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