00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #if __GNUC__ >= 3
00027 @PRAGMA_SYSTEM_HEADER@
00028 #endif
00029 @PRAGMA_COLUMNS@
00030
00031 #if defined __need_system_sys_stat_h
00032
00033
00034 #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
00035
00036 #else
00037
00038
00039 #ifndef _GL_SYS_STAT_H
00040
00041
00042 #include <sys/types.h>
00043
00044
00045 #include <time.h>
00046
00047
00048 #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
00049
00050 #ifndef _GL_SYS_STAT_H
00051 #define _GL_SYS_STAT_H
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
00062 # include <io.h>
00063 # include <direct.h>
00064 #endif
00065
00066 #ifndef S_IFMT
00067 # define S_IFMT 0170000
00068 #endif
00069
00070 #if STAT_MACROS_BROKEN
00071 # undef S_ISBLK
00072 # undef S_ISCHR
00073 # undef S_ISDIR
00074 # undef S_ISFIFO
00075 # undef S_ISLNK
00076 # undef S_ISNAM
00077 # undef S_ISMPB
00078 # undef S_ISMPC
00079 # undef S_ISNWK
00080 # undef S_ISREG
00081 # undef S_ISSOCK
00082 #endif
00083
00084 #ifndef S_ISBLK
00085 # ifdef S_IFBLK
00086 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
00087 # else
00088 # define S_ISBLK(m) 0
00089 # endif
00090 #endif
00091
00092 #ifndef S_ISCHR
00093 # ifdef S_IFCHR
00094 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
00095 # else
00096 # define S_ISCHR(m) 0
00097 # endif
00098 #endif
00099
00100 #ifndef S_ISDIR
00101 # ifdef S_IFDIR
00102 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
00103 # else
00104 # define S_ISDIR(m) 0
00105 # endif
00106 #endif
00107
00108 #ifndef S_ISDOOR
00109 # define S_ISDOOR(m) 0
00110 #endif
00111
00112 #ifndef S_ISFIFO
00113 # ifdef S_IFIFO
00114 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
00115 # else
00116 # define S_ISFIFO(m) 0
00117 # endif
00118 #endif
00119
00120 #ifndef S_ISLNK
00121 # ifdef S_IFLNK
00122 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
00123 # else
00124 # define S_ISLNK(m) 0
00125 # endif
00126 #endif
00127
00128 #ifndef S_ISMPB
00129 # ifdef S_IFMPB
00130 # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
00131 # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
00132 # else
00133 # define S_ISMPB(m) 0
00134 # define S_ISMPC(m) 0
00135 # endif
00136 #endif
00137
00138 #ifndef S_ISNAM
00139 # ifdef S_IFNAM
00140 # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
00141 # else
00142 # define S_ISNAM(m) 0
00143 # endif
00144 #endif
00145
00146 #ifndef S_ISNWK
00147 # ifdef S_IFNWK
00148 # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
00149 # else
00150 # define S_ISNWK(m) 0
00151 # endif
00152 #endif
00153
00154 #ifndef S_ISPORT
00155 # define S_ISPORT(m) 0
00156 #endif
00157
00158 #ifndef S_ISREG
00159 # ifdef S_IFREG
00160 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
00161 # else
00162 # define S_ISREG(m) 0
00163 # endif
00164 #endif
00165
00166 #ifndef S_ISSOCK
00167 # ifdef S_IFSOCK
00168 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
00169 # else
00170 # define S_ISSOCK(m) 0
00171 # endif
00172 #endif
00173
00174
00175 #ifndef S_TYPEISMQ
00176 # define S_TYPEISMQ(p) 0
00177 #endif
00178
00179 #ifndef S_TYPEISTMO
00180 # define S_TYPEISTMO(p) 0
00181 #endif
00182
00183
00184 #ifndef S_TYPEISSEM
00185 # ifdef S_INSEM
00186 # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
00187 # else
00188 # define S_TYPEISSEM(p) 0
00189 # endif
00190 #endif
00191
00192 #ifndef S_TYPEISSHM
00193 # ifdef S_INSHD
00194 # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
00195 # else
00196 # define S_TYPEISSHM(p) 0
00197 # endif
00198 #endif
00199
00200
00201 #ifndef S_ISCTG
00202 # define S_ISCTG(p) 0
00203 #endif
00204
00205
00206 #ifndef S_ISOFD
00207 # define S_ISOFD(p) 0
00208 #endif
00209
00210
00211 #ifndef S_ISOFL
00212 # define S_ISOFL(p) 0
00213 #endif
00214
00215
00216 #ifndef S_ISWHT
00217 # define S_ISWHT(m) 0
00218 #endif
00219
00220
00221
00222 #if !S_ISUID
00223 # define S_ISUID 04000
00224 #endif
00225 #if !S_ISGID
00226 # define S_ISGID 02000
00227 #endif
00228
00229
00230 #ifndef S_ISVTX
00231 # define S_ISVTX 01000
00232 #endif
00233
00234 #if !S_IRUSR && S_IREAD
00235 # define S_IRUSR S_IREAD
00236 #endif
00237 #if !S_IRUSR
00238 # define S_IRUSR 00400
00239 #endif
00240 #if !S_IRGRP
00241 # define S_IRGRP (S_IRUSR >> 3)
00242 #endif
00243 #if !S_IROTH
00244 # define S_IROTH (S_IRUSR >> 6)
00245 #endif
00246
00247 #if !S_IWUSR && S_IWRITE
00248 # define S_IWUSR S_IWRITE
00249 #endif
00250 #if !S_IWUSR
00251 # define S_IWUSR 00200
00252 #endif
00253 #if !S_IWGRP
00254 # define S_IWGRP (S_IWUSR >> 3)
00255 #endif
00256 #if !S_IWOTH
00257 # define S_IWOTH (S_IWUSR >> 6)
00258 #endif
00259
00260 #if !S_IXUSR && S_IEXEC
00261 # define S_IXUSR S_IEXEC
00262 #endif
00263 #if !S_IXUSR
00264 # define S_IXUSR 00100
00265 #endif
00266 #if !S_IXGRP
00267 # define S_IXGRP (S_IXUSR >> 3)
00268 #endif
00269 #if !S_IXOTH
00270 # define S_IXOTH (S_IXUSR >> 6)
00271 #endif
00272
00273 #if !S_IRWXU
00274 # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
00275 #endif
00276 #if !S_IRWXG
00277 # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
00278 #endif
00279 #if !S_IRWXO
00280 # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
00281 #endif
00282
00283
00284 #if !S_IXUGO
00285 # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
00286 #endif
00287
00288 #ifndef S_IRWXUGO
00289 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
00290 #endif
00291
00292
00293 #ifndef UTIME_NOW
00294 # define UTIME_NOW (-1)
00295 # define UTIME_OMIT (-2)
00296 #endif
00297
00298
00299 #if @GNULIB_FCHMODAT@
00300 # if !@HAVE_FCHMODAT@
00301 _GL_FUNCDECL_SYS (fchmodat, int,
00302 (int fd, char const *file, mode_t mode, int flag)
00303 _GL_ARG_NONNULL ((2)));
00304 # endif
00305 _GL_CXXALIAS_SYS (fchmodat, int,
00306 (int fd, char const *file, mode_t mode, int flag));
00307 _GL_CXXALIASWARN (fchmodat);
00308 #elif defined GNULIB_POSIXCHECK
00309 # undef fchmodat
00310 # if HAVE_RAW_DECL_FCHMODAT
00311 _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
00312 "use gnulib module openat for portability");
00313 # endif
00314 #endif
00315
00316
00317 #if @REPLACE_FSTAT@
00318 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00319 # define fstat rpl_fstat
00320 # endif
00321 _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
00322 _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
00323 #else
00324 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
00325 #endif
00326 _GL_CXXALIASWARN (fstat);
00327
00328
00329 #if @GNULIB_FSTATAT@
00330 # if @REPLACE_FSTATAT@
00331 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00332 # undef fstatat
00333 # define fstatat rpl_fstatat
00334 # endif
00335 _GL_FUNCDECL_RPL (fstatat, int,
00336 (int fd, char const *name, struct stat *st, int flags)
00337 _GL_ARG_NONNULL ((2, 3)));
00338 _GL_CXXALIAS_RPL (fstatat, int,
00339 (int fd, char const *name, struct stat *st, int flags));
00340 # else
00341 # if !@HAVE_FSTATAT@
00342 _GL_FUNCDECL_SYS (fstatat, int,
00343 (int fd, char const *name, struct stat *st, int flags)
00344 _GL_ARG_NONNULL ((2, 3)));
00345 # endif
00346 _GL_CXXALIAS_SYS (fstatat, int,
00347 (int fd, char const *name, struct stat *st, int flags));
00348 # endif
00349 _GL_CXXALIASWARN (fstatat);
00350 #elif defined GNULIB_POSIXCHECK
00351 # undef fstatat
00352 # if HAVE_RAW_DECL_FSTATAT
00353 _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
00354 "use gnulib module openat for portability");
00355 # endif
00356 #endif
00357
00358
00359 #if @GNULIB_FUTIMENS@
00360 # if @REPLACE_FUTIMENS@
00361 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00362 # undef futimens
00363 # define futimens rpl_futimens
00364 # endif
00365 _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
00366 _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
00367 # else
00368 # if !@HAVE_FUTIMENS@
00369 _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
00370 # endif
00371 _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
00372 # endif
00373 _GL_CXXALIASWARN (futimens);
00374 #elif defined GNULIB_POSIXCHECK
00375 # undef futimens
00376 # if HAVE_RAW_DECL_FUTIMENS
00377 _GL_WARN_ON_USE (futimens, "futimens is not portable - "
00378 "use gnulib module futimens for portability");
00379 # endif
00380 #endif
00381
00382
00383 #if @GNULIB_LCHMOD@
00384
00385
00386 # if !@HAVE_LCHMOD@
00387
00388
00389
00390
00391
00392
00393
00394 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00395 # define lchmod chmod
00396 # endif
00397
00398
00399 _GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
00400 (const char *filename, mode_t mode));
00401 # else
00402 # if 0
00403 _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
00404 _GL_ARG_NONNULL ((1)));
00405 # endif
00406 _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
00407 # endif
00408 # if @HAVE_LCHMOD@
00409 _GL_CXXALIASWARN (lchmod);
00410 # endif
00411 #elif defined GNULIB_POSIXCHECK
00412 # undef lchmod
00413 # if HAVE_RAW_DECL_LCHMOD
00414 _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
00415 "use gnulib module lchmod for portability");
00416 # endif
00417 #endif
00418
00419
00420 #if @GNULIB_LSTAT@
00421 # if ! @HAVE_LSTAT@
00422
00423
00424 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00425 # define lstat stat
00426 # endif
00427 _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
00428 # elif @REPLACE_LSTAT@
00429 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00430 # undef lstat
00431 # define lstat rpl_lstat
00432 # endif
00433 _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
00434 _GL_ARG_NONNULL ((1, 2)));
00435 _GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
00436 # else
00437 _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
00438 # endif
00439 # if @HAVE_LSTAT@
00440 _GL_CXXALIASWARN (lstat);
00441 # endif
00442 #elif defined GNULIB_POSIXCHECK
00443 # undef lstat
00444 # if HAVE_RAW_DECL_LSTAT
00445 _GL_WARN_ON_USE (lstat, "lstat is unportable - "
00446 "use gnulib module lstat for portability");
00447 # endif
00448 #endif
00449
00450
00451 #if @REPLACE_MKDIR@
00452 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00453 # undef mkdir
00454 # define mkdir rpl_mkdir
00455 # endif
00456 _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
00457 _GL_ARG_NONNULL ((1)));
00458 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
00459 #else
00460
00461
00462
00463
00464 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
00465
00466 # if !GNULIB_defined_rpl_mkdir
00467 static inline int
00468 rpl_mkdir (char const *name, mode_t mode)
00469 {
00470 return _mkdir (name);
00471 }
00472 # define GNULIB_defined_rpl_mkdir 1
00473 # endif
00474
00475 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00476 # define mkdir rpl_mkdir
00477 # endif
00478 _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
00479 # else
00480 _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
00481 # endif
00482 #endif
00483 _GL_CXXALIASWARN (mkdir);
00484
00485
00486 #if @GNULIB_MKDIRAT@
00487 # if !@HAVE_MKDIRAT@
00488 _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
00489 _GL_ARG_NONNULL ((2)));
00490 # endif
00491 _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
00492 _GL_CXXALIASWARN (mkdirat);
00493 #elif defined GNULIB_POSIXCHECK
00494 # undef mkdirat
00495 # if HAVE_RAW_DECL_MKDIRAT
00496 _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
00497 "use gnulib module openat for portability");
00498 # endif
00499 #endif
00500
00501
00502 #if @GNULIB_MKFIFO@
00503 # if @REPLACE_MKFIFO@
00504 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00505 # undef mkfifo
00506 # define mkfifo rpl_mkfifo
00507 # endif
00508 _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
00509 _GL_ARG_NONNULL ((1)));
00510 _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
00511 # else
00512 # if !@HAVE_MKFIFO@
00513 _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
00514 _GL_ARG_NONNULL ((1)));
00515 # endif
00516 _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
00517 # endif
00518 _GL_CXXALIASWARN (mkfifo);
00519 #elif defined GNULIB_POSIXCHECK
00520 # undef mkfifo
00521 # if HAVE_RAW_DECL_MKFIFO
00522 _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
00523 "use gnulib module mkfifo for portability");
00524 # endif
00525 #endif
00526
00527
00528 #if @GNULIB_MKFIFOAT@
00529 # if !@HAVE_MKFIFOAT@
00530 _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
00531 _GL_ARG_NONNULL ((2)));
00532 # endif
00533 _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
00534 _GL_CXXALIASWARN (mkfifoat);
00535 #elif defined GNULIB_POSIXCHECK
00536 # undef mkfifoat
00537 # if HAVE_RAW_DECL_MKFIFOAT
00538 _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
00539 "use gnulib module mkfifoat for portability");
00540 # endif
00541 #endif
00542
00543
00544 #if @GNULIB_MKNOD@
00545 # if @REPLACE_MKNOD@
00546 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00547 # undef mknod
00548 # define mknod rpl_mknod
00549 # endif
00550 _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
00551 _GL_ARG_NONNULL ((1)));
00552 _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
00553 # else
00554 # if !@HAVE_MKNOD@
00555 _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
00556 _GL_ARG_NONNULL ((1)));
00557 # endif
00558
00559 _GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev));
00560 # endif
00561 _GL_CXXALIASWARN (mknod);
00562 #elif defined GNULIB_POSIXCHECK
00563 # undef mknod
00564 # if HAVE_RAW_DECL_MKNOD
00565 _GL_WARN_ON_USE (mknod, "mknod is not portable - "
00566 "use gnulib module mknod for portability");
00567 # endif
00568 #endif
00569
00570
00571 #if @GNULIB_MKNODAT@
00572 # if !@HAVE_MKNODAT@
00573 _GL_FUNCDECL_SYS (mknodat, int,
00574 (int fd, char const *file, mode_t mode, dev_t dev)
00575 _GL_ARG_NONNULL ((2)));
00576 # endif
00577 _GL_CXXALIAS_SYS (mknodat, int,
00578 (int fd, char const *file, mode_t mode, dev_t dev));
00579 _GL_CXXALIASWARN (mknodat);
00580 #elif defined GNULIB_POSIXCHECK
00581 # undef mknodat
00582 # if HAVE_RAW_DECL_MKNODAT
00583 _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
00584 "use gnulib module mkfifoat for portability");
00585 # endif
00586 #endif
00587
00588
00589 #if @GNULIB_STAT@
00590 # if @REPLACE_STAT@
00591
00592
00593
00594 # undef stat
00595 # ifdef _LARGE_FILES
00596
00597
00598 # define stat stat64
00599 # undef stat64
00600 # define stat64(name, st) rpl_stat (name, st)
00601 # else
00602 # define stat(name, st) rpl_stat (name, st)
00603 # endif
00604 _GL_EXTERN_C int stat (const char *name, struct stat *buf)
00605 _GL_ARG_NONNULL ((1, 2));
00606 # endif
00607 #elif defined GNULIB_POSIXCHECK
00608 # undef stat
00609 # if HAVE_RAW_DECL_STAT
00610 _GL_WARN_ON_USE (stat, "stat is unportable - "
00611 "use gnulib module stat for portability");
00612 # endif
00613 #endif
00614
00615
00616 #if @GNULIB_UTIMENSAT@
00617 # if @REPLACE_UTIMENSAT@
00618 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
00619 # undef utimensat
00620 # define utimensat rpl_utimensat
00621 # endif
00622 _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
00623 struct timespec const times[2], int flag)
00624 _GL_ARG_NONNULL ((2)));
00625 _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
00626 struct timespec const times[2], int flag));
00627 # else
00628 # if !@HAVE_UTIMENSAT@
00629 _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
00630 struct timespec const times[2], int flag)
00631 _GL_ARG_NONNULL ((2)));
00632 # endif
00633 _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
00634 struct timespec const times[2], int flag));
00635 # endif
00636 _GL_CXXALIASWARN (utimensat);
00637 #elif defined GNULIB_POSIXCHECK
00638 # undef utimensat
00639 # if HAVE_RAW_DECL_UTIMENSAT
00640 _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
00641 "use gnulib module utimensat for portability");
00642 # endif
00643 #endif
00644
00645
00646 #endif
00647 #endif
00648 #endif