sys_stat.in.h 17 KB

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