unistd.h 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787
  1. /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
  2. /* Substitute for and wrapper around <unistd.h>.
  3. Copyright (C) 2003-2013 Free Software Foundation, Inc.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef _GL_M4_UNISTD_H
  15. #if __GNUC__ >= 3
  16. #endif
  17. /* The include_next requires a split double-inclusion guard. */
  18. #if 0
  19. # include <unistd.h>
  20. #endif
  21. /* Get all possible declarations of gethostname(). */
  22. #if 0 && 0 \
  23. && !defined _GL_INCLUDING_WINSOCK2_H
  24. # define _GL_INCLUDING_WINSOCK2_H
  25. # include <winsock2.h>
  26. # undef _GL_INCLUDING_WINSOCK2_H
  27. #endif
  28. #if !defined _GL_M4_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
  29. #define _GL_M4_UNISTD_H
  30. /* NetBSD 5.0 mis-defines NULL. Also get size_t. */
  31. #include <stddef.h>
  32. /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
  33. /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
  34. /* But avoid namespace pollution on glibc systems. */
  35. #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
  36. || ((0 || defined GNULIB_POSIXCHECK) \
  37. && defined __CYGWIN__)) \
  38. && ! defined __GLIBC__
  39. # include <stdio.h>
  40. #endif
  41. /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
  42. /* But avoid namespace pollution on glibc systems. */
  43. #if (0 || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
  44. && ! defined __GLIBC__
  45. # include <fcntl.h>
  46. #endif
  47. /* mingw fails to declare _exit in <unistd.h>. */
  48. /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
  49. <unistd.h>. */
  50. /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
  51. /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
  52. included here. */
  53. /* But avoid namespace pollution on glibc systems. */
  54. #if !defined __GLIBC__ && !defined __osf__
  55. # define __need_system_stdlib_h
  56. # include <stdlib.h>
  57. # undef __need_system_stdlib_h
  58. #endif
  59. /* Native Windows platforms declare chdir, getcwd, rmdir in
  60. <io.h> and/or <direct.h>, not in <unistd.h>.
  61. They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
  62. lseek(), read(), unlink(), write() in <io.h>. */
  63. #if ((1 || IN_M4_GNULIB_TESTS || 1 \
  64. || defined GNULIB_POSIXCHECK) \
  65. && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
  66. # include <io.h> /* mingw32, mingw64 */
  67. # include <direct.h> /* mingw64, MSVC 9 */
  68. #elif (1 || IN_M4_GNULIB_TESTS || 1 || 0 \
  69. || 1 || 0 || 0 || IN_M4_GNULIB_TESTS \
  70. || defined GNULIB_POSIXCHECK) \
  71. && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
  72. # include <io.h>
  73. #endif
  74. /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
  75. NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
  76. /* But avoid namespace pollution on glibc systems. */
  77. #if ((0 && (defined _AIX || defined __osf__)) \
  78. || (0 && defined __TANDEM)) \
  79. && !defined __GLIBC__
  80. # include <netdb.h>
  81. #endif
  82. /* MSVC defines off_t in <sys/types.h>.
  83. May also define off_t to a 64-bit type on native Windows. */
  84. #if !0 || 1
  85. /* Get off_t. */
  86. # include <sys/types.h>
  87. #endif
  88. #if (0 || IN_M4_GNULIB_TESTS \
  89. || 1 || 0 \
  90. || 0 || 0 || defined GNULIB_POSIXCHECK)
  91. /* Get ssize_t. */
  92. # include <sys/types.h>
  93. #endif
  94. /* Get getopt(), optarg, optind, opterr, optopt.
  95. But avoid namespace pollution on glibc systems. */
  96. #if 01 && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
  97. # define __need_getopt
  98. # include <getopt.h>
  99. #endif
  100. #ifndef _GL_INLINE_HEADER_BEGIN
  101. # error "Please include config.h first."
  102. #endif
  103. _GL_INLINE_HEADER_BEGIN
  104. #ifndef _GL_UNISTD_INLINE
  105. # define _GL_UNISTD_INLINE _GL_INLINE
  106. #endif
  107. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  108. #ifndef _GL_CXXDEFS_H
  109. #define _GL_CXXDEFS_H
  110. /* _GL_EXTERN_C declaration;
  111. performs the declaration with C linkage. */
  112. #if defined __cplusplus
  113. # define _GL_EXTERN_C extern "C"
  114. #else
  115. # define _GL_EXTERN_C extern
  116. #endif
  117. /* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
  118. declares a replacement function, named rpl_func, with the given prototype,
  119. consisting of return type, parameters, and attributes.
  120. Example:
  121. _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
  122. _GL_ARG_NONNULL ((1)));
  123. */
  124. #define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
  125. _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
  126. #define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
  127. _GL_EXTERN_C rettype rpl_func parameters_and_attributes
  128. /* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
  129. declares the system function, named func, with the given prototype,
  130. consisting of return type, parameters, and attributes.
  131. Example:
  132. _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
  133. _GL_ARG_NONNULL ((1)));
  134. */
  135. #define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
  136. _GL_EXTERN_C rettype func parameters_and_attributes
  137. /* _GL_CXXALIAS_RPL (func, rettype, parameters);
  138. declares a C++ alias called GNULIB_NAMESPACE::func
  139. that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
  140. Example:
  141. _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
  142. */
  143. #define _GL_CXXALIAS_RPL(func,rettype,parameters) \
  144. _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
  145. #if defined __cplusplus && defined GNULIB_NAMESPACE
  146. # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
  147. namespace GNULIB_NAMESPACE \
  148. { \
  149. rettype (*const func) parameters = ::rpl_func; \
  150. } \
  151. _GL_EXTERN_C int _gl_cxxalias_dummy
  152. #else
  153. # define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
  154. _GL_EXTERN_C int _gl_cxxalias_dummy
  155. #endif
  156. /* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
  157. is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
  158. except that the C function rpl_func may have a slightly different
  159. declaration. A cast is used to silence the "invalid conversion" error
  160. that would otherwise occur. */
  161. #if defined __cplusplus && defined GNULIB_NAMESPACE
  162. # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
  163. namespace GNULIB_NAMESPACE \
  164. { \
  165. rettype (*const func) parameters = \
  166. reinterpret_cast<rettype(*)parameters>(::rpl_func); \
  167. } \
  168. _GL_EXTERN_C int _gl_cxxalias_dummy
  169. #else
  170. # define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
  171. _GL_EXTERN_C int _gl_cxxalias_dummy
  172. #endif
  173. /* _GL_CXXALIAS_SYS (func, rettype, parameters);
  174. declares a C++ alias called GNULIB_NAMESPACE::func
  175. that redirects to the system provided function func, if GNULIB_NAMESPACE
  176. is defined.
  177. Example:
  178. _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
  179. */
  180. #if defined __cplusplus && defined GNULIB_NAMESPACE
  181. /* If we were to write
  182. rettype (*const func) parameters = ::func;
  183. like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
  184. better (remove an indirection through a 'static' pointer variable),
  185. but then the _GL_CXXALIASWARN macro below would cause a warning not only
  186. for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
  187. # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
  188. namespace GNULIB_NAMESPACE \
  189. { \
  190. static rettype (*func) parameters = ::func; \
  191. } \
  192. _GL_EXTERN_C int _gl_cxxalias_dummy
  193. #else
  194. # define _GL_CXXALIAS_SYS(func,rettype,parameters) \
  195. _GL_EXTERN_C int _gl_cxxalias_dummy
  196. #endif
  197. /* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
  198. is like _GL_CXXALIAS_SYS (func, rettype, parameters);
  199. except that the C function func may have a slightly different declaration.
  200. A cast is used to silence the "invalid conversion" error that would
  201. otherwise occur. */
  202. #if defined __cplusplus && defined GNULIB_NAMESPACE
  203. # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
  204. namespace GNULIB_NAMESPACE \
  205. { \
  206. static rettype (*func) parameters = \
  207. reinterpret_cast<rettype(*)parameters>(::func); \
  208. } \
  209. _GL_EXTERN_C int _gl_cxxalias_dummy
  210. #else
  211. # define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
  212. _GL_EXTERN_C int _gl_cxxalias_dummy
  213. #endif
  214. /* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
  215. is like _GL_CXXALIAS_SYS (func, rettype, parameters);
  216. except that the C function is picked among a set of overloaded functions,
  217. namely the one with rettype2 and parameters2. Two consecutive casts
  218. are used to silence the "cannot find a match" and "invalid conversion"
  219. errors that would otherwise occur. */
  220. #if defined __cplusplus && defined GNULIB_NAMESPACE
  221. /* The outer cast must be a reinterpret_cast.
  222. The inner cast: When the function is defined as a set of overloaded
  223. functions, it works as a static_cast<>, choosing the designated variant.
  224. When the function is defined as a single variant, it works as a
  225. reinterpret_cast<>. The parenthesized cast syntax works both ways. */
  226. # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
  227. namespace GNULIB_NAMESPACE \
  228. { \
  229. static rettype (*func) parameters = \
  230. reinterpret_cast<rettype(*)parameters>( \
  231. (rettype2(*)parameters2)(::func)); \
  232. } \
  233. _GL_EXTERN_C int _gl_cxxalias_dummy
  234. #else
  235. # define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
  236. _GL_EXTERN_C int _gl_cxxalias_dummy
  237. #endif
  238. /* _GL_CXXALIASWARN (func);
  239. causes a warning to be emitted when ::func is used but not when
  240. GNULIB_NAMESPACE::func is used. func must be defined without overloaded
  241. variants. */
  242. #if defined __cplusplus && defined GNULIB_NAMESPACE
  243. # define _GL_CXXALIASWARN(func) \
  244. _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
  245. # define _GL_CXXALIASWARN_1(func,namespace) \
  246. _GL_CXXALIASWARN_2 (func, namespace)
  247. /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
  248. we enable the warning only when not optimizing. */
  249. # if !__OPTIMIZE__
  250. # define _GL_CXXALIASWARN_2(func,namespace) \
  251. _GL_WARN_ON_USE (func, \
  252. "The symbol ::" #func " refers to the system function. " \
  253. "Use " #namespace "::" #func " instead.")
  254. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  255. # define _GL_CXXALIASWARN_2(func,namespace) \
  256. extern __typeof__ (func) func
  257. # else
  258. # define _GL_CXXALIASWARN_2(func,namespace) \
  259. _GL_EXTERN_C int _gl_cxxalias_dummy
  260. # endif
  261. #else
  262. # define _GL_CXXALIASWARN(func) \
  263. _GL_EXTERN_C int _gl_cxxalias_dummy
  264. #endif
  265. /* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
  266. causes a warning to be emitted when the given overloaded variant of ::func
  267. is used but not when GNULIB_NAMESPACE::func is used. */
  268. #if defined __cplusplus && defined GNULIB_NAMESPACE
  269. # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
  270. _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
  271. GNULIB_NAMESPACE)
  272. # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
  273. _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
  274. /* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
  275. we enable the warning only when not optimizing. */
  276. # if !__OPTIMIZE__
  277. # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
  278. _GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
  279. "The symbol ::" #func " refers to the system function. " \
  280. "Use " #namespace "::" #func " instead.")
  281. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  282. # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
  283. extern __typeof__ (func) func
  284. # else
  285. # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
  286. _GL_EXTERN_C int _gl_cxxalias_dummy
  287. # endif
  288. #else
  289. # define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
  290. _GL_EXTERN_C int _gl_cxxalias_dummy
  291. #endif
  292. #endif /* _GL_CXXDEFS_H */
  293. /* The definition of _GL_ARG_NONNULL is copied here. */
  294. /* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
  295. that the values passed as arguments n, ..., m must be non-NULL pointers.
  296. n = 1 stands for the first argument, n = 2 for the second argument etc. */
  297. #ifndef _GL_ARG_NONNULL
  298. # if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
  299. # define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
  300. # else
  301. # define _GL_ARG_NONNULL(params)
  302. # endif
  303. #endif
  304. /* The definition of _GL_WARN_ON_USE is copied here. */
  305. #ifndef _GL_WARN_ON_USE
  306. # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
  307. /* A compiler attribute is available in gcc versions 4.3.0 and later. */
  308. # define _GL_WARN_ON_USE(function, message) \
  309. extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
  310. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  311. /* Verify the existence of the function. */
  312. # define _GL_WARN_ON_USE(function, message) \
  313. extern __typeof__ (function) function
  314. # else /* Unsupported. */
  315. # define _GL_WARN_ON_USE(function, message) \
  316. _GL_WARN_EXTERN_C int _gl_warn_on_use
  317. # endif
  318. #endif
  319. /* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
  320. is like _GL_WARN_ON_USE (function, "string"), except that the function is
  321. declared with the given prototype, consisting of return type, parameters,
  322. and attributes.
  323. This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
  324. not work in this case. */
  325. #ifndef _GL_WARN_ON_USE_CXX
  326. # if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
  327. # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
  328. extern rettype function parameters_and_attributes \
  329. __attribute__ ((__warning__ (msg)))
  330. # elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
  331. /* Verify the existence of the function. */
  332. # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
  333. extern rettype function parameters_and_attributes
  334. # else /* Unsupported. */
  335. # define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
  336. _GL_WARN_EXTERN_C int _gl_warn_on_use
  337. # endif
  338. #endif
  339. /* _GL_WARN_EXTERN_C declaration;
  340. performs the declaration with C linkage. */
  341. #ifndef _GL_WARN_EXTERN_C
  342. # if defined __cplusplus
  343. # define _GL_WARN_EXTERN_C extern "C"
  344. # else
  345. # define _GL_WARN_EXTERN_C extern
  346. # endif
  347. #endif
  348. /* Hide some function declarations from <winsock2.h>. */
  349. #if 0 && 0
  350. # if !defined _GL_M4_SYS_SOCKET_H
  351. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  352. # undef socket
  353. # define socket socket_used_without_including_sys_socket_h
  354. # undef connect
  355. # define connect connect_used_without_including_sys_socket_h
  356. # undef accept
  357. # define accept accept_used_without_including_sys_socket_h
  358. # undef bind
  359. # define bind bind_used_without_including_sys_socket_h
  360. # undef getpeername
  361. # define getpeername getpeername_used_without_including_sys_socket_h
  362. # undef getsockname
  363. # define getsockname getsockname_used_without_including_sys_socket_h
  364. # undef getsockopt
  365. # define getsockopt getsockopt_used_without_including_sys_socket_h
  366. # undef listen
  367. # define listen listen_used_without_including_sys_socket_h
  368. # undef recv
  369. # define recv recv_used_without_including_sys_socket_h
  370. # undef send
  371. # define send send_used_without_including_sys_socket_h
  372. # undef recvfrom
  373. # define recvfrom recvfrom_used_without_including_sys_socket_h
  374. # undef sendto
  375. # define sendto sendto_used_without_including_sys_socket_h
  376. # undef setsockopt
  377. # define setsockopt setsockopt_used_without_including_sys_socket_h
  378. # undef shutdown
  379. # define shutdown shutdown_used_without_including_sys_socket_h
  380. # else
  381. _GL_WARN_ON_USE (socket,
  382. "socket() used without including <sys/socket.h>");
  383. _GL_WARN_ON_USE (connect,
  384. "connect() used without including <sys/socket.h>");
  385. _GL_WARN_ON_USE (accept,
  386. "accept() used without including <sys/socket.h>");
  387. _GL_WARN_ON_USE (bind,
  388. "bind() used without including <sys/socket.h>");
  389. _GL_WARN_ON_USE (getpeername,
  390. "getpeername() used without including <sys/socket.h>");
  391. _GL_WARN_ON_USE (getsockname,
  392. "getsockname() used without including <sys/socket.h>");
  393. _GL_WARN_ON_USE (getsockopt,
  394. "getsockopt() used without including <sys/socket.h>");
  395. _GL_WARN_ON_USE (listen,
  396. "listen() used without including <sys/socket.h>");
  397. _GL_WARN_ON_USE (recv,
  398. "recv() used without including <sys/socket.h>");
  399. _GL_WARN_ON_USE (send,
  400. "send() used without including <sys/socket.h>");
  401. _GL_WARN_ON_USE (recvfrom,
  402. "recvfrom() used without including <sys/socket.h>");
  403. _GL_WARN_ON_USE (sendto,
  404. "sendto() used without including <sys/socket.h>");
  405. _GL_WARN_ON_USE (setsockopt,
  406. "setsockopt() used without including <sys/socket.h>");
  407. _GL_WARN_ON_USE (shutdown,
  408. "shutdown() used without including <sys/socket.h>");
  409. # endif
  410. # endif
  411. # if !defined _GL_M4_SYS_SELECT_H
  412. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  413. # undef select
  414. # define select select_used_without_including_sys_select_h
  415. # else
  416. _GL_WARN_ON_USE (select,
  417. "select() used without including <sys/select.h>");
  418. # endif
  419. # endif
  420. #endif
  421. /* OS/2 EMX lacks these macros. */
  422. #ifndef STDIN_FILENO
  423. # define STDIN_FILENO 0
  424. #endif
  425. #ifndef STDOUT_FILENO
  426. # define STDOUT_FILENO 1
  427. #endif
  428. #ifndef STDERR_FILENO
  429. # define STDERR_FILENO 2
  430. #endif
  431. /* Ensure *_OK macros exist. */
  432. #ifndef F_OK
  433. # define F_OK 0
  434. # define X_OK 1
  435. # define W_OK 2
  436. # define R_OK 4
  437. #endif
  438. /* Declare overridden functions. */
  439. #if defined GNULIB_POSIXCHECK
  440. /* The access() function is a security risk. */
  441. _GL_WARN_ON_USE (access, "the access function is a security risk - "
  442. "use the gnulib module faccessat instead");
  443. #endif
  444. #if 1
  445. _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
  446. _GL_CXXALIASWARN (chdir);
  447. #elif defined GNULIB_POSIXCHECK
  448. # undef chdir
  449. # if HAVE_RAW_DECL_CHDIR
  450. _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
  451. "use gnulib module chdir for portability");
  452. # endif
  453. #endif
  454. #if 0
  455. /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
  456. to GID (if GID is not -1). Follow symbolic links.
  457. Return 0 if successful, otherwise -1 and errno set.
  458. See the POSIX:2008 specification
  459. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
  460. # if 0
  461. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  462. # undef chown
  463. # define chown rpl_chown
  464. # endif
  465. _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
  466. _GL_ARG_NONNULL ((1)));
  467. _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
  468. # else
  469. # if !1
  470. _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
  471. _GL_ARG_NONNULL ((1)));
  472. # endif
  473. _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
  474. # endif
  475. _GL_CXXALIASWARN (chown);
  476. #elif defined GNULIB_POSIXCHECK
  477. # undef chown
  478. # if HAVE_RAW_DECL_CHOWN
  479. _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
  480. "doesn't treat a uid or gid of -1 on some systems - "
  481. "use gnulib module chown for portability");
  482. # endif
  483. #endif
  484. #if 1
  485. # if 1
  486. /* Automatically included by modules that need a replacement for close. */
  487. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  488. # undef close
  489. # define close rpl_close
  490. # endif
  491. _GL_FUNCDECL_RPL (close, int, (int fd));
  492. _GL_CXXALIAS_RPL (close, int, (int fd));
  493. # else
  494. _GL_CXXALIAS_SYS (close, int, (int fd));
  495. # endif
  496. _GL_CXXALIASWARN (close);
  497. #elif 0
  498. # undef close
  499. # define close close_used_without_requesting_gnulib_module_close
  500. #elif defined GNULIB_POSIXCHECK
  501. # undef close
  502. /* Assume close is always declared. */
  503. _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
  504. "use gnulib module close for portability");
  505. #endif
  506. #if IN_M4_GNULIB_TESTS
  507. # if 1
  508. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  509. # define dup rpl_dup
  510. # endif
  511. _GL_FUNCDECL_RPL (dup, int, (int oldfd));
  512. _GL_CXXALIAS_RPL (dup, int, (int oldfd));
  513. # else
  514. _GL_CXXALIAS_SYS (dup, int, (int oldfd));
  515. # endif
  516. _GL_CXXALIASWARN (dup);
  517. #elif defined GNULIB_POSIXCHECK
  518. # undef dup
  519. # if HAVE_RAW_DECL_DUP
  520. _GL_WARN_ON_USE (dup, "dup is unportable - "
  521. "use gnulib module dup for portability");
  522. # endif
  523. #endif
  524. #if 1
  525. /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
  526. NEWFD = OLDFD, otherwise close NEWFD first if it is open.
  527. Return newfd if successful, otherwise -1 and errno set.
  528. See the POSIX:2008 specification
  529. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
  530. # if 1
  531. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  532. # define dup2 rpl_dup2
  533. # endif
  534. _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
  535. _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
  536. # else
  537. # if !1
  538. _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
  539. # endif
  540. _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
  541. # endif
  542. _GL_CXXALIASWARN (dup2);
  543. #elif defined GNULIB_POSIXCHECK
  544. # undef dup2
  545. # if HAVE_RAW_DECL_DUP2
  546. _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
  547. "use gnulib module dup2 for portability");
  548. # endif
  549. #endif
  550. #if 0
  551. /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
  552. specified flags.
  553. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  554. and O_TEXT, O_BINARY (defined in "binary-io.h").
  555. Close NEWFD first if it is open.
  556. Return newfd if successful, otherwise -1 and errno set.
  557. See the Linux man page at
  558. <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
  559. # if 1
  560. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  561. # define dup3 rpl_dup3
  562. # endif
  563. _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
  564. _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
  565. # else
  566. _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
  567. _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
  568. # endif
  569. _GL_CXXALIASWARN (dup3);
  570. #elif defined GNULIB_POSIXCHECK
  571. # undef dup3
  572. # if HAVE_RAW_DECL_DUP3
  573. _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
  574. "use gnulib module dup3 for portability");
  575. # endif
  576. #endif
  577. #if 1
  578. # if !1
  579. /* Set of environment variables and values. An array of strings of the form
  580. "VARIABLE=VALUE", terminated with a NULL. */
  581. # if defined __APPLE__ && defined __MACH__
  582. # include <crt_externs.h>
  583. # define environ (*_NSGetEnviron ())
  584. # else
  585. # ifdef __cplusplus
  586. extern "C" {
  587. # endif
  588. extern char **environ;
  589. # ifdef __cplusplus
  590. }
  591. # endif
  592. # endif
  593. # endif
  594. #elif defined GNULIB_POSIXCHECK
  595. # if HAVE_RAW_DECL_ENVIRON
  596. _GL_UNISTD_INLINE char ***
  597. rpl_environ (void)
  598. {
  599. return &environ;
  600. }
  601. _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
  602. "use gnulib module environ for portability");
  603. # undef environ
  604. # define environ (*rpl_environ ())
  605. # endif
  606. #endif
  607. #if 0
  608. /* Like access(), except that it uses the effective user id and group id of
  609. the current process. */
  610. # if !1
  611. _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
  612. _GL_ARG_NONNULL ((1)));
  613. # endif
  614. _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
  615. _GL_CXXALIASWARN (euidaccess);
  616. # if defined GNULIB_POSIXCHECK
  617. /* Like access(), this function is a security risk. */
  618. _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
  619. "use the gnulib module faccessat instead");
  620. # endif
  621. #elif defined GNULIB_POSIXCHECK
  622. # undef euidaccess
  623. # if HAVE_RAW_DECL_EUIDACCESS
  624. _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
  625. "use gnulib module euidaccess for portability");
  626. # endif
  627. #endif
  628. #if 0
  629. # if !1
  630. _GL_FUNCDECL_SYS (faccessat, int,
  631. (int fd, char const *file, int mode, int flag)
  632. _GL_ARG_NONNULL ((2)));
  633. # endif
  634. _GL_CXXALIAS_SYS (faccessat, int,
  635. (int fd, char const *file, int mode, int flag));
  636. _GL_CXXALIASWARN (faccessat);
  637. #elif defined GNULIB_POSIXCHECK
  638. # undef faccessat
  639. # if HAVE_RAW_DECL_FACCESSAT
  640. _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
  641. "use gnulib module faccessat for portability");
  642. # endif
  643. #endif
  644. #if 0
  645. /* Change the process' current working directory to the directory on which
  646. the given file descriptor is open.
  647. Return 0 if successful, otherwise -1 and errno set.
  648. See the POSIX:2008 specification
  649. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
  650. # if ! 1
  651. _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
  652. /* Gnulib internal hooks needed to maintain the fchdir metadata. */
  653. _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
  654. _GL_ARG_NONNULL ((2));
  655. _GL_EXTERN_C void _gl_unregister_fd (int fd);
  656. _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
  657. _GL_EXTERN_C const char *_gl_directory_name (int fd);
  658. # else
  659. # if !1
  660. _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
  661. # endif
  662. # endif
  663. _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
  664. _GL_CXXALIASWARN (fchdir);
  665. #elif defined GNULIB_POSIXCHECK
  666. # undef fchdir
  667. # if HAVE_RAW_DECL_FCHDIR
  668. _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
  669. "use gnulib module fchdir for portability");
  670. # endif
  671. #endif
  672. #if 0
  673. # if 0
  674. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  675. # undef fchownat
  676. # define fchownat rpl_fchownat
  677. # endif
  678. _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
  679. uid_t owner, gid_t group, int flag)
  680. _GL_ARG_NONNULL ((2)));
  681. _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
  682. uid_t owner, gid_t group, int flag));
  683. # else
  684. # if !1
  685. _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
  686. uid_t owner, gid_t group, int flag)
  687. _GL_ARG_NONNULL ((2)));
  688. # endif
  689. _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
  690. uid_t owner, gid_t group, int flag));
  691. # endif
  692. _GL_CXXALIASWARN (fchownat);
  693. #elif defined GNULIB_POSIXCHECK
  694. # undef fchownat
  695. # if HAVE_RAW_DECL_FCHOWNAT
  696. _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
  697. "use gnulib module openat for portability");
  698. # endif
  699. #endif
  700. #if 0
  701. /* Synchronize changes to a file.
  702. Return 0 if successful, otherwise -1 and errno set.
  703. See POSIX:2008 specification
  704. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
  705. # if !1 || !1
  706. _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
  707. # endif
  708. _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
  709. _GL_CXXALIASWARN (fdatasync);
  710. #elif defined GNULIB_POSIXCHECK
  711. # undef fdatasync
  712. # if HAVE_RAW_DECL_FDATASYNC
  713. _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
  714. "use gnulib module fdatasync for portability");
  715. # endif
  716. #endif
  717. #if 0
  718. /* Synchronize changes, including metadata, to a file.
  719. Return 0 if successful, otherwise -1 and errno set.
  720. See POSIX:2008 specification
  721. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
  722. # if !1
  723. _GL_FUNCDECL_SYS (fsync, int, (int fd));
  724. # endif
  725. _GL_CXXALIAS_SYS (fsync, int, (int fd));
  726. _GL_CXXALIASWARN (fsync);
  727. #elif defined GNULIB_POSIXCHECK
  728. # undef fsync
  729. # if HAVE_RAW_DECL_FSYNC
  730. _GL_WARN_ON_USE (fsync, "fsync is unportable - "
  731. "use gnulib module fsync for portability");
  732. # endif
  733. #endif
  734. #if 0
  735. /* Change the size of the file to which FD is opened to become equal to LENGTH.
  736. Return 0 if successful, otherwise -1 and errno set.
  737. See the POSIX:2008 specification
  738. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
  739. # if 0
  740. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  741. # undef ftruncate
  742. # define ftruncate rpl_ftruncate
  743. # endif
  744. _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
  745. _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
  746. # else
  747. # if !1
  748. _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
  749. # endif
  750. _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
  751. # endif
  752. _GL_CXXALIASWARN (ftruncate);
  753. #elif defined GNULIB_POSIXCHECK
  754. # undef ftruncate
  755. # if HAVE_RAW_DECL_FTRUNCATE
  756. _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
  757. "use gnulib module ftruncate for portability");
  758. # endif
  759. #endif
  760. #if IN_M4_GNULIB_TESTS
  761. /* Get the name of the current working directory, and put it in SIZE bytes
  762. of BUF.
  763. Return BUF if successful, or NULL if the directory couldn't be determined
  764. or SIZE was too small.
  765. See the POSIX:2008 specification
  766. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
  767. Additionally, the gnulib module 'getcwd' guarantees the following GNU
  768. extension: If BUF is NULL, an array is allocated with 'malloc'; the array
  769. is SIZE bytes long, unless SIZE == 0, in which case it is as big as
  770. necessary. */
  771. # if 1
  772. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  773. # define getcwd rpl_getcwd
  774. # endif
  775. _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
  776. _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
  777. # else
  778. /* Need to cast, because on mingw, the second parameter is
  779. int size. */
  780. _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
  781. # endif
  782. _GL_CXXALIASWARN (getcwd);
  783. #elif defined GNULIB_POSIXCHECK
  784. # undef getcwd
  785. # if HAVE_RAW_DECL_GETCWD
  786. _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
  787. "use gnulib module getcwd for portability");
  788. # endif
  789. #endif
  790. #if 0
  791. /* Return the NIS domain name of the machine.
  792. WARNING! The NIS domain name is unrelated to the fully qualified host name
  793. of the machine. It is also unrelated to email addresses.
  794. WARNING! The NIS domain name is usually the empty string or "(none)" when
  795. not using NIS.
  796. Put up to LEN bytes of the NIS domain name into NAME.
  797. Null terminate it if the name is shorter than LEN.
  798. If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
  799. Return 0 if successful, otherwise set errno and return -1. */
  800. # if 0
  801. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  802. # undef getdomainname
  803. # define getdomainname rpl_getdomainname
  804. # endif
  805. _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
  806. _GL_ARG_NONNULL ((1)));
  807. _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
  808. # else
  809. # if !1
  810. _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
  811. _GL_ARG_NONNULL ((1)));
  812. # endif
  813. _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
  814. # endif
  815. _GL_CXXALIASWARN (getdomainname);
  816. #elif defined GNULIB_POSIXCHECK
  817. # undef getdomainname
  818. # if HAVE_RAW_DECL_GETDOMAINNAME
  819. _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
  820. "use gnulib module getdomainname for portability");
  821. # endif
  822. #endif
  823. #if 1
  824. /* Return the maximum number of file descriptors in the current process.
  825. In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
  826. # if !0
  827. _GL_FUNCDECL_SYS (getdtablesize, int, (void));
  828. # endif
  829. _GL_CXXALIAS_SYS (getdtablesize, int, (void));
  830. _GL_CXXALIASWARN (getdtablesize);
  831. #elif defined GNULIB_POSIXCHECK
  832. # undef getdtablesize
  833. # if HAVE_RAW_DECL_GETDTABLESIZE
  834. _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
  835. "use gnulib module getdtablesize for portability");
  836. # endif
  837. #endif
  838. #if 0
  839. /* Return the supplemental groups that the current process belongs to.
  840. It is unspecified whether the effective group id is in the list.
  841. If N is 0, return the group count; otherwise, N describes how many
  842. entries are available in GROUPS. Return -1 and set errno if N is
  843. not 0 and not large enough. Fails with ENOSYS on some systems. */
  844. # if 0
  845. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  846. # undef getgroups
  847. # define getgroups rpl_getgroups
  848. # endif
  849. _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
  850. _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
  851. # else
  852. # if !1
  853. _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
  854. # endif
  855. _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
  856. # endif
  857. _GL_CXXALIASWARN (getgroups);
  858. #elif defined GNULIB_POSIXCHECK
  859. # undef getgroups
  860. # if HAVE_RAW_DECL_GETGROUPS
  861. _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
  862. "use gnulib module getgroups for portability");
  863. # endif
  864. #endif
  865. #if 0
  866. /* Return the standard host name of the machine.
  867. WARNING! The host name may or may not be fully qualified.
  868. Put up to LEN bytes of the host name into NAME.
  869. Null terminate it if the name is shorter than LEN.
  870. If the host name is longer than LEN, set errno = EINVAL and return -1.
  871. Return 0 if successful, otherwise set errno and return -1. */
  872. # if 0
  873. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  874. # undef gethostname
  875. # define gethostname rpl_gethostname
  876. # endif
  877. _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
  878. _GL_ARG_NONNULL ((1)));
  879. _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
  880. # else
  881. # if !1
  882. _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
  883. _GL_ARG_NONNULL ((1)));
  884. # endif
  885. /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
  886. parameter is
  887. int len. */
  888. _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
  889. # endif
  890. _GL_CXXALIASWARN (gethostname);
  891. #elif 0
  892. # undef gethostname
  893. # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
  894. #elif defined GNULIB_POSIXCHECK
  895. # undef gethostname
  896. # if HAVE_RAW_DECL_GETHOSTNAME
  897. _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
  898. "use gnulib module gethostname for portability");
  899. # endif
  900. #endif
  901. #if 0
  902. /* Returns the user's login name, or NULL if it cannot be found. Upon error,
  903. returns NULL with errno set.
  904. See <http://www.opengroup.org/susv3xsh/getlogin.html>.
  905. Most programs don't need to use this function, because the information is
  906. available through environment variables:
  907. ${LOGNAME-$USER} on Unix platforms,
  908. $USERNAME on native Windows platforms.
  909. */
  910. # if !1
  911. _GL_FUNCDECL_SYS (getlogin, char *, (void));
  912. # endif
  913. _GL_CXXALIAS_SYS (getlogin, char *, (void));
  914. _GL_CXXALIASWARN (getlogin);
  915. #elif defined GNULIB_POSIXCHECK
  916. # undef getlogin
  917. # if HAVE_RAW_DECL_GETLOGIN
  918. _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
  919. "use gnulib module getlogin for portability");
  920. # endif
  921. #endif
  922. #if 0
  923. /* Copies the user's login name to NAME.
  924. The array pointed to by NAME has room for SIZE bytes.
  925. Returns 0 if successful. Upon error, an error number is returned, or -1 in
  926. the case that the login name cannot be found but no specific error is
  927. provided (this case is hopefully rare but is left open by the POSIX spec).
  928. See <http://www.opengroup.org/susv3xsh/getlogin.html>.
  929. Most programs don't need to use this function, because the information is
  930. available through environment variables:
  931. ${LOGNAME-$USER} on Unix platforms,
  932. $USERNAME on native Windows platforms.
  933. */
  934. # if 0
  935. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  936. # define getlogin_r rpl_getlogin_r
  937. # endif
  938. _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
  939. _GL_ARG_NONNULL ((1)));
  940. _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
  941. # else
  942. # if !1
  943. _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
  944. _GL_ARG_NONNULL ((1)));
  945. # endif
  946. /* Need to cast, because on Solaris 10 systems, the second argument is
  947. int size. */
  948. _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
  949. # endif
  950. _GL_CXXALIASWARN (getlogin_r);
  951. #elif defined GNULIB_POSIXCHECK
  952. # undef getlogin_r
  953. # if HAVE_RAW_DECL_GETLOGIN_R
  954. _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
  955. "use gnulib module getlogin_r for portability");
  956. # endif
  957. #endif
  958. #if IN_M4_GNULIB_TESTS
  959. # if 1
  960. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  961. # define getpagesize rpl_getpagesize
  962. # endif
  963. _GL_FUNCDECL_RPL (getpagesize, int, (void));
  964. _GL_CXXALIAS_RPL (getpagesize, int, (void));
  965. # else
  966. # if !0
  967. # if !defined getpagesize
  968. /* This is for POSIX systems. */
  969. # if !defined _gl_getpagesize && defined _SC_PAGESIZE
  970. # if ! (defined __VMS && __VMS_VER < 70000000)
  971. # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
  972. # endif
  973. # endif
  974. /* This is for older VMS. */
  975. # if !defined _gl_getpagesize && defined __VMS
  976. # ifdef __ALPHA
  977. # define _gl_getpagesize() 8192
  978. # else
  979. # define _gl_getpagesize() 512
  980. # endif
  981. # endif
  982. /* This is for BeOS. */
  983. # if !defined _gl_getpagesize && 0
  984. # error #include <OS.h>
  985. # if defined B_PAGE_SIZE
  986. # define _gl_getpagesize() B_PAGE_SIZE
  987. # endif
  988. # endif
  989. /* This is for AmigaOS4.0. */
  990. # if !defined _gl_getpagesize && defined __amigaos4__
  991. # define _gl_getpagesize() 2048
  992. # endif
  993. /* This is for older Unix systems. */
  994. # if !defined _gl_getpagesize && 0
  995. # include <sys/param.h>
  996. # ifdef EXEC_PAGESIZE
  997. # define _gl_getpagesize() EXEC_PAGESIZE
  998. # else
  999. # ifdef NBPG
  1000. # ifndef CLSIZE
  1001. # define CLSIZE 1
  1002. # endif
  1003. # define _gl_getpagesize() (NBPG * CLSIZE)
  1004. # else
  1005. # ifdef NBPC
  1006. # define _gl_getpagesize() NBPC
  1007. # endif
  1008. # endif
  1009. # endif
  1010. # endif
  1011. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1012. # define getpagesize() _gl_getpagesize ()
  1013. # else
  1014. # if !GNULIB_defined_getpagesize_function
  1015. _GL_UNISTD_INLINE int
  1016. getpagesize ()
  1017. {
  1018. return _gl_getpagesize ();
  1019. }
  1020. # define GNULIB_defined_getpagesize_function 1
  1021. # endif
  1022. # endif
  1023. # endif
  1024. # endif
  1025. /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
  1026. _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
  1027. # endif
  1028. # if 0
  1029. _GL_CXXALIASWARN (getpagesize);
  1030. # endif
  1031. #elif defined GNULIB_POSIXCHECK
  1032. # undef getpagesize
  1033. # if HAVE_RAW_DECL_GETPAGESIZE
  1034. _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
  1035. "use gnulib module getpagesize for portability");
  1036. # endif
  1037. #endif
  1038. #if 0
  1039. /* Return the next valid login shell on the system, or NULL when the end of
  1040. the list has been reached. */
  1041. # if !1
  1042. _GL_FUNCDECL_SYS (getusershell, char *, (void));
  1043. # endif
  1044. _GL_CXXALIAS_SYS (getusershell, char *, (void));
  1045. _GL_CXXALIASWARN (getusershell);
  1046. #elif defined GNULIB_POSIXCHECK
  1047. # undef getusershell
  1048. # if HAVE_RAW_DECL_GETUSERSHELL
  1049. _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
  1050. "use gnulib module getusershell for portability");
  1051. # endif
  1052. #endif
  1053. #if 0
  1054. /* Rewind to pointer that is advanced at each getusershell() call. */
  1055. # if !1
  1056. _GL_FUNCDECL_SYS (setusershell, void, (void));
  1057. # endif
  1058. _GL_CXXALIAS_SYS (setusershell, void, (void));
  1059. _GL_CXXALIASWARN (setusershell);
  1060. #elif defined GNULIB_POSIXCHECK
  1061. # undef setusershell
  1062. # if HAVE_RAW_DECL_SETUSERSHELL
  1063. _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
  1064. "use gnulib module getusershell for portability");
  1065. # endif
  1066. #endif
  1067. #if 0
  1068. /* Free the pointer that is advanced at each getusershell() call and
  1069. associated resources. */
  1070. # if !1
  1071. _GL_FUNCDECL_SYS (endusershell, void, (void));
  1072. # endif
  1073. _GL_CXXALIAS_SYS (endusershell, void, (void));
  1074. _GL_CXXALIASWARN (endusershell);
  1075. #elif defined GNULIB_POSIXCHECK
  1076. # undef endusershell
  1077. # if HAVE_RAW_DECL_ENDUSERSHELL
  1078. _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
  1079. "use gnulib module getusershell for portability");
  1080. # endif
  1081. #endif
  1082. #if 0
  1083. /* Determine whether group id is in calling user's group list. */
  1084. # if !1
  1085. _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
  1086. # endif
  1087. _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
  1088. _GL_CXXALIASWARN (group_member);
  1089. #elif defined GNULIB_POSIXCHECK
  1090. # undef group_member
  1091. # if HAVE_RAW_DECL_GROUP_MEMBER
  1092. _GL_WARN_ON_USE (group_member, "group_member is unportable - "
  1093. "use gnulib module group-member for portability");
  1094. # endif
  1095. #endif
  1096. #if 0
  1097. # if 0
  1098. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1099. # undef isatty
  1100. # define isatty rpl_isatty
  1101. # endif
  1102. _GL_FUNCDECL_RPL (isatty, int, (int fd));
  1103. _GL_CXXALIAS_RPL (isatty, int, (int fd));
  1104. # else
  1105. _GL_CXXALIAS_SYS (isatty, int, (int fd));
  1106. # endif
  1107. _GL_CXXALIASWARN (isatty);
  1108. #elif defined GNULIB_POSIXCHECK
  1109. # undef isatty
  1110. # if HAVE_RAW_DECL_ISATTY
  1111. _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
  1112. "use gnulib module isatty for portability");
  1113. # endif
  1114. #endif
  1115. #if 0
  1116. /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
  1117. to GID (if GID is not -1). Do not follow symbolic links.
  1118. Return 0 if successful, otherwise -1 and errno set.
  1119. See the POSIX:2008 specification
  1120. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
  1121. # if 0
  1122. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1123. # undef lchown
  1124. # define lchown rpl_lchown
  1125. # endif
  1126. _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
  1127. _GL_ARG_NONNULL ((1)));
  1128. _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
  1129. # else
  1130. # if !1
  1131. _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
  1132. _GL_ARG_NONNULL ((1)));
  1133. # endif
  1134. _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
  1135. # endif
  1136. _GL_CXXALIASWARN (lchown);
  1137. #elif defined GNULIB_POSIXCHECK
  1138. # undef lchown
  1139. # if HAVE_RAW_DECL_LCHOWN
  1140. _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
  1141. "use gnulib module lchown for portability");
  1142. # endif
  1143. #endif
  1144. #if IN_M4_GNULIB_TESTS
  1145. /* Create a new hard link for an existing file.
  1146. Return 0 if successful, otherwise -1 and errno set.
  1147. See POSIX:2008 specification
  1148. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
  1149. # if 0
  1150. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1151. # define link rpl_link
  1152. # endif
  1153. _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
  1154. _GL_ARG_NONNULL ((1, 2)));
  1155. _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
  1156. # else
  1157. # if !0
  1158. _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
  1159. _GL_ARG_NONNULL ((1, 2)));
  1160. # endif
  1161. _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
  1162. # endif
  1163. _GL_CXXALIASWARN (link);
  1164. #elif defined GNULIB_POSIXCHECK
  1165. # undef link
  1166. # if HAVE_RAW_DECL_LINK
  1167. _GL_WARN_ON_USE (link, "link is unportable - "
  1168. "use gnulib module link for portability");
  1169. # endif
  1170. #endif
  1171. #if 0
  1172. /* Create a new hard link for an existing file, relative to two
  1173. directories. FLAG controls whether symlinks are followed.
  1174. Return 0 if successful, otherwise -1 and errno set. */
  1175. # if 0
  1176. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1177. # undef linkat
  1178. # define linkat rpl_linkat
  1179. # endif
  1180. _GL_FUNCDECL_RPL (linkat, int,
  1181. (int fd1, const char *path1, int fd2, const char *path2,
  1182. int flag)
  1183. _GL_ARG_NONNULL ((2, 4)));
  1184. _GL_CXXALIAS_RPL (linkat, int,
  1185. (int fd1, const char *path1, int fd2, const char *path2,
  1186. int flag));
  1187. # else
  1188. # if !1
  1189. _GL_FUNCDECL_SYS (linkat, int,
  1190. (int fd1, const char *path1, int fd2, const char *path2,
  1191. int flag)
  1192. _GL_ARG_NONNULL ((2, 4)));
  1193. # endif
  1194. _GL_CXXALIAS_SYS (linkat, int,
  1195. (int fd1, const char *path1, int fd2, const char *path2,
  1196. int flag));
  1197. # endif
  1198. _GL_CXXALIASWARN (linkat);
  1199. #elif defined GNULIB_POSIXCHECK
  1200. # undef linkat
  1201. # if HAVE_RAW_DECL_LINKAT
  1202. _GL_WARN_ON_USE (linkat, "linkat is unportable - "
  1203. "use gnulib module linkat for portability");
  1204. # endif
  1205. #endif
  1206. #if 1
  1207. /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
  1208. Return the new offset if successful, otherwise -1 and errno set.
  1209. See the POSIX:2008 specification
  1210. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
  1211. # if 1
  1212. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1213. # define lseek rpl_lseek
  1214. # endif
  1215. _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
  1216. _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
  1217. # else
  1218. _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
  1219. # endif
  1220. _GL_CXXALIASWARN (lseek);
  1221. #elif defined GNULIB_POSIXCHECK
  1222. # undef lseek
  1223. # if HAVE_RAW_DECL_LSEEK
  1224. _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
  1225. "systems - use gnulib module lseek for portability");
  1226. # endif
  1227. #endif
  1228. #if 0
  1229. /* Create a pipe, defaulting to O_BINARY mode.
  1230. Store the read-end as fd[0] and the write-end as fd[1].
  1231. Return 0 upon success, or -1 with errno set upon failure. */
  1232. # if !1
  1233. _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
  1234. # endif
  1235. _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
  1236. _GL_CXXALIASWARN (pipe);
  1237. #elif defined GNULIB_POSIXCHECK
  1238. # undef pipe
  1239. # if HAVE_RAW_DECL_PIPE
  1240. _GL_WARN_ON_USE (pipe, "pipe is unportable - "
  1241. "use gnulib module pipe-posix for portability");
  1242. # endif
  1243. #endif
  1244. #if 1
  1245. /* Create a pipe, applying the given flags when opening the read-end of the
  1246. pipe and the write-end of the pipe.
  1247. The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
  1248. and O_TEXT, O_BINARY (defined in "binary-io.h").
  1249. Store the read-end as fd[0] and the write-end as fd[1].
  1250. Return 0 upon success, or -1 with errno set upon failure.
  1251. See also the Linux man page at
  1252. <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
  1253. # if 0
  1254. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1255. # define pipe2 rpl_pipe2
  1256. # endif
  1257. _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
  1258. _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
  1259. # else
  1260. _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
  1261. _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
  1262. # endif
  1263. _GL_CXXALIASWARN (pipe2);
  1264. #elif defined GNULIB_POSIXCHECK
  1265. # undef pipe2
  1266. # if HAVE_RAW_DECL_PIPE2
  1267. _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
  1268. "use gnulib module pipe2 for portability");
  1269. # endif
  1270. #endif
  1271. #if 0
  1272. /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
  1273. Return the number of bytes placed into BUF if successful, otherwise
  1274. set errno and return -1. 0 indicates EOF.
  1275. See the POSIX:2008 specification
  1276. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
  1277. # if 0
  1278. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1279. # undef pread
  1280. # define pread rpl_pread
  1281. # endif
  1282. _GL_FUNCDECL_RPL (pread, ssize_t,
  1283. (int fd, void *buf, size_t bufsize, off_t offset)
  1284. _GL_ARG_NONNULL ((2)));
  1285. _GL_CXXALIAS_RPL (pread, ssize_t,
  1286. (int fd, void *buf, size_t bufsize, off_t offset));
  1287. # else
  1288. # if !1
  1289. _GL_FUNCDECL_SYS (pread, ssize_t,
  1290. (int fd, void *buf, size_t bufsize, off_t offset)
  1291. _GL_ARG_NONNULL ((2)));
  1292. # endif
  1293. _GL_CXXALIAS_SYS (pread, ssize_t,
  1294. (int fd, void *buf, size_t bufsize, off_t offset));
  1295. # endif
  1296. _GL_CXXALIASWARN (pread);
  1297. #elif defined GNULIB_POSIXCHECK
  1298. # undef pread
  1299. # if HAVE_RAW_DECL_PREAD
  1300. _GL_WARN_ON_USE (pread, "pread is unportable - "
  1301. "use gnulib module pread for portability");
  1302. # endif
  1303. #endif
  1304. #if 0
  1305. /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
  1306. Return the number of bytes written if successful, otherwise
  1307. set errno and return -1. 0 indicates nothing written. See the
  1308. POSIX:2008 specification
  1309. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
  1310. # if 0
  1311. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1312. # undef pwrite
  1313. # define pwrite rpl_pwrite
  1314. # endif
  1315. _GL_FUNCDECL_RPL (pwrite, ssize_t,
  1316. (int fd, const void *buf, size_t bufsize, off_t offset)
  1317. _GL_ARG_NONNULL ((2)));
  1318. _GL_CXXALIAS_RPL (pwrite, ssize_t,
  1319. (int fd, const void *buf, size_t bufsize, off_t offset));
  1320. # else
  1321. # if !1
  1322. _GL_FUNCDECL_SYS (pwrite, ssize_t,
  1323. (int fd, const void *buf, size_t bufsize, off_t offset)
  1324. _GL_ARG_NONNULL ((2)));
  1325. # endif
  1326. _GL_CXXALIAS_SYS (pwrite, ssize_t,
  1327. (int fd, const void *buf, size_t bufsize, off_t offset));
  1328. # endif
  1329. _GL_CXXALIASWARN (pwrite);
  1330. #elif defined GNULIB_POSIXCHECK
  1331. # undef pwrite
  1332. # if HAVE_RAW_DECL_PWRITE
  1333. _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
  1334. "use gnulib module pwrite for portability");
  1335. # endif
  1336. #endif
  1337. #if 0
  1338. /* Read up to COUNT bytes from file descriptor FD into the buffer starting
  1339. at BUF. See the POSIX:2008 specification
  1340. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
  1341. # if 0
  1342. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1343. # undef read
  1344. # define read rpl_read
  1345. # endif
  1346. _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
  1347. _GL_ARG_NONNULL ((2)));
  1348. _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
  1349. # else
  1350. /* Need to cast, because on mingw, the third parameter is
  1351. unsigned int count
  1352. and the return type is 'int'. */
  1353. _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
  1354. # endif
  1355. _GL_CXXALIASWARN (read);
  1356. #endif
  1357. #if 1
  1358. /* Read the contents of the symbolic link FILE and place the first BUFSIZE
  1359. bytes of it into BUF. Return the number of bytes placed into BUF if
  1360. successful, otherwise -1 and errno set.
  1361. See the POSIX:2008 specification
  1362. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
  1363. # if 0
  1364. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1365. # define readlink rpl_readlink
  1366. # endif
  1367. _GL_FUNCDECL_RPL (readlink, ssize_t,
  1368. (const char *file, char *buf, size_t bufsize)
  1369. _GL_ARG_NONNULL ((1, 2)));
  1370. _GL_CXXALIAS_RPL (readlink, ssize_t,
  1371. (const char *file, char *buf, size_t bufsize));
  1372. # else
  1373. # if !0
  1374. _GL_FUNCDECL_SYS (readlink, ssize_t,
  1375. (const char *file, char *buf, size_t bufsize)
  1376. _GL_ARG_NONNULL ((1, 2)));
  1377. # endif
  1378. _GL_CXXALIAS_SYS (readlink, ssize_t,
  1379. (const char *file, char *buf, size_t bufsize));
  1380. # endif
  1381. _GL_CXXALIASWARN (readlink);
  1382. #elif defined GNULIB_POSIXCHECK
  1383. # undef readlink
  1384. # if HAVE_RAW_DECL_READLINK
  1385. _GL_WARN_ON_USE (readlink, "readlink is unportable - "
  1386. "use gnulib module readlink for portability");
  1387. # endif
  1388. #endif
  1389. #if 0
  1390. # if !1
  1391. _GL_FUNCDECL_SYS (readlinkat, ssize_t,
  1392. (int fd, char const *file, char *buf, size_t len)
  1393. _GL_ARG_NONNULL ((2, 3)));
  1394. # endif
  1395. _GL_CXXALIAS_SYS (readlinkat, ssize_t,
  1396. (int fd, char const *file, char *buf, size_t len));
  1397. _GL_CXXALIASWARN (readlinkat);
  1398. #elif defined GNULIB_POSIXCHECK
  1399. # undef readlinkat
  1400. # if HAVE_RAW_DECL_READLINKAT
  1401. _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
  1402. "use gnulib module readlinkat for portability");
  1403. # endif
  1404. #endif
  1405. #if 1
  1406. /* Remove the directory DIR. */
  1407. # if 1
  1408. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1409. # define rmdir rpl_rmdir
  1410. # endif
  1411. _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
  1412. _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
  1413. # else
  1414. _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
  1415. # endif
  1416. _GL_CXXALIASWARN (rmdir);
  1417. #elif defined GNULIB_POSIXCHECK
  1418. # undef rmdir
  1419. # if HAVE_RAW_DECL_RMDIR
  1420. _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
  1421. "use gnulib module rmdir for portability");
  1422. # endif
  1423. #endif
  1424. #if 0
  1425. /* Set the host name of the machine.
  1426. The host name may or may not be fully qualified.
  1427. Put LEN bytes of NAME into the host name.
  1428. Return 0 if successful, otherwise, set errno and return -1.
  1429. Platforms with no ability to set the hostname return -1 and set
  1430. errno = ENOSYS. */
  1431. # if !1 || !1
  1432. _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
  1433. _GL_ARG_NONNULL ((1)));
  1434. # endif
  1435. /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
  1436. and FreeBSD 6.4 the second parameter is int. On Solaris 11
  1437. 2011-10, the first parameter is not const. */
  1438. _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
  1439. _GL_CXXALIASWARN (sethostname);
  1440. #elif defined GNULIB_POSIXCHECK
  1441. # undef sethostname
  1442. # if HAVE_RAW_DECL_SETHOSTNAME
  1443. _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
  1444. "use gnulib module sethostname for portability");
  1445. # endif
  1446. #endif
  1447. #if IN_M4_GNULIB_TESTS
  1448. /* Pause the execution of the current thread for N seconds.
  1449. Returns the number of seconds left to sleep.
  1450. See the POSIX:2008 specification
  1451. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
  1452. # if 0
  1453. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1454. # undef sleep
  1455. # define sleep rpl_sleep
  1456. # endif
  1457. _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
  1458. _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
  1459. # else
  1460. # if !0
  1461. _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
  1462. # endif
  1463. _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
  1464. # endif
  1465. _GL_CXXALIASWARN (sleep);
  1466. #elif defined GNULIB_POSIXCHECK
  1467. # undef sleep
  1468. # if HAVE_RAW_DECL_SLEEP
  1469. _GL_WARN_ON_USE (sleep, "sleep is unportable - "
  1470. "use gnulib module sleep for portability");
  1471. # endif
  1472. #endif
  1473. #if IN_M4_GNULIB_TESTS
  1474. # if 0
  1475. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1476. # undef symlink
  1477. # define symlink rpl_symlink
  1478. # endif
  1479. _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
  1480. _GL_ARG_NONNULL ((1, 2)));
  1481. _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
  1482. # else
  1483. # if !0
  1484. _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
  1485. _GL_ARG_NONNULL ((1, 2)));
  1486. # endif
  1487. _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
  1488. # endif
  1489. _GL_CXXALIASWARN (symlink);
  1490. #elif defined GNULIB_POSIXCHECK
  1491. # undef symlink
  1492. # if HAVE_RAW_DECL_SYMLINK
  1493. _GL_WARN_ON_USE (symlink, "symlink is not portable - "
  1494. "use gnulib module symlink for portability");
  1495. # endif
  1496. #endif
  1497. #if 0
  1498. # if !1
  1499. _GL_FUNCDECL_SYS (symlinkat, int,
  1500. (char const *contents, int fd, char const *file)
  1501. _GL_ARG_NONNULL ((1, 3)));
  1502. # endif
  1503. _GL_CXXALIAS_SYS (symlinkat, int,
  1504. (char const *contents, int fd, char const *file));
  1505. _GL_CXXALIASWARN (symlinkat);
  1506. #elif defined GNULIB_POSIXCHECK
  1507. # undef symlinkat
  1508. # if HAVE_RAW_DECL_SYMLINKAT
  1509. _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
  1510. "use gnulib module symlinkat for portability");
  1511. # endif
  1512. #endif
  1513. #if 0
  1514. /* Store at most BUFLEN characters of the pathname of the terminal FD is
  1515. open on in BUF. Return 0 on success, otherwise an error number. */
  1516. # if 0
  1517. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1518. # undef ttyname_r
  1519. # define ttyname_r rpl_ttyname_r
  1520. # endif
  1521. _GL_FUNCDECL_RPL (ttyname_r, int,
  1522. (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
  1523. _GL_CXXALIAS_RPL (ttyname_r, int,
  1524. (int fd, char *buf, size_t buflen));
  1525. # else
  1526. # if !1
  1527. _GL_FUNCDECL_SYS (ttyname_r, int,
  1528. (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
  1529. # endif
  1530. _GL_CXXALIAS_SYS (ttyname_r, int,
  1531. (int fd, char *buf, size_t buflen));
  1532. # endif
  1533. _GL_CXXALIASWARN (ttyname_r);
  1534. #elif defined GNULIB_POSIXCHECK
  1535. # undef ttyname_r
  1536. # if HAVE_RAW_DECL_TTYNAME_R
  1537. _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
  1538. "use gnulib module ttyname_r for portability");
  1539. # endif
  1540. #endif
  1541. #if 0
  1542. # if 0
  1543. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1544. # undef unlink
  1545. # define unlink rpl_unlink
  1546. # endif
  1547. _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
  1548. _GL_CXXALIAS_RPL (unlink, int, (char const *file));
  1549. # else
  1550. _GL_CXXALIAS_SYS (unlink, int, (char const *file));
  1551. # endif
  1552. _GL_CXXALIASWARN (unlink);
  1553. #elif defined GNULIB_POSIXCHECK
  1554. # undef unlink
  1555. # if HAVE_RAW_DECL_UNLINK
  1556. _GL_WARN_ON_USE (unlink, "unlink is not portable - "
  1557. "use gnulib module unlink for portability");
  1558. # endif
  1559. #endif
  1560. #if 0
  1561. # if 0
  1562. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1563. # undef unlinkat
  1564. # define unlinkat rpl_unlinkat
  1565. # endif
  1566. _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
  1567. _GL_ARG_NONNULL ((2)));
  1568. _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
  1569. # else
  1570. # if !1
  1571. _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
  1572. _GL_ARG_NONNULL ((2)));
  1573. # endif
  1574. _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
  1575. # endif
  1576. _GL_CXXALIASWARN (unlinkat);
  1577. #elif defined GNULIB_POSIXCHECK
  1578. # undef unlinkat
  1579. # if HAVE_RAW_DECL_UNLINKAT
  1580. _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
  1581. "use gnulib module openat for portability");
  1582. # endif
  1583. #endif
  1584. #if 0
  1585. /* Pause the execution of the current thread for N microseconds.
  1586. Returns 0 on completion, or -1 on range error.
  1587. See the POSIX:2001 specification
  1588. <http://www.opengroup.org/susv3xsh/usleep.html>. */
  1589. # if 0
  1590. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1591. # undef usleep
  1592. # define usleep rpl_usleep
  1593. # endif
  1594. _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
  1595. _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
  1596. # else
  1597. # if !1
  1598. _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
  1599. # endif
  1600. _GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
  1601. # endif
  1602. _GL_CXXALIASWARN (usleep);
  1603. #elif defined GNULIB_POSIXCHECK
  1604. # undef usleep
  1605. # if HAVE_RAW_DECL_USLEEP
  1606. _GL_WARN_ON_USE (usleep, "usleep is unportable - "
  1607. "use gnulib module usleep for portability");
  1608. # endif
  1609. #endif
  1610. #if IN_M4_GNULIB_TESTS
  1611. /* Write up to COUNT bytes starting at BUF to file descriptor FD.
  1612. See the POSIX:2008 specification
  1613. <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
  1614. # if 1
  1615. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1616. # undef write
  1617. # define write rpl_write
  1618. # endif
  1619. _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
  1620. _GL_ARG_NONNULL ((2)));
  1621. _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
  1622. # else
  1623. /* Need to cast, because on mingw, the third parameter is
  1624. unsigned int count
  1625. and the return type is 'int'. */
  1626. _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
  1627. # endif
  1628. _GL_CXXALIASWARN (write);
  1629. #endif
  1630. _GL_INLINE_HEADER_END
  1631. #endif /* _GL_M4_UNISTD_H */
  1632. #endif /* _GL_M4_UNISTD_H */