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