1/* -*- buffer-read-only: t -*- vi: set ro: */
2/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3#line 1
4/* Provide a more complete sys/stat header file.
5   Copyright (C) 2005-2010 Free Software Foundation, Inc.
6
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation; either version 3, or (at your option)
10   any later version.
11
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with this program; if not, write to the Free Software Foundation,
19   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
20
21/* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
22
23/* This file is supposed to be used on platforms where <sys/stat.h> is
24   incomplete.  It is intended to provide definitions and prototypes
25   needed by an application.  Start with what the system provides.  */
26
27#if __GNUC__ >= 3
28@PRAGMA_SYSTEM_HEADER@
29#endif
30
31#if defined __need_system_sys_stat_h
32/* Special invocation convention.  */
33
34#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
35
36#else
37/* Normal invocation convention.  */
38
39#ifndef _GL_SYS_STAT_H
40
41/* Get nlink_t.  */
42#include <sys/types.h>
43
44/* Get struct timespec.  */
45#include <time.h>
46
47/* The include_next requires a split double-inclusion guard.  */
48#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
49
50#ifndef _GL_SYS_STAT_H
51#define _GL_SYS_STAT_H
52
53/* The definition of GL_LINK_WARNING is copied here.  */
54
55/* The definition of _GL_ARG_NONNULL is copied here.  */
56
57/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
58   headers that may declare mkdir().  */
59#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
60# include <io.h>
61#endif
62
63#ifndef S_IFMT
64# define S_IFMT 0170000
65#endif
66
67#if STAT_MACROS_BROKEN
68# undef S_ISBLK
69# undef S_ISCHR
70# undef S_ISDIR
71# undef S_ISFIFO
72# undef S_ISLNK
73# undef S_ISNAM
74# undef S_ISMPB
75# undef S_ISMPC
76# undef S_ISNWK
77# undef S_ISREG
78# undef S_ISSOCK
79#endif
80
81#ifndef S_ISBLK
82# ifdef S_IFBLK
83#  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
84# else
85#  define S_ISBLK(m) 0
86# endif
87#endif
88
89#ifndef S_ISCHR
90# ifdef S_IFCHR
91#  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
92# else
93#  define S_ISCHR(m) 0
94# endif
95#endif
96
97#ifndef S_ISDIR
98# ifdef S_IFDIR
99#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
100# else
101#  define S_ISDIR(m) 0
102# endif
103#endif
104
105#ifndef S_ISDOOR /* Solaris 2.5 and up */
106# define S_ISDOOR(m) 0
107#endif
108
109#ifndef S_ISFIFO
110# ifdef S_IFIFO
111#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
112# else
113#  define S_ISFIFO(m) 0
114# endif
115#endif
116
117#ifndef S_ISLNK
118# ifdef S_IFLNK
119#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
120# else
121#  define S_ISLNK(m) 0
122# endif
123#endif
124
125#ifndef S_ISMPB /* V7 */
126# ifdef S_IFMPB
127#  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
128#  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
129# else
130#  define S_ISMPB(m) 0
131#  define S_ISMPC(m) 0
132# endif
133#endif
134
135#ifndef S_ISNAM /* Xenix */
136# ifdef S_IFNAM
137#  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
138# else
139#  define S_ISNAM(m) 0
140# endif
141#endif
142
143#ifndef S_ISNWK /* HP/UX */
144# ifdef S_IFNWK
145#  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
146# else
147#  define S_ISNWK(m) 0
148# endif
149#endif
150
151#ifndef S_ISPORT /* Solaris 10 and up */
152# define S_ISPORT(m) 0
153#endif
154
155#ifndef S_ISREG
156# ifdef S_IFREG
157#  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
158# else
159#  define S_ISREG(m) 0
160# endif
161#endif
162
163#ifndef S_ISSOCK
164# ifdef S_IFSOCK
165#  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
166# else
167#  define S_ISSOCK(m) 0
168# endif
169#endif
170
171
172#ifndef S_TYPEISMQ
173# define S_TYPEISMQ(p) 0
174#endif
175
176#ifndef S_TYPEISTMO
177# define S_TYPEISTMO(p) 0
178#endif
179
180
181#ifndef S_TYPEISSEM
182# ifdef S_INSEM
183#  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
184# else
185#  define S_TYPEISSEM(p) 0
186# endif
187#endif
188
189#ifndef S_TYPEISSHM
190# ifdef S_INSHD
191#  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
192# else
193#  define S_TYPEISSHM(p) 0
194# endif
195#endif
196
197/* high performance ("contiguous data") */
198#ifndef S_ISCTG
199# define S_ISCTG(p) 0
200#endif
201
202/* Cray DMF (data migration facility): off line, with data  */
203#ifndef S_ISOFD
204# define S_ISOFD(p) 0
205#endif
206
207/* Cray DMF (data migration facility): off line, with no data  */
208#ifndef S_ISOFL
209# define S_ISOFL(p) 0
210#endif
211
212/* 4.4BSD whiteout */
213#ifndef S_ISWHT
214# define S_ISWHT(m) 0
215#endif
216
217/* If any of the following are undefined,
218   define them to their de facto standard values.  */
219#if !S_ISUID
220# define S_ISUID 04000
221#endif
222#if !S_ISGID
223# define S_ISGID 02000
224#endif
225
226/* S_ISVTX is a common extension to POSIX.  */
227#ifndef S_ISVTX
228# define S_ISVTX 01000
229#endif
230
231#if !S_IRUSR && S_IREAD
232# define S_IRUSR S_IREAD
233#endif
234#if !S_IRUSR
235# define S_IRUSR 00400
236#endif
237#if !S_IRGRP
238# define S_IRGRP (S_IRUSR >> 3)
239#endif
240#if !S_IROTH
241# define S_IROTH (S_IRUSR >> 6)
242#endif
243
244#if !S_IWUSR && S_IWRITE
245# define S_IWUSR S_IWRITE
246#endif
247#if !S_IWUSR
248# define S_IWUSR 00200
249#endif
250#if !S_IWGRP
251# define S_IWGRP (S_IWUSR >> 3)
252#endif
253#if !S_IWOTH
254# define S_IWOTH (S_IWUSR >> 6)
255#endif
256
257#if !S_IXUSR && S_IEXEC
258# define S_IXUSR S_IEXEC
259#endif
260#if !S_IXUSR
261# define S_IXUSR 00100
262#endif
263#if !S_IXGRP
264# define S_IXGRP (S_IXUSR >> 3)
265#endif
266#if !S_IXOTH
267# define S_IXOTH (S_IXUSR >> 6)
268#endif
269
270#if !S_IRWXU
271# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
272#endif
273#if !S_IRWXG
274# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
275#endif
276#if !S_IRWXO
277# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
278#endif
279
280/* S_IXUGO is a common extension to POSIX.  */
281#if !S_IXUGO
282# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
283#endif
284
285#ifndef S_IRWXUGO
286# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
287#endif
288
289/* Macros for futimens and utimensat.  */
290#ifndef UTIME_NOW
291# define UTIME_NOW (-1)
292# define UTIME_OMIT (-2)
293#endif
294
295
296#ifdef __cplusplus
297extern "C" {
298#endif
299
300
301#if @GNULIB_FCHMODAT@
302# if !@HAVE_FCHMODAT@
303extern int fchmodat (int fd, char const *file, mode_t mode, int flag)
304     _GL_ARG_NONNULL ((2));
305# endif
306#elif defined GNULIB_POSIXCHECK
307# undef fchmodat
308# define fchmodat(d,n,m,f)                         \
309    (GL_LINK_WARNING ("fchmodat is not portable - " \
310                      "use gnulib module openat for portability"), \
311     fchmodat (d, n, m, f))
312#endif
313
314
315#if @REPLACE_FSTAT@
316# define fstat rpl_fstat
317extern int fstat (int fd, struct stat *buf) _GL_ARG_NONNULL ((2));
318#endif
319
320
321#if @GNULIB_FSTATAT@
322# if @REPLACE_FSTATAT@
323#  undef fstatat
324#  define fstatat rpl_fstatat
325# endif
326# if !@HAVE_FSTATAT@ || @REPLACE_FSTATAT@
327extern int fstatat (int fd, char const *name, struct stat *st, int flags)
328     _GL_ARG_NONNULL ((2, 3));
329# endif
330#elif defined GNULIB_POSIXCHECK
331# undef fstatat
332# define fstatat(d,n,s,f)                         \
333    (GL_LINK_WARNING ("fstatat is not portable - " \
334                      "use gnulib module openat for portability"), \
335     fstatat (d, n, s, f))
336#endif
337
338
339#if @GNULIB_FUTIMENS@
340# if @REPLACE_FUTIMENS@
341#  undef futimens
342#  define futimens rpl_futimens
343# endif
344# if !@HAVE_FUTIMENS@ || @REPLACE_FUTIMENS@
345extern int futimens (int fd, struct timespec const times[2]);
346# endif
347#elif defined GNULIB_POSIXCHECK
348# undef futimens
349# define futimens(f,t)                         \
350    (GL_LINK_WARNING ("futimens is not portable - " \
351                      "use gnulib module futimens for portability"), \
352     futimens (f, t))
353#endif
354
355
356#if @GNULIB_LCHMOD@
357/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
358   denotes a symbolic link.  */
359# if !@HAVE_LCHMOD@
360/* The lchmod replacement follows symbolic links.  Callers should take
361   this into account; lchmod should be applied only to arguments that
362   are known to not be symbolic links.  On hosts that lack lchmod,
363   this can lead to race conditions between the check and the
364   invocation of lchmod, but we know of no workarounds that are
365   reliable in general.  You might try requesting support for lchmod
366   from your operating system supplier.  */
367#  define lchmod chmod
368# endif
369# if 0 /* assume already declared */
370extern int lchmod (const char *filename, mode_t mode) _GL_ARG_NONNULL ((1));
371# endif
372#elif defined GNULIB_POSIXCHECK
373# undef lchmod
374# define lchmod(f,m) \
375    (GL_LINK_WARNING ("lchmod is unportable - " \
376                      "use gnulib module lchmod for portability"), \
377     lchmod (f, m))
378#endif
379
380
381#if @GNULIB_LSTAT@
382# if ! @HAVE_LSTAT@
383/* mingw does not support symlinks, therefore it does not have lstat.  But
384   without links, stat does just fine.  */
385#  define lstat stat
386# elif @REPLACE_LSTAT@
387#  undef lstat
388#  define lstat rpl_lstat
389extern int rpl_lstat (const char *name, struct stat *buf)
390     _GL_ARG_NONNULL ((1, 2));
391# endif
392#elif defined GNULIB_POSIXCHECK
393# undef lstat
394# define lstat(p,b)                                                     \
395  (GL_LINK_WARNING ("lstat is unportable - "                            \
396                    "use gnulib module lstat for portability"),         \
397   lstat (p, b))
398#endif
399
400
401#if @REPLACE_MKDIR@
402# undef mkdir
403# define mkdir rpl_mkdir
404extern int mkdir (char const *name, mode_t mode) _GL_ARG_NONNULL ((1));
405#else
406/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
407   Additionally, it declares _mkdir (and depending on compile flags, an
408   alias mkdir), only in the nonstandard <io.h>, which is included above.  */
409# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
410
411static inline int
412rpl_mkdir (char const *name, mode_t mode)
413{
414  return _mkdir (name);
415}
416
417#  define mkdir rpl_mkdir
418# endif
419#endif
420
421
422#if @GNULIB_MKDIRAT@
423# if !@HAVE_MKDIRAT@
424extern int mkdirat (int fd, char const *file, mode_t mode)
425     _GL_ARG_NONNULL ((2));
426# endif
427#elif defined GNULIB_POSIXCHECK
428# undef mkdirat
429# define mkdirat(d,n,m)                         \
430    (GL_LINK_WARNING ("mkdirat is not portable - " \
431                      "use gnulib module openat for portability"), \
432     mkdirat (d, n, m))
433#endif
434
435
436#if @GNULIB_MKFIFO@
437# if @REPLACE_MKFIFO@
438#  undef mkfifo
439#  define mkfifo rpl_mkfifo
440# endif
441# if !@HAVE_MKFIFO@ || @REPLACE_MKFIFO@
442extern int mkfifo (char const *file, mode_t mode) _GL_ARG_NONNULL ((1));
443# endif
444#elif defined GNULIB_POSIXCHECK
445# undef mkfifo
446# define mkfifo(n,m)                                                    \
447    (GL_LINK_WARNING ("mkfifo is not portable - "                       \
448                      "use gnulib module mkfifo for portability"),      \
449     mkfifo (n, m))
450#endif
451
452
453#if @GNULIB_MKFIFOAT@
454# if !@HAVE_MKFIFOAT@
455extern int mkfifoat (int fd, char const *file, mode_t mode)
456     _GL_ARG_NONNULL ((2));
457# endif
458#elif defined GNULIB_POSIXCHECK
459# undef mkfifoat
460# define mkfifoat(d,n,m)                                     \
461    (GL_LINK_WARNING ("mkfifoat is not portable - " \
462                      "use gnulib module mkfifoat for portability"), \
463     mkfifoat (d, n, m))
464#endif
465
466
467#if @GNULIB_MKNOD@
468# if @REPLACE_MKNOD@
469#  undef mknod
470#  define mknod rpl_mknod
471# endif
472# if !@HAVE_MKNOD@ || @REPLACE_MKNOD@
473extern int mknod (char const *file, mode_t mode, dev_t dev)
474     _GL_ARG_NONNULL ((1));
475# endif
476#elif defined GNULIB_POSIXCHECK
477# undef mknod
478# define mknod(n,m,d)                                                   \
479    (GL_LINK_WARNING ("mknod is not portable - "                        \
480                      "use gnulib module mknod for portability"),       \
481     mknod (n, m, d))
482#endif
483
484
485#if @GNULIB_MKNODAT@
486# if !@HAVE_MKNODAT@
487extern int mknodat (int fd, char const *file, mode_t mode, dev_t dev)
488     _GL_ARG_NONNULL ((2));
489# endif
490#elif defined GNULIB_POSIXCHECK
491# undef mknodat
492# define mknodat(f,n,m,d)                            \
493    (GL_LINK_WARNING ("mknodat is not portable - " \
494                      "use gnulib module mkfifoat for portability"), \
495     mknodat (f, n, m, d))
496#endif
497
498
499#if @GNULIB_STAT@
500# if @REPLACE_STAT@
501/* We can't use the object-like #define stat rpl_stat, because of
502   struct stat.  This means that rpl_stat will not be used if the user
503   does (stat)(a,b).  Oh well.  */
504#  undef stat
505#  ifdef _LARGE_FILES
506    /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
507       so we have to replace stat64() instead of stat(). */
508#   define stat stat64
509#   undef stat64
510#   define stat64(name, st) rpl_stat (name, st)
511#  else /* !_LARGE_FILES */
512#   define stat(name, st) rpl_stat (name, st)
513#  endif /* !_LARGE_FILES */
514extern int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
515# endif
516#elif defined GNULIB_POSIXCHECK
517# undef stat
518# define stat(p,b)                                                      \
519  (GL_LINK_WARNING ("stat is unportable - "                             \
520                    "use gnulib module stat for portability"),          \
521   stat (p, b))
522#endif
523
524
525#if @GNULIB_UTIMENSAT@
526# if @REPLACE_UTIMENSAT@
527#  undef utimensat
528#  define utimensat rpl_utimensat
529# endif
530# if !@HAVE_UTIMENSAT@ || @REPLACE_UTIMENSAT@
531   extern int utimensat (int fd, char const *name,
532                         struct timespec const times[2], int flag)
533        _GL_ARG_NONNULL ((2));
534# endif
535#elif defined GNULIB_POSIXCHECK
536# undef utimensat
537# define utimensat(d,n,t,f)                          \
538    (GL_LINK_WARNING ("utimensat is not portable - " \
539                      "use gnulib module utimensat for portability"), \
540     utimensat (d, n, t, f))
541#endif
542
543
544#ifdef __cplusplus
545}
546#endif
547
548
549#endif /* _GL_SYS_STAT_H */
550#endif /* _GL_SYS_STAT_H */
551#endif
552