Import upstream version 1.26
[debian/tar] / gnu / unistd.in.h
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Substitute for and wrapper around <unistd.h>.
4    Copyright (C) 2003-2011 Free Software Foundation, Inc.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3, or (at your option)
9    any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software Foundation,
18    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
19
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
24
25 /* Special invocation convention:
26    - On mingw, several headers, including <winsock2.h>, include <unistd.h>,
27      but we need to ensure that both the system <unistd.h> and <winsock2.h>
28      are completely included before we replace gethostname.  */
29 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
30   && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H
31 /* <unistd.h> is being indirectly included for the first time from
32    <winsock2.h>; avoid declaring any overrides.  */
33 # if @HAVE_UNISTD_H@
34 #  @INCLUDE_NEXT@ @NEXT_UNISTD_H@
35 # else
36 #  error unexpected; report this to bug-gnulib@gnu.org
37 # endif
38 # define _GL_WINSOCK2_H_WITNESS
39
40 /* Normal invocation.  */
41 #elif !defined _GL_UNISTD_H
42
43 /* The include_next requires a split double-inclusion guard.  */
44 #if @HAVE_UNISTD_H@
45 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
46 #endif
47
48 /* Get all possible declarations of gethostname().  */
49 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
50   && !defined _GL_INCLUDING_WINSOCK2_H
51 # define _GL_INCLUDING_WINSOCK2_H
52 # include <winsock2.h>
53 # undef _GL_INCLUDING_WINSOCK2_H
54 #endif
55
56 #if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
57 #define _GL_UNISTD_H
58
59 /* NetBSD 5.0 mis-defines NULL.  Also get size_t.  */
60 #include <stddef.h>
61
62 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>.  */
63 /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>.  */
64 /* But avoid namespace pollution on glibc systems.  */
65 #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
66      || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
67          && defined __CYGWIN__)) \
68     && ! defined __GLIBC__
69 # include <stdio.h>
70 #endif
71
72 /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>.  */
73 /* But avoid namespace pollution on glibc systems.  */
74 #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
75     && ! defined __GLIBC__
76 # include <fcntl.h>
77 #endif
78
79 /* mingw fails to declare _exit in <unistd.h>.  */
80 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
81 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>.  */
82 /* But avoid namespace pollution on glibc systems.  */
83 #ifndef __GLIBC__
84 # include <stdlib.h>
85 #endif
86
87 /* mingw declares getcwd in <io.h>, not in <unistd.h>.  */
88 #if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
89      && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
90 # include <io.h>
91 #endif
92
93 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
94    NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>.  */
95 /* But avoid namespace pollution on glibc systems.  */
96 #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
97      || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
98     && !defined __GLIBC__
99 # include <netdb.h>
100 #endif
101
102 #if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
103      || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
104 /* Get ssize_t.  */
105 # include <sys/types.h>
106 #endif
107
108 /* Get getopt(), optarg, optind, opterr, optopt.
109    But avoid namespace pollution on glibc systems.  */
110 #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
111 # include <getopt.h>
112 #endif
113
114 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
115
116 /* The definition of _GL_ARG_NONNULL is copied here.  */
117
118 /* The definition of _GL_WARN_ON_USE is copied here.  */
119
120
121 #if @GNULIB_GETHOSTNAME@
122 /* Get all possible declarations of gethostname().  */
123 # if @UNISTD_H_HAVE_WINSOCK2_H@
124 #  if !defined _GL_SYS_SOCKET_H
125 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
126 #    undef socket
127 #    define socket              socket_used_without_including_sys_socket_h
128 #    undef connect
129 #    define connect             connect_used_without_including_sys_socket_h
130 #    undef accept
131 #    define accept              accept_used_without_including_sys_socket_h
132 #    undef bind
133 #    define bind                bind_used_without_including_sys_socket_h
134 #    undef getpeername
135 #    define getpeername         getpeername_used_without_including_sys_socket_h
136 #    undef getsockname
137 #    define getsockname         getsockname_used_without_including_sys_socket_h
138 #    undef getsockopt
139 #    define getsockopt          getsockopt_used_without_including_sys_socket_h
140 #    undef listen
141 #    define listen              listen_used_without_including_sys_socket_h
142 #    undef recv
143 #    define recv                recv_used_without_including_sys_socket_h
144 #    undef send
145 #    define send                send_used_without_including_sys_socket_h
146 #    undef recvfrom
147 #    define recvfrom            recvfrom_used_without_including_sys_socket_h
148 #    undef sendto
149 #    define sendto              sendto_used_without_including_sys_socket_h
150 #    undef setsockopt
151 #    define setsockopt          setsockopt_used_without_including_sys_socket_h
152 #    undef shutdown
153 #    define shutdown            shutdown_used_without_including_sys_socket_h
154 #   else
155      _GL_WARN_ON_USE (socket,
156                       "socket() used without including <sys/socket.h>");
157      _GL_WARN_ON_USE (connect,
158                       "connect() used without including <sys/socket.h>");
159      _GL_WARN_ON_USE (accept,
160                       "accept() used without including <sys/socket.h>");
161      _GL_WARN_ON_USE (bind,
162                       "bind() used without including <sys/socket.h>");
163      _GL_WARN_ON_USE (getpeername,
164                       "getpeername() used without including <sys/socket.h>");
165      _GL_WARN_ON_USE (getsockname,
166                       "getsockname() used without including <sys/socket.h>");
167      _GL_WARN_ON_USE (getsockopt,
168                       "getsockopt() used without including <sys/socket.h>");
169      _GL_WARN_ON_USE (listen,
170                       "listen() used without including <sys/socket.h>");
171      _GL_WARN_ON_USE (recv,
172                       "recv() used without including <sys/socket.h>");
173      _GL_WARN_ON_USE (send,
174                       "send() used without including <sys/socket.h>");
175      _GL_WARN_ON_USE (recvfrom,
176                       "recvfrom() used without including <sys/socket.h>");
177      _GL_WARN_ON_USE (sendto,
178                       "sendto() used without including <sys/socket.h>");
179      _GL_WARN_ON_USE (setsockopt,
180                       "setsockopt() used without including <sys/socket.h>");
181      _GL_WARN_ON_USE (shutdown,
182                       "shutdown() used without including <sys/socket.h>");
183 #   endif
184 #  endif
185 #  if !defined _GL_SYS_SELECT_H
186 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
187 #    undef select
188 #    define select              select_used_without_including_sys_select_h
189 #   else
190      _GL_WARN_ON_USE (select,
191                       "select() used without including <sys/select.h>");
192 #   endif
193 #  endif
194 # endif
195 #endif
196
197
198 /* OS/2 EMX lacks these macros.  */
199 #ifndef STDIN_FILENO
200 # define STDIN_FILENO 0
201 #endif
202 #ifndef STDOUT_FILENO
203 # define STDOUT_FILENO 1
204 #endif
205 #ifndef STDERR_FILENO
206 # define STDERR_FILENO 2
207 #endif
208
209 /* Ensure *_OK macros exist.  */
210 #ifndef F_OK
211 # define F_OK 0
212 # define X_OK 1
213 # define W_OK 2
214 # define R_OK 4
215 #endif
216
217
218 /* Declare overridden functions.  */
219
220
221 #if defined GNULIB_POSIXCHECK
222 /* The access() function is a security risk.  */
223 _GL_WARN_ON_USE (access, "the access function is a security risk - "
224                  "use the gnulib module faccessat instead");
225 #endif
226
227
228 #if @GNULIB_CHOWN@
229 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
230    to GID (if GID is not -1).  Follow symbolic links.
231    Return 0 if successful, otherwise -1 and errno set.
232    See the POSIX:2001 specification
233    <http://www.opengroup.org/susv3xsh/chown.html>.  */
234 # if @REPLACE_CHOWN@
235 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
236 #   undef chown
237 #   define chown rpl_chown
238 #  endif
239 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
240                               _GL_ARG_NONNULL ((1)));
241 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
242 # else
243 #  if !@HAVE_CHOWN@
244 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
245                               _GL_ARG_NONNULL ((1)));
246 #  endif
247 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
248 # endif
249 _GL_CXXALIASWARN (chown);
250 #elif defined GNULIB_POSIXCHECK
251 # undef chown
252 # if HAVE_RAW_DECL_CHOWN
253 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
254                  "doesn't treat a uid or gid of -1 on some systems - "
255                  "use gnulib module chown for portability");
256 # endif
257 #endif
258
259
260 #if @GNULIB_CLOSE@
261 # if @REPLACE_CLOSE@
262 /* Automatically included by modules that need a replacement for close.  */
263 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
264 #   undef close
265 #   define close rpl_close
266 #  endif
267 _GL_FUNCDECL_RPL (close, int, (int fd));
268 _GL_CXXALIAS_RPL (close, int, (int fd));
269 # else
270 _GL_CXXALIAS_SYS (close, int, (int fd));
271 # endif
272 _GL_CXXALIASWARN (close);
273 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
274 # undef close
275 # define close close_used_without_requesting_gnulib_module_close
276 #elif defined GNULIB_POSIXCHECK
277 # undef close
278 /* Assume close is always declared.  */
279 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
280                  "use gnulib module close for portability");
281 #endif
282
283
284 #if @REPLACE_DUP@
285 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
286 #  define dup rpl_dup
287 # endif
288 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
289 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
290 #else
291 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
292 #endif
293 _GL_CXXALIASWARN (dup);
294
295
296 #if @GNULIB_DUP2@
297 /* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
298    NEWFD = OLDFD, otherwise close NEWFD first if it is open.
299    Return newfd if successful, otherwise -1 and errno set.
300    See the POSIX:2001 specification
301    <http://www.opengroup.org/susv3xsh/dup2.html>.  */
302 # if @REPLACE_DUP2@
303 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
304 #   define dup2 rpl_dup2
305 #  endif
306 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
307 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
308 # else
309 #  if !@HAVE_DUP2@
310 _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
311 #  endif
312 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
313 # endif
314 _GL_CXXALIASWARN (dup2);
315 #elif defined GNULIB_POSIXCHECK
316 # undef dup2
317 # if HAVE_RAW_DECL_DUP2
318 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
319                  "use gnulib module dup2 for portability");
320 # endif
321 #endif
322
323
324 #if @GNULIB_DUP3@
325 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
326    specified flags.
327    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
328    and O_TEXT, O_BINARY (defined in "binary-io.h").
329    Close NEWFD first if it is open.
330    Return newfd if successful, otherwise -1 and errno set.
331    See the Linux man page at
332    <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>.  */
333 # if @HAVE_DUP3@
334 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
335 #   define dup3 rpl_dup3
336 #  endif
337 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
338 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
339 # else
340 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
341 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
342 # endif
343 _GL_CXXALIASWARN (dup3);
344 #elif defined GNULIB_POSIXCHECK
345 # undef dup3
346 # if HAVE_RAW_DECL_DUP3
347 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
348                  "use gnulib module dup3 for portability");
349 # endif
350 #endif
351
352
353 #if @GNULIB_ENVIRON@
354 # if !@HAVE_DECL_ENVIRON@
355 /* Set of environment variables and values.  An array of strings of the form
356    "VARIABLE=VALUE", terminated with a NULL.  */
357 #  if defined __APPLE__ && defined __MACH__
358 #   include <crt_externs.h>
359 #   define environ (*_NSGetEnviron ())
360 #  else
361 #   ifdef __cplusplus
362 extern "C" {
363 #   endif
364 extern char **environ;
365 #   ifdef __cplusplus
366 }
367 #   endif
368 #  endif
369 # endif
370 #elif defined GNULIB_POSIXCHECK
371 # if HAVE_RAW_DECL_ENVIRON
372 static inline char ***
373 rpl_environ (void)
374 {
375   return &environ;
376 }
377 _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
378                  "use gnulib module environ for portability");
379 #  undef environ
380 #  define environ (*rpl_environ ())
381 # endif
382 #endif
383
384
385 #if @GNULIB_EUIDACCESS@
386 /* Like access(), except that it uses the effective user id and group id of
387    the current process.  */
388 # if !@HAVE_EUIDACCESS@
389 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
390                                    _GL_ARG_NONNULL ((1)));
391 # endif
392 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
393 _GL_CXXALIASWARN (euidaccess);
394 # if defined GNULIB_POSIXCHECK
395 /* Like access(), this function is a security risk.  */
396 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
397                  "use the gnulib module faccessat instead");
398 # endif
399 #elif defined GNULIB_POSIXCHECK
400 # undef euidaccess
401 # if HAVE_RAW_DECL_EUIDACCESS
402 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
403                  "use gnulib module euidaccess for portability");
404 # endif
405 #endif
406
407
408 #if @GNULIB_FACCESSAT@
409 # if !@HAVE_FACCESSAT@
410 _GL_FUNCDECL_SYS (faccessat, int,
411                   (int fd, char const *file, int mode, int flag)
412                   _GL_ARG_NONNULL ((2)));
413 # endif
414 _GL_CXXALIAS_SYS (faccessat, int,
415                   (int fd, char const *file, int mode, int flag));
416 _GL_CXXALIASWARN (faccessat);
417 #elif defined GNULIB_POSIXCHECK
418 # undef faccessat
419 # if HAVE_RAW_DECL_FACCESSAT
420 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
421                  "use gnulib module faccessat for portability");
422 # endif
423 #endif
424
425
426 #if @GNULIB_FCHDIR@
427 /* Change the process' current working directory to the directory on which
428    the given file descriptor is open.
429    Return 0 if successful, otherwise -1 and errno set.
430    See the POSIX:2001 specification
431    <http://www.opengroup.org/susv3xsh/fchdir.html>.  */
432 # if ! @HAVE_FCHDIR@
433 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
434
435 /* Gnulib internal hooks needed to maintain the fchdir metadata.  */
436 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
437      _GL_ARG_NONNULL ((2));
438 _GL_EXTERN_C void _gl_unregister_fd (int fd);
439 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
440 _GL_EXTERN_C const char *_gl_directory_name (int fd);
441
442 # else
443 #  if !@HAVE_DECL_FCHDIR@
444 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
445 #  endif
446 # endif
447 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
448 _GL_CXXALIASWARN (fchdir);
449 #elif defined GNULIB_POSIXCHECK
450 # undef fchdir
451 # if HAVE_RAW_DECL_FCHDIR
452 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
453                  "use gnulib module fchdir for portability");
454 # endif
455 #endif
456
457
458 #if @GNULIB_FCHOWNAT@
459 # if @REPLACE_FCHOWNAT@
460 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
461 #   undef fchownat
462 #   define fchownat rpl_fchownat
463 #  endif
464 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
465                                   uid_t owner, gid_t group, int flag)
466                                  _GL_ARG_NONNULL ((2)));
467 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
468                                   uid_t owner, gid_t group, int flag));
469 # else
470 #  if !@HAVE_FCHOWNAT@
471 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
472                                   uid_t owner, gid_t group, int flag)
473                                  _GL_ARG_NONNULL ((2)));
474 #  endif
475 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
476                                   uid_t owner, gid_t group, int flag));
477 # endif
478 _GL_CXXALIASWARN (fchownat);
479 #elif defined GNULIB_POSIXCHECK
480 # undef fchownat
481 # if HAVE_RAW_DECL_FCHOWNAT
482 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
483                  "use gnulib module openat for portability");
484 # endif
485 #endif
486
487
488 #if @GNULIB_FSYNC@
489 /* Synchronize changes to a file.
490    Return 0 if successful, otherwise -1 and errno set.
491    See POSIX:2001 specification
492    <http://www.opengroup.org/susv3xsh/fsync.html>.  */
493 # if !@HAVE_FSYNC@
494 _GL_FUNCDECL_SYS (fsync, int, (int fd));
495 # endif
496 _GL_CXXALIAS_SYS (fsync, int, (int fd));
497 _GL_CXXALIASWARN (fsync);
498 #elif defined GNULIB_POSIXCHECK
499 # undef fsync
500 # if HAVE_RAW_DECL_FSYNC
501 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
502                  "use gnulib module fsync for portability");
503 # endif
504 #endif
505
506
507 #if @GNULIB_FTRUNCATE@
508 /* Change the size of the file to which FD is opened to become equal to LENGTH.
509    Return 0 if successful, otherwise -1 and errno set.
510    See the POSIX:2001 specification
511    <http://www.opengroup.org/susv3xsh/ftruncate.html>.  */
512 # if !@HAVE_FTRUNCATE@
513 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
514 # endif
515 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
516 _GL_CXXALIASWARN (ftruncate);
517 #elif defined GNULIB_POSIXCHECK
518 # undef ftruncate
519 # if HAVE_RAW_DECL_FTRUNCATE
520 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
521                  "use gnulib module ftruncate for portability");
522 # endif
523 #endif
524
525
526 #if @GNULIB_GETCWD@
527 /* Get the name of the current working directory, and put it in SIZE bytes
528    of BUF.
529    Return BUF if successful, or NULL if the directory couldn't be determined
530    or SIZE was too small.
531    See the POSIX:2001 specification
532    <http://www.opengroup.org/susv3xsh/getcwd.html>.
533    Additionally, the gnulib module 'getcwd' guarantees the following GNU
534    extension: If BUF is NULL, an array is allocated with 'malloc'; the array
535    is SIZE bytes long, unless SIZE == 0, in which case it is as big as
536    necessary.  */
537 # if @REPLACE_GETCWD@
538 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
539 #   define getcwd rpl_getcwd
540 #  endif
541 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
542 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
543 # else
544 /* Need to cast, because on mingw, the second parameter is
545                                                    int size.  */
546 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
547 # endif
548 _GL_CXXALIASWARN (getcwd);
549 #elif defined GNULIB_POSIXCHECK
550 # undef getcwd
551 # if HAVE_RAW_DECL_GETCWD
552 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
553                  "use gnulib module getcwd for portability");
554 # endif
555 #endif
556
557
558 #if @GNULIB_GETDOMAINNAME@
559 /* Return the NIS domain name of the machine.
560    WARNING! The NIS domain name is unrelated to the fully qualified host name
561             of the machine.  It is also unrelated to email addresses.
562    WARNING! The NIS domain name is usually the empty string or "(none)" when
563             not using NIS.
564
565    Put up to LEN bytes of the NIS domain name into NAME.
566    Null terminate it if the name is shorter than LEN.
567    If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
568    Return 0 if successful, otherwise set errno and return -1.  */
569 # if @REPLACE_GETDOMAINNAME@
570 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
571 #   undef getdomainname
572 #   define getdomainname rpl_getdomainname
573 #  endif
574 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
575                                       _GL_ARG_NONNULL ((1)));
576 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
577 # else
578 #  if !@HAVE_DECL_GETDOMAINNAME@
579 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
580                                       _GL_ARG_NONNULL ((1)));
581 #  endif
582 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
583 # endif
584 _GL_CXXALIASWARN (getdomainname);
585 #elif defined GNULIB_POSIXCHECK
586 # undef getdomainname
587 # if HAVE_RAW_DECL_GETDOMAINNAME
588 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
589                  "use gnulib module getdomainname for portability");
590 # endif
591 #endif
592
593
594 #if @GNULIB_GETDTABLESIZE@
595 /* Return the maximum number of file descriptors in the current process.
596    In POSIX, this is same as sysconf (_SC_OPEN_MAX).  */
597 # if !@HAVE_GETDTABLESIZE@
598 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
599 # endif
600 _GL_CXXALIAS_SYS (getdtablesize, int, (void));
601 _GL_CXXALIASWARN (getdtablesize);
602 #elif defined GNULIB_POSIXCHECK
603 # undef getdtablesize
604 # if HAVE_RAW_DECL_GETDTABLESIZE
605 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
606                  "use gnulib module getdtablesize for portability");
607 # endif
608 #endif
609
610
611 #if @GNULIB_GETGROUPS@
612 /* Return the supplemental groups that the current process belongs to.
613    It is unspecified whether the effective group id is in the list.
614    If N is 0, return the group count; otherwise, N describes how many
615    entries are available in GROUPS.  Return -1 and set errno if N is
616    not 0 and not large enough.  Fails with ENOSYS on some systems.  */
617 # if @REPLACE_GETGROUPS@
618 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
619 #   undef getgroups
620 #   define getgroups rpl_getgroups
621 #  endif
622 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
623 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
624 # else
625 #  if !@HAVE_GETGROUPS@
626 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
627 #  endif
628 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
629 # endif
630 _GL_CXXALIASWARN (getgroups);
631 #elif defined GNULIB_POSIXCHECK
632 # undef getgroups
633 # if HAVE_RAW_DECL_GETGROUPS
634 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
635                  "use gnulib module getgroups for portability");
636 # endif
637 #endif
638
639
640 #if @GNULIB_GETHOSTNAME@
641 /* Return the standard host name of the machine.
642    WARNING! The host name may or may not be fully qualified.
643
644    Put up to LEN bytes of the host name into NAME.
645    Null terminate it if the name is shorter than LEN.
646    If the host name is longer than LEN, set errno = EINVAL and return -1.
647    Return 0 if successful, otherwise set errno and return -1.  */
648 # if @UNISTD_H_HAVE_WINSOCK2_H@
649 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
650 #   undef gethostname
651 #   define gethostname rpl_gethostname
652 #  endif
653 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
654                                     _GL_ARG_NONNULL ((1)));
655 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
656 # else
657 #  if !@HAVE_GETHOSTNAME@
658 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
659                                     _GL_ARG_NONNULL ((1)));
660 #  endif
661 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
662    parameter is
663                                                       int len.  */
664 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
665 # endif
666 _GL_CXXALIASWARN (gethostname);
667 #elif @UNISTD_H_HAVE_WINSOCK2_H@
668 # undef gethostname
669 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
670 #elif defined GNULIB_POSIXCHECK
671 # undef gethostname
672 # if HAVE_RAW_DECL_GETHOSTNAME
673 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
674                  "use gnulib module gethostname for portability");
675 # endif
676 #endif
677
678
679 #if @GNULIB_GETLOGIN@
680 /* Returns the user's login name, or NULL if it cannot be found.  Upon error,
681    returns NULL with errno set.
682
683    See <http://www.opengroup.org/susv3xsh/getlogin.html>.
684
685    Most programs don't need to use this function, because the information is
686    available through environment variables:
687      ${LOGNAME-$USER}        on Unix platforms,
688      $USERNAME               on native Windows platforms.
689  */
690 # if !@HAVE_GETLOGIN@
691 _GL_FUNCDECL_SYS (getlogin, char *, (void));
692 # endif
693 _GL_CXXALIAS_SYS (getlogin, char *, (void));
694 _GL_CXXALIASWARN (getlogin);
695 #elif defined GNULIB_POSIXCHECK
696 # undef getlogin
697 # if HAVE_RAW_DECL_GETLOGIN
698 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
699                  "use gnulib module getlogin for portability");
700 # endif
701 #endif
702
703
704 #if @GNULIB_GETLOGIN_R@
705 /* Copies the user's login name to NAME.
706    The array pointed to by NAME has room for SIZE bytes.
707
708    Returns 0 if successful.  Upon error, an error number is returned, or -1 in
709    the case that the login name cannot be found but no specific error is
710    provided (this case is hopefully rare but is left open by the POSIX spec).
711
712    See <http://www.opengroup.org/susv3xsh/getlogin.html>.
713
714    Most programs don't need to use this function, because the information is
715    available through environment variables:
716      ${LOGNAME-$USER}        on Unix platforms,
717      $USERNAME               on native Windows platforms.
718  */
719 # if @REPLACE_GETLOGIN_R@
720 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
721 #   define getlogin_r rpl_getlogin_r
722 #  endif
723 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
724                                    _GL_ARG_NONNULL ((1)));
725 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
726 # else
727 #  if !@HAVE_DECL_GETLOGIN_R@
728 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
729                                    _GL_ARG_NONNULL ((1)));
730 #  endif
731 /* Need to cast, because on Solaris 10 systems, the second argument is
732                                                      int size.  */
733 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
734 # endif
735 _GL_CXXALIASWARN (getlogin_r);
736 #elif defined GNULIB_POSIXCHECK
737 # undef getlogin_r
738 # if HAVE_RAW_DECL_GETLOGIN_R
739 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
740                  "use gnulib module getlogin_r for portability");
741 # endif
742 #endif
743
744
745 #if @GNULIB_GETPAGESIZE@
746 # if @REPLACE_GETPAGESIZE@
747 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
748 #   define getpagesize rpl_getpagesize
749 #  endif
750 _GL_FUNCDECL_RPL (getpagesize, int, (void));
751 _GL_CXXALIAS_RPL (getpagesize, int, (void));
752 # else
753 #  if !@HAVE_GETPAGESIZE@
754 #   if !defined getpagesize
755 /* This is for POSIX systems.  */
756 #    if !defined _gl_getpagesize && defined _SC_PAGESIZE
757 #     if ! (defined __VMS && __VMS_VER < 70000000)
758 #      define _gl_getpagesize() sysconf (_SC_PAGESIZE)
759 #     endif
760 #    endif
761 /* This is for older VMS.  */
762 #    if !defined _gl_getpagesize && defined __VMS
763 #     ifdef __ALPHA
764 #      define _gl_getpagesize() 8192
765 #     else
766 #      define _gl_getpagesize() 512
767 #     endif
768 #    endif
769 /* This is for BeOS.  */
770 #    if !defined _gl_getpagesize && @HAVE_OS_H@
771 #     include <OS.h>
772 #     if defined B_PAGE_SIZE
773 #      define _gl_getpagesize() B_PAGE_SIZE
774 #     endif
775 #    endif
776 /* This is for AmigaOS4.0.  */
777 #    if !defined _gl_getpagesize && defined __amigaos4__
778 #     define _gl_getpagesize() 2048
779 #    endif
780 /* This is for older Unix systems.  */
781 #    if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
782 #     include <sys/param.h>
783 #     ifdef EXEC_PAGESIZE
784 #      define _gl_getpagesize() EXEC_PAGESIZE
785 #     else
786 #      ifdef NBPG
787 #       ifndef CLSIZE
788 #        define CLSIZE 1
789 #       endif
790 #       define _gl_getpagesize() (NBPG * CLSIZE)
791 #      else
792 #       ifdef NBPC
793 #        define _gl_getpagesize() NBPC
794 #       endif
795 #      endif
796 #     endif
797 #    endif
798 #    if !(defined __cplusplus && defined GNULIB_NAMESPACE)
799 #     define getpagesize() _gl_getpagesize ()
800 #    else
801 #     if !GNULIB_defined_getpagesize_function
802 static inline int
803 getpagesize ()
804 {
805   return _gl_getpagesize ();
806 }
807 #      define GNULIB_defined_getpagesize_function 1
808 #     endif
809 #    endif
810 #   endif
811 #  endif
812 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t.  */
813 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
814 # endif
815 # if @HAVE_DECL_GETPAGESIZE@
816 _GL_CXXALIASWARN (getpagesize);
817 # endif
818 #elif defined GNULIB_POSIXCHECK
819 # undef getpagesize
820 # if HAVE_RAW_DECL_GETPAGESIZE
821 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
822                  "use gnulib module getpagesize for portability");
823 # endif
824 #endif
825
826
827 #if @GNULIB_GETUSERSHELL@
828 /* Return the next valid login shell on the system, or NULL when the end of
829    the list has been reached.  */
830 # if !@HAVE_DECL_GETUSERSHELL@
831 _GL_FUNCDECL_SYS (getusershell, char *, (void));
832 # endif
833 _GL_CXXALIAS_SYS (getusershell, char *, (void));
834 _GL_CXXALIASWARN (getusershell);
835 #elif defined GNULIB_POSIXCHECK
836 # undef getusershell
837 # if HAVE_RAW_DECL_GETUSERSHELL
838 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
839                  "use gnulib module getusershell for portability");
840 # endif
841 #endif
842
843 #if @GNULIB_GETUSERSHELL@
844 /* Rewind to pointer that is advanced at each getusershell() call.  */
845 # if !@HAVE_DECL_GETUSERSHELL@
846 _GL_FUNCDECL_SYS (setusershell, void, (void));
847 # endif
848 _GL_CXXALIAS_SYS (setusershell, void, (void));
849 _GL_CXXALIASWARN (setusershell);
850 #elif defined GNULIB_POSIXCHECK
851 # undef setusershell
852 # if HAVE_RAW_DECL_SETUSERSHELL
853 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
854                  "use gnulib module getusershell for portability");
855 # endif
856 #endif
857
858 #if @GNULIB_GETUSERSHELL@
859 /* Free the pointer that is advanced at each getusershell() call and
860    associated resources.  */
861 # if !@HAVE_DECL_GETUSERSHELL@
862 _GL_FUNCDECL_SYS (endusershell, void, (void));
863 # endif
864 _GL_CXXALIAS_SYS (endusershell, void, (void));
865 _GL_CXXALIASWARN (endusershell);
866 #elif defined GNULIB_POSIXCHECK
867 # undef endusershell
868 # if HAVE_RAW_DECL_ENDUSERSHELL
869 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
870                  "use gnulib module getusershell for portability");
871 # endif
872 #endif
873
874
875 #if @GNULIB_LCHOWN@
876 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
877    to GID (if GID is not -1).  Do not follow symbolic links.
878    Return 0 if successful, otherwise -1 and errno set.
879    See the POSIX:2001 specification
880    <http://www.opengroup.org/susv3xsh/lchown.html>.  */
881 # if @REPLACE_LCHOWN@
882 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
883 #   undef lchown
884 #   define lchown rpl_lchown
885 #  endif
886 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
887                                _GL_ARG_NONNULL ((1)));
888 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
889 # else
890 #  if !@HAVE_LCHOWN@
891 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
892                                _GL_ARG_NONNULL ((1)));
893 #  endif
894 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
895 # endif
896 _GL_CXXALIASWARN (lchown);
897 #elif defined GNULIB_POSIXCHECK
898 # undef lchown
899 # if HAVE_RAW_DECL_LCHOWN
900 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
901                  "use gnulib module lchown for portability");
902 # endif
903 #endif
904
905
906 #if @GNULIB_LINK@
907 /* Create a new hard link for an existing file.
908    Return 0 if successful, otherwise -1 and errno set.
909    See POSIX:2001 specification
910    <http://www.opengroup.org/susv3xsh/link.html>.  */
911 # if @REPLACE_LINK@
912 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
913 #   define link rpl_link
914 #  endif
915 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
916                              _GL_ARG_NONNULL ((1, 2)));
917 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
918 # else
919 #  if !@HAVE_LINK@
920 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
921                              _GL_ARG_NONNULL ((1, 2)));
922 #  endif
923 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
924 # endif
925 _GL_CXXALIASWARN (link);
926 #elif defined GNULIB_POSIXCHECK
927 # undef link
928 # if HAVE_RAW_DECL_LINK
929 _GL_WARN_ON_USE (link, "link is unportable - "
930                  "use gnulib module link for portability");
931 # endif
932 #endif
933
934
935 #if @GNULIB_LINKAT@
936 /* Create a new hard link for an existing file, relative to two
937    directories.  FLAG controls whether symlinks are followed.
938    Return 0 if successful, otherwise -1 and errno set.  */
939 # if @REPLACE_LINKAT@
940 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
941 #   undef linkat
942 #   define linkat rpl_linkat
943 #  endif
944 _GL_FUNCDECL_RPL (linkat, int,
945                   (int fd1, const char *path1, int fd2, const char *path2,
946                    int flag)
947                   _GL_ARG_NONNULL ((2, 4)));
948 _GL_CXXALIAS_RPL (linkat, int,
949                   (int fd1, const char *path1, int fd2, const char *path2,
950                    int flag));
951 # else
952 #  if !@HAVE_LINKAT@
953 _GL_FUNCDECL_SYS (linkat, int,
954                   (int fd1, const char *path1, int fd2, const char *path2,
955                    int flag)
956                   _GL_ARG_NONNULL ((2, 4)));
957 #  endif
958 _GL_CXXALIAS_SYS (linkat, int,
959                   (int fd1, const char *path1, int fd2, const char *path2,
960                    int flag));
961 # endif
962 _GL_CXXALIASWARN (linkat);
963 #elif defined GNULIB_POSIXCHECK
964 # undef linkat
965 # if HAVE_RAW_DECL_LINKAT
966 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
967                  "use gnulib module linkat for portability");
968 # endif
969 #endif
970
971
972 #if @GNULIB_LSEEK@
973 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
974    Return the new offset if successful, otherwise -1 and errno set.
975    See the POSIX:2001 specification
976    <http://www.opengroup.org/susv3xsh/lseek.html>.  */
977 # if @REPLACE_LSEEK@
978 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
979 #   define lseek rpl_lseek
980 #  endif
981 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
982 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
983 # else
984 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
985 # endif
986 _GL_CXXALIASWARN (lseek);
987 #elif defined GNULIB_POSIXCHECK
988 # undef lseek
989 # if HAVE_RAW_DECL_LSEEK
990 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
991                  "systems - use gnulib module lseek for portability");
992 # endif
993 #endif
994
995
996 #if @GNULIB_PIPE@
997 /* Create a pipe, defaulting to O_BINARY mode.
998    Store the read-end as fd[0] and the write-end as fd[1].
999    Return 0 upon success, or -1 with errno set upon failure.  */
1000 # if !@HAVE_PIPE@
1001 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
1002 # endif
1003 _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1004 _GL_CXXALIASWARN (pipe);
1005 #elif defined GNULIB_POSIXCHECK
1006 # undef pipe
1007 # if HAVE_RAW_DECL_PIPE
1008 _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1009                  "use gnulib module pipe-posix for portability");
1010 # endif
1011 #endif
1012
1013
1014 #if @GNULIB_PIPE2@
1015 /* Create a pipe, applying the given flags when opening the read-end of the
1016    pipe and the write-end of the pipe.
1017    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1018    and O_TEXT, O_BINARY (defined in "binary-io.h").
1019    Store the read-end as fd[0] and the write-end as fd[1].
1020    Return 0 upon success, or -1 with errno set upon failure.
1021    See also the Linux man page at
1022    <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>.  */
1023 # if @HAVE_PIPE2@
1024 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1025 #   define pipe2 rpl_pipe2
1026 #  endif
1027 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1028 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1029 # else
1030 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1031 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1032 # endif
1033 _GL_CXXALIASWARN (pipe2);
1034 #elif defined GNULIB_POSIXCHECK
1035 # undef pipe2
1036 # if HAVE_RAW_DECL_PIPE2
1037 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1038                  "use gnulib module pipe2 for portability");
1039 # endif
1040 #endif
1041
1042
1043 #if @GNULIB_PREAD@
1044 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1045    Return the number of bytes placed into BUF if successful, otherwise
1046    set errno and return -1.  0 indicates EOF.  See the POSIX:2001
1047    specification <http://www.opengroup.org/susv3xsh/pread.html>.  */
1048 # if @REPLACE_PREAD@
1049 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1050 #   define pread rpl_pread
1051 #  endif
1052 _GL_FUNCDECL_RPL (pread, ssize_t,
1053                   (int fd, void *buf, size_t bufsize, off_t offset)
1054                   _GL_ARG_NONNULL ((2)));
1055 _GL_CXXALIAS_RPL (pread, ssize_t,
1056                   (int fd, void *buf, size_t bufsize, off_t offset));
1057 # else
1058 #  if !@HAVE_PREAD@
1059 _GL_FUNCDECL_SYS (pread, ssize_t,
1060                   (int fd, void *buf, size_t bufsize, off_t offset)
1061                   _GL_ARG_NONNULL ((2)));
1062 #  endif
1063 _GL_CXXALIAS_SYS (pread, ssize_t,
1064                   (int fd, void *buf, size_t bufsize, off_t offset));
1065 # endif
1066 _GL_CXXALIASWARN (pread);
1067 #elif defined GNULIB_POSIXCHECK
1068 # undef pread
1069 # if HAVE_RAW_DECL_PREAD
1070 _GL_WARN_ON_USE (pread, "pread is unportable - "
1071                  "use gnulib module pread for portability");
1072 # endif
1073 #endif
1074
1075
1076 #if @GNULIB_PWRITE@
1077 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1078    Return the number of bytes written if successful, otherwise
1079    set errno and return -1.  0 indicates nothing written.  See the
1080    POSIX:2001 specification
1081    <http://www.opengroup.org/susv3xsh/pwrite.html>.  */
1082 # if @REPLACE_PWRITE@
1083 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1084 #   define pwrite rpl_pwrite
1085 #  endif
1086 _GL_FUNCDECL_RPL (pwrite, ssize_t,
1087                   (int fd, const void *buf, size_t bufsize, off_t offset)
1088                   _GL_ARG_NONNULL ((2)));
1089 _GL_CXXALIAS_RPL (pwrite, ssize_t,
1090                   (int fd, const void *buf, size_t bufsize, off_t offset));
1091 # else
1092 #  if !@HAVE_PWRITE@
1093 _GL_FUNCDECL_SYS (pwrite, ssize_t,
1094                   (int fd, const void *buf, size_t bufsize, off_t offset)
1095                   _GL_ARG_NONNULL ((2)));
1096 #  endif
1097 _GL_CXXALIAS_SYS (pwrite, ssize_t,
1098                   (int fd, const void *buf, size_t bufsize, off_t offset));
1099 # endif
1100 _GL_CXXALIASWARN (pwrite);
1101 #elif defined GNULIB_POSIXCHECK
1102 # undef pwrite
1103 # if HAVE_RAW_DECL_PWRITE
1104 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1105                  "use gnulib module pwrite for portability");
1106 # endif
1107 #endif
1108
1109
1110 #if @GNULIB_READLINK@
1111 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
1112    bytes of it into BUF.  Return the number of bytes placed into BUF if
1113    successful, otherwise -1 and errno set.
1114    See the POSIX:2001 specification
1115    <http://www.opengroup.org/susv3xsh/readlink.html>.  */
1116 # if @REPLACE_READLINK@
1117 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1118 #   define readlink rpl_readlink
1119 #  endif
1120 _GL_FUNCDECL_RPL (readlink, ssize_t,
1121                   (const char *file, char *buf, size_t bufsize)
1122                   _GL_ARG_NONNULL ((1, 2)));
1123 _GL_CXXALIAS_RPL (readlink, ssize_t,
1124                   (const char *file, char *buf, size_t bufsize));
1125 # else
1126 #  if !@HAVE_READLINK@
1127 _GL_FUNCDECL_SYS (readlink, ssize_t,
1128                   (const char *file, char *buf, size_t bufsize)
1129                   _GL_ARG_NONNULL ((1, 2)));
1130 #  endif
1131 _GL_CXXALIAS_SYS (readlink, ssize_t,
1132                   (const char *file, char *buf, size_t bufsize));
1133 # endif
1134 _GL_CXXALIASWARN (readlink);
1135 #elif defined GNULIB_POSIXCHECK
1136 # undef readlink
1137 # if HAVE_RAW_DECL_READLINK
1138 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1139                  "use gnulib module readlink for portability");
1140 # endif
1141 #endif
1142
1143
1144 #if @GNULIB_READLINKAT@
1145 # if !@HAVE_READLINKAT@
1146 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
1147                   (int fd, char const *file, char *buf, size_t len)
1148                   _GL_ARG_NONNULL ((2, 3)));
1149 # endif
1150 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
1151                   (int fd, char const *file, char *buf, size_t len));
1152 _GL_CXXALIASWARN (readlinkat);
1153 #elif defined GNULIB_POSIXCHECK
1154 # undef readlinkat
1155 # if HAVE_RAW_DECL_READLINKAT
1156 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1157                  "use gnulib module readlinkat for portability");
1158 # endif
1159 #endif
1160
1161
1162 #if @GNULIB_RMDIR@
1163 /* Remove the directory DIR.  */
1164 # if @REPLACE_RMDIR@
1165 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1166 #   define rmdir rpl_rmdir
1167 #  endif
1168 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1169 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1170 # else
1171 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1172 # endif
1173 _GL_CXXALIASWARN (rmdir);
1174 #elif defined GNULIB_POSIXCHECK
1175 # undef rmdir
1176 # if HAVE_RAW_DECL_RMDIR
1177 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1178                  "use gnulib module rmdir for portability");
1179 # endif
1180 #endif
1181
1182
1183 #if @GNULIB_SLEEP@
1184 /* Pause the execution of the current thread for N seconds.
1185    Returns the number of seconds left to sleep.
1186    See the POSIX:2001 specification
1187    <http://www.opengroup.org/susv3xsh/sleep.html>.  */
1188 # if @REPLACE_SLEEP@
1189 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1190 #   undef sleep
1191 #   define sleep rpl_sleep
1192 #  endif
1193 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1194 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1195 # else
1196 #  if !@HAVE_SLEEP@
1197 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1198 #  endif
1199 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1200 # endif
1201 _GL_CXXALIASWARN (sleep);
1202 #elif defined GNULIB_POSIXCHECK
1203 # undef sleep
1204 # if HAVE_RAW_DECL_SLEEP
1205 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
1206                  "use gnulib module sleep for portability");
1207 # endif
1208 #endif
1209
1210
1211 #if @GNULIB_SYMLINK@
1212 # if @REPLACE_SYMLINK@
1213 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1214 #   undef symlink
1215 #   define symlink rpl_symlink
1216 #  endif
1217 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1218                                 _GL_ARG_NONNULL ((1, 2)));
1219 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1220 # else
1221 #  if !@HAVE_SYMLINK@
1222 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1223                                 _GL_ARG_NONNULL ((1, 2)));
1224 #  endif
1225 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1226 # endif
1227 _GL_CXXALIASWARN (symlink);
1228 #elif defined GNULIB_POSIXCHECK
1229 # undef symlink
1230 # if HAVE_RAW_DECL_SYMLINK
1231 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
1232                  "use gnulib module symlink for portability");
1233 # endif
1234 #endif
1235
1236
1237 #if @GNULIB_SYMLINKAT@
1238 # if !@HAVE_SYMLINKAT@
1239 _GL_FUNCDECL_SYS (symlinkat, int,
1240                   (char const *contents, int fd, char const *file)
1241                   _GL_ARG_NONNULL ((1, 3)));
1242 # endif
1243 _GL_CXXALIAS_SYS (symlinkat, int,
1244                   (char const *contents, int fd, char const *file));
1245 _GL_CXXALIASWARN (symlinkat);
1246 #elif defined GNULIB_POSIXCHECK
1247 # undef symlinkat
1248 # if HAVE_RAW_DECL_SYMLINKAT
1249 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1250                  "use gnulib module symlinkat for portability");
1251 # endif
1252 #endif
1253
1254
1255 #if @GNULIB_TTYNAME_R@
1256 /* Store at most BUFLEN characters of the pathname of the terminal FD is
1257    open on in BUF.  Return 0 on success, otherwise an error number.  */
1258 # if @REPLACE_TTYNAME_R@
1259 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1260 #   undef ttyname_r
1261 #   define ttyname_r rpl_ttyname_r
1262 #  endif
1263 _GL_FUNCDECL_RPL (ttyname_r, int,
1264                   (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1265 _GL_CXXALIAS_RPL (ttyname_r, int,
1266                   (int fd, char *buf, size_t buflen));
1267 # else
1268 #  if !@HAVE_DECL_TTYNAME_R@
1269 _GL_FUNCDECL_SYS (ttyname_r, int,
1270                   (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1271 #  endif
1272 _GL_CXXALIAS_SYS (ttyname_r, int,
1273                   (int fd, char *buf, size_t buflen));
1274 # endif
1275 _GL_CXXALIASWARN (ttyname_r);
1276 #elif defined GNULIB_POSIXCHECK
1277 # undef ttyname_r
1278 # if HAVE_RAW_DECL_TTYNAME_R
1279 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1280                  "use gnulib module ttyname_r for portability");
1281 # endif
1282 #endif
1283
1284
1285 #if @GNULIB_UNLINK@
1286 # if @REPLACE_UNLINK@
1287 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1288 #   undef unlink
1289 #   define unlink rpl_unlink
1290 #  endif
1291 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1292 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
1293 # else
1294 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
1295 # endif
1296 _GL_CXXALIASWARN (unlink);
1297 #elif defined GNULIB_POSIXCHECK
1298 # undef unlink
1299 # if HAVE_RAW_DECL_UNLINK
1300 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
1301                  "use gnulib module unlink for portability");
1302 # endif
1303 #endif
1304
1305
1306 #if @GNULIB_UNLINKAT@
1307 # if @REPLACE_UNLINKAT@
1308 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1309 #   undef unlinkat
1310 #   define unlinkat rpl_unlinkat
1311 #  endif
1312 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1313                                  _GL_ARG_NONNULL ((2)));
1314 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1315 # else
1316 #  if !@HAVE_UNLINKAT@
1317 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1318                                  _GL_ARG_NONNULL ((2)));
1319 #  endif
1320 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1321 # endif
1322 _GL_CXXALIASWARN (unlinkat);
1323 #elif defined GNULIB_POSIXCHECK
1324 # undef unlinkat
1325 # if HAVE_RAW_DECL_UNLINKAT
1326 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1327                  "use gnulib module openat for portability");
1328 # endif
1329 #endif
1330
1331
1332 #if @GNULIB_USLEEP@
1333 /* Pause the execution of the current thread for N microseconds.
1334    Returns 0 on completion, or -1 on range error.
1335    See the POSIX:2001 specification
1336    <http://www.opengroup.org/susv3xsh/sleep.html>.  */
1337 # if @REPLACE_USLEEP@
1338 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1339 #   undef usleep
1340 #   define usleep rpl_usleep
1341 #  endif
1342 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1343 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1344 # else
1345 #  if !@HAVE_USLEEP@
1346 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1347 #  endif
1348 _GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
1349 # endif
1350 _GL_CXXALIASWARN (usleep);
1351 #elif defined GNULIB_POSIXCHECK
1352 # undef usleep
1353 # if HAVE_RAW_DECL_USLEEP
1354 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1355                  "use gnulib module usleep for portability");
1356 # endif
1357 #endif
1358
1359
1360 #if @GNULIB_WRITE@
1361 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
1362    See the POSIX:2001 specification
1363    <http://www.opengroup.org/susv3xsh/write.html>.  */
1364 # if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
1365 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1366 #   undef write
1367 #   define write rpl_write
1368 #  endif
1369 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1370                                   _GL_ARG_NONNULL ((2)));
1371 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1372 # else
1373 /* Need to cast, because on mingw, the third parameter is
1374                                                              unsigned int count
1375    and the return type is 'int'.  */
1376 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1377 # endif
1378 _GL_CXXALIASWARN (write);
1379 #endif
1380
1381
1382 #endif /* _GL_UNISTD_H */
1383 #endif /* _GL_UNISTD_H */