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