Blame lib/sys_stat.in.h

Packit 8f70b4
/* Provide a more complete sys/stat.h header file.
Packit 8f70b4
   Copyright (C) 2005-2018 Free Software Foundation, Inc.
Packit 8f70b4
Packit 8f70b4
   This program is free software; you can redistribute it and/or modify
Packit 8f70b4
   it under the terms of the GNU General Public License as published by
Packit 8f70b4
   the Free Software Foundation; either version 3, or (at your option)
Packit 8f70b4
   any later version.
Packit 8f70b4
Packit 8f70b4
   This program is distributed in the hope that it will be useful,
Packit 8f70b4
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 8f70b4
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 8f70b4
   GNU General Public License for more details.
Packit 8f70b4
Packit 8f70b4
   You should have received a copy of the GNU General Public License
Packit 8f70b4
   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
Packit 8f70b4
Packit 8f70b4
/* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
Packit 8f70b4
Packit 8f70b4
/* This file is supposed to be used on platforms where <sys/stat.h> is
Packit 8f70b4
   incomplete.  It is intended to provide definitions and prototypes
Packit 8f70b4
   needed by an application.  Start with what the system provides.  */
Packit 8f70b4
Packit 8f70b4
#if __GNUC__ >= 3
Packit 8f70b4
@PRAGMA_SYSTEM_HEADER@
Packit 8f70b4
#endif
Packit 8f70b4
@PRAGMA_COLUMNS@
Packit 8f70b4
Packit 8f70b4
#if defined __need_system_sys_stat_h
Packit 8f70b4
/* Special invocation convention.  */
Packit 8f70b4
Packit 8f70b4
#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
Packit 8f70b4
Packit 8f70b4
#else
Packit 8f70b4
/* Normal invocation convention.  */
Packit 8f70b4
Packit 8f70b4
#ifndef _@GUARD_PREFIX@_SYS_STAT_H
Packit 8f70b4
Packit 8f70b4
/* Get nlink_t.
Packit 8f70b4
   May also define off_t to a 64-bit type on native Windows.  */
Packit 8f70b4
#include <sys/types.h>
Packit 8f70b4
Packit 8f70b4
/* Get struct timespec.  */
Packit 8f70b4
#include <time.h>
Packit 8f70b4
Packit 8f70b4
/* The include_next requires a split double-inclusion guard.  */
Packit 8f70b4
#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
Packit 8f70b4
Packit 8f70b4
#ifndef _@GUARD_PREFIX@_SYS_STAT_H
Packit 8f70b4
#define _@GUARD_PREFIX@_SYS_STAT_H
Packit 8f70b4
Packit 8f70b4
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
Packit 8f70b4
Packit 8f70b4
/* The definition of _GL_ARG_NONNULL is copied here.  */
Packit 8f70b4
Packit 8f70b4
/* The definition of _GL_WARN_ON_USE is copied here.  */
Packit 8f70b4
Packit 8f70b4
/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
Packit 8f70b4
   headers that may declare mkdir().  Native Windows platforms declare mkdir
Packit 8f70b4
   in <io.h> and/or <direct.h>, not in <unistd.h>.  */
Packit 8f70b4
#if defined _WIN32 && ! defined __CYGWIN__
Packit 8f70b4
# include <io.h>     /* mingw32, mingw64 */
Packit 8f70b4
# include <direct.h> /* mingw64, MSVC 9 */
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
/* Native Windows platforms declare umask() in <io.h>.  */
Packit 8f70b4
#if 0 && (defined _WIN32 && ! defined __CYGWIN__)
Packit 8f70b4
# include <io.h>
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
/* Large File Support on native Windows.  */
Packit 8f70b4
#if @WINDOWS_64_BIT_ST_SIZE@
Packit 8f70b4
# define stat _stati64
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
/* Optionally, override 'struct stat' on native Windows.  */
Packit 8f70b4
#if @GNULIB_OVERRIDES_STRUCT_STAT@
Packit 8f70b4
Packit 8f70b4
# undef stat
Packit 8f70b4
# if @GNULIB_STAT@
Packit 8f70b4
#  define stat rpl_stat
Packit 8f70b4
# else
Packit 8f70b4
   /* Provoke a clear link error if stat() is used as a function and
Packit 8f70b4
      module 'stat' is not in use.  */
