unistd.in.h 78 KB

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