sys_stat.in.h 18 KB

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