Packit 8f70b4
#  define stat stat_used_without_requesting_gnulib_module_stat
Packit 8f70b4
# endif
Packit 8f70b4
Packit 8f70b4
# if !GNULIB_defined_struct_stat
Packit 8f70b4
struct stat
Packit 8f70b4
{
Packit 8f70b4
  dev_t st_dev;
Packit 8f70b4
  ino_t st_ino;
Packit 8f70b4
  mode_t st_mode;
Packit 8f70b4
  nlink_t st_nlink;
Packit 8f70b4
#  if 0
Packit 8f70b4
  uid_t st_uid;
Packit 8f70b4
#  else /* uid_t is not defined by default on native Windows.  */
Packit 8f70b4
  short st_uid;
Packit 8f70b4
#  endif
Packit 8f70b4
#  if 0
Packit 8f70b4
  gid_t st_gid;
Packit 8f70b4
#  else /* gid_t is not defined by default on native Windows.  */
Packit 8f70b4
  short st_gid;
Packit 8f70b4
#  endif
Packit 8f70b4
  dev_t st_rdev;
Packit 8f70b4
  off_t st_size;
Packit 8f70b4
#  if 0
Packit 8f70b4
  blksize_t st_blksize;
Packit 8f70b4
  blkcnt_t st_blocks;
Packit 8f70b4
#  endif
Packit 8f70b4
Packit 8f70b4
#  if @WINDOWS_STAT_TIMESPEC@
Packit 8f70b4
  struct timespec st_atim;
Packit 8f70b4
  struct timespec st_mtim;
Packit 8f70b4
  struct timespec st_ctim;
Packit 8f70b4
#  else
Packit 8f70b4
  time_t st_atime;
Packit 8f70b4
  time_t st_mtime;
Packit 8f70b4
  time_t st_ctime;
Packit 8f70b4
#  endif
Packit 8f70b4
};
Packit 8f70b4
#  if @WINDOWS_STAT_TIMESPEC@
Packit 8f70b4
#   define st_atime st_atim.tv_sec
Packit 8f70b4
#   define st_mtime st_mtim.tv_sec
Packit 8f70b4
#   define st_ctime st_ctim.tv_sec
Packit 8f70b4
    /* Indicator, for gnulib internal purposes.  */
