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