Home | History | Annotate | Line # | Download | only in import
      1      1.1  christos /* Provide a more complete sys/stat.h header file.
      2  1.1.1.2  christos    Copyright (C) 2005-2022 Free Software Foundation, Inc.
      3      1.1  christos 
      4  1.1.1.2  christos    This file is free software: you can redistribute it and/or modify
      5  1.1.1.2  christos    it under the terms of the GNU Lesser General Public License as
      6  1.1.1.2  christos    published by the Free Software Foundation; either version 2.1 of the
      7  1.1.1.2  christos    License, or (at your option) any later version.
      8      1.1  christos 
      9  1.1.1.2  christos    This file is distributed in the hope that it will be useful,
     10      1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     11      1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12  1.1.1.2  christos    GNU Lesser General Public License for more details.
     13      1.1  christos 
     14  1.1.1.2  christos    You should have received a copy of the GNU Lesser General Public License
     15  1.1.1.2  christos    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
     16      1.1  christos 
     17      1.1  christos /* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
     18      1.1  christos 
     19      1.1  christos /* This file is supposed to be used on platforms where <sys/stat.h> is
     20      1.1  christos    incomplete.  It is intended to provide definitions and prototypes
     21      1.1  christos    needed by an application.  Start with what the system provides.  */
     22      1.1  christos 
     23      1.1  christos #if __GNUC__ >= 3
     24      1.1  christos @PRAGMA_SYSTEM_HEADER@
     25      1.1  christos #endif
     26      1.1  christos @PRAGMA_COLUMNS@
     27      1.1  christos 
     28      1.1  christos #if defined __need_system_sys_stat_h
     29      1.1  christos /* Special invocation convention.  */
     30      1.1  christos 
     31      1.1  christos #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
     32      1.1  christos 
     33      1.1  christos #else
     34      1.1  christos /* Normal invocation convention.  */
     35      1.1  christos 
     36      1.1  christos #ifndef _@GUARD_PREFIX@_SYS_STAT_H
     37      1.1  christos 
     38      1.1  christos /* Get nlink_t.
     39      1.1  christos    May also define off_t to a 64-bit type on native Windows.  */
     40      1.1  christos #include <sys/types.h>
     41      1.1  christos 
     42      1.1  christos /* Get struct timespec.  */
     43      1.1  christos #include <time.h>
     44      1.1  christos 
     45      1.1  christos /* The include_next requires a split double-inclusion guard.  */
     46      1.1  christos #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
     47      1.1  christos 
     48      1.1  christos #ifndef _@GUARD_PREFIX@_SYS_STAT_H
     49      1.1  christos #define _@GUARD_PREFIX@_SYS_STAT_H
     50      1.1  christos 
     51      1.1  christos /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
     52      1.1  christos 
     53      1.1  christos /* The definition of _GL_ARG_NONNULL is copied here.  */
     54      1.1  christos 
     55      1.1  christos /* The definition of _GL_WARN_ON_USE is copied here.  */
     56      1.1  christos 
     57      1.1  christos /* Before doing "#define mknod rpl_mknod" below, we need to include all
     58      1.1  christos    headers that may declare mknod().  OS/2 kLIBC declares mknod() in
     59      1.1  christos    <unistd.h>, not in <sys/stat.h>.  */
     60      1.1  christos #ifdef __KLIBC__
     61      1.1  christos # include <unistd.h>
     62      1.1  christos #endif
     63      1.1  christos 
     64      1.1  christos /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
     65      1.1  christos    headers that may declare mkdir().  Native Windows platforms declare mkdir
     66      1.1  christos    in <io.h> and/or <direct.h>, not in <sys/stat.h>.  */
     67      1.1  christos #if defined _WIN32 && ! defined __CYGWIN__
     68      1.1  christos # include <io.h>     /* mingw32, mingw64 */
     69      1.1  christos # include <direct.h> /* mingw64, MSVC 9 */
     70      1.1  christos #endif
     71      1.1  christos 
     72      1.1  christos /* Native Windows platforms declare umask() in <io.h>.  */
     73      1.1  christos #if 0 && (defined _WIN32 && ! defined __CYGWIN__)
     74      1.1  christos # include <io.h>
     75      1.1  christos #endif
     76      1.1  christos 
     77      1.1  christos /* Large File Support on native Windows.  */
     78      1.1  christos #if @WINDOWS_64_BIT_ST_SIZE@
     79      1.1  christos # define stat _stati64
     80      1.1  christos #endif
     81      1.1  christos 
     82      1.1  christos /* Optionally, override 'struct stat' on native Windows.  */
     83      1.1  christos #if @GNULIB_OVERRIDES_STRUCT_STAT@
     84      1.1  christos 
     85      1.1  christos # undef stat
     86      1.1  christos # if @GNULIB_STAT@
     87      1.1  christos #  define stat rpl_stat
     88      1.1  christos # else
     89      1.1  christos    /* Provoke a clear link error if stat() is used as a function and
     90      1.1  christos       module 'stat' is not in use.  */
     91      1.1  christos #  define stat stat_used_without_requesting_gnulib_module_stat
     92      1.1  christos # endif
     93      1.1  christos 
     94      1.1  christos # if !GNULIB_defined_struct_stat
     95      1.1  christos struct stat
     96      1.1  christos {
     97      1.1  christos   dev_t st_dev;
     98      1.1  christos   ino_t st_ino;
     99      1.1  christos   mode_t st_mode;
    100      1.1  christos   nlink_t st_nlink;
    101      1.1  christos #  if 0
    102      1.1  christos   uid_t st_uid;
    103      1.1  christos #  else /* uid_t is not defined by default on native Windows.  */
    104      1.1  christos   short st_uid;
    105      1.1  christos #  endif
    106      1.1  christos #  if 0
    107      1.1  christos   gid_t st_gid;
    108      1.1  christos #  else /* gid_t is not defined by default on native Windows.  */
    109      1.1  christos   short st_gid;
    110      1.1  christos #  endif
    111      1.1  christos   dev_t st_rdev;
    112      1.1  christos   off_t st_size;
    113      1.1  christos #  if 0
    114      1.1  christos   blksize_t st_blksize;
    115      1.1  christos   blkcnt_t st_blocks;
    116      1.1  christos #  endif
    117      1.1  christos 
    118      1.1  christos #  if @WINDOWS_STAT_TIMESPEC@
    119      1.1  christos   struct timespec st_atim;
    120      1.1  christos   struct timespec st_mtim;
    121      1.1  christos   struct timespec st_ctim;
    122      1.1  christos #  else
    123      1.1  christos   time_t st_atime;
    124      1.1  christos   time_t st_mtime;
    125      1.1  christos   time_t st_ctime;
    126      1.1  christos #  endif
    127      1.1  christos };
    128      1.1  christos #  if @WINDOWS_STAT_TIMESPEC@
    129      1.1  christos #   define st_atime st_atim.tv_sec
    130      1.1  christos #   define st_mtime st_mtim.tv_sec
    131      1.1  christos #   define st_ctime st_ctim.tv_sec
    132      1.1  christos     /* Indicator, for gnulib internal purposes.  */
    133      1.1  christos #   define _GL_WINDOWS_STAT_TIMESPEC 1
    134      1.1  christos #  endif
    135      1.1  christos #  define GNULIB_defined_struct_stat 1
    136      1.1  christos # endif
    137      1.1  christos 
    138      1.1  christos /* Other possible values of st_mode.  */
    139      1.1  christos # if 0
    140      1.1  christos #  define _S_IFBLK  0x6000
    141      1.1  christos # endif
    142      1.1  christos # if 0
    143      1.1  christos #  define _S_IFLNK  0xA000
    144      1.1  christos # endif
    145      1.1  christos # if 0
    146      1.1  christos #  define _S_IFSOCK 0xC000
    147      1.1  christos # endif
    148      1.1  christos 
    149      1.1  christos #endif
    150      1.1  christos 
    151      1.1  christos #ifndef S_IFIFO
    152      1.1  christos # ifdef _S_IFIFO
    153      1.1  christos #  define S_IFIFO _S_IFIFO
    154      1.1  christos # endif
    155      1.1  christos #endif
    156      1.1  christos 
    157      1.1  christos #ifndef S_IFMT
    158      1.1  christos # define S_IFMT 0170000
    159      1.1  christos #endif
    160      1.1  christos 
    161      1.1  christos #if STAT_MACROS_BROKEN
    162      1.1  christos # undef S_ISBLK
    163      1.1  christos # undef S_ISCHR
    164      1.1  christos # undef S_ISDIR
    165      1.1  christos # undef S_ISFIFO
    166      1.1  christos # undef S_ISLNK
    167      1.1  christos # undef S_ISNAM
    168      1.1  christos # undef S_ISMPB
    169      1.1  christos # undef S_ISMPC
    170      1.1  christos # undef S_ISNWK
    171      1.1  christos # undef S_ISREG
    172      1.1  christos # undef S_ISSOCK
    173      1.1  christos #endif
    174      1.1  christos 
    175      1.1  christos #ifndef S_ISBLK
    176      1.1  christos # ifdef S_IFBLK
    177      1.1  christos #  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
    178      1.1  christos # else
    179      1.1  christos #  define S_ISBLK(m) 0
    180      1.1  christos # endif
    181      1.1  christos #endif
    182      1.1  christos 
    183      1.1  christos #ifndef S_ISCHR
    184      1.1  christos # ifdef S_IFCHR
    185      1.1  christos #  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
    186      1.1  christos # else
    187      1.1  christos #  define S_ISCHR(m) 0
    188      1.1  christos # endif
    189      1.1  christos #endif
    190      1.1  christos 
    191      1.1  christos #ifndef S_ISDIR
    192      1.1  christos # ifdef S_IFDIR
    193      1.1  christos #  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
    194      1.1  christos # else
    195      1.1  christos #  define S_ISDIR(m) 0
    196      1.1  christos # endif
    197      1.1  christos #endif
    198      1.1  christos 
    199      1.1  christos #ifndef S_ISDOOR /* Solaris 2.5 and up */
    200      1.1  christos # define S_ISDOOR(m) 0
    201      1.1  christos #endif
    202      1.1  christos 
    203      1.1  christos #ifndef S_ISFIFO
    204      1.1  christos # ifdef S_IFIFO
    205      1.1  christos #  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
    206      1.1  christos # else
    207      1.1  christos #  define S_ISFIFO(m) 0
    208      1.1  christos # endif
    209      1.1  christos #endif
    210      1.1  christos 
    211      1.1  christos #ifndef S_ISLNK
    212      1.1  christos # ifdef S_IFLNK
    213      1.1  christos #  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
    214      1.1  christos # else
    215      1.1  christos #  define S_ISLNK(m) 0
    216      1.1  christos # endif
    217      1.1  christos #endif
    218      1.1  christos 
    219      1.1  christos #ifndef S_ISMPB /* V7 */
    220      1.1  christos # ifdef S_IFMPB
    221      1.1  christos #  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
    222      1.1  christos #  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
    223      1.1  christos # else
    224      1.1  christos #  define S_ISMPB(m) 0
    225      1.1  christos #  define S_ISMPC(m) 0
    226      1.1  christos # endif
    227      1.1  christos #endif
    228      1.1  christos 
    229      1.1  christos #ifndef S_ISMPX /* AIX */
    230      1.1  christos # define S_ISMPX(m) 0
    231      1.1  christos #endif
    232      1.1  christos 
    233      1.1  christos #ifndef S_ISNAM /* Xenix */
    234      1.1  christos # ifdef S_IFNAM
    235      1.1  christos #  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
    236      1.1  christos # else
    237      1.1  christos #  define S_ISNAM(m) 0
    238      1.1  christos # endif
    239      1.1  christos #endif
    240      1.1  christos 
    241      1.1  christos #ifndef S_ISNWK /* HP/UX */
    242      1.1  christos # ifdef S_IFNWK
    243      1.1  christos #  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
    244      1.1  christos # else
    245      1.1  christos #  define S_ISNWK(m) 0
    246      1.1  christos # endif
    247      1.1  christos #endif
    248      1.1  christos 
    249      1.1  christos #ifndef S_ISPORT /* Solaris 10 and up */
    250      1.1  christos # define S_ISPORT(m) 0
    251      1.1  christos #endif
    252      1.1  christos 
    253      1.1  christos #ifndef S_ISREG
    254      1.1  christos # ifdef S_IFREG
    255      1.1  christos #  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
    256      1.1  christos # else
    257      1.1  christos #  define S_ISREG(m) 0
    258      1.1  christos # endif
    259      1.1  christos #endif
    260      1.1  christos 
    261      1.1  christos #ifndef S_ISSOCK
    262      1.1  christos # ifdef S_IFSOCK
    263      1.1  christos #  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
    264      1.1  christos # else
    265      1.1  christos #  define S_ISSOCK(m) 0
    266      1.1  christos # endif
    267      1.1  christos #endif
    268      1.1  christos 
    269      1.1  christos 
    270      1.1  christos #ifndef S_TYPEISMQ
    271      1.1  christos # define S_TYPEISMQ(p) 0
    272      1.1  christos #endif
    273      1.1  christos 
    274      1.1  christos #ifndef S_TYPEISTMO
    275      1.1  christos # define S_TYPEISTMO(p) 0
    276      1.1  christos #endif
    277      1.1  christos 
    278      1.1  christos 
    279      1.1  christos #ifndef S_TYPEISSEM
    280      1.1  christos # ifdef S_INSEM
    281      1.1  christos #  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
    282      1.1  christos # else
    283      1.1  christos #  define S_TYPEISSEM(p) 0
    284      1.1  christos # endif
    285      1.1  christos #endif
    286      1.1  christos 
    287      1.1  christos #ifndef S_TYPEISSHM
    288      1.1  christos # ifdef S_INSHD
    289      1.1  christos #  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
    290      1.1  christos # else
    291      1.1  christos #  define S_TYPEISSHM(p) 0
    292      1.1  christos # endif
    293      1.1  christos #endif
    294      1.1  christos 
    295      1.1  christos /* high performance ("contiguous data") */
    296      1.1  christos #ifndef S_ISCTG
    297      1.1  christos # define S_ISCTG(p) 0
    298      1.1  christos #endif
    299      1.1  christos 
    300      1.1  christos /* Cray DMF (data migration facility): off line, with data  */
    301      1.1  christos #ifndef S_ISOFD
    302      1.1  christos # define S_ISOFD(p) 0
    303      1.1  christos #endif
    304      1.1  christos 
    305      1.1  christos /* Cray DMF (data migration facility): off line, with no data  */
    306      1.1  christos #ifndef S_ISOFL
    307      1.1  christos # define S_ISOFL(p) 0
    308      1.1  christos #endif
    309      1.1  christos 
    310      1.1  christos /* 4.4BSD whiteout */
    311      1.1  christos #ifndef S_ISWHT
    312      1.1  christos # define S_ISWHT(m) 0
    313      1.1  christos #endif
    314      1.1  christos 
    315      1.1  christos /* If any of the following are undefined,
    316      1.1  christos    define them to their de facto standard values.  */
    317      1.1  christos #if !S_ISUID
    318      1.1  christos # define S_ISUID 04000
    319      1.1  christos #endif
    320      1.1  christos #if !S_ISGID
    321      1.1  christos # define S_ISGID 02000
    322      1.1  christos #endif
    323      1.1  christos 
    324      1.1  christos /* S_ISVTX is a common extension to POSIX.  */
    325      1.1  christos #ifndef S_ISVTX
    326      1.1  christos # define S_ISVTX 01000
    327      1.1  christos #endif
    328      1.1  christos 
    329      1.1  christos #if !S_IRUSR && S_IREAD
    330      1.1  christos # define S_IRUSR S_IREAD
    331      1.1  christos #endif
    332      1.1  christos #if !S_IRUSR
    333      1.1  christos # define S_IRUSR 00400
    334      1.1  christos #endif
    335      1.1  christos #if !S_IRGRP
    336      1.1  christos # define S_IRGRP (S_IRUSR >> 3)
    337      1.1  christos #endif
    338      1.1  christos #if !S_IROTH
    339      1.1  christos # define S_IROTH (S_IRUSR >> 6)
    340      1.1  christos #endif
    341      1.1  christos 
    342      1.1  christos #if !S_IWUSR && S_IWRITE
    343      1.1  christos # define S_IWUSR S_IWRITE
    344      1.1  christos #endif
    345      1.1  christos #if !S_IWUSR
    346      1.1  christos # define S_IWUSR 00200
    347      1.1  christos #endif
    348      1.1  christos #if !S_IWGRP
    349      1.1  christos # define S_IWGRP (S_IWUSR >> 3)
    350      1.1  christos #endif
    351      1.1  christos #if !S_IWOTH
    352      1.1  christos # define S_IWOTH (S_IWUSR >> 6)
    353      1.1  christos #endif
    354      1.1  christos 
    355      1.1  christos #if !S_IXUSR && S_IEXEC
    356      1.1  christos # define S_IXUSR S_IEXEC
    357      1.1  christos #endif
    358      1.1  christos #if !S_IXUSR
    359      1.1  christos # define S_IXUSR 00100
    360      1.1  christos #endif
    361      1.1  christos #if !S_IXGRP
    362      1.1  christos # define S_IXGRP (S_IXUSR >> 3)
    363      1.1  christos #endif
    364      1.1  christos #if !S_IXOTH
    365      1.1  christos # define S_IXOTH (S_IXUSR >> 6)
    366      1.1  christos #endif
    367      1.1  christos 
    368      1.1  christos #if !S_IRWXU
    369      1.1  christos # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
    370      1.1  christos #endif
    371      1.1  christos #if !S_IRWXG
    372      1.1  christos # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
    373      1.1  christos #endif
    374      1.1  christos #if !S_IRWXO
    375      1.1  christos # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
    376      1.1  christos #endif
    377      1.1  christos 
    378  1.1.1.2  christos /* Although S_IXUGO and S_IRWXUGO are not specified by POSIX and are
    379  1.1.1.2  christos    not implemented in GNU/Linux, some Gnulib-using apps use the macros.  */
    380      1.1  christos #if !S_IXUGO
    381      1.1  christos # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
    382      1.1  christos #endif
    383      1.1  christos #ifndef S_IRWXUGO
    384      1.1  christos # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
    385      1.1  christos #endif
    386      1.1  christos 
    387      1.1  christos /* Macros for futimens and utimensat.  */
    388      1.1  christos #ifndef UTIME_NOW
    389      1.1  christos # define UTIME_NOW (-1)
    390      1.1  christos # define UTIME_OMIT (-2)
    391      1.1  christos #endif
    392      1.1  christos 
    393      1.1  christos 
    394  1.1.1.2  christos #if @GNULIB_MDA_CHMOD@
    395  1.1.1.2  christos /* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
    396  1.1.1.2  christos    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
    397  1.1.1.2  christos    platforms by defining GNULIB_NAMESPACE::chmod always.  */
    398  1.1.1.2  christos # if defined _WIN32 && !defined __CYGWIN__
    399  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    400  1.1.1.2  christos #   undef chmod
    401  1.1.1.2  christos #   define chmod _chmod
    402  1.1.1.2  christos #  endif
    403  1.1.1.2  christos /* Need to cast, because in mingw the last argument is 'int mode'.  */
    404  1.1.1.2  christos _GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
    405  1.1.1.2  christos # else
    406  1.1.1.2  christos _GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
    407  1.1.1.2  christos # endif
    408  1.1.1.2  christos _GL_CXXALIASWARN (chmod);
    409  1.1.1.2  christos #endif
    410  1.1.1.2  christos 
    411  1.1.1.2  christos 
    412      1.1  christos #if @GNULIB_FCHMODAT@
    413      1.1  christos # if @REPLACE_FCHMODAT@
    414      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    415      1.1  christos #   undef fchmodat
    416      1.1  christos #   define fchmodat rpl_fchmodat
    417      1.1  christos #  endif
    418      1.1  christos _GL_FUNCDECL_RPL (fchmodat, int,
    419      1.1  christos                   (int fd, char const *file, mode_t mode, int flag)
    420      1.1  christos                   _GL_ARG_NONNULL ((2)));
    421      1.1  christos _GL_CXXALIAS_RPL (fchmodat, int,
    422      1.1  christos                   (int fd, char const *file, mode_t mode, int flag));
    423      1.1  christos # else
    424      1.1  christos #  if !@HAVE_FCHMODAT@
    425      1.1  christos _GL_FUNCDECL_SYS (fchmodat, int,
    426      1.1  christos                   (int fd, char const *file, mode_t mode, int flag)
    427      1.1  christos                   _GL_ARG_NONNULL ((2)));
    428      1.1  christos #  endif
    429      1.1  christos _GL_CXXALIAS_SYS (fchmodat, int,
    430      1.1  christos                   (int fd, char const *file, mode_t mode, int flag));
    431      1.1  christos # endif
    432      1.1  christos _GL_CXXALIASWARN (fchmodat);
    433      1.1  christos #elif defined GNULIB_POSIXCHECK
    434      1.1  christos # undef fchmodat
    435      1.1  christos # if HAVE_RAW_DECL_FCHMODAT
    436      1.1  christos _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
    437      1.1  christos                  "use gnulib module openat for portability");
    438      1.1  christos # endif
    439      1.1  christos #endif
    440      1.1  christos 
    441      1.1  christos 
    442      1.1  christos #if @GNULIB_FSTAT@
    443      1.1  christos # if @REPLACE_FSTAT@
    444      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    445      1.1  christos #   undef fstat
    446      1.1  christos #   define fstat rpl_fstat
    447      1.1  christos #  endif
    448      1.1  christos _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
    449      1.1  christos _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
    450      1.1  christos # else
    451      1.1  christos _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
    452      1.1  christos # endif
    453  1.1.1.2  christos # if __GLIBC__ >= 2
    454      1.1  christos _GL_CXXALIASWARN (fstat);
    455  1.1.1.2  christos # endif
    456      1.1  christos #elif @GNULIB_OVERRIDES_STRUCT_STAT@
    457      1.1  christos # undef fstat
    458      1.1  christos # define fstat fstat_used_without_requesting_gnulib_module_fstat
    459      1.1  christos #elif @WINDOWS_64_BIT_ST_SIZE@
    460      1.1  christos /* Above, we define stat to _stati64.  */
    461      1.1  christos # define fstat _fstati64
    462      1.1  christos #elif defined GNULIB_POSIXCHECK
    463      1.1  christos # undef fstat
    464      1.1  christos # if HAVE_RAW_DECL_FSTAT
    465      1.1  christos _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
    466      1.1  christos                  "use gnulib module fstat for portability");
    467      1.1  christos # endif
    468      1.1  christos #endif
    469      1.1  christos 
    470      1.1  christos 
    471      1.1  christos #if @GNULIB_FSTATAT@
    472      1.1  christos # if @REPLACE_FSTATAT@
    473      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    474      1.1  christos #   undef fstatat
    475      1.1  christos #   define fstatat rpl_fstatat
    476      1.1  christos #  endif
    477      1.1  christos _GL_FUNCDECL_RPL (fstatat, int,
    478      1.1  christos                   (int fd, char const *restrict name, struct stat *restrict st,
    479      1.1  christos                    int flags)
    480      1.1  christos                   _GL_ARG_NONNULL ((2, 3)));
    481      1.1  christos _GL_CXXALIAS_RPL (fstatat, int,
    482      1.1  christos                   (int fd, char const *restrict name, struct stat *restrict st,
    483      1.1  christos                    int flags));
    484      1.1  christos # else
    485      1.1  christos #  if !@HAVE_FSTATAT@
    486      1.1  christos _GL_FUNCDECL_SYS (fstatat, int,
    487      1.1  christos                   (int fd, char const *restrict name, struct stat *restrict st,
    488      1.1  christos                    int flags)
    489      1.1  christos                   _GL_ARG_NONNULL ((2, 3)));
    490      1.1  christos #  endif
    491      1.1  christos _GL_CXXALIAS_SYS (fstatat, int,
    492      1.1  christos                   (int fd, char const *restrict name, struct stat *restrict st,
    493      1.1  christos                    int flags));
    494      1.1  christos # endif
    495      1.1  christos _GL_CXXALIASWARN (fstatat);
    496      1.1  christos #elif @GNULIB_OVERRIDES_STRUCT_STAT@
    497      1.1  christos # undef fstatat
    498      1.1  christos # define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
    499      1.1  christos #elif defined GNULIB_POSIXCHECK
    500      1.1  christos # undef fstatat
    501      1.1  christos # if HAVE_RAW_DECL_FSTATAT
    502      1.1  christos _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
    503      1.1  christos                  "use gnulib module openat for portability");
    504      1.1  christos # endif
    505      1.1  christos #endif
    506      1.1  christos 
    507      1.1  christos 
    508      1.1  christos #if @GNULIB_FUTIMENS@
    509      1.1  christos /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
    510      1.1  christos    implementation relies on futimesat, which on Solaris 10 makes an invocation
    511      1.1  christos    to futimens that is meant to invoke the libc's futimens(), not gnulib's
    512      1.1  christos    futimens().  */
    513      1.1  christos # if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
    514      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    515      1.1  christos #   undef futimens
    516      1.1  christos #   define futimens rpl_futimens
    517      1.1  christos #  endif
    518      1.1  christos _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
    519      1.1  christos _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
    520      1.1  christos # else
    521      1.1  christos #  if !@HAVE_FUTIMENS@
    522      1.1  christos _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
    523      1.1  christos #  endif
    524      1.1  christos _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
    525      1.1  christos # endif
    526      1.1  christos # if @HAVE_FUTIMENS@
    527      1.1  christos _GL_CXXALIASWARN (futimens);
    528      1.1  christos # endif
    529      1.1  christos #elif defined GNULIB_POSIXCHECK
    530      1.1  christos # undef futimens
    531      1.1  christos # if HAVE_RAW_DECL_FUTIMENS
    532      1.1  christos _GL_WARN_ON_USE (futimens, "futimens is not portable - "
    533      1.1  christos                  "use gnulib module futimens for portability");
    534      1.1  christos # endif
    535      1.1  christos #endif
    536      1.1  christos 
    537      1.1  christos 
    538  1.1.1.2  christos #if @GNULIB_GETUMASK@
    539  1.1.1.2  christos # if !@HAVE_GETUMASK@
    540  1.1.1.2  christos _GL_FUNCDECL_SYS (getumask, mode_t, (void));
    541  1.1.1.2  christos # endif
    542  1.1.1.2  christos _GL_CXXALIAS_SYS (getumask, mode_t, (void));
    543  1.1.1.2  christos # if @HAVE_GETUMASK@
    544  1.1.1.2  christos _GL_CXXALIASWARN (getumask);
    545  1.1.1.2  christos # endif
    546  1.1.1.2  christos #elif defined GNULIB_POSIXCHECK
    547  1.1.1.2  christos # undef getumask
    548  1.1.1.2  christos # if HAVE_RAW_DECL_GETUMASK
    549  1.1.1.2  christos _GL_WARN_ON_USE (getumask, "getumask is not portable - "
    550  1.1.1.2  christos                  "use gnulib module getumask for portability");
    551  1.1.1.2  christos # endif
    552  1.1.1.2  christos #endif
    553  1.1.1.2  christos 
    554  1.1.1.2  christos 
    555      1.1  christos #if @GNULIB_LCHMOD@
    556      1.1  christos /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
    557      1.1  christos    denotes a symbolic link.  */
    558      1.1  christos # if !@HAVE_LCHMOD@ || defined __hpux
    559      1.1  christos _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
    560      1.1  christos                                _GL_ARG_NONNULL ((1)));
    561      1.1  christos # endif
    562      1.1  christos _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
    563      1.1  christos _GL_CXXALIASWARN (lchmod);
    564      1.1  christos #elif defined GNULIB_POSIXCHECK
    565      1.1  christos # undef lchmod
    566      1.1  christos # if HAVE_RAW_DECL_LCHMOD
    567      1.1  christos _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
    568      1.1  christos                  "use gnulib module lchmod for portability");
    569      1.1  christos # endif
    570      1.1  christos #endif
    571      1.1  christos 
    572      1.1  christos 
    573      1.1  christos #if @GNULIB_LSTAT@
    574      1.1  christos # if ! @HAVE_LSTAT@
    575      1.1  christos /* mingw does not support symlinks, therefore it does not have lstat.  But
    576      1.1  christos    without links, stat does just fine.  */
    577      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    578      1.1  christos #   define lstat stat
    579      1.1  christos #  endif
    580      1.1  christos _GL_CXXALIAS_RPL_1 (lstat, stat, int,
    581      1.1  christos                     (const char *restrict name, struct stat *restrict buf));
    582      1.1  christos # elif @REPLACE_LSTAT@
    583      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    584      1.1  christos #   undef lstat
    585      1.1  christos #   define lstat rpl_lstat
    586      1.1  christos #  endif
    587      1.1  christos _GL_FUNCDECL_RPL (lstat, int,
    588      1.1  christos                   (const char *restrict name, struct stat *restrict buf)
    589      1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
    590      1.1  christos _GL_CXXALIAS_RPL (lstat, int,
    591      1.1  christos                   (const char *restrict name, struct stat *restrict buf));
    592      1.1  christos # else
    593      1.1  christos _GL_CXXALIAS_SYS (lstat, int,
    594      1.1  christos                   (const char *restrict name, struct stat *restrict buf));
    595      1.1  christos # endif
    596      1.1  christos # if @HAVE_LSTAT@
    597      1.1  christos _GL_CXXALIASWARN (lstat);
    598      1.1  christos # endif
    599      1.1  christos #elif @GNULIB_OVERRIDES_STRUCT_STAT@
    600      1.1  christos # undef lstat
    601      1.1  christos # define lstat lstat_used_without_requesting_gnulib_module_lstat
    602      1.1  christos #elif defined GNULIB_POSIXCHECK
    603      1.1  christos # undef lstat
    604      1.1  christos # if HAVE_RAW_DECL_LSTAT
    605      1.1  christos _GL_WARN_ON_USE (lstat, "lstat is unportable - "
    606      1.1  christos                  "use gnulib module lstat for portability");
    607      1.1  christos # endif
    608      1.1  christos #endif
    609      1.1  christos 
    610      1.1  christos 
    611  1.1.1.2  christos #if @GNULIB_MKDIR@
    612  1.1.1.2  christos # if @REPLACE_MKDIR@
    613  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    614  1.1.1.2  christos #   undef mkdir
    615  1.1.1.2  christos #   define mkdir rpl_mkdir
    616  1.1.1.2  christos #  endif
    617      1.1  christos _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
    618  1.1.1.2  christos                                _GL_ARG_NONNULL ((1)));
    619      1.1  christos _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
    620  1.1.1.2  christos # elif defined _WIN32 && !defined __CYGWIN__
    621      1.1  christos /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
    622      1.1  christos    Additionally, it declares _mkdir (and depending on compile flags, an
    623      1.1  christos    alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
    624      1.1  christos    which are included above.  */
    625      1.1  christos #  if !GNULIB_defined_rpl_mkdir
    626      1.1  christos static int
    627      1.1  christos rpl_mkdir (char const *name, mode_t mode)
    628      1.1  christos {
    629      1.1  christos   return _mkdir (name);
    630      1.1  christos }
    631      1.1  christos #   define GNULIB_defined_rpl_mkdir 1
    632      1.1  christos #  endif
    633      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    634  1.1.1.2  christos #   undef mkdir
    635  1.1.1.2  christos #   define mkdir rpl_mkdir
    636  1.1.1.2  christos #  endif
    637  1.1.1.2  christos _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
    638  1.1.1.2  christos # else
    639  1.1.1.2  christos _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
    640  1.1.1.2  christos # endif
    641  1.1.1.2  christos _GL_CXXALIASWARN (mkdir);
    642  1.1.1.2  christos #elif defined GNULIB_POSIXCHECK
    643  1.1.1.2  christos # undef mkdir
    644  1.1.1.2  christos # if HAVE_RAW_DECL_MKDIR
    645  1.1.1.2  christos _GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
    646  1.1.1.2  christos                  "use gnulib module mkdir for portability");
    647  1.1.1.2  christos # endif
    648  1.1.1.2  christos #elif @GNULIB_MDA_MKDIR@
    649  1.1.1.2  christos /* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not
    650  1.1.1.2  christos    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
    651  1.1.1.2  christos    platforms by defining GNULIB_NAMESPACE::mkdir always.  */
    652  1.1.1.2  christos # if defined _WIN32 && !defined __CYGWIN__
    653  1.1.1.2  christos #  if !GNULIB_defined_rpl_mkdir
    654  1.1.1.2  christos static int
    655  1.1.1.2  christos rpl_mkdir (char const *name, mode_t mode)
    656  1.1.1.2  christos {
    657  1.1.1.2  christos   return _mkdir (name);
    658  1.1.1.2  christos }
    659  1.1.1.2  christos #   define GNULIB_defined_rpl_mkdir 1
    660  1.1.1.2  christos #  endif
    661  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    662  1.1.1.2  christos #   undef mkdir
    663      1.1  christos #   define mkdir rpl_mkdir
    664      1.1  christos #  endif
    665      1.1  christos _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
    666      1.1  christos # else
    667      1.1  christos _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
    668      1.1  christos # endif
    669      1.1  christos _GL_CXXALIASWARN (mkdir);
    670  1.1.1.2  christos #endif
    671      1.1  christos 
    672      1.1  christos 
    673      1.1  christos #if @GNULIB_MKDIRAT@
    674      1.1  christos # if !@HAVE_MKDIRAT@
    675      1.1  christos _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
    676      1.1  christos                                 _GL_ARG_NONNULL ((2)));
    677      1.1  christos # endif
    678      1.1  christos _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
    679      1.1  christos _GL_CXXALIASWARN (mkdirat);
    680      1.1  christos #elif defined GNULIB_POSIXCHECK
    681      1.1  christos # undef mkdirat
    682      1.1  christos # if HAVE_RAW_DECL_MKDIRAT
    683      1.1  christos _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
    684      1.1  christos                  "use gnulib module openat for portability");
    685      1.1  christos # endif
    686      1.1  christos #endif
    687      1.1  christos 
    688      1.1  christos 
    689      1.1  christos #if @GNULIB_MKFIFO@
    690      1.1  christos # if @REPLACE_MKFIFO@
    691      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    692      1.1  christos #   undef mkfifo
    693      1.1  christos #   define mkfifo rpl_mkfifo
    694      1.1  christos #  endif
    695      1.1  christos _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
    696      1.1  christos                                _GL_ARG_NONNULL ((1)));
    697      1.1  christos _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
    698      1.1  christos # else
    699      1.1  christos #  if !@HAVE_MKFIFO@
    700      1.1  christos _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
    701      1.1  christos                                _GL_ARG_NONNULL ((1)));
    702      1.1  christos #  endif
    703      1.1  christos _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
    704      1.1  christos # endif
    705      1.1  christos _GL_CXXALIASWARN (mkfifo);
    706      1.1  christos #elif defined GNULIB_POSIXCHECK
    707      1.1  christos # undef mkfifo
    708      1.1  christos # if HAVE_RAW_DECL_MKFIFO
    709      1.1  christos _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
    710      1.1  christos                  "use gnulib module mkfifo for portability");
    711      1.1  christos # endif
    712      1.1  christos #endif
    713      1.1  christos 
    714      1.1  christos 
    715      1.1  christos #if @GNULIB_MKFIFOAT@
    716  1.1.1.2  christos # if @REPLACE_MKFIFOAT@
    717  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    718  1.1.1.2  christos #   undef mkfifoat
    719  1.1.1.2  christos #   define mkfifoat rpl_mkfifoat
    720  1.1.1.2  christos #  endif
    721  1.1.1.2  christos _GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)
    722  1.1.1.2  christos                                  _GL_ARG_NONNULL ((2)));
    723  1.1.1.2  christos _GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
    724  1.1.1.2  christos # else
    725  1.1.1.2  christos #  if !@HAVE_MKFIFOAT@
    726      1.1  christos _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
    727      1.1  christos                                  _GL_ARG_NONNULL ((2)));
    728  1.1.1.2  christos #  endif
    729      1.1  christos _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
    730  1.1.1.2  christos # endif
    731      1.1  christos _GL_CXXALIASWARN (mkfifoat);
    732      1.1  christos #elif defined GNULIB_POSIXCHECK
    733      1.1  christos # undef mkfifoat
    734      1.1  christos # if HAVE_RAW_DECL_MKFIFOAT
    735      1.1  christos _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
    736      1.1  christos                  "use gnulib module mkfifoat for portability");
    737      1.1  christos # endif
    738      1.1  christos #endif
    739      1.1  christos 
    740      1.1  christos 
    741      1.1  christos #if @GNULIB_MKNOD@
    742      1.1  christos # if @REPLACE_MKNOD@
    743      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    744      1.1  christos #   undef mknod
    745      1.1  christos #   define mknod rpl_mknod
    746      1.1  christos #  endif
    747      1.1  christos _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
    748      1.1  christos                               _GL_ARG_NONNULL ((1)));
    749      1.1  christos _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
    750      1.1  christos # else
    751      1.1  christos #  if !@HAVE_MKNOD@
    752      1.1  christos _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
    753      1.1  christos                               _GL_ARG_NONNULL ((1)));
    754      1.1  christos #  endif
    755      1.1  christos /* Need to cast, because on OSF/1 5.1, the third parameter is '...'.  */
    756      1.1  christos _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
    757      1.1  christos # endif
    758      1.1  christos _GL_CXXALIASWARN (mknod);
    759      1.1  christos #elif defined GNULIB_POSIXCHECK
    760      1.1  christos # undef mknod
    761      1.1  christos # if HAVE_RAW_DECL_MKNOD
    762      1.1  christos _GL_WARN_ON_USE (mknod, "mknod is not portable - "
    763      1.1  christos                  "use gnulib module mknod for portability");
    764      1.1  christos # endif
    765      1.1  christos #endif
    766      1.1  christos 
    767      1.1  christos 
    768      1.1  christos #if @GNULIB_MKNODAT@
    769  1.1.1.2  christos # if @REPLACE_MKNODAT@
    770  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    771  1.1.1.2  christos #   undef mknodat
    772  1.1.1.2  christos #   define mknodat rpl_mknodat
    773  1.1.1.2  christos #  endif
    774  1.1.1.2  christos _GL_FUNCDECL_RPL (mknodat, int,
    775  1.1.1.2  christos                   (int fd, char const *file, mode_t mode, dev_t dev)
    776  1.1.1.2  christos                   _GL_ARG_NONNULL ((2)));
    777  1.1.1.2  christos _GL_CXXALIAS_RPL (mknodat, int,
    778  1.1.1.2  christos                   (int fd, char const *file, mode_t mode, dev_t dev));
    779  1.1.1.2  christos # else
    780  1.1.1.2  christos #  if !@HAVE_MKNODAT@
    781      1.1  christos _GL_FUNCDECL_SYS (mknodat, int,
    782      1.1  christos                   (int fd, char const *file, mode_t mode, dev_t dev)
    783      1.1  christos                   _GL_ARG_NONNULL ((2)));
    784  1.1.1.2  christos #  endif
    785      1.1  christos _GL_CXXALIAS_SYS (mknodat, int,
    786      1.1  christos                   (int fd, char const *file, mode_t mode, dev_t dev));
    787  1.1.1.2  christos # endif
    788      1.1  christos _GL_CXXALIASWARN (mknodat);
    789      1.1  christos #elif defined GNULIB_POSIXCHECK
    790      1.1  christos # undef mknodat
    791      1.1  christos # if HAVE_RAW_DECL_MKNODAT
    792      1.1  christos _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
    793      1.1  christos                  "use gnulib module mkfifoat for portability");
    794      1.1  christos # endif
    795      1.1  christos #endif
    796      1.1  christos 
    797      1.1  christos 
    798      1.1  christos #if @GNULIB_STAT@
    799      1.1  christos # if @REPLACE_STAT@
    800      1.1  christos #  if !@GNULIB_OVERRIDES_STRUCT_STAT@
    801      1.1  christos     /* We can't use the object-like #define stat rpl_stat, because of
    802      1.1  christos        struct stat.  This means that rpl_stat will not be used if the user
    803      1.1  christos        does (stat)(a,b).  Oh well.  */
    804      1.1  christos #   if defined _AIX && defined stat && defined _LARGE_FILES
    805      1.1  christos      /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
    806      1.1  christos         so we have to replace stat64() instead of stat(). */
    807      1.1  christos #    undef stat64
    808      1.1  christos #    define stat64(name, st) rpl_stat (name, st)
    809      1.1  christos #   elif @WINDOWS_64_BIT_ST_SIZE@
    810      1.1  christos      /* Above, we define stat to _stati64.  */
    811      1.1  christos #    if defined __MINGW32__ && defined _stati64
    812      1.1  christos #     ifndef _USE_32BIT_TIME_T
    813      1.1  christos        /* The system headers define _stati64 to _stat64.  */
    814      1.1  christos #      undef _stat64
    815      1.1  christos #      define _stat64(name, st) rpl_stat (name, st)
    816      1.1  christos #     endif
    817      1.1  christos #    elif defined _MSC_VER && defined _stati64
    818      1.1  christos #     ifdef _USE_32BIT_TIME_T
    819      1.1  christos        /* The system headers define _stati64 to _stat32i64.  */
    820      1.1  christos #      undef _stat32i64
    821      1.1  christos #      define _stat32i64(name, st) rpl_stat (name, st)
    822      1.1  christos #     else
    823      1.1  christos        /* The system headers define _stati64 to _stat64.  */
    824      1.1  christos #      undef _stat64
    825      1.1  christos #      define _stat64(name, st) rpl_stat (name, st)
    826      1.1  christos #     endif
    827      1.1  christos #    else
    828      1.1  christos #     undef _stati64
    829      1.1  christos #     define _stati64(name, st) rpl_stat (name, st)
    830      1.1  christos #    endif
    831      1.1  christos #   elif defined __MINGW32__ && defined stat
    832      1.1  christos #    ifdef _USE_32BIT_TIME_T
    833      1.1  christos       /* The system headers define stat to _stat32i64.  */
    834      1.1  christos #     undef _stat32i64
    835      1.1  christos #     define _stat32i64(name, st) rpl_stat (name, st)
    836      1.1  christos #    else
    837      1.1  christos       /* The system headers define stat to _stat64.  */
    838      1.1  christos #     undef _stat64
    839      1.1  christos #     define _stat64(name, st) rpl_stat (name, st)
    840      1.1  christos #    endif
    841      1.1  christos #   elif defined _MSC_VER && defined stat
    842      1.1  christos #    ifdef _USE_32BIT_TIME_T
    843      1.1  christos       /* The system headers define stat to _stat32.  */
    844      1.1  christos #     undef _stat32
    845      1.1  christos #     define _stat32(name, st) rpl_stat (name, st)
    846      1.1  christos #    else
    847      1.1  christos       /* The system headers define stat to _stat64i32.  */
    848      1.1  christos #     undef _stat64i32
    849      1.1  christos #     define _stat64i32(name, st) rpl_stat (name, st)
    850      1.1  christos #    endif
    851      1.1  christos #   else /* !(_AIX || __MINGW32__ || _MSC_VER) */
    852      1.1  christos #    undef stat
    853      1.1  christos #    define stat(name, st) rpl_stat (name, st)
    854      1.1  christos #   endif /* !_LARGE_FILES */
    855      1.1  christos #  endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */
    856      1.1  christos _GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf)
    857      1.1  christos                       _GL_ARG_NONNULL ((1, 2));
    858      1.1  christos # endif
    859      1.1  christos #elif @GNULIB_OVERRIDES_STRUCT_STAT@
    860      1.1  christos /* see above:
    861      1.1  christos   #define stat stat_used_without_requesting_gnulib_module_stat
    862      1.1  christos  */
    863      1.1  christos #elif defined GNULIB_POSIXCHECK
    864      1.1  christos # undef stat
    865      1.1  christos # if HAVE_RAW_DECL_STAT
    866      1.1  christos _GL_WARN_ON_USE (stat, "stat is unportable - "
    867      1.1  christos                  "use gnulib module stat for portability");
    868      1.1  christos # endif
    869      1.1  christos #endif
    870      1.1  christos 
    871      1.1  christos 
    872  1.1.1.2  christos #if @GNULIB_MDA_UMASK@
    873  1.1.1.2  christos /* On native Windows, map 'umask' to '_umask', so that -loldnames is not
    874  1.1.1.2  christos    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
    875  1.1.1.2  christos    platforms by defining GNULIB_NAMESPACE::umask always.  */
    876  1.1.1.2  christos # if defined _WIN32 && !defined __CYGWIN__
    877  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    878  1.1.1.2  christos #   undef umask
    879  1.1.1.2  christos #   define umask _umask
    880  1.1.1.2  christos #  endif
    881  1.1.1.2  christos /* Need to cast, because in mingw the last argument is 'int mode'.  */
    882  1.1.1.2  christos _GL_CXXALIAS_MDA_CAST (umask, mode_t, (mode_t mask));
    883  1.1.1.2  christos # else
    884  1.1.1.2  christos _GL_CXXALIAS_SYS (umask, mode_t, (mode_t mask));
    885  1.1.1.2  christos # endif
    886  1.1.1.2  christos _GL_CXXALIASWARN (umask);
    887  1.1.1.2  christos #endif
    888  1.1.1.2  christos 
    889  1.1.1.2  christos 
    890      1.1  christos #if @GNULIB_UTIMENSAT@
    891      1.1  christos /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
    892      1.1  christos    implementation relies on futimesat, which on Solaris 10 makes an invocation
    893      1.1  christos    to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
    894      1.1  christos    utimensat().  */
    895      1.1  christos # if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
    896      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    897      1.1  christos #   undef utimensat
    898      1.1  christos #   define utimensat rpl_utimensat
    899      1.1  christos #  endif
    900      1.1  christos _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
    901      1.1  christos                                    struct timespec const times[2], int flag)
    902      1.1  christos                                   _GL_ARG_NONNULL ((2)));
    903      1.1  christos _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
    904      1.1  christos                                    struct timespec const times[2], int flag));
    905      1.1  christos # else
    906      1.1  christos #  if !@HAVE_UTIMENSAT@
    907      1.1  christos _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
    908      1.1  christos                                    struct timespec const times[2], int flag)
    909      1.1  christos                                   _GL_ARG_NONNULL ((2)));
    910      1.1  christos #  endif
    911      1.1  christos _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
    912      1.1  christos                                    struct timespec const times[2], int flag));
    913      1.1  christos # endif
    914      1.1  christos # if @HAVE_UTIMENSAT@
    915      1.1  christos _GL_CXXALIASWARN (utimensat);
    916      1.1  christos # endif
    917      1.1  christos #elif defined GNULIB_POSIXCHECK
    918      1.1  christos # undef utimensat
    919      1.1  christos # if HAVE_RAW_DECL_UTIMENSAT
    920      1.1  christos _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
    921      1.1  christos                  "use gnulib module utimensat for portability");
    922      1.1  christos # endif
    923      1.1  christos #endif
    924      1.1  christos 
    925      1.1  christos 
    926      1.1  christos #endif /* _@GUARD_PREFIX@_SYS_STAT_H */
    927      1.1  christos #endif /* _@GUARD_PREFIX@_SYS_STAT_H */
    928      1.1  christos #endif
    929