xref: /netbsd-src/external/gpl3/gdb/dist/gnulib/import/sys_stat.in.h (revision 4b169a6ba595ae283ca507b26b15fdff40495b1c)
18dffb485Schristos /* Provide a more complete sys/stat.h header file.
2*4b169a6bSchristos    Copyright (C) 2005-2022 Free Software Foundation, Inc.
38dffb485Schristos 
4*4b169a6bSchristos    This file is free software: you can redistribute it and/or modify
5*4b169a6bSchristos    it under the terms of the GNU Lesser General Public License as
6*4b169a6bSchristos    published by the Free Software Foundation; either version 2.1 of the
7*4b169a6bSchristos    License, or (at your option) any later version.
88dffb485Schristos 
9*4b169a6bSchristos    This file is distributed in the hope that it will be useful,
108dffb485Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
118dffb485Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*4b169a6bSchristos    GNU Lesser General Public License for more details.
138dffb485Schristos 
14*4b169a6bSchristos    You should have received a copy of the GNU Lesser General Public License
15*4b169a6bSchristos    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
168dffb485Schristos 
178dffb485Schristos /* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
188dffb485Schristos 
198dffb485Schristos /* This file is supposed to be used on platforms where <sys/stat.h> is
208dffb485Schristos    incomplete.  It is intended to provide definitions and prototypes
218dffb485Schristos    needed by an application.  Start with what the system provides.  */
228dffb485Schristos 
238dffb485Schristos #if __GNUC__ >= 3
248dffb485Schristos @PRAGMA_SYSTEM_HEADER@
258dffb485Schristos #endif
268dffb485Schristos @PRAGMA_COLUMNS@
278dffb485Schristos 
288dffb485Schristos #if defined __need_system_sys_stat_h
298dffb485Schristos /* Special invocation convention.  */
308dffb485Schristos 
318dffb485Schristos #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
328dffb485Schristos 
338dffb485Schristos #else
348dffb485Schristos /* Normal invocation convention.  */
358dffb485Schristos 
368dffb485Schristos #ifndef _@GUARD_PREFIX@_SYS_STAT_H
378dffb485Schristos 
388dffb485Schristos /* Get nlink_t.
398dffb485Schristos    May also define off_t to a 64-bit type on native Windows.  */
408dffb485Schristos #include <sys/types.h>
418dffb485Schristos 
428dffb485Schristos /* Get struct timespec.  */
438dffb485Schristos #include <time.h>
448dffb485Schristos 
458dffb485Schristos /* The include_next requires a split double-inclusion guard.  */
468dffb485Schristos #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
478dffb485Schristos 
488dffb485Schristos #ifndef _@GUARD_PREFIX@_SYS_STAT_H
498dffb485Schristos #define _@GUARD_PREFIX@_SYS_STAT_H
508dffb485Schristos 
518dffb485Schristos /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
528dffb485Schristos 
538dffb485Schristos /* The definition of _GL_ARG_NONNULL is copied here.  */
548dffb485Schristos 
558dffb485Schristos /* The definition of _GL_WARN_ON_USE is copied here.  */
568dffb485Schristos 
578dffb485Schristos /* Before doing "#define mknod rpl_mknod" below, we need to include all
588dffb485Schristos    headers that may declare mknod().  OS/2 kLIBC declares mknod() in
598dffb485Schristos    <unistd.h>, not in <sys/stat.h>.  */
608dffb485Schristos #ifdef __KLIBC__
618dffb485Schristos # include <unistd.h>
628dffb485Schristos #endif
638dffb485Schristos 
648dffb485Schristos /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
658dffb485Schristos    headers that may declare mkdir().  Native Windows platforms declare mkdir
668dffb485Schristos    in <io.h> and/or <direct.h>, not in <sys/stat.h>.  */
678dffb485Schristos #if defined _WIN32 && ! defined __CYGWIN__
688dffb485Schristos # include <io.h>     /* mingw32, mingw64 */
698dffb485Schristos # include <direct.h> /* mingw64, MSVC 9 */
708dffb485Schristos #endif
718dffb485Schristos 
728dffb485Schristos /* Native Windows platforms declare umask() in <io.h>.  */
738dffb485Schristos #if 0 && (defined _WIN32 && ! defined __CYGWIN__)
748dffb485Schristos # include <io.h>
758dffb485Schristos #endif
768dffb485Schristos 
778dffb485Schristos /* Large File Support on native Windows.  */
788dffb485Schristos #if @WINDOWS_64_BIT_ST_SIZE@
798dffb485Schristos # define stat _stati64
808dffb485Schristos #endif
818dffb485Schristos 
828dffb485Schristos /* Optionally, override 'struct stat' on native Windows.  */
838dffb485Schristos #if @GNULIB_OVERRIDES_STRUCT_STAT@
848dffb485Schristos 
858dffb485Schristos # undef stat
868dffb485Schristos # if @GNULIB_STAT@
878dffb485Schristos #  define stat rpl_stat
888dffb485Schristos # else
898dffb485Schristos    /* Provoke a clear link error if stat() is used as a function and
908dffb485Schristos       module 'stat' is not in use.  */
918dffb485Schristos #  define stat stat_used_without_requesting_gnulib_module_stat
928dffb485Schristos # endif
938dffb485Schristos 
948dffb485Schristos # if !GNULIB_defined_struct_stat
958dffb485Schristos struct stat
968dffb485Schristos {
978dffb485Schristos   dev_t st_dev;
988dffb485Schristos   ino_t st_ino;
998dffb485Schristos   mode_t st_mode;
1008dffb485Schristos   nlink_t st_nlink;
1018dffb485Schristos #  if 0
1028dffb485Schristos   uid_t st_uid;
1038dffb485Schristos #  else /* uid_t is not defined by default on native Windows.  */
1048dffb485Schristos   short st_uid;
1058dffb485Schristos #  endif
1068dffb485Schristos #  if 0
1078dffb485Schristos   gid_t st_gid;
1088dffb485Schristos #  else /* gid_t is not defined by default on native Windows.  */
1098dffb485Schristos   short st_gid;
1108dffb485Schristos #  endif
1118dffb485Schristos   dev_t st_rdev;
1128dffb485Schristos   off_t st_size;
1138dffb485Schristos #  if 0
1148dffb485Schristos   blksize_t st_blksize;
1158dffb485Schristos   blkcnt_t st_blocks;
1168dffb485Schristos #  endif
1178dffb485Schristos 
1188dffb485Schristos #  if @WINDOWS_STAT_TIMESPEC@
1198dffb485Schristos   struct timespec st_atim;
1208dffb485Schristos   struct timespec st_mtim;
1218dffb485Schristos   struct timespec st_ctim;
1228dffb485Schristos #  else
1238dffb485Schristos   time_t st_atime;
1248dffb485Schristos   time_t st_mtime;
1258dffb485Schristos   time_t st_ctime;
1268dffb485Schristos #  endif
1278dffb485Schristos };
1288dffb485Schristos #  if @WINDOWS_STAT_TIMESPEC@
1298dffb485Schristos #   define st_atime st_atim.tv_sec
1308dffb485Schristos #   define st_mtime st_mtim.tv_sec
1318dffb485Schristos #   define st_ctime st_ctim.tv_sec
1328dffb485Schristos     /* Indicator, for gnulib internal purposes.  */
1338dffb485Schristos #   define _GL_WINDOWS_STAT_TIMESPEC 1
1348dffb485Schristos #  endif
1358dffb485Schristos #  define GNULIB_defined_struct_stat 1
1368dffb485Schristos # endif
1378dffb485Schristos 
1388dffb485Schristos /* Other possible values of st_mode.  */
1398dffb485Schristos # if 0
1408dffb485Schristos #  define _S_IFBLK  0x6000
1418dffb485Schristos # endif
1428dffb485Schristos # if 0
1438dffb485Schristos #  define _S_IFLNK  0xA000
1448dffb485Schristos # endif
1458dffb485Schristos # if 0
1468dffb485Schristos #  define _S_IFSOCK 0xC000
1478dffb485Schristos # endif
1488dffb485Schristos 
1498dffb485Schristos #endif
1508dffb485Schristos 
1518dffb485Schristos #ifndef S_IFIFO
1528dffb485Schristos # ifdef _S_IFIFO
1538dffb485Schristos #  define S_IFIFO _S_IFIFO
1548dffb485Schristos # endif
1558dffb485Schristos #endif
1568dffb485Schristos 
1578dffb485Schristos #ifndef S_IFMT
1588dffb485Schristos # define S_IFMT 0170000
1598dffb485Schristos #endif
1608dffb485Schristos 
1618dffb485Schristos #if STAT_MACROS_BROKEN
1628dffb485Schristos # undef S_ISBLK
1638dffb485Schristos # undef S_ISCHR
1648dffb485Schristos # undef S_ISDIR
1658dffb485Schristos # undef S_ISFIFO
1668dffb485Schristos # undef S_ISLNK
1678dffb485Schristos # undef S_ISNAM
1688dffb485Schristos # undef S_ISMPB
1698dffb485Schristos # undef S_ISMPC
1708dffb485Schristos # undef S_ISNWK
1718dffb485Schristos # undef S_ISREG
1728dffb485Schristos # undef S_ISSOCK
1738dffb485Schristos #endif
1748dffb485Schristos 
1758dffb485Schristos #ifndef S_ISBLK
1768dffb485Schristos # ifdef S_IFBLK
1778dffb485Schristos #  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
1788dffb485Schristos # else
1798dffb485Schristos #  define S_ISBLK(m) 0
1808dffb485Schristos # endif
1818dffb485Schristos #endif
1828dffb485Schristos 
1838dffb485Schristos #ifndef S_ISCHR
1848dffb485Schristos # ifdef S_IFCHR
1858dffb485Schristos #  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
1868dffb485Schristos # else
1878dffb485Schristos #  define S_ISCHR(m) 0
1888dffb485Schristos # endif
1898dffb485Schristos #endif
1908dffb485Schristos 
1918dffb485Schristos #ifndef S_ISDIR
1928dffb485Schristos # ifdef S_IFDIR
1938dffb485Schristos #  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
1948dffb485Schristos # else
1958dffb485Schristos #  define S_ISDIR(m) 0
1968dffb485Schristos # endif
1978dffb485Schristos #endif
1988dffb485Schristos 
1998dffb485Schristos #ifndef S_ISDOOR /* Solaris 2.5 and up */
2008dffb485Schristos # define S_ISDOOR(m) 0
2018dffb485Schristos #endif
2028dffb485Schristos 
2038dffb485Schristos #ifndef S_ISFIFO
2048dffb485Schristos # ifdef S_IFIFO
2058dffb485Schristos #  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
2068dffb485Schristos # else
2078dffb485Schristos #  define S_ISFIFO(m) 0
2088dffb485Schristos # endif
2098dffb485Schristos #endif
2108dffb485Schristos 
2118dffb485Schristos #ifndef S_ISLNK
2128dffb485Schristos # ifdef S_IFLNK
2138dffb485Schristos #  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
2148dffb485Schristos # else
2158dffb485Schristos #  define S_ISLNK(m) 0
2168dffb485Schristos # endif
2178dffb485Schristos #endif
2188dffb485Schristos 
2198dffb485Schristos #ifndef S_ISMPB /* V7 */
2208dffb485Schristos # ifdef S_IFMPB
2218dffb485Schristos #  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
2228dffb485Schristos #  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
2238dffb485Schristos # else
2248dffb485Schristos #  define S_ISMPB(m) 0
2258dffb485Schristos #  define S_ISMPC(m) 0
2268dffb485Schristos # endif
2278dffb485Schristos #endif
2288dffb485Schristos 
2298dffb485Schristos #ifndef S_ISMPX /* AIX */
2308dffb485Schristos # define S_ISMPX(m) 0
2318dffb485Schristos #endif
2328dffb485Schristos 
2338dffb485Schristos #ifndef S_ISNAM /* Xenix */
2348dffb485Schristos # ifdef S_IFNAM
2358dffb485Schristos #  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
2368dffb485Schristos # else
2378dffb485Schristos #  define S_ISNAM(m) 0
2388dffb485Schristos # endif
2398dffb485Schristos #endif
2408dffb485Schristos 
2418dffb485Schristos #ifndef S_ISNWK /* HP/UX */
2428dffb485Schristos # ifdef S_IFNWK
2438dffb485Schristos #  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
2448dffb485Schristos # else
2458dffb485Schristos #  define S_ISNWK(m) 0
2468dffb485Schristos # endif
2478dffb485Schristos #endif
2488dffb485Schristos 
2498dffb485Schristos #ifndef S_ISPORT /* Solaris 10 and up */
2508dffb485Schristos # define S_ISPORT(m) 0
2518dffb485Schristos #endif
2528dffb485Schristos 
2538dffb485Schristos #ifndef S_ISREG
2548dffb485Schristos # ifdef S_IFREG
2558dffb485Schristos #  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
2568dffb485Schristos # else
2578dffb485Schristos #  define S_ISREG(m) 0
2588dffb485Schristos # endif
2598dffb485Schristos #endif
2608dffb485Schristos 
2618dffb485Schristos #ifndef S_ISSOCK
2628dffb485Schristos # ifdef S_IFSOCK
2638dffb485Schristos #  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
2648dffb485Schristos # else
2658dffb485Schristos #  define S_ISSOCK(m) 0
2668dffb485Schristos # endif
2678dffb485Schristos #endif
2688dffb485Schristos 
2698dffb485Schristos 
2708dffb485Schristos #ifndef S_TYPEISMQ
2718dffb485Schristos # define S_TYPEISMQ(p) 0
2728dffb485Schristos #endif
2738dffb485Schristos 
2748dffb485Schristos #ifndef S_TYPEISTMO
2758dffb485Schristos # define S_TYPEISTMO(p) 0
2768dffb485Schristos #endif
2778dffb485Schristos 
2788dffb485Schristos 
2798dffb485Schristos #ifndef S_TYPEISSEM
2808dffb485Schristos # ifdef S_INSEM
2818dffb485Schristos #  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
2828dffb485Schristos # else
2838dffb485Schristos #  define S_TYPEISSEM(p) 0
2848dffb485Schristos # endif
2858dffb485Schristos #endif
2868dffb485Schristos 
2878dffb485Schristos #ifndef S_TYPEISSHM
2888dffb485Schristos # ifdef S_INSHD
2898dffb485Schristos #  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
2908dffb485Schristos # else
2918dffb485Schristos #  define S_TYPEISSHM(p) 0
2928dffb485Schristos # endif
2938dffb485Schristos #endif
2948dffb485Schristos 
2958dffb485Schristos /* high performance ("contiguous data") */
2968dffb485Schristos #ifndef S_ISCTG
2978dffb485Schristos # define S_ISCTG(p) 0
2988dffb485Schristos #endif
2998dffb485Schristos 
3008dffb485Schristos /* Cray DMF (data migration facility): off line, with data  */
3018dffb485Schristos #ifndef S_ISOFD
3028dffb485Schristos # define S_ISOFD(p) 0
3038dffb485Schristos #endif
3048dffb485Schristos 
3058dffb485Schristos /* Cray DMF (data migration facility): off line, with no data  */
3068dffb485Schristos #ifndef S_ISOFL
3078dffb485Schristos # define S_ISOFL(p) 0
3088dffb485Schristos #endif
3098dffb485Schristos 
3108dffb485Schristos /* 4.4BSD whiteout */
3118dffb485Schristos #ifndef S_ISWHT
3128dffb485Schristos # define S_ISWHT(m) 0
3138dffb485Schristos #endif
3148dffb485Schristos 
3158dffb485Schristos /* If any of the following are undefined,
3168dffb485Schristos    define them to their de facto standard values.  */
3178dffb485Schristos #if !S_ISUID
3188dffb485Schristos # define S_ISUID 04000
3198dffb485Schristos #endif
3208dffb485Schristos #if !S_ISGID
3218dffb485Schristos # define S_ISGID 02000
3228dffb485Schristos #endif
3238dffb485Schristos 
3248dffb485Schristos /* S_ISVTX is a common extension to POSIX.  */
3258dffb485Schristos #ifndef S_ISVTX
3268dffb485Schristos # define S_ISVTX 01000
3278dffb485Schristos #endif
3288dffb485Schristos 
3298dffb485Schristos #if !S_IRUSR && S_IREAD
3308dffb485Schristos # define S_IRUSR S_IREAD
3318dffb485Schristos #endif
3328dffb485Schristos #if !S_IRUSR
3338dffb485Schristos # define S_IRUSR 00400
3348dffb485Schristos #endif
3358dffb485Schristos #if !S_IRGRP
3368dffb485Schristos # define S_IRGRP (S_IRUSR >> 3)
3378dffb485Schristos #endif
3388dffb485Schristos #if !S_IROTH
3398dffb485Schristos # define S_IROTH (S_IRUSR >> 6)
3408dffb485Schristos #endif
3418dffb485Schristos 
3428dffb485Schristos #if !S_IWUSR && S_IWRITE
3438dffb485Schristos # define S_IWUSR S_IWRITE
3448dffb485Schristos #endif
3458dffb485Schristos #if !S_IWUSR
3468dffb485Schristos # define S_IWUSR 00200
3478dffb485Schristos #endif
3488dffb485Schristos #if !S_IWGRP
3498dffb485Schristos # define S_IWGRP (S_IWUSR >> 3)
3508dffb485Schristos #endif
3518dffb485Schristos #if !S_IWOTH
3528dffb485Schristos # define S_IWOTH (S_IWUSR >> 6)
3538dffb485Schristos #endif
3548dffb485Schristos 
3558dffb485Schristos #if !S_IXUSR && S_IEXEC
3568dffb485Schristos # define S_IXUSR S_IEXEC
3578dffb485Schristos #endif
3588dffb485Schristos #if !S_IXUSR
3598dffb485Schristos # define S_IXUSR 00100
3608dffb485Schristos #endif
3618dffb485Schristos #if !S_IXGRP
3628dffb485Schristos # define S_IXGRP (S_IXUSR >> 3)
3638dffb485Schristos #endif
3648dffb485Schristos #if !S_IXOTH
3658dffb485Schristos # define S_IXOTH (S_IXUSR >> 6)
3668dffb485Schristos #endif
3678dffb485Schristos 
3688dffb485Schristos #if !S_IRWXU
3698dffb485Schristos # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
3708dffb485Schristos #endif
3718dffb485Schristos #if !S_IRWXG
3728dffb485Schristos # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
3738dffb485Schristos #endif
3748dffb485Schristos #if !S_IRWXO
3758dffb485Schristos # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
3768dffb485Schristos #endif
3778dffb485Schristos 
378*4b169a6bSchristos /* Although S_IXUGO and S_IRWXUGO are not specified by POSIX and are
379*4b169a6bSchristos    not implemented in GNU/Linux, some Gnulib-using apps use the macros.  */
3808dffb485Schristos #if !S_IXUGO
3818dffb485Schristos # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
3828dffb485Schristos #endif
3838dffb485Schristos #ifndef S_IRWXUGO
3848dffb485Schristos # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
3858dffb485Schristos #endif
3868dffb485Schristos 
3878dffb485Schristos /* Macros for futimens and utimensat.  */
3888dffb485Schristos #ifndef UTIME_NOW
3898dffb485Schristos # define UTIME_NOW (-1)
3908dffb485Schristos # define UTIME_OMIT (-2)
3918dffb485Schristos #endif
3928dffb485Schristos 
3938dffb485Schristos 
394*4b169a6bSchristos #if @GNULIB_MDA_CHMOD@
395*4b169a6bSchristos /* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
396*4b169a6bSchristos    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
397*4b169a6bSchristos    platforms by defining GNULIB_NAMESPACE::chmod always.  */
398*4b169a6bSchristos # if defined _WIN32 && !defined __CYGWIN__
399*4b169a6bSchristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
400*4b169a6bSchristos #   undef chmod
401*4b169a6bSchristos #   define chmod _chmod
402*4b169a6bSchristos #  endif
403*4b169a6bSchristos /* Need to cast, because in mingw the last argument is 'int mode'.  */
404*4b169a6bSchristos _GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
405*4b169a6bSchristos # else
406*4b169a6bSchristos _GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
407*4b169a6bSchristos # endif
408*4b169a6bSchristos _GL_CXXALIASWARN (chmod);
409*4b169a6bSchristos #endif
410*4b169a6bSchristos 
411*4b169a6bSchristos 
4128dffb485Schristos #if @GNULIB_FCHMODAT@
4138dffb485Schristos # if @REPLACE_FCHMODAT@
4148dffb485Schristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
4158dffb485Schristos #   undef fchmodat
4168dffb485Schristos #   define fchmodat rpl_fchmodat
4178dffb485Schristos #  endif
4188dffb485Schristos _GL_FUNCDECL_RPL (fchmodat, int,
4198dffb485Schristos                   (int fd, char const *file, mode_t mode, int flag)
4208dffb485Schristos                   _GL_ARG_NONNULL ((2)));
4218dffb485Schristos _GL_CXXALIAS_RPL (fchmodat, int,
4228dffb485Schristos                   (int fd, char const *file, mode_t mode, int flag));
4238dffb485Schristos # else
4248dffb485Schristos #  if !@HAVE_FCHMODAT@
4258dffb485Schristos _GL_FUNCDECL_SYS (fchmodat, int,
4268dffb485Schristos                   (int fd, char const *file, mode_t mode, int flag)
4278dffb485Schristos                   _GL_ARG_NONNULL ((2)));
4288dffb485Schristos #  endif
4298dffb485Schristos _GL_CXXALIAS_SYS (fchmodat, int,
4308dffb485Schristos                   (int fd, char const *file, mode_t mode, int flag));
4318dffb485Schristos # endif
4328dffb485Schristos _GL_CXXALIASWARN (fchmodat);
4338dffb485Schristos #elif defined GNULIB_POSIXCHECK
4348dffb485Schristos # undef fchmodat
4358dffb485Schristos # if HAVE_RAW_DECL_FCHMODAT
4368dffb485Schristos _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
4378dffb485Schristos                  "use gnulib module openat for portability");
4388dffb485Schristos # endif
4398dffb485Schristos #endif
4408dffb485Schristos 
4418dffb485Schristos 
4428dffb485Schristos #if @GNULIB_FSTAT@
4438dffb485Schristos # if @REPLACE_FSTAT@
4448dffb485Schristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
4458dffb485Schristos #   undef fstat
4468dffb485Schristos #   define fstat rpl_fstat
4478dffb485Schristos #  endif
4488dffb485Schristos _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
4498dffb485Schristos _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
4508dffb485Schristos # else
4518dffb485Schristos _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
4528dffb485Schristos # endif
453*4b169a6bSchristos # if __GLIBC__ >= 2
4548dffb485Schristos _GL_CXXALIASWARN (fstat);
455*4b169a6bSchristos # endif
4568dffb485Schristos #elif @GNULIB_OVERRIDES_STRUCT_STAT@
4578dffb485Schristos # undef fstat
4588dffb485Schristos # define fstat fstat_used_without_requesting_gnulib_module_fstat
4598dffb485Schristos #elif @WINDOWS_64_BIT_ST_SIZE@
4608dffb485Schristos /* Above, we define stat to _stati64.  */
4618dffb485Schristos # define fstat _fstati64
4628dffb485Schristos #elif defined GNULIB_POSIXCHECK
4638dffb485Schristos # undef fstat
4648dffb485Schristos # if HAVE_RAW_DECL_FSTAT
4658dffb485Schristos _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
4668dffb485Schristos                  "use gnulib module fstat for portability");
4678dffb485Schristos # endif
4688dffb485Schristos #endif
4698dffb485Schristos 
4708dffb485Schristos 
4718dffb485Schristos #if @GNULIB_FSTATAT@
4728dffb485Schristos # if @REPLACE_FSTATAT@
4738dffb485Schristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
4748dffb485Schristos #   undef fstatat
4758dffb485Schristos #   define fstatat rpl_fstatat
4768dffb485Schristos #  endif
4778dffb485Schristos _GL_FUNCDECL_RPL (fstatat, int,
4788dffb485Schristos                   (int fd, char const *restrict name, struct stat *restrict st,
4798dffb485Schristos                    int flags)
4808dffb485Schristos                   _GL_ARG_NONNULL ((2, 3)));
4818dffb485Schristos _GL_CXXALIAS_RPL (fstatat, int,
4828dffb485Schristos                   (int fd, char const *restrict name, struct stat *restrict st,
4838dffb485Schristos                    int flags));
4848dffb485Schristos # else
4858dffb485Schristos #  if !@HAVE_FSTATAT@
4868dffb485Schristos _GL_FUNCDECL_SYS (fstatat, int,
4878dffb485Schristos                   (int fd, char const *restrict name, struct stat *restrict st,
4888dffb485Schristos                    int flags)
4898dffb485Schristos                   _GL_ARG_NONNULL ((2, 3)));
4908dffb485Schristos #  endif
4918dffb485Schristos _GL_CXXALIAS_SYS (fstatat, int,
4928dffb485Schristos                   (int fd, char const *restrict name, struct stat *restrict st,
4938dffb485Schristos                    int flags));
4948dffb485Schristos # endif
4958dffb485Schristos _GL_CXXALIASWARN (fstatat);
4968dffb485Schristos #elif @GNULIB_OVERRIDES_STRUCT_STAT@
4978dffb485Schristos # undef fstatat
4988dffb485Schristos # define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
4998dffb485Schristos #elif defined GNULIB_POSIXCHECK
5008dffb485Schristos # undef fstatat
5018dffb485Schristos # if HAVE_RAW_DECL_FSTATAT
5028dffb485Schristos _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
5038dffb485Schristos                  "use gnulib module openat for portability");
5048dffb485Schristos # endif
5058dffb485Schristos #endif
5068dffb485Schristos 
5078dffb485Schristos 
5088dffb485Schristos #if @GNULIB_FUTIMENS@
5098dffb485Schristos /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
5108dffb485Schristos    implementation relies on futimesat, which on Solaris 10 makes an invocation
5118dffb485Schristos    to futimens that is meant to invoke the libc's futimens(), not gnulib's
5128dffb485Schristos    futimens().  */
5138dffb485Schristos # if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
5148dffb485Schristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
5158dffb485Schristos #   undef futimens
5168dffb485Schristos #   define futimens rpl_futimens
5178dffb485Schristos #  endif
5188dffb485Schristos _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
5198dffb485Schristos _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
5208dffb485Schristos # else
5218dffb485Schristos #  if !@HAVE_FUTIMENS@
5228dffb485Schristos _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
5238dffb485Schristos #  endif
5248dffb485Schristos _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
5258dffb485Schristos # endif
5268dffb485Schristos # if @HAVE_FUTIMENS@
5278dffb485Schristos _GL_CXXALIASWARN (futimens);
5288dffb485Schristos # endif
5298dffb485Schristos #elif defined GNULIB_POSIXCHECK
5308dffb485Schristos # undef futimens
5318dffb485Schristos # if HAVE_RAW_DECL_FUTIMENS
5328dffb485Schristos _GL_WARN_ON_USE (futimens, "futimens is not portable - "
5338dffb485Schristos                  "use gnulib module futimens for portability");
5348dffb485Schristos # endif
5358dffb485Schristos #endif
5368dffb485Schristos 
5378dffb485Schristos 
538*4b169a6bSchristos #if @GNULIB_GETUMASK@
539*4b169a6bSchristos # if !@HAVE_GETUMASK@
540*4b169a6bSchristos _GL_FUNCDECL_SYS (getumask, mode_t, (void));
541*4b169a6bSchristos # endif
542*4b169a6bSchristos _GL_CXXALIAS_SYS (getumask, mode_t, (void));
543*4b169a6bSchristos # if @HAVE_GETUMASK@
544*4b169a6bSchristos _GL_CXXALIASWARN (getumask);
545*4b169a6bSchristos # endif
546*4b169a6bSchristos #elif defined GNULIB_POSIXCHECK
547*4b169a6bSchristos # undef getumask
548*4b169a6bSchristos # if HAVE_RAW_DECL_GETUMASK
549*4b169a6bSchristos _GL_WARN_ON_USE (getumask, "getumask is not portable - "
550*4b169a6bSchristos                  "use gnulib module getumask for portability");
551*4b169a6bSchristos # endif
552*4b169a6bSchristos #endif
553*4b169a6bSchristos 
554*4b169a6bSchristos 
5558dffb485Schristos #if @GNULIB_LCHMOD@
5568dffb485Schristos /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
5578dffb485Schristos    denotes a symbolic link.  */
5588dffb485Schristos # if !@HAVE_LCHMOD@ || defined __hpux
5598dffb485Schristos _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
5608dffb485Schristos                                _GL_ARG_NONNULL ((1)));
5618dffb485Schristos # endif
5628dffb485Schristos _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
5638dffb485Schristos _GL_CXXALIASWARN (lchmod);
5648dffb485Schristos #elif defined GNULIB_POSIXCHECK
5658dffb485Schristos # undef lchmod
5668dffb485Schristos # if HAVE_RAW_DECL_LCHMOD
5678dffb485Schristos _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
5688dffb485Schristos                  "use gnulib module lchmod for portability");
5698dffb485Schristos # endif
5708dffb485Schristos #endif
5718dffb485Schristos 
5728dffb485Schristos 
5738dffb485Schristos #if @GNULIB_LSTAT@
5748dffb485Schristos # if ! @HAVE_LSTAT@
5758dffb485Schristos /* mingw does not support symlinks, therefore it does not have lstat.  But
5768dffb485Schristos    without links, stat does just fine.  */
5778dffb485Schristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
5788dffb485Schristos #   define lstat stat
5798dffb485Schristos #  endif
5808dffb485Schristos _GL_CXXALIAS_RPL_1 (lstat, stat, int,
5818dffb485Schristos                     (const char *restrict name, struct stat *restrict buf));
5828dffb485Schristos # elif @REPLACE_LSTAT@
5838dffb485Schristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
5848dffb485Schristos #   undef lstat
5858dffb485Schristos #   define lstat rpl_lstat
5868dffb485Schristos #  endif
5878dffb485Schristos _GL_FUNCDECL_RPL (lstat, int,
5888dffb485Schristos                   (const char *restrict name, struct stat *restrict buf)
5898dffb485Schristos                   _GL_ARG_NONNULL ((1, 2)));
5908dffb485Schristos _GL_CXXALIAS_RPL (lstat, int,
5918dffb485Schristos                   (const char *restrict name, struct stat *restrict buf));
5928dffb485Schristos # else
5938dffb485Schristos _GL_CXXALIAS_SYS (lstat, int,
5948dffb485Schristos                   (const char *restrict name, struct stat *restrict buf));
5958dffb485Schristos # endif
5968dffb485Schristos # if @HAVE_LSTAT@
5978dffb485Schristos _GL_CXXALIASWARN (lstat);
5988dffb485Schristos # endif
5998dffb485Schristos #elif @GNULIB_OVERRIDES_STRUCT_STAT@
6008dffb485Schristos # undef lstat
6018dffb485Schristos # define lstat lstat_used_without_requesting_gnulib_module_lstat
6028dffb485Schristos #elif defined GNULIB_POSIXCHECK
6038dffb485Schristos # undef lstat
6048dffb485Schristos # if HAVE_RAW_DECL_LSTAT
6058dffb485Schristos _GL_WARN_ON_USE (lstat, "lstat is unportable - "
6068dffb485Schristos                  "use gnulib module lstat for portability");
6078dffb485Schristos # endif
6088dffb485Schristos #endif
6098dffb485Schristos 
6108dffb485Schristos 
611*4b169a6bSchristos #if @GNULIB_MKDIR@
6128dffb485Schristos # if @REPLACE_MKDIR@
6138dffb485Schristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
6148dffb485Schristos #   undef mkdir
6158dffb485Schristos #   define mkdir rpl_mkdir
6168dffb485Schristos #  endif
6178dffb485Schristos _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
6188dffb485Schristos                                _GL_ARG_NONNULL ((1)));
6198dffb485Schristos _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
620*4b169a6bSchristos # elif defined _WIN32 && !defined __CYGWIN__
6218dffb485Schristos /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
6228dffb485Schristos    Additionally, it declares _mkdir (and depending on compile flags, an
6238dffb485Schristos    alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
6248dffb485Schristos    which are included above.  */
6258dffb485Schristos #  if !GNULIB_defined_rpl_mkdir
6268dffb485Schristos static int
6278dffb485Schristos rpl_mkdir (char const *name, mode_t mode)
6288dffb485Schristos {
6298dffb485Schristos   return _mkdir (name);
6308dffb485Schristos }
6318dffb485Schristos #   define GNULIB_defined_rpl_mkdir 1
6328dffb485Schristos #  endif
6338dffb485Schristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
634*4b169a6bSchristos #   undef mkdir
6358dffb485Schristos #   define mkdir rpl_mkdir
6368dffb485Schristos #  endif
6378dffb485Schristos _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
6388dffb485Schristos # else
6398dffb485Schristos _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
6408dffb485Schristos # endif
641*4b169a6bSchristos _GL_CXXALIASWARN (mkdir);
642*4b169a6bSchristos #elif defined GNULIB_POSIXCHECK
643*4b169a6bSchristos # undef mkdir
644*4b169a6bSchristos # if HAVE_RAW_DECL_MKDIR
645*4b169a6bSchristos _GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
646*4b169a6bSchristos                  "use gnulib module mkdir for portability");
647*4b169a6bSchristos # endif
648*4b169a6bSchristos #elif @GNULIB_MDA_MKDIR@
649*4b169a6bSchristos /* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not
650*4b169a6bSchristos    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
651*4b169a6bSchristos    platforms by defining GNULIB_NAMESPACE::mkdir always.  */
652*4b169a6bSchristos # if defined _WIN32 && !defined __CYGWIN__
653*4b169a6bSchristos #  if !GNULIB_defined_rpl_mkdir
654*4b169a6bSchristos static int
655*4b169a6bSchristos rpl_mkdir (char const *name, mode_t mode)
656*4b169a6bSchristos {
657*4b169a6bSchristos   return _mkdir (name);
658*4b169a6bSchristos }
659*4b169a6bSchristos #   define GNULIB_defined_rpl_mkdir 1
660*4b169a6bSchristos #  endif
661*4b169a6bSchristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
662*4b169a6bSchristos #   undef mkdir
663*4b169a6bSchristos #   define mkdir rpl_mkdir
664*4b169a6bSchristos #  endif
665*4b169a6bSchristos _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
666*4b169a6bSchristos # else
667*4b169a6bSchristos _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
6688dffb485Schristos # endif
6698dffb485Schristos _GL_CXXALIASWARN (mkdir);
670*4b169a6bSchristos #endif
6718dffb485Schristos 
6728dffb485Schristos 
6738dffb485Schristos #if @GNULIB_MKDIRAT@
6748dffb485Schristos # if !@HAVE_MKDIRAT@
6758dffb485Schristos _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
6768dffb485Schristos                                 _GL_ARG_NONNULL ((2)));
6778dffb485Schristos # endif
6788dffb485Schristos _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
6798dffb485Schristos _GL_CXXALIASWARN (mkdirat);
6808dffb485Schristos #elif defined GNULIB_POSIXCHECK
6818dffb485Schristos # undef mkdirat
6828dffb485Schristos # if HAVE_RAW_DECL_MKDIRAT
6838dffb485Schristos _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
6848dffb485Schristos                  "use gnulib module openat for portability");
6858dffb485Schristos # endif
6868dffb485Schristos #endif
6878dffb485Schristos 
6888dffb485Schristos 
6898dffb485Schristos #if @GNULIB_MKFIFO@
6908dffb485Schristos # if @REPLACE_MKFIFO@
6918dffb485Schristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
6928dffb485Schristos #   undef mkfifo
6938dffb485Schristos #   define mkfifo rpl_mkfifo
6948dffb485Schristos #  endif
6958dffb485Schristos _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
6968dffb485Schristos                                _GL_ARG_NONNULL ((1)));
6978dffb485Schristos _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
6988dffb485Schristos # else
6998dffb485Schristos #  if !@HAVE_MKFIFO@
7008dffb485Schristos _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
7018dffb485Schristos                                _GL_ARG_NONNULL ((1)));
7028dffb485Schristos #  endif
7038dffb485Schristos _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
7048dffb485Schristos # endif
7058dffb485Schristos _GL_CXXALIASWARN (mkfifo);
7068dffb485Schristos #elif defined GNULIB_POSIXCHECK
7078dffb485Schristos # undef mkfifo
7088dffb485Schristos # if HAVE_RAW_DECL_MKFIFO
7098dffb485Schristos _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
7108dffb485Schristos                  "use gnulib module mkfifo for portability");
7118dffb485Schristos # endif
7128dffb485Schristos #endif
7138dffb485Schristos 
7148dffb485Schristos 
7158dffb485Schristos #if @GNULIB_MKFIFOAT@
716*4b169a6bSchristos # if @REPLACE_MKFIFOAT@
717*4b169a6bSchristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
718*4b169a6bSchristos #   undef mkfifoat
719*4b169a6bSchristos #   define mkfifoat rpl_mkfifoat
720*4b169a6bSchristos #  endif
721*4b169a6bSchristos _GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)
722*4b169a6bSchristos                                  _GL_ARG_NONNULL ((2)));
723*4b169a6bSchristos _GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
724*4b169a6bSchristos # else
7258dffb485Schristos #  if !@HAVE_MKFIFOAT@
7268dffb485Schristos _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
7278dffb485Schristos                                  _GL_ARG_NONNULL ((2)));
7288dffb485Schristos #  endif
7298dffb485Schristos _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
730*4b169a6bSchristos # endif
7318dffb485Schristos _GL_CXXALIASWARN (mkfifoat);
7328dffb485Schristos #elif defined GNULIB_POSIXCHECK
7338dffb485Schristos # undef mkfifoat
7348dffb485Schristos # if HAVE_RAW_DECL_MKFIFOAT
7358dffb485Schristos _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
7368dffb485Schristos                  "use gnulib module mkfifoat for portability");
7378dffb485Schristos # endif
7388dffb485Schristos #endif
7398dffb485Schristos 
7408dffb485Schristos 
7418dffb485Schristos #if @GNULIB_MKNOD@
7428dffb485Schristos # if @REPLACE_MKNOD@
7438dffb485Schristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
7448dffb485Schristos #   undef mknod
7458dffb485Schristos #   define mknod rpl_mknod
7468dffb485Schristos #  endif
7478dffb485Schristos _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
7488dffb485Schristos                               _GL_ARG_NONNULL ((1)));
7498dffb485Schristos _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
7508dffb485Schristos # else
7518dffb485Schristos #  if !@HAVE_MKNOD@
7528dffb485Schristos _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
7538dffb485Schristos                               _GL_ARG_NONNULL ((1)));
7548dffb485Schristos #  endif
7558dffb485Schristos /* Need to cast, because on OSF/1 5.1, the third parameter is '...'.  */
7568dffb485Schristos _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
7578dffb485Schristos # endif
7588dffb485Schristos _GL_CXXALIASWARN (mknod);
7598dffb485Schristos #elif defined GNULIB_POSIXCHECK
7608dffb485Schristos # undef mknod
7618dffb485Schristos # if HAVE_RAW_DECL_MKNOD
7628dffb485Schristos _GL_WARN_ON_USE (mknod, "mknod is not portable - "
7638dffb485Schristos                  "use gnulib module mknod for portability");
7648dffb485Schristos # endif
7658dffb485Schristos #endif
7668dffb485Schristos 
7678dffb485Schristos 
7688dffb485Schristos #if @GNULIB_MKNODAT@
769*4b169a6bSchristos # if @REPLACE_MKNODAT@
770*4b169a6bSchristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
771*4b169a6bSchristos #   undef mknodat
772*4b169a6bSchristos #   define mknodat rpl_mknodat
773*4b169a6bSchristos #  endif
774*4b169a6bSchristos _GL_FUNCDECL_RPL (mknodat, int,
775*4b169a6bSchristos                   (int fd, char const *file, mode_t mode, dev_t dev)
776*4b169a6bSchristos                   _GL_ARG_NONNULL ((2)));
777*4b169a6bSchristos _GL_CXXALIAS_RPL (mknodat, int,
778*4b169a6bSchristos                   (int fd, char const *file, mode_t mode, dev_t dev));
779*4b169a6bSchristos # else
7808dffb485Schristos #  if !@HAVE_MKNODAT@
7818dffb485Schristos _GL_FUNCDECL_SYS (mknodat, int,
7828dffb485Schristos                   (int fd, char const *file, mode_t mode, dev_t dev)
7838dffb485Schristos                   _GL_ARG_NONNULL ((2)));
7848dffb485Schristos #  endif
7858dffb485Schristos _GL_CXXALIAS_SYS (mknodat, int,
7868dffb485Schristos                   (int fd, char const *file, mode_t mode, dev_t dev));
787*4b169a6bSchristos # endif
7888dffb485Schristos _GL_CXXALIASWARN (mknodat);
7898dffb485Schristos #elif defined GNULIB_POSIXCHECK
7908dffb485Schristos # undef mknodat
7918dffb485Schristos # if HAVE_RAW_DECL_MKNODAT
7928dffb485Schristos _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
7938dffb485Schristos                  "use gnulib module mkfifoat for portability");
7948dffb485Schristos # endif
7958dffb485Schristos #endif
7968dffb485Schristos 
7978dffb485Schristos 
7988dffb485Schristos #if @GNULIB_STAT@
7998dffb485Schristos # if @REPLACE_STAT@
8008dffb485Schristos #  if !@GNULIB_OVERRIDES_STRUCT_STAT@
8018dffb485Schristos     /* We can't use the object-like #define stat rpl_stat, because of
8028dffb485Schristos        struct stat.  This means that rpl_stat will not be used if the user
8038dffb485Schristos        does (stat)(a,b).  Oh well.  */
8048dffb485Schristos #   if defined _AIX && defined stat && defined _LARGE_FILES
8058dffb485Schristos      /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
8068dffb485Schristos         so we have to replace stat64() instead of stat(). */
8078dffb485Schristos #    undef stat64
8088dffb485Schristos #    define stat64(name, st) rpl_stat (name, st)
8098dffb485Schristos #   elif @WINDOWS_64_BIT_ST_SIZE@
8108dffb485Schristos      /* Above, we define stat to _stati64.  */
8118dffb485Schristos #    if defined __MINGW32__ && defined _stati64
8128dffb485Schristos #     ifndef _USE_32BIT_TIME_T
8138dffb485Schristos        /* The system headers define _stati64 to _stat64.  */
8148dffb485Schristos #      undef _stat64
8158dffb485Schristos #      define _stat64(name, st) rpl_stat (name, st)
8168dffb485Schristos #     endif
8178dffb485Schristos #    elif defined _MSC_VER && defined _stati64
8188dffb485Schristos #     ifdef _USE_32BIT_TIME_T
8198dffb485Schristos        /* The system headers define _stati64 to _stat32i64.  */
8208dffb485Schristos #      undef _stat32i64
8218dffb485Schristos #      define _stat32i64(name, st) rpl_stat (name, st)
8228dffb485Schristos #     else
8238dffb485Schristos        /* The system headers define _stati64 to _stat64.  */
8248dffb485Schristos #      undef _stat64
8258dffb485Schristos #      define _stat64(name, st) rpl_stat (name, st)
8268dffb485Schristos #     endif
8278dffb485Schristos #    else
8288dffb485Schristos #     undef _stati64
8298dffb485Schristos #     define _stati64(name, st) rpl_stat (name, st)
8308dffb485Schristos #    endif
8318dffb485Schristos #   elif defined __MINGW32__ && defined stat
8328dffb485Schristos #    ifdef _USE_32BIT_TIME_T
8338dffb485Schristos       /* The system headers define stat to _stat32i64.  */
8348dffb485Schristos #     undef _stat32i64
8358dffb485Schristos #     define _stat32i64(name, st) rpl_stat (name, st)
8368dffb485Schristos #    else
8378dffb485Schristos       /* The system headers define stat to _stat64.  */
8388dffb485Schristos #     undef _stat64
8398dffb485Schristos #     define _stat64(name, st) rpl_stat (name, st)
8408dffb485Schristos #    endif
8418dffb485Schristos #   elif defined _MSC_VER && defined stat
8428dffb485Schristos #    ifdef _USE_32BIT_TIME_T
8438dffb485Schristos       /* The system headers define stat to _stat32.  */
8448dffb485Schristos #     undef _stat32
8458dffb485Schristos #     define _stat32(name, st) rpl_stat (name, st)
8468dffb485Schristos #    else
8478dffb485Schristos       /* The system headers define stat to _stat64i32.  */
8488dffb485Schristos #     undef _stat64i32
8498dffb485Schristos #     define _stat64i32(name, st) rpl_stat (name, st)
8508dffb485Schristos #    endif
8518dffb485Schristos #   else /* !(_AIX || __MINGW32__ || _MSC_VER) */
8528dffb485Schristos #    undef stat
8538dffb485Schristos #    define stat(name, st) rpl_stat (name, st)
8548dffb485Schristos #   endif /* !_LARGE_FILES */
8558dffb485Schristos #  endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */
8568dffb485Schristos _GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf)
8578dffb485Schristos                       _GL_ARG_NONNULL ((1, 2));
8588dffb485Schristos # endif
8598dffb485Schristos #elif @GNULIB_OVERRIDES_STRUCT_STAT@
8608dffb485Schristos /* see above:
8618dffb485Schristos   #define stat stat_used_without_requesting_gnulib_module_stat
8628dffb485Schristos  */
8638dffb485Schristos #elif defined GNULIB_POSIXCHECK
8648dffb485Schristos # undef stat
8658dffb485Schristos # if HAVE_RAW_DECL_STAT
8668dffb485Schristos _GL_WARN_ON_USE (stat, "stat is unportable - "
8678dffb485Schristos                  "use gnulib module stat for portability");
8688dffb485Schristos # endif
8698dffb485Schristos #endif
8708dffb485Schristos 
8718dffb485Schristos 
872*4b169a6bSchristos #if @GNULIB_MDA_UMASK@
873*4b169a6bSchristos /* On native Windows, map 'umask' to '_umask', so that -loldnames is not
874*4b169a6bSchristos    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
875*4b169a6bSchristos    platforms by defining GNULIB_NAMESPACE::umask always.  */
876*4b169a6bSchristos # if defined _WIN32 && !defined __CYGWIN__
877*4b169a6bSchristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
878*4b169a6bSchristos #   undef umask
879*4b169a6bSchristos #   define umask _umask
880*4b169a6bSchristos #  endif
881*4b169a6bSchristos /* Need to cast, because in mingw the last argument is 'int mode'.  */
882*4b169a6bSchristos _GL_CXXALIAS_MDA_CAST (umask, mode_t, (mode_t mask));
883*4b169a6bSchristos # else
884*4b169a6bSchristos _GL_CXXALIAS_SYS (umask, mode_t, (mode_t mask));
885*4b169a6bSchristos # endif
886*4b169a6bSchristos _GL_CXXALIASWARN (umask);
887*4b169a6bSchristos #endif
888*4b169a6bSchristos 
889*4b169a6bSchristos 
8908dffb485Schristos #if @GNULIB_UTIMENSAT@
8918dffb485Schristos /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
8928dffb485Schristos    implementation relies on futimesat, which on Solaris 10 makes an invocation
8938dffb485Schristos    to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
8948dffb485Schristos    utimensat().  */
8958dffb485Schristos # if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
8968dffb485Schristos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
8978dffb485Schristos #   undef utimensat
8988dffb485Schristos #   define utimensat rpl_utimensat
8998dffb485Schristos #  endif
9008dffb485Schristos _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
9018dffb485Schristos                                    struct timespec const times[2], int flag)
9028dffb485Schristos                                   _GL_ARG_NONNULL ((2)));
9038dffb485Schristos _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
9048dffb485Schristos                                    struct timespec const times[2], int flag));
9058dffb485Schristos # else
9068dffb485Schristos #  if !@HAVE_UTIMENSAT@
9078dffb485Schristos _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
9088dffb485Schristos                                    struct timespec const times[2], int flag)
9098dffb485Schristos                                   _GL_ARG_NONNULL ((2)));
9108dffb485Schristos #  endif
9118dffb485Schristos _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
9128dffb485Schristos                                    struct timespec const times[2], int flag));
9138dffb485Schristos # endif
9148dffb485Schristos # if @HAVE_UTIMENSAT@
9158dffb485Schristos _GL_CXXALIASWARN (utimensat);
9168dffb485Schristos # endif
9178dffb485Schristos #elif defined GNULIB_POSIXCHECK
9188dffb485Schristos # undef utimensat
9198dffb485Schristos # if HAVE_RAW_DECL_UTIMENSAT
9208dffb485Schristos _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
9218dffb485Schristos                  "use gnulib module utimensat for portability");
9228dffb485Schristos # endif
9238dffb485Schristos #endif
9248dffb485Schristos 
9258dffb485Schristos 
9268dffb485Schristos #endif /* _@GUARD_PREFIX@_SYS_STAT_H */
9278dffb485Schristos #endif /* _@GUARD_PREFIX@_SYS_STAT_H */
9288dffb485Schristos #endif
929