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 _@GUARD_PREFIX@_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 _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
57 #define _@GUARD_PREFIX@_UNISTD_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__))
90 # include <io.h> /* mingw32, mingw64 */
91 # include <direct.h> /* mingw64 */
94 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
95 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
96 /* But avoid namespace pollution on glibc systems. */
97 #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
98 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
103 #if (@GNULIB_READ@ || @GNULIB_WRITE@ \
104 || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
105 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
107 # include <sys/types.h>
110 /* Get getopt(), optarg, optind, opterr, optopt.
111 But avoid namespace pollution on glibc systems. */
112 #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
116 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
118 /* The definition of _GL_ARG_NONNULL is copied here. */
120 /* The definition of _GL_WARN_ON_USE is copied here. */
123 /* Hide some function declarations from <winsock2.h>. */
125 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
126 # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
127 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
129 # define socket socket_used_without_including_sys_socket_h
131 # define connect connect_used_without_including_sys_socket_h
133 # define accept accept_used_without_including_sys_socket_h
135 # define bind bind_used_without_including_sys_socket_h
137 # define getpeername getpeername_used_without_including_sys_socket_h
139 # define getsockname getsockname_used_without_including_sys_socket_h
141 # define getsockopt getsockopt_used_without_including_sys_socket_h
143 # define listen listen_used_without_including_sys_socket_h
145 # define recv recv_used_without_including_sys_socket_h
147 # define send send_used_without_including_sys_socket_h
149 # define recvfrom recvfrom_used_without_including_sys_socket_h
151 # define sendto sendto_used_without_including_sys_socket_h
153 # define setsockopt setsockopt_used_without_including_sys_socket_h
155 # define shutdown shutdown_used_without_including_sys_socket_h
157 _GL_WARN_ON_USE (socket,
158 "socket() used without including <sys/socket.h>");
159 _GL_WARN_ON_USE (connect,
160 "connect() used without including <sys/socket.h>");
161 _GL_WARN_ON_USE (accept,
162 "accept() used without including <sys/socket.h>");
163 _GL_WARN_ON_USE (bind,
164 "bind() used without including <sys/socket.h>");
165 _GL_WARN_ON_USE (getpeername,
166 "getpeername() used without including <sys/socket.h>");
167 _GL_WARN_ON_USE (getsockname,
168 "getsockname() used without including <sys/socket.h>");
169 _GL_WARN_ON_USE (getsockopt,
170 "getsockopt() used without including <sys/socket.h>");
171 _GL_WARN_ON_USE (listen,
172 "listen() used without including <sys/socket.h>");
173 _GL_WARN_ON_USE (recv,
174 "recv() used without including <sys/socket.h>");
175 _GL_WARN_ON_USE (send,
176 "send() used without including <sys/socket.h>");
177 _GL_WARN_ON_USE (recvfrom,
178 "recvfrom() used without including <sys/socket.h>");
179 _GL_WARN_ON_USE (sendto,
180 "sendto() used without including <sys/socket.h>");
181 _GL_WARN_ON_USE (setsockopt,
182 "setsockopt() used without including <sys/socket.h>");
183 _GL_WARN_ON_USE (shutdown,
184 "shutdown() used without including <sys/socket.h>");
187 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
188 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
190 # define select select_used_without_including_sys_select_h
192 _GL_WARN_ON_USE (select,
193 "select() used without including <sys/select.h>");
199 /* OS/2 EMX lacks these macros. */
201 # define STDIN_FILENO 0
203 #ifndef STDOUT_FILENO
204 # define STDOUT_FILENO 1
206 #ifndef STDERR_FILENO
207 # define STDERR_FILENO 2
210 /* Ensure *_OK macros exist. */
219 /* Declare overridden functions. */
222 #if defined GNULIB_POSIXCHECK
223 /* The access() function is a security risk. */
224 _GL_WARN_ON_USE (access, "the access function is a security risk - "
225 "use the gnulib module faccessat instead");
230 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
231 to GID (if GID is not -1). Follow symbolic links.
232 Return 0 if successful, otherwise -1 and errno set.
233 See the POSIX:2001 specification
234 <http://www.opengroup.org/susv3xsh/chown.html>. */
236 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
238 # define chown rpl_chown
240 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
241 _GL_ARG_NONNULL ((1)));
242 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
245 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
246 _GL_ARG_NONNULL ((1)));
248 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
250 _GL_CXXALIASWARN (chown);
251 #elif defined GNULIB_POSIXCHECK
253 # if HAVE_RAW_DECL_CHOWN
254 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
255 "doesn't treat a uid or gid of -1 on some systems - "
256 "use gnulib module chown for portability");
263 /* Automatically included by modules that need a replacement for close. */
264 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
266 # define close rpl_close
268 _GL_FUNCDECL_RPL (close, int, (int fd));
269 _GL_CXXALIAS_RPL (close, int, (int fd));
271 _GL_CXXALIAS_SYS (close, int, (int fd));
273 _GL_CXXALIASWARN (close);
274 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
276 # define close close_used_without_requesting_gnulib_module_close
277 #elif defined GNULIB_POSIXCHECK
279 /* Assume close is always declared. */
280 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
281 "use gnulib module close for portability");
286 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
289 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
290 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
292 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
294 _GL_CXXALIASWARN (dup);
298 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
299 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
300 Return newfd if successful, otherwise -1 and errno set.
301 See the POSIX:2001 specification
302 <http://www.opengroup.org/susv3xsh/dup2.html>. */
304 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
305 # define dup2 rpl_dup2
307 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
308 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
311 _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
313 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
315 _GL_CXXALIASWARN (dup2);
316 #elif defined GNULIB_POSIXCHECK
318 # if HAVE_RAW_DECL_DUP2
319 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
320 "use gnulib module dup2 for portability");
326 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
328 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
329 and O_TEXT, O_BINARY (defined in "binary-io.h").
330 Close NEWFD first if it is open.
331 Return newfd if successful, otherwise -1 and errno set.
332 See the Linux man page at
333 <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
335 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
336 # define dup3 rpl_dup3
338 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
339 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
341 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
342 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
344 _GL_CXXALIASWARN (dup3);
345 #elif defined GNULIB_POSIXCHECK
347 # if HAVE_RAW_DECL_DUP3
348 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
349 "use gnulib module dup3 for portability");
355 # if !@HAVE_DECL_ENVIRON@
356 /* Set of environment variables and values. An array of strings of the form
357 "VARIABLE=VALUE", terminated with a NULL. */
358 # if defined __APPLE__ && defined __MACH__
359 # include <crt_externs.h>
360 # define environ (*_NSGetEnviron ())
365 extern char **environ;
371 #elif defined GNULIB_POSIXCHECK
372 # if HAVE_RAW_DECL_ENVIRON
373 static inline char ***
378 _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
379 "use gnulib module environ for portability");
381 # define environ (*rpl_environ ())
386 #if @GNULIB_EUIDACCESS@
387 /* Like access(), except that it uses the effective user id and group id of
388 the current process. */
389 # if !@HAVE_EUIDACCESS@
390 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
391 _GL_ARG_NONNULL ((1)));
393 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
394 _GL_CXXALIASWARN (euidaccess);
395 # if defined GNULIB_POSIXCHECK
396 /* Like access(), this function is a security risk. */
397 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
398 "use the gnulib module faccessat instead");
400 #elif defined GNULIB_POSIXCHECK
402 # if HAVE_RAW_DECL_EUIDACCESS
403 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
404 "use gnulib module euidaccess for portability");
409 #if @GNULIB_FACCESSAT@
410 # if !@HAVE_FACCESSAT@
411 _GL_FUNCDECL_SYS (faccessat, int,
412 (int fd, char const *file, int mode, int flag)
413 _GL_ARG_NONNULL ((2)));
415 _GL_CXXALIAS_SYS (faccessat, int,
416 (int fd, char const *file, int mode, int flag));
417 _GL_CXXALIASWARN (faccessat);
418 #elif defined GNULIB_POSIXCHECK
420 # if HAVE_RAW_DECL_FACCESSAT
421 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
422 "use gnulib module faccessat for portability");
428 /* Change the process' current working directory to the directory on which
429 the given file descriptor is open.
430 Return 0 if successful, otherwise -1 and errno set.
431 See the POSIX:2001 specification
432 <http://www.opengroup.org/susv3xsh/fchdir.html>. */
434 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
436 /* Gnulib internal hooks needed to maintain the fchdir metadata. */
437 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
438 _GL_ARG_NONNULL ((2));
439 _GL_EXTERN_C void _gl_unregister_fd (int fd);
440 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
441 _GL_EXTERN_C const char *_gl_directory_name (int fd);
444 # if !@HAVE_DECL_FCHDIR@
445 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
448 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
449 _GL_CXXALIASWARN (fchdir);
450 #elif defined GNULIB_POSIXCHECK
452 # if HAVE_RAW_DECL_FCHDIR
453 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
454 "use gnulib module fchdir for portability");
459 #if @GNULIB_FCHOWNAT@
460 # if @REPLACE_FCHOWNAT@
461 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
463 # define fchownat rpl_fchownat
465 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
466 uid_t owner, gid_t group, int flag)
467 _GL_ARG_NONNULL ((2)));
468 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
469 uid_t owner, gid_t group, int flag));
471 # if !@HAVE_FCHOWNAT@
472 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
473 uid_t owner, gid_t group, int flag)
474 _GL_ARG_NONNULL ((2)));
476 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
477 uid_t owner, gid_t group, int flag));
479 _GL_CXXALIASWARN (fchownat);
480 #elif defined GNULIB_POSIXCHECK
482 # if HAVE_RAW_DECL_FCHOWNAT
483 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
484 "use gnulib module openat for portability");
490 /* Synchronize changes to a file.
491 Return 0 if successful, otherwise -1 and errno set.
492 See POSIX:2001 specification
493 <http://www.opengroup.org/susv3xsh/fsync.html>. */
495 _GL_FUNCDECL_SYS (fsync, int, (int fd));
497 _GL_CXXALIAS_SYS (fsync, int, (int fd));
498 _GL_CXXALIASWARN (fsync);
499 #elif defined GNULIB_POSIXCHECK
501 # if HAVE_RAW_DECL_FSYNC
502 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
503 "use gnulib module fsync for portability");
508 #if @GNULIB_FTRUNCATE@
509 /* Change the size of the file to which FD is opened to become equal to LENGTH.
510 Return 0 if successful, otherwise -1 and errno set.
511 See the POSIX:2001 specification
512 <http://www.opengroup.org/susv3xsh/ftruncate.html>. */
513 # if !@HAVE_FTRUNCATE@
514 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
516 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
517 _GL_CXXALIASWARN (ftruncate);
518 #elif defined GNULIB_POSIXCHECK
520 # if HAVE_RAW_DECL_FTRUNCATE
521 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
522 "use gnulib module ftruncate for portability");
528 /* Get the name of the current working directory, and put it in SIZE bytes
530 Return BUF if successful, or NULL if the directory couldn't be determined
531 or SIZE was too small.
532 See the POSIX:2001 specification
533 <http://www.opengroup.org/susv3xsh/getcwd.html>.
534 Additionally, the gnulib module 'getcwd' guarantees the following GNU
535 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
536 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
538 # if @REPLACE_GETCWD@
539 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
540 # define getcwd rpl_getcwd
542 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
543 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
545 /* Need to cast, because on mingw, the second parameter is
547 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
549 _GL_CXXALIASWARN (getcwd);
550 #elif defined GNULIB_POSIXCHECK
552 # if HAVE_RAW_DECL_GETCWD
553 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
554 "use gnulib module getcwd for portability");
559 #if @GNULIB_GETDOMAINNAME@
560 /* Return the NIS domain name of the machine.
561 WARNING! The NIS domain name is unrelated to the fully qualified host name
562 of the machine. It is also unrelated to email addresses.
563 WARNING! The NIS domain name is usually the empty string or "(none)" when
566 Put up to LEN bytes of the NIS domain name into NAME.
567 Null terminate it if the name is shorter than LEN.
568 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
569 Return 0 if successful, otherwise set errno and return -1. */
570 # if @REPLACE_GETDOMAINNAME@
571 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
572 # undef getdomainname
573 # define getdomainname rpl_getdomainname
575 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
576 _GL_ARG_NONNULL ((1)));
577 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
579 # if !@HAVE_DECL_GETDOMAINNAME@
580 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
581 _GL_ARG_NONNULL ((1)));
583 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
585 _GL_CXXALIASWARN (getdomainname);
586 #elif defined GNULIB_POSIXCHECK
587 # undef getdomainname
588 # if HAVE_RAW_DECL_GETDOMAINNAME
589 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
590 "use gnulib module getdomainname for portability");
595 #if @GNULIB_GETDTABLESIZE@
596 /* Return the maximum number of file descriptors in the current process.
597 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
598 # if !@HAVE_GETDTABLESIZE@
599 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
601 _GL_CXXALIAS_SYS (getdtablesize, int, (void));
602 _GL_CXXALIASWARN (getdtablesize);
603 #elif defined GNULIB_POSIXCHECK
604 # undef getdtablesize
605 # if HAVE_RAW_DECL_GETDTABLESIZE
606 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
607 "use gnulib module getdtablesize for portability");
612 #if @GNULIB_GETGROUPS@
613 /* Return the supplemental groups that the current process belongs to.
614 It is unspecified whether the effective group id is in the list.
615 If N is 0, return the group count; otherwise, N describes how many
616 entries are available in GROUPS. Return -1 and set errno if N is
617 not 0 and not large enough. Fails with ENOSYS on some systems. */
618 # if @REPLACE_GETGROUPS@
619 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
621 # define getgroups rpl_getgroups
623 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
624 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
626 # if !@HAVE_GETGROUPS@
627 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
629 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
631 _GL_CXXALIASWARN (getgroups);
632 #elif defined GNULIB_POSIXCHECK
634 # if HAVE_RAW_DECL_GETGROUPS
635 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
636 "use gnulib module getgroups for portability");
641 #if @GNULIB_GETHOSTNAME@
642 /* Return the standard host name of the machine.
643 WARNING! The host name may or may not be fully qualified.
645 Put up to LEN bytes of the host name into NAME.
646 Null terminate it if the name is shorter than LEN.
647 If the host name is longer than LEN, set errno = EINVAL and return -1.
648 Return 0 if successful, otherwise set errno and return -1. */
649 # if @UNISTD_H_HAVE_WINSOCK2_H@
650 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
652 # define gethostname rpl_gethostname
654 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
655 _GL_ARG_NONNULL ((1)));
656 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
658 # if !@HAVE_GETHOSTNAME@
659 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
660 _GL_ARG_NONNULL ((1)));
662 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
665 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
667 _GL_CXXALIASWARN (gethostname);
668 #elif @UNISTD_H_HAVE_WINSOCK2_H@
670 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
671 #elif defined GNULIB_POSIXCHECK
673 # if HAVE_RAW_DECL_GETHOSTNAME
674 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
675 "use gnulib module gethostname for portability");
680 #if @GNULIB_GETLOGIN@
681 /* Returns the user's login name, or NULL if it cannot be found. Upon error,
682 returns NULL with errno set.
684 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
686 Most programs don't need to use this function, because the information is
687 available through environment variables:
688 ${LOGNAME-$USER} on Unix platforms,
689 $USERNAME on native Windows platforms.
691 # if !@HAVE_GETLOGIN@
692 _GL_FUNCDECL_SYS (getlogin, char *, (void));
694 _GL_CXXALIAS_SYS (getlogin, char *, (void));
695 _GL_CXXALIASWARN (getlogin);
696 #elif defined GNULIB_POSIXCHECK
698 # if HAVE_RAW_DECL_GETLOGIN
699 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
700 "use gnulib module getlogin for portability");
705 #if @GNULIB_GETLOGIN_R@
706 /* Copies the user's login name to NAME.
707 The array pointed to by NAME has room for SIZE bytes.
709 Returns 0 if successful. Upon error, an error number is returned, or -1 in
710 the case that the login name cannot be found but no specific error is
711 provided (this case is hopefully rare but is left open by the POSIX spec).
713 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
715 Most programs don't need to use this function, because the information is
716 available through environment variables:
717 ${LOGNAME-$USER} on Unix platforms,
718 $USERNAME on native Windows platforms.
720 # if @REPLACE_GETLOGIN_R@
721 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
722 # define getlogin_r rpl_getlogin_r
724 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
725 _GL_ARG_NONNULL ((1)));
726 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
728 # if !@HAVE_DECL_GETLOGIN_R@
729 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
730 _GL_ARG_NONNULL ((1)));
732 /* Need to cast, because on Solaris 10 systems, the second argument is
734 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
736 _GL_CXXALIASWARN (getlogin_r);
737 #elif defined GNULIB_POSIXCHECK
739 # if HAVE_RAW_DECL_GETLOGIN_R
740 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
741 "use gnulib module getlogin_r for portability");
746 #if @GNULIB_GETPAGESIZE@
747 # if @REPLACE_GETPAGESIZE@
748 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
749 # define getpagesize rpl_getpagesize
751 _GL_FUNCDECL_RPL (getpagesize, int, (void));
752 _GL_CXXALIAS_RPL (getpagesize, int, (void));
754 # if !@HAVE_GETPAGESIZE@
755 # if !defined getpagesize
756 /* This is for POSIX systems. */
757 # if !defined _gl_getpagesize && defined _SC_PAGESIZE
758 # if ! (defined __VMS && __VMS_VER < 70000000)
759 # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
762 /* This is for older VMS. */
763 # if !defined _gl_getpagesize && defined __VMS
765 # define _gl_getpagesize() 8192
767 # define _gl_getpagesize() 512
770 /* This is for BeOS. */
771 # if !defined _gl_getpagesize && @HAVE_OS_H@
773 # if defined B_PAGE_SIZE
774 # define _gl_getpagesize() B_PAGE_SIZE
777 /* This is for AmigaOS4.0. */
778 # if !defined _gl_getpagesize && defined __amigaos4__
779 # define _gl_getpagesize() 2048
781 /* This is for older Unix systems. */
782 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
783 # include <sys/param.h>
784 # ifdef EXEC_PAGESIZE
785 # define _gl_getpagesize() EXEC_PAGESIZE
791 # define _gl_getpagesize() (NBPG * CLSIZE)
794 # define _gl_getpagesize() NBPC
799 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
800 # define getpagesize() _gl_getpagesize ()
802 # if !GNULIB_defined_getpagesize_function
806 return _gl_getpagesize ();
808 # define GNULIB_defined_getpagesize_function 1
813 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
814 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
816 # if @HAVE_DECL_GETPAGESIZE@
817 _GL_CXXALIASWARN (getpagesize);
819 #elif defined GNULIB_POSIXCHECK
821 # if HAVE_RAW_DECL_GETPAGESIZE
822 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
823 "use gnulib module getpagesize for portability");
828 #if @GNULIB_GETUSERSHELL@
829 /* Return the next valid login shell on the system, or NULL when the end of
830 the list has been reached. */
831 # if !@HAVE_DECL_GETUSERSHELL@
832 _GL_FUNCDECL_SYS (getusershell, char *, (void));
834 _GL_CXXALIAS_SYS (getusershell, char *, (void));
835 _GL_CXXALIASWARN (getusershell);
836 #elif defined GNULIB_POSIXCHECK
838 # if HAVE_RAW_DECL_GETUSERSHELL
839 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
840 "use gnulib module getusershell for portability");
844 #if @GNULIB_GETUSERSHELL@
845 /* Rewind to pointer that is advanced at each getusershell() call. */
846 # if !@HAVE_DECL_GETUSERSHELL@
847 _GL_FUNCDECL_SYS (setusershell, void, (void));
849 _GL_CXXALIAS_SYS (setusershell, void, (void));
850 _GL_CXXALIASWARN (setusershell);
851 #elif defined GNULIB_POSIXCHECK
853 # if HAVE_RAW_DECL_SETUSERSHELL
854 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
855 "use gnulib module getusershell for portability");
859 #if @GNULIB_GETUSERSHELL@
860 /* Free the pointer that is advanced at each getusershell() call and
861 associated resources. */
862 # if !@HAVE_DECL_GETUSERSHELL@
863 _GL_FUNCDECL_SYS (endusershell, void, (void));
865 _GL_CXXALIAS_SYS (endusershell, void, (void));
866 _GL_CXXALIASWARN (endusershell);
867 #elif defined GNULIB_POSIXCHECK
869 # if HAVE_RAW_DECL_ENDUSERSHELL
870 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
871 "use gnulib module getusershell for portability");
876 #if @GNULIB_GROUP_MEMBER@
877 /* Determine whether group id is in calling user's group list. */
878 # if !@HAVE_GROUP_MEMBER@
879 _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
881 _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
882 _GL_CXXALIASWARN (group_member);
883 #elif defined GNULIB_POSIXCHECK
885 # if HAVE_RAW_DECL_GROUP_MEMBER
886 _GL_WARN_ON_USE (group_member, "group_member is unportable - "
887 "use gnulib module group-member for portability");
893 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
894 to GID (if GID is not -1). Do not follow symbolic links.
895 Return 0 if successful, otherwise -1 and errno set.
896 See the POSIX:2001 specification
897 <http://www.opengroup.org/susv3xsh/lchown.html>. */
898 # if @REPLACE_LCHOWN@
899 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
901 # define lchown rpl_lchown
903 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
904 _GL_ARG_NONNULL ((1)));
905 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
908 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
909 _GL_ARG_NONNULL ((1)));
911 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
913 _GL_CXXALIASWARN (lchown);
914 #elif defined GNULIB_POSIXCHECK
916 # if HAVE_RAW_DECL_LCHOWN
917 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
918 "use gnulib module lchown for portability");
924 /* Create a new hard link for an existing file.
925 Return 0 if successful, otherwise -1 and errno set.
926 See POSIX:2001 specification
927 <http://www.opengroup.org/susv3xsh/link.html>. */
929 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
930 # define link rpl_link
932 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
933 _GL_ARG_NONNULL ((1, 2)));
934 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
937 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
938 _GL_ARG_NONNULL ((1, 2)));
940 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
942 _GL_CXXALIASWARN (link);
943 #elif defined GNULIB_POSIXCHECK
945 # if HAVE_RAW_DECL_LINK
946 _GL_WARN_ON_USE (link, "link is unportable - "
947 "use gnulib module link for portability");
953 /* Create a new hard link for an existing file, relative to two
954 directories. FLAG controls whether symlinks are followed.
955 Return 0 if successful, otherwise -1 and errno set. */
956 # if @REPLACE_LINKAT@
957 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
959 # define linkat rpl_linkat
961 _GL_FUNCDECL_RPL (linkat, int,
962 (int fd1, const char *path1, int fd2, const char *path2,
964 _GL_ARG_NONNULL ((2, 4)));
965 _GL_CXXALIAS_RPL (linkat, int,
966 (int fd1, const char *path1, int fd2, const char *path2,
970 _GL_FUNCDECL_SYS (linkat, int,
971 (int fd1, const char *path1, int fd2, const char *path2,
973 _GL_ARG_NONNULL ((2, 4)));
975 _GL_CXXALIAS_SYS (linkat, int,
976 (int fd1, const char *path1, int fd2, const char *path2,
979 _GL_CXXALIASWARN (linkat);
980 #elif defined GNULIB_POSIXCHECK
982 # if HAVE_RAW_DECL_LINKAT
983 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
984 "use gnulib module linkat for portability");
990 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
991 Return the new offset if successful, otherwise -1 and errno set.
992 See the POSIX:2001 specification
993 <http://www.opengroup.org/susv3xsh/lseek.html>. */
995 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
996 # define lseek rpl_lseek
998 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
999 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1001 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1003 _GL_CXXALIASWARN (lseek);
1004 #elif defined GNULIB_POSIXCHECK
1006 # if HAVE_RAW_DECL_LSEEK
1007 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1008 "systems - use gnulib module lseek for portability");
1014 /* Create a pipe, defaulting to O_BINARY mode.
1015 Store the read-end as fd[0] and the write-end as fd[1].
1016 Return 0 upon success, or -1 with errno set upon failure. */
1018 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
1020 _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1021 _GL_CXXALIASWARN (pipe);
1022 #elif defined GNULIB_POSIXCHECK
1024 # if HAVE_RAW_DECL_PIPE
1025 _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1026 "use gnulib module pipe-posix for portability");
1032 /* Create a pipe, applying the given flags when opening the read-end of the
1033 pipe and the write-end of the pipe.
1034 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1035 and O_TEXT, O_BINARY (defined in "binary-io.h").
1036 Store the read-end as fd[0] and the write-end as fd[1].
1037 Return 0 upon success, or -1 with errno set upon failure.
1038 See also the Linux man page at
1039 <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
1041 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1042 # define pipe2 rpl_pipe2
1044 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1045 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1047 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1048 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1050 _GL_CXXALIASWARN (pipe2);
1051 #elif defined GNULIB_POSIXCHECK
1053 # if HAVE_RAW_DECL_PIPE2
1054 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1055 "use gnulib module pipe2 for portability");
1061 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1062 Return the number of bytes placed into BUF if successful, otherwise
1063 set errno and return -1. 0 indicates EOF. See the POSIX:2001
1064 specification <http://www.opengroup.org/susv3xsh/pread.html>. */
1065 # if @REPLACE_PREAD@
1066 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1068 # define pread rpl_pread
1070 _GL_FUNCDECL_RPL (pread, ssize_t,
1071 (int fd, void *buf, size_t bufsize, off_t offset)
1072 _GL_ARG_NONNULL ((2)));
1073 _GL_CXXALIAS_RPL (pread, ssize_t,
1074 (int fd, void *buf, size_t bufsize, off_t offset));
1077 _GL_FUNCDECL_SYS (pread, ssize_t,
1078 (int fd, void *buf, size_t bufsize, off_t offset)
1079 _GL_ARG_NONNULL ((2)));
1081 _GL_CXXALIAS_SYS (pread, ssize_t,
1082 (int fd, void *buf, size_t bufsize, off_t offset));
1084 _GL_CXXALIASWARN (pread);
1085 #elif defined GNULIB_POSIXCHECK
1087 # if HAVE_RAW_DECL_PREAD
1088 _GL_WARN_ON_USE (pread, "pread is unportable - "
1089 "use gnulib module pread for portability");
1095 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1096 Return the number of bytes written if successful, otherwise
1097 set errno and return -1. 0 indicates nothing written. See the
1098 POSIX:2001 specification
1099 <http://www.opengroup.org/susv3xsh/pwrite.html>. */
1100 # if @REPLACE_PWRITE@
1101 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1103 # define pwrite rpl_pwrite
1105 _GL_FUNCDECL_RPL (pwrite, ssize_t,
1106 (int fd, const void *buf, size_t bufsize, off_t offset)
1107 _GL_ARG_NONNULL ((2)));
1108 _GL_CXXALIAS_RPL (pwrite, ssize_t,
1109 (int fd, const void *buf, size_t bufsize, off_t offset));
1112 _GL_FUNCDECL_SYS (pwrite, ssize_t,
1113 (int fd, const void *buf, size_t bufsize, off_t offset)
1114 _GL_ARG_NONNULL ((2)));
1116 _GL_CXXALIAS_SYS (pwrite, ssize_t,
1117 (int fd, const void *buf, size_t bufsize, off_t offset));
1119 _GL_CXXALIASWARN (pwrite);
1120 #elif defined GNULIB_POSIXCHECK
1122 # if HAVE_RAW_DECL_PWRITE
1123 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1124 "use gnulib module pwrite for portability");
1130 /* Read up to COUNT bytes from file descriptor FD into the buffer starting
1131 at BUF. See the POSIX:2001 specification
1132 <http://www.opengroup.org/susv3xsh/read.html>. */
1133 # if @REPLACE_READ@ && @GNULIB_UNISTD_H_NONBLOCKING@
1134 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1136 # define read rpl_read
1138 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1139 _GL_ARG_NONNULL ((2)));
1140 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1142 /* Need to cast, because on mingw, the third parameter is
1144 and the return type is 'int'. */
1145 _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
1147 _GL_CXXALIASWARN (read);
1151 #if @GNULIB_READLINK@
1152 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
1153 bytes of it into BUF. Return the number of bytes placed into BUF if
1154 successful, otherwise -1 and errno set.
1155 See the POSIX:2001 specification
1156 <http://www.opengroup.org/susv3xsh/readlink.html>. */
1157 # if @REPLACE_READLINK@
1158 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1159 # define readlink rpl_readlink
1161 _GL_FUNCDECL_RPL (readlink, ssize_t,
1162 (const char *file, char *buf, size_t bufsize)
1163 _GL_ARG_NONNULL ((1, 2)));
1164 _GL_CXXALIAS_RPL (readlink, ssize_t,
1165 (const char *file, char *buf, size_t bufsize));
1167 # if !@HAVE_READLINK@
1168 _GL_FUNCDECL_SYS (readlink, ssize_t,
1169 (const char *file, char *buf, size_t bufsize)
1170 _GL_ARG_NONNULL ((1, 2)));
1172 _GL_CXXALIAS_SYS (readlink, ssize_t,
1173 (const char *file, char *buf, size_t bufsize));
1175 _GL_CXXALIASWARN (readlink);
1176 #elif defined GNULIB_POSIXCHECK
1178 # if HAVE_RAW_DECL_READLINK
1179 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1180 "use gnulib module readlink for portability");
1185 #if @GNULIB_READLINKAT@
1186 # if !@HAVE_READLINKAT@
1187 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
1188 (int fd, char const *file, char *buf, size_t len)
1189 _GL_ARG_NONNULL ((2, 3)));
1191 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
1192 (int fd, char const *file, char *buf, size_t len));
1193 _GL_CXXALIASWARN (readlinkat);
1194 #elif defined GNULIB_POSIXCHECK
1196 # if HAVE_RAW_DECL_READLINKAT
1197 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1198 "use gnulib module readlinkat for portability");
1204 /* Remove the directory DIR. */
1205 # if @REPLACE_RMDIR@
1206 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1207 # define rmdir rpl_rmdir
1209 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1210 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1212 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1214 _GL_CXXALIASWARN (rmdir);
1215 #elif defined GNULIB_POSIXCHECK
1217 # if HAVE_RAW_DECL_RMDIR
1218 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1219 "use gnulib module rmdir for portability");
1225 /* Pause the execution of the current thread for N seconds.
1226 Returns the number of seconds left to sleep.
1227 See the POSIX:2001 specification
1228 <http://www.opengroup.org/susv3xsh/sleep.html>. */
1229 # if @REPLACE_SLEEP@
1230 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1232 # define sleep rpl_sleep
1234 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1235 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1238 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1240 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1242 _GL_CXXALIASWARN (sleep);
1243 #elif defined GNULIB_POSIXCHECK
1245 # if HAVE_RAW_DECL_SLEEP
1246 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
1247 "use gnulib module sleep for portability");
1252 #if @GNULIB_SYMLINK@
1253 # if @REPLACE_SYMLINK@
1254 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1256 # define symlink rpl_symlink
1258 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1259 _GL_ARG_NONNULL ((1, 2)));
1260 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1262 # if !@HAVE_SYMLINK@
1263 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1264 _GL_ARG_NONNULL ((1, 2)));
1266 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1268 _GL_CXXALIASWARN (symlink);
1269 #elif defined GNULIB_POSIXCHECK
1271 # if HAVE_RAW_DECL_SYMLINK
1272 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
1273 "use gnulib module symlink for portability");
1278 #if @GNULIB_SYMLINKAT@
1279 # if !@HAVE_SYMLINKAT@
1280 _GL_FUNCDECL_SYS (symlinkat, int,
1281 (char const *contents, int fd, char const *file)
1282 _GL_ARG_NONNULL ((1, 3)));
1284 _GL_CXXALIAS_SYS (symlinkat, int,
1285 (char const *contents, int fd, char const *file));
1286 _GL_CXXALIASWARN (symlinkat);
1287 #elif defined GNULIB_POSIXCHECK
1289 # if HAVE_RAW_DECL_SYMLINKAT
1290 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1291 "use gnulib module symlinkat for portability");
1296 #if @GNULIB_TTYNAME_R@
1297 /* Store at most BUFLEN characters of the pathname of the terminal FD is
1298 open on in BUF. Return 0 on success, otherwise an error number. */
1299 # if @REPLACE_TTYNAME_R@
1300 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1302 # define ttyname_r rpl_ttyname_r
1304 _GL_FUNCDECL_RPL (ttyname_r, int,
1305 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1306 _GL_CXXALIAS_RPL (ttyname_r, int,
1307 (int fd, char *buf, size_t buflen));
1309 # if !@HAVE_DECL_TTYNAME_R@
1310 _GL_FUNCDECL_SYS (ttyname_r, int,
1311 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1313 _GL_CXXALIAS_SYS (ttyname_r, int,
1314 (int fd, char *buf, size_t buflen));
1316 _GL_CXXALIASWARN (ttyname_r);
1317 #elif defined GNULIB_POSIXCHECK
1319 # if HAVE_RAW_DECL_TTYNAME_R
1320 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1321 "use gnulib module ttyname_r for portability");
1327 # if @REPLACE_UNLINK@
1328 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1330 # define unlink rpl_unlink
1332 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1333 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
1335 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
1337 _GL_CXXALIASWARN (unlink);
1338 #elif defined GNULIB_POSIXCHECK
1340 # if HAVE_RAW_DECL_UNLINK
1341 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
1342 "use gnulib module unlink for portability");
1347 #if @GNULIB_UNLINKAT@
1348 # if @REPLACE_UNLINKAT@
1349 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1351 # define unlinkat rpl_unlinkat
1353 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1354 _GL_ARG_NONNULL ((2)));
1355 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1357 # if !@HAVE_UNLINKAT@
1358 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1359 _GL_ARG_NONNULL ((2)));
1361 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1363 _GL_CXXALIASWARN (unlinkat);
1364 #elif defined GNULIB_POSIXCHECK
1366 # if HAVE_RAW_DECL_UNLINKAT
1367 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1368 "use gnulib module openat for portability");
1374 /* Pause the execution of the current thread for N microseconds.
1375 Returns 0 on completion, or -1 on range error.
1376 See the POSIX:2001 specification
1377 <http://www.opengroup.org/susv3xsh/sleep.html>. */
1378 # if @REPLACE_USLEEP@
1379 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1381 # define usleep rpl_usleep
1383 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1384 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1387 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1389 _GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
1391 _GL_CXXALIASWARN (usleep);
1392 #elif defined GNULIB_POSIXCHECK
1394 # if HAVE_RAW_DECL_USLEEP
1395 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1396 "use gnulib module usleep for portability");
1402 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
1403 See the POSIX:2001 specification
1404 <http://www.opengroup.org/susv3xsh/write.html>. */
1405 # if @REPLACE_WRITE@ && (@GNULIB_UNISTD_H_NONBLOCKING@ || @GNULIB_UNISTD_H_SIGPIPE@)
1406 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1408 # define write rpl_write
1410 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1411 _GL_ARG_NONNULL ((2)));
1412 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1414 /* Need to cast, because on mingw, the third parameter is
1416 and the return type is 'int'. */
1417 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1419 _GL_CXXALIASWARN (write);
1423 #endif /* _@GUARD_PREFIX@_UNISTD_H */
1424 #endif /* _@GUARD_PREFIX@_UNISTD_H */