Merge branch 'master' of github.com:monitoring-plugins/monitoring-plugins
[monitoring-plugins.git] / gl / sys_stat.in.h
blob096887c016218a6f560babb2427c4d2a09e15530
1 /* Provide a more complete sys/stat.h header file.
2 Copyright (C) 2005-2023 Free Software Foundation, Inc.
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
9 This file 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 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser 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 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
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
72 /* Native Windows platforms declare umask() in <io.h>. */
73 #if 0 && (defined _WIN32 && ! defined __CYGWIN__)
74 # include <io.h>
75 #endif
77 /* Large File Support on native Windows. */
78 #if @WINDOWS_64_BIT_ST_SIZE@
79 # define stat _stati64
80 #endif
82 /* Optionally, override 'struct stat' on native Windows. */
83 #if @GNULIB_OVERRIDES_STRUCT_STAT@
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
94 # if !GNULIB_defined_struct_stat
95 struct stat
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
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
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
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
149 #endif
151 #ifndef S_IFIFO
152 # ifdef _S_IFIFO
153 # define S_IFIFO _S_IFIFO
154 # endif
155 #endif
157 #ifndef S_IFMT
158 # define S_IFMT 0170000
159 #endif
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
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
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
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
199 #ifndef S_ISDOOR /* Solaris 2.5 and up */
200 # define S_ISDOOR(m) 0
201 #endif
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
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
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
229 #ifndef S_ISMPX /* AIX */
230 # define S_ISMPX(m) 0
231 #endif
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
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
249 #ifndef S_ISPORT /* Solaris 10 and up */
250 # define S_ISPORT(m) 0
251 #endif
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
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
270 #ifndef S_TYPEISMQ
271 # define S_TYPEISMQ(p) 0
272 #endif
274 #ifndef S_TYPEISTMO
275 # define S_TYPEISTMO(p) 0
276 #endif
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
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
295 /* high performance ("contiguous data") */
296 #ifndef S_ISCTG
297 # define S_ISCTG(p) 0
298 #endif
300 /* Cray DMF (data migration facility): off line, with data */
301 #ifndef S_ISOFD
302 # define S_ISOFD(p) 0
303 #endif
305 /* Cray DMF (data migration facility): off line, with no data */
306 #ifndef S_ISOFL
307 # define S_ISOFL(p) 0
308 #endif
310 /* 4.4BSD whiteout */
311 #ifndef S_ISWHT
312 # define S_ISWHT(m) 0
313 #endif
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
324 /* S_ISVTX is a common extension to POSIX. */
325 #ifndef S_ISVTX
326 # define S_ISVTX 01000
327 #endif
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
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
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
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
378 /* Although S_IXUGO and S_IRWXUGO are not specified by POSIX and are
379 not implemented in GNU/Linux, some Gnulib-using apps use the macros. */
380 #if !S_IXUGO
381 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
382 #endif
383 #ifndef S_IRWXUGO
384 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
385 #endif
387 /* Macros for futimens and utimensat. */
388 #ifndef UTIME_NOW
389 # define UTIME_NOW (-1)
390 # define UTIME_OMIT (-2)
391 #endif
394 #if @GNULIB_CHMOD@
395 # if @REPLACE_CHMOD@
396 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
397 # undef chmod
398 # define chmod rpl_chmod
399 # endif
400 _GL_FUNCDECL_RPL (chmod, int, (const char *filename, mode_t mode)
401 _GL_ARG_NONNULL ((1)));
402 _GL_CXXALIAS_RPL (chmod, int, (const char *filename, mode_t mode));
403 # elif defined _WIN32 && !defined __CYGWIN__
404 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
405 # undef chmod
406 # define chmod _chmod
407 # endif
408 /* Need to cast, because in mingw the last argument is 'int mode'. */
409 _GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
410 # else
411 _GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
412 # endif
413 _GL_CXXALIASWARN (chmod);
414 #elif defined GNULIB_POSIXCHECK
415 # undef chmod
416 # if HAVE_RAW_DECL_CHMOD
417 _GL_WARN_ON_USE (chmod, "chmod has portability problems - "
418 "use gnulib module chmod for portability");
419 # endif
420 #elif @GNULIB_MDA_CHMOD@
421 /* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not
422 required. In C++ with GNULIB_NAMESPACE, avoid differences between
423 platforms by defining GNULIB_NAMESPACE::chmod always. */
424 # if defined _WIN32 && !defined __CYGWIN__
425 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
426 # undef chmod
427 # define chmod _chmod
428 # endif
429 /* Need to cast, because in mingw the last argument is 'int mode'. */
430 _GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode));
431 # else
432 _GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode));
433 # endif
434 _GL_CXXALIASWARN (chmod);
435 #endif
438 #if @GNULIB_FCHMODAT@
439 # if @REPLACE_FCHMODAT@
440 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
441 # undef fchmodat
442 # define fchmodat rpl_fchmodat
443 # endif
444 _GL_FUNCDECL_RPL (fchmodat, int,
445 (int fd, char const *file, mode_t mode, int flag)
446 _GL_ARG_NONNULL ((2)));
447 _GL_CXXALIAS_RPL (fchmodat, int,
448 (int fd, char const *file, mode_t mode, int flag));
449 # else
450 # if !@HAVE_FCHMODAT@
451 _GL_FUNCDECL_SYS (fchmodat, int,
452 (int fd, char const *file, mode_t mode, int flag)
453 _GL_ARG_NONNULL ((2)));
454 # endif
455 _GL_CXXALIAS_SYS (fchmodat, int,
456 (int fd, char const *file, mode_t mode, int flag));
457 # endif
458 _GL_CXXALIASWARN (fchmodat);
459 #elif defined GNULIB_POSIXCHECK
460 # undef fchmodat
461 # if HAVE_RAW_DECL_FCHMODAT
462 _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
463 "use gnulib module openat for portability");
464 # endif
465 #endif
468 #if @GNULIB_FSTAT@
469 # if @REPLACE_FSTAT@
470 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
471 # undef fstat
472 # define fstat rpl_fstat
473 # endif
474 _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
475 _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
476 # else
477 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
478 # endif
479 # if __GLIBC__ >= 2
480 _GL_CXXALIASWARN (fstat);
481 # endif
482 #elif @GNULIB_OVERRIDES_STRUCT_STAT@
483 # undef fstat
484 # define fstat fstat_used_without_requesting_gnulib_module_fstat
485 #elif @WINDOWS_64_BIT_ST_SIZE@
486 /* Above, we define stat to _stati64. */
487 # define fstat _fstati64
488 #elif defined GNULIB_POSIXCHECK
489 # undef fstat
490 # if HAVE_RAW_DECL_FSTAT
491 _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
492 "use gnulib module fstat for portability");
493 # endif
494 #endif
497 #if @GNULIB_FSTATAT@
498 # if @REPLACE_FSTATAT@
499 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
500 # undef fstatat
501 # define fstatat rpl_fstatat
502 # endif
503 _GL_FUNCDECL_RPL (fstatat, int,
504 (int fd, char const *restrict name, struct stat *restrict st,
505 int flags)
506 _GL_ARG_NONNULL ((2, 3)));
507 _GL_CXXALIAS_RPL (fstatat, int,
508 (int fd, char const *restrict name, struct stat *restrict st,
509 int flags));
510 # else
511 # if !@HAVE_FSTATAT@
512 _GL_FUNCDECL_SYS (fstatat, int,
513 (int fd, char const *restrict name, struct stat *restrict st,
514 int flags)
515 _GL_ARG_NONNULL ((2, 3)));
516 # endif
517 _GL_CXXALIAS_SYS (fstatat, int,
518 (int fd, char const *restrict name, struct stat *restrict st,
519 int flags));
520 # endif
521 _GL_CXXALIASWARN (fstatat);
522 #elif @GNULIB_OVERRIDES_STRUCT_STAT@
523 # undef fstatat
524 # define fstatat fstatat_used_without_requesting_gnulib_module_fstatat
525 #elif defined GNULIB_POSIXCHECK
526 # undef fstatat
527 # if HAVE_RAW_DECL_FSTATAT
528 _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
529 "use gnulib module openat for portability");
530 # endif
531 #endif
534 #if @GNULIB_FUTIMENS@
535 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
536 implementation relies on futimesat, which on Solaris 10 makes an invocation
537 to futimens that is meant to invoke the libc's futimens(), not gnulib's
538 futimens(). */
539 # if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
540 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
541 # undef futimens
542 # define futimens rpl_futimens
543 # endif
544 _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
545 _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
546 # else
547 # if !@HAVE_FUTIMENS@
548 _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
549 # endif
550 _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
551 # endif
552 # if @HAVE_FUTIMENS@
553 _GL_CXXALIASWARN (futimens);
554 # endif
555 #elif defined GNULIB_POSIXCHECK
556 # undef futimens
557 # if HAVE_RAW_DECL_FUTIMENS
558 _GL_WARN_ON_USE (futimens, "futimens is not portable - "
559 "use gnulib module futimens for portability");
560 # endif
561 #endif
564 #if @GNULIB_GETUMASK@
565 # if !@HAVE_GETUMASK@
566 _GL_FUNCDECL_SYS (getumask, mode_t, (void));
567 # endif
568 _GL_CXXALIAS_SYS (getumask, mode_t, (void));
569 # if @HAVE_GETUMASK@
570 _GL_CXXALIASWARN (getumask);
571 # endif
572 #elif defined GNULIB_POSIXCHECK
573 # undef getumask
574 # if HAVE_RAW_DECL_GETUMASK
575 _GL_WARN_ON_USE (getumask, "getumask is not portable - "
576 "use gnulib module getumask for portability");
577 # endif
578 #endif
581 #if @GNULIB_LCHMOD@
582 /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
583 denotes a symbolic link. */
584 # if !@HAVE_LCHMOD@ || defined __hpux
585 _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
586 _GL_ARG_NONNULL ((1)));
587 # endif
588 _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
589 _GL_CXXALIASWARN (lchmod);
590 #elif defined GNULIB_POSIXCHECK
591 # undef lchmod
592 # if HAVE_RAW_DECL_LCHMOD
593 _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
594 "use gnulib module lchmod for portability");
595 # endif
596 #endif
599 #if @GNULIB_MKDIR@
600 # if @REPLACE_MKDIR@
601 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
602 # undef mkdir
603 # define mkdir rpl_mkdir
604 # endif
605 _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
606 _GL_ARG_NONNULL ((1)));
607 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
608 # elif defined _WIN32 && !defined __CYGWIN__
609 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
610 Additionally, it declares _mkdir (and depending on compile flags, an
611 alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
612 which are included above. */
613 # if !GNULIB_defined_rpl_mkdir
614 static int
615 rpl_mkdir (char const *name, mode_t mode)
617 return _mkdir (name);
619 # define GNULIB_defined_rpl_mkdir 1
620 # endif
621 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
622 # undef mkdir
623 # define mkdir rpl_mkdir
624 # endif
625 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
626 # else
627 _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
628 # endif
629 _GL_CXXALIASWARN (mkdir);
630 #elif defined GNULIB_POSIXCHECK
631 # undef mkdir
632 # if HAVE_RAW_DECL_MKDIR
633 _GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - "
634 "use gnulib module mkdir for portability");
635 # endif
636 #elif @GNULIB_MDA_MKDIR@
637 /* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not
638 required. In C++ with GNULIB_NAMESPACE, avoid differences between
639 platforms by defining GNULIB_NAMESPACE::mkdir always. */
640 # if defined _WIN32 && !defined __CYGWIN__
641 # if !GNULIB_defined_rpl_mkdir
642 static int
643 rpl_mkdir (char const *name, mode_t mode)
645 return _mkdir (name);
647 # define GNULIB_defined_rpl_mkdir 1
648 # endif
649 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
650 # undef mkdir
651 # define mkdir rpl_mkdir
652 # endif
653 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
654 # else
655 _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
656 # endif
657 _GL_CXXALIASWARN (mkdir);
658 #endif
661 #if @GNULIB_MKDIRAT@
662 # if !@HAVE_MKDIRAT@
663 _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
664 _GL_ARG_NONNULL ((2)));
665 # endif
666 _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
667 _GL_CXXALIASWARN (mkdirat);
668 #elif defined GNULIB_POSIXCHECK
669 # undef mkdirat
670 # if HAVE_RAW_DECL_MKDIRAT
671 _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
672 "use gnulib module openat for portability");
673 # endif
674 #endif
677 #if @GNULIB_MKFIFO@
678 # if @REPLACE_MKFIFO@
679 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
680 # undef mkfifo
681 # define mkfifo rpl_mkfifo
682 # endif
683 _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
684 _GL_ARG_NONNULL ((1)));
685 _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
686 # else
687 # if !@HAVE_MKFIFO@
688 _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
689 _GL_ARG_NONNULL ((1)));
690 # endif
691 _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
692 # endif
693 _GL_CXXALIASWARN (mkfifo);
694 #elif defined GNULIB_POSIXCHECK
695 # undef mkfifo
696 # if HAVE_RAW_DECL_MKFIFO
697 _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
698 "use gnulib module mkfifo for portability");
699 # endif
700 #endif
703 #if @GNULIB_MKFIFOAT@
704 # if @REPLACE_MKFIFOAT@
705 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
706 # undef mkfifoat
707 # define mkfifoat rpl_mkfifoat
708 # endif
709 _GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)
710 _GL_ARG_NONNULL ((2)));
711 _GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode));
712 # else
713 # if !@HAVE_MKFIFOAT@
714 _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
715 _GL_ARG_NONNULL ((2)));
716 # endif
717 _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
718 # endif
719 _GL_CXXALIASWARN (mkfifoat);
720 #elif defined GNULIB_POSIXCHECK
721 # undef mkfifoat
722 # if HAVE_RAW_DECL_MKFIFOAT
723 _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
724 "use gnulib module mkfifoat for portability");
725 # endif
726 #endif
729 #if @GNULIB_MKNOD@
730 # if @REPLACE_MKNOD@
731 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
732 # undef mknod
733 # define mknod rpl_mknod
734 # endif
735 _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
736 _GL_ARG_NONNULL ((1)));
737 _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
738 # else
739 # if !@HAVE_MKNOD@
740 _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
741 _GL_ARG_NONNULL ((1)));
742 # endif
743 /* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */
744 _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
745 # endif
746 _GL_CXXALIASWARN (mknod);
747 #elif defined GNULIB_POSIXCHECK
748 # undef mknod
749 # if HAVE_RAW_DECL_MKNOD
750 _GL_WARN_ON_USE (mknod, "mknod is not portable - "
751 "use gnulib module mknod for portability");
752 # endif
753 #endif
756 #if @GNULIB_MKNODAT@
757 # if @REPLACE_MKNODAT@
758 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
759 # undef mknodat
760 # define mknodat rpl_mknodat
761 # endif
762 _GL_FUNCDECL_RPL (mknodat, int,
763 (int fd, char const *file, mode_t mode, dev_t dev)
764 _GL_ARG_NONNULL ((2)));
765 _GL_CXXALIAS_RPL (mknodat, int,
766 (int fd, char const *file, mode_t mode, dev_t dev));
767 # else
768 # if !@HAVE_MKNODAT@
769 _GL_FUNCDECL_SYS (mknodat, int,
770 (int fd, char const *file, mode_t mode, dev_t dev)
771 _GL_ARG_NONNULL ((2)));
772 # endif
773 _GL_CXXALIAS_SYS (mknodat, int,
774 (int fd, char const *file, mode_t mode, dev_t dev));
775 # endif
776 _GL_CXXALIASWARN (mknodat);
777 #elif defined GNULIB_POSIXCHECK
778 # undef mknodat
779 # if HAVE_RAW_DECL_MKNODAT
780 _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
781 "use gnulib module mkfifoat for portability");
782 # endif
783 #endif
786 #if @GNULIB_STAT@
787 # if @REPLACE_STAT@
788 # if !@GNULIB_OVERRIDES_STRUCT_STAT@
789 /* We can't use the object-like #define stat rpl_stat, because of
790 struct stat. This means that rpl_stat will not be used if the user
791 does (stat)(a,b). Oh well. */
792 # if defined _AIX && defined stat && defined _LARGE_FILES
793 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
794 so we have to replace stat64() instead of stat(). */
795 # undef stat64
796 # define stat64(name, st) rpl_stat (name, st)
797 # elif @WINDOWS_64_BIT_ST_SIZE@
798 /* Above, we define stat to _stati64. */
799 # if defined __MINGW32__ && defined _stati64
800 # ifndef _USE_32BIT_TIME_T
801 /* The system headers define _stati64 to _stat64. */
802 # undef _stat64
803 # define _stat64(name, st) rpl_stat (name, st)
804 # endif
805 # elif defined _MSC_VER && defined _stati64
806 # ifdef _USE_32BIT_TIME_T
807 /* The system headers define _stati64 to _stat32i64. */
808 # undef _stat32i64
809 # define _stat32i64(name, st) rpl_stat (name, st)
810 # else
811 /* The system headers define _stati64 to _stat64. */
812 # undef _stat64
813 # define _stat64(name, st) rpl_stat (name, st)
814 # endif
815 # else
816 # undef _stati64
817 # define _stati64(name, st) rpl_stat (name, st)
818 # endif
819 # elif defined __MINGW32__ && defined stat
820 # ifdef _USE_32BIT_TIME_T
821 /* The system headers define stat to _stat32i64. */
822 # undef _stat32i64
823 # define _stat32i64(name, st) rpl_stat (name, st)
824 # else
825 /* The system headers define stat to _stat64. */
826 # undef _stat64
827 # define _stat64(name, st) rpl_stat (name, st)
828 # endif
829 # elif defined _MSC_VER && defined stat
830 # ifdef _USE_32BIT_TIME_T
831 /* The system headers define stat to _stat32. */
832 # undef _stat32
833 # define _stat32(name, st) rpl_stat (name, st)
834 # else
835 /* The system headers define stat to _stat64i32. */
836 # undef _stat64i32
837 # define _stat64i32(name, st) rpl_stat (name, st)
838 # endif
839 # else /* !(_AIX || __MINGW32__ || _MSC_VER) */
840 # undef stat
841 # define stat(name, st) rpl_stat (name, st)
842 # endif /* !_LARGE_FILES */
843 # endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */
844 _GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf)
845 _GL_ARG_NONNULL ((1, 2));
846 # endif
847 #elif @GNULIB_OVERRIDES_STRUCT_STAT@
848 /* see above:
849 #define stat stat_used_without_requesting_gnulib_module_stat
851 #elif defined GNULIB_POSIXCHECK
852 # undef stat
853 # if HAVE_RAW_DECL_STAT
854 _GL_WARN_ON_USE (stat, "stat is unportable - "
855 "use gnulib module stat for portability");
856 # endif
857 #endif
860 #if @GNULIB_LSTAT@
861 # if ! @HAVE_LSTAT@
862 /* mingw does not support symlinks, therefore it does not have lstat. But
863 without links, stat does just fine. */
864 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
865 # define lstat stat
866 # endif
867 _GL_CXXALIAS_RPL_1 (lstat, stat, int,
868 (const char *restrict name, struct stat *restrict buf));
869 # elif @REPLACE_LSTAT@
870 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
871 # undef lstat
872 # define lstat rpl_lstat
873 # endif
874 _GL_FUNCDECL_RPL (lstat, int,
875 (const char *restrict name, struct stat *restrict buf)
876 _GL_ARG_NONNULL ((1, 2)));
877 _GL_CXXALIAS_RPL (lstat, int,
878 (const char *restrict name, struct stat *restrict buf));
879 # else
880 _GL_CXXALIAS_SYS (lstat, int,
881 (const char *restrict name, struct stat *restrict buf));
882 # endif
883 # if @HAVE_LSTAT@
884 _GL_CXXALIASWARN (lstat);
885 # endif
886 #elif @GNULIB_OVERRIDES_STRUCT_STAT@
887 # undef lstat
888 # define lstat lstat_used_without_requesting_gnulib_module_lstat
889 #elif defined GNULIB_POSIXCHECK
890 # undef lstat
891 # if HAVE_RAW_DECL_LSTAT
892 _GL_WARN_ON_USE (lstat, "lstat is unportable - "
893 "use gnulib module lstat for portability");
894 # endif
895 #endif
898 #if @GNULIB_MDA_UMASK@
899 /* On native Windows, map 'umask' to '_umask', so that -loldnames is not
900 required. In C++ with GNULIB_NAMESPACE, avoid differences between
901 platforms by defining GNULIB_NAMESPACE::umask always. */
902 # if defined _WIN32 && !defined __CYGWIN__
903 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
904 # undef umask
905 # define umask _umask
906 # endif
907 /* Need to cast, because in mingw the last argument is 'int mode'. */
908 _GL_CXXALIAS_MDA_CAST (umask, mode_t, (mode_t mask));
909 # else
910 _GL_CXXALIAS_SYS (umask, mode_t, (mode_t mask));
911 # endif
912 _GL_CXXALIASWARN (umask);
913 #endif
916 #if @GNULIB_UTIMENSAT@
917 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
918 implementation relies on futimesat, which on Solaris 10 makes an invocation
919 to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
920 utimensat(). */
921 # if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
922 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
923 # undef utimensat
924 # define utimensat rpl_utimensat
925 # endif
926 _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
927 struct timespec const times[2], int flag)
928 _GL_ARG_NONNULL ((2)));
929 _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
930 struct timespec const times[2], int flag));
931 # else
932 # if !@HAVE_UTIMENSAT@
933 _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
934 struct timespec const times[2], int flag)
935 _GL_ARG_NONNULL ((2)));
936 # endif
937 _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
938 struct timespec const times[2], int flag));
939 # endif
940 # if @HAVE_UTIMENSAT@
941 _GL_CXXALIASWARN (utimensat);
942 # endif
943 #elif defined GNULIB_POSIXCHECK
944 # undef utimensat
945 # if HAVE_RAW_DECL_UTIMENSAT
946 _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
947 "use gnulib module utimensat for portability");
948 # endif
949 #endif
952 #endif /* _@GUARD_PREFIX@_SYS_STAT_H */
953 #endif /* _@GUARD_PREFIX@_SYS_STAT_H */
954 #endif