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