Packit 8f70b4
#   define _GL_WINDOWS_STAT_TIMESPEC 1
Packit 8f70b4
#  endif
Packit 8f70b4
#  define GNULIB_defined_struct_stat 1
Packit 8f70b4
# endif
Packit 8f70b4
Packit 8f70b4
/* Other possible values of st_mode.  */
Packit 8f70b4
# if 0
Packit 8f70b4
#  define _S_IFBLK  0x6000
Packit 8f70b4
# endif
Packit 8f70b4
# if 0
Packit 8f70b4
#  define _S_IFLNK  0xA000
Packit 8f70b4
# endif
Packit 8f70b4
# if 0
Packit 8f70b4
#  define _S_IFSOCK 0xC000
Packit 8f70b4
# endif
Packit 8f70b4
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_IFIFO
Packit 8f70b4
# ifdef _S_IFIFO
Packit 8f70b4
#  define S_IFIFO _S_IFIFO
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_IFMT
Packit 8f70b4
# define S_IFMT 0170000
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#if STAT_MACROS_BROKEN
Packit 8f70b4
# undef S_ISBLK
Packit 8f70b4
# undef S_ISCHR
Packit 8f70b4
# undef S_ISDIR
Packit 8f70b4
# undef S_ISFIFO
Packit 8f70b4
# undef S_ISLNK
Packit 8f70b4
# undef S_ISNAM
Packit 8f70b4
# undef S_ISMPB
Packit 8f70b4
# undef S_ISMPC
Packit 8f70b4
# undef S_ISNWK
Packit 8f70b4
# undef S_ISREG
Packit 8f70b4
# undef S_ISSOCK
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISBLK
Packit 8f70b4
# ifdef S_IFBLK
Packit 8f70b4
#  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_ISBLK(m) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISCHR
Packit 8f70b4
# ifdef S_IFCHR
Packit 8f70b4
#  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_ISCHR(m) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISDIR
Packit 8f70b4
# ifdef S_IFDIR
Packit 8f70b4
#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_ISDIR(m) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISDOOR /* Solaris 2.5 and up */
Packit 8f70b4
# define S_ISDOOR(m) 0
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISFIFO
Packit 8f70b4
# ifdef S_IFIFO
Packit 8f70b4
#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_ISFIFO(m) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISLNK
Packit 8f70b4
# ifdef S_IFLNK
Packit 8f70b4
#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_ISLNK(m) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISMPB /* V7 */
Packit 8f70b4
# ifdef S_IFMPB
Packit 8f70b4
#  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
Packit 8f70b4
#  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_ISMPB(m) 0
Packit 8f70b4
#  define S_ISMPC(m) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISMPX /* AIX */
Packit 8f70b4
# define S_ISMPX(m) 0
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISNAM /* Xenix */
Packit 8f70b4
# ifdef S_IFNAM
Packit 8f70b4
#  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_ISNAM(m) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISNWK /* HP/UX */
Packit 8f70b4
# ifdef S_IFNWK
Packit 8f70b4
#  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_ISNWK(m) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISPORT /* Solaris 10 and up */
Packit 8f70b4
# define S_ISPORT(m) 0
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISREG
Packit 8f70b4
# ifdef S_IFREG
Packit 8f70b4
#  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_ISREG(m) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_ISSOCK
Packit 8f70b4
# ifdef S_IFSOCK
Packit 8f70b4
#  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_ISSOCK(m) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#ifndef S_TYPEISMQ
Packit 8f70b4
# define S_TYPEISMQ(p) 0
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_TYPEISTMO
Packit 8f70b4
# define S_TYPEISTMO(p) 0
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#ifndef S_TYPEISSEM
Packit 8f70b4
# ifdef S_INSEM
Packit 8f70b4
#  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_TYPEISSEM(p) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_TYPEISSHM
Packit 8f70b4
# ifdef S_INSHD
Packit 8f70b4
#  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
Packit 8f70b4
# else
Packit 8f70b4
#  define S_TYPEISSHM(p) 0
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
/* high performance ("contiguous data") */
Packit 8f70b4
#ifndef S_ISCTG
Packit 8f70b4
# define S_ISCTG(p) 0
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
/* Cray DMF (data migration facility): off line, with data  */
Packit 8f70b4
#ifndef S_ISOFD
Packit 8f70b4
# define S_ISOFD(p) 0
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
/* Cray DMF (data migration facility): off line, with no data  */
Packit 8f70b4
#ifndef S_ISOFL
Packit 8f70b4
# define S_ISOFL(p) 0
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
/* 4.4BSD whiteout */
Packit 8f70b4
#ifndef S_ISWHT
Packit 8f70b4
# define S_ISWHT(m) 0
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
/* If any of the following are undefined,
Packit 8f70b4
   define them to their de facto standard values.  */
