Blame src/gl/sys_stat.in.h

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