maint: don't specify XZ_OPT=-9ev in dist-related rule
[gnulib.git] / lib / sys_stat.in.h
1 /* Provide a more complete sys/stat header file.
2    Copyright (C) 2005-2012 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 2, 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 <http://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 #include <sys/types.h>
40
41 /* Get struct timespec.  */
42 #include <time.h>
43
44 /* The include_next requires a split double-inclusion guard.  */
45 #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
46
47 #ifndef _@GUARD_PREFIX@_SYS_STAT_H
48 #define _@GUARD_PREFIX@_SYS_STAT_H
49
50 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
51
52 /* The definition of _GL_ARG_NONNULL is copied here.  */
53
54 /* The definition of _GL_WARN_ON_USE is copied here.  */
55
56 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
57    headers that may declare mkdir().  Native Windows platforms declare mkdir
58    in <io.h> and/or <direct.h>, not in <unistd.h>.  */
59 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
60 # include <io.h>     /* mingw32, mingw64 */
61 # include <direct.h> /* mingw64, MSVC 9 */
62 #endif
63
64 /* Native Windows platforms declare umask() in <io.h>.  */
65 #if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
66 # include <io.h>
67 #endif
68
69 #ifndef S_IFIFO
70 # ifdef _S_IFIFO
71 #  define S_IFIFO _S_IFIFO
72 # endif
73 #endif
74
75 #ifndef S_IFMT
76 # define S_IFMT 0170000
77 #endif
78
79 #if STAT_MACROS_BROKEN
80 # undef S_ISBLK
81 # undef S_ISCHR
82 # undef S_ISDIR
83 # undef S_ISFIFO
84 # undef S_ISLNK
85 # undef S_ISNAM
86 # undef S_ISMPB
87 # undef S_ISMPC
88 # undef S_ISNWK
89 # undef S_ISREG
90 # undef S_ISSOCK
91 #endif
92
93 #ifndef S_ISBLK
94 # ifdef S_IFBLK
95 #  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
96 # else
97 #  define S_ISBLK(m) 0
98 # endif
99 #endif
100
101 #ifndef S_ISCHR
102 # ifdef S_IFCHR
103 #  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
104 # else
105 #  define S_ISCHR(m) 0
106 # endif
107 #endif
108
109 #ifndef S_ISDIR
110 # ifdef S_IFDIR
111 #  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
112 # else
113 #  define S_ISDIR(m) 0
114 # endif
115 #endif
116
117 #ifndef S_ISDOOR /* Solaris 2.5 and up */
118 # define S_ISDOOR(m) 0
119 #endif
120
121 #ifndef S_ISFIFO
122 # ifdef S_IFIFO
123 #  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
124 # else
125 #  define S_ISFIFO(m) 0
126 # endif
127 #endif
128
129 #ifndef S_ISLNK
130 # ifdef S_IFLNK
131 #  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
132 # else
133 #  define S_ISLNK(m) 0
134 # endif
135 #endif
136
137 #ifndef S_ISMPB /* V7 */
138 # ifdef S_IFMPB
139 #  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
140 #  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
141 # else
142 #  define S_ISMPB(m) 0
143 #  define S_ISMPC(m) 0
144 # endif
145 #endif
146
147 #ifndef S_ISNAM /* Xenix */
148 # ifdef S_IFNAM
149 #  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
150 # else
151 #  define S_ISNAM(m) 0
152 # endif
153 #endif
154
155 #ifndef S_ISNWK /* HP/UX */
156 # ifdef S_IFNWK
157 #  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
158 # else
159 #  define S_ISNWK(m) 0
160 # endif
161 #endif
162
163 #ifndef S_ISPORT /* Solaris 10 and up */
164 # define S_ISPORT(m) 0
165 #endif
166
167 #ifndef S_ISREG
168 # ifdef S_IFREG
169 #  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
170 # else
171 #  define S_ISREG(m) 0
172 # endif
173 #endif
174
175 #ifndef S_ISSOCK
176 # ifdef S_IFSOCK
177 #  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
178 # else
179 #  define S_ISSOCK(m) 0
180 # endif
181 #endif
182
183
184 #ifndef S_TYPEISMQ
185 # define S_TYPEISMQ(p) 0
186 #endif
187
188 #ifndef S_TYPEISTMO
189 # define S_TYPEISTMO(p) 0
190 #endif
191
192
193 #ifndef S_TYPEISSEM
194 # ifdef S_INSEM
195 #  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
196 # else
197 #  define S_TYPEISSEM(p) 0
198 # endif
199 #endif
200
201 #ifndef S_TYPEISSHM
202 # ifdef S_INSHD
203 #  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
204 # else
205 #  define S_TYPEISSHM(p) 0
206 # endif
207 #endif
208
209 /* high performance ("contiguous data") */
210 #ifndef S_ISCTG
211 # define S_ISCTG(p) 0
212 #endif
213
214 /* Cray DMF (data migration facility): off line, with data  */
215 #ifndef S_ISOFD
216 # define S_ISOFD(p) 0
217 #endif
218
219 /* Cray DMF (data migration facility): off line, with no data  */
220 #ifndef S_ISOFL
221 # define S_ISOFL(p) 0
222 #endif
223
224 /* 4.4BSD whiteout */
225 #ifndef S_ISWHT
226 # define S_ISWHT(m) 0
227 #endif
228
229 /* If any of the following are undefined,
230    define them to their de facto standard values.  */
231 #if !S_ISUID
232 # define S_ISUID 04000
233 #endif
234 #if !S_ISGID
235 # define S_ISGID 02000
236 #endif
237
238 /* S_ISVTX is a common extension to POSIX.  */
239 #ifndef S_ISVTX
240 # define S_ISVTX 01000
241 #endif
242
243 #if !S_IRUSR && S_IREAD
244 # define S_IRUSR S_IREAD
245 #endif
246 #if !S_IRUSR
247 # define S_IRUSR 00400
248 #endif
249 #if !S_IRGRP
250 # define S_IRGRP (S_IRUSR >> 3)
251 #endif
252 #if !S_IROTH
253 # define S_IROTH (S_IRUSR >> 6)
254 #endif
255
256 #if !S_IWUSR && S_IWRITE
257 # define S_IWUSR S_IWRITE
258 #endif
259 #if !S_IWUSR
260 # define S_IWUSR 00200
261 #endif
262 #if !S_IWGRP
263 # define S_IWGRP (S_IWUSR >> 3)
264 #endif
265 #if !S_IWOTH
266 # define S_IWOTH (S_IWUSR >> 6)
267 #endif
268
269 #if !S_IXUSR && S_IEXEC
270 # define S_IXUSR S_IEXEC
271 #endif
272 #if !S_IXUSR
273 # define S_IXUSR 00100
274 #endif
275 #if !S_IXGRP
276 # define S_IXGRP (S_IXUSR >> 3)
277 #endif
278 #if !S_IXOTH
279 # define S_IXOTH (S_IXUSR >> 6)
280 #endif
281
282 #if !S_IRWXU
283 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
284 #endif
285 #if !S_IRWXG
286 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
287 #endif
288 #if !S_IRWXO
289 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
290 #endif
291
292 /* S_IXUGO is a common extension to POSIX.  */
293 #if !S_IXUGO
294 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
295 #endif
296
297 #ifndef S_IRWXUGO
298 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
299 #endif
300
301 /* Macros for futimens and utimensat.  */
302 #ifndef UTIME_NOW
303 # define UTIME_NOW (-1)
304 # define UTIME_OMIT (-2)
305 #endif
306
307
308 #if @GNULIB_FCHMODAT@
309 # if !@HAVE_FCHMODAT@
310 _GL_FUNCDECL_SYS (fchmodat, int,
311                   (int fd, char const *file, mode_t mode, int flag)
312                   _GL_ARG_NONNULL ((2)));
313 # endif
314 _GL_CXXALIAS_SYS (fchmodat, int,
315                   (int fd, char const *file, mode_t mode, int flag));
316 _GL_CXXALIASWARN (fchmodat);
317 #elif defined GNULIB_POSIXCHECK
318 # undef fchmodat
319 # if HAVE_RAW_DECL_FCHMODAT
320 _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
321                  "use gnulib module openat for portability");
322 # endif
323 #endif
324
325
326 #if @GNULIB_FSTAT@
327 # if @REPLACE_FSTAT@
328 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
329 #   undef fstat
330 #   define fstat rpl_fstat
331 #  endif
332 _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
333 _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
334 # else
335 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
336 # endif
337 _GL_CXXALIASWARN (fstat);
338 #elif defined GNULIB_POSIXCHECK
339 # undef fstat
340 # if HAVE_RAW_DECL_FSTAT
341 _GL_WARN_ON_USE (fstat, "fstat has portability problems - "
342                  "use gnulib module fstat for portability");
343 # endif
344 #endif
345
346
347 #if @GNULIB_FSTATAT@
348 # if @REPLACE_FSTATAT@
349 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
350 #   undef fstatat
351 #   define fstatat rpl_fstatat
352 #  endif
353 _GL_FUNCDECL_RPL (fstatat, int,
354                   (int fd, char const *name, struct stat *st, int flags)
355                   _GL_ARG_NONNULL ((2, 3)));
356 _GL_CXXALIAS_RPL (fstatat, int,
357                   (int fd, char const *name, struct stat *st, int flags));
358 # else
359 #  if !@HAVE_FSTATAT@
360 _GL_FUNCDECL_SYS (fstatat, int,
361                   (int fd, char const *name, struct stat *st, int flags)
362                   _GL_ARG_NONNULL ((2, 3)));
363 #  endif
364 _GL_CXXALIAS_SYS (fstatat, int,
365                   (int fd, char const *name, struct stat *st, int flags));
366 # endif
367 _GL_CXXALIASWARN (fstatat);
368 #elif defined GNULIB_POSIXCHECK
369 # undef fstatat
370 # if HAVE_RAW_DECL_FSTATAT
371 _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
372                  "use gnulib module openat for portability");
373 # endif
374 #endif
375
376
377 #if @GNULIB_FUTIMENS@
378 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens
379    implementation relies on futimesat, which on Solaris 10 makes an invocation
380    to futimens that is meant to invoke the libc's futimens(), not gnulib's
381    futimens().  */
382 # if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun)
383 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
384 #   undef futimens
385 #   define futimens rpl_futimens
386 #  endif
387 _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
388 _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
389 # else
390 #  if !@HAVE_FUTIMENS@
391 _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
392 #  endif
393 _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
394 # endif
395 # if @HAVE_FUTIMENS@
396 _GL_CXXALIASWARN (futimens);
397 # endif
398 #elif defined GNULIB_POSIXCHECK
399 # undef futimens
400 # if HAVE_RAW_DECL_FUTIMENS
401 _GL_WARN_ON_USE (futimens, "futimens is not portable - "
402                  "use gnulib module futimens for portability");
403 # endif
404 #endif
405
406
407 #if @GNULIB_LCHMOD@
408 /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
409    denotes a symbolic link.  */
410 # if !@HAVE_LCHMOD@
411 /* The lchmod replacement follows symbolic links.  Callers should take
412    this into account; lchmod should be applied only to arguments that
413    are known to not be symbolic links.  On hosts that lack lchmod,
414    this can lead to race conditions between the check and the
415    invocation of lchmod, but we know of no workarounds that are
416    reliable in general.  You might try requesting support for lchmod
417    from your operating system supplier.  */
418 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
419 #   define lchmod chmod
420 #  endif
421 /* Need to cast, because on mingw, the second parameter of chmod is
422                                                 int mode.  */
423 _GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
424                          (const char *filename, mode_t mode));
425 # else
426 #  if 0 /* assume already declared */
427 _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
428                                _GL_ARG_NONNULL ((1)));
429 #  endif
430 _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
431 # endif
432 # if @HAVE_LCHMOD@
433 _GL_CXXALIASWARN (lchmod);
434 # endif
435 #elif defined GNULIB_POSIXCHECK
436 # undef lchmod
437 # if HAVE_RAW_DECL_LCHMOD
438 _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
439                  "use gnulib module lchmod for portability");
440 # endif
441 #endif
442
443
444 #if @GNULIB_LSTAT@
445 # if ! @HAVE_LSTAT@
446 /* mingw does not support symlinks, therefore it does not have lstat.  But
447    without links, stat does just fine.  */
448 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
449 #   define lstat stat
450 #  endif
451 _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
452 # elif @REPLACE_LSTAT@
453 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
454 #   undef lstat
455 #   define lstat rpl_lstat
456 #  endif
457 _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
458                               _GL_ARG_NONNULL ((1, 2)));
459 _GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
460 # else
461 _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
462 # endif
463 # if @HAVE_LSTAT@
464 _GL_CXXALIASWARN (lstat);
465 # endif
466 #elif defined GNULIB_POSIXCHECK
467 # undef lstat
468 # if HAVE_RAW_DECL_LSTAT
469 _GL_WARN_ON_USE (lstat, "lstat is unportable - "
470                  "use gnulib module lstat for portability");
471 # endif
472 #endif
473
474
475 #if @REPLACE_MKDIR@
476 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
477 #  undef mkdir
478 #  define mkdir rpl_mkdir
479 # endif
480 _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
481                               _GL_ARG_NONNULL ((1)));
482 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
483 #else
484 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
485    Additionally, it declares _mkdir (and depending on compile flags, an
486    alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
487    which are included above.  */
488 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
489
490 #  if !GNULIB_defined_rpl_mkdir
491 static inline int
492 rpl_mkdir (char const *name, mode_t mode)
493 {
494   return _mkdir (name);
495 }
496 #   define GNULIB_defined_rpl_mkdir 1
497 #  endif
498
499 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
500 #   define mkdir rpl_mkdir
501 #  endif
502 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
503 # else
504 _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
505 # endif
506 #endif
507 _GL_CXXALIASWARN (mkdir);
508
509
510 #if @GNULIB_MKDIRAT@
511 # if !@HAVE_MKDIRAT@
512 _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
513                                 _GL_ARG_NONNULL ((2)));
514 # endif
515 _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
516 _GL_CXXALIASWARN (mkdirat);
517 #elif defined GNULIB_POSIXCHECK
518 # undef mkdirat
519 # if HAVE_RAW_DECL_MKDIRAT
520 _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
521                  "use gnulib module openat for portability");
522 # endif
523 #endif
524
525
526 #if @GNULIB_MKFIFO@
527 # if @REPLACE_MKFIFO@
528 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
529 #   undef mkfifo
530 #   define mkfifo rpl_mkfifo
531 #  endif
532 _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
533                                _GL_ARG_NONNULL ((1)));
534 _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
535 # else
536 #  if !@HAVE_MKFIFO@
537 _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
538                                _GL_ARG_NONNULL ((1)));
539 #  endif
540 _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
541 # endif
542 _GL_CXXALIASWARN (mkfifo);
543 #elif defined GNULIB_POSIXCHECK
544 # undef mkfifo
545 # if HAVE_RAW_DECL_MKFIFO
546 _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
547                  "use gnulib module mkfifo for portability");
548 # endif
549 #endif
550
551
552 #if @GNULIB_MKFIFOAT@
553 # if !@HAVE_MKFIFOAT@
554 _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
555                                  _GL_ARG_NONNULL ((2)));
556 # endif
557 _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
558 _GL_CXXALIASWARN (mkfifoat);
559 #elif defined GNULIB_POSIXCHECK
560 # undef mkfifoat
561 # if HAVE_RAW_DECL_MKFIFOAT
562 _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
563                  "use gnulib module mkfifoat for portability");
564 # endif
565 #endif
566
567
568 #if @GNULIB_MKNOD@
569 # if @REPLACE_MKNOD@
570 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
571 #   undef mknod
572 #   define mknod rpl_mknod
573 #  endif
574 _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
575                               _GL_ARG_NONNULL ((1)));
576 _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
577 # else
578 #  if !@HAVE_MKNOD@
579 _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
580                               _GL_ARG_NONNULL ((1)));
581 #  endif
582 /* Need to cast, because on OSF/1 5.1, the third parameter is '...'.  */
583 _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
584 # endif
585 _GL_CXXALIASWARN (mknod);
586 #elif defined GNULIB_POSIXCHECK
587 # undef mknod
588 # if HAVE_RAW_DECL_MKNOD
589 _GL_WARN_ON_USE (mknod, "mknod is not portable - "
590                  "use gnulib module mknod for portability");
591 # endif
592 #endif
593
594
595 #if @GNULIB_MKNODAT@
596 # if !@HAVE_MKNODAT@
597 _GL_FUNCDECL_SYS (mknodat, int,
598                   (int fd, char const *file, mode_t mode, dev_t dev)
599                   _GL_ARG_NONNULL ((2)));
600 # endif
601 _GL_CXXALIAS_SYS (mknodat, int,
602                   (int fd, char const *file, mode_t mode, dev_t dev));
603 _GL_CXXALIASWARN (mknodat);
604 #elif defined GNULIB_POSIXCHECK
605 # undef mknodat
606 # if HAVE_RAW_DECL_MKNODAT
607 _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
608                  "use gnulib module mkfifoat for portability");
609 # endif
610 #endif
611
612
613 #if @GNULIB_STAT@
614 # if @REPLACE_STAT@
615 /* We can't use the object-like #define stat rpl_stat, because of
616    struct stat.  This means that rpl_stat will not be used if the user
617    does (stat)(a,b).  Oh well.  */
618 #  if defined _AIX && defined stat && defined _LARGE_FILES
619     /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
620        so we have to replace stat64() instead of stat(). */
621 #   undef stat64
622 #   define stat64(name, st) rpl_stat (name, st)
623 #  elif defined __MINGW32__ && defined stat
624 #   ifdef _USE_32BIT_TIME_T
625      /* The system headers define stat to _stat32i64.  */
626 #    undef _stat32i64
627 #    define _stat32i64(name, st) rpl_stat (name, st)
628 #   else
629      /* The system headers define stat to _stat64.  */
630 #    undef _stat64
631 #    define _stat64(name, st) rpl_stat (name, st)
632 #   endif
633 #  elif defined _MSC_VER && defined stat
634 #   ifdef _USE_32BIT_TIME_T
635      /* The system headers define stat to _stat32.  */
636 #    undef _stat32
637 #    define _stat32(name, st) rpl_stat (name, st)
638 #   else
639      /* The system headers define stat to _stat64i32.  */
640 #    undef _stat64i32
641 #    define _stat64i32(name, st) rpl_stat (name, st)
642 #   endif
643 #  else /* !(_AIX ||__MINGW32__ ||  _MSC_VER) */
644 #   undef stat
645 #   define stat(name, st) rpl_stat (name, st)
646 #  endif /* !_LARGE_FILES */
647 _GL_EXTERN_C int stat (const char *name, struct stat *buf)
648                       _GL_ARG_NONNULL ((1, 2));
649 # endif
650 #elif defined GNULIB_POSIXCHECK
651 # undef stat
652 # if HAVE_RAW_DECL_STAT
653 _GL_WARN_ON_USE (stat, "stat is unportable - "
654                  "use gnulib module stat for portability");
655 # endif
656 #endif
657
658
659 #if @GNULIB_UTIMENSAT@
660 /* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat
661    implementation relies on futimesat, which on Solaris 10 makes an invocation
662    to utimensat that is meant to invoke the libc's utimensat(), not gnulib's
663    utimensat().  */
664 # if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun)
665 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
666 #   undef utimensat
667 #   define utimensat rpl_utimensat
668 #  endif
669 _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
670                                    struct timespec const times[2], int flag)
671                                   _GL_ARG_NONNULL ((2)));
672 _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
673                                    struct timespec const times[2], int flag));
674 # else
675 #  if !@HAVE_UTIMENSAT@
676 _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
677                                    struct timespec const times[2], int flag)
678                                   _GL_ARG_NONNULL ((2)));
679 #  endif
680 _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
681                                    struct timespec const times[2], int flag));
682 # endif
683 # if @HAVE_UTIMENSAT@
684 _GL_CXXALIASWARN (utimensat);
685 # endif
686 #elif defined GNULIB_POSIXCHECK
687 # undef utimensat
688 # if HAVE_RAW_DECL_UTIMENSAT
689 _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
690                  "use gnulib module utimensat for portability");
691 # endif
692 #endif
693
694
695 #endif /* _@GUARD_PREFIX@_SYS_STAT_H */
696 #endif /* _@GUARD_PREFIX@_SYS_STAT_H */
697 #endif