Packit 8f70b4
#if !S_ISUID
Packit 8f70b4
# define S_ISUID 04000
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_ISGID
Packit 8f70b4
# define S_ISGID 02000
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
/* S_ISVTX is a common extension to POSIX.  */
Packit 8f70b4
#ifndef S_ISVTX
Packit 8f70b4
# define S_ISVTX 01000
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#if !S_IRUSR && S_IREAD
Packit 8f70b4
# define S_IRUSR S_IREAD
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_IRUSR
Packit 8f70b4
# define S_IRUSR 00400
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_IRGRP
Packit 8f70b4
# define S_IRGRP (S_IRUSR >> 3)
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_IROTH
Packit 8f70b4
# define S_IROTH (S_IRUSR >> 6)
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#if !S_IWUSR && S_IWRITE
Packit 8f70b4
# define S_IWUSR S_IWRITE
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_IWUSR
Packit 8f70b4
# define S_IWUSR 00200
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_IWGRP
Packit 8f70b4
# define S_IWGRP (S_IWUSR >> 3)
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_IWOTH
Packit 8f70b4
# define S_IWOTH (S_IWUSR >> 6)
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#if !S_IXUSR && S_IEXEC
Packit 8f70b4
# define S_IXUSR S_IEXEC
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_IXUSR
Packit 8f70b4
# define S_IXUSR 00100
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_IXGRP
Packit 8f70b4
# define S_IXGRP (S_IXUSR >> 3)
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_IXOTH
Packit 8f70b4
# define S_IXOTH (S_IXUSR >> 6)
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#if !S_IRWXU
Packit 8f70b4
# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_IRWXG
Packit 8f70b4
# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
Packit 8f70b4
#endif
Packit 8f70b4
#if !S_IRWXO
Packit 8f70b4
# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
/* S_IXUGO is a common extension to POSIX.  */
Packit 8f70b4
#if !S_IXUGO
Packit 8f70b4
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
#ifndef S_IRWXUGO
Packit 8f70b4
# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
/* Macros for futimens and utimensat.  */
Packit 8f70b4
#ifndef UTIME_NOW
Packit 8f70b4
# define UTIME_NOW (-1)
Packit 8f70b4
# define UTIME_OMIT (-2)
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_FCHMODAT@
Packit 8f70b4
# if !@HAVE_FCHMODAT@
Packit 8f70b4
_GL_FUNCDECL_SYS (fchmodat, int,
Packit 8f70b4
                  (int fd, char const *file, mode_t mode, int flag)
Packit 8f70b4
                  _GL_ARG_NONNULL ((2)));
Packit 8f70b4
# endif
Packit 8f70b4
_GL_CXXALIAS_SYS (fchmodat, int,
Packit 8f70b4
                  (int fd, char const *file, mode_t mode, int flag));
Packit 8f70b4
_GL_CXXALIASWARN (fchmodat);
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef fchmodat
Packit 8f70b4
# if HAVE_RAW_DECL_FCHMODAT
Packit 8f70b4
_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
Packit 8f70b4
                 "use gnulib module openat for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_FSTAT@
