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