unistd.in.h 53 KB

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