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