1 /* Provide a more complete sys/stat.h header file.
2 Copyright (C) 2005-2020 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
19 /* This file is supposed to be used on platforms where <sys/stat.h> is
20 incomplete. It is intended to provide definitions and prototypes
21 needed by an application. Start with what the system provides. */
24 @PRAGMA_SYSTEM_HEADER@
28 #if defined __need_system_sys_stat_h
29 /* Special invocation convention. */
31 #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
34 /* Normal invocation convention. */
36 #ifndef _@GUARD_PREFIX@_SYS_STAT_H
39 May also define off_t to a 64-bit type on native Windows. */
40 #include <sys/types.h>
42 /* Get struct timespec. */
45 /* The include_next requires a split double-inclusion guard. */
46 #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
48 #ifndef _@GUARD_PREFIX@_SYS_STAT_H
49 #define _@GUARD_PREFIX@_SYS_STAT_H
51 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
53 /* The definition of _GL_ARG_NONNULL is copied here. */
55 /* The definition of _GL_WARN_ON_USE is copied here. */
57 /* Before doing "#define mknod rpl_mknod" below, we need to include all
58 headers that may declare mknod(). OS/2 kLIBC declares mknod() in
59 <unistd.h>, not in <sys/stat.h>. */
64 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
65 headers that may declare mkdir(). Native Windows platforms declare mkdir
66 in <io.h> and/or <direct.h>, not in <sys/stat.h>. */
67 #if defined _WIN32 && ! defined __CYGWIN__
68 # include <io.h> /* mingw32, mingw64 */
69 # include <direct.h> /* mingw64, MSVC 9 */
72 /* Native Windows platforms declare umask() in <io.h>. */
73 #if 0 && (defined _WIN32 && ! defined __CYGWIN__)
77 /* Large File Support on native Windows. */
78 #if @WINDOWS_64_BIT_ST_SIZE@
79 # define stat _stati64
82 /* Optionally, override 'struct stat' on native Windows. */
83 #if @GNULIB_OVERRIDES_STRUCT_STAT@
87 # define stat rpl_stat
89 /* Provoke a clear link error if stat() is used as a function and
90 module 'stat' is not in use. */
91 # define stat stat_used_without_requesting_gnulib_module_stat
94 # if !GNULIB_defined_struct_stat
103 # else /* uid_t is not defined by default on native Windows. */
108 # else /* gid_t is not defined by default on native Windows. */
114 blksize_t st_blksize
;
118 # if @WINDOWS_STAT_TIMESPEC@
119 struct timespec st_atim
;
120 struct timespec st_mtim
;
121 struct timespec st_ctim
;
128 # if @WINDOWS_STAT_TIMESPEC@
129 # define st_atime st_atim.tv_sec
130 # define st_mtime st_mtim.tv_sec
131 # define st_ctime st_ctim.tv_sec
132 /* Indicator, for gnulib internal purposes. */
133 # define _GL_WINDOWS_STAT_TIMESPEC 1
135 # define GNULIB_defined_struct_stat 1
138 /* Other possible values of st_mode. */
140 # define _S_IFBLK 0x6000
143 # define _S_IFLNK 0xA000
146 # define _S_IFSOCK 0xC000
153 # define S_IFIFO _S_IFIFO
158 # define S_IFMT 0170000
161 #if STAT_MACROS_BROKEN
177 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
179 # define S_ISBLK(m) 0
185 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
187 # define S_ISCHR(m) 0
193 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
195 # define S_ISDIR(m) 0
199 #ifndef S_ISDOOR /* Solaris 2.5 and up */
200 # define S_ISDOOR(m) 0
205 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
207 # define S_ISFIFO(m) 0
213 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
215 # define S_ISLNK(m) 0
219 #ifndef S_ISMPB /* V7 */
221 # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
222 # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
224 # define S_ISMPB(m) 0
225 # define S_ISMPC(m) 0
229 #ifndef S_ISMPX /* AIX */
230 # define S_ISMPX(m) 0
233 #ifndef S_ISNAM /* Xenix */
235 # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
237 # define S_ISNAM(m) 0
241 #ifndef S_ISNWK /* HP/UX */
243 # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
245 # define S_ISNWK(m) 0
249 #ifndef S_ISPORT /* Solaris 10 and up */
250 # define S_ISPORT(m) 0
255 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
257 # define S_ISREG(m) 0
263 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
265 # define S_ISSOCK(m) 0
271 # define S_TYPEISMQ(p) 0
275 # define S_TYPEISTMO(p) 0
281 # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
283 # define S_TYPEISSEM(p) 0
289 # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
291 # define S_TYPEISSHM(p) 0
295 /* high performance ("contiguous data") */
297 # define S_ISCTG(p) 0
300 /* Cray DMF (data migration facility): off line, with data */
302 # define S_ISOFD(p) 0
305 /* Cray DMF (data migration facility): off line, with no data */
307 # define S_ISOFL(p) 0
310 /* 4.4BSD whiteout */
312 # define S_ISWHT(m) 0
315 /* If any of the following are undefined,
316 define them to their de facto standard values. */
318 # define S_ISUID 04000
321 # define S_ISGID 02000
324 /* S_ISVTX is a common extension to POSIX. */
326 # define S_ISVTX 01000
329 #if !S_IRUSR && S_IREAD
330 # define S_IRUSR S_IREAD
333 # define S_IRUSR 00400
336 # define S_IRGRP (S_IRUSR >> 3)
339 # define S_IROTH (S_IRUSR >> 6)
342 #if !S_IWUSR && S_IWRITE
343 # define S_IWUSR S_IWRITE
346 # define S_IWUSR 00200
349 # define S_IWGRP (S_IWUSR >> 3)
352 # define S_IWOTH (S_IWUSR >> 6)
355 #if !S_IXUSR && S_IEXEC
356 # define S_IXUSR S_IEXEC
359 # define S_IXUSR 00100
362 # define S_IXGRP (S_IXUSR >> 3)
365 # define S_IXOTH (S_IXUSR >> 6)
369 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
372 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
375 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
378 /* Although S_IXUGO and S_IRWXUGO are not specified by POSIX and are
379 not implemented in GNU/Linux, some Gnulib-using apps use the macros. */
381 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
384 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
387 /* Macros for futimens and utimensat. */
389 # define UTIME_NOW (-1)
390 # define UTIME_OMIT (-2)
394 /* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
395 required. In C++ with GNULIB_NAMESPACE, avoid differences between
396 platforms by defining GNULIB_NAMESPACE::chmod always. */
397 #if defined _WIN32 && !defined __CYGWIN__
398 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
400 # define chmod _chmod
402 /* Need to cast, because in mingw the last argument is 'int mode'. */
403 _GL_CXXALIAS_MDA_CAST (chmod
, int, (const char *filename
, mode_t mode
));
405 _GL_CXXALIAS_SYS (chmod
, int, (const char *filename
, mode_t mode
));
407 _GL_CXXALIASWARN (chmod
);
410 #if @GNULIB_FCHMODAT@
411 # if @REPLACE_FCHMODAT@
412 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
414 # define fchmodat rpl_fchmodat
416 _GL_FUNCDECL_RPL (fchmodat
, int,
417 (int fd
, char const *file
, mode_t mode
, int flag
)
418 _GL_ARG_NONNULL ((2)));
419 _GL_CXXALIAS_RPL (fchmodat
, int,
420 (int fd
, char const *file
, mode_t mode
, int flag
));
422 # if !@HAVE_FCHMODAT@
423 _GL_FUNCDECL_SYS (fchmodat
, int,
424 (int fd
, char const *file
, mode_t mode
, int flag
)
425 _GL_ARG_NONNULL ((2)));
427 _GL_CXXALIAS_SYS (fchmodat
, int,
428 (int fd
, char const *file
, mode_t mode
, int flag
));
430 _GL_CXXALIASWARN (fchmodat
);
431 #elif defined GNULIB_POSIXCHECK
433 # if HAVE_RAW_DECL_FCHMODAT
434 _GL_WARN_ON_USE (fchmodat
, "fchmodat is not portable - "
435 "use gnulib module openat for portability");
442 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
444 # define fstat rpl_fstat
446 _GL_FUNCDECL_RPL (fstat
, int, (int fd
, struct stat
*buf
) _GL_ARG_NONNULL ((2)));
447 _GL_CXXALIAS_RPL (fstat
, int, (int fd
, struct stat
*buf
));
449 _GL_CXXALIAS_SYS (fstat
, int, (int fd
, struct stat
*buf
));
452 _GL_CXXALIASWARN (fstat
);
454 #elif @GNULIB_OVERRIDES_STRUCT_STAT@
456 # define fstat fstat_used_without_requesting_gnulib_module_fstat
457 #elif @WINDOWS_64_BIT_ST_SIZE@
458 /* Above, we define stat to _stati64. */
459 # define fstat _fstati64
460 #elif defined GNULIB_POSIXCHECK
462 # if HAVE_RAW_DECL_FSTAT
463 _GL_WARN_ON_USE (fstat
, "fstat has portability problems - "
464 "use gnulib module fstat for portability");
470 # if @REPLACE_FSTATAT@
471 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
473 # define fstatat rpl_fstatat
475 _GL_FUNCDECL_RPL (fstatat
, int,
476 (int fd
, char const *restrict name
, struct stat
*restrict st
,
478 _GL_ARG_NONNULL ((2, 3)));
479 _GL_CXXALIAS_RPL (fstatat
, int,
480 (int fd
, char const *restrict name
, struct stat
*restrict st
,
484 _GL_FUNCDECL_SYS (fstatat
, int,
485 (int fd
, char const *restrict name
, struct stat
*restrict st
,
487 _GL_ARG_NONNULL ((2, 3)));
489 _GL_CXXALIAS_SYS (fstatat
, int,
490 (int fd
, char const *restrict name
, struct stat
*restrict st
,
493 _GL_CXXALIASWARN (fstatat
);
494 #elif @GNULIB_OVERRIDES_STRUCT_STAT@
496 # define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
497 #elif defined GNULIB_POSIXCHECK
499 # if HAVE_RAW_DECL_FSTATAT
500 _GL_WARN_ON_USE (fstatat
, "fstatat is not portable - "
501 "use gnulib module openat for portability");
506 #if @GNULIB_FUTIMENS@
507 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
508 implementation relies on futimesat, which on Solaris 10 makes an invocation
509 to futimens that is meant to invoke the libc's futimens(), not gnulib's
511 # if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
512 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
514 # define futimens rpl_futimens
516 _GL_FUNCDECL_RPL (futimens
, int, (int fd
, struct timespec
const times
[2]));
517 _GL_CXXALIAS_RPL (futimens
, int, (int fd
, struct timespec
const times
[2]));
519 # if !@HAVE_FUTIMENS@
520 _GL_FUNCDECL_SYS (futimens
, int, (int fd
, struct timespec
const times
[2]));
522 _GL_CXXALIAS_SYS (futimens
, int, (int fd
, struct timespec
const times
[2]));
525 _GL_CXXALIASWARN (futimens
);
527 #elif defined GNULIB_POSIXCHECK
529 # if HAVE_RAW_DECL_FUTIMENS
530 _GL_WARN_ON_USE (futimens
, "futimens is not portable - "
531 "use gnulib module futimens for portability");
536 #if @GNULIB_GETUMASK@
537 # if !@HAVE_GETUMASK@
538 _GL_FUNCDECL_SYS (getumask
, mode_t
, (void));
540 _GL_CXXALIAS_SYS (getumask
, mode_t
, (void));
542 _GL_CXXALIASWARN (getumask
);
544 #elif defined GNULIB_POSIXCHECK
546 # if HAVE_RAW_DECL_GETUMASK
547 _GL_WARN_ON_USE (getumask
, "getumask is not portable - "
548 "use gnulib module getumask for portability");
554 /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
555 denotes a symbolic link. */
556 # if !@HAVE_LCHMOD@ || defined __hpux
557 _GL_FUNCDECL_SYS (lchmod
, int, (const char *filename
, mode_t mode
)
558 _GL_ARG_NONNULL ((1)));
560 _GL_CXXALIAS_SYS (lchmod
, int, (const char *filename
, mode_t mode
));
561 _GL_CXXALIASWARN (lchmod
);
562 #elif defined GNULIB_POSIXCHECK
564 # if HAVE_RAW_DECL_LCHMOD
565 _GL_WARN_ON_USE (lchmod
, "lchmod is unportable - "
566 "use gnulib module lchmod for portability");
573 /* mingw does not support symlinks, therefore it does not have lstat. But
574 without links, stat does just fine. */
575 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
578 _GL_CXXALIAS_RPL_1 (lstat
, stat
, int,
579 (const char *restrict name
, struct stat
*restrict buf
));
580 # elif @REPLACE_LSTAT@
581 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
583 # define lstat rpl_lstat
585 _GL_FUNCDECL_RPL (lstat
, int,
586 (const char *restrict name
, struct stat
*restrict buf
)
587 _GL_ARG_NONNULL ((1, 2)));
588 _GL_CXXALIAS_RPL (lstat
, int,
589 (const char *restrict name
, struct stat
*restrict buf
));
591 _GL_CXXALIAS_SYS (lstat
, int,
592 (const char *restrict name
, struct stat
*restrict buf
));
595 _GL_CXXALIASWARN (lstat
);
597 #elif @GNULIB_OVERRIDES_STRUCT_STAT@
599 # define lstat lstat_used_without_requesting_gnulib_module_lstat
600 #elif defined GNULIB_POSIXCHECK
602 # if HAVE_RAW_DECL_LSTAT
603 _GL_WARN_ON_USE (lstat
, "lstat is unportable - "
604 "use gnulib module lstat for portability");
610 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
612 # define mkdir rpl_mkdir
614 _GL_FUNCDECL_RPL (mkdir
, int, (char const *name
, mode_t mode
)
615 _GL_ARG_NONNULL ((1)));
616 _GL_CXXALIAS_RPL (mkdir
, int, (char const *name
, mode_t mode
));
618 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
619 Additionally, it declares _mkdir (and depending on compile flags, an
620 alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
621 which are included above. */
622 # if defined _WIN32 && ! defined __CYGWIN__
624 # if !GNULIB_defined_rpl_mkdir
626 rpl_mkdir (char const *name
, mode_t mode
)
628 return _mkdir (name
);
630 # define GNULIB_defined_rpl_mkdir 1
633 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
634 # define mkdir rpl_mkdir
636 _GL_CXXALIAS_RPL (mkdir
, int, (char const *name
, mode_t mode
));
638 _GL_CXXALIAS_SYS (mkdir
, int, (char const *name
, mode_t mode
));
641 _GL_CXXALIASWARN (mkdir
);
646 _GL_FUNCDECL_SYS (mkdirat
, int, (int fd
, char const *file
, mode_t mode
)
647 _GL_ARG_NONNULL ((2)));
649 _GL_CXXALIAS_SYS (mkdirat
, int, (int fd
, char const *file
, mode_t mode
));
650 _GL_CXXALIASWARN (mkdirat
);
651 #elif defined GNULIB_POSIXCHECK
653 # if HAVE_RAW_DECL_MKDIRAT
654 _GL_WARN_ON_USE (mkdirat
, "mkdirat is not portable - "
655 "use gnulib module openat for portability");
661 # if @REPLACE_MKFIFO@
662 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
664 # define mkfifo rpl_mkfifo
666 _GL_FUNCDECL_RPL (mkfifo
, int, (char const *file
, mode_t mode
)
667 _GL_ARG_NONNULL ((1)));
668 _GL_CXXALIAS_RPL (mkfifo
, int, (char const *file
, mode_t mode
));
671 _GL_FUNCDECL_SYS (mkfifo
, int, (char const *file
, mode_t mode
)
672 _GL_ARG_NONNULL ((1)));
674 _GL_CXXALIAS_SYS (mkfifo
, int, (char const *file
, mode_t mode
));
676 _GL_CXXALIASWARN (mkfifo
);
677 #elif defined GNULIB_POSIXCHECK
679 # if HAVE_RAW_DECL_MKFIFO
680 _GL_WARN_ON_USE (mkfifo
, "mkfifo is not portable - "
681 "use gnulib module mkfifo for portability");
686 #if @GNULIB_MKFIFOAT@
687 # if !@HAVE_MKFIFOAT@
688 _GL_FUNCDECL_SYS (mkfifoat
, int, (int fd
, char const *file
, mode_t mode
)
689 _GL_ARG_NONNULL ((2)));
691 _GL_CXXALIAS_SYS (mkfifoat
, int, (int fd
, char const *file
, mode_t mode
));
692 _GL_CXXALIASWARN (mkfifoat
);
693 #elif defined GNULIB_POSIXCHECK
695 # if HAVE_RAW_DECL_MKFIFOAT
696 _GL_WARN_ON_USE (mkfifoat
, "mkfifoat is not portable - "
697 "use gnulib module mkfifoat for portability");
704 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
706 # define mknod rpl_mknod
708 _GL_FUNCDECL_RPL (mknod
, int, (char const *file
, mode_t mode
, dev_t dev
)
709 _GL_ARG_NONNULL ((1)));
710 _GL_CXXALIAS_RPL (mknod
, int, (char const *file
, mode_t mode
, dev_t dev
));
713 _GL_FUNCDECL_SYS (mknod
, int, (char const *file
, mode_t mode
, dev_t dev
)
714 _GL_ARG_NONNULL ((1)));
716 /* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
717 _GL_CXXALIAS_SYS_CAST (mknod
, int, (char const *file
, mode_t mode
, dev_t dev
));
719 _GL_CXXALIASWARN (mknod
);
720 #elif defined GNULIB_POSIXCHECK
722 # if HAVE_RAW_DECL_MKNOD
723 _GL_WARN_ON_USE (mknod
, "mknod is not portable - "
724 "use gnulib module mknod for portability");
731 _GL_FUNCDECL_SYS (mknodat
, int,
732 (int fd
, char const *file
, mode_t mode
, dev_t dev
)
733 _GL_ARG_NONNULL ((2)));
735 _GL_CXXALIAS_SYS (mknodat
, int,
736 (int fd
, char const *file
, mode_t mode
, dev_t dev
));
737 _GL_CXXALIASWARN (mknodat
);
738 #elif defined GNULIB_POSIXCHECK
740 # if HAVE_RAW_DECL_MKNODAT
741 _GL_WARN_ON_USE (mknodat
, "mknodat is not portable - "
742 "use gnulib module mkfifoat for portability");
749 # if !@GNULIB_OVERRIDES_STRUCT_STAT@
750 /* We can't use the object-like #define stat rpl_stat, because of
751 struct stat. This means that rpl_stat will not be used if the user
752 does (stat)(a,b). Oh well. */
753 # if defined _AIX && defined stat && defined _LARGE_FILES
754 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
755 so we have to replace stat64() instead of stat(). */
757 # define stat64(name, st) rpl_stat (name, st)
758 # elif @WINDOWS_64_BIT_ST_SIZE@
759 /* Above, we define stat to _stati64. */
760 # if defined __MINGW32__ && defined _stati64
761 # ifndef _USE_32BIT_TIME_T
762 /* The system headers define _stati64 to _stat64. */
764 # define _stat64(name, st) rpl_stat (name, st)
766 # elif defined _MSC_VER && defined _stati64
767 # ifdef _USE_32BIT_TIME_T
768 /* The system headers define _stati64 to _stat32i64. */
770 # define _stat32i64(name, st) rpl_stat (name, st)
772 /* The system headers define _stati64 to _stat64. */
774 # define _stat64(name, st) rpl_stat (name, st)
778 # define _stati64(name, st) rpl_stat (name, st)
780 # elif defined __MINGW32__ && defined stat
781 # ifdef _USE_32BIT_TIME_T
782 /* The system headers define stat to _stat32i64. */
784 # define _stat32i64(name, st) rpl_stat (name, st)
786 /* The system headers define stat to _stat64. */
788 # define _stat64(name, st) rpl_stat (name, st)
790 # elif defined _MSC_VER && defined stat
791 # ifdef _USE_32BIT_TIME_T
792 /* The system headers define stat to _stat32. */
794 # define _stat32(name, st) rpl_stat (name, st)
796 /* The system headers define stat to _stat64i32. */
798 # define _stat64i32(name, st) rpl_stat (name, st)
800 # else /* !(_AIX || __MINGW32__ || _MSC_VER) */
802 # define stat(name, st) rpl_stat (name, st)
803 # endif /* !_LARGE_FILES */
804 # endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */
805 _GL_EXTERN_C
int stat (const char *restrict name
, struct stat
*restrict buf
)
806 _GL_ARG_NONNULL ((1, 2));
808 #elif @GNULIB_OVERRIDES_STRUCT_STAT@
810 #define stat stat_used_without_requesting_gnulib_module_stat
812 #elif defined GNULIB_POSIXCHECK
814 # if HAVE_RAW_DECL_STAT
815 _GL_WARN_ON_USE (stat
, "stat is unportable - "
816 "use gnulib module stat for portability");
821 /* On native Windows, map 'umask' to '_umask', so that -loldnames is not
822 required. In C++ with GNULIB_NAMESPACE, avoid differences between
823 platforms by defining GNULIB_NAMESPACE::umask always. */
824 #if defined _WIN32 && !defined __CYGWIN__
825 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
827 # define umask _umask
829 /* Need to cast, because in mingw the last argument is 'int mode'. */
830 _GL_CXXALIAS_MDA_CAST (umask
, mode_t
, (mode_t mask
));
832 _GL_CXXALIAS_SYS (umask
, mode_t
, (mode_t mask
));
834 _GL_CXXALIASWARN (umask
);
837 #if @GNULIB_UTIMENSAT@
838 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
839 implementation relies on futimesat, which on Solaris 10 makes an invocation
840 to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
842 # if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
843 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
845 # define utimensat rpl_utimensat
847 _GL_FUNCDECL_RPL (utimensat
, int, (int fd
, char const *name
,
848 struct timespec
const times
[2], int flag
)
849 _GL_ARG_NONNULL ((2)));
850 _GL_CXXALIAS_RPL (utimensat
, int, (int fd
, char const *name
,
851 struct timespec
const times
[2], int flag
));
853 # if !@HAVE_UTIMENSAT@
854 _GL_FUNCDECL_SYS (utimensat
, int, (int fd
, char const *name
,
855 struct timespec
const times
[2], int flag
)
856 _GL_ARG_NONNULL ((2)));
858 _GL_CXXALIAS_SYS (utimensat
, int, (int fd
, char const *name
,
859 struct timespec
const times
[2], int flag
));
861 # if @HAVE_UTIMENSAT@
862 _GL_CXXALIASWARN (utimensat
);
864 #elif defined GNULIB_POSIXCHECK
866 # if HAVE_RAW_DECL_UTIMENSAT
867 _GL_WARN_ON_USE (utimensat
, "utimensat is not portable - "
868 "use gnulib module utimensat for portability");
873 #endif /* _@GUARD_PREFIX@_SYS_STAT_H */
874 #endif /* _@GUARD_PREFIX@_SYS_STAT_H */