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