bffdf8fa926b83f0c1c30d1e24328f6579524115
[debian/gzip] / lib / 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 definition of GL_LINK_WARNING is 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 #ifdef __cplusplus
149 extern "C" {
150 #endif
151
152
153 #if @GNULIB_CHOWN@
154 # if @REPLACE_CHOWN@
155 #  undef chown
156 #  define chown rpl_chown
157 # endif
158 # if !@HAVE_CHOWN@ || @REPLACE_CHOWN@
159 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
160    to GID (if GID is not -1).  Follow symbolic links.
161    Return 0 if successful, otherwise -1 and errno set.
162    See the POSIX:2001 specification
163    <http://www.opengroup.org/susv3xsh/chown.html>.  */
164 extern int chown (const char *file, uid_t uid, gid_t gid)
165      _GL_ARG_NONNULL ((1));
166 # endif
167 #elif defined GNULIB_POSIXCHECK
168 # undef chown
169 # define chown(f,u,g) \
170     (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
171                       "doesn't treat a uid or gid of -1 on some systems - " \
172                       "use gnulib module chown for portability"), \
173      chown (f, u, g))
174 #endif
175
176
177 #if @GNULIB_CLOSE@
178 # if @REPLACE_CLOSE@
179 /* Automatically included by modules that need a replacement for close.  */
180 #  undef close
181 #  define close rpl_close
182 extern int close (int);
183 # endif
184 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
185 # undef close
186 # define close close_used_without_requesting_gnulib_module_close
187 #elif defined GNULIB_POSIXCHECK
188 # undef close
189 # define close(f) \
190     (GL_LINK_WARNING ("close does not portably work on sockets - " \
191                       "use gnulib module close for portability"), \
192      close (f))
193 #endif
194
195
196 #if @REPLACE_DUP@
197 # define dup rpl_dup
198 extern int dup (int);
199 #endif
200
201
202 #if @GNULIB_DUP2@
203 # if @REPLACE_DUP2@
204 #  define dup2 rpl_dup2
205 # endif
206 # if !@HAVE_DUP2@ || @REPLACE_DUP2@
207 /* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
208    NEWFD = OLDFD, otherwise close NEWFD first if it is open.
209    Return newfd if successful, otherwise -1 and errno set.
210    See the POSIX:2001 specification
211    <http://www.opengroup.org/susv3xsh/dup2.html>.  */
212 extern int dup2 (int oldfd, int newfd);
213 # endif
214 #elif defined GNULIB_POSIXCHECK
215 # undef dup2
216 # define dup2(o,n) \
217     (GL_LINK_WARNING ("dup2 is unportable - " \
218                       "use gnulib module dup2 for portability"), \
219      dup2 (o, n))
220 #endif
221
222
223 #if @GNULIB_DUP3@
224 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
225    specified flags.
226    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
227    and O_TEXT, O_BINARY (defined in "binary-io.h").
228    Close NEWFD first if it is open.
229    Return newfd if successful, otherwise -1 and errno set.
230    See the Linux man page at
231    <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>.  */
232 # if @HAVE_DUP3@
233 #  define dup3 rpl_dup3
234 # endif
235 extern int dup3 (int oldfd, int newfd, int flags);
236 #elif defined GNULIB_POSIXCHECK
237 # undef dup3
238 # define dup3(o,n,f) \
239     (GL_LINK_WARNING ("dup3 is unportable - " \
240                       "use gnulib module dup3 for portability"), \
241      dup3 (o, n, f))
242 #endif
243
244
245 #if @GNULIB_ENVIRON@
246 # if !@HAVE_DECL_ENVIRON@
247 /* Set of environment variables and values.  An array of strings of the form
248    "VARIABLE=VALUE", terminated with a NULL.  */
249 #  if defined __APPLE__ && defined __MACH__
250 #   include <crt_externs.h>
251 #   define environ (*_NSGetEnviron ())
252 #  else
253 extern char **environ;
254 #  endif
255 # endif
256 #elif defined GNULIB_POSIXCHECK
257 # if HAVE_RAW_DECL_ENVIRON
258 static inline char ***
259 rpl_environ (void)
260 {
261   return &environ;
262 }
263 _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
264                  "use gnulib module environ for portability");
265 #  undef environ
266 #  define environ (*rpl_environ ())
267 # endif
268 #endif
269
270
271 #if @GNULIB_EUIDACCESS@
272 # if !@HAVE_EUIDACCESS@
273 /* Like access(), except that it uses the effective user id and group id of
274    the current process.  */
275 extern int euidaccess (const char *filename, int mode) _GL_ARG_NONNULL ((1));
276 # endif
277 #elif defined GNULIB_POSIXCHECK
278 # undef euidaccess
279 # define euidaccess(f,m) \
280     (GL_LINK_WARNING ("euidaccess is unportable - " \
281                       "use gnulib module euidaccess for portability"), \
282      euidaccess (f, m))
283 #endif
284
285
286 #if @GNULIB_FACCESSAT@
287 # if !@HAVE_FACCESSAT@
288 extern int faccessat (int fd, char const *file, int mode, int flag)
289      _GL_ARG_NONNULL ((2));
290 # endif
291 #elif defined GNULIB_POSIXCHECK
292 # undef faccessat
293 # define faccessat(d,n,m,f)                         \
294     (GL_LINK_WARNING ("faccessat is not portable - " \
295                       "use gnulib module faccessat for portability"), \
296      faccessat (d, n, m, f))
297 #endif
298
299
300 #if @GNULIB_FCHDIR@
301 # if @REPLACE_FCHDIR@
302 /* Change the process' current working directory to the directory on which
303    the given file descriptor is open.
304    Return 0 if successful, otherwise -1 and errno set.
305    See the POSIX:2001 specification
306    <http://www.opengroup.org/susv3xsh/fchdir.html>.  */
307 extern int fchdir (int /*fd*/);
308
309 /* Gnulib internal hooks needed to maintain the fchdir metadata.  */
310 extern int _gl_register_fd (int fd, const char *filename)
311      _GL_ARG_NONNULL ((2));
312 extern void _gl_unregister_fd (int fd);
313 extern int _gl_register_dup (int oldfd, int newfd);
314 extern const char *_gl_directory_name (int fd);
315
316 # endif
317 #elif defined GNULIB_POSIXCHECK
318 # undef fchdir
319 # define fchdir(f) \
320     (GL_LINK_WARNING ("fchdir is unportable - " \
321                       "use gnulib module fchdir for portability"), \
322      fchdir (f))
323 #endif
324
325
326 #if @GNULIB_FCHOWNAT@
327 # if @REPLACE_FCHOWNAT@
328 #  undef fchownat
329 #  define fchownat rpl_fchownat
330 # endif
331 # if !@HAVE_FCHOWNAT@ || @REPLACE_FCHOWNAT@
332 extern int fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag)
333      _GL_ARG_NONNULL ((2));
334 # endif
335 #elif defined GNULIB_POSIXCHECK
336 # undef fchownat
337 # define fchownat(d,n,o,g,f)                        \
338     (GL_LINK_WARNING ("fchownat is not portable - " \
339                       "use gnulib module openat for portability"), \
340      fchownat (d, n, o, g, f))
341 #endif
342
343
344 #if @GNULIB_FSYNC@
345 /* Synchronize changes to a file.
346    Return 0 if successful, otherwise -1 and errno set.
347    See POSIX:2001 specification
348    <http://www.opengroup.org/susv3xsh/fsync.html>.  */
349 # if !@HAVE_FSYNC@
350 extern int fsync (int fd);
351 # endif
352 #elif defined GNULIB_POSIXCHECK
353 # undef fsync
354 # define fsync(fd) \
355     (GL_LINK_WARNING ("fsync is unportable - " \
356                       "use gnulib module fsync for portability"), \
357      fsync (fd))
358 #endif
359
360
361 #if @GNULIB_FTRUNCATE@
362 # if !@HAVE_FTRUNCATE@
363 /* Change the size of the file to which FD is opened to become equal to LENGTH.
364    Return 0 if successful, otherwise -1 and errno set.
365    See the POSIX:2001 specification
366    <http://www.opengroup.org/susv3xsh/ftruncate.html>.  */
367 extern int ftruncate (int fd, off_t length);
368 # endif
369 #elif defined GNULIB_POSIXCHECK
370 # undef ftruncate
371 # define ftruncate(f,l) \
372     (GL_LINK_WARNING ("ftruncate is unportable - " \
373                       "use gnulib module ftruncate for portability"), \
374      ftruncate (f, l))
375 #endif
376
377
378 #if @GNULIB_GETCWD@
379 # if @REPLACE_GETCWD@
380 /* Get the name of the current working directory, and put it in SIZE bytes
381    of BUF.
382    Return BUF if successful, or NULL if the directory couldn't be determined
383    or SIZE was too small.
384    See the POSIX:2001 specification
385    <http://www.opengroup.org/susv3xsh/getcwd.html>.
386    Additionally, the gnulib module 'getcwd' guarantees the following GNU
387    extension: If BUF is NULL, an array is allocated with 'malloc'; the array
388    is SIZE bytes long, unless SIZE == 0, in which case it is as big as
389    necessary.  */
390 #  define getcwd rpl_getcwd
391 extern char * getcwd (char *buf, size_t size);
392 # endif
393 #elif defined GNULIB_POSIXCHECK
394 # undef getcwd
395 # define getcwd(b,s) \
396     (GL_LINK_WARNING ("getcwd is unportable - " \
397                       "use gnulib module getcwd for portability"), \
398      getcwd (b, s))
399 #endif
400
401
402 #if @GNULIB_GETDOMAINNAME@
403 /* Return the NIS domain name of the machine.
404    WARNING! The NIS domain name is unrelated to the fully qualified host name
405             of the machine.  It is also unrelated to email addresses.
406    WARNING! The NIS domain name is usually the empty string or "(none)" when
407             not using NIS.
408
409    Put up to LEN bytes of the NIS domain name into NAME.
410    Null terminate it if the name is shorter than LEN.
411    If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
412    Return 0 if successful, otherwise set errno and return -1.  */
413 # if !@HAVE_GETDOMAINNAME@
414 extern int getdomainname(char *name, size_t len) _GL_ARG_NONNULL ((1));
415 # endif
416 #elif defined GNULIB_POSIXCHECK
417 # undef getdomainname
418 # define getdomainname(n,l) \
419     (GL_LINK_WARNING ("getdomainname is unportable - " \
420                       "use gnulib module getdomainname for portability"), \
421      getdomainname (n, l))
422 #endif
423
424
425 #if @GNULIB_GETDTABLESIZE@
426 # if !@HAVE_GETDTABLESIZE@
427 /* Return the maximum number of file descriptors in the current process.
428    In POSIX, this is same as sysconf (_SC_OPEN_MAX).  */
429 extern int getdtablesize (void);
430 # endif
431 #elif defined GNULIB_POSIXCHECK
432 # undef getdtablesize
433 # define getdtablesize() \
434     (GL_LINK_WARNING ("getdtablesize is unportable - " \
435                       "use gnulib module getdtablesize for portability"), \
436      getdtablesize ())
437 #endif
438
439
440 #if @GNULIB_GETGROUPS@
441 # if @REPLACE_GETGROUPS@
442 #  undef getgroups
443 #  define getgroups rpl_getgroups
444 # endif
445 # if !@HAVE_GETGROUPS@ || @REPLACE_GETGROUPS@
446 /* Return the supplemental groups that the current process belongs to.
447    It is unspecified whether the effective group id is in the list.
448    If N is 0, return the group count; otherwise, N describes how many
449    entries are available in GROUPS.  Return -1 and set errno if N is
450    not 0 and not large enough.  Fails with ENOSYS on some systems.  */
451 int getgroups (int n, gid_t *groups);
452 # endif
453 #elif defined GNULIB_POSIXCHECK
454 # undef getgroups
455 # define getgroups(n,g)                                                 \
456     (GL_LINK_WARNING ("getgroups is unportable - "                      \
457                       "use gnulib module getgroups for portability"),   \
458      getgroups (n, g))
459 #endif
460
461
462 #if @GNULIB_GETHOSTNAME@
463 /* Return the standard host name of the machine.
464    WARNING! The host name may or may not be fully qualified.
465
466    Put up to LEN bytes of the host name into NAME.
467    Null terminate it if the name is shorter than LEN.
468    If the host name is longer than LEN, set errno = EINVAL and return -1.
469    Return 0 if successful, otherwise set errno and return -1.  */
470 # if @UNISTD_H_HAVE_WINSOCK2_H@
471 #  undef gethostname
472 #  define gethostname rpl_gethostname
473 # endif
474 # if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@
475 extern int gethostname(char *name, size_t len) _GL_ARG_NONNULL ((1));
476 # endif
477 #elif @UNISTD_H_HAVE_WINSOCK2_H@
478 # undef gethostname
479 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
480 #elif defined GNULIB_POSIXCHECK
481 # undef gethostname
482 # define gethostname(n,l) \
483     (GL_LINK_WARNING ("gethostname is unportable - " \
484                       "use gnulib module gethostname for portability"), \
485      gethostname (n, l))
486 #endif
487
488
489 #if @GNULIB_GETLOGIN@
490 /* Returns the user's login name, or NULL if it cannot be found.  Upon error,
491    returns NULL with errno set.
492
493    See <http://www.opengroup.org/susv3xsh/getlogin.html>.
494
495    Most programs don't need to use this function, because the information is
496    available through environment variables:
497      ${LOGNAME-$USER}        on Unix platforms,
498      $USERNAME               on native Windows platforms.
499  */
500 # if !@HAVE_GETLOGIN@
501 extern char *getlogin (void);
502 # endif
503 #elif defined GNULIB_POSIXCHECK
504 # undef getlogin
505 # define getlogin() \
506     (GL_LINK_WARNING ("getlogin is unportable - " \
507                       "use gnulib module getlogin for portability"), \
508      getlogin ())
509 #endif
510
511
512 #if @GNULIB_GETLOGIN_R@
513 /* Copies the user's login name to NAME.
514    The array pointed to by NAME has room for SIZE bytes.
515
516    Returns 0 if successful.  Upon error, an error number is returned, or -1 in
517    the case that the login name cannot be found but no specific error is
518    provided (this case is hopefully rare but is left open by the POSIX spec).
519
520    See <http://www.opengroup.org/susv3xsh/getlogin.html>.
521
522    Most programs don't need to use this function, because the information is
523    available through environment variables:
524      ${LOGNAME-$USER}        on Unix platforms,
525      $USERNAME               on native Windows platforms.
526  */
527 # if !@HAVE_DECL_GETLOGIN_R@
528 extern int getlogin_r (char *name, size_t size) _GL_ARG_NONNULL ((1));
529 # endif
530 #elif defined GNULIB_POSIXCHECK
531 # undef getlogin_r
532 # define getlogin_r(n,s) \
533     (GL_LINK_WARNING ("getlogin_r is unportable - " \
534                       "use gnulib module getlogin_r for portability"), \
535      getlogin_r (n, s))
536 #endif
537
538
539 #if @GNULIB_GETPAGESIZE@
540 # if @REPLACE_GETPAGESIZE@
541 #  define getpagesize rpl_getpagesize
542 extern int getpagesize (void);
543 # elif !@HAVE_GETPAGESIZE@
544 /* This is for POSIX systems.  */
545 #  if !defined getpagesize && defined _SC_PAGESIZE
546 #   if ! (defined __VMS && __VMS_VER < 70000000)
547 #    define getpagesize() sysconf (_SC_PAGESIZE)
548 #   endif
549 #  endif
550 /* This is for older VMS.  */
551 #  if !defined getpagesize && defined __VMS
552 #   ifdef __ALPHA
553 #    define getpagesize() 8192
554 #   else
555 #    define getpagesize() 512
556 #   endif
557 #  endif
558 /* This is for BeOS.  */
559 #  if !defined getpagesize && @HAVE_OS_H@
560 #   include <OS.h>
561 #   if defined B_PAGE_SIZE
562 #    define getpagesize() B_PAGE_SIZE
563 #   endif
564 #  endif
565 /* This is for AmigaOS4.0.  */
566 #  if !defined getpagesize && defined __amigaos4__
567 #   define getpagesize() 2048
568 #  endif
569 /* This is for older Unix systems.  */
570 #  if !defined getpagesize && @HAVE_SYS_PARAM_H@
571 #   include <sys/param.h>
572 #   ifdef EXEC_PAGESIZE
573 #    define getpagesize() EXEC_PAGESIZE
574 #   else
575 #    ifdef NBPG
576 #     ifndef CLSIZE
577 #      define CLSIZE 1
578 #     endif
579 #     define getpagesize() (NBPG * CLSIZE)
580 #    else
581 #     ifdef NBPC
582 #      define getpagesize() NBPC
583 #     endif
584 #    endif
585 #   endif
586 #  endif
587 # endif
588 #elif defined GNULIB_POSIXCHECK
589 # undef getpagesize
590 # define getpagesize() \
591     (GL_LINK_WARNING ("getpagesize is unportable - " \
592                       "use gnulib module getpagesize for portability"), \
593      getpagesize ())
594 #endif
595
596
597 #if @GNULIB_GETUSERSHELL@
598 # if !@HAVE_GETUSERSHELL@
599 /* Return the next valid login shell on the system, or NULL when the end of
600    the list has been reached.  */
601 extern char *getusershell (void);
602 /* Rewind to pointer that is advanced at each getusershell() call.  */
603 extern void setusershell (void);
604 /* Free the pointer that is advanced at each getusershell() call and
605    associated resources.  */
606 extern void endusershell (void);
607 # endif
608 #elif defined GNULIB_POSIXCHECK
609 # undef getusershell
610 # define getusershell() \
611     (GL_LINK_WARNING ("getusershell is unportable - " \
612                       "use gnulib module getusershell for portability"), \
613      getusershell ())
614 # undef setusershell
615 # define setusershell() \
616     (GL_LINK_WARNING ("setusershell is unportable - " \
617                       "use gnulib module getusershell for portability"), \
618      setusershell ())
619 # undef endusershell
620 # define endusershell() \
621     (GL_LINK_WARNING ("endusershell is unportable - " \
622                       "use gnulib module getusershell for portability"), \
623      endusershell ())
624 #endif
625
626
627 #if @GNULIB_LCHOWN@
628 # if @REPLACE_LCHOWN@
629 #  undef lchown
630 #  define lchown rpl_lchown
631 # endif
632 # if !@HAVE_LCHOWN@ || @REPLACE_LCHOWN@
633 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
634    to GID (if GID is not -1).  Do not follow symbolic links.
635    Return 0 if successful, otherwise -1 and errno set.
636    See the POSIX:2001 specification
637    <http://www.opengroup.org/susv3xsh/lchown.html>.  */
638 extern int lchown (char const *file, uid_t owner, gid_t group)
639      _GL_ARG_NONNULL ((1));
640 # endif
641 #elif defined GNULIB_POSIXCHECK
642 # undef lchown
643 # define lchown(f,u,g) \
644     (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
645                       "systems - use gnulib module lchown for portability"), \
646      lchown (f, u, g))
647 #endif
648
649
650 #if @GNULIB_LINK@
651 # if @REPLACE_LINK@
652 #  define link rpl_link
653 # endif
654 /* Create a new hard link for an existing file.
655    Return 0 if successful, otherwise -1 and errno set.
656    See POSIX:2001 specification
657    <http://www.opengroup.org/susv3xsh/link.html>.  */
658 # if !@HAVE_LINK@ || @REPLACE_LINK@
659 extern int link (const char *path1, const char *path2)
660      _GL_ARG_NONNULL ((1, 2));
661 # endif
662 #elif defined GNULIB_POSIXCHECK
663 # undef link
664 # define link(path1,path2) \
665     (GL_LINK_WARNING ("link is unportable - " \
666                       "use gnulib module link for portability"), \
667      link (path1, path2))
668 #endif
669
670 #if @GNULIB_LINKAT@
671 # if @REPLACE_LINKAT@
672 #  undef linkat
673 #  define linkat rpl_linkat
674 # endif
675 /* Create a new hard link for an existing file, relative to two
676    directories.  FLAG controls whether symlinks are followed.
677    Return 0 if successful, otherwise -1 and errno set.  */
678 # if !@HAVE_LINKAT@ || @REPLACE_LINKAT@
679 extern int linkat (int fd1, const char *path1, int fd2, const char *path2,
680                    int flag)
681      _GL_ARG_NONNULL ((2, 4));
682 # endif
683 #elif defined GNULIB_POSIXCHECK
684 # undef linkat
685 # define linkat(f1,path1,f2,path2,f)              \
686     (GL_LINK_WARNING ("linkat is unportable - " \
687                       "use gnulib module linkat for portability"), \
688      linkat (f1, path1, f2, path2,f))
689 #endif
690
691 #if @GNULIB_LSEEK@
692 # if @REPLACE_LSEEK@
693 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
694    Return the new offset if successful, otherwise -1 and errno set.
695    See the POSIX:2001 specification
696    <http://www.opengroup.org/susv3xsh/lseek.html>.  */
697 #  define lseek rpl_lseek
698    extern off_t lseek (int fd, off_t offset, int whence);
699 # endif
700 #elif defined GNULIB_POSIXCHECK
701 # undef lseek
702 # define lseek(f,o,w) \
703     (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
704                       "systems - use gnulib module lseek for portability"), \
705      lseek (f, o, w))
706 #endif
707
708
709 #if @GNULIB_PIPE2@
710 /* Create a pipe, applying the given flags when opening the read-end of the
711    pipe and the write-end of the pipe.
712    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
713    and O_TEXT, O_BINARY (defined in "binary-io.h").
714    Store the read-end as fd[0] and the write-end as fd[1].
715    Return 0 upon success, or -1 with errno set upon failure.
716    See also the Linux man page at
717    <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>.  */
718 # if @HAVE_PIPE2@
719 #  define pipe2 rpl_pipe2
720 # endif
721 extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL ((1));
722 #elif defined GNULIB_POSIXCHECK
723 # undef pipe2
724 # define pipe2(f,o) \
725     (GL_LINK_WARNING ("pipe2 is unportable - " \
726                       "use gnulib module pipe2 for portability"), \
727      pipe2 (f, o))
728 #endif
729
730
731 #if @GNULIB_PREAD@
732 # if @REPLACE_PREAD@
733 #  define pread rpl_pread
734 # endif
735 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
736    Return the number of bytes placed into BUF if successful, otherwise
737    set errno and return -1.  0 indicates EOF.  See the POSIX:2001
738    specification <http://www.opengroup.org/susv3xsh/pread.html>.  */
739 # if !@HAVE_PREAD@ || @REPLACE_PREAD@
740   extern ssize_t pread (int fd, void *buf, size_t bufsize, off_t offset)
741        _GL_ARG_NONNULL ((2));
742 # endif
743 #elif defined GNULIB_POSIXCHECK
744 # undef pread
745 # define pread(f,b,s,o)                        \
746     (GL_LINK_WARNING ("pread is unportable - " \
747                       "use gnulib module pread for portability"), \
748      pread (f, b, s, o))
749 #endif
750
751
752 #if @GNULIB_READLINK@
753 # if @REPLACE_READLINK@
754 #  define readlink rpl_readlink
755 # endif
756 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
757    bytes of it into BUF.  Return the number of bytes placed into BUF if
758    successful, otherwise -1 and errno set.
759    See the POSIX:2001 specification
760    <http://www.opengroup.org/susv3xsh/readlink.html>.  */
761 # if !@HAVE_READLINK@ || @REPLACE_READLINK@
762 extern ssize_t readlink (const char *file, char *buf, size_t bufsize)
763      _GL_ARG_NONNULL ((1, 2));
764 # endif
765 #elif defined GNULIB_POSIXCHECK
766 # undef readlink
767 # define readlink(f,b,s) \
768     (GL_LINK_WARNING ("readlink is unportable - " \
769                       "use gnulib module readlink for portability"), \
770      readlink (f, b, s))
771 #endif
772
773
774 #if @GNULIB_READLINKAT@
775 # if !@HAVE_READLINKAT@
776 extern ssize_t readlinkat (int fd, char const *file, char *buf, size_t len)
777      _GL_ARG_NONNULL ((2, 3));
778 # endif
779 #elif defined GNULIB_POSIXCHECK
780 # undef readlinkat
781 # define readlinkat(d,n,b,l)                         \
782     (GL_LINK_WARNING ("readlinkat is not portable - " \
783                       "use gnulib module symlinkat for portability"), \
784      readlinkat (d, n, b, l))
785 #endif
786
787
788 #if @GNULIB_RMDIR@
789 # if @REPLACE_RMDIR@
790 #  define rmdir rpl_rmdir
791 /* Remove the directory DIR.  */
792 extern int rmdir (char const *name) _GL_ARG_NONNULL ((1));
793 # endif
794 #elif defined GNULIB_POSIXCHECK
795 # undef rmdir
796 # define rmdir(n) \
797     (GL_LINK_WARNING ("rmdir is unportable - " \
798                       "use gnulib module rmdir for portability"), \
799      rmdir (n))
800 #endif
801
802
803 #if @GNULIB_SLEEP@
804 # if @REPLACE_SLEEP@
805 #  undef sleep
806 #  define sleep rpl_sleep
807 # endif
808 /* Pause the execution of the current thread for N seconds.
809    Returns the number of seconds left to sleep.
810    See the POSIX:2001 specification
811    <http://www.opengroup.org/susv3xsh/sleep.html>.  */
812 # if !@HAVE_SLEEP@ || @REPLACE_SLEEP@
813 extern unsigned int sleep (unsigned int n);
814 # endif
815 #elif defined GNULIB_POSIXCHECK
816 # undef sleep
817 # define sleep(n) \
818     (GL_LINK_WARNING ("sleep is unportable - " \
819                       "use gnulib module sleep for portability"), \
820      sleep (n))
821 #endif
822
823
824 #if @GNULIB_SYMLINK@
825 # if @REPLACE_SYMLINK@
826 #  undef symlink
827 #  define symlink rpl_symlink
828 # endif
829 # if !@HAVE_SYMLINK@ || @REPLACE_SYMLINK@
830 extern int symlink (char const *contents, char const *file)
831      _GL_ARG_NONNULL ((1, 2));
832 # endif
833 #elif defined GNULIB_POSIXCHECK
834 # undef symlink
835 # define symlink(c,n)                        \
836     (GL_LINK_WARNING ("symlink is not portable - " \
837                       "use gnulib module symlink for portability"), \
838      symlink (c, n))
839 #endif
840
841
842 #if @GNULIB_SYMLINKAT@
843 # if !@HAVE_SYMLINKAT@
844 extern int symlinkat (char const *contents, int fd, char const *file)
845      _GL_ARG_NONNULL ((1, 3));
846 # endif
847 #elif defined GNULIB_POSIXCHECK
848 # undef symlinkat
849 # define symlinkat(c,d,n)                            \
850     (GL_LINK_WARNING ("symlinkat is not portable - " \
851                       "use gnulib module symlinkat for portability"), \
852      symlinkat (c, d, n))
853 #endif
854
855
856 #if @GNULIB_UNLINK@
857 # if @REPLACE_UNLINK@
858 #  undef unlink
859 #  define unlink rpl_unlink
860 extern int unlink (char const *file) _GL_ARG_NONNULL ((1));
861 # endif
862 #elif defined GNULIB_POSIXCHECK
863 # undef unlink
864 # define unlink(n)                         \
865     (GL_LINK_WARNING ("unlink is not portable - " \
866                       "use gnulib module unlink for portability"), \
867      unlink (n))
868 #endif
869
870
871 #if @GNULIB_UNLINKAT@
872 # if @REPLACE_UNLINKAT@
873 #  undef unlinkat
874 #  define unlinkat rpl_unlinkat
875 # endif
876 # if !@HAVE_UNLINKAT@ || @REPLACE_UNLINKAT@
877 extern int unlinkat (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2));
878 # endif
879 #elif defined GNULIB_POSIXCHECK
880 # undef unlinkat
881 # define unlinkat(d,n,f)                         \
882     (GL_LINK_WARNING ("unlinkat is not portable - " \
883                       "use gnulib module openat for portability"), \
884      unlinkat (d, n, f))
885 #endif
886
887
888 #if @GNULIB_USLEEP@
889 # if @REPLACE_USLEEP@
890 #  undef usleep
891 #  define usleep rpl_usleep
892 # endif
893 # if !@HAVE_USLEEP@ || @REPLACE_USLEEP@
894 /* Pause the execution of the current thread for N microseconds.
895    Returns 0 on completion, or -1 on range error.
896    See the POSIX:2001 specification
897    <http://www.opengroup.org/susv3xsh/sleep.html>.  */
898 extern int usleep (useconds_t n);
899 # endif
900 #elif defined GNULIB_POSIXCHECK
901 # undef usleep
902 # define usleep(n) \
903     (GL_LINK_WARNING ("usleep is unportable - " \
904                       "use gnulib module usleep for portability"), \
905      usleep (n))
906 #endif
907
908
909 #if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
910 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
911    See the POSIX:2001 specification
912    <http://www.opengroup.org/susv3xsh/write.html>.  */
913 # undef write
914 # define write rpl_write
915 extern ssize_t write (int fd, const void *buf, size_t count)
916      _GL_ARG_NONNULL ((2));
917 #endif
918
919
920 #ifdef __cplusplus
921 }
922 #endif
923
924
925 #endif /* _GL_UNISTD_H */
926 #endif /* _GL_UNISTD_H */