unistd.in.h 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330
  1. /* Substitute for and wrapper around <unistd.h>.
  2. Copyright (C) 2003-2023 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. # if __GLIBC__ >= 2
  1065. _GL_CXXALIASWARN (getdomainname);
  1066. # endif
  1067. #elif defined GNULIB_POSIXCHECK
  1068. # undef getdomainname
  1069. # if HAVE_RAW_DECL_GETDOMAINNAME
  1070. _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
  1071. "use gnulib module getdomainname for portability");
  1072. # endif
  1073. #endif
  1074. #if @GNULIB_GETDTABLESIZE@
  1075. /* Return the maximum number of file descriptors in the current process.
  1076. In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
  1077. # if @REPLACE_GETDTABLESIZE@
  1078. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1079. # undef getdtablesize
  1080. # define getdtablesize rpl_getdtablesize
  1081. # endif
  1082. _GL_FUNCDECL_RPL (getdtablesize, int, (void));
  1083. _GL_CXXALIAS_RPL (getdtablesize, int, (void));
  1084. # else
  1085. # if !@HAVE_GETDTABLESIZE@
  1086. _GL_FUNCDECL_SYS (getdtablesize, int, (void));
  1087. # endif
  1088. /* Need to cast, because on AIX, the parameter list is
  1089. (...). */
  1090. _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
  1091. # endif
  1092. _GL_CXXALIASWARN (getdtablesize);
  1093. #elif defined GNULIB_POSIXCHECK
  1094. # undef getdtablesize
  1095. # if HAVE_RAW_DECL_GETDTABLESIZE
  1096. _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
  1097. "use gnulib module getdtablesize for portability");
  1098. # endif
  1099. #endif
  1100. #if @GNULIB_GETENTROPY@
  1101. /* Fill a buffer with random bytes. */
  1102. # if !@HAVE_GETENTROPY@
  1103. _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
  1104. # endif
  1105. _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
  1106. _GL_CXXALIASWARN (getentropy);
  1107. #elif defined GNULIB_POSIXCHECK
  1108. # undef getentropy
  1109. # if HAVE_RAW_DECL_GETENTROPY
  1110. _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
  1111. "use gnulib module getentropy for portability");
  1112. # endif
  1113. #endif
  1114. #if @GNULIB_GETGROUPS@
  1115. /* Return the supplemental groups that the current process belongs to.
  1116. It is unspecified whether the effective group id is in the list.
  1117. If N is 0, return the group count; otherwise, N describes how many
  1118. entries are available in GROUPS. Return -1 and set errno if N is
  1119. not 0 and not large enough. Fails with ENOSYS on some systems. */
  1120. # if @REPLACE_GETGROUPS@
  1121. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1122. # undef getgroups
  1123. # define getgroups rpl_getgroups
  1124. # endif
  1125. _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
  1126. _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
  1127. # else
  1128. # if !@HAVE_GETGROUPS@
  1129. _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
  1130. # endif
  1131. _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
  1132. # endif
  1133. _GL_CXXALIASWARN (getgroups);
  1134. #elif defined GNULIB_POSIXCHECK
  1135. # undef getgroups
  1136. # if HAVE_RAW_DECL_GETGROUPS
  1137. _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
  1138. "use gnulib module getgroups for portability");
  1139. # endif
  1140. #endif
  1141. #if @GNULIB_GETHOSTNAME@
  1142. /* Return the standard host name of the machine.
  1143. WARNING! The host name may or may not be fully qualified.
  1144. Put up to LEN bytes of the host name into NAME.
  1145. Null terminate it if the name is shorter than LEN.
  1146. If the host name is longer than LEN, set errno = EINVAL and return -1.
  1147. Return 0 if successful, otherwise set errno and return -1. */
  1148. # if @UNISTD_H_HAVE_WINSOCK2_H@
  1149. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1150. # undef gethostname
  1151. # define gethostname rpl_gethostname
  1152. # endif
  1153. _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
  1154. _GL_ARG_NONNULL ((1)));
  1155. _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
  1156. # else
  1157. # if !@HAVE_GETHOSTNAME@
  1158. _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
  1159. _GL_ARG_NONNULL ((1)));
  1160. # endif
  1161. /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
  1162. parameter is
  1163. int len. */
  1164. _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
  1165. # endif
  1166. _GL_CXXALIASWARN (gethostname);
  1167. #elif @UNISTD_H_HAVE_WINSOCK2_H@
  1168. # undef gethostname
  1169. # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
  1170. #elif defined GNULIB_POSIXCHECK
  1171. # undef gethostname
  1172. # if HAVE_RAW_DECL_GETHOSTNAME
  1173. _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
  1174. "use gnulib module gethostname for portability");
  1175. # endif
  1176. #endif
  1177. #if @GNULIB_GETLOGIN@
  1178. /* Returns the user's login name, or NULL if it cannot be found. Upon error,
  1179. returns NULL with errno set.
  1180. See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
  1181. Most programs don't need to use this function, because the information is
  1182. available through environment variables:
  1183. ${LOGNAME-$USER} on Unix platforms,
  1184. $USERNAME on native Windows platforms.
  1185. */
  1186. # if !@HAVE_DECL_GETLOGIN@
  1187. _GL_FUNCDECL_SYS (getlogin, char *, (void));
  1188. # endif
  1189. _GL_CXXALIAS_SYS (getlogin, char *, (void));
  1190. _GL_CXXALIASWARN (getlogin);
  1191. #elif defined GNULIB_POSIXCHECK
  1192. # undef getlogin
  1193. # if HAVE_RAW_DECL_GETLOGIN
  1194. _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
  1195. "use gnulib module getlogin for portability");
  1196. # endif
  1197. #endif
  1198. #if @GNULIB_GETLOGIN_R@
  1199. /* Copies the user's login name to NAME.
  1200. The array pointed to by NAME has room for SIZE bytes.
  1201. Returns 0 if successful. Upon error, an error number is returned, or -1 in
  1202. the case that the login name cannot be found but no specific error is
  1203. provided (this case is hopefully rare but is left open by the POSIX spec).
  1204. See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
  1205. Most programs don't need to use this function, because the information is
  1206. available through environment variables:
  1207. ${LOGNAME-$USER} on Unix platforms,
  1208. $USERNAME on native Windows platforms.
  1209. */
  1210. # if @REPLACE_GETLOGIN_R@
  1211. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1212. # define getlogin_r rpl_getlogin_r
  1213. # endif
  1214. _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
  1215. _GL_ARG_NONNULL ((1)));
  1216. _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
  1217. # else
  1218. # if !@HAVE_DECL_GETLOGIN_R@
  1219. _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
  1220. _GL_ARG_NONNULL ((1)));
  1221. # endif
  1222. /* Need to cast, because on Solaris 10 systems, the second argument is
  1223. int size. */
  1224. _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
  1225. # endif
  1226. _GL_CXXALIASWARN (getlogin_r);
  1227. #elif defined GNULIB_POSIXCHECK
  1228. # undef getlogin_r
  1229. # if HAVE_RAW_DECL_GETLOGIN_R
  1230. _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
  1231. "use gnulib module getlogin_r for portability");
  1232. # endif
  1233. #endif
  1234. #if @GNULIB_GETPAGESIZE@
  1235. # if @REPLACE_GETPAGESIZE@
  1236. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1237. # define getpagesize rpl_getpagesize
  1238. # endif
  1239. _GL_FUNCDECL_RPL (getpagesize, int, (void));
  1240. _GL_CXXALIAS_RPL (getpagesize, int, (void));
  1241. # else
  1242. /* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
  1243. the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
  1244. # if defined __hpux
  1245. _GL_FUNCDECL_SYS (getpagesize, int, (void));
  1246. # endif
  1247. # if !@HAVE_GETPAGESIZE@
  1248. # if !defined getpagesize
  1249. /* This is for POSIX systems. */
  1250. # if !defined _gl_getpagesize && defined _SC_PAGESIZE
  1251. # if ! (defined __VMS && __VMS_VER < 70000000)
  1252. # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
  1253. # endif
  1254. # endif
  1255. /* This is for older VMS. */
  1256. # if !defined _gl_getpagesize && defined __VMS
  1257. # ifdef __ALPHA
  1258. # define _gl_getpagesize() 8192
  1259. # else
  1260. # define _gl_getpagesize() 512
  1261. # endif
  1262. # endif
  1263. /* This is for BeOS. */
  1264. # if !defined _gl_getpagesize && @HAVE_OS_H@
  1265. # include <OS.h>
  1266. # if defined B_PAGE_SIZE
  1267. # define _gl_getpagesize() B_PAGE_SIZE
  1268. # endif
  1269. # endif
  1270. /* This is for AmigaOS4.0. */
  1271. # if !defined _gl_getpagesize && defined __amigaos4__
  1272. # define _gl_getpagesize() 2048
  1273. # endif
  1274. /* This is for older Unix systems. */
  1275. # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
  1276. # include <sys/param.h>
  1277. # ifdef EXEC_PAGESIZE
  1278. # define _gl_getpagesize() EXEC_PAGESIZE
  1279. # else
  1280. # ifdef NBPG
  1281. # ifndef CLSIZE
  1282. # define CLSIZE 1
  1283. # endif
  1284. # define _gl_getpagesize() (NBPG * CLSIZE)
  1285. # else
  1286. # ifdef NBPC
  1287. # define _gl_getpagesize() NBPC
  1288. # endif
  1289. # endif
  1290. # endif
  1291. # endif
  1292. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1293. # define getpagesize() _gl_getpagesize ()
  1294. # else
  1295. # if !GNULIB_defined_getpagesize_function
  1296. _GL_UNISTD_INLINE int
  1297. getpagesize ()
  1298. {
  1299. return _gl_getpagesize ();
  1300. }
  1301. # define GNULIB_defined_getpagesize_function 1
  1302. # endif
  1303. # endif
  1304. # endif
  1305. # endif
  1306. /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
  1307. _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
  1308. # endif
  1309. # if @HAVE_DECL_GETPAGESIZE@
  1310. _GL_CXXALIASWARN (getpagesize);
  1311. # endif
  1312. #elif defined GNULIB_POSIXCHECK
  1313. # undef getpagesize
  1314. # if HAVE_RAW_DECL_GETPAGESIZE
  1315. _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
  1316. "use gnulib module getpagesize for portability");
  1317. # endif
  1318. #endif
  1319. #if @GNULIB_GETPASS@
  1320. /* Function getpass() from module 'getpass':
  1321. Read a password from /dev/tty or stdin.
  1322. Function getpass() from module 'getpass-gnu':
  1323. Read a password of arbitrary length from /dev/tty or stdin. */
  1324. # if (@GNULIB_GETPASS@ && @REPLACE_GETPASS@) \
  1325. || (@GNULIB_GETPASS_GNU@ && @REPLACE_GETPASS_FOR_GETPASS_GNU@)
  1326. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1327. # undef getpass
  1328. # define getpass rpl_getpass
  1329. # endif
  1330. _GL_FUNCDECL_RPL (getpass, char *, (const char *prompt)
  1331. _GL_ARG_NONNULL ((1)));
  1332. _GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
  1333. # else
  1334. # if !@HAVE_GETPASS@
  1335. _GL_FUNCDECL_SYS (getpass, char *, (const char *prompt)
  1336. _GL_ARG_NONNULL ((1)));
  1337. # endif
  1338. _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
  1339. # endif
  1340. _GL_CXXALIASWARN (getpass);
  1341. #elif defined GNULIB_POSIXCHECK
  1342. # undef getpass
  1343. # if HAVE_RAW_DECL_GETPASS
  1344. _GL_WARN_ON_USE (getpass, "getpass is unportable - "
  1345. "use gnulib module getpass or getpass-gnu for portability");
  1346. # endif
  1347. #endif
  1348. #if @GNULIB_MDA_GETPID@
  1349. /* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not
  1350. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1351. platforms by defining GNULIB_NAMESPACE::getpid always. */
  1352. # if defined _WIN32 && !defined __CYGWIN__
  1353. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1354. # undef getpid
  1355. # define getpid _getpid
  1356. # endif
  1357. _GL_CXXALIAS_MDA (getpid, int, (void));
  1358. # else
  1359. _GL_CXXALIAS_SYS (getpid, pid_t, (void));
  1360. # endif
  1361. _GL_CXXALIASWARN (getpid);
  1362. #endif
  1363. #if @GNULIB_GETUSERSHELL@
  1364. /* Return the next valid login shell on the system, or NULL when the end of
  1365. the list has been reached. */
  1366. # if !@HAVE_DECL_GETUSERSHELL@
  1367. _GL_FUNCDECL_SYS (getusershell, char *, (void));
  1368. # endif
  1369. _GL_CXXALIAS_SYS (getusershell, char *, (void));
  1370. _GL_CXXALIASWARN (getusershell);
  1371. #elif defined GNULIB_POSIXCHECK
  1372. # undef getusershell
  1373. # if HAVE_RAW_DECL_GETUSERSHELL
  1374. _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
  1375. "use gnulib module getusershell for portability");
  1376. # endif
  1377. #endif
  1378. #if @GNULIB_GETUSERSHELL@
  1379. /* Rewind to pointer that is advanced at each getusershell() call. */
  1380. # if !@HAVE_DECL_GETUSERSHELL@
  1381. _GL_FUNCDECL_SYS (setusershell, void, (void));
  1382. # endif
  1383. _GL_CXXALIAS_SYS (setusershell, void, (void));
  1384. _GL_CXXALIASWARN (setusershell);
  1385. #elif defined GNULIB_POSIXCHECK
  1386. # undef setusershell
  1387. # if HAVE_RAW_DECL_SETUSERSHELL
  1388. _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
  1389. "use gnulib module getusershell for portability");
  1390. # endif
  1391. #endif
  1392. #if @GNULIB_GETUSERSHELL@
  1393. /* Free the pointer that is advanced at each getusershell() call and
  1394. associated resources. */
  1395. # if !@HAVE_DECL_GETUSERSHELL@
  1396. _GL_FUNCDECL_SYS (endusershell, void, (void));
  1397. # endif
  1398. _GL_CXXALIAS_SYS (endusershell, void, (void));
  1399. _GL_CXXALIASWARN (endusershell);
  1400. #elif defined GNULIB_POSIXCHECK
  1401. # undef endusershell
  1402. # if HAVE_RAW_DECL_ENDUSERSHELL
  1403. _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
  1404. "use gnulib module getusershell for portability");
  1405. # endif
  1406. #endif
  1407. #if @GNULIB_GROUP_MEMBER@
  1408. /* Determine whether group id is in calling user's group list. */
  1409. # if !@HAVE_GROUP_MEMBER@
  1410. _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
  1411. # endif
  1412. _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
  1413. _GL_CXXALIASWARN (group_member);
  1414. #elif defined GNULIB_POSIXCHECK
  1415. # undef group_member
  1416. # if HAVE_RAW_DECL_GROUP_MEMBER
  1417. _GL_WARN_ON_USE (group_member, "group_member is unportable - "
  1418. "use gnulib module group-member for portability");
  1419. # endif
  1420. #endif
  1421. #if @GNULIB_ISATTY@
  1422. # if @REPLACE_ISATTY@
  1423. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1424. # undef isatty
  1425. # define isatty rpl_isatty
  1426. # endif
  1427. # define GNULIB_defined_isatty 1
  1428. _GL_FUNCDECL_RPL (isatty, int, (int fd));
  1429. _GL_CXXALIAS_RPL (isatty, int, (int fd));
  1430. # elif defined _WIN32 && !defined __CYGWIN__
  1431. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1432. # undef isatty
  1433. # define isatty _isatty
  1434. # endif
  1435. _GL_CXXALIAS_MDA (isatty, int, (int fd));
  1436. # else
  1437. _GL_CXXALIAS_SYS (isatty, int, (int fd));
  1438. # endif
  1439. _GL_CXXALIASWARN (isatty);
  1440. #elif defined GNULIB_POSIXCHECK
  1441. # undef isatty
  1442. # if HAVE_RAW_DECL_ISATTY
  1443. _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
  1444. "use gnulib module isatty for portability");
  1445. # endif
  1446. #elif @GNULIB_MDA_ISATTY@
  1447. /* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not
  1448. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1449. platforms by defining GNULIB_NAMESPACE::isatty always. */
  1450. # if defined _WIN32 && !defined __CYGWIN__
  1451. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1452. # undef isatty
  1453. # define isatty _isatty
  1454. # endif
  1455. _GL_CXXALIAS_MDA (isatty, int, (int fd));
  1456. # else
  1457. _GL_CXXALIAS_SYS (isatty, int, (int fd));
  1458. # endif
  1459. _GL_CXXALIASWARN (isatty);
  1460. #endif
  1461. #if @GNULIB_LCHOWN@
  1462. /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
  1463. to GID (if GID is not -1). Do not follow symbolic links.
  1464. Return 0 if successful, otherwise -1 and errno set.
  1465. See the POSIX:2008 specification
  1466. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
  1467. # if @REPLACE_LCHOWN@
  1468. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1469. # undef lchown
  1470. # define lchown rpl_lchown
  1471. # endif
  1472. _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
  1473. _GL_ARG_NONNULL ((1)));
  1474. _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
  1475. # else
  1476. # if !@HAVE_LCHOWN@
  1477. _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
  1478. _GL_ARG_NONNULL ((1)));
  1479. # endif
  1480. _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
  1481. # endif
  1482. _GL_CXXALIASWARN (lchown);
  1483. #elif defined GNULIB_POSIXCHECK
  1484. # undef lchown
  1485. # if HAVE_RAW_DECL_LCHOWN
  1486. _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
  1487. "use gnulib module lchown for portability");
  1488. # endif
  1489. #endif
  1490. #if @GNULIB_LINK@
  1491. /* Create a new hard link for an existing file.
  1492. Return 0 if successful, otherwise -1 and errno set.
  1493. See POSIX:2008 specification
  1494. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
  1495. # if @REPLACE_LINK@
  1496. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1497. # define link rpl_link
  1498. # endif
  1499. _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
  1500. _GL_ARG_NONNULL ((1, 2)));
  1501. _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
  1502. # else
  1503. # if !@HAVE_LINK@
  1504. _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
  1505. _GL_ARG_NONNULL ((1, 2)));
  1506. # endif
  1507. _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
  1508. # endif
  1509. _GL_CXXALIASWARN (link);
  1510. #elif defined GNULIB_POSIXCHECK
  1511. # undef link
  1512. # if HAVE_RAW_DECL_LINK
  1513. _GL_WARN_ON_USE (link, "link is unportable - "
  1514. "use gnulib module link for portability");
  1515. # endif
  1516. #endif
  1517. #if @GNULIB_LINKAT@
  1518. /* Create a new hard link for an existing file, relative to two
  1519. directories. FLAG controls whether symlinks are followed.
  1520. Return 0 if successful, otherwise -1 and errno set. */
  1521. # if @REPLACE_LINKAT@
  1522. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1523. # undef linkat
  1524. # define linkat rpl_linkat
  1525. # endif
  1526. _GL_FUNCDECL_RPL (linkat, int,
  1527. (int fd1, const char *path1, int fd2, const char *path2,
  1528. int flag)
  1529. _GL_ARG_NONNULL ((2, 4)));
  1530. _GL_CXXALIAS_RPL (linkat, int,
  1531. (int fd1, const char *path1, int fd2, const char *path2,
  1532. int flag));
  1533. # else
  1534. # if !@HAVE_LINKAT@
  1535. _GL_FUNCDECL_SYS (linkat, int,
  1536. (int fd1, const char *path1, int fd2, const char *path2,
  1537. int flag)
  1538. _GL_ARG_NONNULL ((2, 4)));
  1539. # endif
  1540. _GL_CXXALIAS_SYS (linkat, int,
  1541. (int fd1, const char *path1, int fd2, const char *path2,
  1542. int flag));
  1543. # endif
  1544. _GL_CXXALIASWARN (linkat);
  1545. #elif defined GNULIB_POSIXCHECK
  1546. # undef linkat
  1547. # if HAVE_RAW_DECL_LINKAT
  1548. _GL_WARN_ON_USE (linkat, "linkat is unportable - "
  1549. "use gnulib module linkat for portability");
  1550. # endif
  1551. #endif
  1552. #if @GNULIB_LSEEK@
  1553. /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
  1554. Return the new offset if successful, otherwise -1 and errno set.
  1555. See the POSIX:2008 specification
  1556. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
  1557. # if @REPLACE_LSEEK@
  1558. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1559. # define lseek rpl_lseek
  1560. # endif
  1561. _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
  1562. _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
  1563. # elif defined _WIN32 && !defined __CYGWIN__
  1564. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1565. # undef lseek
  1566. # define lseek _lseek
  1567. # endif
  1568. _GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence));
  1569. # else
  1570. _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
  1571. # endif
  1572. _GL_CXXALIASWARN (lseek);
  1573. #elif defined GNULIB_POSIXCHECK
  1574. # undef lseek
  1575. # if HAVE_RAW_DECL_LSEEK
  1576. _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
  1577. "systems - use gnulib module lseek for portability");
  1578. # endif
  1579. #elif @GNULIB_MDA_LSEEK@
  1580. /* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not
  1581. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1582. platforms by defining GNULIB_NAMESPACE::lseek always. */
  1583. # if defined _WIN32 && !defined __CYGWIN__
  1584. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1585. # undef lseek
  1586. # define lseek _lseek
  1587. # endif
  1588. _GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence));
  1589. # else
  1590. _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
  1591. # endif
  1592. _GL_CXXALIASWARN (lseek);
  1593. #endif
  1594. #if @GNULIB_PIPE@
  1595. /* Create a pipe, defaulting to O_BINARY mode.
  1596. Store the read-end as fd[0] and the write-end as fd[1].
  1597. Return 0 upon success, or -1 with errno set upon failure. */
  1598. # if !@HAVE_PIPE@
  1599. _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
  1600. # endif
  1601. _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
  1602. _GL_CXXALIASWARN (pipe);
  1603. #elif defined GNULIB_POSIXCHECK
  1604. # undef pipe
  1605. # if HAVE_RAW_DECL_PIPE
  1606. _GL_WARN_ON_USE (pipe, "pipe is unportable - "
  1607. "use gnulib module pipe-posix for portability");
  1608. # endif
  1609. #endif
  1610. #if @GNULIB_PIPE2@
  1611. /* Create a pipe, applying the given flags when opening the read-end of the
  1612. pipe and the write-end of the pipe.
  1613. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  1614. and O_TEXT, O_BINARY (defined in "binary-io.h").
  1615. Store the read-end as fd[0] and the write-end as fd[1].
  1616. Return 0 upon success, or -1 with errno set upon failure.
  1617. See also the Linux man page at
  1618. <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
  1619. # if @HAVE_PIPE2@
  1620. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1621. # define pipe2 rpl_pipe2
  1622. # endif
  1623. _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
  1624. _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
  1625. # else
  1626. _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
  1627. _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
  1628. # endif
  1629. _GL_CXXALIASWARN (pipe2);
  1630. #elif defined GNULIB_POSIXCHECK
  1631. # undef pipe2
  1632. # if HAVE_RAW_DECL_PIPE2
  1633. _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
  1634. "use gnulib module pipe2 for portability");
  1635. # endif
  1636. #endif
  1637. #if @GNULIB_PREAD@
  1638. /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
  1639. Return the number of bytes placed into BUF if successful, otherwise
  1640. set errno and return -1. 0 indicates EOF.
  1641. See the POSIX:2008 specification
  1642. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
  1643. # if @REPLACE_PREAD@
  1644. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1645. # undef pread
  1646. # define pread rpl_pread
  1647. # endif
  1648. _GL_FUNCDECL_RPL (pread, ssize_t,
  1649. (int fd, void *buf, size_t bufsize, off_t offset)
  1650. _GL_ARG_NONNULL ((2)));
  1651. _GL_CXXALIAS_RPL (pread, ssize_t,
  1652. (int fd, void *buf, size_t bufsize, off_t offset));
  1653. # else
  1654. # if !@HAVE_PREAD@
  1655. _GL_FUNCDECL_SYS (pread, ssize_t,
  1656. (int fd, void *buf, size_t bufsize, off_t offset)
  1657. _GL_ARG_NONNULL ((2)));
  1658. # endif
  1659. _GL_CXXALIAS_SYS (pread, ssize_t,
  1660. (int fd, void *buf, size_t bufsize, off_t offset));
  1661. # endif
  1662. _GL_CXXALIASWARN (pread);
  1663. #elif defined GNULIB_POSIXCHECK
  1664. # undef pread
  1665. # if HAVE_RAW_DECL_PREAD
  1666. _GL_WARN_ON_USE (pread, "pread is unportable - "
  1667. "use gnulib module pread for portability");
  1668. # endif
  1669. #endif
  1670. #if @GNULIB_PWRITE@
  1671. /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
  1672. Return the number of bytes written if successful, otherwise
  1673. set errno and return -1. 0 indicates nothing written. See the
  1674. POSIX:2008 specification
  1675. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
  1676. # if @REPLACE_PWRITE@
  1677. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1678. # undef pwrite
  1679. # define pwrite rpl_pwrite
  1680. # endif
  1681. _GL_FUNCDECL_RPL (pwrite, ssize_t,
  1682. (int fd, const void *buf, size_t bufsize, off_t offset)
  1683. _GL_ARG_NONNULL ((2)));
  1684. _GL_CXXALIAS_RPL (pwrite, ssize_t,
  1685. (int fd, const void *buf, size_t bufsize, off_t offset));
  1686. # else
  1687. # if !@HAVE_PWRITE@
  1688. _GL_FUNCDECL_SYS (pwrite, ssize_t,
  1689. (int fd, const void *buf, size_t bufsize, off_t offset)
  1690. _GL_ARG_NONNULL ((2)));
  1691. # endif
  1692. _GL_CXXALIAS_SYS (pwrite, ssize_t,
  1693. (int fd, const void *buf, size_t bufsize, off_t offset));
  1694. # endif
  1695. _GL_CXXALIASWARN (pwrite);
  1696. #elif defined GNULIB_POSIXCHECK
  1697. # undef pwrite
  1698. # if HAVE_RAW_DECL_PWRITE
  1699. _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
  1700. "use gnulib module pwrite for portability");
  1701. # endif
  1702. #endif
  1703. #if @GNULIB_READ@
  1704. /* Read up to COUNT bytes from file descriptor FD into the buffer starting
  1705. at BUF. See the POSIX:2008 specification
  1706. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
  1707. # if @REPLACE_READ@
  1708. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1709. # undef read
  1710. # define read rpl_read
  1711. # endif
  1712. _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
  1713. _GL_ARG_NONNULL ((2)));
  1714. _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
  1715. # elif defined _WIN32 && !defined __CYGWIN__
  1716. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1717. # undef read
  1718. # define read _read
  1719. # endif
  1720. _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
  1721. # else
  1722. _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
  1723. # endif
  1724. _GL_CXXALIASWARN (read);
  1725. #elif @GNULIB_MDA_READ@
  1726. /* On native Windows, map 'read' to '_read', so that -loldnames is not
  1727. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1728. platforms by defining GNULIB_NAMESPACE::read always. */
  1729. # if defined _WIN32 && !defined __CYGWIN__
  1730. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1731. # undef read
  1732. # define read _read
  1733. # endif
  1734. # ifdef __MINGW32__
  1735. _GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count));
  1736. # else
  1737. _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count));
  1738. # endif
  1739. # else
  1740. _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
  1741. # endif
  1742. _GL_CXXALIASWARN (read);
  1743. #endif
  1744. #if @GNULIB_READLINK@
  1745. /* Read the contents of the symbolic link FILE and place the first BUFSIZE
  1746. bytes of it into BUF. Return the number of bytes placed into BUF if
  1747. successful, otherwise -1 and errno set.
  1748. See the POSIX:2008 specification
  1749. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
  1750. # if @REPLACE_READLINK@
  1751. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1752. # define readlink rpl_readlink
  1753. # endif
  1754. _GL_FUNCDECL_RPL (readlink, ssize_t,
  1755. (const char *restrict file,
  1756. char *restrict buf, size_t bufsize)
  1757. _GL_ARG_NONNULL ((1, 2)));
  1758. _GL_CXXALIAS_RPL (readlink, ssize_t,
  1759. (const char *restrict file,
  1760. char *restrict buf, size_t bufsize));
  1761. # else
  1762. # if !@HAVE_READLINK@
  1763. _GL_FUNCDECL_SYS (readlink, ssize_t,
  1764. (const char *restrict file,
  1765. char *restrict buf, size_t bufsize)
  1766. _GL_ARG_NONNULL ((1, 2)));
  1767. # endif
  1768. _GL_CXXALIAS_SYS (readlink, ssize_t,
  1769. (const char *restrict file,
  1770. char *restrict buf, size_t bufsize));
  1771. # endif
  1772. _GL_CXXALIASWARN (readlink);
  1773. #elif defined GNULIB_POSIXCHECK
  1774. # undef readlink
  1775. # if HAVE_RAW_DECL_READLINK
  1776. _GL_WARN_ON_USE (readlink, "readlink is unportable - "
  1777. "use gnulib module readlink for portability");
  1778. # endif
  1779. #endif
  1780. #if @GNULIB_READLINKAT@
  1781. # if @REPLACE_READLINKAT@
  1782. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1783. # define readlinkat rpl_readlinkat
  1784. # endif
  1785. _GL_FUNCDECL_RPL (readlinkat, ssize_t,
  1786. (int fd, char const *restrict file,
  1787. char *restrict buf, size_t len)
  1788. _GL_ARG_NONNULL ((2, 3)));
  1789. _GL_CXXALIAS_RPL (readlinkat, ssize_t,
  1790. (int fd, char const *restrict file,
  1791. char *restrict buf, size_t len));
  1792. # else
  1793. # if !@HAVE_READLINKAT@
  1794. _GL_FUNCDECL_SYS (readlinkat, ssize_t,
  1795. (int fd, char const *restrict file,
  1796. char *restrict buf, size_t len)
  1797. _GL_ARG_NONNULL ((2, 3)));
  1798. # endif
  1799. _GL_CXXALIAS_SYS (readlinkat, ssize_t,
  1800. (int fd, char const *restrict file,
  1801. char *restrict buf, size_t len));
  1802. # endif
  1803. _GL_CXXALIASWARN (readlinkat);
  1804. #elif defined GNULIB_POSIXCHECK
  1805. # undef readlinkat
  1806. # if HAVE_RAW_DECL_READLINKAT
  1807. _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
  1808. "use gnulib module readlinkat for portability");
  1809. # endif
  1810. #endif
  1811. #if @GNULIB_RMDIR@
  1812. /* Remove the directory DIR. */
  1813. # if @REPLACE_RMDIR@
  1814. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1815. # define rmdir rpl_rmdir
  1816. # endif
  1817. _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
  1818. _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
  1819. # elif defined _WIN32 && !defined __CYGWIN__
  1820. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1821. # undef rmdir
  1822. # define rmdir _rmdir
  1823. # endif
  1824. _GL_CXXALIAS_MDA (rmdir, int, (char const *name));
  1825. # else
  1826. _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
  1827. # endif
  1828. _GL_CXXALIASWARN (rmdir);
  1829. #elif defined GNULIB_POSIXCHECK
  1830. # undef rmdir
  1831. # if HAVE_RAW_DECL_RMDIR
  1832. _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
  1833. "use gnulib module rmdir for portability");
  1834. # endif
  1835. #elif @GNULIB_MDA_RMDIR@
  1836. /* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not
  1837. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1838. platforms by defining GNULIB_NAMESPACE::rmdir always. */
  1839. # if defined _WIN32 && !defined __CYGWIN__
  1840. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1841. # undef rmdir
  1842. # define rmdir _rmdir
  1843. # endif
  1844. _GL_CXXALIAS_MDA (rmdir, int, (char const *name));
  1845. # else
  1846. _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
  1847. # endif
  1848. _GL_CXXALIASWARN (rmdir);
  1849. #endif
  1850. #if @GNULIB_SETHOSTNAME@
  1851. /* Set the host name of the machine.
  1852. The host name may or may not be fully qualified.
  1853. Put LEN bytes of NAME into the host name.
  1854. Return 0 if successful, otherwise, set errno and return -1.
  1855. Platforms with no ability to set the hostname return -1 and set
  1856. errno = ENOSYS. */
  1857. # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
  1858. _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
  1859. _GL_ARG_NONNULL ((1)));
  1860. # endif
  1861. /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
  1862. and FreeBSD 6.4 the second parameter is int. On Solaris 11
  1863. 2011-10, the first parameter is not const. */
  1864. _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
  1865. _GL_CXXALIASWARN (sethostname);
  1866. #elif defined GNULIB_POSIXCHECK
  1867. # undef sethostname
  1868. # if HAVE_RAW_DECL_SETHOSTNAME
  1869. _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
  1870. "use gnulib module sethostname for portability");
  1871. # endif
  1872. #endif
  1873. #if @GNULIB_SLEEP@
  1874. /* Pause the execution of the current thread for N seconds.
  1875. Returns the number of seconds left to sleep.
  1876. See the POSIX:2008 specification
  1877. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
  1878. # if @REPLACE_SLEEP@
  1879. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1880. # undef sleep
  1881. # define sleep rpl_sleep
  1882. # endif
  1883. _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
  1884. _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
  1885. # else
  1886. # if !@HAVE_SLEEP@
  1887. _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
  1888. # endif
  1889. _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
  1890. # endif
  1891. _GL_CXXALIASWARN (sleep);
  1892. #elif defined GNULIB_POSIXCHECK
  1893. # undef sleep
  1894. # if HAVE_RAW_DECL_SLEEP
  1895. _GL_WARN_ON_USE (sleep, "sleep is unportable - "
  1896. "use gnulib module sleep for portability");
  1897. # endif
  1898. #endif
  1899. #if @GNULIB_MDA_SWAB@
  1900. /* On native Windows, map 'swab' to '_swab', so that -loldnames is not
  1901. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  1902. platforms by defining GNULIB_NAMESPACE::swab always. */
  1903. # if defined _WIN32 && !defined __CYGWIN__
  1904. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1905. # undef swab
  1906. # define swab _swab
  1907. # endif
  1908. /* Need to cast, because in old mingw the arguments are
  1909. (const char *from, char *to, size_t n). */
  1910. _GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
  1911. # else
  1912. # if defined __hpux /* HP-UX */
  1913. _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
  1914. # elif defined __sun && (defined __SunOS_5_10 || defined __XOPEN_OR_POSIX) && !defined _XPG4 /* Solaris */
  1915. _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
  1916. # else
  1917. _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
  1918. # endif
  1919. # endif
  1920. _GL_CXXALIASWARN (swab);
  1921. #endif
  1922. #if @GNULIB_SYMLINK@
  1923. # if @REPLACE_SYMLINK@
  1924. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1925. # undef symlink
  1926. # define symlink rpl_symlink
  1927. # endif
  1928. _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
  1929. _GL_ARG_NONNULL ((1, 2)));
  1930. _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
  1931. # else
  1932. # if !@HAVE_SYMLINK@
  1933. _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
  1934. _GL_ARG_NONNULL ((1, 2)));
  1935. # endif
  1936. _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
  1937. # endif
  1938. _GL_CXXALIASWARN (symlink);
  1939. #elif defined GNULIB_POSIXCHECK
  1940. # undef symlink
  1941. # if HAVE_RAW_DECL_SYMLINK
  1942. _GL_WARN_ON_USE (symlink, "symlink is not portable - "
  1943. "use gnulib module symlink for portability");
  1944. # endif
  1945. #endif
  1946. #if @GNULIB_SYMLINKAT@
  1947. # if @REPLACE_SYMLINKAT@
  1948. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1949. # undef symlinkat
  1950. # define symlinkat rpl_symlinkat
  1951. # endif
  1952. _GL_FUNCDECL_RPL (symlinkat, int,
  1953. (char const *contents, int fd, char const *file)
  1954. _GL_ARG_NONNULL ((1, 3)));
  1955. _GL_CXXALIAS_RPL (symlinkat, int,
  1956. (char const *contents, int fd, char const *file));
  1957. # else
  1958. # if !@HAVE_SYMLINKAT@
  1959. _GL_FUNCDECL_SYS (symlinkat, int,
  1960. (char const *contents, int fd, char const *file)
  1961. _GL_ARG_NONNULL ((1, 3)));
  1962. # endif
  1963. _GL_CXXALIAS_SYS (symlinkat, int,
  1964. (char const *contents, int fd, char const *file));
  1965. # endif
  1966. _GL_CXXALIASWARN (symlinkat);
  1967. #elif defined GNULIB_POSIXCHECK
  1968. # undef symlinkat
  1969. # if HAVE_RAW_DECL_SYMLINKAT
  1970. _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
  1971. "use gnulib module symlinkat for portability");
  1972. # endif
  1973. #endif
  1974. #if @GNULIB_TRUNCATE@
  1975. /* Change the size of the file designated by FILENAME to become equal to LENGTH.
  1976. Return 0 if successful, otherwise -1 and errno set.
  1977. See the POSIX:2008 specification
  1978. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */
  1979. # if @REPLACE_TRUNCATE@
  1980. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1981. # undef truncate
  1982. # define truncate rpl_truncate
  1983. # endif
  1984. _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
  1985. _GL_ARG_NONNULL ((1)));
  1986. _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
  1987. # else
  1988. # if !@HAVE_DECL_TRUNCATE@
  1989. _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
  1990. _GL_ARG_NONNULL ((1)));
  1991. # endif
  1992. _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
  1993. # endif
  1994. _GL_CXXALIASWARN (truncate);
  1995. #elif defined GNULIB_POSIXCHECK
  1996. # undef truncate
  1997. # if HAVE_RAW_DECL_TRUNCATE
  1998. _GL_WARN_ON_USE (truncate, "truncate is unportable - "
  1999. "use gnulib module truncate for portability");
  2000. # endif
  2001. #endif
  2002. #if @GNULIB_TTYNAME_R@
  2003. /* Store at most BUFLEN characters of the pathname of the terminal FD is
  2004. open on in BUF. Return 0 on success, otherwise an error number. */
  2005. # if @REPLACE_TTYNAME_R@
  2006. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2007. # undef ttyname_r
  2008. # define ttyname_r rpl_ttyname_r
  2009. # endif
  2010. _GL_FUNCDECL_RPL (ttyname_r, int,
  2011. (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
  2012. _GL_CXXALIAS_RPL (ttyname_r, int,
  2013. (int fd, char *buf, size_t buflen));
  2014. # else
  2015. # if !@HAVE_DECL_TTYNAME_R@
  2016. _GL_FUNCDECL_SYS (ttyname_r, int,
  2017. (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
  2018. # endif
  2019. _GL_CXXALIAS_SYS (ttyname_r, int,
  2020. (int fd, char *buf, size_t buflen));
  2021. # endif
  2022. _GL_CXXALIASWARN (ttyname_r);
  2023. #elif defined GNULIB_POSIXCHECK
  2024. # undef ttyname_r
  2025. # if HAVE_RAW_DECL_TTYNAME_R
  2026. _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
  2027. "use gnulib module ttyname_r for portability");
  2028. # endif
  2029. #endif
  2030. #if @GNULIB_UNLINK@
  2031. # if @REPLACE_UNLINK@
  2032. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2033. # undef unlink
  2034. # define unlink rpl_unlink
  2035. # endif
  2036. _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
  2037. _GL_CXXALIAS_RPL (unlink, int, (char const *file));
  2038. # elif defined _WIN32 && !defined __CYGWIN__
  2039. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2040. # undef unlink
  2041. # define unlink _unlink
  2042. # endif
  2043. _GL_CXXALIAS_MDA (unlink, int, (char const *file));
  2044. # else
  2045. _GL_CXXALIAS_SYS (unlink, int, (char const *file));
  2046. # endif
  2047. _GL_CXXALIASWARN (unlink);
  2048. #elif defined GNULIB_POSIXCHECK
  2049. # undef unlink
  2050. # if HAVE_RAW_DECL_UNLINK
  2051. _GL_WARN_ON_USE (unlink, "unlink is not portable - "
  2052. "use gnulib module unlink for portability");
  2053. # endif
  2054. #elif @GNULIB_MDA_UNLINK@
  2055. /* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not
  2056. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  2057. platforms by defining GNULIB_NAMESPACE::unlink always. */
  2058. # if defined _WIN32 && !defined __CYGWIN__
  2059. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2060. # undef unlink
  2061. # define unlink _unlink
  2062. # endif
  2063. _GL_CXXALIAS_MDA (unlink, int, (char const *file));
  2064. # else
  2065. _GL_CXXALIAS_SYS (unlink, int, (char const *file));
  2066. # endif
  2067. _GL_CXXALIASWARN (unlink);
  2068. #endif
  2069. #if @GNULIB_UNLINKAT@
  2070. # if @REPLACE_UNLINKAT@
  2071. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2072. # undef unlinkat
  2073. # define unlinkat rpl_unlinkat
  2074. # endif
  2075. _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
  2076. _GL_ARG_NONNULL ((2)));
  2077. _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
  2078. # else
  2079. # if !@HAVE_UNLINKAT@
  2080. _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
  2081. _GL_ARG_NONNULL ((2)));
  2082. # endif
  2083. _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
  2084. # endif
  2085. _GL_CXXALIASWARN (unlinkat);
  2086. #elif defined GNULIB_POSIXCHECK
  2087. # undef unlinkat
  2088. # if HAVE_RAW_DECL_UNLINKAT
  2089. _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
  2090. "use gnulib module unlinkat for portability");
  2091. # endif
  2092. #endif
  2093. #if @GNULIB_USLEEP@
  2094. /* Pause the execution of the current thread for N microseconds.
  2095. Returns 0 on completion, or -1 on range error.
  2096. See the POSIX:2001 specification
  2097. <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
  2098. # if @REPLACE_USLEEP@
  2099. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2100. # undef usleep
  2101. # define usleep rpl_usleep
  2102. # endif
  2103. _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
  2104. _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
  2105. # else
  2106. # if !@HAVE_USLEEP@
  2107. _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
  2108. # endif
  2109. /* Need to cast, because on Haiku, the first parameter is
  2110. unsigned int n. */
  2111. _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n));
  2112. # endif
  2113. _GL_CXXALIASWARN (usleep);
  2114. #elif defined GNULIB_POSIXCHECK
  2115. # undef usleep
  2116. # if HAVE_RAW_DECL_USLEEP
  2117. _GL_WARN_ON_USE (usleep, "usleep is unportable - "
  2118. "use gnulib module usleep for portability");
  2119. # endif
  2120. #endif
  2121. #if @GNULIB_WRITE@
  2122. /* Write up to COUNT bytes starting at BUF to file descriptor FD.
  2123. See the POSIX:2008 specification
  2124. <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
  2125. # if @REPLACE_WRITE@
  2126. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2127. # undef write
  2128. # define write rpl_write
  2129. # endif
  2130. _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
  2131. _GL_ARG_NONNULL ((2)));
  2132. _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
  2133. # elif defined _WIN32 && !defined __CYGWIN__
  2134. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2135. # undef write
  2136. # define write _write
  2137. # endif
  2138. _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
  2139. # else
  2140. _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
  2141. # endif
  2142. _GL_CXXALIASWARN (write);
  2143. #elif @GNULIB_MDA_WRITE@
  2144. /* On native Windows, map 'write' to '_write', so that -loldnames is not
  2145. required. In C++ with GNULIB_NAMESPACE, avoid differences between
  2146. platforms by defining GNULIB_NAMESPACE::write always. */
  2147. # if defined _WIN32 && !defined __CYGWIN__
  2148. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  2149. # undef write
  2150. # define write _write
  2151. # endif
  2152. # ifdef __MINGW32__
  2153. _GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count));
  2154. # else
  2155. _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count));
  2156. # endif
  2157. # else
  2158. _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
  2159. # endif
  2160. _GL_CXXALIASWARN (write);
  2161. #endif
  2162. _GL_INLINE_HEADER_END
  2163. #endif /* _@GUARD_PREFIX@_UNISTD_H */
  2164. #endif /* _GL_INCLUDING_UNISTD_H */
  2165. #endif /* _@GUARD_PREFIX@_UNISTD_H */