unistd.in.h 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558
  1. /* Substitute for and wrapper around <unistd.h>.
  2. Copyright (C) 2003-2014 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 <crt_externs.h>
  357. # define environ (*_NSGetEnviron ())
  358. # else
  359. # ifdef __cplusplus
  360. extern "C" {
  361. # endif
  362. extern char **environ;
  363. # ifdef __cplusplus
  364. }
  365. # endif
  366. # endif
  367. # endif
  368. #elif defined GNULIB_POSIXCHECK
  369. # if HAVE_RAW_DECL_ENVIRON
  370. _GL_UNISTD_INLINE char ***
  371. rpl_environ (void)
  372. {
  373. return &environ;
  374. }
  375. _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
  376. "use gnulib module environ for portability");
  377. # undef environ
  378. # define environ (*rpl_environ ())
  379. # endif
  380. #endif
  381. #if @GNULIB_EUIDACCESS@
  382. /* Like access(), except that it uses the effective user id and group id of
  383. the current process. */
  384. # if !@HAVE_EUIDACCESS@
  385. _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
  386. _GL_ARG_NONNULL ((1)));
  387. # endif
  388. _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
  389. _GL_CXXALIASWARN (euidaccess);
  390. # if defined GNULIB_POSIXCHECK
  391. /* Like access(), this function is a security risk. */
  392. _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
  393. "use the gnulib module faccessat instead");
  394. # endif
  395. #elif defined GNULIB_POSIXCHECK
  396. # undef euidaccess
  397. # if HAVE_RAW_DECL_EUIDACCESS
  398. _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
  399. "use gnulib module euidaccess for portability");
  400. # endif
  401. #endif
  402. #if @GNULIB_FACCESSAT@
  403. # if !@HAVE_FACCESSAT@
  404. _GL_FUNCDECL_SYS (faccessat, int,
  405. (int fd, char const *file, int mode, int flag)
  406. _GL_ARG_NONNULL ((2)));
  407. # endif
  408. _GL_CXXALIAS_SYS (faccessat, int,
  409. (int fd, char const *file, int mode, int flag));
  410. _GL_CXXALIASWARN (faccessat);
  411. #elif defined GNULIB_POSIXCHECK
  412. # undef faccessat
  413. # if HAVE_RAW_DECL_FACCESSAT
  414. _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
  415. "use gnulib module faccessat for portability");
  416. # endif
  417. #endif
  418. #if @GNULIB_FCHDIR@
  419. /* Change the process' current working directory to the directory on which
  420. the given file descriptor is open.
  421. Return 0 if successful, otherwise -1 and errno set.
  422. See the POSIX:2008 specification
  423. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
  424. # if ! @HAVE_FCHDIR@
  425. _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
  426. /* Gnulib internal hooks needed to maintain the fchdir metadata. */
  427. _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
  428. _GL_ARG_NONNULL ((2));
  429. _GL_EXTERN_C void _gl_unregister_fd (int fd);
  430. _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
  431. _GL_EXTERN_C const char *_gl_directory_name (int fd);
  432. # else
  433. # if !@HAVE_DECL_FCHDIR@
  434. _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
  435. # endif
  436. # endif
  437. _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
  438. _GL_CXXALIASWARN (fchdir);
  439. #elif defined GNULIB_POSIXCHECK
  440. # undef fchdir
  441. # if HAVE_RAW_DECL_FCHDIR
  442. _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
  443. "use gnulib module fchdir for portability");
  444. # endif
  445. #endif
  446. #if @GNULIB_FCHOWNAT@
  447. # if @REPLACE_FCHOWNAT@
  448. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  449. # undef fchownat
  450. # define fchownat rpl_fchownat
  451. # endif
  452. _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
  453. uid_t owner, gid_t group, int flag)
  454. _GL_ARG_NONNULL ((2)));
  455. _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
  456. uid_t owner, gid_t group, int flag));
  457. # else
  458. # if !@HAVE_FCHOWNAT@
  459. _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
  460. uid_t owner, gid_t group, int flag)
  461. _GL_ARG_NONNULL ((2)));
  462. # endif
  463. _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
  464. uid_t owner, gid_t group, int flag));
  465. # endif
  466. _GL_CXXALIASWARN (fchownat);
  467. #elif defined GNULIB_POSIXCHECK
  468. # undef fchownat
  469. # if HAVE_RAW_DECL_FCHOWNAT
  470. _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
  471. "use gnulib module openat for portability");
  472. # endif
  473. #endif
  474. #if @GNULIB_FDATASYNC@
  475. /* Synchronize changes to a file.
  476. Return 0 if successful, otherwise -1 and errno set.
  477. See POSIX:2008 specification
  478. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
  479. # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
  480. _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
  481. # endif
  482. _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
  483. _GL_CXXALIASWARN (fdatasync);
  484. #elif defined GNULIB_POSIXCHECK
  485. # undef fdatasync
  486. # if HAVE_RAW_DECL_FDATASYNC
  487. _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
  488. "use gnulib module fdatasync for portability");
  489. # endif
  490. #endif
  491. #if @GNULIB_FSYNC@
  492. /* Synchronize changes, including metadata, to a file.
  493. Return 0 if successful, otherwise -1 and errno set.
  494. See POSIX:2008 specification
  495. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
  496. # if !@HAVE_FSYNC@
  497. _GL_FUNCDECL_SYS (fsync, int, (int fd));
  498. # endif
  499. _GL_CXXALIAS_SYS (fsync, int, (int fd));
  500. _GL_CXXALIASWARN (fsync);
  501. #elif defined GNULIB_POSIXCHECK
  502. # undef fsync
  503. # if HAVE_RAW_DECL_FSYNC
  504. _GL_WARN_ON_USE (fsync, "fsync is unportable - "
  505. "use gnulib module fsync for portability");
  506. # endif
  507. #endif
  508. #if @GNULIB_FTRUNCATE@
  509. /* Change the size of the file to which FD is opened to become equal to LENGTH.
  510. Return 0 if successful, otherwise -1 and errno set.
  511. See the POSIX:2008 specification
  512. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
  513. # if @REPLACE_FTRUNCATE@
  514. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  515. # undef ftruncate
  516. # define ftruncate rpl_ftruncate
  517. # endif
  518. _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
  519. _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
  520. # else
  521. # if !@HAVE_FTRUNCATE@
  522. _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
  523. # endif
  524. _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
  525. # endif
  526. _GL_CXXALIASWARN (ftruncate);
  527. #elif defined GNULIB_POSIXCHECK
  528. # undef ftruncate
  529. # if HAVE_RAW_DECL_FTRUNCATE
  530. _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
  531. "use gnulib module ftruncate for portability");
  532. # endif
  533. #endif
  534. #if @GNULIB_GETCWD@
  535. /* Get the name of the current working directory, and put it in SIZE bytes
  536. of BUF.
  537. Return BUF if successful, or NULL if the directory couldn't be determined
  538. or SIZE was too small.
  539. See the POSIX:2008 specification
  540. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
  541. Additionally, the gnulib module 'getcwd' guarantees the following GNU
  542. extension: If BUF is NULL, an array is allocated with 'malloc'; the array
  543. is SIZE bytes long, unless SIZE == 0, in which case it is as big as
  544. necessary. */
  545. # if @REPLACE_GETCWD@
  546. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  547. # define getcwd rpl_getcwd
  548. # endif
  549. _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
  550. _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
  551. # else
  552. /* Need to cast, because on mingw, the second parameter is
  553. int size. */
  554. _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
  555. # endif
  556. _GL_CXXALIASWARN (getcwd);
  557. #elif defined GNULIB_POSIXCHECK
  558. # undef getcwd
  559. # if HAVE_RAW_DECL_GETCWD
  560. _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
  561. "use gnulib module getcwd for portability");
  562. # endif
  563. #endif
  564. #if @GNULIB_GETDOMAINNAME@
  565. /* Return the NIS domain name of the machine.
  566. WARNING! The NIS domain name is unrelated to the fully qualified host name
  567. of the machine. It is also unrelated to email addresses.
  568. WARNING! The NIS domain name is usually the empty string or "(none)" when
  569. not using NIS.
  570. Put up to LEN bytes of the NIS domain name into NAME.
  571. Null terminate it if the name is shorter than LEN.
  572. If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
  573. Return 0 if successful, otherwise set errno and return -1. */
  574. # if @REPLACE_GETDOMAINNAME@
  575. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  576. # undef getdomainname
  577. # define getdomainname rpl_getdomainname
  578. # endif
  579. _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
  580. _GL_ARG_NONNULL ((1)));
  581. _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
  582. # else
  583. # if !@HAVE_DECL_GETDOMAINNAME@
  584. _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
  585. _GL_ARG_NONNULL ((1)));
  586. # endif
  587. _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
  588. # endif
  589. _GL_CXXALIASWARN (getdomainname);
  590. #elif defined GNULIB_POSIXCHECK
  591. # undef getdomainname
  592. # if HAVE_RAW_DECL_GETDOMAINNAME
  593. _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
  594. "use gnulib module getdomainname for portability");
  595. # endif
  596. #endif
  597. #if @GNULIB_GETDTABLESIZE@
  598. /* Return the maximum number of file descriptors in the current process.
  599. In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
  600. # if @REPLACE_GETDTABLESIZE@
  601. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  602. # undef getdtablesize
  603. # define getdtablesize rpl_getdtablesize
  604. # endif
  605. _GL_FUNCDECL_RPL (getdtablesize, int, (void));
  606. _GL_CXXALIAS_RPL (getdtablesize, int, (void));
  607. # else
  608. # if !@HAVE_GETDTABLESIZE@
  609. _GL_FUNCDECL_SYS (getdtablesize, int, (void));
  610. # endif
  611. _GL_CXXALIAS_SYS (getdtablesize, int, (void));
  612. # endif
  613. _GL_CXXALIASWARN (getdtablesize);
  614. #elif defined GNULIB_POSIXCHECK
  615. # undef getdtablesize
  616. # if HAVE_RAW_DECL_GETDTABLESIZE
  617. _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
  618. "use gnulib module getdtablesize for portability");
  619. # endif
  620. #endif
  621. #if @GNULIB_GETGROUPS@
  622. /* Return the supplemental groups that the current process belongs to.
  623. It is unspecified whether the effective group id is in the list.
  624. If N is 0, return the group count; otherwise, N describes how many
  625. entries are available in GROUPS. Return -1 and set errno if N is
  626. not 0 and not large enough. Fails with ENOSYS on some systems. */
  627. # if @REPLACE_GETGROUPS@
  628. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  629. # undef getgroups
  630. # define getgroups rpl_getgroups
  631. # endif
  632. _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
  633. _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
  634. # else
  635. # if !@HAVE_GETGROUPS@
  636. _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
  637. # endif
  638. _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
  639. # endif
  640. _GL_CXXALIASWARN (getgroups);
  641. #elif defined GNULIB_POSIXCHECK
  642. # undef getgroups
  643. # if HAVE_RAW_DECL_GETGROUPS
  644. _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
  645. "use gnulib module getgroups for portability");
  646. # endif
  647. #endif
  648. #if @GNULIB_GETHOSTNAME@
  649. /* Return the standard host name of the machine.
  650. WARNING! The host name may or may not be fully qualified.
  651. Put up to LEN bytes of the host name into NAME.
  652. Null terminate it if the name is shorter than LEN.
  653. If the host name is longer than LEN, set errno = EINVAL and return -1.
  654. Return 0 if successful, otherwise set errno and return -1. */
  655. # if @UNISTD_H_HAVE_WINSOCK2_H@
  656. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  657. # undef gethostname
  658. # define gethostname rpl_gethostname
  659. # endif
  660. _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
  661. _GL_ARG_NONNULL ((1)));
  662. _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
  663. # else
  664. # if !@HAVE_GETHOSTNAME@
  665. _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
  666. _GL_ARG_NONNULL ((1)));
  667. # endif
  668. /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
  669. parameter is
  670. int len. */
  671. _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
  672. # endif
  673. _GL_CXXALIASWARN (gethostname);
  674. #elif @UNISTD_H_HAVE_WINSOCK2_H@
  675. # undef gethostname
  676. # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
  677. #elif defined GNULIB_POSIXCHECK
  678. # undef gethostname
  679. # if HAVE_RAW_DECL_GETHOSTNAME
  680. _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
  681. "use gnulib module gethostname for portability");
  682. # endif
  683. #endif
  684. #if @GNULIB_GETLOGIN@
  685. /* Returns the user's login name, or NULL if it cannot be found. Upon error,
  686. returns NULL with errno set.
  687. See <http://www.opengroup.org/susv3xsh/getlogin.html>.
  688. Most programs don't need to use this function, because the information is
  689. available through environment variables:
  690. ${LOGNAME-$USER} on Unix platforms,
  691. $USERNAME on native Windows platforms.
  692. */
  693. # if !@HAVE_GETLOGIN@
  694. _GL_FUNCDECL_SYS (getlogin, char *, (void));
  695. # endif
  696. _GL_CXXALIAS_SYS (getlogin, char *, (void));
  697. _GL_CXXALIASWARN (getlogin);
  698. #elif defined GNULIB_POSIXCHECK
  699. # undef getlogin
  700. # if HAVE_RAW_DECL_GETLOGIN
  701. _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
  702. "use gnulib module getlogin for portability");
  703. # endif
  704. #endif
  705. #if @GNULIB_GETLOGIN_R@
  706. /* Copies the user's login name to NAME.
  707. The array pointed to by NAME has room for SIZE bytes.
  708. Returns 0 if successful. Upon error, an error number is returned, or -1 in
  709. the case that the login name cannot be found but no specific error is
  710. provided (this case is hopefully rare but is left open by the POSIX spec).
  711. See <http://www.opengroup.org/susv3xsh/getlogin.html>.
  712. Most programs don't need to use this function, because the information is
  713. available through environment variables:
  714. ${LOGNAME-$USER} on Unix platforms,
  715. $USERNAME on native Windows platforms.
  716. */
  717. # if @REPLACE_GETLOGIN_R@
  718. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  719. # define getlogin_r rpl_getlogin_r
  720. # endif
  721. _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
  722. _GL_ARG_NONNULL ((1)));
  723. _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
  724. # else
  725. # if !@HAVE_DECL_GETLOGIN_R@
  726. _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
  727. _GL_ARG_NONNULL ((1)));
  728. # endif
  729. /* Need to cast, because on Solaris 10 systems, the second argument is
  730. int size. */
  731. _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
  732. # endif
  733. _GL_CXXALIASWARN (getlogin_r);
  734. #elif defined GNULIB_POSIXCHECK
  735. # undef getlogin_r
  736. # if HAVE_RAW_DECL_GETLOGIN_R
  737. _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
  738. "use gnulib module getlogin_r for portability");
  739. # endif
  740. #endif
  741. #if @GNULIB_GETPAGESIZE@
  742. # if @REPLACE_GETPAGESIZE@
  743. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  744. # define getpagesize rpl_getpagesize
  745. # endif
  746. _GL_FUNCDECL_RPL (getpagesize, int, (void));
  747. _GL_CXXALIAS_RPL (getpagesize, int, (void));
  748. # else
  749. # if !@HAVE_GETPAGESIZE@
  750. # if !defined getpagesize
  751. /* This is for POSIX systems. */
  752. # if !defined _gl_getpagesize && defined _SC_PAGESIZE
  753. # if ! (defined __VMS && __VMS_VER < 70000000)
  754. # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
  755. # endif
  756. # endif
  757. /* This is for older VMS. */
  758. # if !defined _gl_getpagesize && defined __VMS
  759. # ifdef __ALPHA
  760. # define _gl_getpagesize() 8192
  761. # else
  762. # define _gl_getpagesize() 512
  763. # endif
  764. # endif
  765. /* This is for BeOS. */
  766. # if !defined _gl_getpagesize && @HAVE_OS_H@
  767. # include <OS.h>
  768. # if defined B_PAGE_SIZE
  769. # define _gl_getpagesize() B_PAGE_SIZE
  770. # endif
  771. # endif
  772. /* This is for AmigaOS4.0. */
  773. # if !defined _gl_getpagesize && defined __amigaos4__
  774. # define _gl_getpagesize() 2048
  775. # endif
  776. /* This is for older Unix systems. */
  777. # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
  778. # include <sys/param.h>
  779. # ifdef EXEC_PAGESIZE
  780. # define _gl_getpagesize() EXEC_PAGESIZE
  781. # else
  782. # ifdef NBPG
  783. # ifndef CLSIZE
  784. # define CLSIZE 1
  785. # endif
  786. # define _gl_getpagesize() (NBPG * CLSIZE)
  787. # else
  788. # ifdef NBPC
  789. # define _gl_getpagesize() NBPC
  790. # endif
  791. # endif
  792. # endif
  793. # endif
  794. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  795. # define getpagesize() _gl_getpagesize ()
  796. # else
  797. # if !GNULIB_defined_getpagesize_function
  798. _GL_UNISTD_INLINE int
  799. getpagesize ()
  800. {
  801. return _gl_getpagesize ();
  802. }
  803. # define GNULIB_defined_getpagesize_function 1
  804. # endif
  805. # endif
  806. # endif
  807. # endif
  808. /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
  809. _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
  810. # endif
  811. # if @HAVE_DECL_GETPAGESIZE@
  812. _GL_CXXALIASWARN (getpagesize);
  813. # endif
  814. #elif defined GNULIB_POSIXCHECK
  815. # undef getpagesize
  816. # if HAVE_RAW_DECL_GETPAGESIZE
  817. _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
  818. "use gnulib module getpagesize for portability");
  819. # endif
  820. #endif
  821. #if @GNULIB_GETUSERSHELL@
  822. /* Return the next valid login shell on the system, or NULL when the end of
  823. the list has been reached. */
  824. # if !@HAVE_DECL_GETUSERSHELL@
  825. _GL_FUNCDECL_SYS (getusershell, char *, (void));
  826. # endif
  827. _GL_CXXALIAS_SYS (getusershell, char *, (void));
  828. _GL_CXXALIASWARN (getusershell);
  829. #elif defined GNULIB_POSIXCHECK
  830. # undef getusershell
  831. # if HAVE_RAW_DECL_GETUSERSHELL
  832. _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
  833. "use gnulib module getusershell for portability");
  834. # endif
  835. #endif
  836. #if @GNULIB_GETUSERSHELL@
  837. /* Rewind to pointer that is advanced at each getusershell() call. */
  838. # if !@HAVE_DECL_GETUSERSHELL@
  839. _GL_FUNCDECL_SYS (setusershell, void, (void));
  840. # endif
  841. _GL_CXXALIAS_SYS (setusershell, void, (void));
  842. _GL_CXXALIASWARN (setusershell);
  843. #elif defined GNULIB_POSIXCHECK
  844. # undef setusershell
  845. # if HAVE_RAW_DECL_SETUSERSHELL
  846. _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
  847. "use gnulib module getusershell for portability");
  848. # endif
  849. #endif
  850. #if @GNULIB_GETUSERSHELL@
  851. /* Free the pointer that is advanced at each getusershell() call and
  852. associated resources. */
  853. # if !@HAVE_DECL_GETUSERSHELL@
  854. _GL_FUNCDECL_SYS (endusershell, void, (void));
  855. # endif
  856. _GL_CXXALIAS_SYS (endusershell, void, (void));
  857. _GL_CXXALIASWARN (endusershell);
  858. #elif defined GNULIB_POSIXCHECK
  859. # undef endusershell
  860. # if HAVE_RAW_DECL_ENDUSERSHELL
  861. _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
  862. "use gnulib module getusershell for portability");
  863. # endif
  864. #endif
  865. #if @GNULIB_GROUP_MEMBER@
  866. /* Determine whether group id is in calling user's group list. */
  867. # if !@HAVE_GROUP_MEMBER@
  868. _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
  869. # endif
  870. _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
  871. _GL_CXXALIASWARN (group_member);
  872. #elif defined GNULIB_POSIXCHECK
  873. # undef group_member
  874. # if HAVE_RAW_DECL_GROUP_MEMBER
  875. _GL_WARN_ON_USE (group_member, "group_member is unportable - "
  876. "use gnulib module group-member for portability");
  877. # endif
  878. #endif
  879. #if @GNULIB_ISATTY@
  880. # if @REPLACE_ISATTY@
  881. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  882. # undef isatty
  883. # define isatty rpl_isatty
  884. # endif
  885. _GL_FUNCDECL_RPL (isatty, int, (int fd));
  886. _GL_CXXALIAS_RPL (isatty, int, (int fd));
  887. # else
  888. _GL_CXXALIAS_SYS (isatty, int, (int fd));
  889. # endif
  890. _GL_CXXALIASWARN (isatty);
  891. #elif defined GNULIB_POSIXCHECK
  892. # undef isatty
  893. # if HAVE_RAW_DECL_ISATTY
  894. _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
  895. "use gnulib module isatty for portability");
  896. # endif
  897. #endif
  898. #if @GNULIB_LCHOWN@
  899. /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
  900. to GID (if GID is not -1). Do not follow symbolic links.
  901. Return 0 if successful, otherwise -1 and errno set.
  902. See the POSIX:2008 specification
  903. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
  904. # if @REPLACE_LCHOWN@
  905. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  906. # undef lchown
  907. # define lchown rpl_lchown
  908. # endif
  909. _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
  910. _GL_ARG_NONNULL ((1)));
  911. _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
  912. # else
  913. # if !@HAVE_LCHOWN@
  914. _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
  915. _GL_ARG_NONNULL ((1)));
  916. # endif
  917. _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
  918. # endif
  919. _GL_CXXALIASWARN (lchown);
  920. #elif defined GNULIB_POSIXCHECK
  921. # undef lchown
  922. # if HAVE_RAW_DECL_LCHOWN
  923. _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
  924. "use gnulib module lchown for portability");
  925. # endif
  926. #endif
  927. #if @GNULIB_LINK@
  928. /* Create a new hard link for an existing file.
  929. Return 0 if successful, otherwise -1 and errno set.
  930. See POSIX:2008 specification
  931. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
  932. # if @REPLACE_LINK@
  933. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  934. # define link rpl_link
  935. # endif
  936. _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
  937. _GL_ARG_NONNULL ((1, 2)));
  938. _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
  939. # else
  940. # if !@HAVE_LINK@
  941. _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
  942. _GL_ARG_NONNULL ((1, 2)));
  943. # endif
  944. _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
  945. # endif
  946. _GL_CXXALIASWARN (link);
  947. #elif defined GNULIB_POSIXCHECK
  948. # undef link
  949. # if HAVE_RAW_DECL_LINK
  950. _GL_WARN_ON_USE (link, "link is unportable - "
  951. "use gnulib module link for portability");
  952. # endif
  953. #endif
  954. #if @GNULIB_LINKAT@
  955. /* Create a new hard link for an existing file, relative to two
  956. directories. FLAG controls whether symlinks are followed.
  957. Return 0 if successful, otherwise -1 and errno set. */
  958. # if @REPLACE_LINKAT@
  959. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  960. # undef linkat
  961. # define linkat rpl_linkat
  962. # endif
  963. _GL_FUNCDECL_RPL (linkat, int,
  964. (int fd1, const char *path1, int fd2, const char *path2,
  965. int flag)
  966. _GL_ARG_NONNULL ((2, 4)));
  967. _GL_CXXALIAS_RPL (linkat, int,
  968. (int fd1, const char *path1, int fd2, const char *path2,
  969. int flag));
  970. # else
  971. # if !@HAVE_LINKAT@
  972. _GL_FUNCDECL_SYS (linkat, int,
  973. (int fd1, const char *path1, int fd2, const char *path2,
  974. int flag)
  975. _GL_ARG_NONNULL ((2, 4)));
  976. # endif
  977. _GL_CXXALIAS_SYS (linkat, int,
  978. (int fd1, const char *path1, int fd2, const char *path2,
  979. int flag));
  980. # endif
  981. _GL_CXXALIASWARN (linkat);
  982. #elif defined GNULIB_POSIXCHECK
  983. # undef linkat
  984. # if HAVE_RAW_DECL_LINKAT
  985. _GL_WARN_ON_USE (linkat, "linkat is unportable - "
  986. "use gnulib module linkat for portability");
  987. # endif
  988. #endif
  989. #if @GNULIB_LSEEK@
  990. /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
  991. Return the new offset if successful, otherwise -1 and errno set.
  992. See the POSIX:2008 specification
  993. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
  994. # if @REPLACE_LSEEK@
  995. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  996. # define lseek rpl_lseek
  997. # endif
  998. _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
  999. _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
  1000. # else
  1001. _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
  1002. # endif
  1003. _GL_CXXALIASWARN (lseek);
  1004. #elif defined GNULIB_POSIXCHECK
  1005. # undef lseek
  1006. # if HAVE_RAW_DECL_LSEEK
  1007. _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
  1008. "systems - use gnulib module lseek for portability");
  1009. # endif
  1010. #endif
  1011. #if @GNULIB_PIPE@
  1012. /* Create a pipe, defaulting to O_BINARY mode.
  1013. Store the read-end as fd[0] and the write-end as fd[1].
  1014. Return 0 upon success, or -1 with errno set upon failure. */
  1015. # if !@HAVE_PIPE@
  1016. _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
  1017. # endif
  1018. _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
  1019. _GL_CXXALIASWARN (pipe);
  1020. #elif defined GNULIB_POSIXCHECK
  1021. # undef pipe
  1022. # if HAVE_RAW_DECL_PIPE
  1023. _GL_WARN_ON_USE (pipe, "pipe is unportable - "
  1024. "use gnulib module pipe-posix for portability");
  1025. # endif
  1026. #endif
  1027. #if @GNULIB_PIPE2@
  1028. /* Create a pipe, applying the given flags when opening the read-end of the
  1029. pipe and the write-end of the pipe.
  1030. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  1031. and O_TEXT, O_BINARY (defined in "binary-io.h").
  1032. Store the read-end as fd[0] and the write-end as fd[1].
  1033. Return 0 upon success, or -1 with errno set upon failure.
  1034. See also the Linux man page at
  1035. <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
  1036. # if @HAVE_PIPE2@
  1037. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1038. # define pipe2 rpl_pipe2
  1039. # endif
  1040. _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
  1041. _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
  1042. # else
  1043. _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
  1044. _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
  1045. # endif
  1046. _GL_CXXALIASWARN (pipe2);
  1047. #elif defined GNULIB_POSIXCHECK
  1048. # undef pipe2
  1049. # if HAVE_RAW_DECL_PIPE2
  1050. _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
  1051. "use gnulib module pipe2 for portability");
  1052. # endif
  1053. #endif
  1054. #if @GNULIB_PREAD@
  1055. /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
  1056. Return the number of bytes placed into BUF if successful, otherwise
  1057. set errno and return -1. 0 indicates EOF.
  1058. See the POSIX:2008 specification
  1059. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
  1060. # if @REPLACE_PREAD@
  1061. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1062. # undef pread
  1063. # define pread rpl_pread
  1064. # endif
  1065. _GL_FUNCDECL_RPL (pread, ssize_t,
  1066. (int fd, void *buf, size_t bufsize, off_t offset)
  1067. _GL_ARG_NONNULL ((2)));
  1068. _GL_CXXALIAS_RPL (pread, ssize_t,
  1069. (int fd, void *buf, size_t bufsize, off_t offset));
  1070. # else
  1071. # if !@HAVE_PREAD@
  1072. _GL_FUNCDECL_SYS (pread, ssize_t,
  1073. (int fd, void *buf, size_t bufsize, off_t offset)
  1074. _GL_ARG_NONNULL ((2)));
  1075. # endif
  1076. _GL_CXXALIAS_SYS (pread, ssize_t,
  1077. (int fd, void *buf, size_t bufsize, off_t offset));
  1078. # endif
  1079. _GL_CXXALIASWARN (pread);
  1080. #elif defined GNULIB_POSIXCHECK
  1081. # undef pread
  1082. # if HAVE_RAW_DECL_PREAD
  1083. _GL_WARN_ON_USE (pread, "pread is unportable - "
  1084. "use gnulib module pread for portability");
  1085. # endif
  1086. #endif
  1087. #if @GNULIB_PWRITE@
  1088. /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
  1089. Return the number of bytes written if successful, otherwise
  1090. set errno and return -1. 0 indicates nothing written. See the
  1091. POSIX:2008 specification
  1092. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
  1093. # if @REPLACE_PWRITE@
  1094. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1095. # undef pwrite
  1096. # define pwrite rpl_pwrite
  1097. # endif
  1098. _GL_FUNCDECL_RPL (pwrite, ssize_t,
  1099. (int fd, const void *buf, size_t bufsize, off_t offset)
  1100. _GL_ARG_NONNULL ((2)));
  1101. _GL_CXXALIAS_RPL (pwrite, ssize_t,
  1102. (int fd, const void *buf, size_t bufsize, off_t offset));
  1103. # else
  1104. # if !@HAVE_PWRITE@
  1105. _GL_FUNCDECL_SYS (pwrite, ssize_t,
  1106. (int fd, const void *buf, size_t bufsize, off_t offset)
  1107. _GL_ARG_NONNULL ((2)));
  1108. # endif
  1109. _GL_CXXALIAS_SYS (pwrite, ssize_t,
  1110. (int fd, const void *buf, size_t bufsize, off_t offset));
  1111. # endif
  1112. _GL_CXXALIASWARN (pwrite);
  1113. #elif defined GNULIB_POSIXCHECK
  1114. # undef pwrite
  1115. # if HAVE_RAW_DECL_PWRITE
  1116. _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
  1117. "use gnulib module pwrite for portability");
  1118. # endif
  1119. #endif
  1120. #if @GNULIB_READ@
  1121. /* Read up to COUNT bytes from file descriptor FD into the buffer starting
  1122. at BUF. See the POSIX:2008 specification
  1123. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
  1124. # if @REPLACE_READ@
  1125. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1126. # undef read
  1127. # define read rpl_read
  1128. # endif
  1129. _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
  1130. _GL_ARG_NONNULL ((2)));
  1131. _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
  1132. # else
  1133. /* Need to cast, because on mingw, the third parameter is
  1134. unsigned int count
  1135. and the return type is 'int'. */
  1136. _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
  1137. # endif
  1138. _GL_CXXALIASWARN (read);
  1139. #endif
  1140. #if @GNULIB_READLINK@
  1141. /* Read the contents of the symbolic link FILE and place the first BUFSIZE
  1142. bytes of it into BUF. Return the number of bytes placed into BUF if
  1143. successful, otherwise -1 and errno set.
  1144. See the POSIX:2008 specification
  1145. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
  1146. # if @REPLACE_READLINK@
  1147. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1148. # define readlink rpl_readlink
  1149. # endif
  1150. _GL_FUNCDECL_RPL (readlink, ssize_t,
  1151. (const char *file, char *buf, size_t bufsize)
  1152. _GL_ARG_NONNULL ((1, 2)));
  1153. _GL_CXXALIAS_RPL (readlink, ssize_t,
  1154. (const char *file, char *buf, size_t bufsize));
  1155. # else
  1156. # if !@HAVE_READLINK@
  1157. _GL_FUNCDECL_SYS (readlink, ssize_t,
  1158. (const char *file, char *buf, size_t bufsize)
  1159. _GL_ARG_NONNULL ((1, 2)));
  1160. # endif
  1161. _GL_CXXALIAS_SYS (readlink, ssize_t,
  1162. (const char *file, char *buf, size_t bufsize));
  1163. # endif
  1164. _GL_CXXALIASWARN (readlink);
  1165. #elif defined GNULIB_POSIXCHECK
  1166. # undef readlink
  1167. # if HAVE_RAW_DECL_READLINK
  1168. _GL_WARN_ON_USE (readlink, "readlink is unportable - "
  1169. "use gnulib module readlink for portability");
  1170. # endif
  1171. #endif
  1172. #if @GNULIB_READLINKAT@
  1173. # if !@HAVE_READLINKAT@
  1174. _GL_FUNCDECL_SYS (readlinkat, ssize_t,
  1175. (int fd, char const *file, char *buf, size_t len)
  1176. _GL_ARG_NONNULL ((2, 3)));
  1177. # endif
  1178. _GL_CXXALIAS_SYS (readlinkat, ssize_t,
  1179. (int fd, char const *file, char *buf, size_t len));
  1180. _GL_CXXALIASWARN (readlinkat);
  1181. #elif defined GNULIB_POSIXCHECK
  1182. # undef readlinkat
  1183. # if HAVE_RAW_DECL_READLINKAT
  1184. _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
  1185. "use gnulib module readlinkat for portability");
  1186. # endif
  1187. #endif
  1188. #if @GNULIB_RMDIR@
  1189. /* Remove the directory DIR. */
  1190. # if @REPLACE_RMDIR@
  1191. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1192. # define rmdir rpl_rmdir
  1193. # endif
  1194. _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
  1195. _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
  1196. # else
  1197. _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
  1198. # endif
  1199. _GL_CXXALIASWARN (rmdir);
  1200. #elif defined GNULIB_POSIXCHECK
  1201. # undef rmdir
  1202. # if HAVE_RAW_DECL_RMDIR
  1203. _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
  1204. "use gnulib module rmdir for portability");
  1205. # endif
  1206. #endif
  1207. #if @GNULIB_SETHOSTNAME@
  1208. /* Set the host name of the machine.
  1209. The host name may or may not be fully qualified.
  1210. Put LEN bytes of NAME into the host name.
  1211. Return 0 if successful, otherwise, set errno and return -1.
  1212. Platforms with no ability to set the hostname return -1 and set
  1213. errno = ENOSYS. */
  1214. # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
  1215. _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
  1216. _GL_ARG_NONNULL ((1)));
  1217. # endif
  1218. /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
  1219. and FreeBSD 6.4 the second parameter is int. On Solaris 11
  1220. 2011-10, the first parameter is not const. */
  1221. _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
  1222. _GL_CXXALIASWARN (sethostname);
  1223. #elif defined GNULIB_POSIXCHECK
  1224. # undef sethostname
  1225. # if HAVE_RAW_DECL_SETHOSTNAME
  1226. _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
  1227. "use gnulib module sethostname for portability");
  1228. # endif
  1229. #endif
  1230. #if @GNULIB_SLEEP@
  1231. /* Pause the execution of the current thread for N seconds.
  1232. Returns the number of seconds left to sleep.
  1233. See the POSIX:2008 specification
  1234. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
  1235. # if @REPLACE_SLEEP@
  1236. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1237. # undef sleep
  1238. # define sleep rpl_sleep
  1239. # endif
  1240. _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
  1241. _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
  1242. # else
  1243. # if !@HAVE_SLEEP@
  1244. _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
  1245. # endif
  1246. _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
  1247. # endif
  1248. _GL_CXXALIASWARN (sleep);
  1249. #elif defined GNULIB_POSIXCHECK
  1250. # undef sleep
  1251. # if HAVE_RAW_DECL_SLEEP
  1252. _GL_WARN_ON_USE (sleep, "sleep is unportable - "
  1253. "use gnulib module sleep for portability");
  1254. # endif
  1255. #endif
  1256. #if @GNULIB_SYMLINK@
  1257. # if @REPLACE_SYMLINK@
  1258. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1259. # undef symlink
  1260. # define symlink rpl_symlink
  1261. # endif
  1262. _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
  1263. _GL_ARG_NONNULL ((1, 2)));
  1264. _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
  1265. # else
  1266. # if !@HAVE_SYMLINK@
  1267. _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
  1268. _GL_ARG_NONNULL ((1, 2)));
  1269. # endif
  1270. _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
  1271. # endif
  1272. _GL_CXXALIASWARN (symlink);
  1273. #elif defined GNULIB_POSIXCHECK
  1274. # undef symlink
  1275. # if HAVE_RAW_DECL_SYMLINK
  1276. _GL_WARN_ON_USE (symlink, "symlink is not portable - "
  1277. "use gnulib module symlink for portability");
  1278. # endif
  1279. #endif
  1280. #if @GNULIB_SYMLINKAT@
  1281. # if !@HAVE_SYMLINKAT@
  1282. _GL_FUNCDECL_SYS (symlinkat, int,
  1283. (char const *contents, int fd, char const *file)
  1284. _GL_ARG_NONNULL ((1, 3)));
  1285. # endif
  1286. _GL_CXXALIAS_SYS (symlinkat, int,
  1287. (char const *contents, int fd, char const *file));
  1288. _GL_CXXALIASWARN (symlinkat);
  1289. #elif defined GNULIB_POSIXCHECK
  1290. # undef symlinkat
  1291. # if HAVE_RAW_DECL_SYMLINKAT
  1292. _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
  1293. "use gnulib module symlinkat for portability");
  1294. # endif
  1295. #endif
  1296. #if @GNULIB_TTYNAME_R@
  1297. /* Store at most BUFLEN characters of the pathname of the terminal FD is
  1298. open on in BUF. Return 0 on success, otherwise an error number. */
  1299. # if @REPLACE_TTYNAME_R@
  1300. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1301. # undef ttyname_r
  1302. # define ttyname_r rpl_ttyname_r
  1303. # endif
  1304. _GL_FUNCDECL_RPL (ttyname_r, int,
  1305. (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
  1306. _GL_CXXALIAS_RPL (ttyname_r, int,
  1307. (int fd, char *buf, size_t buflen));
  1308. # else
  1309. # if !@HAVE_DECL_TTYNAME_R@
  1310. _GL_FUNCDECL_SYS (ttyname_r, int,
  1311. (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
  1312. # endif
  1313. _GL_CXXALIAS_SYS (ttyname_r, int,
  1314. (int fd, char *buf, size_t buflen));
  1315. # endif
  1316. _GL_CXXALIASWARN (ttyname_r);
  1317. #elif defined GNULIB_POSIXCHECK
  1318. # undef ttyname_r
  1319. # if HAVE_RAW_DECL_TTYNAME_R
  1320. _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
  1321. "use gnulib module ttyname_r for portability");
  1322. # endif
  1323. #endif
  1324. #if @GNULIB_UNLINK@
  1325. # if @REPLACE_UNLINK@
  1326. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1327. # undef unlink
  1328. # define unlink rpl_unlink
  1329. # endif
  1330. _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
  1331. _GL_CXXALIAS_RPL (unlink, int, (char const *file));
  1332. # else
  1333. _GL_CXXALIAS_SYS (unlink, int, (char const *file));
  1334. # endif
  1335. _GL_CXXALIASWARN (unlink);
  1336. #elif defined GNULIB_POSIXCHECK
  1337. # undef unlink
  1338. # if HAVE_RAW_DECL_UNLINK
  1339. _GL_WARN_ON_USE (unlink, "unlink is not portable - "
  1340. "use gnulib module unlink for portability");
  1341. # endif
  1342. #endif
  1343. #if @GNULIB_UNLINKAT@
  1344. # if @REPLACE_UNLINKAT@
  1345. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1346. # undef unlinkat
  1347. # define unlinkat rpl_unlinkat
  1348. # endif
  1349. _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
  1350. _GL_ARG_NONNULL ((2)));
  1351. _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
  1352. # else
  1353. # if !@HAVE_UNLINKAT@
  1354. _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
  1355. _GL_ARG_NONNULL ((2)));
  1356. # endif
  1357. _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
  1358. # endif
  1359. _GL_CXXALIASWARN (unlinkat);
  1360. #elif defined GNULIB_POSIXCHECK
  1361. # undef unlinkat
  1362. # if HAVE_RAW_DECL_UNLINKAT
  1363. _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
  1364. "use gnulib module openat for portability");
  1365. # endif
  1366. #endif
  1367. #if @GNULIB_USLEEP@
  1368. /* Pause the execution of the current thread for N microseconds.
  1369. Returns 0 on completion, or -1 on range error.
  1370. See the POSIX:2001 specification
  1371. <http://www.opengroup.org/susv3xsh/usleep.html>. */
  1372. # if @REPLACE_USLEEP@
  1373. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1374. # undef usleep
  1375. # define usleep rpl_usleep
  1376. # endif
  1377. _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
  1378. _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
  1379. # else
  1380. # if !@HAVE_USLEEP@
  1381. _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
  1382. # endif
  1383. _GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
  1384. # endif
  1385. _GL_CXXALIASWARN (usleep);
  1386. #elif defined GNULIB_POSIXCHECK
  1387. # undef usleep
  1388. # if HAVE_RAW_DECL_USLEEP
  1389. _GL_WARN_ON_USE (usleep, "usleep is unportable - "
  1390. "use gnulib module usleep for portability");
  1391. # endif
  1392. #endif
  1393. #if @GNULIB_WRITE@
  1394. /* Write up to COUNT bytes starting at BUF to file descriptor FD.
  1395. See the POSIX:2008 specification
  1396. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
  1397. # if @REPLACE_WRITE@
  1398. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1399. # undef write
  1400. # define write rpl_write
  1401. # endif
  1402. _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
  1403. _GL_ARG_NONNULL ((2)));
  1404. _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
  1405. # else
  1406. /* Need to cast, because on mingw, the third parameter is
  1407. unsigned int count
  1408. and the return type is 'int'. */
  1409. _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
  1410. # endif
  1411. _GL_CXXALIASWARN (write);
  1412. #endif
  1413. _GL_INLINE_HEADER_END
  1414. #endif /* _@GUARD_PREFIX@_UNISTD_H */
  1415. #endif /* _GL_INCLUDING_UNISTD_H */
  1416. #endif /* _@GUARD_PREFIX@_UNISTD_H */