Packit 8f70b4
# if @REPLACE_FSTAT@
Packit 8f70b4
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 8f70b4
#   undef fstat
Packit 8f70b4
#   define fstat rpl_fstat
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
Packit 8f70b4
_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
Packit 8f70b4
# else
Packit 8f70b4
_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
Packit 8f70b4
# endif
Packit 8f70b4
_GL_CXXALIASWARN (fstat);
Packit 8f70b4
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
Packit 8f70b4
# undef fstat
Packit 8f70b4
# define fstat fstat_used_without_requesting_gnulib_module_fstat
Packit 8f70b4
#elif @WINDOWS_64_BIT_ST_SIZE@
Packit 8f70b4
/* Above, we define stat to _stati64.  */
Packit 8f70b4
# define fstat _fstati64
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef fstat
Packit 8f70b4
# if HAVE_RAW_DECL_FSTAT
Packit 8f70b4
_GL_WARN_ON_USE (fstat, "fstat has portability problems - "
Packit 8f70b4
                 "use gnulib module fstat for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_FSTATAT@
Packit 8f70b4
# if @REPLACE_FSTATAT@
Packit 8f70b4
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 8f70b4
#   undef fstatat
Packit 8f70b4
#   define fstatat rpl_fstatat
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_FUNCDECL_RPL (fstatat, int,
Packit 8f70b4
                  (int fd, char const *name, struct stat *st, int flags)
Packit 8f70b4
                  _GL_ARG_NONNULL ((2, 3)));
Packit 8f70b4
_GL_CXXALIAS_RPL (fstatat, int,
Packit 8f70b4
                  (int fd, char const *name, struct stat *st, int flags));
Packit 8f70b4
# else
Packit 8f70b4
#  if !@HAVE_FSTATAT@
Packit 8f70b4
_GL_FUNCDECL_SYS (fstatat, int,
Packit 8f70b4
                  (int fd, char const *name, struct stat *st, int flags)
Packit 8f70b4
                  _GL_ARG_NONNULL ((2, 3)));
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_CXXALIAS_SYS (fstatat, int,
Packit 8f70b4
                  (int fd, char const *name, struct stat *st, int flags));
Packit 8f70b4
# endif
Packit 8f70b4
_GL_CXXALIASWARN (fstatat);
Packit 8f70b4
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
Packit 8f70b4
# undef fstatat
Packit 8f70b4
# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef fstatat
Packit 8f70b4
# if HAVE_RAW_DECL_FSTATAT
Packit 8f70b4
_GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
Packit 8f70b4
                 "use gnulib module openat for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_FUTIMENS@
Packit 8f70b4
/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
Packit 8f70b4
   implementation relies on futimesat, which on Solaris 10 makes an invocation
Packit 8f70b4
   to futimens that is meant to invoke the libc's futimens(), not gnulib's
Packit 8f70b4
   futimens().  */
Packit 8f70b4
# if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
Packit 8f70b4
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 8f70b4
#   undef futimens
Packit 8f70b4
#   define futimens rpl_futimens
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
Packit 8f70b4
_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
Packit 8f70b4
# else
Packit 8f70b4
#  if !@HAVE_FUTIMENS@
Packit 8f70b4
_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
Packit 8f70b4
# endif
Packit 8f70b4
# if @HAVE_FUTIMENS@
Packit 8f70b4
_GL_CXXALIASWARN (futimens);
Packit 8f70b4
# endif
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef futimens
Packit 8f70b4
# if HAVE_RAW_DECL_FUTIMENS
Packit 8f70b4
_GL_WARN_ON_USE (futimens, "futimens is not portable - "
Packit 8f70b4
                 "use gnulib module futimens for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_LCHMOD@
Packit 8f70b4
/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
Packit 8f70b4
   denotes a symbolic link.  */
Packit 8f70b4
# if !@HAVE_LCHMOD@
Packit 8f70b4
/* The lchmod replacement follows symbolic links.  Callers should take
Packit 8f70b4
   this into account; lchmod should be applied only to arguments that
Packit 8f70b4
   are known to not be symbolic links.  On hosts that lack lchmod,
Packit 8f70b4
   this can lead to race conditions between the check and the
Packit 8f70b4
   invocation of lchmod, but we know of no workarounds that are
Packit 8f70b4
   reliable in general.  You might try requesting support for lchmod
Packit 8f70b4
   from your operating system supplier.  */
Packit 8f70b4
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 8f70b4
#   define lchmod chmod
Packit 8f70b4
#  endif
Packit 8f70b4
/* Need to cast, because on mingw, the second parameter of chmod is
Packit 8f70b4
                                                int mode.  */
Packit 8f70b4
_GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
Packit 8f70b4
                         (const char *filename, mode_t mode));
Packit 8f70b4
# else
Packit 8f70b4
#  if 0 /* assume already declared */
Packit 8f70b4
_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
Packit 8f70b4
                               _GL_ARG_NONNULL ((1)));
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
Packit 8f70b4
# endif
Packit 8f70b4
# if @HAVE_LCHMOD@
Packit 8f70b4
_GL_CXXALIASWARN (lchmod);
Packit 8f70b4
# endif
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef lchmod
Packit 8f70b4
# if HAVE_RAW_DECL_LCHMOD
Packit 8f70b4
_GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
Packit 8f70b4
                 "use gnulib module lchmod for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_LSTAT@
Packit 8f70b4
# if ! @HAVE_LSTAT@
Packit 8f70b4
/* mingw does not support symlinks, therefore it does not have lstat.  But
Packit 8f70b4
   without links, stat does just fine.  */
Packit 8f70b4
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 8f70b4
#   define lstat stat
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
Packit 8f70b4
# elif @REPLACE_LSTAT@
Packit 8f70b4
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 8f70b4
#   undef lstat
Packit 8f70b4
#   define lstat rpl_lstat
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
Packit 8f70b4
                              _GL_ARG_NONNULL ((1, 2)));
