unistd.in.h 79 KB

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