sys_stat.in.h 20 KB

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