unistd.in.h 78 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313
  1. /* Substitute for and wrapper around <unistd.h>.
  2. Copyright (C) 2003-2021 Free Software Foundation, Inc.
  3. This file is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as
  5. published by the Free Software Foundation; either version 2.1 of the
  6. License, or (at your option) any later version.
  7. This file 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 <https://www.gnu.org/licenses/>. */
  13. #ifndef _@GUARD_PREFIX@_UNISTD_H
  14. #if __GNUC__ >= 3
  15. @PRAGMA_SYSTEM_HEADER@
  16. #endif
  17. @PRAGMA_COLUMNS@
  18. #if @HAVE_UNISTD_H@ && defined _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. /* But avoid namespace pollution on glibc systems. */
  44. #ifndef __GLIBC__
  45. # include <stddef.h>
  46. #endif
  47. /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
  48. /* MSVC declares 'unlink' in <stdio.h>, not in <unistd.h>. We must include
  49. it before we #define unlink rpl_unlink. */
  50. /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
  51. /* But avoid namespace pollution on glibc systems. */
  52. #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
  53. || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \
  54. && (defined _WIN32 && ! defined __CYGWIN__)) \
  55. || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
  56. && defined __CYGWIN__)) \
  57. && ! defined __GLIBC__
  58. # include <stdio.h>
  59. #endif
  60. /* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
  61. <unistd.h>. */
  62. /* But avoid namespace pollution on glibc systems. */
  63. #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
  64. && (defined __CYGWIN__ || defined __ANDROID__) \
  65. && ! defined __GLIBC__
  66. # include <fcntl.h>
  67. #endif
  68. /* mingw fails to declare _exit in <unistd.h>. */
  69. /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
  70. <unistd.h>. */
  71. /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
  72. /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
  73. included here. */
  74. /* But avoid namespace pollution on glibc systems. */
  75. #if !defined __GLIBC__ && !defined __osf__
  76. # define __need_system_stdlib_h
  77. # include <stdlib.h>
  78. # undef __need_system_stdlib_h
  79. #endif
  80. /* Native Windows platforms declare _chdir, _getcwd, _rmdir in
  81. <io.h> and/or <direct.h>, not in <unistd.h>.
  82. They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
  83. _lseek(), _read(), _unlink(), _write() in <io.h>. */
  84. #if defined _WIN32 && !defined __CYGWIN__
  85. # include <io.h>
  86. # include <direct.h>
  87. #endif
  88. /* Native Windows platforms declare _execl*, _execv* in <process.h>. */
  89. #if defined _WIN32 && !defined __CYGWIN__
  90. # include <process.h>
  91. #endif
  92. /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
  93. NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
  94. /* But avoid namespace pollution on glibc systems. */
  95. #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
  96. || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
  97. && !defined __GLIBC__
  98. # include <netdb.h>
  99. #endif
  100. /* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in
  101. <sys/random.h>, not in <unistd.h>. */
  102. /* But avoid namespace pollution on glibc systems. */
  103. #if (@GNULIB_GETENTROPY@ || defined GNULIB_POSIXCHECK) \
  104. && ((defined __APPLE__ && defined __MACH__) || defined __sun \
  105. || defined __ANDROID__) \
  106. && @UNISTD_H_HAVE_SYS_RANDOM_H@ \
  107. && !defined __GLIBC__
  108. # include <sys/random.h>
  109. #endif
  110. /* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */
  111. /* But avoid namespace pollution on glibc systems. */
  112. #if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
  113. && !defined __GLIBC__
  114. # include <sys/stat.h>
  115. #endif
  116. /* MSVC defines off_t in <sys/types.h>.
  117. May also define off_t to a 64-bit type on native Windows. */
  118. /* Get off_t, ssize_t, mode_t. */
  119. #include <sys/types.h>
  120. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  121. /* The definition of _GL_ARG_NONNULL is copied here. */
  122. /* The definition of _GL_WARN_ON_USE is copied here. */
  123. /* Get getopt(), optarg, optind, opterr, optopt. */
  124. #if @GNULIB_GETOPT_POSIX@ && @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
  125. # include <getopt-cdefs.h>
  126. # include <getopt-pfx-core.h>
  127. #endif
  128. #ifndef _GL_INLINE_HEADER_BEGIN
  129. #error "Please include config.h first."
  130. #endif
  131. _GL_INLINE_HEADER_BEGIN
  132. #ifndef _GL_UNISTD_INLINE
  133. # define _GL_UNISTD_INLINE _GL_INLINE
  134. #endif
  135. /* Hide some function declarations from <winsock2.h>. */
  136. #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
  137. # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
  138. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  139. # undef socket
  140. # define socket socket_used_without_including_sys_socket_h
  141. # undef connect
  142. # define connect connect_used_without_including_sys_socket_h
  143. # undef accept
  144. # define accept accept_used_without_including_sys_socket_h
  145. # undef bind
  146. # define bind bind_used_without_including_sys_socket_h
  147. # undef getpeername
  148. # define getpeername getpeername_used_without_including_sys_socket_h
  149. # undef getsockname
  150. # define getsockname getsockname_used_without_including_sys_socket_h
  151. # undef getsockopt
  152. # define getsockopt getsockopt_used_without_including_sys_socket_h
  153. # undef listen
  154. # define listen listen_used_without_including_sys_socket_h
  155. # undef recv
  156. # define recv recv_used_without_including_sys_socket_h
  157. # undef send
  158. # define send send_used_without_including_sys_socket_h
  159. # undef recvfrom
  160. # define recvfrom recvfrom_used_without_including_sys_socket_h
  161. # undef sendto
  162. # define sendto sendto_used_without_including_sys_socket_h
  163. # undef setsockopt
  164. # define setsockopt setsockopt_used_without_including_sys_socket_h
  165. # undef shutdown
  166. # define shutdown shutdown_used_without_including_sys_socket_h
  167. # else
  168. _GL_WARN_ON_USE (socket,
  169. "socket() used without including <sys/socket.h>");
  170. _GL_WARN_ON_USE (connect,
  171. "connect() used without including <sys/socket.h>");
  172. _GL_WARN_ON_USE (accept,
  173. "accept() used without including <sys/socket.h>");
  174. _GL_WARN_ON_USE (bind,
  175. "bind() used without including <sys/socket.h>");
  176. _GL_WARN_ON_USE (getpeername,
  177. "getpeername() used without including <sys/socket.h>");
  178. _GL_WARN_ON_USE (getsockname,
  179. "getsockname() used without including <sys/socket.h>");
  180. _GL_WARN_ON_USE (getsockopt,
  181. "getsockopt() used without including <sys/socket.h>");
  182. _GL_WARN_ON_USE (listen,
  183. "listen() used without including <sys/socket.h>");
  184. _GL_WARN_ON_USE (recv,
  185. "recv() used without including <sys/socket.h>");
  186. _GL_WARN_ON_USE (send,
  187. "send() used without including <sys/socket.h>");
  188. _GL_WARN_ON_USE (recvfrom,
  189. "recvfrom() used without including <sys/socket.h>");
  190. _GL_WARN_ON_USE (sendto,
  191. "sendto() used without including <sys/socket.h>");
  192. _GL_WARN_ON_USE (setsockopt,
  193. "setsockopt() used without including <sys/socket.h>");
  194. _GL_WARN_ON_USE (shutdown,
  195. "shutdown() used without including <sys/socket.h>");
  196. # endif
  197. # endif
  198. # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
  199. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  200. # undef select
  201. # define select select_used_without_including_sys_select_h
  202. # else
  203. _GL_WARN_ON_USE (select,
  204. "select() used without including <sys/select.h>");
  205. # endif
  206. # endif
  207. #endif
  208. /* OS/2 EMX lacks these macros. */
  209. #ifndef STDIN_FILENO
  210. # define STDIN_FILENO 0
  211. #endif
  212. #ifndef STDOUT_FILENO
  213. # define STDOUT_FILENO 1
  214. #endif
  215. #ifndef STDERR_FILENO
  216. # define STDERR_FILENO 2
  217. #endif
  218. /* Ensure *_OK macros exist. */
  219. #ifndef F_OK
  220. # define F_OK 0
  221. # define X_OK 1
  222. # define W_OK 2
  223. # define R_OK 4
  224. #endif
  225. /* Declare overridden functions. */
  226. #if @GNULIB_ACCESS@
  227. # if @REPLACE_ACCESS@
  228. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  229. # undef access
  230. # define access rpl_access
  231. # endif
  232. _GL_FUNCDECL_RPL (access, int, (const char *file, int mode)
  233. _GL_ARG_NONNULL ((1)));
  234. _GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
  235. # elif defined _WIN32 && !defined __CYGWIN__
  236. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  237. # undef access
  238. # define access _access
  239. # endif
  240. _GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
  241. # else
  242. _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
  243. # endif
  244. _GL_CXXALIASWARN (access);
  245. #elif defined GNULIB_POSIXCHECK
  246. # undef access
  247. # if HAVE_RAW_DECL_ACCESS
  248. /* The access() function is a security risk. */
  249. _GL_WARN_ON_USE (access, "access does not always support X_OK - "
  250. "use gnulib module access for portability; "
  251. "also, this function is a security risk - "
  252. "use the gnulib module faccessat instead");
  253. # endif
  254. #elif @GNULIB_MDA_ACCESS@
  255. /* On native Windows, map 'access' to '_access', so that -loldnames is not
  256. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  257. platforms by defining GNULIB_NAMESPACE::access always. */
  258. # if defined _WIN32 && !defined __CYGWIN__
  259. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  260. # undef access
  261. # define access _access
  262. # endif
  263. _GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
  264. # else
  265. _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
  266. # endif
  267. _GL_CXXALIASWARN (access);
  268. #endif
  269. #if @GNULIB_CHDIR@
  270. # if defined _WIN32 && !defined __CYGWIN__
  271. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  272. # undef chdir
  273. # define chdir _chdir
  274. # endif
  275. _GL_CXXALIAS_MDA (chdir, int, (const char *file));
  276. # else
  277. _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
  278. # endif
  279. _GL_CXXALIASWARN (chdir);
  280. #elif defined GNULIB_POSIXCHECK
  281. # undef chdir
  282. # if HAVE_RAW_DECL_CHDIR
  283. _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
  284. "use gnulib module chdir for portability");
  285. # endif
  286. #elif @GNULIB_MDA_CHDIR@
  287. /* On native Windows, map 'chdir' to '_chdir', so that -loldnames is not
  288. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  289. platforms by defining GNULIB_NAMESPACE::chdir always. */
  290. # if defined _WIN32 && !defined __CYGWIN__
  291. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  292. # undef chdir
  293. # define chdir _chdir
  294. # endif
  295. _GL_CXXALIAS_MDA (chdir, int, (const char *file));
  296. # else
  297. _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
  298. # endif
  299. _GL_CXXALIASWARN (chdir);
  300. #endif
  301. #if @GNULIB_CHOWN@
  302. /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
  303. to GID (if GID is not -1). Follow symbolic links.
  304. Return 0 if successful, otherwise -1 and errno set.
  305. See the POSIX:2008 specification
  306. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
  307. # if @REPLACE_CHOWN@
  308. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  309. # undef chown
  310. # define chown rpl_chown
  311. # endif
  312. _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
  313. _GL_ARG_NONNULL ((1)));
  314. _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
  315. # else
  316. # if !@HAVE_CHOWN@
  317. _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
  318. _GL_ARG_NONNULL ((1)));
  319. # endif
  320. _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
  321. # endif
  322. _GL_CXXALIASWARN (chown);
  323. #elif defined GNULIB_POSIXCHECK
  324. # undef chown
  325. # if HAVE_RAW_DECL_CHOWN
  326. _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
  327. "doesn't treat a uid or gid of -1 on some systems - "
  328. "use gnulib module chown for portability");
  329. # endif
  330. #endif
  331. #if @GNULIB_CLOSE@
  332. # if @REPLACE_CLOSE@
  333. /* Automatically included by modules that need a replacement for close. */
  334. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  335. # undef close
  336. # define close rpl_close
  337. # endif
  338. _GL_FUNCDECL_RPL (close, int, (int fd));
  339. _GL_CXXALIAS_RPL (close, int, (int fd));
  340. # elif defined _WIN32 && !defined __CYGWIN__
  341. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  342. # undef close
  343. # define close _close
  344. # endif
  345. _GL_CXXALIAS_MDA (close, int, (int fd));
  346. # else
  347. _GL_CXXALIAS_SYS (close, int, (int fd));
  348. # endif
  349. _GL_CXXALIASWARN (close);
  350. #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
  351. # undef close
  352. # define close close_used_without_requesting_gnulib_module_close
  353. #elif defined GNULIB_POSIXCHECK
  354. # undef close
  355. /* Assume close is always declared. */
  356. _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
  357. "use gnulib module close for portability");
  358. #elif @GNULIB_MDA_CLOSE@
  359. /* On native Windows, map 'close' to '_close', so that -loldnames is not
  360. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  361. platforms by defining GNULIB_NAMESPACE::close always. */
  362. # if defined _WIN32 && !defined __CYGWIN__
  363. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  364. # undef close
  365. # define close _close
  366. # endif
  367. _GL_CXXALIAS_MDA (close, int, (int fd));
  368. # else
  369. _GL_CXXALIAS_SYS (close, int, (int fd));
  370. # endif
  371. _GL_CXXALIASWARN (close);
  372. #endif
  373. #if @GNULIB_COPY_FILE_RANGE@
  374. # if !@HAVE_COPY_FILE_RANGE@
  375. _GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
  376. int ofd, off_t *opos,
  377. size_t len, unsigned flags));
  378. _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
  379. int ofd, off_t *opos,
  380. size_t len, unsigned flags));
  381. # endif
  382. _GL_CXXALIASWARN (copy_file_range);
  383. #elif defined GNULIB_POSIXCHECK
  384. # if HAVE_RAW_DECL_COPY_FILE_RANGE
  385. _GL_WARN_ON_USE (copy_file_range,
  386. "copy_file_range is unportable - "
  387. "use gnulib module copy_file_range for portability");
  388. # endif
  389. #endif
  390. #if @GNULIB_DUP@
  391. # if @REPLACE_DUP@
  392. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  393. # define dup rpl_dup
  394. # endif
  395. _GL_FUNCDECL_RPL (dup, int, (int oldfd));
  396. _GL_CXXALIAS_RPL (dup, int, (int oldfd));
  397. # elif defined _WIN32 && !defined __CYGWIN__
  398. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  399. # undef dup
  400. # define dup _dup
  401. # endif
  402. _GL_CXXALIAS_MDA (dup, int, (int oldfd));
  403. # else
  404. _GL_CXXALIAS_SYS (dup, int, (int oldfd));
  405. # endif
  406. _GL_CXXALIASWARN (dup);
  407. #elif defined GNULIB_POSIXCHECK
  408. # undef dup
  409. # if HAVE_RAW_DECL_DUP
  410. _GL_WARN_ON_USE (dup, "dup is unportable - "
  411. "use gnulib module dup for portability");
  412. # endif
  413. #elif @GNULIB_MDA_DUP@
  414. /* On native Windows, map 'dup' to '_dup', so that -loldnames is not
  415. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  416. platforms by defining GNULIB_NAMESPACE::dup always. */
  417. # if defined _WIN32 && !defined __CYGWIN__
  418. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  419. # undef dup
  420. # define dup _dup
  421. # endif
  422. _GL_CXXALIAS_MDA (dup, int, (int oldfd));
  423. # else
  424. _GL_CXXALIAS_SYS (dup, int, (int oldfd));
  425. # endif
  426. _GL_CXXALIASWARN (dup);
  427. #endif
  428. #if @GNULIB_DUP2@
  429. /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
  430. NEWFD = OLDFD, otherwise close NEWFD first if it is open.
  431. Return newfd if successful, otherwise -1 and errno set.
  432. See the POSIX:2008 specification
  433. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
  434. # if @REPLACE_DUP2@
  435. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  436. # define dup2 rpl_dup2
  437. # endif
  438. _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
  439. _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
  440. # elif defined _WIN32 && !defined __CYGWIN__
  441. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  442. # undef dup2
  443. # define dup2 _dup2
  444. # endif
  445. _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
  446. # else
  447. _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
  448. # endif
  449. _GL_CXXALIASWARN (dup2);
  450. #elif defined GNULIB_POSIXCHECK
  451. # undef dup2
  452. # if HAVE_RAW_DECL_DUP2
  453. _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
  454. "use gnulib module dup2 for portability");
  455. # endif
  456. #elif @GNULIB_MDA_DUP2@
  457. /* On native Windows, map 'dup2' to '_dup2', so that -loldnames is not
  458. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  459. platforms by defining GNULIB_NAMESPACE::dup2 always. */
  460. # if defined _WIN32 && !defined __CYGWIN__
  461. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  462. # undef dup2
  463. # define dup2 _dup2
  464. # endif
  465. _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
  466. # else
  467. _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
  468. # endif
  469. _GL_CXXALIASWARN (dup2);
  470. #endif
  471. #if @GNULIB_DUP3@
  472. /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
  473. specified flags.
  474. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  475. and O_TEXT, O_BINARY (defined in "binary-io.h").
  476. Close NEWFD first if it is open.
  477. Return newfd if successful, otherwise -1 and errno set.
  478. See the Linux man page at
  479. <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
  480. # if @HAVE_DUP3@
  481. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  482. # define dup3 rpl_dup3
  483. # endif
  484. _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
  485. _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
  486. # else
  487. _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
  488. _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
  489. # endif
  490. _GL_CXXALIASWARN (dup3);
  491. #elif defined GNULIB_POSIXCHECK
  492. # undef dup3
  493. # if HAVE_RAW_DECL_DUP3
  494. _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
  495. "use gnulib module dup3 for portability");
  496. # endif
  497. #endif
  498. #if @GNULIB_ENVIRON@
  499. # if defined __CYGWIN__ && !defined __i386__
  500. /* The 'environ' variable is defined in a DLL. Therefore its declaration needs
  501. the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it.
  502. This leads to a link error on 64-bit Cygwin when the option
  503. -Wl,--disable-auto-import is in use. */
  504. _GL_EXTERN_C __declspec(dllimport) char **environ;
  505. # endif
  506. # if !@HAVE_DECL_ENVIRON@
  507. /* Set of environment variables and values. An array of strings of the form
  508. "VARIABLE=VALUE", terminated with a NULL. */
  509. # if defined __APPLE__ && defined __MACH__
  510. # include <TargetConditionals.h>
  511. # if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
  512. # define _GL_USE_CRT_EXTERNS
  513. # endif
  514. # endif
  515. # ifdef _GL_USE_CRT_EXTERNS
  516. # include <crt_externs.h>
  517. # define environ (*_NSGetEnviron ())
  518. # else
  519. # ifdef __cplusplus
  520. extern "C" {
  521. # endif
  522. extern char **environ;
  523. # ifdef __cplusplus
  524. }
  525. # endif
  526. # endif
  527. # endif
  528. #elif defined GNULIB_POSIXCHECK
  529. # if HAVE_RAW_DECL_ENVIRON
  530. _GL_UNISTD_INLINE char ***
  531. _GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - "
  532. "use gnulib module environ for portability")
  533. rpl_environ (void)
  534. {
  535. return &environ;
  536. }
  537. # undef environ
  538. # define environ (*rpl_environ ())
  539. # endif
  540. #endif
  541. #if @GNULIB_EUIDACCESS@
  542. /* Like access(), except that it uses the effective user id and group id of
  543. the current process. */
  544. # if !@HAVE_EUIDACCESS@
  545. _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
  546. _GL_ARG_NONNULL ((1)));
  547. # endif
  548. _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
  549. _GL_CXXALIASWARN (euidaccess);
  550. # if defined GNULIB_POSIXCHECK
  551. /* Like access(), this function is a security risk. */
  552. _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
  553. "use the gnulib module faccessat instead");
  554. # endif
  555. #elif defined GNULIB_POSIXCHECK
  556. # undef euidaccess
  557. # if HAVE_RAW_DECL_EUIDACCESS
  558. _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
  559. "use gnulib module euidaccess for portability");
  560. # endif
  561. #endif
  562. #if @GNULIB_EXECL@
  563. # if @REPLACE_EXECL@
  564. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  565. # undef execl
  566. # define execl rpl_execl
  567. # endif
  568. _GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...)
  569. _GL_ARG_NONNULL ((1)));
  570. _GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
  571. # else
  572. _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
  573. # endif
  574. _GL_CXXALIASWARN (execl);
  575. #elif defined GNULIB_POSIXCHECK
  576. # undef execl
  577. # if HAVE_RAW_DECL_EXECL
  578. _GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - "
  579. "use gnulib module execl for portability");
  580. # endif
  581. #elif @GNULIB_MDA_EXECL@
  582. /* On native Windows, map 'execl' to '_execl', so that -loldnames is not
  583. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  584. platforms by defining GNULIB_NAMESPACE::execl always. */
  585. # if defined _WIN32 && !defined __CYGWIN__
  586. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  587. # undef execl
  588. # define execl _execl
  589. # endif
  590. _GL_CXXALIAS_MDA (execl, intptr_t, (const char *program, const char *arg, ...));
  591. # else
  592. _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
  593. # endif
  594. _GL_CXXALIASWARN (execl);
  595. #endif
  596. #if @GNULIB_EXECLE@
  597. # if @REPLACE_EXECLE@
  598. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  599. # undef execle
  600. # define execle rpl_execle
  601. # endif
  602. _GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...)
  603. _GL_ARG_NONNULL ((1)));
  604. _GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
  605. # else
  606. _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
  607. # endif
  608. _GL_CXXALIASWARN (execle);
  609. #elif defined GNULIB_POSIXCHECK
  610. # undef execle
  611. # if HAVE_RAW_DECL_EXECLE
  612. _GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - "
  613. "use gnulib module execle for portability");
  614. # endif
  615. #elif @GNULIB_MDA_EXECLE@
  616. /* On native Windows, map 'execle' to '_execle', so that -loldnames is not
  617. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  618. platforms by defining GNULIB_NAMESPACE::execle always. */
  619. # if defined _WIN32 && !defined __CYGWIN__
  620. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  621. # undef execle
  622. # define execle _execle
  623. # endif
  624. _GL_CXXALIAS_MDA (execle, intptr_t,
  625. (const char *program, const char *arg, ...));
  626. # else
  627. _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
  628. # endif
  629. _GL_CXXALIASWARN (execle);
  630. #endif
  631. #if @GNULIB_EXECLP@
  632. # if @REPLACE_EXECLP@
  633. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  634. # undef execlp
  635. # define execlp rpl_execlp
  636. # endif
  637. _GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...)
  638. _GL_ARG_NONNULL ((1)));
  639. _GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
  640. # else
  641. _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
  642. # endif
  643. _GL_CXXALIASWARN (execlp);
  644. #elif defined GNULIB_POSIXCHECK
  645. # undef execlp
  646. # if HAVE_RAW_DECL_EXECLP
  647. _GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - "
  648. "use gnulib module execlp for portability");
  649. # endif
  650. #elif @GNULIB_MDA_EXECLP@
  651. /* On native Windows, map 'execlp' to '_execlp', so that -loldnames is not
  652. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  653. platforms by defining GNULIB_NAMESPACE::execlp always. */
  654. # if defined _WIN32 && !defined __CYGWIN__
  655. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  656. # undef execlp
  657. # define execlp _execlp
  658. # endif
  659. _GL_CXXALIAS_MDA (execlp, intptr_t,
  660. (const char *program, const char *arg, ...));
  661. # else
  662. _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
  663. # endif
  664. _GL_CXXALIASWARN (execlp);
  665. #endif
  666. #if @GNULIB_EXECV@
  667. # if @REPLACE_EXECV@
  668. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  669. # undef execv
  670. # define execv rpl_execv
  671. # endif
  672. _GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv)
  673. _GL_ARG_NONNULL ((1, 2)));
  674. _GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
  675. # else
  676. _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
  677. # endif
  678. _GL_CXXALIASWARN (execv);
  679. #elif defined GNULIB_POSIXCHECK
  680. # undef execv
  681. # if HAVE_RAW_DECL_EXECV
  682. _GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - "
  683. "use gnulib module execv for portability");
  684. # endif
  685. #elif @GNULIB_MDA_EXECV@
  686. /* On native Windows, map 'execv' to '_execv', so that -loldnames is not
  687. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  688. platforms by defining GNULIB_NAMESPACE::execv always. */
  689. # if defined _WIN32 && !defined __CYGWIN__
  690. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  691. # undef execv
  692. # define execv _execv
  693. # endif
  694. _GL_CXXALIAS_MDA_CAST (execv, intptr_t,
  695. (const char *program, char * const *argv));
  696. # else
  697. _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
  698. # endif
  699. _GL_CXXALIASWARN (execv);
  700. #endif
  701. #if @GNULIB_EXECVE@
  702. # if @REPLACE_EXECVE@
  703. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  704. # undef execve
  705. # define execve rpl_execve
  706. # endif
  707. _GL_FUNCDECL_RPL (execve, int,
  708. (const char *program, char * const *argv, char * const *env)
  709. _GL_ARG_NONNULL ((1, 2)));
  710. _GL_CXXALIAS_RPL (execve, int,
  711. (const char *program, char * const *argv, char * const *env));
  712. # else
  713. _GL_CXXALIAS_SYS (execve, int,
  714. (const char *program, char * const *argv, char * const *env));
  715. # endif
  716. _GL_CXXALIASWARN (execve);
  717. #elif defined GNULIB_POSIXCHECK
  718. # undef execve
  719. # if HAVE_RAW_DECL_EXECVE
  720. _GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - "
  721. "use gnulib module execve for portability");
  722. # endif
  723. #elif @GNULIB_MDA_EXECVE@
  724. /* On native Windows, map 'execve' to '_execve', so that -loldnames is not
  725. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  726. platforms by defining GNULIB_NAMESPACE::execve always. */
  727. # if defined _WIN32 && !defined __CYGWIN__
  728. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  729. # undef execve
  730. # define execve _execve
  731. # endif
  732. _GL_CXXALIAS_MDA_CAST (execve, intptr_t,
  733. (const char *program, char * const *argv,
  734. char * const *env));
  735. # else
  736. _GL_CXXALIAS_SYS (execve, int,
  737. (const char *program, char * const *argv, char * const *env));
  738. # endif
  739. _GL_CXXALIASWARN (execve);
  740. #endif
  741. #if @GNULIB_EXECVP@
  742. # if @REPLACE_EXECVP@
  743. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  744. # undef execvp
  745. # define execvp rpl_execvp
  746. # endif
  747. _GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv)
  748. _GL_ARG_NONNULL ((1, 2)));
  749. _GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
  750. # else
  751. _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
  752. # endif
  753. _GL_CXXALIASWARN (execvp);
  754. #elif defined GNULIB_POSIXCHECK
  755. # undef execvp
  756. # if HAVE_RAW_DECL_EXECVP
  757. _GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - "
  758. "use gnulib module execvp for portability");
  759. # endif
  760. #elif @GNULIB_MDA_EXECVP@
  761. /* On native Windows, map 'execvp' to '_execvp', so that -loldnames is not
  762. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  763. platforms by defining GNULIB_NAMESPACE::execvp always. */
  764. # if defined _WIN32 && !defined __CYGWIN__
  765. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  766. # undef execvp
  767. # define execvp _execvp
  768. # endif
  769. _GL_CXXALIAS_MDA_CAST (execvp, intptr_t,
  770. (const char *program, char * const *argv));
  771. # else
  772. _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
  773. # endif
  774. _GL_CXXALIASWARN (execvp);
  775. #endif
  776. #if @GNULIB_EXECVPE@
  777. # if @REPLACE_EXECVPE@
  778. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  779. # undef execvpe
  780. # define execvpe rpl_execvpe
  781. # endif
  782. _GL_FUNCDECL_RPL (execvpe, int,
  783. (const char *program, char * const *argv, char * const *env)
  784. _GL_ARG_NONNULL ((1, 2)));
  785. _GL_CXXALIAS_RPL (execvpe, int,
  786. (const char *program, char * const *argv, char * const *env));
  787. # else
  788. # if !@HAVE_DECL_EXECVPE@
  789. _GL_FUNCDECL_SYS (execvpe, int,
  790. (const char *program, char * const *argv, char * const *env)
  791. _GL_ARG_NONNULL ((1, 2)));
  792. # endif
  793. _GL_CXXALIAS_SYS (execvpe, int,
  794. (const char *program, char * const *argv, char * const *env));
  795. # endif
  796. _GL_CXXALIASWARN (execvpe);
  797. #elif defined GNULIB_POSIXCHECK
  798. # undef execvpe
  799. # if HAVE_RAW_DECL_EXECVPE
  800. _GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - "
  801. "use gnulib module execvpe for portability");
  802. # endif
  803. #elif @GNULIB_MDA_EXECVPE@
  804. /* On native Windows, map 'execvpe' to '_execvpe', so that -loldnames is not
  805. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  806. platforms by defining GNULIB_NAMESPACE::execvpe on all platforms that have
  807. it. */
  808. # if defined _WIN32 && !defined __CYGWIN__
  809. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  810. # undef execvpe
  811. # define execvpe _execvpe
  812. # endif
  813. _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
  814. (const char *program, char * const *argv,
  815. char * const *env));
  816. # elif @HAVE_EXECVPE@
  817. # if !@HAVE_DECL_EXECVPE@
  818. _GL_FUNCDECL_SYS (execvpe, int,
  819. (const char *program, char * const *argv, char * const *env)
  820. _GL_ARG_NONNULL ((1, 2)));
  821. # endif
  822. _GL_CXXALIAS_SYS (execvpe, int,
  823. (const char *program, char * const *argv, char * const *env));
  824. # endif
  825. # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_EXECVPE@
  826. _GL_CXXALIASWARN (execvpe);
  827. # endif
  828. #endif
  829. #if @GNULIB_FACCESSAT@
  830. # if @REPLACE_FACCESSAT@
  831. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  832. # undef faccessat
  833. # define faccessat rpl_faccessat
  834. # endif
  835. _GL_FUNCDECL_RPL (faccessat, int,
  836. (int fd, char const *name, int mode, int flag)
  837. _GL_ARG_NONNULL ((2)));
  838. _GL_CXXALIAS_RPL (faccessat, int,
  839. (int fd, char const *name, int mode, int flag));
  840. # else
  841. # if !@HAVE_FACCESSAT@
  842. _GL_FUNCDECL_SYS (faccessat, int,
  843. (int fd, char const *file, int mode, int flag)
  844. _GL_ARG_NONNULL ((2)));
  845. # endif
  846. _GL_CXXALIAS_SYS (faccessat, int,
  847. (int fd, char const *file, int mode, int flag));
  848. # endif
  849. _GL_CXXALIASWARN (faccessat);
  850. #elif defined GNULIB_POSIXCHECK
  851. # undef faccessat
  852. # if HAVE_RAW_DECL_FACCESSAT
  853. _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
  854. "use gnulib module faccessat for portability");
  855. # endif
  856. #endif
  857. #if @GNULIB_FCHDIR@
  858. /* Change the process' current working directory to the directory on which
  859. the given file descriptor is open.
  860. Return 0 if successful, otherwise -1 and errno set.
  861. See the POSIX:2008 specification
  862. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
  863. # if ! @HAVE_FCHDIR@
  864. _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
  865. /* Gnulib internal hooks needed to maintain the fchdir metadata. */
  866. _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
  867. _GL_ARG_NONNULL ((2));
  868. _GL_EXTERN_C void _gl_unregister_fd (int fd);
  869. _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
  870. _GL_EXTERN_C const char *_gl_directory_name (int fd);
  871. # else
  872. # if !@HAVE_DECL_FCHDIR@
  873. _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
  874. # endif
  875. # endif
  876. _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
  877. _GL_CXXALIASWARN (fchdir);
  878. #elif defined GNULIB_POSIXCHECK
  879. # undef fchdir
  880. # if HAVE_RAW_DECL_FCHDIR
  881. _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
  882. "use gnulib module fchdir for portability");
  883. # endif
  884. #endif
  885. #if @GNULIB_FCHOWNAT@
  886. # if @REPLACE_FCHOWNAT@
  887. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  888. # undef fchownat
  889. # define fchownat rpl_fchownat
  890. # endif
  891. _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
  892. uid_t owner, gid_t group, int flag)
  893. _GL_ARG_NONNULL ((2)));
  894. _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
  895. uid_t owner, gid_t group, int flag));
  896. # else
  897. # if !@HAVE_FCHOWNAT@
  898. _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
  899. uid_t owner, gid_t group, int flag)
  900. _GL_ARG_NONNULL ((2)));
  901. # endif
  902. _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
  903. uid_t owner, gid_t group, int flag));
  904. # endif
  905. _GL_CXXALIASWARN (fchownat);
  906. #elif defined GNULIB_POSIXCHECK
  907. # undef fchownat
  908. # if HAVE_RAW_DECL_FCHOWNAT
  909. _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
  910. "use gnulib module fchownat for portability");
  911. # endif
  912. #endif
  913. #if @GNULIB_FDATASYNC@
  914. /* Synchronize changes to a file.
  915. Return 0 if successful, otherwise -1 and errno set.
  916. See POSIX:2008 specification
  917. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
  918. # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
  919. _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
  920. # endif
  921. _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
  922. _GL_CXXALIASWARN (fdatasync);
  923. #elif defined GNULIB_POSIXCHECK
  924. # undef fdatasync
  925. # if HAVE_RAW_DECL_FDATASYNC
  926. _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
  927. "use gnulib module fdatasync for portability");
  928. # endif
  929. #endif
  930. #if @GNULIB_FSYNC@
  931. /* Synchronize changes, including metadata, to a file.
  932. Return 0 if successful, otherwise -1 and errno set.
  933. See POSIX:2008 specification
  934. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
  935. # if !@HAVE_FSYNC@
  936. _GL_FUNCDECL_SYS (fsync, int, (int fd));
  937. # endif
  938. _GL_CXXALIAS_SYS (fsync, int, (int fd));
  939. _GL_CXXALIASWARN (fsync);
  940. #elif defined GNULIB_POSIXCHECK
  941. # undef fsync
  942. # if HAVE_RAW_DECL_FSYNC
  943. _GL_WARN_ON_USE (fsync, "fsync is unportable - "
  944. "use gnulib module fsync for portability");
  945. # endif
  946. #endif
  947. #if @GNULIB_FTRUNCATE@
  948. /* Change the size of the file to which FD is opened to become equal to LENGTH.
  949. Return 0 if successful, otherwise -1 and errno set.
  950. See the POSIX:2008 specification
  951. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
  952. # if @REPLACE_FTRUNCATE@
  953. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  954. # undef ftruncate
  955. # define ftruncate rpl_ftruncate
  956. # endif
  957. _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
  958. _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
  959. # else
  960. # if !@HAVE_FTRUNCATE@
  961. _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
  962. # endif
  963. _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
  964. # endif
  965. _GL_CXXALIASWARN (ftruncate);
  966. #elif defined GNULIB_POSIXCHECK
  967. # undef ftruncate
  968. # if HAVE_RAW_DECL_FTRUNCATE
  969. _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
  970. "use gnulib module ftruncate for portability");
  971. # endif
  972. #endif
  973. #if @GNULIB_GETCWD@
  974. /* Get the name of the current working directory, and put it in SIZE bytes
  975. of BUF.
  976. Return BUF if successful, or NULL if the directory couldn't be determined
  977. or SIZE was too small.
  978. See the POSIX:2008 specification
  979. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
  980. Additionally, the gnulib module 'getcwd' guarantees the following GNU
  981. extension: If BUF is NULL, an array is allocated with 'malloc'; the array
  982. is SIZE bytes long, unless SIZE == 0, in which case it is as big as
  983. necessary. */
  984. # if @REPLACE_GETCWD@
  985. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  986. # define getcwd rpl_getcwd
  987. # endif
  988. _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
  989. _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
  990. # elif defined _WIN32 && !defined __CYGWIN__
  991. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  992. # undef getcwd
  993. # define getcwd _getcwd
  994. # endif
  995. _GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
  996. # else
  997. /* Need to cast, because on mingw, the second parameter is
  998. int size. */
  999. _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
  1000. # endif
  1001. _GL_CXXALIASWARN (getcwd);
  1002. #elif defined GNULIB_POSIXCHECK
  1003. # undef getcwd
  1004. # if HAVE_RAW_DECL_GETCWD
  1005. _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
  1006. "use gnulib module getcwd for portability");
  1007. # endif
  1008. #elif @GNULIB_MDA_GETCWD@
  1009. /* On native Windows, map 'getcwd' to '_getcwd', so that -loldnames is not
  1010. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1011. platforms by defining GNULIB_NAMESPACE::getcwd always. */
  1012. # if defined _WIN32 && !defined __CYGWIN__
  1013. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1014. # undef getcwd
  1015. # define getcwd _getcwd
  1016. # endif
  1017. /* Need to cast, because on mingw, the second parameter is either
  1018. 'int size' or 'size_t size'. */
  1019. _GL_CXXALIAS_MDA_CAST (getcwd, char *, (char *buf, size_t size));
  1020. # else
  1021. _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
  1022. # endif
  1023. _GL_CXXALIASWARN (getcwd);
  1024. #endif
  1025. #if @GNULIB_GETDOMAINNAME@
  1026. /* Return the NIS domain name of the machine.
  1027. WARNING! The NIS domain name is unrelated to the fully qualified host name
  1028. of the machine. It is also unrelated to email addresses.
  1029. WARNING! The NIS domain name is usually the empty string or "(none)" when
  1030. not using NIS.
  1031. Put up to LEN bytes of the NIS domain name into NAME.
  1032. Null terminate it if the name is shorter than LEN.
  1033. If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
  1034. Return 0 if successful, otherwise set errno and return -1. */
  1035. # if @REPLACE_GETDOMAINNAME@
  1036. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1037. # undef getdomainname
  1038. # define getdomainname rpl_getdomainname
  1039. # endif
  1040. _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
  1041. _GL_ARG_NONNULL ((1)));
  1042. _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
  1043. # else
  1044. # if !@HAVE_DECL_GETDOMAINNAME@
  1045. _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
  1046. _GL_ARG_NONNULL ((1)));
  1047. # endif
  1048. _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
  1049. # endif
  1050. _GL_CXXALIASWARN (getdomainname);
  1051. #elif defined GNULIB_POSIXCHECK
  1052. # undef getdomainname
  1053. # if HAVE_RAW_DECL_GETDOMAINNAME
  1054. _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
  1055. "use gnulib module getdomainname for portability");
  1056. # endif
  1057. #endif
  1058. #if @GNULIB_GETDTABLESIZE@
  1059. /* Return the maximum number of file descriptors in the current process.
  1060. In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
  1061. # if @REPLACE_GETDTABLESIZE@
  1062. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1063. # undef getdtablesize
  1064. # define getdtablesize rpl_getdtablesize
  1065. # endif
  1066. _GL_FUNCDECL_RPL (getdtablesize, int, (void));
  1067. _GL_CXXALIAS_RPL (getdtablesize, int, (void));
  1068. # else
  1069. # if !@HAVE_GETDTABLESIZE@
  1070. _GL_FUNCDECL_SYS (getdtablesize, int, (void));
  1071. # endif
  1072. /* Need to cast, because on AIX, the parameter list is
  1073. (...). */
  1074. _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
  1075. # endif
  1076. _GL_CXXALIASWARN (getdtablesize);
  1077. #elif defined GNULIB_POSIXCHECK
  1078. # undef getdtablesize
  1079. # if HAVE_RAW_DECL_GETDTABLESIZE
  1080. _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
  1081. "use gnulib module getdtablesize for portability");
  1082. # endif
  1083. #endif
  1084. #if @GNULIB_GETENTROPY@
  1085. /* Fill a buffer with random bytes. */
  1086. # if !@HAVE_GETENTROPY@
  1087. _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
  1088. # endif
  1089. _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
  1090. _GL_CXXALIASWARN (getentropy);
  1091. #elif defined GNULIB_POSIXCHECK
  1092. # undef getentropy
  1093. # if HAVE_RAW_DECL_GETENTROPY
  1094. _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
  1095. "use gnulib module getentropy for portability");
  1096. # endif
  1097. #endif
  1098. #if @GNULIB_GETGROUPS@
  1099. /* Return the supplemental groups that the current process belongs to.
  1100. It is unspecified whether the effective group id is in the list.
  1101. If N is 0, return the group count; otherwise, N describes how many
  1102. entries are available in GROUPS. Return -1 and set errno if N is
  1103. not 0 and not large enough. Fails with ENOSYS on some systems. */
  1104. # if @REPLACE_GETGROUPS@
  1105. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1106. # undef getgroups
  1107. # define getgroups rpl_getgroups
  1108. # endif
  1109. _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
  1110. _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
  1111. # else
  1112. # if !@HAVE_GETGROUPS@
  1113. _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
  1114. # endif
  1115. _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
  1116. # endif
  1117. _GL_CXXALIASWARN (getgroups);
  1118. #elif defined GNULIB_POSIXCHECK
  1119. # undef getgroups
  1120. # if HAVE_RAW_DECL_GETGROUPS
  1121. _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
  1122. "use gnulib module getgroups for portability");
  1123. # endif
  1124. #endif
  1125. #if @GNULIB_GETHOSTNAME@
  1126. /* Return the standard host name of the machine.
  1127. WARNING! The host name may or may not be fully qualified.
  1128. Put up to LEN bytes of the host name into NAME.
  1129. Null terminate it if the name is shorter than LEN.
  1130. If the host name is longer than LEN, set errno = EINVAL and return -1.
  1131. Return 0 if successful, otherwise set errno and return -1. */
  1132. # if @UNISTD_H_HAVE_WINSOCK2_H@
  1133. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1134. # undef gethostname
  1135. # define gethostname rpl_gethostname
  1136. # endif
  1137. _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
  1138. _GL_ARG_NONNULL ((1)));
  1139. _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
  1140. # else
  1141. # if !@HAVE_GETHOSTNAME@
  1142. _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
  1143. _GL_ARG_NONNULL ((1)));
  1144. # endif
  1145. /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
  1146. parameter is
  1147. int len. */
  1148. _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
  1149. # endif
  1150. _GL_CXXALIASWARN (gethostname);
  1151. #elif @UNISTD_H_HAVE_WINSOCK2_H@
  1152. # undef gethostname
  1153. # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
  1154. #elif defined GNULIB_POSIXCHECK
  1155. # undef gethostname
  1156. # if HAVE_RAW_DECL_GETHOSTNAME
  1157. _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
  1158. "use gnulib module gethostname for portability");
  1159. # endif
  1160. #endif
  1161. #if @GNULIB_GETLOGIN@
  1162. /* Returns the user's login name, or NULL if it cannot be found. Upon error,
  1163. returns NULL with errno set.
  1164. See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
  1165. Most programs don't need to use this function, because the information is
  1166. available through environment variables:
  1167. ${LOGNAME-$USER} on Unix platforms,
  1168. $USERNAME on native Windows platforms.
  1169. */
  1170. # if !@HAVE_DECL_GETLOGIN@
  1171. _GL_FUNCDECL_SYS (getlogin, char *, (void));
  1172. # endif
  1173. _GL_CXXALIAS_SYS (getlogin, char *, (void));
  1174. _GL_CXXALIASWARN (getlogin);
  1175. #elif defined GNULIB_POSIXCHECK
  1176. # undef getlogin
  1177. # if HAVE_RAW_DECL_GETLOGIN
  1178. _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
  1179. "use gnulib module getlogin for portability");
  1180. # endif
  1181. #endif
  1182. #if @GNULIB_GETLOGIN_R@
  1183. /* Copies the user's login name to NAME.
  1184. The array pointed to by NAME has room for SIZE bytes.
  1185. Returns 0 if successful. Upon error, an error number is returned, or -1 in
  1186. the case that the login name cannot be found but no specific error is
  1187. provided (this case is hopefully rare but is left open by the POSIX spec).
  1188. See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
  1189. Most programs don't need to use this function, because the information is
  1190. available through environment variables:
  1191. ${LOGNAME-$USER} on Unix platforms,
  1192. $USERNAME on native Windows platforms.
  1193. */
  1194. # if @REPLACE_GETLOGIN_R@
  1195. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1196. # define getlogin_r rpl_getlogin_r
  1197. # endif
  1198. _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
  1199. _GL_ARG_NONNULL ((1)));
  1200. _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
  1201. # else
  1202. # if !@HAVE_DECL_GETLOGIN_R@
  1203. _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
  1204. _GL_ARG_NONNULL ((1)));
  1205. # endif
  1206. /* Need to cast, because on Solaris 10 systems, the second argument is
  1207. int size. */
  1208. _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
  1209. # endif
  1210. _GL_CXXALIASWARN (getlogin_r);
  1211. #elif defined GNULIB_POSIXCHECK
  1212. # undef getlogin_r
  1213. # if HAVE_RAW_DECL_GETLOGIN_R
  1214. _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
  1215. "use gnulib module getlogin_r for portability");
  1216. # endif
  1217. #endif
  1218. #if @GNULIB_GETPAGESIZE@
  1219. # if @REPLACE_GETPAGESIZE@
  1220. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1221. # define getpagesize rpl_getpagesize
  1222. # endif
  1223. _GL_FUNCDECL_RPL (getpagesize, int, (void));
  1224. _GL_CXXALIAS_RPL (getpagesize, int, (void));
  1225. # else
  1226. /* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
  1227. the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
  1228. # if defined __hpux
  1229. _GL_FUNCDECL_SYS (getpagesize, int, (void));
  1230. # endif
  1231. # if !@HAVE_GETPAGESIZE@
  1232. # if !defined getpagesize
  1233. /* This is for POSIX systems. */
  1234. # if !defined _gl_getpagesize && defined _SC_PAGESIZE
  1235. # if ! (defined __VMS && __VMS_VER < 70000000)
  1236. # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
  1237. # endif
  1238. # endif
  1239. /* This is for older VMS. */
  1240. # if !defined _gl_getpagesize && defined __VMS
  1241. # ifdef __ALPHA
  1242. # define _gl_getpagesize() 8192
  1243. # else
  1244. # define _gl_getpagesize() 512
  1245. # endif
  1246. # endif
  1247. /* This is for BeOS. */
  1248. # if !defined _gl_getpagesize && @HAVE_OS_H@
  1249. # include <OS.h>
  1250. # if defined B_PAGE_SIZE
  1251. # define _gl_getpagesize() B_PAGE_SIZE
  1252. # endif
  1253. # endif
  1254. /* This is for AmigaOS4.0. */
  1255. # if !defined _gl_getpagesize && defined __amigaos4__
  1256. # define _gl_getpagesize() 2048
  1257. # endif
  1258. /* This is for older Unix systems. */
  1259. # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
  1260. # include <sys/param.h>
  1261. # ifdef EXEC_PAGESIZE
  1262. # define _gl_getpagesize() EXEC_PAGESIZE
  1263. # else
  1264. # ifdef NBPG
  1265. # ifndef CLSIZE
  1266. # define CLSIZE 1
  1267. # endif
  1268. # define _gl_getpagesize() (NBPG * CLSIZE)
  1269. # else
  1270. # ifdef NBPC
  1271. # define _gl_getpagesize() NBPC
  1272. # endif
  1273. # endif
  1274. # endif
  1275. # endif
  1276. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1277. # define getpagesize() _gl_getpagesize ()
  1278. # else
  1279. # if !GNULIB_defined_getpagesize_function
  1280. _GL_UNISTD_INLINE int
  1281. getpagesize ()
  1282. {
  1283. return _gl_getpagesize ();
  1284. }
  1285. # define GNULIB_defined_getpagesize_function 1
  1286. # endif
  1287. # endif
  1288. # endif
  1289. # endif
  1290. /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
  1291. _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
  1292. # endif
  1293. # if @HAVE_DECL_GETPAGESIZE@
  1294. _GL_CXXALIASWARN (getpagesize);
  1295. # endif
  1296. #elif defined GNULIB_POSIXCHECK
  1297. # undef getpagesize
  1298. # if HAVE_RAW_DECL_GETPAGESIZE
  1299. _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
  1300. "use gnulib module getpagesize for portability");
  1301. # endif
  1302. #endif
  1303. #if @GNULIB_GETPASS@
  1304. /* Function getpass() from module 'getpass':
  1305. Read a password from /dev/tty or stdin.
  1306. Function getpass() from module 'getpass-gnu':
  1307. Read a password of arbitrary length from /dev/tty or stdin. */
  1308. # if @REPLACE_GETPASS@
  1309. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1310. # undef getpass
  1311. # define getpass rpl_getpass
  1312. # endif
  1313. _GL_FUNCDECL_RPL (getpass, char *, (const char *prompt)
  1314. _GL_ARG_NONNULL ((1)));
  1315. _GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
  1316. # else
  1317. # if !@HAVE_GETPASS@
  1318. _GL_FUNCDECL_SYS (getpass, char *, (const char *prompt)
  1319. _GL_ARG_NONNULL ((1)));
  1320. # endif
  1321. _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
  1322. # endif
  1323. _GL_CXXALIASWARN (getpass);
  1324. #elif defined GNULIB_POSIXCHECK
  1325. # undef getpass
  1326. # if HAVE_RAW_DECL_GETPASS
  1327. _GL_WARN_ON_USE (getpass, "getpass is unportable - "
  1328. "use gnulib module getpass or getpass-gnu for portability");
  1329. # endif
  1330. #endif
  1331. #if @GNULIB_MDA_GETPID@
  1332. /* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not
  1333. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1334. platforms by defining GNULIB_NAMESPACE::getpid always. */
  1335. # if defined _WIN32 && !defined __CYGWIN__
  1336. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1337. # undef getpid
  1338. # define getpid _getpid
  1339. # endif
  1340. _GL_CXXALIAS_MDA (getpid, int, (void));
  1341. # else
  1342. _GL_CXXALIAS_SYS (getpid, pid_t, (void));
  1343. # endif
  1344. _GL_CXXALIASWARN (getpid);
  1345. #endif
  1346. #if @GNULIB_GETUSERSHELL@
  1347. /* Return the next valid login shell on the system, or NULL when the end of
  1348. the list has been reached. */
  1349. # if !@HAVE_DECL_GETUSERSHELL@
  1350. _GL_FUNCDECL_SYS (getusershell, char *, (void));
  1351. # endif
  1352. _GL_CXXALIAS_SYS (getusershell, char *, (void));
  1353. _GL_CXXALIASWARN (getusershell);
  1354. #elif defined GNULIB_POSIXCHECK
  1355. # undef getusershell
  1356. # if HAVE_RAW_DECL_GETUSERSHELL
  1357. _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
  1358. "use gnulib module getusershell for portability");
  1359. # endif
  1360. #endif
  1361. #if @GNULIB_GETUSERSHELL@
  1362. /* Rewind to pointer that is advanced at each getusershell() call. */
  1363. # if !@HAVE_DECL_GETUSERSHELL@
  1364. _GL_FUNCDECL_SYS (setusershell, void, (void));
  1365. # endif
  1366. _GL_CXXALIAS_SYS (setusershell, void, (void));
  1367. _GL_CXXALIASWARN (setusershell);
  1368. #elif defined GNULIB_POSIXCHECK
  1369. # undef setusershell
  1370. # if HAVE_RAW_DECL_SETUSERSHELL
  1371. _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
  1372. "use gnulib module getusershell for portability");
  1373. # endif
  1374. #endif
  1375. #if @GNULIB_GETUSERSHELL@
  1376. /* Free the pointer that is advanced at each getusershell() call and
  1377. associated resources. */
  1378. # if !@HAVE_DECL_GETUSERSHELL@
  1379. _GL_FUNCDECL_SYS (endusershell, void, (void));
  1380. # endif
  1381. _GL_CXXALIAS_SYS (endusershell, void, (void));
  1382. _GL_CXXALIASWARN (endusershell);
  1383. #elif defined GNULIB_POSIXCHECK
  1384. # undef endusershell
  1385. # if HAVE_RAW_DECL_ENDUSERSHELL
  1386. _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
  1387. "use gnulib module getusershell for portability");
  1388. # endif
  1389. #endif
  1390. #if @GNULIB_GROUP_MEMBER@
  1391. /* Determine whether group id is in calling user's group list. */
  1392. # if !@HAVE_GROUP_MEMBER@
  1393. _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
  1394. # endif
  1395. _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
  1396. _GL_CXXALIASWARN (group_member);
  1397. #elif defined GNULIB_POSIXCHECK
  1398. # undef group_member
  1399. # if HAVE_RAW_DECL_GROUP_MEMBER
  1400. _GL_WARN_ON_USE (group_member, "group_member is unportable - "
  1401. "use gnulib module group-member for portability");
  1402. # endif
  1403. #endif
  1404. #if @GNULIB_ISATTY@
  1405. # if @REPLACE_ISATTY@
  1406. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1407. # undef isatty
  1408. # define isatty rpl_isatty
  1409. # endif
  1410. # define GNULIB_defined_isatty 1
  1411. _GL_FUNCDECL_RPL (isatty, int, (int fd));
  1412. _GL_CXXALIAS_RPL (isatty, int, (int fd));
  1413. # elif defined _WIN32 && !defined __CYGWIN__
  1414. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1415. # undef isatty
  1416. # define isatty _isatty
  1417. # endif
  1418. _GL_CXXALIAS_MDA (isatty, int, (int fd));
  1419. # else
  1420. _GL_CXXALIAS_SYS (isatty, int, (int fd));
  1421. # endif
  1422. _GL_CXXALIASWARN (isatty);
  1423. #elif defined GNULIB_POSIXCHECK
  1424. # undef isatty
  1425. # if HAVE_RAW_DECL_ISATTY
  1426. _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
  1427. "use gnulib module isatty for portability");
  1428. # endif
  1429. #elif @GNULIB_MDA_ISATTY@
  1430. /* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not
  1431. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1432. platforms by defining GNULIB_NAMESPACE::isatty always. */
  1433. # if defined _WIN32 && !defined __CYGWIN__
  1434. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1435. # undef isatty
  1436. # define isatty _isatty
  1437. # endif
  1438. _GL_CXXALIAS_MDA (isatty, int, (int fd));
  1439. # else
  1440. _GL_CXXALIAS_SYS (isatty, int, (int fd));
  1441. # endif
  1442. _GL_CXXALIASWARN (isatty);
  1443. #endif
  1444. #if @GNULIB_LCHOWN@
  1445. /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
  1446. to GID (if GID is not -1). Do not follow symbolic links.
  1447. Return 0 if successful, otherwise -1 and errno set.
  1448. See the POSIX:2008 specification
  1449. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
  1450. # if @REPLACE_LCHOWN@
  1451. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1452. # undef lchown
  1453. # define lchown rpl_lchown
  1454. # endif
  1455. _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
  1456. _GL_ARG_NONNULL ((1)));
  1457. _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
  1458. # else
  1459. # if !@HAVE_LCHOWN@
  1460. _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
  1461. _GL_ARG_NONNULL ((1)));
  1462. # endif
  1463. _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
  1464. # endif
  1465. _GL_CXXALIASWARN (lchown);
  1466. #elif defined GNULIB_POSIXCHECK
  1467. # undef lchown
  1468. # if HAVE_RAW_DECL_LCHOWN
  1469. _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
  1470. "use gnulib module lchown for portability");
  1471. # endif
  1472. #endif
  1473. #if @GNULIB_LINK@
  1474. /* Create a new hard link for an existing file.
  1475. Return 0 if successful, otherwise -1 and errno set.
  1476. See POSIX:2008 specification
  1477. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
  1478. # if @REPLACE_LINK@
  1479. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1480. # define link rpl_link
  1481. # endif
  1482. _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
  1483. _GL_ARG_NONNULL ((1, 2)));
  1484. _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
  1485. # else
  1486. # if !@HAVE_LINK@
  1487. _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
  1488. _GL_ARG_NONNULL ((1, 2)));
  1489. # endif
  1490. _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
  1491. # endif
  1492. _GL_CXXALIASWARN (link);
  1493. #elif defined GNULIB_POSIXCHECK
  1494. # undef link
  1495. # if HAVE_RAW_DECL_LINK
  1496. _GL_WARN_ON_USE (link, "link is unportable - "
  1497. "use gnulib module link for portability");
  1498. # endif
  1499. #endif
  1500. #if @GNULIB_LINKAT@
  1501. /* Create a new hard link for an existing file, relative to two
  1502. directories. FLAG controls whether symlinks are followed.
  1503. Return 0 if successful, otherwise -1 and errno set. */
  1504. # if @REPLACE_LINKAT@
  1505. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1506. # undef linkat
  1507. # define linkat rpl_linkat
  1508. # endif
  1509. _GL_FUNCDECL_RPL (linkat, int,
  1510. (int fd1, const char *path1, int fd2, const char *path2,
  1511. int flag)
  1512. _GL_ARG_NONNULL ((2, 4)));
  1513. _GL_CXXALIAS_RPL (linkat, int,
  1514. (int fd1, const char *path1, int fd2, const char *path2,
  1515. int flag));
  1516. # else
  1517. # if !@HAVE_LINKAT@
  1518. _GL_FUNCDECL_SYS (linkat, int,
  1519. (int fd1, const char *path1, int fd2, const char *path2,
  1520. int flag)
  1521. _GL_ARG_NONNULL ((2, 4)));
  1522. # endif
  1523. _GL_CXXALIAS_SYS (linkat, int,
  1524. (int fd1, const char *path1, int fd2, const char *path2,
  1525. int flag));
  1526. # endif
  1527. _GL_CXXALIASWARN (linkat);
  1528. #elif defined GNULIB_POSIXCHECK
  1529. # undef linkat
  1530. # if HAVE_RAW_DECL_LINKAT
  1531. _GL_WARN_ON_USE (linkat, "linkat is unportable - "
  1532. "use gnulib module linkat for portability");
  1533. # endif
  1534. #endif
  1535. #if @GNULIB_LSEEK@
  1536. /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
  1537. Return the new offset if successful, otherwise -1 and errno set.
  1538. See the POSIX:2008 specification
  1539. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
  1540. # if @REPLACE_LSEEK@
  1541. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1542. # define lseek rpl_lseek
  1543. # endif
  1544. _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
  1545. _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
  1546. # elif defined _WIN32 && !defined __CYGWIN__
  1547. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1548. # undef lseek
  1549. # define lseek _lseek
  1550. # endif
  1551. _GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence));
  1552. # else
  1553. _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
  1554. # endif
  1555. _GL_CXXALIASWARN (lseek);
  1556. #elif defined GNULIB_POSIXCHECK
  1557. # undef lseek
  1558. # if HAVE_RAW_DECL_LSEEK
  1559. _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
  1560. "systems - use gnulib module lseek for portability");
  1561. # endif
  1562. #elif @GNULIB_MDA_LSEEK@
  1563. /* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not
  1564. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1565. platforms by defining GNULIB_NAMESPACE::lseek always. */
  1566. # if defined _WIN32 && !defined __CYGWIN__
  1567. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1568. # undef lseek
  1569. # define lseek _lseek
  1570. # endif
  1571. _GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence));
  1572. # else
  1573. _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
  1574. # endif
  1575. _GL_CXXALIASWARN (lseek);
  1576. #endif
  1577. #if @GNULIB_PIPE@
  1578. /* Create a pipe, defaulting to O_BINARY mode.
  1579. Store the read-end as fd[0] and the write-end as fd[1].
  1580. Return 0 upon success, or -1 with errno set upon failure. */
  1581. # if !@HAVE_PIPE@
  1582. _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
  1583. # endif
  1584. _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
  1585. _GL_CXXALIASWARN (pipe);
  1586. #elif defined GNULIB_POSIXCHECK
  1587. # undef pipe
  1588. # if HAVE_RAW_DECL_PIPE
  1589. _GL_WARN_ON_USE (pipe, "pipe is unportable - "
  1590. "use gnulib module pipe-posix for portability");
  1591. # endif
  1592. #endif
  1593. #if @GNULIB_PIPE2@
  1594. /* Create a pipe, applying the given flags when opening the read-end of the
  1595. pipe and the write-end of the pipe.
  1596. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  1597. and O_TEXT, O_BINARY (defined in "binary-io.h").
  1598. Store the read-end as fd[0] and the write-end as fd[1].
  1599. Return 0 upon success, or -1 with errno set upon failure.
  1600. See also the Linux man page at
  1601. <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
  1602. # if @HAVE_PIPE2@
  1603. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1604. # define pipe2 rpl_pipe2
  1605. # endif
  1606. _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
  1607. _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
  1608. # else
  1609. _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
  1610. _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
  1611. # endif
  1612. _GL_CXXALIASWARN (pipe2);
  1613. #elif defined GNULIB_POSIXCHECK
  1614. # undef pipe2
  1615. # if HAVE_RAW_DECL_PIPE2
  1616. _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
  1617. "use gnulib module pipe2 for portability");
  1618. # endif
  1619. #endif
  1620. #if @GNULIB_PREAD@
  1621. /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
  1622. Return the number of bytes placed into BUF if successful, otherwise
  1623. set errno and return -1. 0 indicates EOF.
  1624. See the POSIX:2008 specification
  1625. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
  1626. # if @REPLACE_PREAD@
  1627. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1628. # undef pread
  1629. # define pread rpl_pread
  1630. # endif
  1631. _GL_FUNCDECL_RPL (pread, ssize_t,
  1632. (int fd, void *buf, size_t bufsize, off_t offset)
  1633. _GL_ARG_NONNULL ((2)));
  1634. _GL_CXXALIAS_RPL (pread, ssize_t,
  1635. (int fd, void *buf, size_t bufsize, off_t offset));
  1636. # else
  1637. # if !@HAVE_PREAD@
  1638. _GL_FUNCDECL_SYS (pread, ssize_t,
  1639. (int fd, void *buf, size_t bufsize, off_t offset)
  1640. _GL_ARG_NONNULL ((2)));
  1641. # endif
  1642. _GL_CXXALIAS_SYS (pread, ssize_t,
  1643. (int fd, void *buf, size_t bufsize, off_t offset));
  1644. # endif
  1645. _GL_CXXALIASWARN (pread);
  1646. #elif defined GNULIB_POSIXCHECK
  1647. # undef pread
  1648. # if HAVE_RAW_DECL_PREAD
  1649. _GL_WARN_ON_USE (pread, "pread is unportable - "
  1650. "use gnulib module pread for portability");
  1651. # endif
  1652. #endif
  1653. #if @GNULIB_PWRITE@
  1654. /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
  1655. Return the number of bytes written if successful, otherwise
  1656. set errno and return -1. 0 indicates nothing written. See the
  1657. POSIX:2008 specification
  1658. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
  1659. # if @REPLACE_PWRITE@
  1660. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1661. # undef pwrite
  1662. # define pwrite rpl_pwrite
  1663. # endif
  1664. _GL_FUNCDECL_RPL (pwrite, ssize_t,
  1665. (int fd, const void *buf, size_t bufsize, off_t offset)
  1666. _GL_ARG_NONNULL ((2)));
  1667. _GL_CXXALIAS_RPL (pwrite, ssize_t,
  1668. (int fd, const void *buf, size_t bufsize, off_t offset));
  1669. # else
  1670. # if !@HAVE_PWRITE@
  1671. _GL_FUNCDECL_SYS (pwrite, ssize_t,
  1672. (int fd, const void *buf, size_t bufsize, off_t offset)
  1673. _GL_ARG_NONNULL ((2)));
  1674. # endif
  1675. _GL_CXXALIAS_SYS (pwrite, ssize_t,
  1676. (int fd, const void *buf, size_t bufsize, off_t offset));
  1677. # endif
  1678. _GL_CXXALIASWARN (pwrite);
  1679. #elif defined GNULIB_POSIXCHECK
  1680. # undef pwrite
  1681. # if HAVE_RAW_DECL_PWRITE
  1682. _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
  1683. "use gnulib module pwrite for portability");
  1684. # endif
  1685. #endif
  1686. #if @GNULIB_READ@
  1687. /* Read up to COUNT bytes from file descriptor FD into the buffer starting
  1688. at BUF. See the POSIX:2008 specification
  1689. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
  1690. # if @REPLACE_READ@
  1691. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1692. # undef read
  1693. # define read rpl_read
  1694. # endif
  1695. _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
  1696. _GL_ARG_NONNULL ((2)));
  1697. _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
  1698. # elif defined _WIN32 && !defined __CYGWIN__
  1699. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1700. # undef read
  1701. # define read _read
  1702. # endif
  1703. _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
  1704. # else
  1705. _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
  1706. # endif
  1707. _GL_CXXALIASWARN (read);
  1708. #elif @GNULIB_MDA_READ@
  1709. /* On native Windows, map 'read' to '_read', so that -loldnames is not
  1710. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1711. platforms by defining GNULIB_NAMESPACE::read always. */
  1712. # if defined _WIN32 && !defined __CYGWIN__
  1713. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1714. # undef read
  1715. # define read _read
  1716. # endif
  1717. # ifdef __MINGW32__
  1718. _GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count));
  1719. # else
  1720. _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count));
  1721. # endif
  1722. # else
  1723. _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
  1724. # endif
  1725. _GL_CXXALIASWARN (read);
  1726. #endif
  1727. #if @GNULIB_READLINK@
  1728. /* Read the contents of the symbolic link FILE and place the first BUFSIZE
  1729. bytes of it into BUF. Return the number of bytes placed into BUF if
  1730. successful, otherwise -1 and errno set.
  1731. See the POSIX:2008 specification
  1732. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
  1733. # if @REPLACE_READLINK@
  1734. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1735. # define readlink rpl_readlink
  1736. # endif
  1737. _GL_FUNCDECL_RPL (readlink, ssize_t,
  1738. (const char *restrict file,
  1739. char *restrict buf, size_t bufsize)
  1740. _GL_ARG_NONNULL ((1, 2)));
  1741. _GL_CXXALIAS_RPL (readlink, ssize_t,
  1742. (const char *restrict file,
  1743. char *restrict buf, size_t bufsize));
  1744. # else
  1745. # if !@HAVE_READLINK@
  1746. _GL_FUNCDECL_SYS (readlink, ssize_t,
  1747. (const char *restrict file,
  1748. char *restrict buf, size_t bufsize)
  1749. _GL_ARG_NONNULL ((1, 2)));
  1750. # endif
  1751. _GL_CXXALIAS_SYS (readlink, ssize_t,
  1752. (const char *restrict file,
  1753. char *restrict buf, size_t bufsize));
  1754. # endif
  1755. _GL_CXXALIASWARN (readlink);
  1756. #elif defined GNULIB_POSIXCHECK
  1757. # undef readlink
  1758. # if HAVE_RAW_DECL_READLINK
  1759. _GL_WARN_ON_USE (readlink, "readlink is unportable - "
  1760. "use gnulib module readlink for portability");
  1761. # endif
  1762. #endif
  1763. #if @GNULIB_READLINKAT@
  1764. # if @REPLACE_READLINKAT@
  1765. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1766. # define readlinkat rpl_readlinkat
  1767. # endif
  1768. _GL_FUNCDECL_RPL (readlinkat, ssize_t,
  1769. (int fd, char const *restrict file,
  1770. char *restrict buf, size_t len)
  1771. _GL_ARG_NONNULL ((2, 3)));
  1772. _GL_CXXALIAS_RPL (readlinkat, ssize_t,
  1773. (int fd, char const *restrict file,
  1774. char *restrict buf, size_t len));
  1775. # else
  1776. # if !@HAVE_READLINKAT@
  1777. _GL_FUNCDECL_SYS (readlinkat, ssize_t,
  1778. (int fd, char const *restrict file,
  1779. char *restrict buf, size_t len)
  1780. _GL_ARG_NONNULL ((2, 3)));
  1781. # endif
  1782. _GL_CXXALIAS_SYS (readlinkat, ssize_t,
  1783. (int fd, char const *restrict file,
  1784. char *restrict buf, size_t len));
  1785. # endif
  1786. _GL_CXXALIASWARN (readlinkat);
  1787. #elif defined GNULIB_POSIXCHECK
  1788. # undef readlinkat
  1789. # if HAVE_RAW_DECL_READLINKAT
  1790. _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
  1791. "use gnulib module readlinkat for portability");
  1792. # endif
  1793. #endif
  1794. #if @GNULIB_RMDIR@
  1795. /* Remove the directory DIR. */
  1796. # if @REPLACE_RMDIR@
  1797. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1798. # define rmdir rpl_rmdir
  1799. # endif
  1800. _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
  1801. _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
  1802. # elif defined _WIN32 && !defined __CYGWIN__
  1803. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1804. # undef rmdir
  1805. # define rmdir _rmdir
  1806. # endif
  1807. _GL_CXXALIAS_MDA (rmdir, int, (char const *name));
  1808. # else
  1809. _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
  1810. # endif
  1811. _GL_CXXALIASWARN (rmdir);
  1812. #elif defined GNULIB_POSIXCHECK
  1813. # undef rmdir
  1814. # if HAVE_RAW_DECL_RMDIR
  1815. _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
  1816. "use gnulib module rmdir for portability");
  1817. # endif
  1818. #elif @GNULIB_MDA_RMDIR@
  1819. /* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not
  1820. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1821. platforms by defining GNULIB_NAMESPACE::rmdir always. */
  1822. # if defined _WIN32 && !defined __CYGWIN__
  1823. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1824. # undef rmdir
  1825. # define rmdir _rmdir
  1826. # endif
  1827. _GL_CXXALIAS_MDA (rmdir, int, (char const *name));
  1828. # else
  1829. _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
  1830. # endif
  1831. _GL_CXXALIASWARN (rmdir);
  1832. #endif
  1833. #if @GNULIB_SETHOSTNAME@
  1834. /* Set the host name of the machine.
  1835. The host name may or may not be fully qualified.
  1836. Put LEN bytes of NAME into the host name.
  1837. Return 0 if successful, otherwise, set errno and return -1.
  1838. Platforms with no ability to set the hostname return -1 and set
  1839. errno = ENOSYS. */
  1840. # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
  1841. _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
  1842. _GL_ARG_NONNULL ((1)));
  1843. # endif
  1844. /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
  1845. and FreeBSD 6.4 the second parameter is int. On Solaris 11
  1846. 2011-10, the first parameter is not const. */
  1847. _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
  1848. _GL_CXXALIASWARN (sethostname);
  1849. #elif defined GNULIB_POSIXCHECK
  1850. # undef sethostname
  1851. # if HAVE_RAW_DECL_SETHOSTNAME
  1852. _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
  1853. "use gnulib module sethostname for portability");
  1854. # endif
  1855. #endif
  1856. #if @GNULIB_SLEEP@
  1857. /* Pause the execution of the current thread for N seconds.
  1858. Returns the number of seconds left to sleep.
  1859. See the POSIX:2008 specification
  1860. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
  1861. # if @REPLACE_SLEEP@
  1862. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1863. # undef sleep
  1864. # define sleep rpl_sleep
  1865. # endif
  1866. _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
  1867. _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
  1868. # else
  1869. # if !@HAVE_SLEEP@
  1870. _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
  1871. # endif
  1872. _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
  1873. # endif
  1874. _GL_CXXALIASWARN (sleep);
  1875. #elif defined GNULIB_POSIXCHECK
  1876. # undef sleep
  1877. # if HAVE_RAW_DECL_SLEEP
  1878. _GL_WARN_ON_USE (sleep, "sleep is unportable - "
  1879. "use gnulib module sleep for portability");
  1880. # endif
  1881. #endif
  1882. #if @GNULIB_MDA_SWAB@
  1883. /* On native Windows, map 'swab' to '_swab', so that -loldnames is not
  1884. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1885. platforms by defining GNULIB_NAMESPACE::swab always. */
  1886. # if defined _WIN32 && !defined __CYGWIN__
  1887. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1888. # undef swab
  1889. # define swab _swab
  1890. # endif
  1891. /* Need to cast, because in old mingw the arguments are
  1892. (const char *from, char *to, size_t n). */
  1893. _GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
  1894. # else
  1895. # if defined __hpux /* HP-UX */
  1896. _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
  1897. # elif defined __sun && !defined _XPG4 /* Solaris */
  1898. _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
  1899. # else
  1900. _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
  1901. # endif
  1902. # endif
  1903. _GL_CXXALIASWARN (swab);
  1904. #endif
  1905. #if @GNULIB_SYMLINK@
  1906. # if @REPLACE_SYMLINK@
  1907. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1908. # undef symlink
  1909. # define symlink rpl_symlink
  1910. # endif
  1911. _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
  1912. _GL_ARG_NONNULL ((1, 2)));
  1913. _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
  1914. # else
  1915. # if !@HAVE_SYMLINK@
  1916. _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
  1917. _GL_ARG_NONNULL ((1, 2)));
  1918. # endif
  1919. _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
  1920. # endif
  1921. _GL_CXXALIASWARN (symlink);
  1922. #elif defined GNULIB_POSIXCHECK
  1923. # undef symlink
  1924. # if HAVE_RAW_DECL_SYMLINK
  1925. _GL_WARN_ON_USE (symlink, "symlink is not portable - "
  1926. "use gnulib module symlink for portability");
  1927. # endif
  1928. #endif
  1929. #if @GNULIB_SYMLINKAT@
  1930. # if @REPLACE_SYMLINKAT@
  1931. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1932. # undef symlinkat
  1933. # define symlinkat rpl_symlinkat
  1934. # endif
  1935. _GL_FUNCDECL_RPL (symlinkat, int,
  1936. (char const *contents, int fd, char const *file)
  1937. _GL_ARG_NONNULL ((1, 3)));
  1938. _GL_CXXALIAS_RPL (symlinkat, int,
  1939. (char const *contents, int fd, char const *file));
  1940. # else
  1941. # if !@HAVE_SYMLINKAT@
  1942. _GL_FUNCDECL_SYS (symlinkat, int,
  1943. (char const *contents, int fd, char const *file)
  1944. _GL_ARG_NONNULL ((1, 3)));
  1945. # endif
  1946. _GL_CXXALIAS_SYS (symlinkat, int,
  1947. (char const *contents, int fd, char const *file));
  1948. # endif
  1949. _GL_CXXALIASWARN (symlinkat);
  1950. #elif defined GNULIB_POSIXCHECK
  1951. # undef symlinkat
  1952. # if HAVE_RAW_DECL_SYMLINKAT
  1953. _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
  1954. "use gnulib module symlinkat for portability");
  1955. # endif
  1956. #endif
  1957. #if @GNULIB_TRUNCATE@
  1958. /* Change the size of the file designated by FILENAME to become equal to LENGTH.
  1959. Return 0 if successful, otherwise -1 and errno set.
  1960. See the POSIX:2008 specification
  1961. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */
  1962. # if @REPLACE_TRUNCATE@
  1963. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1964. # undef truncate
  1965. # define truncate rpl_truncate
  1966. # endif
  1967. _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
  1968. _GL_ARG_NONNULL ((1)));
  1969. _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
  1970. # else
  1971. # if !@HAVE_DECL_TRUNCATE@
  1972. _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
  1973. _GL_ARG_NONNULL ((1)));
  1974. # endif
  1975. _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
  1976. # endif
  1977. _GL_CXXALIASWARN (truncate);
  1978. #elif defined GNULIB_POSIXCHECK
  1979. # undef truncate
  1980. # if HAVE_RAW_DECL_TRUNCATE
  1981. _GL_WARN_ON_USE (truncate, "truncate is unportable - "
  1982. "use gnulib module truncate for portability");
  1983. # endif
  1984. #endif
  1985. #if @GNULIB_TTYNAME_R@
  1986. /* Store at most BUFLEN characters of the pathname of the terminal FD is
  1987. open on in BUF. Return 0 on success, otherwise an error number. */
  1988. # if @REPLACE_TTYNAME_R@
  1989. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1990. # undef ttyname_r
  1991. # define ttyname_r rpl_ttyname_r
  1992. # endif
  1993. _GL_FUNCDECL_RPL (ttyname_r, int,
  1994. (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
  1995. _GL_CXXALIAS_RPL (ttyname_r, int,
  1996. (int fd, char *buf, size_t buflen));
  1997. # else
  1998. # if !@HAVE_DECL_TTYNAME_R@
  1999. _GL_FUNCDECL_SYS (ttyname_r, int,
  2000. (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
  2001. # endif
  2002. _GL_CXXALIAS_SYS (ttyname_r, int,
  2003. (int fd, char *buf, size_t buflen));
  2004. # endif
  2005. _GL_CXXALIASWARN (ttyname_r);
  2006. #elif defined GNULIB_POSIXCHECK
  2007. # undef ttyname_r
  2008. # if HAVE_RAW_DECL_TTYNAME_R
  2009. _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
  2010. "use gnulib module ttyname_r for portability");
  2011. # endif
  2012. #endif
  2013. #if @GNULIB_UNLINK@
  2014. # if @REPLACE_UNLINK@
  2015. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2016. # undef unlink
  2017. # define unlink rpl_unlink
  2018. # endif
  2019. _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
  2020. _GL_CXXALIAS_RPL (unlink, int, (char const *file));
  2021. # elif defined _WIN32 && !defined __CYGWIN__
  2022. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2023. # undef unlink
  2024. # define unlink _unlink
  2025. # endif
  2026. _GL_CXXALIAS_MDA (unlink, int, (char const *file));
  2027. # else
  2028. _GL_CXXALIAS_SYS (unlink, int, (char const *file));
  2029. # endif
  2030. _GL_CXXALIASWARN (unlink);
  2031. #elif defined GNULIB_POSIXCHECK
  2032. # undef unlink
  2033. # if HAVE_RAW_DECL_UNLINK
  2034. _GL_WARN_ON_USE (unlink, "unlink is not portable - "
  2035. "use gnulib module unlink for portability");
  2036. # endif
  2037. #elif @GNULIB_MDA_UNLINK@
  2038. /* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not
  2039. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  2040. platforms by defining GNULIB_NAMESPACE::unlink always. */
  2041. # if defined _WIN32 && !defined __CYGWIN__
  2042. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2043. # undef unlink
  2044. # define unlink _unlink
  2045. # endif
  2046. _GL_CXXALIAS_MDA (unlink, int, (char const *file));
  2047. # else
  2048. _GL_CXXALIAS_SYS (unlink, int, (char const *file));
  2049. # endif
  2050. _GL_CXXALIASWARN (unlink);
  2051. #endif
  2052. #if @GNULIB_UNLINKAT@
  2053. # if @REPLACE_UNLINKAT@
  2054. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2055. # undef unlinkat
  2056. # define unlinkat rpl_unlinkat
  2057. # endif
  2058. _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
  2059. _GL_ARG_NONNULL ((2)));
  2060. _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
  2061. # else
  2062. # if !@HAVE_UNLINKAT@
  2063. _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
  2064. _GL_ARG_NONNULL ((2)));
  2065. # endif
  2066. _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
  2067. # endif
  2068. _GL_CXXALIASWARN (unlinkat);
  2069. #elif defined GNULIB_POSIXCHECK
  2070. # undef unlinkat
  2071. # if HAVE_RAW_DECL_UNLINKAT
  2072. _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
  2073. "use gnulib module unlinkat for portability");
  2074. # endif
  2075. #endif
  2076. #if @GNULIB_USLEEP@
  2077. /* Pause the execution of the current thread for N microseconds.
  2078. Returns 0 on completion, or -1 on range error.
  2079. See the POSIX:2001 specification
  2080. <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
  2081. # if @REPLACE_USLEEP@
  2082. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2083. # undef usleep
  2084. # define usleep rpl_usleep
  2085. # endif
  2086. _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
  2087. _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
  2088. # else
  2089. # if !@HAVE_USLEEP@
  2090. _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
  2091. # endif
  2092. /* Need to cast, because on Haiku, the first parameter is
  2093. unsigned int n. */
  2094. _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n));
  2095. # endif
  2096. _GL_CXXALIASWARN (usleep);
  2097. #elif defined GNULIB_POSIXCHECK
  2098. # undef usleep
  2099. # if HAVE_RAW_DECL_USLEEP
  2100. _GL_WARN_ON_USE (usleep, "usleep is unportable - "
  2101. "use gnulib module usleep for portability");
  2102. # endif
  2103. #endif
  2104. #if @GNULIB_WRITE@
  2105. /* Write up to COUNT bytes starting at BUF to file descriptor FD.
  2106. See the POSIX:2008 specification
  2107. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
  2108. # if @REPLACE_WRITE@
  2109. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2110. # undef write
  2111. # define write rpl_write
  2112. # endif
  2113. _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
  2114. _GL_ARG_NONNULL ((2)));
  2115. _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
  2116. # elif defined _WIN32 && !defined __CYGWIN__
  2117. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2118. # undef write
  2119. # define write _write
  2120. # endif
  2121. _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
  2122. # else
  2123. _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
  2124. # endif
  2125. _GL_CXXALIASWARN (write);
  2126. #elif @GNULIB_MDA_WRITE@
  2127. /* On native Windows, map 'write' to '_write', so that -loldnames is not
  2128. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  2129. platforms by defining GNULIB_NAMESPACE::write always. */
  2130. # if defined _WIN32 && !defined __CYGWIN__
  2131. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2132. # undef write
  2133. # define write _write
  2134. # endif
  2135. # ifdef __MINGW32__
  2136. _GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count));
  2137. # else
  2138. _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count));
  2139. # endif
  2140. # else
  2141. _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
  2142. # endif
  2143. _GL_CXXALIASWARN (write);
  2144. #endif
  2145. _GL_INLINE_HEADER_END
  2146. #endif /* _@GUARD_PREFIX@_UNISTD_H */
  2147. #endif /* _GL_INCLUDING_UNISTD_H */
  2148. #endif /* _@GUARD_PREFIX@_UNISTD_H */