unistd.in.h 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530
  1. /* Substitute for and wrapper around <unistd.h>.
  2. Copyright (C) 2003-2013 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. #ifndef _@GUARD_PREFIX@_UNISTD_H
  14. #if __GNUC__ >= 3
  15. @PRAGMA_SYSTEM_HEADER@
  16. #endif
  17. @PRAGMA_COLUMNS@
  18. /* The include_next requires a split double-inclusion guard. */
  19. #if @HAVE_UNISTD_H@
  20. # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
  21. #endif
  22. /* Get all possible declarations of gethostname(). */
  23. #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
  24. && !defined _GL_INCLUDING_WINSOCK2_H
  25. # define _GL_INCLUDING_WINSOCK2_H
  26. # include <winsock2.h>
  27. # undef _GL_INCLUDING_WINSOCK2_H
  28. #endif
  29. #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
  30. #define _@GUARD_PREFIX@_UNISTD_H
  31. /* NetBSD 5.0 mis-defines NULL. Also get size_t. */
  32. #include <stddef.h>
  33. /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
  34. /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
  35. /* But avoid namespace pollution on glibc systems. */
  36. #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
  37. || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
  38. && defined __CYGWIN__)) \
  39. && ! defined __GLIBC__
  40. # include <stdio.h>
  41. #endif
  42. /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
  43. /* But avoid namespace pollution on glibc systems. */
  44. #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
  45. && ! defined __GLIBC__
  46. # include <fcntl.h>
  47. #endif
  48. /* mingw fails to declare _exit in <unistd.h>. */
  49. /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
  50. <unistd.h>. */
  51. /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
  52. /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
  53. included here. */
  54. /* But avoid namespace pollution on glibc systems. */
  55. #if !defined __GLIBC__ && !defined __osf__
  56. # define __need_system_stdlib_h
  57. # include <stdlib.h>
  58. # undef __need_system_stdlib_h
  59. #endif
  60. /* Native Windows platforms declare chdir, getcwd, rmdir in
  61. <io.h> and/or <direct.h>, not in <unistd.h>.
  62. They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
  63. lseek(), read(), unlink(), write() in <io.h>. */
  64. #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
  65. || defined GNULIB_POSIXCHECK) \
  66. && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
  67. # include <io.h> /* mingw32, mingw64 */
  68. # include <direct.h> /* mingw64, MSVC 9 */
  69. #elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
  70. || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
  71. || defined GNULIB_POSIXCHECK) \
  72. && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
  73. # include <io.h>
  74. #endif
  75. /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
  76. NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
  77. /* But avoid namespace pollution on glibc systems. */
  78. #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
  79. || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
  80. && !defined __GLIBC__
  81. # include <netdb.h>
  82. #endif
  83. /* MSVC defines off_t in <sys/types.h>.
  84. May also define off_t to a 64-bit type on native Windows. */
  85. #if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
  86. /* Get off_t. */
  87. # include <sys/types.h>
  88. #endif
  89. #if (@GNULIB_READ@ || @GNULIB_WRITE@ \
  90. || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
  91. || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
  92. /* Get ssize_t. */
  93. # include <sys/types.h>
  94. #endif
  95. /* Get getopt(), optarg, optind, opterr, optopt.
  96. But avoid namespace pollution on glibc systems. */
  97. #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
  98. # define __need_getopt
  99. # include <getopt.h>
  100. #endif
  101. _GL_INLINE_HEADER_BEGIN
  102. #ifndef _GL_UNISTD_INLINE
  103. # define _GL_UNISTD_INLINE _GL_INLINE
  104. #endif
  105. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  106. /* The definition of _GL_ARG_NONNULL is copied here. */
  107. /* The definition of _GL_WARN_ON_USE is copied here. */
  108. /* Hide some function declarations from <winsock2.h>. */
  109. #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
  110. # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
  111. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  112. # undef socket
  113. # define socket socket_used_without_including_sys_socket_h
  114. # undef connect
  115. # define connect connect_used_without_including_sys_socket_h
  116. # undef accept
  117. # define accept accept_used_without_including_sys_socket_h
  118. # undef bind
  119. # define bind bind_used_without_including_sys_socket_h
  120. # undef getpeername
  121. # define getpeername getpeername_used_without_including_sys_socket_h
  122. # undef getsockname
  123. # define getsockname getsockname_used_without_including_sys_socket_h
  124. # undef getsockopt
  125. # define getsockopt getsockopt_used_without_including_sys_socket_h
  126. # undef listen
  127. # define listen listen_used_without_including_sys_socket_h
  128. # undef recv
  129. # define recv recv_used_without_including_sys_socket_h
  130. # undef send
  131. # define send send_used_without_including_sys_socket_h
  132. # undef recvfrom
  133. # define recvfrom recvfrom_used_without_including_sys_socket_h
  134. # undef sendto
  135. # define sendto sendto_used_without_including_sys_socket_h
  136. # undef setsockopt
  137. # define setsockopt setsockopt_used_without_including_sys_socket_h
  138. # undef shutdown
  139. # define shutdown shutdown_used_without_including_sys_socket_h
  140. # else
  141. _GL_WARN_ON_USE (socket,
  142. "socket() used without including <sys/socket.h>");
  143. _GL_WARN_ON_USE (connect,
  144. "connect() used without including <sys/socket.h>");
  145. _GL_WARN_ON_USE (accept,
  146. "accept() used without including <sys/socket.h>");
  147. _GL_WARN_ON_USE (bind,
  148. "bind() used without including <sys/socket.h>");
  149. _GL_WARN_ON_USE (getpeername,
  150. "getpeername() used without including <sys/socket.h>");
  151. _GL_WARN_ON_USE (getsockname,
  152. "getsockname() used without including <sys/socket.h>");
  153. _GL_WARN_ON_USE (getsockopt,
  154. "getsockopt() used without including <sys/socket.h>");
  155. _GL_WARN_ON_USE (listen,
  156. "listen() used without including <sys/socket.h>");
  157. _GL_WARN_ON_USE (recv,
  158. "recv() used without including <sys/socket.h>");
  159. _GL_WARN_ON_USE (send,
  160. "send() used without including <sys/socket.h>");
  161. _GL_WARN_ON_USE (recvfrom,
  162. "recvfrom() used without including <sys/socket.h>");
  163. _GL_WARN_ON_USE (sendto,
  164. "sendto() used without including <sys/socket.h>");
  165. _GL_WARN_ON_USE (setsockopt,
  166. "setsockopt() used without including <sys/socket.h>");
  167. _GL_WARN_ON_USE (shutdown,
  168. "shutdown() used without including <sys/socket.h>");
  169. # endif
  170. # endif
  171. # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
  172. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  173. # undef select
  174. # define select select_used_without_including_sys_select_h
  175. # else
  176. _GL_WARN_ON_USE (select,
  177. "select() used without including <sys/select.h>");
  178. # endif
  179. # endif
  180. #endif
  181. /* OS/2 EMX lacks these macros. */
  182. #ifndef STDIN_FILENO
  183. # define STDIN_FILENO 0
  184. #endif
  185. #ifndef STDOUT_FILENO
  186. # define STDOUT_FILENO 1
  187. #endif
  188. #ifndef STDERR_FILENO
  189. # define STDERR_FILENO 2
  190. #endif
  191. /* Ensure *_OK macros exist. */
  192. #ifndef F_OK
  193. # define F_OK 0
  194. # define X_OK 1
  195. # define W_OK 2
  196. # define R_OK 4
  197. #endif
  198. /* Declare overridden functions. */
  199. #if defined GNULIB_POSIXCHECK
  200. /* The access() function is a security risk. */
  201. _GL_WARN_ON_USE (access, "the access function is a security risk - "
  202. "use the gnulib module faccessat instead");
  203. #endif
  204. #if @GNULIB_CHDIR@
  205. _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
  206. _GL_CXXALIASWARN (chdir);
  207. #elif defined GNULIB_POSIXCHECK
  208. # undef chdir
  209. # if HAVE_RAW_DECL_CHDIR
  210. _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
  211. "use gnulib module chdir for portability");
  212. # endif
  213. #endif
  214. #if @GNULIB_CHOWN@
  215. /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
  216. to GID (if GID is not -1). Follow symbolic links.
  217. Return 0 if successful, otherwise -1 and errno set.
  218. See the POSIX:2008 specification
  219. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
  220. # if @REPLACE_CHOWN@
  221. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  222. # undef chown
  223. # define chown rpl_chown
  224. # endif
  225. _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
  226. _GL_ARG_NONNULL ((1)));
  227. _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
  228. # else
  229. # if !@HAVE_CHOWN@
  230. _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
  231. _GL_ARG_NONNULL ((1)));
  232. # endif
  233. _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
  234. # endif
  235. _GL_CXXALIASWARN (chown);
  236. #elif defined GNULIB_POSIXCHECK
  237. # undef chown
  238. # if HAVE_RAW_DECL_CHOWN
  239. _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
  240. "doesn't treat a uid or gid of -1 on some systems - "
  241. "use gnulib module chown for portability");
  242. # endif
  243. #endif
  244. #if @GNULIB_CLOSE@
  245. # if @REPLACE_CLOSE@
  246. /* Automatically included by modules that need a replacement for close. */
  247. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  248. # undef close
  249. # define close rpl_close
  250. # endif
  251. _GL_FUNCDECL_RPL (close, int, (int fd));
  252. _GL_CXXALIAS_RPL (close, int, (int fd));
  253. # else
  254. _GL_CXXALIAS_SYS (close, int, (int fd));
  255. # endif
  256. _GL_CXXALIASWARN (close);
  257. #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
  258. # undef close
  259. # define close close_used_without_requesting_gnulib_module_close
  260. #elif defined GNULIB_POSIXCHECK
  261. # undef close
  262. /* Assume close is always declared. */
  263. _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
  264. "use gnulib module close for portability");
  265. #endif
  266. #if @GNULIB_DUP@
  267. # if @REPLACE_DUP@
  268. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  269. # define dup rpl_dup
  270. # endif
  271. _GL_FUNCDECL_RPL (dup, int, (int oldfd));
  272. _GL_CXXALIAS_RPL (dup, int, (int oldfd));
  273. # else
  274. _GL_CXXALIAS_SYS (dup, int, (int oldfd));
  275. # endif
  276. _GL_CXXALIASWARN (dup);
  277. #elif defined GNULIB_POSIXCHECK
  278. # undef dup
  279. # if HAVE_RAW_DECL_DUP
  280. _GL_WARN_ON_USE (dup, "dup is unportable - "
  281. "use gnulib module dup for portability");
  282. # endif
  283. #endif
  284. #if @GNULIB_DUP2@
  285. /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
  286. NEWFD = OLDFD, otherwise close NEWFD first if it is open.
  287. Return newfd if successful, otherwise -1 and errno set.
  288. See the POSIX:2008 specification
  289. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
  290. # if @REPLACE_DUP2@
  291. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  292. # define dup2 rpl_dup2
  293. # endif
  294. _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
  295. _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
  296. # else
  297. # if !@HAVE_DUP2@
  298. _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
  299. # endif
  300. _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
  301. # endif
  302. _GL_CXXALIASWARN (dup2);
  303. #elif defined GNULIB_POSIXCHECK
  304. # undef dup2
  305. # if HAVE_RAW_DECL_DUP2
  306. _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
  307. "use gnulib module dup2 for portability");
  308. # endif
  309. #endif
  310. #if @GNULIB_DUP3@
  311. /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
  312. specified flags.
  313. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  314. and O_TEXT, O_BINARY (defined in "binary-io.h").
  315. Close NEWFD first if it is open.
  316. Return newfd if successful, otherwise -1 and errno set.
  317. See the Linux man page at
  318. <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
  319. # if @HAVE_DUP3@
  320. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  321. # define dup3 rpl_dup3
  322. # endif
  323. _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
  324. _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
  325. # else
  326. _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
  327. _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
  328. # endif
  329. _GL_CXXALIASWARN (dup3);
  330. #elif defined GNULIB_POSIXCHECK
  331. # undef dup3
  332. # if HAVE_RAW_DECL_DUP3
  333. _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
  334. "use gnulib module dup3 for portability");
  335. # endif
  336. #endif
  337. #if @GNULIB_ENVIRON@
  338. # if !@HAVE_DECL_ENVIRON@
  339. /* Set of environment variables and values. An array of strings of the form
  340. "VARIABLE=VALUE", terminated with a NULL. */
  341. # if defined __APPLE__ && defined __MACH__
  342. # include <crt_externs.h>
  343. # define environ (*_NSGetEnviron ())
  344. # else
  345. # ifdef __cplusplus
  346. extern "C" {
  347. # endif
  348. extern char **environ;
  349. # ifdef __cplusplus
  350. }
  351. # endif
  352. # endif
  353. # endif
  354. #elif defined GNULIB_POSIXCHECK
  355. # if HAVE_RAW_DECL_ENVIRON
  356. _GL_UNISTD_INLINE char ***
  357. rpl_environ (void)
  358. {
  359. return &environ;
  360. }
  361. _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
  362. "use gnulib module environ for portability");
  363. # undef environ
  364. # define environ (*rpl_environ ())
  365. # endif
  366. #endif
  367. #if @GNULIB_EUIDACCESS@
  368. /* Like access(), except that it uses the effective user id and group id of
  369. the current process. */
  370. # if !@HAVE_EUIDACCESS@
  371. _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
  372. _GL_ARG_NONNULL ((1)));
  373. # endif
  374. _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
  375. _GL_CXXALIASWARN (euidaccess);
  376. # if defined GNULIB_POSIXCHECK
  377. /* Like access(), this function is a security risk. */
  378. _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
  379. "use the gnulib module faccessat instead");
  380. # endif
  381. #elif defined GNULIB_POSIXCHECK
  382. # undef euidaccess
  383. # if HAVE_RAW_DECL_EUIDACCESS
  384. _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
  385. "use gnulib module euidaccess for portability");
  386. # endif
  387. #endif
  388. #if @GNULIB_FACCESSAT@
  389. # if !@HAVE_FACCESSAT@
  390. _GL_FUNCDECL_SYS (faccessat, int,
  391. (int fd, char const *file, int mode, int flag)
  392. _GL_ARG_NONNULL ((2)));
  393. # endif
  394. _GL_CXXALIAS_SYS (faccessat, int,
  395. (int fd, char const *file, int mode, int flag));
  396. _GL_CXXALIASWARN (faccessat);
  397. #elif defined GNULIB_POSIXCHECK
  398. # undef faccessat
  399. # if HAVE_RAW_DECL_FACCESSAT
  400. _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
  401. "use gnulib module faccessat for portability");
  402. # endif
  403. #endif
  404. #if @GNULIB_FCHDIR@
  405. /* Change the process' current working directory to the directory on which
  406. the given file descriptor is open.
  407. Return 0 if successful, otherwise -1 and errno set.
  408. See the POSIX:2008 specification
  409. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
  410. # if ! @HAVE_FCHDIR@
  411. _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
  412. /* Gnulib internal hooks needed to maintain the fchdir metadata. */
  413. _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
  414. _GL_ARG_NONNULL ((2));
  415. _GL_EXTERN_C void _gl_unregister_fd (int fd);
  416. _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
  417. _GL_EXTERN_C const char *_gl_directory_name (int fd);
  418. # else
  419. # if !@HAVE_DECL_FCHDIR@
  420. _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
  421. # endif
  422. # endif
  423. _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
  424. _GL_CXXALIASWARN (fchdir);
  425. #elif defined GNULIB_POSIXCHECK
  426. # undef fchdir
  427. # if HAVE_RAW_DECL_FCHDIR
  428. _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
  429. "use gnulib module fchdir for portability");
  430. # endif
  431. #endif
  432. #if @GNULIB_FCHOWNAT@
  433. # if @REPLACE_FCHOWNAT@
  434. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  435. # undef fchownat
  436. # define fchownat rpl_fchownat
  437. # endif
  438. _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
  439. uid_t owner, gid_t group, int flag)
  440. _GL_ARG_NONNULL ((2)));
  441. _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
  442. uid_t owner, gid_t group, int flag));
  443. # else
  444. # if !@HAVE_FCHOWNAT@
  445. _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
  446. uid_t owner, gid_t group, int flag)
  447. _GL_ARG_NONNULL ((2)));
  448. # endif
  449. _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
  450. uid_t owner, gid_t group, int flag));
  451. # endif
  452. _GL_CXXALIASWARN (fchownat);
  453. #elif defined GNULIB_POSIXCHECK
  454. # undef fchownat
  455. # if HAVE_RAW_DECL_FCHOWNAT
  456. _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
  457. "use gnulib module openat for portability");
  458. # endif
  459. #endif
  460. #if @GNULIB_FDATASYNC@
  461. /* Synchronize changes to a file.
  462. Return 0 if successful, otherwise -1 and errno set.
  463. See POSIX:2008 specification
  464. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
  465. # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
  466. _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
  467. # endif
  468. _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
  469. _GL_CXXALIASWARN (fdatasync);
  470. #elif defined GNULIB_POSIXCHECK
  471. # undef fdatasync
  472. # if HAVE_RAW_DECL_FDATASYNC
  473. _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
  474. "use gnulib module fdatasync for portability");
  475. # endif
  476. #endif
  477. #if @GNULIB_FSYNC@
  478. /* Synchronize changes, including metadata, to a file.
  479. Return 0 if successful, otherwise -1 and errno set.
  480. See POSIX:2008 specification
  481. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
  482. # if !@HAVE_FSYNC@
  483. _GL_FUNCDECL_SYS (fsync, int, (int fd));
  484. # endif
  485. _GL_CXXALIAS_SYS (fsync, int, (int fd));
  486. _GL_CXXALIASWARN (fsync);
  487. #elif defined GNULIB_POSIXCHECK
  488. # undef fsync
  489. # if HAVE_RAW_DECL_FSYNC
  490. _GL_WARN_ON_USE (fsync, "fsync is unportable - "
  491. "use gnulib module fsync for portability");
  492. # endif
  493. #endif
  494. #if @GNULIB_FTRUNCATE@
  495. /* Change the size of the file to which FD is opened to become equal to LENGTH.
  496. Return 0 if successful, otherwise -1 and errno set.
  497. See the POSIX:2008 specification
  498. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
  499. # if @REPLACE_FTRUNCATE@
  500. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  501. # undef ftruncate
  502. # define ftruncate rpl_ftruncate
  503. # endif
  504. _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
  505. _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
  506. # else
  507. # if !@HAVE_FTRUNCATE@
  508. _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
  509. # endif
  510. _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
  511. # endif
  512. _GL_CXXALIASWARN (ftruncate);
  513. #elif defined GNULIB_POSIXCHECK
  514. # undef ftruncate
  515. # if HAVE_RAW_DECL_FTRUNCATE
  516. _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
  517. "use gnulib module ftruncate for portability");
  518. # endif
  519. #endif
  520. #if @GNULIB_GETCWD@
  521. /* Get the name of the current working directory, and put it in SIZE bytes
  522. of BUF.
  523. Return BUF if successful, or NULL if the directory couldn't be determined
  524. or SIZE was too small.
  525. See the POSIX:2008 specification
  526. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
  527. Additionally, the gnulib module 'getcwd' guarantees the following GNU
  528. extension: If BUF is NULL, an array is allocated with 'malloc'; the array
  529. is SIZE bytes long, unless SIZE == 0, in which case it is as big as
  530. necessary. */
  531. # if @REPLACE_GETCWD@
  532. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  533. # define getcwd rpl_getcwd
  534. # endif
  535. _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
  536. _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
  537. # else
  538. /* Need to cast, because on mingw, the second parameter is
  539. int size. */
  540. _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
  541. # endif
  542. _GL_CXXALIASWARN (getcwd);
  543. #elif defined GNULIB_POSIXCHECK
  544. # undef getcwd
  545. # if HAVE_RAW_DECL_GETCWD
  546. _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
  547. "use gnulib module getcwd for portability");
  548. # endif
  549. #endif
  550. #if @GNULIB_GETDOMAINNAME@
  551. /* Return the NIS domain name of the machine.
  552. WARNING! The NIS domain name is unrelated to the fully qualified host name
  553. of the machine. It is also unrelated to email addresses.
  554. WARNING! The NIS domain name is usually the empty string or "(none)" when
  555. not using NIS.
  556. Put up to LEN bytes of the NIS domain name into NAME.
  557. Null terminate it if the name is shorter than LEN.
  558. If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
  559. Return 0 if successful, otherwise set errno and return -1. */
  560. # if @REPLACE_GETDOMAINNAME@
  561. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  562. # undef getdomainname
  563. # define getdomainname rpl_getdomainname
  564. # endif
  565. _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
  566. _GL_ARG_NONNULL ((1)));
  567. _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
  568. # else
  569. # if !@HAVE_DECL_GETDOMAINNAME@
  570. _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
  571. _GL_ARG_NONNULL ((1)));
  572. # endif
  573. _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
  574. # endif
  575. _GL_CXXALIASWARN (getdomainname);
  576. #elif defined GNULIB_POSIXCHECK
  577. # undef getdomainname
  578. # if HAVE_RAW_DECL_GETDOMAINNAME
  579. _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
  580. "use gnulib module getdomainname for portability");
  581. # endif
  582. #endif
  583. #if @GNULIB_GETDTABLESIZE@
  584. /* Return the maximum number of file descriptors in the current process.
  585. In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
  586. # if !@HAVE_GETDTABLESIZE@
  587. _GL_FUNCDECL_SYS (getdtablesize, int, (void));
  588. # endif
  589. _GL_CXXALIAS_SYS (getdtablesize, int, (void));
  590. _GL_CXXALIASWARN (getdtablesize);
  591. #elif defined GNULIB_POSIXCHECK
  592. # undef getdtablesize
  593. # if HAVE_RAW_DECL_GETDTABLESIZE
  594. _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
  595. "use gnulib module getdtablesize for portability");
  596. # endif
  597. #endif
  598. #if @GNULIB_GETGROUPS@
  599. /* Return the supplemental groups that the current process belongs to.
  600. It is unspecified whether the effective group id is in the list.
  601. If N is 0, return the group count; otherwise, N describes how many
  602. entries are available in GROUPS. Return -1 and set errno if N is
  603. not 0 and not large enough. Fails with ENOSYS on some systems. */
  604. # if @REPLACE_GETGROUPS@
  605. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  606. # undef getgroups
  607. # define getgroups rpl_getgroups
  608. # endif
  609. _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
  610. _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
  611. # else
  612. # if !@HAVE_GETGROUPS@
  613. _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
  614. # endif
  615. _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
  616. # endif
  617. _GL_CXXALIASWARN (getgroups);
  618. #elif defined GNULIB_POSIXCHECK
  619. # undef getgroups
  620. # if HAVE_RAW_DECL_GETGROUPS
  621. _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
  622. "use gnulib module getgroups for portability");
  623. # endif
  624. #endif
  625. #if @GNULIB_GETHOSTNAME@
  626. /* Return the standard host name of the machine.
  627. WARNING! The host name may or may not be fully qualified.
  628. Put up to LEN bytes of the host name into NAME.
  629. Null terminate it if the name is shorter than LEN.
  630. If the host name is longer than LEN, set errno = EINVAL and return -1.
  631. Return 0 if successful, otherwise set errno and return -1. */
  632. # if @UNISTD_H_HAVE_WINSOCK2_H@
  633. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  634. # undef gethostname
  635. # define gethostname rpl_gethostname
  636. # endif
  637. _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
  638. _GL_ARG_NONNULL ((1)));
  639. _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
  640. # else
  641. # if !@HAVE_GETHOSTNAME@
  642. _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
  643. _GL_ARG_NONNULL ((1)));
  644. # endif
  645. /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
  646. parameter is
  647. int len. */
  648. _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
  649. # endif
  650. _GL_CXXALIASWARN (gethostname);
  651. #elif @UNISTD_H_HAVE_WINSOCK2_H@
  652. # undef gethostname
  653. # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
  654. #elif defined GNULIB_POSIXCHECK
  655. # undef gethostname
  656. # if HAVE_RAW_DECL_GETHOSTNAME
  657. _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
  658. "use gnulib module gethostname for portability");
  659. # endif
  660. #endif
  661. #if @GNULIB_GETLOGIN@
  662. /* Returns the user's login name, or NULL if it cannot be found. Upon error,
  663. returns NULL with errno set.
  664. See <http://www.opengroup.org/susv3xsh/getlogin.html>.
  665. Most programs don't need to use this function, because the information is
  666. available through environment variables:
  667. ${LOGNAME-$USER} on Unix platforms,
  668. $USERNAME on native Windows platforms.
  669. */
  670. # if !@HAVE_GETLOGIN@
  671. _GL_FUNCDECL_SYS (getlogin, char *, (void));
  672. # endif
  673. _GL_CXXALIAS_SYS (getlogin, char *, (void));
  674. _GL_CXXALIASWARN (getlogin);
  675. #elif defined GNULIB_POSIXCHECK
  676. # undef getlogin
  677. # if HAVE_RAW_DECL_GETLOGIN
  678. _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
  679. "use gnulib module getlogin for portability");
  680. # endif
  681. #endif
  682. #if @GNULIB_GETLOGIN_R@
  683. /* Copies the user's login name to NAME.
  684. The array pointed to by NAME has room for SIZE bytes.
  685. Returns 0 if successful. Upon error, an error number is returned, or -1 in
  686. the case that the login name cannot be found but no specific error is
  687. provided (this case is hopefully rare but is left open by the POSIX spec).
  688. See <http://www.opengroup.org/susv3xsh/getlogin.html>.
  689. Most programs don't need to use this function, because the information is
  690. available through environment variables:
  691. ${LOGNAME-$USER} on Unix platforms,
  692. $USERNAME on native Windows platforms.
  693. */
  694. # if @REPLACE_GETLOGIN_R@
  695. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  696. # define getlogin_r rpl_getlogin_r
  697. # endif
  698. _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
  699. _GL_ARG_NONNULL ((1)));
  700. _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
  701. # else
  702. # if !@HAVE_DECL_GETLOGIN_R@
  703. _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
  704. _GL_ARG_NONNULL ((1)));
  705. # endif
  706. /* Need to cast, because on Solaris 10 systems, the second argument is
  707. int size. */
  708. _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
  709. # endif
  710. _GL_CXXALIASWARN (getlogin_r);
  711. #elif defined GNULIB_POSIXCHECK
  712. # undef getlogin_r
  713. # if HAVE_RAW_DECL_GETLOGIN_R
  714. _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
  715. "use gnulib module getlogin_r for portability");
  716. # endif
  717. #endif
  718. #if @GNULIB_GETPAGESIZE@
  719. # if @REPLACE_GETPAGESIZE@
  720. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  721. # define getpagesize rpl_getpagesize
  722. # endif
  723. _GL_FUNCDECL_RPL (getpagesize, int, (void));
  724. _GL_CXXALIAS_RPL (getpagesize, int, (void));
  725. # else
  726. # if !@HAVE_GETPAGESIZE@
  727. # if !defined getpagesize
  728. /* This is for POSIX systems. */
  729. # if !defined _gl_getpagesize && defined _SC_PAGESIZE
  730. # if ! (defined __VMS && __VMS_VER < 70000000)
  731. # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
  732. # endif
  733. # endif
  734. /* This is for older VMS. */
  735. # if !defined _gl_getpagesize && defined __VMS
  736. # ifdef __ALPHA
  737. # define _gl_getpagesize() 8192
  738. # else
  739. # define _gl_getpagesize() 512
  740. # endif
  741. # endif
  742. /* This is for BeOS. */
  743. # if !defined _gl_getpagesize && @HAVE_OS_H@
  744. # include <OS.h>
  745. # if defined B_PAGE_SIZE
  746. # define _gl_getpagesize() B_PAGE_SIZE
  747. # endif
  748. # endif
  749. /* This is for AmigaOS4.0. */
  750. # if !defined _gl_getpagesize && defined __amigaos4__
  751. # define _gl_getpagesize() 2048
  752. # endif
  753. /* This is for older Unix systems. */
  754. # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
  755. # include <sys/param.h>
  756. # ifdef EXEC_PAGESIZE
  757. # define _gl_getpagesize() EXEC_PAGESIZE
  758. # else
  759. # ifdef NBPG
  760. # ifndef CLSIZE
  761. # define CLSIZE 1
  762. # endif
  763. # define _gl_getpagesize() (NBPG * CLSIZE)
  764. # else
  765. # ifdef NBPC
  766. # define _gl_getpagesize() NBPC
  767. # endif
  768. # endif
  769. # endif
  770. # endif
  771. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  772. # define getpagesize() _gl_getpagesize ()
  773. # else
  774. # if !GNULIB_defined_getpagesize_function
  775. _GL_UNISTD_INLINE int
  776. getpagesize ()
  777. {
  778. return _gl_getpagesize ();
  779. }
  780. # define GNULIB_defined_getpagesize_function 1
  781. # endif
  782. # endif
  783. # endif
  784. # endif
  785. /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
  786. _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
  787. # endif
  788. # if @HAVE_DECL_GETPAGESIZE@
  789. _GL_CXXALIASWARN (getpagesize);
  790. # endif
  791. #elif defined GNULIB_POSIXCHECK
  792. # undef getpagesize
  793. # if HAVE_RAW_DECL_GETPAGESIZE
  794. _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
  795. "use gnulib module getpagesize for portability");
  796. # endif
  797. #endif
  798. #if @GNULIB_GETUSERSHELL@
  799. /* Return the next valid login shell on the system, or NULL when the end of
  800. the list has been reached. */
  801. # if !@HAVE_DECL_GETUSERSHELL@
  802. _GL_FUNCDECL_SYS (getusershell, char *, (void));
  803. # endif
  804. _GL_CXXALIAS_SYS (getusershell, char *, (void));
  805. _GL_CXXALIASWARN (getusershell);
  806. #elif defined GNULIB_POSIXCHECK
  807. # undef getusershell
  808. # if HAVE_RAW_DECL_GETUSERSHELL
  809. _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
  810. "use gnulib module getusershell for portability");
  811. # endif
  812. #endif
  813. #if @GNULIB_GETUSERSHELL@
  814. /* Rewind to pointer that is advanced at each getusershell() call. */
  815. # if !@HAVE_DECL_GETUSERSHELL@
  816. _GL_FUNCDECL_SYS (setusershell, void, (void));
  817. # endif
  818. _GL_CXXALIAS_SYS (setusershell, void, (void));
  819. _GL_CXXALIASWARN (setusershell);
  820. #elif defined GNULIB_POSIXCHECK
  821. # undef setusershell
  822. # if HAVE_RAW_DECL_SETUSERSHELL
  823. _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
  824. "use gnulib module getusershell for portability");
  825. # endif
  826. #endif
  827. #if @GNULIB_GETUSERSHELL@
  828. /* Free the pointer that is advanced at each getusershell() call and
  829. associated resources. */
  830. # if !@HAVE_DECL_GETUSERSHELL@
  831. _GL_FUNCDECL_SYS (endusershell, void, (void));
  832. # endif
  833. _GL_CXXALIAS_SYS (endusershell, void, (void));
  834. _GL_CXXALIASWARN (endusershell);
  835. #elif defined GNULIB_POSIXCHECK
  836. # undef endusershell
  837. # if HAVE_RAW_DECL_ENDUSERSHELL
  838. _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
  839. "use gnulib module getusershell for portability");
  840. # endif
  841. #endif
  842. #if @GNULIB_GROUP_MEMBER@
  843. /* Determine whether group id is in calling user's group list. */
  844. # if !@HAVE_GROUP_MEMBER@
  845. _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
  846. # endif
  847. _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
  848. _GL_CXXALIASWARN (group_member);
  849. #elif defined GNULIB_POSIXCHECK
  850. # undef group_member
  851. # if HAVE_RAW_DECL_GROUP_MEMBER
  852. _GL_WARN_ON_USE (group_member, "group_member is unportable - "
  853. "use gnulib module group-member for portability");
  854. # endif
  855. #endif
  856. #if @GNULIB_ISATTY@
  857. # if @REPLACE_ISATTY@
  858. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  859. # undef isatty
  860. # define isatty rpl_isatty
  861. # endif
  862. _GL_FUNCDECL_RPL (isatty, int, (int fd));
  863. _GL_CXXALIAS_RPL (isatty, int, (int fd));
  864. # else
  865. _GL_CXXALIAS_SYS (isatty, int, (int fd));
  866. # endif
  867. _GL_CXXALIASWARN (isatty);
  868. #elif defined GNULIB_POSIXCHECK
  869. # undef isatty
  870. # if HAVE_RAW_DECL_ISATTY
  871. _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
  872. "use gnulib module isatty for portability");
  873. # endif
  874. #endif
  875. #if @GNULIB_LCHOWN@
  876. /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
  877. to GID (if GID is not -1). Do not follow symbolic links.
  878. Return 0 if successful, otherwise -1 and errno set.
  879. See the POSIX:2008 specification
  880. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
  881. # if @REPLACE_LCHOWN@
  882. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  883. # undef lchown
  884. # define lchown rpl_lchown
  885. # endif
  886. _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
  887. _GL_ARG_NONNULL ((1)));
  888. _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
  889. # else
  890. # if !@HAVE_LCHOWN@
  891. _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
  892. _GL_ARG_NONNULL ((1)));
  893. # endif
  894. _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
  895. # endif
  896. _GL_CXXALIASWARN (lchown);
  897. #elif defined GNULIB_POSIXCHECK
  898. # undef lchown
  899. # if HAVE_RAW_DECL_LCHOWN
  900. _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
  901. "use gnulib module lchown for portability");
  902. # endif
  903. #endif
  904. #if @GNULIB_LINK@
  905. /* Create a new hard link for an existing file.
  906. Return 0 if successful, otherwise -1 and errno set.
  907. See POSIX:2008 specification
  908. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
  909. # if @REPLACE_LINK@
  910. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  911. # define link rpl_link
  912. # endif
  913. _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
  914. _GL_ARG_NONNULL ((1, 2)));
  915. _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
  916. # else
  917. # if !@HAVE_LINK@
  918. _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
  919. _GL_ARG_NONNULL ((1, 2)));
  920. # endif
  921. _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
  922. # endif
  923. _GL_CXXALIASWARN (link);
  924. #elif defined GNULIB_POSIXCHECK
  925. # undef link
  926. # if HAVE_RAW_DECL_LINK
  927. _GL_WARN_ON_USE (link, "link is unportable - "
  928. "use gnulib module link for portability");
  929. # endif
  930. #endif
  931. #if @GNULIB_LINKAT@
  932. /* Create a new hard link for an existing file, relative to two
  933. directories. FLAG controls whether symlinks are followed.
  934. Return 0 if successful, otherwise -1 and errno set. */
  935. # if @REPLACE_LINKAT@
  936. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  937. # undef linkat
  938. # define linkat rpl_linkat
  939. # endif
  940. _GL_FUNCDECL_RPL (linkat, int,
  941. (int fd1, const char *path1, int fd2, const char *path2,
  942. int flag)
  943. _GL_ARG_NONNULL ((2, 4)));
  944. _GL_CXXALIAS_RPL (linkat, int,
  945. (int fd1, const char *path1, int fd2, const char *path2,
  946. int flag));
  947. # else
  948. # if !@HAVE_LINKAT@
  949. _GL_FUNCDECL_SYS (linkat, int,
  950. (int fd1, const char *path1, int fd2, const char *path2,
  951. int flag)
  952. _GL_ARG_NONNULL ((2, 4)));
  953. # endif
  954. _GL_CXXALIAS_SYS (linkat, int,
  955. (int fd1, const char *path1, int fd2, const char *path2,
  956. int flag));
  957. # endif
  958. _GL_CXXALIASWARN (linkat);
  959. #elif defined GNULIB_POSIXCHECK
  960. # undef linkat
  961. # if HAVE_RAW_DECL_LINKAT
  962. _GL_WARN_ON_USE (linkat, "linkat is unportable - "
  963. "use gnulib module linkat for portability");
  964. # endif
  965. #endif
  966. #if @GNULIB_LSEEK@
  967. /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
  968. Return the new offset if successful, otherwise -1 and errno set.
  969. See the POSIX:2008 specification
  970. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
  971. # if @REPLACE_LSEEK@
  972. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  973. # define lseek rpl_lseek
  974. # endif
  975. _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
  976. _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
  977. # else
  978. _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
  979. # endif
  980. _GL_CXXALIASWARN (lseek);
  981. #elif defined GNULIB_POSIXCHECK
  982. # undef lseek
  983. # if HAVE_RAW_DECL_LSEEK
  984. _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
  985. "systems - use gnulib module lseek for portability");
  986. # endif
  987. #endif
  988. #if @GNULIB_PIPE@
  989. /* Create a pipe, defaulting to O_BINARY mode.
  990. Store the read-end as fd[0] and the write-end as fd[1].
  991. Return 0 upon success, or -1 with errno set upon failure. */
  992. # if !@HAVE_PIPE@
  993. _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
  994. # endif
  995. _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
  996. _GL_CXXALIASWARN (pipe);
  997. #elif defined GNULIB_POSIXCHECK
  998. # undef pipe
  999. # if HAVE_RAW_DECL_PIPE
  1000. _GL_WARN_ON_USE (pipe, "pipe is unportable - "
  1001. "use gnulib module pipe-posix for portability");
  1002. # endif
  1003. #endif
  1004. #if @GNULIB_PIPE2@
  1005. /* Create a pipe, applying the given flags when opening the read-end of the
  1006. pipe and the write-end of the pipe.
  1007. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  1008. and O_TEXT, O_BINARY (defined in "binary-io.h").
  1009. Store the read-end as fd[0] and the write-end as fd[1].
  1010. Return 0 upon success, or -1 with errno set upon failure.
  1011. See also the Linux man page at
  1012. <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
  1013. # if @HAVE_PIPE2@
  1014. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1015. # define pipe2 rpl_pipe2
  1016. # endif
  1017. _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
  1018. _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
  1019. # else
  1020. _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
  1021. _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
  1022. # endif
  1023. _GL_CXXALIASWARN (pipe2);
  1024. #elif defined GNULIB_POSIXCHECK
  1025. # undef pipe2
  1026. # if HAVE_RAW_DECL_PIPE2
  1027. _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
  1028. "use gnulib module pipe2 for portability");
  1029. # endif
  1030. #endif
  1031. #if @GNULIB_PREAD@
  1032. /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
  1033. Return the number of bytes placed into BUF if successful, otherwise
  1034. set errno and return -1. 0 indicates EOF.
  1035. See the POSIX:2008 specification
  1036. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
  1037. # if @REPLACE_PREAD@
  1038. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1039. # undef pread
  1040. # define pread rpl_pread
  1041. # endif
  1042. _GL_FUNCDECL_RPL (pread, ssize_t,
  1043. (int fd, void *buf, size_t bufsize, off_t offset)
  1044. _GL_ARG_NONNULL ((2)));
  1045. _GL_CXXALIAS_RPL (pread, ssize_t,
  1046. (int fd, void *buf, size_t bufsize, off_t offset));
  1047. # else
  1048. # if !@HAVE_PREAD@
  1049. _GL_FUNCDECL_SYS (pread, ssize_t,
  1050. (int fd, void *buf, size_t bufsize, off_t offset)
  1051. _GL_ARG_NONNULL ((2)));
  1052. # endif
  1053. _GL_CXXALIAS_SYS (pread, ssize_t,
  1054. (int fd, void *buf, size_t bufsize, off_t offset));
  1055. # endif
  1056. _GL_CXXALIASWARN (pread);
  1057. #elif defined GNULIB_POSIXCHECK
  1058. # undef pread
  1059. # if HAVE_RAW_DECL_PREAD
  1060. _GL_WARN_ON_USE (pread, "pread is unportable - "
  1061. "use gnulib module pread for portability");
  1062. # endif
  1063. #endif
  1064. #if @GNULIB_PWRITE@
  1065. /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
  1066. Return the number of bytes written if successful, otherwise
  1067. set errno and return -1. 0 indicates nothing written. See the
  1068. POSIX:2008 specification
  1069. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
  1070. # if @REPLACE_PWRITE@
  1071. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1072. # undef pwrite
  1073. # define pwrite rpl_pwrite
  1074. # endif
  1075. _GL_FUNCDECL_RPL (pwrite, ssize_t,
  1076. (int fd, const void *buf, size_t bufsize, off_t offset)
  1077. _GL_ARG_NONNULL ((2)));
  1078. _GL_CXXALIAS_RPL (pwrite, ssize_t,
  1079. (int fd, const void *buf, size_t bufsize, off_t offset));
  1080. # else
  1081. # if !@HAVE_PWRITE@
  1082. _GL_FUNCDECL_SYS (pwrite, ssize_t,
  1083. (int fd, const void *buf, size_t bufsize, off_t offset)
  1084. _GL_ARG_NONNULL ((2)));
  1085. # endif
  1086. _GL_CXXALIAS_SYS (pwrite, ssize_t,
  1087. (int fd, const void *buf, size_t bufsize, off_t offset));
  1088. # endif
  1089. _GL_CXXALIASWARN (pwrite);
  1090. #elif defined GNULIB_POSIXCHECK
  1091. # undef pwrite
  1092. # if HAVE_RAW_DECL_PWRITE
  1093. _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
  1094. "use gnulib module pwrite for portability");
  1095. # endif
  1096. #endif
  1097. #if @GNULIB_READ@
  1098. /* Read up to COUNT bytes from file descriptor FD into the buffer starting
  1099. at BUF. See the POSIX:2008 specification
  1100. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
  1101. # if @REPLACE_READ@
  1102. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1103. # undef read
  1104. # define read rpl_read
  1105. # endif
  1106. _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
  1107. _GL_ARG_NONNULL ((2)));
  1108. _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
  1109. # else
  1110. /* Need to cast, because on mingw, the third parameter is
  1111. unsigned int count
  1112. and the return type is 'int'. */
  1113. _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
  1114. # endif
  1115. _GL_CXXALIASWARN (read);
  1116. #endif
  1117. #if @GNULIB_READLINK@
  1118. /* Read the contents of the symbolic link FILE and place the first BUFSIZE
  1119. bytes of it into BUF. Return the number of bytes placed into BUF if
  1120. successful, otherwise -1 and errno set.
  1121. See the POSIX:2008 specification
  1122. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
  1123. # if @REPLACE_READLINK@
  1124. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1125. # define readlink rpl_readlink
  1126. # endif
  1127. _GL_FUNCDECL_RPL (readlink, ssize_t,
  1128. (const char *file, char *buf, size_t bufsize)
  1129. _GL_ARG_NONNULL ((1, 2)));
  1130. _GL_CXXALIAS_RPL (readlink, ssize_t,
  1131. (const char *file, char *buf, size_t bufsize));
  1132. # else
  1133. # if !@HAVE_READLINK@
  1134. _GL_FUNCDECL_SYS (readlink, ssize_t,
  1135. (const char *file, char *buf, size_t bufsize)
  1136. _GL_ARG_NONNULL ((1, 2)));
  1137. # endif
  1138. _GL_CXXALIAS_SYS (readlink, ssize_t,
  1139. (const char *file, char *buf, size_t bufsize));
  1140. # endif
  1141. _GL_CXXALIASWARN (readlink);
  1142. #elif defined GNULIB_POSIXCHECK
  1143. # undef readlink
  1144. # if HAVE_RAW_DECL_READLINK
  1145. _GL_WARN_ON_USE (readlink, "readlink is unportable - "
  1146. "use gnulib module readlink for portability");
  1147. # endif
  1148. #endif
  1149. #if @GNULIB_READLINKAT@
  1150. # if !@HAVE_READLINKAT@
  1151. _GL_FUNCDECL_SYS (readlinkat, ssize_t,
  1152. (int fd, char const *file, char *buf, size_t len)
  1153. _GL_ARG_NONNULL ((2, 3)));
  1154. # endif
  1155. _GL_CXXALIAS_SYS (readlinkat, ssize_t,
  1156. (int fd, char const *file, char *buf, size_t len));
  1157. _GL_CXXALIASWARN (readlinkat);
  1158. #elif defined GNULIB_POSIXCHECK
  1159. # undef readlinkat
  1160. # if HAVE_RAW_DECL_READLINKAT
  1161. _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
  1162. "use gnulib module readlinkat for portability");
  1163. # endif
  1164. #endif
  1165. #if @GNULIB_RMDIR@
  1166. /* Remove the directory DIR. */
  1167. # if @REPLACE_RMDIR@
  1168. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1169. # define rmdir rpl_rmdir
  1170. # endif
  1171. _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
  1172. _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
  1173. # else
  1174. _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
  1175. # endif
  1176. _GL_CXXALIASWARN (rmdir);
  1177. #elif defined GNULIB_POSIXCHECK
  1178. # undef rmdir
  1179. # if HAVE_RAW_DECL_RMDIR
  1180. _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
  1181. "use gnulib module rmdir for portability");
  1182. # endif
  1183. #endif
  1184. #if @GNULIB_SETHOSTNAME@
  1185. /* Set the host name of the machine.
  1186. The host name may or may not be fully qualified.
  1187. Put LEN bytes of NAME into the host name.
  1188. Return 0 if successful, otherwise, set errno and return -1.
  1189. Platforms with no ability to set the hostname return -1 and set
  1190. errno = ENOSYS. */
  1191. # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
  1192. _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
  1193. _GL_ARG_NONNULL ((1)));
  1194. # endif
  1195. /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
  1196. and FreeBSD 6.4 the second parameter is int. On Solaris 11
  1197. 2011-10, the first parameter is not const. */
  1198. _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
  1199. _GL_CXXALIASWARN (sethostname);
  1200. #elif defined GNULIB_POSIXCHECK
  1201. # undef sethostname
  1202. # if HAVE_RAW_DECL_SETHOSTNAME
  1203. _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
  1204. "use gnulib module sethostname for portability");
  1205. # endif
  1206. #endif
  1207. #if @GNULIB_SLEEP@
  1208. /* Pause the execution of the current thread for N seconds.
  1209. Returns the number of seconds left to sleep.
  1210. See the POSIX:2008 specification
  1211. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
  1212. # if @REPLACE_SLEEP@
  1213. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1214. # undef sleep
  1215. # define sleep rpl_sleep
  1216. # endif
  1217. _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
  1218. _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
  1219. # else
  1220. # if !@HAVE_SLEEP@
  1221. _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
  1222. # endif
  1223. _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
  1224. # endif
  1225. _GL_CXXALIASWARN (sleep);
  1226. #elif defined GNULIB_POSIXCHECK
  1227. # undef sleep
  1228. # if HAVE_RAW_DECL_SLEEP
  1229. _GL_WARN_ON_USE (sleep, "sleep is unportable - "
  1230. "use gnulib module sleep for portability");
  1231. # endif
  1232. #endif
  1233. #if @GNULIB_SYMLINK@
  1234. # if @REPLACE_SYMLINK@
  1235. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1236. # undef symlink
  1237. # define symlink rpl_symlink
  1238. # endif
  1239. _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
  1240. _GL_ARG_NONNULL ((1, 2)));
  1241. _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
  1242. # else
  1243. # if !@HAVE_SYMLINK@
  1244. _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
  1245. _GL_ARG_NONNULL ((1, 2)));
  1246. # endif
  1247. _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
  1248. # endif
  1249. _GL_CXXALIASWARN (symlink);
  1250. #elif defined GNULIB_POSIXCHECK
  1251. # undef symlink
  1252. # if HAVE_RAW_DECL_SYMLINK
  1253. _GL_WARN_ON_USE (symlink, "symlink is not portable - "
  1254. "use gnulib module symlink for portability");
  1255. # endif
  1256. #endif
  1257. #if @GNULIB_SYMLINKAT@
  1258. # if !@HAVE_SYMLINKAT@
  1259. _GL_FUNCDECL_SYS (symlinkat, int,
  1260. (char const *contents, int fd, char const *file)
  1261. _GL_ARG_NONNULL ((1, 3)));
  1262. # endif
  1263. _GL_CXXALIAS_SYS (symlinkat, int,
  1264. (char const *contents, int fd, char const *file));
  1265. _GL_CXXALIASWARN (symlinkat);
  1266. #elif defined GNULIB_POSIXCHECK
  1267. # undef symlinkat
  1268. # if HAVE_RAW_DECL_SYMLINKAT
  1269. _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
  1270. "use gnulib module symlinkat for portability");
  1271. # endif
  1272. #endif
  1273. #if @GNULIB_TTYNAME_R@
  1274. /* Store at most BUFLEN characters of the pathname of the terminal FD is
  1275. open on in BUF. Return 0 on success, otherwise an error number. */
  1276. # if @REPLACE_TTYNAME_R@
  1277. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1278. # undef ttyname_r
  1279. # define ttyname_r rpl_ttyname_r
  1280. # endif
  1281. _GL_FUNCDECL_RPL (ttyname_r, int,
  1282. (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
  1283. _GL_CXXALIAS_RPL (ttyname_r, int,
  1284. (int fd, char *buf, size_t buflen));
  1285. # else
  1286. # if !@HAVE_DECL_TTYNAME_R@
  1287. _GL_FUNCDECL_SYS (ttyname_r, int,
  1288. (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
  1289. # endif
  1290. _GL_CXXALIAS_SYS (ttyname_r, int,
  1291. (int fd, char *buf, size_t buflen));
  1292. # endif
  1293. _GL_CXXALIASWARN (ttyname_r);
  1294. #elif defined GNULIB_POSIXCHECK
  1295. # undef ttyname_r
  1296. # if HAVE_RAW_DECL_TTYNAME_R
  1297. _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
  1298. "use gnulib module ttyname_r for portability");
  1299. # endif
  1300. #endif
  1301. #if @GNULIB_UNLINK@
  1302. # if @REPLACE_UNLINK@
  1303. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1304. # undef unlink
  1305. # define unlink rpl_unlink
  1306. # endif
  1307. _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
  1308. _GL_CXXALIAS_RPL (unlink, int, (char const *file));
  1309. # else
  1310. _GL_CXXALIAS_SYS (unlink, int, (char const *file));
  1311. # endif
  1312. _GL_CXXALIASWARN (unlink);
  1313. #elif defined GNULIB_POSIXCHECK
  1314. # undef unlink
  1315. # if HAVE_RAW_DECL_UNLINK
  1316. _GL_WARN_ON_USE (unlink, "unlink is not portable - "
  1317. "use gnulib module unlink for portability");
  1318. # endif
  1319. #endif
  1320. #if @GNULIB_UNLINKAT@
  1321. # if @REPLACE_UNLINKAT@
  1322. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1323. # undef unlinkat
  1324. # define unlinkat rpl_unlinkat
  1325. # endif
  1326. _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
  1327. _GL_ARG_NONNULL ((2)));
  1328. _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
  1329. # else
  1330. # if !@HAVE_UNLINKAT@
  1331. _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
  1332. _GL_ARG_NONNULL ((2)));
  1333. # endif
  1334. _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
  1335. # endif
  1336. _GL_CXXALIASWARN (unlinkat);
  1337. #elif defined GNULIB_POSIXCHECK
  1338. # undef unlinkat
  1339. # if HAVE_RAW_DECL_UNLINKAT
  1340. _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
  1341. "use gnulib module openat for portability");
  1342. # endif
  1343. #endif
  1344. #if @GNULIB_USLEEP@
  1345. /* Pause the execution of the current thread for N microseconds.
  1346. Returns 0 on completion, or -1 on range error.
  1347. See the POSIX:2001 specification
  1348. <http://www.opengroup.org/susv3xsh/usleep.html>. */
  1349. # if @REPLACE_USLEEP@
  1350. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1351. # undef usleep
  1352. # define usleep rpl_usleep
  1353. # endif
  1354. _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
  1355. _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
  1356. # else
  1357. # if !@HAVE_USLEEP@
  1358. _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
  1359. # endif
  1360. _GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
  1361. # endif
  1362. _GL_CXXALIASWARN (usleep);
  1363. #elif defined GNULIB_POSIXCHECK
  1364. # undef usleep
  1365. # if HAVE_RAW_DECL_USLEEP
  1366. _GL_WARN_ON_USE (usleep, "usleep is unportable - "
  1367. "use gnulib module usleep for portability");
  1368. # endif
  1369. #endif
  1370. #if @GNULIB_WRITE@
  1371. /* Write up to COUNT bytes starting at BUF to file descriptor FD.
  1372. See the POSIX:2008 specification
  1373. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
  1374. # if @REPLACE_WRITE@
  1375. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1376. # undef write
  1377. # define write rpl_write
  1378. # endif
  1379. _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
  1380. _GL_ARG_NONNULL ((2)));
  1381. _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
  1382. # else
  1383. /* Need to cast, because on mingw, the third parameter is
  1384. unsigned int count
  1385. and the return type is 'int'. */
  1386. _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
  1387. # endif
  1388. _GL_CXXALIASWARN (write);
  1389. #endif
  1390. _GL_INLINE_HEADER_END
  1391. #endif /* _@GUARD_PREFIX@_UNISTD_H */
  1392. #endif /* _@GUARD_PREFIX@_UNISTD_H */