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