1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* Provide a more complete sys/stat header file.
3 Copyright (C) 2005-2013 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
18 /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
20 /* This file is supposed to be used on platforms where <sys/stat.h> is
21 incomplete. It is intended to provide definitions and prototypes
22 needed by an application. Start with what the system provides. */
25 #pragma GCC system_header
29 #if defined __need_system_sys_stat_h
30 /* Special invocation convention. */
32 #include_next <sys/stat.h>
35 /* Normal invocation convention. */
37 #ifndef _GL_SYS_STAT_H
40 May also define off_t to a 64-bit type on native Windows. */
41 #include <sys/types.h>
43 /* Get struct timespec. */
46 /* The include_next requires a split double-inclusion guard. */
47 #include_next <sys/stat.h>
49 #ifndef _GL_SYS_STAT_H
50 #define _GL_SYS_STAT_H
52 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
56 /* The three most frequent use cases of these macros are:
58 * For providing a substitute for a function that is missing on some
59 platforms, but is declared and works fine on the platforms on which
64 _GL_FUNCDECL_SYS (foo, ...);
66 _GL_CXXALIAS_SYS (foo, ...);
67 _GL_CXXALIASWARN (foo);
68 #elif defined GNULIB_POSIXCHECK
72 * For providing a replacement for a function that exists on all platforms,
73 but is broken/insufficient and needs to be replaced on some platforms:
77 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
81 _GL_FUNCDECL_RPL (foo, ...);
82 _GL_CXXALIAS_RPL (foo, ...);
84 _GL_CXXALIAS_SYS (foo, ...);
86 _GL_CXXALIASWARN (foo);
87 #elif defined GNULIB_POSIXCHECK
91 * For providing a replacement for a function that exists on some platforms
92 but is broken/insufficient and needs to be replaced on some of them and
93 is additionally either missing or undeclared on some other platforms:
97 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
101 _GL_FUNCDECL_RPL (foo, ...);
102 _GL_CXXALIAS_RPL (foo, ...);
104 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
105 _GL_FUNCDECL_SYS (foo, ...);
107 _GL_CXXALIAS_SYS (foo, ...);
109 _GL_CXXALIASWARN (foo);
110 #elif defined GNULIB_POSIXCHECK
115 /* _GL_EXTERN_C declaration;
116 performs the declaration with C linkage. */
117 #if defined __cplusplus
118 # define _GL_EXTERN_C extern "C"
120 # define _GL_EXTERN_C extern
123 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
124 declares a replacement function, named rpl_func, with the given prototype,
125 consisting of return type, parameters, and attributes.
127 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
128 _GL_ARG_NONNULL ((1)));
130 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
131 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
132 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
133 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
135 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
136 declares the system function, named func, with the given prototype,
137 consisting of return type, parameters, and attributes.
139 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
140 _GL_ARG_NONNULL ((1)));
142 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
143 _GL_EXTERN_C rettype func parameters_and_attributes
145 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
146 declares a C++ alias called GNULIB_NAMESPACE::func
147 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
149 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
151 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
152 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
153 #if defined __cplusplus && defined GNULIB_NAMESPACE
154 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
155 namespace GNULIB_NAMESPACE \
157 rettype (*const func) parameters = ::rpl_func; \
159 _GL_EXTERN_C int _gl_cxxalias_dummy
161 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
162 _GL_EXTERN_C int _gl_cxxalias_dummy
165 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
166 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
167 except that the C function rpl_func may have a slightly different
168 declaration. A cast is used to silence the "invalid conversion" error
169 that would otherwise occur. */
170 #if defined __cplusplus && defined GNULIB_NAMESPACE
171 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
172 namespace GNULIB_NAMESPACE \
174 rettype (*const func) parameters = \
175 reinterpret_cast<rettype(*)parameters>(::rpl_func); \
177 _GL_EXTERN_C int _gl_cxxalias_dummy
179 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
180 _GL_EXTERN_C int _gl_cxxalias_dummy
183 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
184 declares a C++ alias called GNULIB_NAMESPACE::func
185 that redirects to the system provided function func, if GNULIB_NAMESPACE
188 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
190 #if defined __cplusplus && defined GNULIB_NAMESPACE
191 /* If we were to write
192 rettype (*const func) parameters = ::func;
193 like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
194 better (remove an indirection through a 'static' pointer variable),
195 but then the _GL_CXXALIASWARN macro below would cause a warning not only
196 for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
197 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
198 namespace GNULIB_NAMESPACE \
200 static rettype (*func) parameters = ::func; \
202 _GL_EXTERN_C int _gl_cxxalias_dummy
204 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
205 _GL_EXTERN_C int _gl_cxxalias_dummy
208 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
209 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
210 except that the C function func may have a slightly different declaration.
211 A cast is used to silence the "invalid conversion" error that would
213 #if defined __cplusplus && defined GNULIB_NAMESPACE
214 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
215 namespace GNULIB_NAMESPACE \
217 static rettype (*func) parameters = \
218 reinterpret_cast<rettype(*)parameters>(::func); \
220 _GL_EXTERN_C int _gl_cxxalias_dummy
222 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
223 _GL_EXTERN_C int _gl_cxxalias_dummy
226 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
227 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
228 except that the C function is picked among a set of overloaded functions,
229 namely the one with rettype2 and parameters2. Two consecutive casts
230 are used to silence the "cannot find a match" and "invalid conversion"
231 errors that would otherwise occur. */
232 #if defined __cplusplus && defined GNULIB_NAMESPACE
233 /* The outer cast must be a reinterpret_cast.
234 The inner cast: When the function is defined as a set of overloaded
235 functions, it works as a static_cast<>, choosing the designated variant.
236 When the function is defined as a single variant, it works as a
237 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
238 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
239 namespace GNULIB_NAMESPACE \
241 static rettype (*func) parameters = \
242 reinterpret_cast<rettype(*)parameters>( \
243 (rettype2(*)parameters2)(::func)); \
245 _GL_EXTERN_C int _gl_cxxalias_dummy
247 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
248 _GL_EXTERN_C int _gl_cxxalias_dummy
251 /* _GL_CXXALIASWARN (func);
252 causes a warning to be emitted when ::func is used but not when
253 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
255 #if defined __cplusplus && defined GNULIB_NAMESPACE
256 # define _GL_CXXALIASWARN(func) \
257 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
258 # define _GL_CXXALIASWARN_1(func,namespace) \
259 _GL_CXXALIASWARN_2 (func, namespace)
260 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
261 we enable the warning only when not optimizing. */
263 # define _GL_CXXALIASWARN_2(func,namespace) \
264 _GL_WARN_ON_USE (func, \
265 "The symbol ::" #func " refers to the system function. " \
266 "Use " #namespace "::" #func " instead.")
267 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
268 # define _GL_CXXALIASWARN_2(func,namespace) \
269 extern __typeof__ (func) func
271 # define _GL_CXXALIASWARN_2(func,namespace) \
272 _GL_EXTERN_C int _gl_cxxalias_dummy
275 # define _GL_CXXALIASWARN(func) \
276 _GL_EXTERN_C int _gl_cxxalias_dummy
279 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
280 causes a warning to be emitted when the given overloaded variant of ::func
281 is used but not when GNULIB_NAMESPACE::func is used. */
282 #if defined __cplusplus && defined GNULIB_NAMESPACE
283 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
284 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
286 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
287 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
288 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
289 we enable the warning only when not optimizing. */
291 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
292 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
293 "The symbol ::" #func " refers to the system function. " \
294 "Use " #namespace "::" #func " instead.")
295 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
296 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
297 extern __typeof__ (func) func
299 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
300 _GL_EXTERN_C int _gl_cxxalias_dummy
303 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
304 _GL_EXTERN_C int _gl_cxxalias_dummy
307 #endif /* _GL_CXXDEFS_H */
309 /* The definition of _GL_ARG_NONNULL is copied here. */
310 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
311 that the values passed as arguments n, ..., m must be non-NULL pointers.
312 n = 1 stands for the first argument, n = 2 for the second argument etc. */
313 #ifndef _GL_ARG_NONNULL
314 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
315 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
317 # define _GL_ARG_NONNULL(params)
321 /* The definition of _GL_WARN_ON_USE is copied here. */
322 #ifndef _GL_WARN_ON_USE
324 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
325 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
326 # define _GL_WARN_ON_USE(function, message) \
327 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
328 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
329 /* Verify the existence of the function. */
330 # define _GL_WARN_ON_USE(function, message) \
331 extern __typeof__ (function) function
332 # else /* Unsupported. */
333 # define _GL_WARN_ON_USE(function, message) \
334 _GL_WARN_EXTERN_C int _gl_warn_on_use
338 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
339 is like _GL_WARN_ON_USE (function, "string"), except that the function is
340 declared with the given prototype, consisting of return type, parameters,
342 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
343 not work in this case. */
344 #ifndef _GL_WARN_ON_USE_CXX
345 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
346 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
347 extern rettype function parameters_and_attributes \
348 __attribute__ ((__warning__ (msg)))
349 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
350 /* Verify the existence of the function. */
351 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
352 extern rettype function parameters_and_attributes
353 # else /* Unsupported. */
354 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
355 _GL_WARN_EXTERN_C int _gl_warn_on_use
359 /* _GL_WARN_EXTERN_C declaration;
360 performs the declaration with C linkage. */
361 #ifndef _GL_WARN_EXTERN_C
362 # if defined __cplusplus
363 # define _GL_WARN_EXTERN_C extern "C"
365 # define _GL_WARN_EXTERN_C extern
369 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
370 headers that may declare mkdir(). Native Windows platforms declare mkdir
371 in <io.h> and/or <direct.h>, not in <unistd.h>. */
372 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
373 # include <io.h> /* mingw32, mingw64 */
374 # include <direct.h> /* mingw64, MSVC 9 */
377 /* Native Windows platforms declare umask() in <io.h>. */
378 #if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
382 /* Large File Support on native Windows. */
384 # define stat _stati64
389 # define S_IFIFO _S_IFIFO
394 # define S_IFMT 0170000
397 #if STAT_MACROS_BROKEN
413 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
415 # define S_ISBLK(m) 0
421 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
423 # define S_ISCHR(m) 0
429 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
431 # define S_ISDIR(m) 0
435 #ifndef S_ISDOOR /* Solaris 2.5 and up */
436 # define S_ISDOOR(m) 0
441 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
443 # define S_ISFIFO(m) 0
449 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
451 # define S_ISLNK(m) 0
455 #ifndef S_ISMPB /* V7 */
457 # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
458 # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
460 # define S_ISMPB(m) 0
461 # define S_ISMPC(m) 0
465 #ifndef S_ISMPX /* AIX */
466 # define S_ISMPX(m) 0
469 #ifndef S_ISNAM /* Xenix */
471 # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
473 # define S_ISNAM(m) 0
477 #ifndef S_ISNWK /* HP/UX */
479 # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
481 # define S_ISNWK(m) 0
485 #ifndef S_ISPORT /* Solaris 10 and up */
486 # define S_ISPORT(m) 0
491 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
493 # define S_ISREG(m) 0
499 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
501 # define S_ISSOCK(m) 0
507 # define S_TYPEISMQ(p) 0
511 # define S_TYPEISTMO(p) 0
517 # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
519 # define S_TYPEISSEM(p) 0
525 # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
527 # define S_TYPEISSHM(p) 0
531 /* high performance ("contiguous data") */
533 # define S_ISCTG(p) 0
536 /* Cray DMF (data migration facility): off line, with data */
538 # define S_ISOFD(p) 0
541 /* Cray DMF (data migration facility): off line, with no data */
543 # define S_ISOFL(p) 0
546 /* 4.4BSD whiteout */
548 # define S_ISWHT(m) 0
551 /* If any of the following are undefined,
552 define them to their de facto standard values. */
554 # define S_ISUID 04000
557 # define S_ISGID 02000
560 /* S_ISVTX is a common extension to POSIX. */
562 # define S_ISVTX 01000
565 #if !S_IRUSR && S_IREAD
566 # define S_IRUSR S_IREAD
569 # define S_IRUSR 00400
572 # define S_IRGRP (S_IRUSR >> 3)
575 # define S_IROTH (S_IRUSR >> 6)
578 #if !S_IWUSR && S_IWRITE
579 # define S_IWUSR S_IWRITE
582 # define S_IWUSR 00200
585 # define S_IWGRP (S_IWUSR >> 3)
588 # define S_IWOTH (S_IWUSR >> 6)
591 #if !S_IXUSR && S_IEXEC
592 # define S_IXUSR S_IEXEC
595 # define S_IXUSR 00100
598 # define S_IXGRP (S_IXUSR >> 3)
601 # define S_IXOTH (S_IXUSR >> 6)
605 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
608 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
611 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
614 /* S_IXUGO is a common extension to POSIX. */
616 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
620 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
623 /* Macros for futimens and utimensat. */
625 # define UTIME_NOW (-1)
626 # define UTIME_OMIT (-2)
632 _GL_FUNCDECL_SYS (fchmodat, int,
633 (int fd, char const *file, mode_t mode, int flag)
634 _GL_ARG_NONNULL ((2)));
636 _GL_CXXALIAS_SYS (fchmodat, int,
637 (int fd, char const *file, mode_t mode, int flag));
638 _GL_CXXALIASWARN (fchmodat);
639 #elif defined GNULIB_POSIXCHECK
641 # if HAVE_RAW_DECL_FCHMODAT
642 _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
643 "use gnulib module openat for portability");
650 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
652 # define fstat rpl_fstat
654 _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
655 _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
657 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
659 _GL_CXXALIASWARN (fstat);
661 /* Above, we define stat to _stati64. */
662 # define fstat _fstati64
663 #elif defined GNULIB_POSIXCHECK
665 # if HAVE_RAW_DECL_FSTAT
666 _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
667 "use gnulib module fstat for portability");
674 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
676 # define fstatat rpl_fstatat
678 _GL_FUNCDECL_RPL (fstatat, int,
679 (int fd, char const *name, struct stat *st, int flags)
680 _GL_ARG_NONNULL ((2, 3)));
681 _GL_CXXALIAS_RPL (fstatat, int,
682 (int fd, char const *name, struct stat *st, int flags));
685 _GL_FUNCDECL_SYS (fstatat, int,
686 (int fd, char const *name, struct stat *st, int flags)
687 _GL_ARG_NONNULL ((2, 3)));
689 _GL_CXXALIAS_SYS (fstatat, int,
690 (int fd, char const *name, struct stat *st, int flags));
692 _GL_CXXALIASWARN (fstatat);
693 #elif defined GNULIB_POSIXCHECK
695 # if HAVE_RAW_DECL_FSTATAT
696 _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
697 "use gnulib module openat for portability");
703 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
704 implementation relies on futimesat, which on Solaris 10 makes an invocation
705 to futimens that is meant to invoke the libc's futimens(), not gnulib's
707 # if 0 || (!1 && defined __sun)
708 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
710 # define futimens rpl_futimens
712 _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
713 _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
716 _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
718 _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
721 _GL_CXXALIASWARN (futimens);
723 #elif defined GNULIB_POSIXCHECK
725 # if HAVE_RAW_DECL_FUTIMENS
726 _GL_WARN_ON_USE (futimens, "futimens is not portable - "
727 "use gnulib module futimens for portability");
733 /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
734 denotes a symbolic link. */
736 /* The lchmod replacement follows symbolic links. Callers should take
737 this into account; lchmod should be applied only to arguments that
738 are known to not be symbolic links. On hosts that lack lchmod,
739 this can lead to race conditions between the check and the
740 invocation of lchmod, but we know of no workarounds that are
741 reliable in general. You might try requesting support for lchmod
742 from your operating system supplier. */
743 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
744 # define lchmod chmod
746 /* Need to cast, because on mingw, the second parameter of chmod is
748 _GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
749 (const char *filename, mode_t mode));
751 # if 0 /* assume already declared */
752 _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
753 _GL_ARG_NONNULL ((1)));
755 _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
758 _GL_CXXALIASWARN (lchmod);
760 #elif defined GNULIB_POSIXCHECK
762 # if HAVE_RAW_DECL_LCHMOD
763 _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
764 "use gnulib module lchmod for portability");
771 /* mingw does not support symlinks, therefore it does not have lstat. But
772 without links, stat does just fine. */
773 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
776 _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
778 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
780 # define lstat rpl_lstat
782 _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
783 _GL_ARG_NONNULL ((1, 2)));
784 _GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
786 _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
789 _GL_CXXALIASWARN (lstat);
791 #elif defined GNULIB_POSIXCHECK
793 # if HAVE_RAW_DECL_LSTAT
794 _GL_WARN_ON_USE (lstat, "lstat is unportable - "
795 "use gnulib module lstat for portability");
801 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
803 # define mkdir rpl_mkdir
805 _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
806 _GL_ARG_NONNULL ((1)));
807 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
809 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
810 Additionally, it declares _mkdir (and depending on compile flags, an
811 alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
812 which are included above. */
813 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
815 # if !GNULIB_defined_rpl_mkdir
817 rpl_mkdir (char const *name, mode_t mode)
819 return _mkdir (name);
821 # define GNULIB_defined_rpl_mkdir 1
824 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
825 # define mkdir rpl_mkdir
827 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
829 _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
832 _GL_CXXALIASWARN (mkdir);
837 _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
838 _GL_ARG_NONNULL ((2)));
840 _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
841 _GL_CXXALIASWARN (mkdirat);
842 #elif defined GNULIB_POSIXCHECK
844 # if HAVE_RAW_DECL_MKDIRAT
845 _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
846 "use gnulib module openat for portability");
853 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
855 # define mkfifo rpl_mkfifo
857 _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
858 _GL_ARG_NONNULL ((1)));
859 _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
862 _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
863 _GL_ARG_NONNULL ((1)));
865 _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
867 _GL_CXXALIASWARN (mkfifo);
868 #elif defined GNULIB_POSIXCHECK
870 # if HAVE_RAW_DECL_MKFIFO
871 _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
872 "use gnulib module mkfifo for portability");
879 _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
880 _GL_ARG_NONNULL ((2)));
882 _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
883 _GL_CXXALIASWARN (mkfifoat);
884 #elif defined GNULIB_POSIXCHECK
886 # if HAVE_RAW_DECL_MKFIFOAT
887 _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
888 "use gnulib module mkfifoat for portability");
895 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
897 # define mknod rpl_mknod
899 _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
900 _GL_ARG_NONNULL ((1)));
901 _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
904 _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
905 _GL_ARG_NONNULL ((1)));
907 /* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
908 _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
910 _GL_CXXALIASWARN (mknod);
911 #elif defined GNULIB_POSIXCHECK
913 # if HAVE_RAW_DECL_MKNOD
914 _GL_WARN_ON_USE (mknod, "mknod is not portable - "
915 "use gnulib module mknod for portability");
922 _GL_FUNCDECL_SYS (mknodat, int,
923 (int fd, char const *file, mode_t mode, dev_t dev)
924 _GL_ARG_NONNULL ((2)));
926 _GL_CXXALIAS_SYS (mknodat, int,
927 (int fd, char const *file, mode_t mode, dev_t dev));
928 _GL_CXXALIASWARN (mknodat);
929 #elif defined GNULIB_POSIXCHECK
931 # if HAVE_RAW_DECL_MKNODAT
932 _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
933 "use gnulib module mkfifoat for portability");
940 /* We can't use the object-like #define stat rpl_stat, because of
941 struct stat. This means that rpl_stat will not be used if the user
942 does (stat)(a,b). Oh well. */
943 # if defined _AIX && defined stat && defined _LARGE_FILES
944 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
945 so we have to replace stat64() instead of stat(). */
947 # define stat64(name, st) rpl_stat (name, st)
949 /* Above, we define stat to _stati64. */
950 # if defined __MINGW32__ && defined _stati64
951 # ifndef _USE_32BIT_TIME_T
952 /* The system headers define _stati64 to _stat64. */
954 # define _stat64(name, st) rpl_stat (name, st)
956 # elif defined _MSC_VER && defined _stati64
957 # ifdef _USE_32BIT_TIME_T
958 /* The system headers define _stati64 to _stat32i64. */
960 # define _stat32i64(name, st) rpl_stat (name, st)
962 /* The system headers define _stati64 to _stat64. */
964 # define _stat64(name, st) rpl_stat (name, st)
968 # define _stati64(name, st) rpl_stat (name, st)
970 # elif defined __MINGW32__ && defined stat
971 # ifdef _USE_32BIT_TIME_T
972 /* The system headers define stat to _stat32i64. */
974 # define _stat32i64(name, st) rpl_stat (name, st)
976 /* The system headers define stat to _stat64. */
978 # define _stat64(name, st) rpl_stat (name, st)
980 # elif defined _MSC_VER && defined stat
981 # ifdef _USE_32BIT_TIME_T
982 /* The system headers define stat to _stat32. */
984 # define _stat32(name, st) rpl_stat (name, st)
986 /* The system headers define stat to _stat64i32. */
988 # define _stat64i32(name, st) rpl_stat (name, st)
990 # else /* !(_AIX ||__MINGW32__ || _MSC_VER) */
992 # define stat(name, st) rpl_stat (name, st)
993 # endif /* !_LARGE_FILES */
994 _GL_EXTERN_C int stat (const char *name, struct stat *buf)
995 _GL_ARG_NONNULL ((1, 2));
997 #elif defined GNULIB_POSIXCHECK
999 # if HAVE_RAW_DECL_STAT
1000 _GL_WARN_ON_USE (stat, "stat is unportable - "
1001 "use gnulib module stat for portability");
1007 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
1008 implementation relies on futimesat, which on Solaris 10 makes an invocation
1009 to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
1011 # if 0 || (!1 && defined __sun)
1012 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1014 # define utimensat rpl_utimensat
1016 _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
1017 struct timespec const times[2], int flag)
1018 _GL_ARG_NONNULL ((2)));
1019 _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
1020 struct timespec const times[2], int flag));
1023 _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
1024 struct timespec const times[2], int flag)
1025 _GL_ARG_NONNULL ((2)));
1027 _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
1028 struct timespec const times[2], int flag));
1031 _GL_CXXALIASWARN (utimensat);
1033 #elif defined GNULIB_POSIXCHECK
1035 # if HAVE_RAW_DECL_UTIMENSAT
1036 _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
1037 "use gnulib module utimensat for portability");
1042 #endif /* _GL_SYS_STAT_H */
1043 #endif /* _GL_SYS_STAT_H */