1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Substitute for and wrapper around <unistd.h>.
4 Copyright (C) 2003-2011 Free Software Foundation, Inc.
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. */
21 @PRAGMA_SYSTEM_HEADER@
25 /* Special invocation convention:
26 - On mingw, several headers, including <winsock2.h>, include <unistd.h>,
27 but we need to ensure that both the system <unistd.h> and <winsock2.h>
28 are completely included before we replace gethostname. */
29 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
30 && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H
31 /* <unistd.h> is being indirectly included for the first time from
32 <winsock2.h>; avoid declaring any overrides. */
34 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
36 # error unexpected; report this to bug-gnulib@gnu.org
38 # define _GL_WINSOCK2_H_WITNESS
40 /* Normal invocation. */
41 #elif !defined _GL_UNISTD_H
43 /* The include_next requires a split double-inclusion guard. */
45 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
48 /* Get all possible declarations of gethostname(). */
49 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
50 && !defined _GL_INCLUDING_WINSOCK2_H
51 # define _GL_INCLUDING_WINSOCK2_H
52 # include <winsock2.h>
53 # undef _GL_INCLUDING_WINSOCK2_H
56 #if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
59 /* NetBSD 5.0 mis-defines NULL. Also get size_t. */
62 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
63 /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
64 /* But avoid namespace pollution on glibc systems. */
65 #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
66 || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
67 && defined __CYGWIN__)) \
68 && ! defined __GLIBC__
72 /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
73 /* But avoid namespace pollution on glibc systems. */
74 #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
75 && ! defined __GLIBC__
79 /* mingw fails to declare _exit in <unistd.h>. */
80 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
81 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
82 /* But avoid namespace pollution on glibc systems. */
87 /* mingw declares getcwd in <io.h>, not in <unistd.h>. */
88 #if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
89 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
93 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
94 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
95 /* But avoid namespace pollution on glibc systems. */
96 #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
97 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
102 #if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
103 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
105 # include <sys/types.h>
108 /* Get getopt(), optarg, optind, opterr, optopt.
109 But avoid namespace pollution on glibc systems. */
110 #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
114 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
116 /* The definition of _GL_ARG_NONNULL is copied here. */
118 /* The definition of _GL_WARN_ON_USE is copied here. */
121 #if @GNULIB_GETHOSTNAME@
122 /* Get all possible declarations of gethostname(). */
123 # if @UNISTD_H_HAVE_WINSOCK2_H@
124 # if !defined _GL_SYS_SOCKET_H
125 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
127 # define socket socket_used_without_including_sys_socket_h
129 # define connect connect_used_without_including_sys_socket_h
131 # define accept accept_used_without_including_sys_socket_h
133 # define bind bind_used_without_including_sys_socket_h
135 # define getpeername getpeername_used_without_including_sys_socket_h
137 # define getsockname getsockname_used_without_including_sys_socket_h
139 # define getsockopt getsockopt_used_without_including_sys_socket_h
141 # define listen listen_used_without_including_sys_socket_h
143 # define recv recv_used_without_including_sys_socket_h
145 # define send send_used_without_including_sys_socket_h
147 # define recvfrom recvfrom_used_without_including_sys_socket_h
149 # define sendto sendto_used_without_including_sys_socket_h
151 # define setsockopt setsockopt_used_without_including_sys_socket_h
153 # define shutdown shutdown_used_without_including_sys_socket_h
155 _GL_WARN_ON_USE (socket,
156 "socket() used without including <sys/socket.h>");
157 _GL_WARN_ON_USE (connect,
158 "connect() used without including <sys/socket.h>");
159 _GL_WARN_ON_USE (accept,
160 "accept() used without including <sys/socket.h>");
161 _GL_WARN_ON_USE (bind,
162 "bind() used without including <sys/socket.h>");
163 _GL_WARN_ON_USE (getpeername,
164 "getpeername() used without including <sys/socket.h>");
165 _GL_WARN_ON_USE (getsockname,
166 "getsockname() used without including <sys/socket.h>");
167 _GL_WARN_ON_USE (getsockopt,
168 "getsockopt() used without including <sys/socket.h>");
169 _GL_WARN_ON_USE (listen,
170 "listen() used without including <sys/socket.h>");
171 _GL_WARN_ON_USE (recv,
172 "recv() used without including <sys/socket.h>");
173 _GL_WARN_ON_USE (send,
174 "send() used without including <sys/socket.h>");
175 _GL_WARN_ON_USE (recvfrom,
176 "recvfrom() used without including <sys/socket.h>");
177 _GL_WARN_ON_USE (sendto,
178 "sendto() used without including <sys/socket.h>");
179 _GL_WARN_ON_USE (setsockopt,
180 "setsockopt() used without including <sys/socket.h>");
181 _GL_WARN_ON_USE (shutdown,
182 "shutdown() used without including <sys/socket.h>");
185 # if !defined _GL_SYS_SELECT_H
186 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
188 # define select select_used_without_including_sys_select_h
190 _GL_WARN_ON_USE (select,
191 "select() used without including <sys/select.h>");
198 /* OS/2 EMX lacks these macros. */
200 # define STDIN_FILENO 0
202 #ifndef STDOUT_FILENO
203 # define STDOUT_FILENO 1
205 #ifndef STDERR_FILENO
206 # define STDERR_FILENO 2
209 /* Ensure *_OK macros exist. */
218 /* Declare overridden functions. */
221 #if defined GNULIB_POSIXCHECK
222 /* The access() function is a security risk. */
223 _GL_WARN_ON_USE (access, "the access function is a security risk - "
224 "use the gnulib module faccessat instead");
229 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
230 to GID (if GID is not -1). Follow symbolic links.
231 Return 0 if successful, otherwise -1 and errno set.
232 See the POSIX:2001 specification
233 <http://www.opengroup.org/susv3xsh/chown.html>. */
235 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
237 # define chown rpl_chown
239 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
240 _GL_ARG_NONNULL ((1)));
241 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
244 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
245 _GL_ARG_NONNULL ((1)));
247 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
249 _GL_CXXALIASWARN (chown);
250 #elif defined GNULIB_POSIXCHECK
252 # if HAVE_RAW_DECL_CHOWN
253 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
254 "doesn't treat a uid or gid of -1 on some systems - "
255 "use gnulib module chown for portability");
262 /* Automatically included by modules that need a replacement for close. */
263 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
265 # define close rpl_close
267 _GL_FUNCDECL_RPL (close, int, (int fd));
268 _GL_CXXALIAS_RPL (close, int, (int fd));
270 _GL_CXXALIAS_SYS (close, int, (int fd));
272 _GL_CXXALIASWARN (close);
273 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
275 # define close close_used_without_requesting_gnulib_module_close
276 #elif defined GNULIB_POSIXCHECK
278 /* Assume close is always declared. */
279 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
280 "use gnulib module close for portability");
285 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
288 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
289 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
291 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
293 _GL_CXXALIASWARN (dup);
297 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
298 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
299 Return newfd if successful, otherwise -1 and errno set.
300 See the POSIX:2001 specification
301 <http://www.opengroup.org/susv3xsh/dup2.html>. */
303 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
304 # define dup2 rpl_dup2
306 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
307 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
310 _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
312 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
314 _GL_CXXALIASWARN (dup2);
315 #elif defined GNULIB_POSIXCHECK
317 # if HAVE_RAW_DECL_DUP2
318 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
319 "use gnulib module dup2 for portability");
325 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
327 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
328 and O_TEXT, O_BINARY (defined in "binary-io.h").
329 Close NEWFD first if it is open.
330 Return newfd if successful, otherwise -1 and errno set.
331 See the Linux man page at
332 <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
334 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
335 # define dup3 rpl_dup3
337 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
338 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
340 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
341 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
343 _GL_CXXALIASWARN (dup3);
344 #elif defined GNULIB_POSIXCHECK
346 # if HAVE_RAW_DECL_DUP3
347 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
348 "use gnulib module dup3 for portability");
354 # if !@HAVE_DECL_ENVIRON@
355 /* Set of environment variables and values. An array of strings of the form
356 "VARIABLE=VALUE", terminated with a NULL. */
357 # if defined __APPLE__ && defined __MACH__
358 # include <crt_externs.h>
359 # define environ (*_NSGetEnviron ())
364 extern char **environ;
370 #elif defined GNULIB_POSIXCHECK
371 # if HAVE_RAW_DECL_ENVIRON
372 static inline char ***
377 _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
378 "use gnulib module environ for portability");
380 # define environ (*rpl_environ ())
385 #if @GNULIB_EUIDACCESS@
386 /* Like access(), except that it uses the effective user id and group id of
387 the current process. */
388 # if !@HAVE_EUIDACCESS@
389 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
390 _GL_ARG_NONNULL ((1)));
392 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
393 _GL_CXXALIASWARN (euidaccess);
394 # if defined GNULIB_POSIXCHECK
395 /* Like access(), this function is a security risk. */
396 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
397 "use the gnulib module faccessat instead");
399 #elif defined GNULIB_POSIXCHECK
401 # if HAVE_RAW_DECL_EUIDACCESS
402 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
403 "use gnulib module euidaccess for portability");
408 #if @GNULIB_FACCESSAT@
409 # if !@HAVE_FACCESSAT@
410 _GL_FUNCDECL_SYS (faccessat, int,
411 (int fd, char const *file, int mode, int flag)
412 _GL_ARG_NONNULL ((2)));
414 _GL_CXXALIAS_SYS (faccessat, int,
415 (int fd, char const *file, int mode, int flag));
416 _GL_CXXALIASWARN (faccessat);
417 #elif defined GNULIB_POSIXCHECK
419 # if HAVE_RAW_DECL_FACCESSAT
420 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
421 "use gnulib module faccessat for portability");
427 /* Change the process' current working directory to the directory on which
428 the given file descriptor is open.
429 Return 0 if successful, otherwise -1 and errno set.
430 See the POSIX:2001 specification
431 <http://www.opengroup.org/susv3xsh/fchdir.html>. */
433 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
435 /* Gnulib internal hooks needed to maintain the fchdir metadata. */
436 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
437 _GL_ARG_NONNULL ((2));
438 _GL_EXTERN_C void _gl_unregister_fd (int fd);
439 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
440 _GL_EXTERN_C const char *_gl_directory_name (int fd);
443 # if !@HAVE_DECL_FCHDIR@
444 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
447 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
448 _GL_CXXALIASWARN (fchdir);
449 #elif defined GNULIB_POSIXCHECK
451 # if HAVE_RAW_DECL_FCHDIR
452 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
453 "use gnulib module fchdir for portability");
458 #if @GNULIB_FCHOWNAT@
459 # if @REPLACE_FCHOWNAT@
460 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
462 # define fchownat rpl_fchownat
464 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
465 uid_t owner, gid_t group, int flag)
466 _GL_ARG_NONNULL ((2)));
467 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
468 uid_t owner, gid_t group, int flag));
470 # if !@HAVE_FCHOWNAT@
471 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
472 uid_t owner, gid_t group, int flag)
473 _GL_ARG_NONNULL ((2)));
475 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
476 uid_t owner, gid_t group, int flag));
478 _GL_CXXALIASWARN (fchownat);
479 #elif defined GNULIB_POSIXCHECK
481 # if HAVE_RAW_DECL_FCHOWNAT
482 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
483 "use gnulib module openat for portability");
489 /* Synchronize changes to a file.
490 Return 0 if successful, otherwise -1 and errno set.
491 See POSIX:2001 specification
492 <http://www.opengroup.org/susv3xsh/fsync.html>. */
494 _GL_FUNCDECL_SYS (fsync, int, (int fd));
496 _GL_CXXALIAS_SYS (fsync, int, (int fd));
497 _GL_CXXALIASWARN (fsync);
498 #elif defined GNULIB_POSIXCHECK
500 # if HAVE_RAW_DECL_FSYNC
501 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
502 "use gnulib module fsync for portability");
507 #if @GNULIB_FTRUNCATE@
508 /* Change the size of the file to which FD is opened to become equal to LENGTH.
509 Return 0 if successful, otherwise -1 and errno set.
510 See the POSIX:2001 specification
511 <http://www.opengroup.org/susv3xsh/ftruncate.html>. */
512 # if !@HAVE_FTRUNCATE@
513 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
515 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
516 _GL_CXXALIASWARN (ftruncate);
517 #elif defined GNULIB_POSIXCHECK
519 # if HAVE_RAW_DECL_FTRUNCATE
520 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
521 "use gnulib module ftruncate for portability");
527 /* Get the name of the current working directory, and put it in SIZE bytes
529 Return BUF if successful, or NULL if the directory couldn't be determined
530 or SIZE was too small.
531 See the POSIX:2001 specification
532 <http://www.opengroup.org/susv3xsh/getcwd.html>.
533 Additionally, the gnulib module 'getcwd' guarantees the following GNU
534 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
535 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
537 # if @REPLACE_GETCWD@
538 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
539 # define getcwd rpl_getcwd
541 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
542 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
544 /* Need to cast, because on mingw, the second parameter is
546 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
548 _GL_CXXALIASWARN (getcwd);
549 #elif defined GNULIB_POSIXCHECK
551 # if HAVE_RAW_DECL_GETCWD
552 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
553 "use gnulib module getcwd for portability");
558 #if @GNULIB_GETDOMAINNAME@
559 /* Return the NIS domain name of the machine.
560 WARNING! The NIS domain name is unrelated to the fully qualified host name
561 of the machine. It is also unrelated to email addresses.
562 WARNING! The NIS domain name is usually the empty string or "(none)" when
565 Put up to LEN bytes of the NIS domain name into NAME.
566 Null terminate it if the name is shorter than LEN.
567 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
568 Return 0 if successful, otherwise set errno and return -1. */
569 # if @REPLACE_GETDOMAINNAME@
570 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
571 # undef getdomainname
572 # define getdomainname rpl_getdomainname
574 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
575 _GL_ARG_NONNULL ((1)));
576 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
578 # if !@HAVE_DECL_GETDOMAINNAME@
579 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
580 _GL_ARG_NONNULL ((1)));
582 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
584 _GL_CXXALIASWARN (getdomainname);
585 #elif defined GNULIB_POSIXCHECK
586 # undef getdomainname
587 # if HAVE_RAW_DECL_GETDOMAINNAME
588 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
589 "use gnulib module getdomainname for portability");
594 #if @GNULIB_GETDTABLESIZE@
595 /* Return the maximum number of file descriptors in the current process.
596 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
597 # if !@HAVE_GETDTABLESIZE@
598 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
600 _GL_CXXALIAS_SYS (getdtablesize, int, (void));
601 _GL_CXXALIASWARN (getdtablesize);
602 #elif defined GNULIB_POSIXCHECK
603 # undef getdtablesize
604 # if HAVE_RAW_DECL_GETDTABLESIZE
605 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
606 "use gnulib module getdtablesize for portability");
611 #if @GNULIB_GETGROUPS@
612 /* Return the supplemental groups that the current process belongs to.
613 It is unspecified whether the effective group id is in the list.
614 If N is 0, return the group count; otherwise, N describes how many
615 entries are available in GROUPS. Return -1 and set errno if N is
616 not 0 and not large enough. Fails with ENOSYS on some systems. */
617 # if @REPLACE_GETGROUPS@
618 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
620 # define getgroups rpl_getgroups
622 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
623 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
625 # if !@HAVE_GETGROUPS@
626 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
628 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
630 _GL_CXXALIASWARN (getgroups);
631 #elif defined GNULIB_POSIXCHECK
633 # if HAVE_RAW_DECL_GETGROUPS
634 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
635 "use gnulib module getgroups for portability");
640 #if @GNULIB_GETHOSTNAME@
641 /* Return the standard host name of the machine.
642 WARNING! The host name may or may not be fully qualified.
644 Put up to LEN bytes of the host name into NAME.
645 Null terminate it if the name is shorter than LEN.
646 If the host name is longer than LEN, set errno = EINVAL and return -1.
647 Return 0 if successful, otherwise set errno and return -1. */
648 # if @UNISTD_H_HAVE_WINSOCK2_H@
649 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
651 # define gethostname rpl_gethostname
653 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
654 _GL_ARG_NONNULL ((1)));
655 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
657 # if !@HAVE_GETHOSTNAME@
658 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
659 _GL_ARG_NONNULL ((1)));
661 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
664 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
666 _GL_CXXALIASWARN (gethostname);
667 #elif @UNISTD_H_HAVE_WINSOCK2_H@
669 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
670 #elif defined GNULIB_POSIXCHECK
672 # if HAVE_RAW_DECL_GETHOSTNAME
673 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
674 "use gnulib module gethostname for portability");
679 #if @GNULIB_GETLOGIN@
680 /* Returns the user's login name, or NULL if it cannot be found. Upon error,
681 returns NULL with errno set.
683 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
685 Most programs don't need to use this function, because the information is
686 available through environment variables:
687 ${LOGNAME-$USER} on Unix platforms,
688 $USERNAME on native Windows platforms.
690 # if !@HAVE_GETLOGIN@
691 _GL_FUNCDECL_SYS (getlogin, char *, (void));
693 _GL_CXXALIAS_SYS (getlogin, char *, (void));
694 _GL_CXXALIASWARN (getlogin);
695 #elif defined GNULIB_POSIXCHECK
697 # if HAVE_RAW_DECL_GETLOGIN
698 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
699 "use gnulib module getlogin for portability");
704 #if @GNULIB_GETLOGIN_R@
705 /* Copies the user's login name to NAME.
706 The array pointed to by NAME has room for SIZE bytes.
708 Returns 0 if successful. Upon error, an error number is returned, or -1 in
709 the case that the login name cannot be found but no specific error is
710 provided (this case is hopefully rare but is left open by the POSIX spec).
712 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
714 Most programs don't need to use this function, because the information is
715 available through environment variables:
716 ${LOGNAME-$USER} on Unix platforms,
717 $USERNAME on native Windows platforms.
719 # if @REPLACE_GETLOGIN_R@
720 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
721 # define getlogin_r rpl_getlogin_r
723 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
724 _GL_ARG_NONNULL ((1)));
725 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
727 # if !@HAVE_DECL_GETLOGIN_R@
728 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
729 _GL_ARG_NONNULL ((1)));
731 /* Need to cast, because on Solaris 10 systems, the second argument is
733 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
735 _GL_CXXALIASWARN (getlogin_r);
736 #elif defined GNULIB_POSIXCHECK
738 # if HAVE_RAW_DECL_GETLOGIN_R
739 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
740 "use gnulib module getlogin_r for portability");
745 #if @GNULIB_GETPAGESIZE@
746 # if @REPLACE_GETPAGESIZE@
747 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
748 # define getpagesize rpl_getpagesize
750 _GL_FUNCDECL_RPL (getpagesize, int, (void));
751 _GL_CXXALIAS_RPL (getpagesize, int, (void));
753 # if !@HAVE_GETPAGESIZE@
754 # if !defined getpagesize
755 /* This is for POSIX systems. */
756 # if !defined _gl_getpagesize && defined _SC_PAGESIZE
757 # if ! (defined __VMS && __VMS_VER < 70000000)
758 # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
761 /* This is for older VMS. */
762 # if !defined _gl_getpagesize && defined __VMS
764 # define _gl_getpagesize() 8192
766 # define _gl_getpagesize() 512
769 /* This is for BeOS. */
770 # if !defined _gl_getpagesize && @HAVE_OS_H@
772 # if defined B_PAGE_SIZE
773 # define _gl_getpagesize() B_PAGE_SIZE
776 /* This is for AmigaOS4.0. */
777 # if !defined _gl_getpagesize && defined __amigaos4__
778 # define _gl_getpagesize() 2048
780 /* This is for older Unix systems. */
781 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
782 # include <sys/param.h>
783 # ifdef EXEC_PAGESIZE
784 # define _gl_getpagesize() EXEC_PAGESIZE
790 # define _gl_getpagesize() (NBPG * CLSIZE)
793 # define _gl_getpagesize() NBPC
798 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
799 # define getpagesize() _gl_getpagesize ()
801 # if !GNULIB_defined_getpagesize_function
805 return _gl_getpagesize ();
807 # define GNULIB_defined_getpagesize_function 1
812 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
813 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
815 # if @HAVE_DECL_GETPAGESIZE@
816 _GL_CXXALIASWARN (getpagesize);
818 #elif defined GNULIB_POSIXCHECK
820 # if HAVE_RAW_DECL_GETPAGESIZE
821 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
822 "use gnulib module getpagesize for portability");
827 #if @GNULIB_GETUSERSHELL@
828 /* Return the next valid login shell on the system, or NULL when the end of
829 the list has been reached. */
830 # if !@HAVE_DECL_GETUSERSHELL@
831 _GL_FUNCDECL_SYS (getusershell, char *, (void));
833 _GL_CXXALIAS_SYS (getusershell, char *, (void));
834 _GL_CXXALIASWARN (getusershell);
835 #elif defined GNULIB_POSIXCHECK
837 # if HAVE_RAW_DECL_GETUSERSHELL
838 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
839 "use gnulib module getusershell for portability");
843 #if @GNULIB_GETUSERSHELL@
844 /* Rewind to pointer that is advanced at each getusershell() call. */
845 # if !@HAVE_DECL_GETUSERSHELL@
846 _GL_FUNCDECL_SYS (setusershell, void, (void));
848 _GL_CXXALIAS_SYS (setusershell, void, (void));
849 _GL_CXXALIASWARN (setusershell);
850 #elif defined GNULIB_POSIXCHECK
852 # if HAVE_RAW_DECL_SETUSERSHELL
853 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
854 "use gnulib module getusershell for portability");
858 #if @GNULIB_GETUSERSHELL@
859 /* Free the pointer that is advanced at each getusershell() call and
860 associated resources. */
861 # if !@HAVE_DECL_GETUSERSHELL@
862 _GL_FUNCDECL_SYS (endusershell, void, (void));
864 _GL_CXXALIAS_SYS (endusershell, void, (void));
865 _GL_CXXALIASWARN (endusershell);
866 #elif defined GNULIB_POSIXCHECK
868 # if HAVE_RAW_DECL_ENDUSERSHELL
869 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
870 "use gnulib module getusershell for portability");
876 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
877 to GID (if GID is not -1). Do not follow symbolic links.
878 Return 0 if successful, otherwise -1 and errno set.
879 See the POSIX:2001 specification
880 <http://www.opengroup.org/susv3xsh/lchown.html>. */
881 # if @REPLACE_LCHOWN@
882 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
884 # define lchown rpl_lchown
886 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
887 _GL_ARG_NONNULL ((1)));
888 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
891 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
892 _GL_ARG_NONNULL ((1)));
894 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
896 _GL_CXXALIASWARN (lchown);
897 #elif defined GNULIB_POSIXCHECK
899 # if HAVE_RAW_DECL_LCHOWN
900 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
901 "use gnulib module lchown for portability");
907 /* Create a new hard link for an existing file.
908 Return 0 if successful, otherwise -1 and errno set.
909 See POSIX:2001 specification
910 <http://www.opengroup.org/susv3xsh/link.html>. */
912 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
913 # define link rpl_link
915 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
916 _GL_ARG_NONNULL ((1, 2)));
917 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
920 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
921 _GL_ARG_NONNULL ((1, 2)));
923 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
925 _GL_CXXALIASWARN (link);
926 #elif defined GNULIB_POSIXCHECK
928 # if HAVE_RAW_DECL_LINK
929 _GL_WARN_ON_USE (link, "link is unportable - "
930 "use gnulib module link for portability");
936 /* Create a new hard link for an existing file, relative to two
937 directories. FLAG controls whether symlinks are followed.
938 Return 0 if successful, otherwise -1 and errno set. */
939 # if @REPLACE_LINKAT@
940 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
942 # define linkat rpl_linkat
944 _GL_FUNCDECL_RPL (linkat, int,
945 (int fd1, const char *path1, int fd2, const char *path2,
947 _GL_ARG_NONNULL ((2, 4)));
948 _GL_CXXALIAS_RPL (linkat, int,
949 (int fd1, const char *path1, int fd2, const char *path2,
953 _GL_FUNCDECL_SYS (linkat, int,
954 (int fd1, const char *path1, int fd2, const char *path2,
956 _GL_ARG_NONNULL ((2, 4)));
958 _GL_CXXALIAS_SYS (linkat, int,
959 (int fd1, const char *path1, int fd2, const char *path2,
962 _GL_CXXALIASWARN (linkat);
963 #elif defined GNULIB_POSIXCHECK
965 # if HAVE_RAW_DECL_LINKAT
966 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
967 "use gnulib module linkat for portability");
973 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
974 Return the new offset if successful, otherwise -1 and errno set.
975 See the POSIX:2001 specification
976 <http://www.opengroup.org/susv3xsh/lseek.html>. */
978 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
979 # define lseek rpl_lseek
981 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
982 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
984 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
986 _GL_CXXALIASWARN (lseek);
987 #elif defined GNULIB_POSIXCHECK
989 # if HAVE_RAW_DECL_LSEEK
990 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
991 "systems - use gnulib module lseek for portability");
997 /* Create a pipe, defaulting to O_BINARY mode.
998 Store the read-end as fd[0] and the write-end as fd[1].
999 Return 0 upon success, or -1 with errno set upon failure. */
1001 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
1003 _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1004 _GL_CXXALIASWARN (pipe);
1005 #elif defined GNULIB_POSIXCHECK
1007 # if HAVE_RAW_DECL_PIPE
1008 _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1009 "use gnulib module pipe-posix for portability");
1015 /* Create a pipe, applying the given flags when opening the read-end of the
1016 pipe and the write-end of the pipe.
1017 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1018 and O_TEXT, O_BINARY (defined in "binary-io.h").
1019 Store the read-end as fd[0] and the write-end as fd[1].
1020 Return 0 upon success, or -1 with errno set upon failure.
1021 See also the Linux man page at
1022 <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
1024 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1025 # define pipe2 rpl_pipe2
1027 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1028 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1030 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1031 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1033 _GL_CXXALIASWARN (pipe2);
1034 #elif defined GNULIB_POSIXCHECK
1036 # if HAVE_RAW_DECL_PIPE2
1037 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1038 "use gnulib module pipe2 for portability");
1044 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1045 Return the number of bytes placed into BUF if successful, otherwise
1046 set errno and return -1. 0 indicates EOF. See the POSIX:2001
1047 specification <http://www.opengroup.org/susv3xsh/pread.html>. */
1048 # if @REPLACE_PREAD@
1049 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1050 # define pread rpl_pread
1052 _GL_FUNCDECL_RPL (pread, ssize_t,
1053 (int fd, void *buf, size_t bufsize, off_t offset)
1054 _GL_ARG_NONNULL ((2)));
1055 _GL_CXXALIAS_RPL (pread, ssize_t,
1056 (int fd, void *buf, size_t bufsize, off_t offset));
1059 _GL_FUNCDECL_SYS (pread, ssize_t,
1060 (int fd, void *buf, size_t bufsize, off_t offset)
1061 _GL_ARG_NONNULL ((2)));
1063 _GL_CXXALIAS_SYS (pread, ssize_t,
1064 (int fd, void *buf, size_t bufsize, off_t offset));
1066 _GL_CXXALIASWARN (pread);
1067 #elif defined GNULIB_POSIXCHECK
1069 # if HAVE_RAW_DECL_PREAD
1070 _GL_WARN_ON_USE (pread, "pread is unportable - "
1071 "use gnulib module pread for portability");
1077 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1078 Return the number of bytes written if successful, otherwise
1079 set errno and return -1. 0 indicates nothing written. See the
1080 POSIX:2001 specification
1081 <http://www.opengroup.org/susv3xsh/pwrite.html>. */
1082 # if @REPLACE_PWRITE@
1083 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1084 # define pwrite rpl_pwrite
1086 _GL_FUNCDECL_RPL (pwrite, ssize_t,
1087 (int fd, const void *buf, size_t bufsize, off_t offset)
1088 _GL_ARG_NONNULL ((2)));
1089 _GL_CXXALIAS_RPL (pwrite, ssize_t,
1090 (int fd, const void *buf, size_t bufsize, off_t offset));
1093 _GL_FUNCDECL_SYS (pwrite, ssize_t,
1094 (int fd, const void *buf, size_t bufsize, off_t offset)
1095 _GL_ARG_NONNULL ((2)));
1097 _GL_CXXALIAS_SYS (pwrite, ssize_t,
1098 (int fd, const void *buf, size_t bufsize, off_t offset));
1100 _GL_CXXALIASWARN (pwrite);
1101 #elif defined GNULIB_POSIXCHECK
1103 # if HAVE_RAW_DECL_PWRITE
1104 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1105 "use gnulib module pwrite for portability");
1110 #if @GNULIB_READLINK@
1111 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
1112 bytes of it into BUF. Return the number of bytes placed into BUF if
1113 successful, otherwise -1 and errno set.
1114 See the POSIX:2001 specification
1115 <http://www.opengroup.org/susv3xsh/readlink.html>. */
1116 # if @REPLACE_READLINK@
1117 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1118 # define readlink rpl_readlink
1120 _GL_FUNCDECL_RPL (readlink, ssize_t,
1121 (const char *file, char *buf, size_t bufsize)
1122 _GL_ARG_NONNULL ((1, 2)));
1123 _GL_CXXALIAS_RPL (readlink, ssize_t,
1124 (const char *file, char *buf, size_t bufsize));
1126 # if !@HAVE_READLINK@
1127 _GL_FUNCDECL_SYS (readlink, ssize_t,
1128 (const char *file, char *buf, size_t bufsize)
1129 _GL_ARG_NONNULL ((1, 2)));
1131 _GL_CXXALIAS_SYS (readlink, ssize_t,
1132 (const char *file, char *buf, size_t bufsize));
1134 _GL_CXXALIASWARN (readlink);
1135 #elif defined GNULIB_POSIXCHECK
1137 # if HAVE_RAW_DECL_READLINK
1138 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1139 "use gnulib module readlink for portability");
1144 #if @GNULIB_READLINKAT@
1145 # if !@HAVE_READLINKAT@
1146 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
1147 (int fd, char const *file, char *buf, size_t len)
1148 _GL_ARG_NONNULL ((2, 3)));
1150 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
1151 (int fd, char const *file, char *buf, size_t len));
1152 _GL_CXXALIASWARN (readlinkat);
1153 #elif defined GNULIB_POSIXCHECK
1155 # if HAVE_RAW_DECL_READLINKAT
1156 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1157 "use gnulib module readlinkat for portability");
1163 /* Remove the directory DIR. */
1164 # if @REPLACE_RMDIR@
1165 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1166 # define rmdir rpl_rmdir
1168 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1169 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1171 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1173 _GL_CXXALIASWARN (rmdir);
1174 #elif defined GNULIB_POSIXCHECK
1176 # if HAVE_RAW_DECL_RMDIR
1177 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1178 "use gnulib module rmdir for portability");
1184 /* Pause the execution of the current thread for N seconds.
1185 Returns the number of seconds left to sleep.
1186 See the POSIX:2001 specification
1187 <http://www.opengroup.org/susv3xsh/sleep.html>. */
1188 # if @REPLACE_SLEEP@
1189 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1191 # define sleep rpl_sleep
1193 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1194 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1197 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1199 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1201 _GL_CXXALIASWARN (sleep);
1202 #elif defined GNULIB_POSIXCHECK
1204 # if HAVE_RAW_DECL_SLEEP
1205 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
1206 "use gnulib module sleep for portability");
1211 #if @GNULIB_SYMLINK@
1212 # if @REPLACE_SYMLINK@
1213 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1215 # define symlink rpl_symlink
1217 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1218 _GL_ARG_NONNULL ((1, 2)));
1219 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1221 # if !@HAVE_SYMLINK@
1222 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1223 _GL_ARG_NONNULL ((1, 2)));
1225 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1227 _GL_CXXALIASWARN (symlink);
1228 #elif defined GNULIB_POSIXCHECK
1230 # if HAVE_RAW_DECL_SYMLINK
1231 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
1232 "use gnulib module symlink for portability");
1237 #if @GNULIB_SYMLINKAT@
1238 # if !@HAVE_SYMLINKAT@
1239 _GL_FUNCDECL_SYS (symlinkat, int,
1240 (char const *contents, int fd, char const *file)
1241 _GL_ARG_NONNULL ((1, 3)));
1243 _GL_CXXALIAS_SYS (symlinkat, int,
1244 (char const *contents, int fd, char const *file));
1245 _GL_CXXALIASWARN (symlinkat);
1246 #elif defined GNULIB_POSIXCHECK
1248 # if HAVE_RAW_DECL_SYMLINKAT
1249 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1250 "use gnulib module symlinkat for portability");
1255 #if @GNULIB_TTYNAME_R@
1256 /* Store at most BUFLEN characters of the pathname of the terminal FD is
1257 open on in BUF. Return 0 on success, otherwise an error number. */
1258 # if @REPLACE_TTYNAME_R@
1259 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1261 # define ttyname_r rpl_ttyname_r
1263 _GL_FUNCDECL_RPL (ttyname_r, int,
1264 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1265 _GL_CXXALIAS_RPL (ttyname_r, int,
1266 (int fd, char *buf, size_t buflen));
1268 # if !@HAVE_DECL_TTYNAME_R@
1269 _GL_FUNCDECL_SYS (ttyname_r, int,
1270 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1272 _GL_CXXALIAS_SYS (ttyname_r, int,
1273 (int fd, char *buf, size_t buflen));
1275 _GL_CXXALIASWARN (ttyname_r);
1276 #elif defined GNULIB_POSIXCHECK
1278 # if HAVE_RAW_DECL_TTYNAME_R
1279 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1280 "use gnulib module ttyname_r for portability");
1286 # if @REPLACE_UNLINK@
1287 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1289 # define unlink rpl_unlink
1291 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1292 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
1294 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
1296 _GL_CXXALIASWARN (unlink);
1297 #elif defined GNULIB_POSIXCHECK
1299 # if HAVE_RAW_DECL_UNLINK
1300 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
1301 "use gnulib module unlink for portability");
1306 #if @GNULIB_UNLINKAT@
1307 # if @REPLACE_UNLINKAT@
1308 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1310 # define unlinkat rpl_unlinkat
1312 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1313 _GL_ARG_NONNULL ((2)));
1314 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1316 # if !@HAVE_UNLINKAT@
1317 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1318 _GL_ARG_NONNULL ((2)));
1320 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1322 _GL_CXXALIASWARN (unlinkat);
1323 #elif defined GNULIB_POSIXCHECK
1325 # if HAVE_RAW_DECL_UNLINKAT
1326 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1327 "use gnulib module openat for portability");
1333 /* Pause the execution of the current thread for N microseconds.
1334 Returns 0 on completion, or -1 on range error.
1335 See the POSIX:2001 specification
1336 <http://www.opengroup.org/susv3xsh/sleep.html>. */
1337 # if @REPLACE_USLEEP@
1338 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1340 # define usleep rpl_usleep
1342 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1343 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1346 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1348 _GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
1350 _GL_CXXALIASWARN (usleep);
1351 #elif defined GNULIB_POSIXCHECK
1353 # if HAVE_RAW_DECL_USLEEP
1354 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1355 "use gnulib module usleep for portability");
1361 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
1362 See the POSIX:2001 specification
1363 <http://www.opengroup.org/susv3xsh/write.html>. */
1364 # if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
1365 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1367 # define write rpl_write
1369 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1370 _GL_ARG_NONNULL ((2)));
1371 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1373 /* Need to cast, because on mingw, the third parameter is
1375 and the return type is 'int'. */
1376 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1378 _GL_CXXALIASWARN (write);
1382 #endif /* _GL_UNISTD_H */
1383 #endif /* _GL_UNISTD_H */