Packit 8f70b4
_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
Packit 8f70b4
# else
Packit 8f70b4
_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
Packit 8f70b4
# endif
Packit 8f70b4
# if @HAVE_LSTAT@
Packit 8f70b4
_GL_CXXALIASWARN (lstat);
Packit 8f70b4
# endif
Packit 8f70b4
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
Packit 8f70b4
# undef lstat
Packit 8f70b4
# define lstat lstat_used_without_requesting_gnulib_module_lstat
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef lstat
Packit 8f70b4
# if HAVE_RAW_DECL_LSTAT
Packit 8f70b4
_GL_WARN_ON_USE (lstat, "lstat is unportable - "
Packit 8f70b4
                 "use gnulib module lstat for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @REPLACE_MKDIR@
Packit 8f70b4
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 8f70b4
#  undef mkdir
Packit 8f70b4
#  define mkdir rpl_mkdir
Packit 8f70b4
# endif
Packit 8f70b4
_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
Packit 8f70b4
                              _GL_ARG_NONNULL ((1)));
Packit 8f70b4
_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
Packit 8f70b4
#else
Packit 8f70b4
/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
Packit 8f70b4
   Additionally, it declares _mkdir (and depending on compile flags, an
Packit 8f70b4
   alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
Packit 8f70b4
   which are included above.  */
Packit 8f70b4
# if defined _WIN32 && ! defined __CYGWIN__
Packit 8f70b4
Packit 8f70b4
#  if !GNULIB_defined_rpl_mkdir
Packit 8f70b4
static int
Packit 8f70b4
rpl_mkdir (char const *name, mode_t mode)
Packit 8f70b4
{
Packit 8f70b4
  return _mkdir (name);
Packit 8f70b4
}
Packit 8f70b4
#   define GNULIB_defined_rpl_mkdir 1
Packit 8f70b4
#  endif
Packit 8f70b4
Packit 8f70b4
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 8f70b4
#   define mkdir rpl_mkdir
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
Packit 8f70b4
# else
Packit 8f70b4
_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
_GL_CXXALIASWARN (mkdir);
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_MKDIRAT@
Packit 8f70b4
# if !@HAVE_MKDIRAT@
Packit 8f70b4
_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
Packit 8f70b4
                                _GL_ARG_NONNULL ((2)));
Packit 8f70b4
# endif
Packit 8f70b4
_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
Packit 8f70b4
_GL_CXXALIASWARN (mkdirat);
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef mkdirat
Packit 8f70b4
# if HAVE_RAW_DECL_MKDIRAT
Packit 8f70b4
_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
Packit 8f70b4
                 "use gnulib module openat for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_MKFIFO@
Packit 8f70b4
# if @REPLACE_MKFIFO@
Packit 8f70b4
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 8f70b4
#   undef mkfifo
Packit 8f70b4
#   define mkfifo rpl_mkfifo
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
Packit 8f70b4
                               _GL_ARG_NONNULL ((1)));
Packit 8f70b4
_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
Packit 8f70b4
# else
Packit 8f70b4
#  if !@HAVE_MKFIFO@
Packit 8f70b4
_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
Packit 8f70b4
                               _GL_ARG_NONNULL ((1)));
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
Packit 8f70b4
# endif
Packit 8f70b4
_GL_CXXALIASWARN (mkfifo);
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef mkfifo
Packit 8f70b4
# if HAVE_RAW_DECL_MKFIFO
Packit 8f70b4
_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
Packit 8f70b4
                 "use gnulib module mkfifo for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_MKFIFOAT@
Packit 8f70b4
# if !@HAVE_MKFIFOAT@
Packit 8f70b4
_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
Packit 8f70b4
                                 _GL_ARG_NONNULL ((2)));
Packit 8f70b4
# endif
Packit 8f70b4
_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
Packit 8f70b4
_GL_CXXALIASWARN (mkfifoat);
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef mkfifoat
Packit 8f70b4
# if HAVE_RAW_DECL_MKFIFOAT
Packit 8f70b4
_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
Packit 8f70b4
                 "use gnulib module mkfifoat for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_MKNOD@
