1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
2 /* -*- buffer-read-only: t -*- vi: set ro: */
3 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
4 /* Provide a more complete sys/stat header file.
5 Copyright (C) 2005-2011 Free Software Foundation, Inc.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
21 /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
23 /* This file is supposed to be used on platforms where <sys/stat.h> is
24 incomplete. It is intended to provide definitions and prototypes
25 needed by an application. Start with what the system provides. */
28 #pragma GCC system_header
32 #if defined __need_system_sys_stat_h
33 /* Special invocation convention. */
35 #include_next <sys/stat.h>
38 /* Normal invocation convention. */
40 #ifndef _GL_SYS_STAT_H
43 #include <sys/types.h>
45 /* Get struct timespec. */
48 /* The include_next requires a split double-inclusion guard. */
49 #include_next <sys/stat.h>
51 #ifndef _GL_SYS_STAT_H
52 #define _GL_SYS_STAT_H
54 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
58 /* The three most frequent use cases of these macros are:
60 * For providing a substitute for a function that is missing on some
61 platforms, but is declared and works fine on the platforms on which
66 _GL_FUNCDECL_SYS (foo, ...);
68 _GL_CXXALIAS_SYS (foo, ...);
69 _GL_CXXALIASWARN (foo);
70 #elif defined GNULIB_POSIXCHECK
74 * For providing a replacement for a function that exists on all platforms,
75 but is broken/insufficient and needs to be replaced on some platforms:
79 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
83 _GL_FUNCDECL_RPL (foo, ...);
84 _GL_CXXALIAS_RPL (foo, ...);
86 _GL_CXXALIAS_SYS (foo, ...);
88 _GL_CXXALIASWARN (foo);
89 #elif defined GNULIB_POSIXCHECK
93 * For providing a replacement for a function that exists on some platforms
94 but is broken/insufficient and needs to be replaced on some of them and
95 is additionally either missing or undeclared on some other platforms:
99 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
103 _GL_FUNCDECL_RPL (foo, ...);
104 _GL_CXXALIAS_RPL (foo, ...);
106 # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
107 _GL_FUNCDECL_SYS (foo, ...);
109 _GL_CXXALIAS_SYS (foo, ...);
111 _GL_CXXALIASWARN (foo);
112 #elif defined GNULIB_POSIXCHECK
117 /* _GL_EXTERN_C declaration;
118 performs the declaration with C linkage. */
119 #if defined __cplusplus
120 # define _GL_EXTERN_C extern "C"
122 # define _GL_EXTERN_C extern
125 /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
126 declares a replacement function, named rpl_func, with the given prototype,
127 consisting of return type, parameters, and attributes.
129 _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
130 _GL_ARG_NONNULL ((1)));
132 #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
133 _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
134 #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
135 _GL_EXTERN_C rettype rpl_func parameters_and_attributes
137 /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
138 declares the system function, named func, with the given prototype,
139 consisting of return type, parameters, and attributes.
141 _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
142 _GL_ARG_NONNULL ((1)));
144 #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
145 _GL_EXTERN_C rettype func parameters_and_attributes
147 /* _GL_CXXALIAS_RPL (func, rettype, parameters);
148 declares a C++ alias called GNULIB_NAMESPACE::func
149 that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
151 _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
153 #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
154 _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
155 #if defined __cplusplus && defined GNULIB_NAMESPACE
156 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
157 namespace GNULIB_NAMESPACE \
159 rettype (*const func) parameters = ::rpl_func; \
161 _GL_EXTERN_C int _gl_cxxalias_dummy
163 # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
164 _GL_EXTERN_C int _gl_cxxalias_dummy
167 /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
168 is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
169 except that the C function rpl_func may have a slightly different
170 declaration. A cast is used to silence the "invalid conversion" error
171 that would otherwise occur. */
172 #if defined __cplusplus && defined GNULIB_NAMESPACE
173 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
174 namespace GNULIB_NAMESPACE \
176 rettype (*const func) parameters = \
177 reinterpret_cast<rettype(*)parameters>(::rpl_func); \
179 _GL_EXTERN_C int _gl_cxxalias_dummy
181 # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
182 _GL_EXTERN_C int _gl_cxxalias_dummy
185 /* _GL_CXXALIAS_SYS (func, rettype, parameters);
186 declares a C++ alias called GNULIB_NAMESPACE::func
187 that redirects to the system provided function func, if GNULIB_NAMESPACE
190 _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
192 #if defined __cplusplus && defined GNULIB_NAMESPACE
193 /* If we were to write
194 rettype (*const func) parameters = ::func;
195 like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
196 better (remove an indirection through a 'static' pointer variable),
197 but then the _GL_CXXALIASWARN macro below would cause a warning not only
198 for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
199 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
200 namespace GNULIB_NAMESPACE \
202 static rettype (*func) parameters = ::func; \
204 _GL_EXTERN_C int _gl_cxxalias_dummy
206 # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
207 _GL_EXTERN_C int _gl_cxxalias_dummy
210 /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
211 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
212 except that the C function func may have a slightly different declaration.
213 A cast is used to silence the "invalid conversion" error that would
215 #if defined __cplusplus && defined GNULIB_NAMESPACE
216 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
217 namespace GNULIB_NAMESPACE \
219 static rettype (*func) parameters = \
220 reinterpret_cast<rettype(*)parameters>(::func); \
222 _GL_EXTERN_C int _gl_cxxalias_dummy
224 # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
225 _GL_EXTERN_C int _gl_cxxalias_dummy
228 /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
229 is like _GL_CXXALIAS_SYS (func, rettype, parameters);
230 except that the C function is picked among a set of overloaded functions,
231 namely the one with rettype2 and parameters2. Two consecutive casts
232 are used to silence the "cannot find a match" and "invalid conversion"
233 errors that would otherwise occur. */
234 #if defined __cplusplus && defined GNULIB_NAMESPACE
235 /* The outer cast must be a reinterpret_cast.
236 The inner cast: When the function is defined as a set of overloaded
237 functions, it works as a static_cast<>, choosing the designated variant.
238 When the function is defined as a single variant, it works as a
239 reinterpret_cast<>. The parenthesized cast syntax works both ways. */
240 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
241 namespace GNULIB_NAMESPACE \
243 static rettype (*func) parameters = \
244 reinterpret_cast<rettype(*)parameters>( \
245 (rettype2(*)parameters2)(::func)); \
247 _GL_EXTERN_C int _gl_cxxalias_dummy
249 # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
250 _GL_EXTERN_C int _gl_cxxalias_dummy
253 /* _GL_CXXALIASWARN (func);
254 causes a warning to be emitted when ::func is used but not when
255 GNULIB_NAMESPACE::func is used. func must be defined without overloaded
257 #if defined __cplusplus && defined GNULIB_NAMESPACE
258 # define _GL_CXXALIASWARN(func) \
259 _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
260 # define _GL_CXXALIASWARN_1(func,namespace) \
261 _GL_CXXALIASWARN_2 (func, namespace)
262 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
263 we enable the warning only when not optimizing. */
265 # define _GL_CXXALIASWARN_2(func,namespace) \
266 _GL_WARN_ON_USE (func, \
267 "The symbol ::" #func " refers to the system function. " \
268 "Use " #namespace "::" #func " instead.")
269 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
270 # define _GL_CXXALIASWARN_2(func,namespace) \
271 extern __typeof__ (func) func
273 # define _GL_CXXALIASWARN_2(func,namespace) \
274 _GL_EXTERN_C int _gl_cxxalias_dummy
277 # define _GL_CXXALIASWARN(func) \
278 _GL_EXTERN_C int _gl_cxxalias_dummy
281 /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
282 causes a warning to be emitted when the given overloaded variant of ::func
283 is used but not when GNULIB_NAMESPACE::func is used. */
284 #if defined __cplusplus && defined GNULIB_NAMESPACE
285 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
286 _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
288 # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
289 _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
290 /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
291 we enable the warning only when not optimizing. */
293 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
294 _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
295 "The symbol ::" #func " refers to the system function. " \
296 "Use " #namespace "::" #func " instead.")
297 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
298 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
299 extern __typeof__ (func) func
301 # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
302 _GL_EXTERN_C int _gl_cxxalias_dummy
305 # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
306 _GL_EXTERN_C int _gl_cxxalias_dummy
309 #endif /* _GL_CXXDEFS_H */
311 /* The definition of _GL_ARG_NONNULL is copied here. */
312 /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
313 that the values passed as arguments n, ..., m must be non-NULL pointers.
314 n = 1 stands for the first argument, n = 2 for the second argument etc. */
315 #ifndef _GL_ARG_NONNULL
316 # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
317 # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
319 # define _GL_ARG_NONNULL(params)
323 /* The definition of _GL_WARN_ON_USE is copied here. */
324 #ifndef _GL_WARN_ON_USE
326 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
327 /* A compiler attribute is available in gcc versions 4.3.0 and later. */
328 # define _GL_WARN_ON_USE(function, message) \
329 extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
330 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
331 /* Verify the existence of the function. */
332 # define _GL_WARN_ON_USE(function, message) \
333 extern __typeof__ (function) function
334 # else /* Unsupported. */
335 # define _GL_WARN_ON_USE(function, message) \
336 _GL_WARN_EXTERN_C int _gl_warn_on_use
340 /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
341 is like _GL_WARN_ON_USE (function, "string"), except that the function is
342 declared with the given prototype, consisting of return type, parameters,
344 This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
345 not work in this case. */
346 #ifndef _GL_WARN_ON_USE_CXX
347 # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
348 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
349 extern rettype function parameters_and_attributes \
350 __attribute__ ((__warning__ (msg)))
351 # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
352 /* Verify the existence of the function. */
353 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
354 extern rettype function parameters_and_attributes
355 # else /* Unsupported. */
356 # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
357 _GL_WARN_EXTERN_C int _gl_warn_on_use
361 /* _GL_WARN_EXTERN_C declaration;
362 performs the declaration with C linkage. */
363 #ifndef _GL_WARN_EXTERN_C
364 # if defined __cplusplus
365 # define _GL_WARN_EXTERN_C extern "C"
367 # define _GL_WARN_EXTERN_C extern
371 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
372 headers that may declare mkdir(). */
373 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
374 # include <io.h> /* mingw32, mingw64 */
375 # include <direct.h> /* mingw64 */
379 # define S_IFMT 0170000
382 #if STAT_MACROS_BROKEN
398 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
400 # define S_ISBLK(m) 0
406 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
408 # define S_ISCHR(m) 0
414 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
416 # define S_ISDIR(m) 0
420 #ifndef S_ISDOOR /* Solaris 2.5 and up */
421 # define S_ISDOOR(m) 0
426 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
428 # define S_ISFIFO(m) 0
434 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
436 # define S_ISLNK(m) 0
440 #ifndef S_ISMPB /* V7 */
442 # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
443 # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
445 # define S_ISMPB(m) 0
446 # define S_ISMPC(m) 0
450 #ifndef S_ISNAM /* Xenix */
452 # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
454 # define S_ISNAM(m) 0
458 #ifndef S_ISNWK /* HP/UX */
460 # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
462 # define S_ISNWK(m) 0
466 #ifndef S_ISPORT /* Solaris 10 and up */
467 # define S_ISPORT(m) 0
472 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
474 # define S_ISREG(m) 0
480 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
482 # define S_ISSOCK(m) 0
488 # define S_TYPEISMQ(p) 0
492 # define S_TYPEISTMO(p) 0
498 # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
500 # define S_TYPEISSEM(p) 0
506 # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
508 # define S_TYPEISSHM(p) 0
512 /* high performance ("contiguous data") */
514 # define S_ISCTG(p) 0
517 /* Cray DMF (data migration facility): off line, with data */
519 # define S_ISOFD(p) 0
522 /* Cray DMF (data migration facility): off line, with no data */
524 # define S_ISOFL(p) 0
527 /* 4.4BSD whiteout */
529 # define S_ISWHT(m) 0
532 /* If any of the following are undefined,
533 define them to their de facto standard values. */
535 # define S_ISUID 04000
538 # define S_ISGID 02000
541 /* S_ISVTX is a common extension to POSIX. */
543 # define S_ISVTX 01000
546 #if !S_IRUSR && S_IREAD
547 # define S_IRUSR S_IREAD
550 # define S_IRUSR 00400
553 # define S_IRGRP (S_IRUSR >> 3)
556 # define S_IROTH (S_IRUSR >> 6)
559 #if !S_IWUSR && S_IWRITE
560 # define S_IWUSR S_IWRITE
563 # define S_IWUSR 00200
566 # define S_IWGRP (S_IWUSR >> 3)
569 # define S_IWOTH (S_IWUSR >> 6)
572 #if !S_IXUSR && S_IEXEC
573 # define S_IXUSR S_IEXEC
576 # define S_IXUSR 00100
579 # define S_IXGRP (S_IXUSR >> 3)
582 # define S_IXOTH (S_IXUSR >> 6)
586 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
589 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
592 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
595 /* S_IXUGO is a common extension to POSIX. */
597 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
601 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
604 /* Macros for futimens and utimensat. */
606 # define UTIME_NOW (-1)
607 # define UTIME_OMIT (-2)
613 _GL_FUNCDECL_SYS (fchmodat, int,
614 (int fd, char const *file, mode_t mode, int flag)
615 _GL_ARG_NONNULL ((2)));
617 _GL_CXXALIAS_SYS (fchmodat, int,
618 (int fd, char const *file, mode_t mode, int flag));
619 _GL_CXXALIASWARN (fchmodat);
620 #elif defined GNULIB_POSIXCHECK
622 # if HAVE_RAW_DECL_FCHMODAT
623 _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
624 "use gnulib module openat for portability");
630 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
631 # define fstat rpl_fstat
633 _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
634 _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
636 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
638 _GL_CXXALIASWARN (fstat);
643 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
645 # define fstatat rpl_fstatat
647 _GL_FUNCDECL_RPL (fstatat, int,
648 (int fd, char const *name, struct stat *st, int flags)
649 _GL_ARG_NONNULL ((2, 3)));
650 _GL_CXXALIAS_RPL (fstatat, int,
651 (int fd, char const *name, struct stat *st, int flags));
654 _GL_FUNCDECL_SYS (fstatat, int,
655 (int fd, char const *name, struct stat *st, int flags)
656 _GL_ARG_NONNULL ((2, 3)));
658 _GL_CXXALIAS_SYS (fstatat, int,
659 (int fd, char const *name, struct stat *st, int flags));
661 _GL_CXXALIASWARN (fstatat);
662 #elif defined GNULIB_POSIXCHECK
664 # if HAVE_RAW_DECL_FSTATAT
665 _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
666 "use gnulib module openat for portability");
672 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
673 implementation relies on futimesat, which on Solaris 10 makes an invocation
674 to futimens that is meant to invoke the libc's futimens(), not gnulib's
676 # if 0 || (!1 && defined __sun)
677 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
679 # define futimens rpl_futimens
681 _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
682 _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
685 _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
687 _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
690 _GL_CXXALIASWARN (futimens);
692 #elif defined GNULIB_POSIXCHECK
694 # if HAVE_RAW_DECL_FUTIMENS
695 _GL_WARN_ON_USE (futimens, "futimens is not portable - "
696 "use gnulib module futimens for portability");
702 /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
703 denotes a symbolic link. */
705 /* The lchmod replacement follows symbolic links. Callers should take
706 this into account; lchmod should be applied only to arguments that
707 are known to not be symbolic links. On hosts that lack lchmod,
708 this can lead to race conditions between the check and the
709 invocation of lchmod, but we know of no workarounds that are
710 reliable in general. You might try requesting support for lchmod
711 from your operating system supplier. */
712 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
713 # define lchmod chmod
715 /* Need to cast, because on mingw, the second parameter of chmod is
717 _GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
718 (const char *filename, mode_t mode));
720 # if 0 /* assume already declared */
721 _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
722 _GL_ARG_NONNULL ((1)));
724 _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
727 _GL_CXXALIASWARN (lchmod);
729 #elif defined GNULIB_POSIXCHECK
731 # if HAVE_RAW_DECL_LCHMOD
732 _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
733 "use gnulib module lchmod for portability");
740 /* mingw does not support symlinks, therefore it does not have lstat. But
741 without links, stat does just fine. */
742 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
745 _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
747 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
749 # define lstat rpl_lstat
751 _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
752 _GL_ARG_NONNULL ((1, 2)));
753 _GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
755 _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
758 _GL_CXXALIASWARN (lstat);
760 #elif defined GNULIB_POSIXCHECK
762 # if HAVE_RAW_DECL_LSTAT
763 _GL_WARN_ON_USE (lstat, "lstat is unportable - "
764 "use gnulib module lstat for portability");
770 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
772 # define mkdir rpl_mkdir
774 _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
775 _GL_ARG_NONNULL ((1)));
776 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
778 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
779 Additionally, it declares _mkdir (and depending on compile flags, an
780 alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
781 which are included above. */
782 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
784 # if !GNULIB_defined_rpl_mkdir
786 rpl_mkdir (char const *name, mode_t mode)
788 return _mkdir (name);
790 # define GNULIB_defined_rpl_mkdir 1
793 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
794 # define mkdir rpl_mkdir
796 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
798 _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
801 _GL_CXXALIASWARN (mkdir);
806 _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
807 _GL_ARG_NONNULL ((2)));
809 _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
810 _GL_CXXALIASWARN (mkdirat);
811 #elif defined GNULIB_POSIXCHECK
813 # if HAVE_RAW_DECL_MKDIRAT
814 _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
815 "use gnulib module openat for portability");
822 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
824 # define mkfifo rpl_mkfifo
826 _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
827 _GL_ARG_NONNULL ((1)));
828 _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
831 _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
832 _GL_ARG_NONNULL ((1)));
834 _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
836 _GL_CXXALIASWARN (mkfifo);
837 #elif defined GNULIB_POSIXCHECK
839 # if HAVE_RAW_DECL_MKFIFO
840 _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
841 "use gnulib module mkfifo for portability");
848 _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
849 _GL_ARG_NONNULL ((2)));
851 _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
852 _GL_CXXALIASWARN (mkfifoat);
853 #elif defined GNULIB_POSIXCHECK
855 # if HAVE_RAW_DECL_MKFIFOAT
856 _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
857 "use gnulib module mkfifoat for portability");
864 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
866 # define mknod rpl_mknod
868 _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
869 _GL_ARG_NONNULL ((1)));
870 _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
873 _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
874 _GL_ARG_NONNULL ((1)));
876 /* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
877 _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
879 _GL_CXXALIASWARN (mknod);
880 #elif defined GNULIB_POSIXCHECK
882 # if HAVE_RAW_DECL_MKNOD
883 _GL_WARN_ON_USE (mknod, "mknod is not portable - "
884 "use gnulib module mknod for portability");
891 _GL_FUNCDECL_SYS (mknodat, int,
892 (int fd, char const *file, mode_t mode, dev_t dev)
893 _GL_ARG_NONNULL ((2)));
895 _GL_CXXALIAS_SYS (mknodat, int,
896 (int fd, char const *file, mode_t mode, dev_t dev));
897 _GL_CXXALIASWARN (mknodat);
898 #elif defined GNULIB_POSIXCHECK
900 # if HAVE_RAW_DECL_MKNODAT
901 _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
902 "use gnulib module mkfifoat for portability");
909 /* We can't use the object-like #define stat rpl_stat, because of
910 struct stat. This means that rpl_stat will not be used if the user
911 does (stat)(a,b). Oh well. */
914 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
915 so we have to replace stat64() instead of stat(). */
918 # define stat64(name, st) rpl_stat (name, st)
919 # else /* !_LARGE_FILES */
920 # define stat(name, st) rpl_stat (name, st)
921 # endif /* !_LARGE_FILES */
922 _GL_EXTERN_C int stat (const char *name, struct stat *buf)
923 _GL_ARG_NONNULL ((1, 2));
925 #elif defined GNULIB_POSIXCHECK
927 # if HAVE_RAW_DECL_STAT
928 _GL_WARN_ON_USE (stat, "stat is unportable - "
929 "use gnulib module stat for portability");
935 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
936 implementation relies on futimesat, which on Solaris 10 makes an invocation
937 to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
939 # if 0 || (!1 && defined __sun)
940 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
942 # define utimensat rpl_utimensat
944 _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
945 struct timespec const times[2], int flag)
946 _GL_ARG_NONNULL ((2)));
947 _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
948 struct timespec const times[2], int flag));
951 _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
952 struct timespec const times[2], int flag)
953 _GL_ARG_NONNULL ((2)));
955 _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
956 struct timespec const times[2], int flag));
959 _GL_CXXALIASWARN (utimensat);
961 #elif defined GNULIB_POSIXCHECK
963 # if HAVE_RAW_DECL_UTIMENSAT
964 _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
965 "use gnulib module utimensat for portability");
970 #endif /* _GL_SYS_STAT_H */
971 #endif /* _GL_SYS_STAT_H */