sys_stat.in.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. /* Provide a more complete sys/stat header file.
  2. Copyright (C) 2005-2010 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  14. /* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
  15. /* This file is supposed to be used on platforms where <sys/stat.h> is
  16. incomplete. It is intended to provide definitions and prototypes
  17. needed by an application. Start with what the system provides. */
  18. #if __GNUC__ >= 3
  19. @PRAGMA_SYSTEM_HEADER@
  20. #endif
  21. #if defined __need_system_sys_stat_h
  22. /* Special invocation convention. */
  23. #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
  24. #else
  25. /* Normal invocation convention. */
  26. #ifndef _GL_SYS_STAT_H
  27. /* Get nlink_t. */
  28. #include <sys/types.h>
  29. /* Get struct timespec. */
  30. #include <time.h>
  31. /* The include_next requires a split double-inclusion guard. */
  32. #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
  33. #ifndef _GL_SYS_STAT_H
  34. #define _GL_SYS_STAT_H
  35. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  36. /* The definition of _GL_ARG_NONNULL is copied here. */
  37. /* The definition of _GL_WARN_ON_USE is copied here. */
  38. /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
  39. headers that may declare mkdir(). */
  40. #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
  41. # include <io.h> /* mingw32, mingw64 */
  42. # include <direct.h> /* mingw64 */
  43. #endif
  44. #ifndef S_IFMT
  45. # define S_IFMT 0170000
  46. #endif
  47. #if STAT_MACROS_BROKEN
  48. # undef S_ISBLK
  49. # undef S_ISCHR
  50. # undef S_ISDIR
  51. # undef S_ISFIFO
  52. # undef S_ISLNK
  53. # undef S_ISNAM
  54. # undef S_ISMPB
  55. # undef S_ISMPC
  56. # undef S_ISNWK
  57. # undef S_ISREG
  58. # undef S_ISSOCK
  59. #endif
  60. #ifndef S_ISBLK
  61. # ifdef S_IFBLK
  62. # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
  63. # else
  64. # define S_ISBLK(m) 0
  65. # endif
  66. #endif
  67. #ifndef S_ISCHR
  68. # ifdef S_IFCHR
  69. # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
  70. # else
  71. # define S_ISCHR(m) 0
  72. # endif
  73. #endif
  74. #ifndef S_ISDIR
  75. # ifdef S_IFDIR
  76. # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  77. # else
  78. # define S_ISDIR(m) 0
  79. # endif
  80. #endif
  81. #ifndef S_ISDOOR /* Solaris 2.5 and up */
  82. # define S_ISDOOR(m) 0
  83. #endif
  84. #ifndef S_ISFIFO
  85. # ifdef S_IFIFO
  86. # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
  87. # else
  88. # define S_ISFIFO(m) 0
  89. # endif
  90. #endif
  91. #ifndef S_ISLNK
  92. # ifdef S_IFLNK
  93. # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
  94. # else
  95. # define S_ISLNK(m) 0
  96. # endif
  97. #endif
  98. #ifndef S_ISMPB /* V7 */
  99. # ifdef S_IFMPB
  100. # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
  101. # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
  102. # else
  103. # define S_ISMPB(m) 0
  104. # define S_ISMPC(m) 0
  105. # endif
  106. #endif
  107. #ifndef S_ISNAM /* Xenix */
  108. # ifdef S_IFNAM
  109. # define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
  110. # else
  111. # define S_ISNAM(m) 0
  112. # endif
  113. #endif
  114. #ifndef S_ISNWK /* HP/UX */
  115. # ifdef S_IFNWK
  116. # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
  117. # else
  118. # define S_ISNWK(m) 0
  119. # endif
  120. #endif
  121. #ifndef S_ISPORT /* Solaris 10 and up */
  122. # define S_ISPORT(m) 0
  123. #endif
  124. #ifndef S_ISREG
  125. # ifdef S_IFREG
  126. # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
  127. # else
  128. # define S_ISREG(m) 0
  129. # endif
  130. #endif
  131. #ifndef S_ISSOCK
  132. # ifdef S_IFSOCK
  133. # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
  134. # else
  135. # define S_ISSOCK(m) 0
  136. # endif
  137. #endif
  138. #ifndef S_TYPEISMQ
  139. # define S_TYPEISMQ(p) 0
  140. #endif
  141. #ifndef S_TYPEISTMO
  142. # define S_TYPEISTMO(p) 0
  143. #endif
  144. #ifndef S_TYPEISSEM
  145. # ifdef S_INSEM
  146. # define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
  147. # else
  148. # define S_TYPEISSEM(p) 0
  149. # endif
  150. #endif
  151. #ifndef S_TYPEISSHM
  152. # ifdef S_INSHD
  153. # define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
  154. # else
  155. # define S_TYPEISSHM(p) 0
  156. # endif
  157. #endif
  158. /* high performance ("contiguous data") */
  159. #ifndef S_ISCTG
  160. # define S_ISCTG(p) 0
  161. #endif
  162. /* Cray DMF (data migration facility): off line, with data */
  163. #ifndef S_ISOFD
  164. # define S_ISOFD(p) 0
  165. #endif
  166. /* Cray DMF (data migration facility): off line, with no data */
  167. #ifndef S_ISOFL
  168. # define S_ISOFL(p) 0
  169. #endif
  170. /* 4.4BSD whiteout */
  171. #ifndef S_ISWHT
  172. # define S_ISWHT(m) 0
  173. #endif
  174. /* If any of the following are undefined,
  175. define them to their de facto standard values. */
  176. #if !S_ISUID
  177. # define S_ISUID 04000
  178. #endif
  179. #if !S_ISGID
  180. # define S_ISGID 02000
  181. #endif
  182. /* S_ISVTX is a common extension to POSIX. */
  183. #ifndef S_ISVTX
  184. # define S_ISVTX 01000
  185. #endif
  186. #if !S_IRUSR && S_IREAD
  187. # define S_IRUSR S_IREAD
  188. #endif
  189. #if !S_IRUSR
  190. # define S_IRUSR 00400
  191. #endif
  192. #if !S_IRGRP
  193. # define S_IRGRP (S_IRUSR >> 3)
  194. #endif
  195. #if !S_IROTH
  196. # define S_IROTH (S_IRUSR >> 6)
  197. #endif
  198. #if !S_IWUSR && S_IWRITE
  199. # define S_IWUSR S_IWRITE
  200. #endif
  201. #if !S_IWUSR
  202. # define S_IWUSR 00200
  203. #endif
  204. #if !S_IWGRP
  205. # define S_IWGRP (S_IWUSR >> 3)
  206. #endif
  207. #if !S_IWOTH
  208. # define S_IWOTH (S_IWUSR >> 6)
  209. #endif
  210. #if !S_IXUSR && S_IEXEC
  211. # define S_IXUSR S_IEXEC
  212. #endif
  213. #if !S_IXUSR
  214. # define S_IXUSR 00100
  215. #endif
  216. #if !S_IXGRP
  217. # define S_IXGRP (S_IXUSR >> 3)
  218. #endif
  219. #if !S_IXOTH
  220. # define S_IXOTH (S_IXUSR >> 6)
  221. #endif
  222. #if !S_IRWXU
  223. # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
  224. #endif
  225. #if !S_IRWXG
  226. # define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
  227. #endif
  228. #if !S_IRWXO
  229. # define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
  230. #endif
  231. /* S_IXUGO is a common extension to POSIX. */
  232. #if !S_IXUGO
  233. # define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
  234. #endif
  235. #ifndef S_IRWXUGO
  236. # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
  237. #endif
  238. /* Macros for futimens and utimensat. */
  239. #ifndef UTIME_NOW
  240. # define UTIME_NOW (-1)
  241. # define UTIME_OMIT (-2)
  242. #endif
  243. #if @GNULIB_FCHMODAT@
  244. # if !@HAVE_FCHMODAT@
  245. _GL_FUNCDECL_SYS (fchmodat, int,
  246. (int fd, char const *file, mode_t mode, int flag)
  247. _GL_ARG_NONNULL ((2)));
  248. # endif
  249. _GL_CXXALIAS_SYS (fchmodat, int,
  250. (int fd, char const *file, mode_t mode, int flag));
  251. _GL_CXXALIASWARN (fchmodat);
  252. #elif defined GNULIB_POSIXCHECK
  253. # undef fchmodat
  254. # if HAVE_RAW_DECL_FCHMODAT
  255. _GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - "
  256. "use gnulib module openat for portability");
  257. # endif
  258. #endif
  259. #if @REPLACE_FSTAT@
  260. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  261. # define fstat rpl_fstat
  262. # endif
  263. _GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2)));
  264. _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
  265. #else
  266. _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
  267. #endif
  268. _GL_CXXALIASWARN (fstat);
  269. #if @GNULIB_FSTATAT@
  270. # if @REPLACE_FSTATAT@
  271. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  272. # undef fstatat
  273. # define fstatat rpl_fstatat
  274. # endif
  275. _GL_FUNCDECL_RPL (fstatat, int,
  276. (int fd, char const *name, struct stat *st, int flags)
  277. _GL_ARG_NONNULL ((2, 3)));
  278. _GL_CXXALIAS_RPL (fstatat, int,
  279. (int fd, char const *name, struct stat *st, int flags));
  280. # else
  281. # if !@HAVE_FSTATAT@
  282. _GL_FUNCDECL_SYS (fstatat, int,
  283. (int fd, char const *name, struct stat *st, int flags)
  284. _GL_ARG_NONNULL ((2, 3)));
  285. # endif
  286. _GL_CXXALIAS_SYS (fstatat, int,
  287. (int fd, char const *name, struct stat *st, int flags));
  288. # endif
  289. _GL_CXXALIASWARN (fstatat);
  290. #elif defined GNULIB_POSIXCHECK
  291. # undef fstatat
  292. # if HAVE_RAW_DECL_FSTATAT
  293. _GL_WARN_ON_USE (fstatat, "fstatat is not portable - "
  294. "use gnulib module openat for portability");
  295. # endif
  296. #endif
  297. #if @GNULIB_FUTIMENS@
  298. # if @REPLACE_FUTIMENS@
  299. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  300. # undef futimens
  301. # define futimens rpl_futimens
  302. # endif
  303. _GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2]));
  304. _GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2]));
  305. # else
  306. # if !@HAVE_FUTIMENS@
  307. _GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2]));
  308. # endif
  309. _GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2]));
  310. # endif
  311. _GL_CXXALIASWARN (futimens);
  312. #elif defined GNULIB_POSIXCHECK
  313. # undef futimens
  314. # if HAVE_RAW_DECL_FUTIMENS
  315. _GL_WARN_ON_USE (futimens, "futimens is not portable - "
  316. "use gnulib module futimens for portability");
  317. # endif
  318. #endif
  319. #if @GNULIB_LCHMOD@
  320. /* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
  321. denotes a symbolic link. */
  322. # if !@HAVE_LCHMOD@
  323. /* The lchmod replacement follows symbolic links. Callers should take
  324. this into account; lchmod should be applied only to arguments that
  325. are known to not be symbolic links. On hosts that lack lchmod,
  326. this can lead to race conditions between the check and the
  327. invocation of lchmod, but we know of no workarounds that are
  328. reliable in general. You might try requesting support for lchmod
  329. from your operating system supplier. */
  330. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  331. # define lchmod chmod
  332. # endif
  333. /* Need to cast, because on mingw, the second parameter of chmod is
  334. int mode. */
  335. _GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int,
  336. (const char *filename, mode_t mode));
  337. # else
  338. # if 0 /* assume already declared */
  339. _GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode)
  340. _GL_ARG_NONNULL ((1)));
  341. # endif
  342. _GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode));
  343. # endif
  344. # if @HAVE_LCHMOD@
  345. _GL_CXXALIASWARN (lchmod);
  346. # endif
  347. #elif defined GNULIB_POSIXCHECK
  348. # undef lchmod
  349. # if HAVE_RAW_DECL_LCHMOD
  350. _GL_WARN_ON_USE (lchmod, "lchmod is unportable - "
  351. "use gnulib module lchmod for portability");
  352. # endif
  353. #endif
  354. #if @GNULIB_LSTAT@
  355. # if ! @HAVE_LSTAT@
  356. /* mingw does not support symlinks, therefore it does not have lstat. But
  357. without links, stat does just fine. */
  358. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  359. # define lstat stat
  360. # endif
  361. _GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf));
  362. # elif @REPLACE_LSTAT@
  363. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  364. # undef lstat
  365. # define lstat rpl_lstat
  366. # endif
  367. _GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf)
  368. _GL_ARG_NONNULL ((1, 2)));
  369. _GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf));
  370. # else
  371. _GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf));
  372. # endif
  373. # if @HAVE_LSTAT@
  374. _GL_CXXALIASWARN (lstat);
  375. # endif
  376. #elif defined GNULIB_POSIXCHECK
  377. # undef lstat
  378. # if HAVE_RAW_DECL_LSTAT
  379. _GL_WARN_ON_USE (lstat, "lstat is unportable - "
  380. "use gnulib module lstat for portability");
  381. # endif
  382. #endif
  383. #if @REPLACE_MKDIR@
  384. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  385. # undef mkdir
  386. # define mkdir rpl_mkdir
  387. # endif
  388. _GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode)
  389. _GL_ARG_NONNULL ((1)));
  390. _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
  391. #else
  392. /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
  393. Additionally, it declares _mkdir (and depending on compile flags, an
  394. alias mkdir), only in the nonstandard includes <direct.h> and <io.h>,
  395. which are included above. */
  396. # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
  397. static inline int
  398. rpl_mkdir (char const *name, mode_t mode)
  399. {
  400. return _mkdir (name);
  401. }
  402. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  403. # define mkdir rpl_mkdir
  404. # endif
  405. _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode));
  406. # else
  407. _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode));
  408. # endif
  409. #endif
  410. _GL_CXXALIASWARN (mkdir);
  411. #if @GNULIB_MKDIRAT@
  412. # if !@HAVE_MKDIRAT@
  413. _GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)
  414. _GL_ARG_NONNULL ((2)));
  415. # endif
  416. _GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode));
  417. _GL_CXXALIASWARN (mkdirat);
  418. #elif defined GNULIB_POSIXCHECK
  419. # undef mkdirat
  420. # if HAVE_RAW_DECL_MKDIRAT
  421. _GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - "
  422. "use gnulib module openat for portability");
  423. # endif
  424. #endif
  425. #if @GNULIB_MKFIFO@
  426. # if @REPLACE_MKFIFO@
  427. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  428. # undef mkfifo
  429. # define mkfifo rpl_mkfifo
  430. # endif
  431. _GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode)
  432. _GL_ARG_NONNULL ((1)));
  433. _GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode));
  434. # else
  435. # if !@HAVE_MKFIFO@
  436. _GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode)
  437. _GL_ARG_NONNULL ((1)));
  438. # endif
  439. _GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode));
  440. # endif
  441. _GL_CXXALIASWARN (mkfifo);
  442. #elif defined GNULIB_POSIXCHECK
  443. # undef mkfifo
  444. # if HAVE_RAW_DECL_MKFIFO
  445. _GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - "
  446. "use gnulib module mkfifo for portability");
  447. # endif
  448. #endif
  449. #if @GNULIB_MKFIFOAT@
  450. # if !@HAVE_MKFIFOAT@
  451. _GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)
  452. _GL_ARG_NONNULL ((2)));
  453. # endif
  454. _GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode));
  455. _GL_CXXALIASWARN (mkfifoat);
  456. #elif defined GNULIB_POSIXCHECK
  457. # undef mkfifoat
  458. # if HAVE_RAW_DECL_MKFIFOAT
  459. _GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - "
  460. "use gnulib module mkfifoat for portability");
  461. # endif
  462. #endif
  463. #if @GNULIB_MKNOD@
  464. # if @REPLACE_MKNOD@
  465. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  466. # undef mknod
  467. # define mknod rpl_mknod
  468. # endif
  469. _GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)
  470. _GL_ARG_NONNULL ((1)));
  471. _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev));
  472. # else
  473. # if !@HAVE_MKNOD@
  474. _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)
  475. _GL_ARG_NONNULL ((1)));
  476. # endif
  477. _GL_CXXALIAS_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev));
  478. # endif
  479. _GL_CXXALIASWARN (mknod);
  480. #elif defined GNULIB_POSIXCHECK
  481. # undef mknod
  482. # if HAVE_RAW_DECL_MKNOD
  483. _GL_WARN_ON_USE (mknod, "mknod is not portable - "
  484. "use gnulib module mknod for portability");
  485. # endif
  486. #endif
  487. #if @GNULIB_MKNODAT@
  488. # if !@HAVE_MKNODAT@
  489. _GL_FUNCDECL_SYS (mknodat, int,
  490. (int fd, char const *file, mode_t mode, dev_t dev)
  491. _GL_ARG_NONNULL ((2)));
  492. # endif
  493. _GL_CXXALIAS_SYS (mknodat, int,
  494. (int fd, char const *file, mode_t mode, dev_t dev));
  495. _GL_CXXALIASWARN (mknodat);
  496. #elif defined GNULIB_POSIXCHECK
  497. # undef mknodat
  498. # if HAVE_RAW_DECL_MKNODAT
  499. _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
  500. "use gnulib module mkfifoat for portability");
  501. # endif
  502. #endif
  503. #if @GNULIB_STAT@
  504. # if @REPLACE_STAT@
  505. /* We can't use the object-like #define stat rpl_stat, because of
  506. struct stat. This means that rpl_stat will not be used if the user
  507. does (stat)(a,b). Oh well. */
  508. # undef stat
  509. # ifdef _LARGE_FILES
  510. /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
  511. so we have to replace stat64() instead of stat(). */
  512. # define stat stat64
  513. # undef stat64
  514. # define stat64(name, st) rpl_stat (name, st)
  515. # else /* !_LARGE_FILES */
  516. # define stat(name, st) rpl_stat (name, st)
  517. # endif /* !_LARGE_FILES */
  518. _GL_EXTERN_C int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));
  519. # endif
  520. #elif defined GNULIB_POSIXCHECK
  521. # undef stat
  522. # if HAVE_RAW_DECL_STAT
  523. _GL_WARN_ON_USE (stat, "stat is unportable - "
  524. "use gnulib module stat for portability");
  525. # endif
  526. #endif
  527. #if @GNULIB_UTIMENSAT@
  528. # if @REPLACE_UTIMENSAT@
  529. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  530. # undef utimensat
  531. # define utimensat rpl_utimensat
  532. # endif
  533. _GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name,
  534. struct timespec const times[2], int flag)
  535. _GL_ARG_NONNULL ((2)));
  536. _GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name,
  537. struct timespec const times[2], int flag));
  538. # else
  539. # if !@HAVE_UTIMENSAT@
  540. _GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name,
  541. struct timespec const times[2], int flag)
  542. _GL_ARG_NONNULL ((2)));
  543. # endif
  544. _GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name,
  545. struct timespec const times[2], int flag));
  546. # endif
  547. _GL_CXXALIASWARN (utimensat);
  548. #elif defined GNULIB_POSIXCHECK
  549. # undef utimensat
  550. # if HAVE_RAW_DECL_UTIMENSAT
  551. _GL_WARN_ON_USE (utimensat, "utimensat is not portable - "
  552. "use gnulib module utimensat for portability");
  553. # endif
  554. #endif
  555. #endif /* _GL_SYS_STAT_H */
  556. #endif /* _GL_SYS_STAT_H */
  557. #endif