unistd.in.h 53 KB

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