unistd.in.h 51 KB

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