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.
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)
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.
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. */
23 @PRAGMA_SYSTEM_HEADER@
26 /* The include_next requires a split double-inclusion guard. */
28 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
34 /* NetBSD 5.0 mis-defines NULL. Also get size_t. */
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__
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__
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. */
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__))
66 #if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
67 || @GNULIB_PREAD@ || defined GNULIB_POSIXCHECK)
69 # include <sys/types.h>
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
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
84 # define socket socket_used_without_including_sys_socket_h
86 # define connect connect_used_without_including_sys_socket_h
88 # define accept accept_used_without_including_sys_socket_h
90 # define bind bind_used_without_including_sys_socket_h
92 # define getpeername getpeername_used_without_including_sys_socket_h
94 # define getsockname getsockname_used_without_including_sys_socket_h
96 # define getsockopt getsockopt_used_without_including_sys_socket_h
98 # define listen listen_used_without_including_sys_socket_h
100 # define recv recv_used_without_including_sys_socket_h
102 # define send send_used_without_including_sys_socket_h
104 # define recvfrom recvfrom_used_without_including_sys_socket_h
106 # define sendto sendto_used_without_including_sys_socket_h
108 # define setsockopt setsockopt_used_without_including_sys_socket_h
110 # define shutdown shutdown_used_without_including_sys_socket_h
112 # if !defined _GL_SYS_SELECT_H
114 # define select select_used_without_including_sys_select_h
119 /* The definition of GL_LINK_WARNING is copied here. */
121 /* The definition of _GL_ARG_NONNULL is copied here. */
123 /* The definition of _GL_WARN_ON_USE is copied here. */
126 /* OS/2 EMX lacks these macros. */
128 # define STDIN_FILENO 0
130 #ifndef STDOUT_FILENO
131 # define STDOUT_FILENO 1
133 #ifndef STDERR_FILENO
134 # define STDERR_FILENO 2
137 /* Ensure *_OK macros exist. */
146 /* Declare overridden functions. */
156 # define chown rpl_chown
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));
167 #elif defined GNULIB_POSIXCHECK
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"), \
179 /* Automatically included by modules that need a replacement for close. */
181 # define close rpl_close
182 extern int close (int);
184 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
186 # define close close_used_without_requesting_gnulib_module_close
187 #elif defined GNULIB_POSIXCHECK
190 (GL_LINK_WARNING ("close does not portably work on sockets - " \
191 "use gnulib module close for portability"), \
198 extern int dup (int);
204 # define dup2 rpl_dup2
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);
214 #elif defined GNULIB_POSIXCHECK
217 (GL_LINK_WARNING ("dup2 is unportable - " \
218 "use gnulib module dup2 for portability"), \
224 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
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>. */
233 # define dup3 rpl_dup3
235 extern int dup3 (int oldfd, int newfd, int flags);
236 #elif defined GNULIB_POSIXCHECK
238 # define dup3(o,n,f) \
239 (GL_LINK_WARNING ("dup3 is unportable - " \
240 "use gnulib module dup3 for portability"), \
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 ())
253 extern char **environ;
256 #elif defined GNULIB_POSIXCHECK
257 # if HAVE_RAW_DECL_ENVIRON
258 static inline char ***
263 _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
264 "use gnulib module environ for portability");
266 # define environ (*rpl_environ ())
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));
277 #elif defined GNULIB_POSIXCHECK
279 # define euidaccess(f,m) \
280 (GL_LINK_WARNING ("euidaccess is unportable - " \
281 "use gnulib module euidaccess for portability"), \
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));
291 #elif defined GNULIB_POSIXCHECK
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))
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*/);
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);
317 #elif defined GNULIB_POSIXCHECK
320 (GL_LINK_WARNING ("fchdir is unportable - " \
321 "use gnulib module fchdir for portability"), \
326 #if @GNULIB_FCHOWNAT@
327 # if @REPLACE_FCHOWNAT@
329 # define fchownat rpl_fchownat
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));
335 #elif defined GNULIB_POSIXCHECK
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))
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>. */
350 extern int fsync (int fd);
352 #elif defined GNULIB_POSIXCHECK
355 (GL_LINK_WARNING ("fsync is unportable - " \
356 "use gnulib module fsync for portability"), \
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);
369 #elif defined GNULIB_POSIXCHECK
371 # define ftruncate(f,l) \
372 (GL_LINK_WARNING ("ftruncate is unportable - " \
373 "use gnulib module ftruncate for portability"), \
379 # if @REPLACE_GETCWD@
380 /* Get the name of the current working directory, and put it in SIZE bytes
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
390 # define getcwd rpl_getcwd
391 extern char * getcwd (char *buf, size_t size);
393 #elif defined GNULIB_POSIXCHECK
395 # define getcwd(b,s) \
396 (GL_LINK_WARNING ("getcwd is unportable - " \
397 "use gnulib module getcwd for portability"), \
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
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));
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))
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);
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"), \
440 #if @GNULIB_GETGROUPS@
441 # if @REPLACE_GETGROUPS@
443 # define getgroups rpl_getgroups
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);
453 #elif defined GNULIB_POSIXCHECK
455 # define getgroups(n,g) \
456 (GL_LINK_WARNING ("getgroups is unportable - " \
457 "use gnulib module getgroups for portability"), \
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.
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@
472 # define gethostname rpl_gethostname
474 # if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@
475 extern int gethostname(char *name, size_t len) _GL_ARG_NONNULL ((1));
477 #elif @UNISTD_H_HAVE_WINSOCK2_H@
479 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
480 #elif defined GNULIB_POSIXCHECK
482 # define gethostname(n,l) \
483 (GL_LINK_WARNING ("gethostname is unportable - " \
484 "use gnulib module gethostname for portability"), \
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.
493 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
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.
500 # if !@HAVE_GETLOGIN@
501 extern char *getlogin (void);
503 #elif defined GNULIB_POSIXCHECK
505 # define getlogin() \
506 (GL_LINK_WARNING ("getlogin is unportable - " \
507 "use gnulib module getlogin for portability"), \
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.
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).
520 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
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.
527 # if !@HAVE_DECL_GETLOGIN_R@
528 extern int getlogin_r (char *name, size_t size) _GL_ARG_NONNULL ((1));
530 #elif defined GNULIB_POSIXCHECK
532 # define getlogin_r(n,s) \
533 (GL_LINK_WARNING ("getlogin_r is unportable - " \
534 "use gnulib module getlogin_r for portability"), \
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)
550 /* This is for older VMS. */
551 # if !defined getpagesize && defined __VMS
553 # define getpagesize() 8192
555 # define getpagesize() 512
558 /* This is for BeOS. */
559 # if !defined getpagesize && @HAVE_OS_H@
561 # if defined B_PAGE_SIZE
562 # define getpagesize() B_PAGE_SIZE
565 /* This is for AmigaOS4.0. */
566 # if !defined getpagesize && defined __amigaos4__
567 # define getpagesize() 2048
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
579 # define getpagesize() (NBPG * CLSIZE)
582 # define getpagesize() NBPC
588 #elif defined GNULIB_POSIXCHECK
590 # define getpagesize() \
591 (GL_LINK_WARNING ("getpagesize is unportable - " \
592 "use gnulib module getpagesize for portability"), \
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);
608 #elif defined GNULIB_POSIXCHECK
610 # define getusershell() \
611 (GL_LINK_WARNING ("getusershell is unportable - " \
612 "use gnulib module getusershell for portability"), \
615 # define setusershell() \
616 (GL_LINK_WARNING ("setusershell is unportable - " \
617 "use gnulib module getusershell for portability"), \
620 # define endusershell() \
621 (GL_LINK_WARNING ("endusershell is unportable - " \
622 "use gnulib module getusershell for portability"), \
628 # if @REPLACE_LCHOWN@
630 # define lchown rpl_lchown
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));
641 #elif defined GNULIB_POSIXCHECK
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"), \
652 # define link rpl_link
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));
662 #elif defined GNULIB_POSIXCHECK
664 # define link(path1,path2) \
665 (GL_LINK_WARNING ("link is unportable - " \
666 "use gnulib module link for portability"), \
671 # if @REPLACE_LINKAT@
673 # define linkat rpl_linkat
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,
681 _GL_ARG_NONNULL ((2, 4));
683 #elif defined GNULIB_POSIXCHECK
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))
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);
700 #elif defined GNULIB_POSIXCHECK
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"), \
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>. */
719 # define pipe2 rpl_pipe2
721 extern int pipe2 (int fd[2], int flags) _GL_ARG_NONNULL ((1));
722 #elif defined GNULIB_POSIXCHECK
724 # define pipe2(f,o) \
725 (GL_LINK_WARNING ("pipe2 is unportable - " \
726 "use gnulib module pipe2 for portability"), \
733 # define pread rpl_pread
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));
743 #elif defined GNULIB_POSIXCHECK
745 # define pread(f,b,s,o) \
746 (GL_LINK_WARNING ("pread is unportable - " \
747 "use gnulib module pread for portability"), \
752 #if @GNULIB_READLINK@
753 # if @REPLACE_READLINK@
754 # define readlink rpl_readlink
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));
765 #elif defined GNULIB_POSIXCHECK
767 # define readlink(f,b,s) \
768 (GL_LINK_WARNING ("readlink is unportable - " \
769 "use gnulib module readlink for portability"), \
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));
779 #elif defined GNULIB_POSIXCHECK
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))
790 # define rmdir rpl_rmdir
791 /* Remove the directory DIR. */
792 extern int rmdir (char const *name) _GL_ARG_NONNULL ((1));
794 #elif defined GNULIB_POSIXCHECK
797 (GL_LINK_WARNING ("rmdir is unportable - " \
798 "use gnulib module rmdir for portability"), \
806 # define sleep rpl_sleep
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);
815 #elif defined GNULIB_POSIXCHECK
818 (GL_LINK_WARNING ("sleep is unportable - " \
819 "use gnulib module sleep for portability"), \
825 # if @REPLACE_SYMLINK@
827 # define symlink rpl_symlink
829 # if !@HAVE_SYMLINK@ || @REPLACE_SYMLINK@
830 extern int symlink (char const *contents, char const *file)
831 _GL_ARG_NONNULL ((1, 2));
833 #elif defined GNULIB_POSIXCHECK
835 # define symlink(c,n) \
836 (GL_LINK_WARNING ("symlink is not portable - " \
837 "use gnulib module symlink for portability"), \
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));
847 #elif defined GNULIB_POSIXCHECK
849 # define symlinkat(c,d,n) \
850 (GL_LINK_WARNING ("symlinkat is not portable - " \
851 "use gnulib module symlinkat for portability"), \
857 # if @REPLACE_UNLINK@
859 # define unlink rpl_unlink
860 extern int unlink (char const *file) _GL_ARG_NONNULL ((1));
862 #elif defined GNULIB_POSIXCHECK
865 (GL_LINK_WARNING ("unlink is not portable - " \
866 "use gnulib module unlink for portability"), \
871 #if @GNULIB_UNLINKAT@
872 # if @REPLACE_UNLINKAT@
874 # define unlinkat rpl_unlinkat
876 # if !@HAVE_UNLINKAT@ || @REPLACE_UNLINKAT@
877 extern int unlinkat (int fd, char const *file, int flag) _GL_ARG_NONNULL ((2));
879 #elif defined GNULIB_POSIXCHECK
881 # define unlinkat(d,n,f) \
882 (GL_LINK_WARNING ("unlinkat is not portable - " \
883 "use gnulib module openat for portability"), \
889 # if @REPLACE_USLEEP@
891 # define usleep rpl_usleep
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);
900 #elif defined GNULIB_POSIXCHECK
903 (GL_LINK_WARNING ("usleep is unportable - " \
904 "use gnulib module usleep for portability"), \
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>. */
914 # define write rpl_write
915 extern ssize_t write (int fd, const void *buf, size_t count)
916 _GL_ARG_NONNULL ((2));
925 #endif /* _GL_UNISTD_H */
926 #endif /* _GL_UNISTD_H */