Packit 8f70b4
# if @REPLACE_MKNOD@
Packit 8f70b4
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 8f70b4
#   undef mknod
Packit 8f70b4
#   define mknod rpl_mknod
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
Packit 8f70b4
                              _GL_ARG_NONNULL ((1)));
Packit 8f70b4
_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
Packit 8f70b4
# else
Packit 8f70b4
#  if !@HAVE_MKNOD@
Packit 8f70b4
_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
Packit 8f70b4
                              _GL_ARG_NONNULL ((1)));
Packit 8f70b4
#  endif
Packit 8f70b4
/* Need to cast, because on OSF/1 5.1, the third parameter is '...'.  */
Packit 8f70b4
_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
Packit 8f70b4
# endif
Packit 8f70b4
_GL_CXXALIASWARN (mknod);
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef mknod
Packit 8f70b4
# if HAVE_RAW_DECL_MKNOD
Packit 8f70b4
_GL_WARN_ON_USE (mknod, "mknod is not portable - "
Packit 8f70b4
                 "use gnulib module mknod for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_MKNODAT@
Packit 8f70b4
# if !@HAVE_MKNODAT@
Packit 8f70b4
_GL_FUNCDECL_SYS (mknodat, int,
Packit 8f70b4
                  (int fd, char const *file, mode_t mode, dev_t dev)
Packit 8f70b4
                  _GL_ARG_NONNULL ((2)));
Packit 8f70b4
# endif
Packit 8f70b4
_GL_CXXALIAS_SYS (mknodat, int,
Packit 8f70b4
                  (int fd, char const *file, mode_t mode, dev_t dev));
Packit 8f70b4
_GL_CXXALIASWARN (mknodat);
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef mknodat
Packit 8f70b4
# if HAVE_RAW_DECL_MKNODAT
Packit 8f70b4
_GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
Packit 8f70b4
                 "use gnulib module mkfifoat for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_STAT@
Packit 8f70b4
# if @REPLACE_STAT@
Packit 8f70b4
#  if !@GNULIB_OVERRIDES_STRUCT_STAT@
Packit 8f70b4
    /* We can't use the object-like #define stat rpl_stat, because of
Packit 8f70b4
       struct stat.  This means that rpl_stat will not be used if the user
Packit 8f70b4
       does (stat)(a,b).  Oh well.  */
Packit 8f70b4
#   if defined _AIX && defined stat && defined _LARGE_FILES
Packit 8f70b4
     /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
Packit 8f70b4
        so we have to replace stat64() instead of stat(). */
Packit 8f70b4
#    undef stat64
Packit 8f70b4
#    define stat64(name, st) rpl_stat (name, st)
Packit 8f70b4
#   elif @WINDOWS_64_BIT_ST_SIZE@
Packit 8f70b4
     /* Above, we define stat to _stati64.  */
Packit 8f70b4
#    if defined __MINGW32__ && defined _stati64
Packit 8f70b4
#     ifndef _USE_32BIT_TIME_T
Packit 8f70b4
       /* The system headers define _stati64 to _stat64.  */
Packit 8f70b4
#      undef _stat64
Packit 8f70b4
#      define _stat64(name, st) rpl_stat (name, st)
Packit 8f70b4
#     endif
Packit 8f70b4
#    elif defined _MSC_VER && defined _stati64
Packit 8f70b4
#     ifdef _USE_32BIT_TIME_T
Packit 8f70b4
       /* The system headers define _stati64 to _stat32i64.  */
Packit 8f70b4
#      undef _stat32i64
Packit 8f70b4
#      define _stat32i64(name, st) rpl_stat (name, st)
Packit 8f70b4
#     else
Packit 8f70b4
       /* The system headers define _stati64 to _stat64.  */
Packit 8f70b4
#      undef _stat64
Packit 8f70b4
#      define _stat64(name, st) rpl_stat (name, st)
Packit 8f70b4
#     endif
Packit 8f70b4
#    else
Packit 8f70b4
#     undef _stati64
Packit 8f70b4
#     define _stati64(name, st) rpl_stat (name, st)
Packit 8f70b4
#    endif
Packit 8f70b4
#   elif defined __MINGW32__ && defined stat
Packit 8f70b4
#    ifdef _USE_32BIT_TIME_T
Packit 8f70b4
      /* The system headers define stat to _stat32i64.  */
Packit 8f70b4
#     undef _stat32i64
Packit 8f70b4
#     define _stat32i64(name, st) rpl_stat (name, st)
Packit 8f70b4
#    else
Packit 8f70b4
      /* The system headers define stat to _stat64.  */
Packit 8f70b4
#     undef _stat64
Packit 8f70b4
#     define _stat64(name, st) rpl_stat (name, st)
Packit 8f70b4
#    endif
Packit 8f70b4
#   elif defined _MSC_VER && defined stat
Packit 8f70b4
#    ifdef _USE_32BIT_TIME_T
Packit 8f70b4
      /* The system headers define stat to _stat32.  */
Packit 8f70b4
#     undef _stat32
Packit 8f70b4
#     define _stat32(name, st) rpl_stat (name, st)
Packit 8f70b4
#    else
Packit 8f70b4
      /* The system headers define stat to _stat64i32.  */
Packit 8f70b4
#     undef _stat64i32
Packit 8f70b4
#     define _stat64i32(name, st) rpl_stat (name, st)
Packit 8f70b4
#    endif
Packit 8f70b4
#   else /* !(_AIX || __MINGW32__ || _MSC_VER) */
Packit 8f70b4
#    undef stat
Packit 8f70b4
#    define stat(name, st) rpl_stat (name, st)
Packit 8f70b4
#   endif /* !_LARGE_FILES */
Packit 8f70b4
#  endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */
Packit 8f70b4
_GL_EXTERN_C int stat (const char *name, struct stat *buf)
Packit 8f70b4
                      _GL_ARG_NONNULL ((1, 2));
Packit 8f70b4
# endif
Packit 8f70b4
#elif @GNULIB_OVERRIDES_STRUCT_STAT@
Packit 8f70b4
/* see above:
Packit 8f70b4
  #define stat stat_used_without_requesting_gnulib_module_stat
Packit 8f70b4
 */
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef stat
Packit 8f70b4
# if HAVE_RAW_DECL_STAT
Packit 8f70b4
_GL_WARN_ON_USE (stat, "stat is unportable - "
Packit 8f70b4
                 "use gnulib module stat for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#if @GNULIB_UTIMENSAT@
Packit 8f70b4
/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
Packit 8f70b4
   implementation relies on futimesat, which on Solaris 10 makes an invocation
Packit 8f70b4
   to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
Packit 8f70b4
   utimensat().  */
Packit 8f70b4
# if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
Packit 8f70b4
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
Packit 8f70b4
#   undef utimensat
Packit 8f70b4
#   define utimensat rpl_utimensat
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
Packit 8f70b4
                                   struct timespec const times[2], int flag)
Packit 8f70b4
                                  _GL_ARG_NONNULL ((2)));
Packit 8f70b4
_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
Packit 8f70b4
                                   struct timespec const times[2], int flag));
Packit 8f70b4
# else
Packit 8f70b4
#  if !@HAVE_UTIMENSAT@
Packit 8f70b4
_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
Packit 8f70b4
                                   struct timespec const times[2], int flag)
Packit 8f70b4
                                  _GL_ARG_NONNULL ((2)));
Packit 8f70b4
#  endif
Packit 8f70b4
_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
Packit 8f70b4
                                   struct timespec const times[2], int flag));
Packit 8f70b4
# endif
Packit 8f70b4
# if @HAVE_UTIMENSAT@
Packit 8f70b4
_GL_CXXALIASWARN (utimensat);
Packit 8f70b4
# endif
Packit 8f70b4
#elif defined GNULIB_POSIXCHECK
Packit 8f70b4
# undef utimensat
Packit 8f70b4
# if HAVE_RAW_DECL_UTIMENSAT
Packit 8f70b4
_GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
Packit 8f70b4
                 "use gnulib module utimensat for portability");
Packit 8f70b4
# endif
Packit 8f70b4
#endif
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
Packit 8f70b4
#endif /* _@GUARD_PREFIX@_SYS_STAT_H */
Packit 8f70b4
#endif