sys_stat.in.h 22 KB

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