unistd.in.h 51 KB

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