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-2013 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, see <http://www.gnu.org/licenses/>. */
19 #ifndef _@GUARD_PREFIX@_UNISTD_H
22 @PRAGMA_SYSTEM_HEADER@
26 /* The include_next requires a split double-inclusion guard. */
28 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
31 /* Get all possible declarations of gethostname(). */
32 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
33 && !defined _GL_INCLUDING_WINSOCK2_H
34 # define _GL_INCLUDING_WINSOCK2_H
35 # include <winsock2.h>
36 # undef _GL_INCLUDING_WINSOCK2_H
39 #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
40 #define _@GUARD_PREFIX@_UNISTD_H
42 /* NetBSD 5.0 mis-defines NULL. Also get size_t. */
45 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
46 /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
47 /* But avoid namespace pollution on glibc systems. */
48 #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
49 || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
50 && defined __CYGWIN__)) \
51 && ! defined __GLIBC__
55 /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
56 /* But avoid namespace pollution on glibc systems. */
57 #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
58 && ! defined __GLIBC__
62 /* mingw fails to declare _exit in <unistd.h>. */
63 /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
65 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
66 /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
68 /* But avoid namespace pollution on glibc systems. */
69 #if !defined __GLIBC__ && !defined __osf__
70 # define __need_system_stdlib_h
72 # undef __need_system_stdlib_h
75 /* Native Windows platforms declare chdir, getcwd, rmdir in
76 <io.h> and/or <direct.h>, not in <unistd.h>.
77 They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
78 lseek(), read(), unlink(), write() in <io.h>. */
79 #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
80 || defined GNULIB_POSIXCHECK) \
81 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
82 # include <io.h> /* mingw32, mingw64 */
83 # include <direct.h> /* mingw64, MSVC 9 */
84 #elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
85 || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
86 || defined GNULIB_POSIXCHECK) \
87 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
91 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
92 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
93 /* But avoid namespace pollution on glibc systems. */
94 #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
95 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
100 /* MSVC defines off_t in <sys/types.h>.
101 May also define off_t to a 64-bit type on native Windows. */
102 #if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
104 # include <sys/types.h>
107 #if (@GNULIB_READ@ || @GNULIB_WRITE@ \
108 || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
109 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
111 # include <sys/types.h>
114 /* Get getopt(), optarg, optind, opterr, optopt.
115 But avoid namespace pollution on glibc systems. */
116 #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
117 # define __need_getopt
121 _GL_INLINE_HEADER_BEGIN
122 #ifndef _GL_UNISTD_INLINE
123 # define _GL_UNISTD_INLINE _GL_INLINE
126 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
128 /* The definition of _GL_ARG_NONNULL is copied here. */
130 /* The definition of _GL_WARN_ON_USE is copied here. */
133 /* Hide some function declarations from <winsock2.h>. */
135 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
136 # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
137 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
139 # define socket socket_used_without_including_sys_socket_h
141 # define connect connect_used_without_including_sys_socket_h
143 # define accept accept_used_without_including_sys_socket_h
145 # define bind bind_used_without_including_sys_socket_h
147 # define getpeername getpeername_used_without_including_sys_socket_h
149 # define getsockname getsockname_used_without_including_sys_socket_h
151 # define getsockopt getsockopt_used_without_including_sys_socket_h
153 # define listen listen_used_without_including_sys_socket_h
155 # define recv recv_used_without_including_sys_socket_h
157 # define send send_used_without_including_sys_socket_h
159 # define recvfrom recvfrom_used_without_including_sys_socket_h
161 # define sendto sendto_used_without_including_sys_socket_h
163 # define setsockopt setsockopt_used_without_including_sys_socket_h
165 # define shutdown shutdown_used_without_including_sys_socket_h
167 _GL_WARN_ON_USE (socket,
168 "socket() used without including <sys/socket.h>");
169 _GL_WARN_ON_USE (connect,
170 "connect() used without including <sys/socket.h>");
171 _GL_WARN_ON_USE (accept,
172 "accept() used without including <sys/socket.h>");
173 _GL_WARN_ON_USE (bind,
174 "bind() used without including <sys/socket.h>");
175 _GL_WARN_ON_USE (getpeername,
176 "getpeername() used without including <sys/socket.h>");
177 _GL_WARN_ON_USE (getsockname,
178 "getsockname() used without including <sys/socket.h>");
179 _GL_WARN_ON_USE (getsockopt,
180 "getsockopt() used without including <sys/socket.h>");
181 _GL_WARN_ON_USE (listen,
182 "listen() used without including <sys/socket.h>");
183 _GL_WARN_ON_USE (recv,
184 "recv() used without including <sys/socket.h>");
185 _GL_WARN_ON_USE (send,
186 "send() used without including <sys/socket.h>");
187 _GL_WARN_ON_USE (recvfrom,
188 "recvfrom() used without including <sys/socket.h>");
189 _GL_WARN_ON_USE (sendto,
190 "sendto() used without including <sys/socket.h>");
191 _GL_WARN_ON_USE (setsockopt,
192 "setsockopt() used without including <sys/socket.h>");
193 _GL_WARN_ON_USE (shutdown,
194 "shutdown() used without including <sys/socket.h>");
197 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
198 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
200 # define select select_used_without_including_sys_select_h
202 _GL_WARN_ON_USE (select,
203 "select() used without including <sys/select.h>");
209 /* OS/2 EMX lacks these macros. */
211 # define STDIN_FILENO 0
213 #ifndef STDOUT_FILENO
214 # define STDOUT_FILENO 1
216 #ifndef STDERR_FILENO
217 # define STDERR_FILENO 2
220 /* Ensure *_OK macros exist. */
229 /* Declare overridden functions. */
232 #if defined GNULIB_POSIXCHECK
233 /* The access() function is a security risk. */
234 _GL_WARN_ON_USE (access, "the access function is a security risk - "
235 "use the gnulib module faccessat instead");
240 _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
241 _GL_CXXALIASWARN (chdir);
242 #elif defined GNULIB_POSIXCHECK
244 # if HAVE_RAW_DECL_CHDIR
245 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
246 "use gnulib module chdir for portability");
252 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
253 to GID (if GID is not -1). Follow symbolic links.
254 Return 0 if successful, otherwise -1 and errno set.
255 See the POSIX:2008 specification
256 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
258 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
260 # define chown rpl_chown
262 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
263 _GL_ARG_NONNULL ((1)));
264 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
267 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
268 _GL_ARG_NONNULL ((1)));
270 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
272 _GL_CXXALIASWARN (chown);
273 #elif defined GNULIB_POSIXCHECK
275 # if HAVE_RAW_DECL_CHOWN
276 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
277 "doesn't treat a uid or gid of -1 on some systems - "
278 "use gnulib module chown for portability");
285 /* Automatically included by modules that need a replacement for close. */
286 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
288 # define close rpl_close
290 _GL_FUNCDECL_RPL (close, int, (int fd));
291 _GL_CXXALIAS_RPL (close, int, (int fd));
293 _GL_CXXALIAS_SYS (close, int, (int fd));
295 _GL_CXXALIASWARN (close);
296 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
298 # define close close_used_without_requesting_gnulib_module_close
299 #elif defined GNULIB_POSIXCHECK
301 /* Assume close is always declared. */
302 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
303 "use gnulib module close for portability");
309 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
312 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
313 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
315 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
317 _GL_CXXALIASWARN (dup);
318 #elif defined GNULIB_POSIXCHECK
320 # if HAVE_RAW_DECL_DUP
321 _GL_WARN_ON_USE (dup, "dup is unportable - "
322 "use gnulib module dup for portability");
328 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
329 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
330 Return newfd if successful, otherwise -1 and errno set.
331 See the POSIX:2008 specification
332 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
334 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
335 # define dup2 rpl_dup2
337 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
338 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
341 _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
343 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
345 _GL_CXXALIASWARN (dup2);
346 #elif defined GNULIB_POSIXCHECK
348 # if HAVE_RAW_DECL_DUP2
349 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
350 "use gnulib module dup2 for portability");
356 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
358 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
359 and O_TEXT, O_BINARY (defined in "binary-io.h").
360 Close NEWFD first if it is open.
361 Return newfd if successful, otherwise -1 and errno set.
362 See the Linux man page at
363 <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
365 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
366 # define dup3 rpl_dup3
368 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
369 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
371 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
372 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
374 _GL_CXXALIASWARN (dup3);
375 #elif defined GNULIB_POSIXCHECK
377 # if HAVE_RAW_DECL_DUP3
378 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
379 "use gnulib module dup3 for portability");
385 # if !@HAVE_DECL_ENVIRON@
386 /* Set of environment variables and values. An array of strings of the form
387 "VARIABLE=VALUE", terminated with a NULL. */
388 # if defined __APPLE__ && defined __MACH__
389 # include <crt_externs.h>
390 # define environ (*_NSGetEnviron ())
395 extern char **environ;
401 #elif defined GNULIB_POSIXCHECK
402 # if HAVE_RAW_DECL_ENVIRON
403 _GL_UNISTD_INLINE char ***
408 _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
409 "use gnulib module environ for portability");
411 # define environ (*rpl_environ ())
416 #if @GNULIB_EUIDACCESS@
417 /* Like access(), except that it uses the effective user id and group id of
418 the current process. */
419 # if !@HAVE_EUIDACCESS@
420 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
421 _GL_ARG_NONNULL ((1)));
423 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
424 _GL_CXXALIASWARN (euidaccess);
425 # if defined GNULIB_POSIXCHECK
426 /* Like access(), this function is a security risk. */
427 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
428 "use the gnulib module faccessat instead");
430 #elif defined GNULIB_POSIXCHECK
432 # if HAVE_RAW_DECL_EUIDACCESS
433 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
434 "use gnulib module euidaccess for portability");
439 #if @GNULIB_FACCESSAT@
440 # if !@HAVE_FACCESSAT@
441 _GL_FUNCDECL_SYS (faccessat, int,
442 (int fd, char const *file, int mode, int flag)
443 _GL_ARG_NONNULL ((2)));
445 _GL_CXXALIAS_SYS (faccessat, int,
446 (int fd, char const *file, int mode, int flag));
447 _GL_CXXALIASWARN (faccessat);
448 #elif defined GNULIB_POSIXCHECK
450 # if HAVE_RAW_DECL_FACCESSAT
451 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
452 "use gnulib module faccessat for portability");
458 /* Change the process' current working directory to the directory on which
459 the given file descriptor is open.
460 Return 0 if successful, otherwise -1 and errno set.
461 See the POSIX:2008 specification
462 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
464 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
466 /* Gnulib internal hooks needed to maintain the fchdir metadata. */
467 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
468 _GL_ARG_NONNULL ((2));
469 _GL_EXTERN_C void _gl_unregister_fd (int fd);
470 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
471 _GL_EXTERN_C const char *_gl_directory_name (int fd);
474 # if !@HAVE_DECL_FCHDIR@
475 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
478 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
479 _GL_CXXALIASWARN (fchdir);
480 #elif defined GNULIB_POSIXCHECK
482 # if HAVE_RAW_DECL_FCHDIR
483 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
484 "use gnulib module fchdir for portability");
489 #if @GNULIB_FCHOWNAT@
490 # if @REPLACE_FCHOWNAT@
491 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
493 # define fchownat rpl_fchownat
495 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
496 uid_t owner, gid_t group, int flag)
497 _GL_ARG_NONNULL ((2)));
498 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
499 uid_t owner, gid_t group, int flag));
501 # if !@HAVE_FCHOWNAT@
502 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
503 uid_t owner, gid_t group, int flag)
504 _GL_ARG_NONNULL ((2)));
506 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
507 uid_t owner, gid_t group, int flag));
509 _GL_CXXALIASWARN (fchownat);
510 #elif defined GNULIB_POSIXCHECK
512 # if HAVE_RAW_DECL_FCHOWNAT
513 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
514 "use gnulib module openat for portability");
519 #if @GNULIB_FDATASYNC@
520 /* Synchronize changes to a file.
521 Return 0 if successful, otherwise -1 and errno set.
522 See POSIX:2008 specification
523 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
524 # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
525 _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
527 _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
528 _GL_CXXALIASWARN (fdatasync);
529 #elif defined GNULIB_POSIXCHECK
531 # if HAVE_RAW_DECL_FDATASYNC
532 _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
533 "use gnulib module fdatasync for portability");
539 /* Synchronize changes, including metadata, to a file.
540 Return 0 if successful, otherwise -1 and errno set.
541 See POSIX:2008 specification
542 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
544 _GL_FUNCDECL_SYS (fsync, int, (int fd));
546 _GL_CXXALIAS_SYS (fsync, int, (int fd));
547 _GL_CXXALIASWARN (fsync);
548 #elif defined GNULIB_POSIXCHECK
550 # if HAVE_RAW_DECL_FSYNC
551 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
552 "use gnulib module fsync for portability");
557 #if @GNULIB_FTRUNCATE@
558 /* Change the size of the file to which FD is opened to become equal to LENGTH.
559 Return 0 if successful, otherwise -1 and errno set.
560 See the POSIX:2008 specification
561 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
562 # if @REPLACE_FTRUNCATE@
563 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
565 # define ftruncate rpl_ftruncate
567 _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
568 _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
570 # if !@HAVE_FTRUNCATE@
571 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
573 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
575 _GL_CXXALIASWARN (ftruncate);
576 #elif defined GNULIB_POSIXCHECK
578 # if HAVE_RAW_DECL_FTRUNCATE
579 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
580 "use gnulib module ftruncate for portability");
586 /* Get the name of the current working directory, and put it in SIZE bytes
588 Return BUF if successful, or NULL if the directory couldn't be determined
589 or SIZE was too small.
590 See the POSIX:2008 specification
591 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
592 Additionally, the gnulib module 'getcwd' guarantees the following GNU
593 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
594 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
596 # if @REPLACE_GETCWD@
597 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
598 # define getcwd rpl_getcwd
600 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
601 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
603 /* Need to cast, because on mingw, the second parameter is
605 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
607 _GL_CXXALIASWARN (getcwd);
608 #elif defined GNULIB_POSIXCHECK
610 # if HAVE_RAW_DECL_GETCWD
611 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
612 "use gnulib module getcwd for portability");
617 #if @GNULIB_GETDOMAINNAME@
618 /* Return the NIS domain name of the machine.
619 WARNING! The NIS domain name is unrelated to the fully qualified host name
620 of the machine. It is also unrelated to email addresses.
621 WARNING! The NIS domain name is usually the empty string or "(none)" when
624 Put up to LEN bytes of the NIS domain name into NAME.
625 Null terminate it if the name is shorter than LEN.
626 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
627 Return 0 if successful, otherwise set errno and return -1. */
628 # if @REPLACE_GETDOMAINNAME@
629 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
630 # undef getdomainname
631 # define getdomainname rpl_getdomainname
633 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
634 _GL_ARG_NONNULL ((1)));
635 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
637 # if !@HAVE_DECL_GETDOMAINNAME@
638 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
639 _GL_ARG_NONNULL ((1)));
641 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
643 _GL_CXXALIASWARN (getdomainname);
644 #elif defined GNULIB_POSIXCHECK
645 # undef getdomainname
646 # if HAVE_RAW_DECL_GETDOMAINNAME
647 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
648 "use gnulib module getdomainname for portability");
653 #if @GNULIB_GETDTABLESIZE@
654 /* Return the maximum number of file descriptors in the current process.
655 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
656 # if !@HAVE_GETDTABLESIZE@
657 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
659 _GL_CXXALIAS_SYS (getdtablesize, int, (void));
660 _GL_CXXALIASWARN (getdtablesize);
661 #elif defined GNULIB_POSIXCHECK
662 # undef getdtablesize
663 # if HAVE_RAW_DECL_GETDTABLESIZE
664 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
665 "use gnulib module getdtablesize for portability");
670 #if @GNULIB_GETGROUPS@
671 /* Return the supplemental groups that the current process belongs to.
672 It is unspecified whether the effective group id is in the list.
673 If N is 0, return the group count; otherwise, N describes how many
674 entries are available in GROUPS. Return -1 and set errno if N is
675 not 0 and not large enough. Fails with ENOSYS on some systems. */
676 # if @REPLACE_GETGROUPS@
677 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
679 # define getgroups rpl_getgroups
681 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
682 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
684 # if !@HAVE_GETGROUPS@
685 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
687 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
689 _GL_CXXALIASWARN (getgroups);
690 #elif defined GNULIB_POSIXCHECK
692 # if HAVE_RAW_DECL_GETGROUPS
693 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
694 "use gnulib module getgroups for portability");
699 #if @GNULIB_GETHOSTNAME@
700 /* Return the standard host name of the machine.
701 WARNING! The host name may or may not be fully qualified.
703 Put up to LEN bytes of the host name into NAME.
704 Null terminate it if the name is shorter than LEN.
705 If the host name is longer than LEN, set errno = EINVAL and return -1.
706 Return 0 if successful, otherwise set errno and return -1. */
707 # if @UNISTD_H_HAVE_WINSOCK2_H@
708 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
710 # define gethostname rpl_gethostname
712 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
713 _GL_ARG_NONNULL ((1)));
714 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
716 # if !@HAVE_GETHOSTNAME@
717 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
718 _GL_ARG_NONNULL ((1)));
720 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
723 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
725 _GL_CXXALIASWARN (gethostname);
726 #elif @UNISTD_H_HAVE_WINSOCK2_H@
728 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
729 #elif defined GNULIB_POSIXCHECK
731 # if HAVE_RAW_DECL_GETHOSTNAME
732 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
733 "use gnulib module gethostname for portability");
738 #if @GNULIB_GETLOGIN@
739 /* Returns the user's login name, or NULL if it cannot be found. Upon error,
740 returns NULL with errno set.
742 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
744 Most programs don't need to use this function, because the information is
745 available through environment variables:
746 ${LOGNAME-$USER} on Unix platforms,
747 $USERNAME on native Windows platforms.
749 # if !@HAVE_GETLOGIN@
750 _GL_FUNCDECL_SYS (getlogin, char *, (void));
752 _GL_CXXALIAS_SYS (getlogin, char *, (void));
753 _GL_CXXALIASWARN (getlogin);
754 #elif defined GNULIB_POSIXCHECK
756 # if HAVE_RAW_DECL_GETLOGIN
757 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
758 "use gnulib module getlogin for portability");
763 #if @GNULIB_GETLOGIN_R@
764 /* Copies the user's login name to NAME.
765 The array pointed to by NAME has room for SIZE bytes.
767 Returns 0 if successful. Upon error, an error number is returned, or -1 in
768 the case that the login name cannot be found but no specific error is
769 provided (this case is hopefully rare but is left open by the POSIX spec).
771 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
773 Most programs don't need to use this function, because the information is
774 available through environment variables:
775 ${LOGNAME-$USER} on Unix platforms,
776 $USERNAME on native Windows platforms.
778 # if @REPLACE_GETLOGIN_R@
779 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
780 # define getlogin_r rpl_getlogin_r
782 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
783 _GL_ARG_NONNULL ((1)));
784 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
786 # if !@HAVE_DECL_GETLOGIN_R@
787 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
788 _GL_ARG_NONNULL ((1)));
790 /* Need to cast, because on Solaris 10 systems, the second argument is
792 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
794 _GL_CXXALIASWARN (getlogin_r);
795 #elif defined GNULIB_POSIXCHECK
797 # if HAVE_RAW_DECL_GETLOGIN_R
798 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
799 "use gnulib module getlogin_r for portability");
804 #if @GNULIB_GETPAGESIZE@
805 # if @REPLACE_GETPAGESIZE@
806 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
807 # define getpagesize rpl_getpagesize
809 _GL_FUNCDECL_RPL (getpagesize, int, (void));
810 _GL_CXXALIAS_RPL (getpagesize, int, (void));
812 # if !@HAVE_GETPAGESIZE@
813 # if !defined getpagesize
814 /* This is for POSIX systems. */
815 # if !defined _gl_getpagesize && defined _SC_PAGESIZE
816 # if ! (defined __VMS && __VMS_VER < 70000000)
817 # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
820 /* This is for older VMS. */
821 # if !defined _gl_getpagesize && defined __VMS
823 # define _gl_getpagesize() 8192
825 # define _gl_getpagesize() 512
828 /* This is for BeOS. */
829 # if !defined _gl_getpagesize && @HAVE_OS_H@
831 # if defined B_PAGE_SIZE
832 # define _gl_getpagesize() B_PAGE_SIZE
835 /* This is for AmigaOS4.0. */
836 # if !defined _gl_getpagesize && defined __amigaos4__
837 # define _gl_getpagesize() 2048
839 /* This is for older Unix systems. */
840 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
841 # include <sys/param.h>
842 # ifdef EXEC_PAGESIZE
843 # define _gl_getpagesize() EXEC_PAGESIZE
849 # define _gl_getpagesize() (NBPG * CLSIZE)
852 # define _gl_getpagesize() NBPC
857 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
858 # define getpagesize() _gl_getpagesize ()
860 # if !GNULIB_defined_getpagesize_function
861 _GL_UNISTD_INLINE int
864 return _gl_getpagesize ();
866 # define GNULIB_defined_getpagesize_function 1
871 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
872 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
874 # if @HAVE_DECL_GETPAGESIZE@
875 _GL_CXXALIASWARN (getpagesize);
877 #elif defined GNULIB_POSIXCHECK
879 # if HAVE_RAW_DECL_GETPAGESIZE
880 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
881 "use gnulib module getpagesize for portability");
886 #if @GNULIB_GETUSERSHELL@
887 /* Return the next valid login shell on the system, or NULL when the end of
888 the list has been reached. */
889 # if !@HAVE_DECL_GETUSERSHELL@
890 _GL_FUNCDECL_SYS (getusershell, char *, (void));
892 _GL_CXXALIAS_SYS (getusershell, char *, (void));
893 _GL_CXXALIASWARN (getusershell);
894 #elif defined GNULIB_POSIXCHECK
896 # if HAVE_RAW_DECL_GETUSERSHELL
897 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
898 "use gnulib module getusershell for portability");
902 #if @GNULIB_GETUSERSHELL@
903 /* Rewind to pointer that is advanced at each getusershell() call. */
904 # if !@HAVE_DECL_GETUSERSHELL@
905 _GL_FUNCDECL_SYS (setusershell, void, (void));
907 _GL_CXXALIAS_SYS (setusershell, void, (void));
908 _GL_CXXALIASWARN (setusershell);
909 #elif defined GNULIB_POSIXCHECK
911 # if HAVE_RAW_DECL_SETUSERSHELL
912 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
913 "use gnulib module getusershell for portability");
917 #if @GNULIB_GETUSERSHELL@
918 /* Free the pointer that is advanced at each getusershell() call and
919 associated resources. */
920 # if !@HAVE_DECL_GETUSERSHELL@
921 _GL_FUNCDECL_SYS (endusershell, void, (void));
923 _GL_CXXALIAS_SYS (endusershell, void, (void));
924 _GL_CXXALIASWARN (endusershell);
925 #elif defined GNULIB_POSIXCHECK
927 # if HAVE_RAW_DECL_ENDUSERSHELL
928 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
929 "use gnulib module getusershell for portability");
934 #if @GNULIB_GROUP_MEMBER@
935 /* Determine whether group id is in calling user's group list. */
936 # if !@HAVE_GROUP_MEMBER@
937 _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
939 _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
940 _GL_CXXALIASWARN (group_member);
941 #elif defined GNULIB_POSIXCHECK
943 # if HAVE_RAW_DECL_GROUP_MEMBER
944 _GL_WARN_ON_USE (group_member, "group_member is unportable - "
945 "use gnulib module group-member for portability");
951 # if @REPLACE_ISATTY@
952 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
954 # define isatty rpl_isatty
956 _GL_FUNCDECL_RPL (isatty, int, (int fd));
957 _GL_CXXALIAS_RPL (isatty, int, (int fd));
959 _GL_CXXALIAS_SYS (isatty, int, (int fd));
961 _GL_CXXALIASWARN (isatty);
962 #elif defined GNULIB_POSIXCHECK
964 # if HAVE_RAW_DECL_ISATTY
965 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
966 "use gnulib module isatty for portability");
972 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
973 to GID (if GID is not -1). Do not follow symbolic links.
974 Return 0 if successful, otherwise -1 and errno set.
975 See the POSIX:2008 specification
976 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
977 # if @REPLACE_LCHOWN@
978 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
980 # define lchown rpl_lchown
982 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
983 _GL_ARG_NONNULL ((1)));
984 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
987 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
988 _GL_ARG_NONNULL ((1)));
990 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
992 _GL_CXXALIASWARN (lchown);
993 #elif defined GNULIB_POSIXCHECK
995 # if HAVE_RAW_DECL_LCHOWN
996 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
997 "use gnulib module lchown for portability");
1003 /* Create a new hard link for an existing file.
1004 Return 0 if successful, otherwise -1 and errno set.
1005 See POSIX:2008 specification
1006 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
1008 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1009 # define link rpl_link
1011 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
1012 _GL_ARG_NONNULL ((1, 2)));
1013 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1016 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
1017 _GL_ARG_NONNULL ((1, 2)));
1019 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1021 _GL_CXXALIASWARN (link);
1022 #elif defined GNULIB_POSIXCHECK
1024 # if HAVE_RAW_DECL_LINK
1025 _GL_WARN_ON_USE (link, "link is unportable - "
1026 "use gnulib module link for portability");
1032 /* Create a new hard link for an existing file, relative to two
1033 directories. FLAG controls whether symlinks are followed.
1034 Return 0 if successful, otherwise -1 and errno set. */
1035 # if @REPLACE_LINKAT@
1036 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1038 # define linkat rpl_linkat
1040 _GL_FUNCDECL_RPL (linkat, int,
1041 (int fd1, const char *path1, int fd2, const char *path2,
1043 _GL_ARG_NONNULL ((2, 4)));
1044 _GL_CXXALIAS_RPL (linkat, int,
1045 (int fd1, const char *path1, int fd2, const char *path2,
1049 _GL_FUNCDECL_SYS (linkat, int,
1050 (int fd1, const char *path1, int fd2, const char *path2,
1052 _GL_ARG_NONNULL ((2, 4)));
1054 _GL_CXXALIAS_SYS (linkat, int,
1055 (int fd1, const char *path1, int fd2, const char *path2,
1058 _GL_CXXALIASWARN (linkat);
1059 #elif defined GNULIB_POSIXCHECK
1061 # if HAVE_RAW_DECL_LINKAT
1062 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1063 "use gnulib module linkat for portability");
1069 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
1070 Return the new offset if successful, otherwise -1 and errno set.
1071 See the POSIX:2008 specification
1072 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
1073 # if @REPLACE_LSEEK@
1074 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1075 # define lseek rpl_lseek
1077 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1078 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1080 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1082 _GL_CXXALIASWARN (lseek);
1083 #elif defined GNULIB_POSIXCHECK
1085 # if HAVE_RAW_DECL_LSEEK
1086 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1087 "systems - use gnulib module lseek for portability");
1093 /* Create a pipe, defaulting to O_BINARY mode.
1094 Store the read-end as fd[0] and the write-end as fd[1].
1095 Return 0 upon success, or -1 with errno set upon failure. */
1097 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
1099 _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1100 _GL_CXXALIASWARN (pipe);
1101 #elif defined GNULIB_POSIXCHECK
1103 # if HAVE_RAW_DECL_PIPE
1104 _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1105 "use gnulib module pipe-posix for portability");
1111 /* Create a pipe, applying the given flags when opening the read-end of the
1112 pipe and the write-end of the pipe.
1113 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1114 and O_TEXT, O_BINARY (defined in "binary-io.h").
1115 Store the read-end as fd[0] and the write-end as fd[1].
1116 Return 0 upon success, or -1 with errno set upon failure.
1117 See also the Linux man page at
1118 <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
1120 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1121 # define pipe2 rpl_pipe2
1123 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1124 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1126 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1127 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1129 _GL_CXXALIASWARN (pipe2);
1130 #elif defined GNULIB_POSIXCHECK
1132 # if HAVE_RAW_DECL_PIPE2
1133 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1134 "use gnulib module pipe2 for portability");
1140 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1141 Return the number of bytes placed into BUF if successful, otherwise
1142 set errno and return -1. 0 indicates EOF.
1143 See the POSIX:2008 specification
1144 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
1145 # if @REPLACE_PREAD@
1146 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1148 # define pread rpl_pread
1150 _GL_FUNCDECL_RPL (pread, ssize_t,
1151 (int fd, void *buf, size_t bufsize, off_t offset)
1152 _GL_ARG_NONNULL ((2)));
1153 _GL_CXXALIAS_RPL (pread, ssize_t,
1154 (int fd, void *buf, size_t bufsize, off_t offset));
1157 _GL_FUNCDECL_SYS (pread, ssize_t,
1158 (int fd, void *buf, size_t bufsize, off_t offset)
1159 _GL_ARG_NONNULL ((2)));
1161 _GL_CXXALIAS_SYS (pread, ssize_t,
1162 (int fd, void *buf, size_t bufsize, off_t offset));
1164 _GL_CXXALIASWARN (pread);
1165 #elif defined GNULIB_POSIXCHECK
1167 # if HAVE_RAW_DECL_PREAD
1168 _GL_WARN_ON_USE (pread, "pread is unportable - "
1169 "use gnulib module pread for portability");
1175 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1176 Return the number of bytes written if successful, otherwise
1177 set errno and return -1. 0 indicates nothing written. See the
1178 POSIX:2008 specification
1179 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
1180 # if @REPLACE_PWRITE@
1181 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1183 # define pwrite rpl_pwrite
1185 _GL_FUNCDECL_RPL (pwrite, ssize_t,
1186 (int fd, const void *buf, size_t bufsize, off_t offset)
1187 _GL_ARG_NONNULL ((2)));
1188 _GL_CXXALIAS_RPL (pwrite, ssize_t,
1189 (int fd, const void *buf, size_t bufsize, off_t offset));
1192 _GL_FUNCDECL_SYS (pwrite, ssize_t,
1193 (int fd, const void *buf, size_t bufsize, off_t offset)
1194 _GL_ARG_NONNULL ((2)));
1196 _GL_CXXALIAS_SYS (pwrite, ssize_t,
1197 (int fd, const void *buf, size_t bufsize, off_t offset));
1199 _GL_CXXALIASWARN (pwrite);
1200 #elif defined GNULIB_POSIXCHECK
1202 # if HAVE_RAW_DECL_PWRITE
1203 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1204 "use gnulib module pwrite for portability");
1210 /* Read up to COUNT bytes from file descriptor FD into the buffer starting
1211 at BUF. See the POSIX:2008 specification
1212 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
1214 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1216 # define read rpl_read
1218 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1219 _GL_ARG_NONNULL ((2)));
1220 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1222 /* Need to cast, because on mingw, the third parameter is
1224 and the return type is 'int'. */
1225 _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
1227 _GL_CXXALIASWARN (read);
1231 #if @GNULIB_READLINK@
1232 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
1233 bytes of it into BUF. Return the number of bytes placed into BUF if
1234 successful, otherwise -1 and errno set.
1235 See the POSIX:2008 specification
1236 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
1237 # if @REPLACE_READLINK@
1238 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1239 # define readlink rpl_readlink
1241 _GL_FUNCDECL_RPL (readlink, ssize_t,
1242 (const char *file, char *buf, size_t bufsize)
1243 _GL_ARG_NONNULL ((1, 2)));
1244 _GL_CXXALIAS_RPL (readlink, ssize_t,
1245 (const char *file, char *buf, size_t bufsize));
1247 # if !@HAVE_READLINK@
1248 _GL_FUNCDECL_SYS (readlink, ssize_t,
1249 (const char *file, char *buf, size_t bufsize)
1250 _GL_ARG_NONNULL ((1, 2)));
1252 _GL_CXXALIAS_SYS (readlink, ssize_t,
1253 (const char *file, char *buf, size_t bufsize));
1255 _GL_CXXALIASWARN (readlink);
1256 #elif defined GNULIB_POSIXCHECK
1258 # if HAVE_RAW_DECL_READLINK
1259 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1260 "use gnulib module readlink for portability");
1265 #if @GNULIB_READLINKAT@
1266 # if !@HAVE_READLINKAT@
1267 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
1268 (int fd, char const *file, char *buf, size_t len)
1269 _GL_ARG_NONNULL ((2, 3)));
1271 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
1272 (int fd, char const *file, char *buf, size_t len));
1273 _GL_CXXALIASWARN (readlinkat);
1274 #elif defined GNULIB_POSIXCHECK
1276 # if HAVE_RAW_DECL_READLINKAT
1277 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1278 "use gnulib module readlinkat for portability");
1284 /* Remove the directory DIR. */
1285 # if @REPLACE_RMDIR@
1286 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1287 # define rmdir rpl_rmdir
1289 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1290 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1292 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1294 _GL_CXXALIASWARN (rmdir);
1295 #elif defined GNULIB_POSIXCHECK
1297 # if HAVE_RAW_DECL_RMDIR
1298 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1299 "use gnulib module rmdir for portability");
1304 #if @GNULIB_SETHOSTNAME@
1305 /* Set the host name of the machine.
1306 The host name may or may not be fully qualified.
1308 Put LEN bytes of NAME into the host name.
1309 Return 0 if successful, otherwise, set errno and return -1.
1311 Platforms with no ability to set the hostname return -1 and set
1313 # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
1314 _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
1315 _GL_ARG_NONNULL ((1)));
1317 /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
1318 and FreeBSD 6.4 the second parameter is int. On Solaris 11
1319 2011-10, the first parameter is not const. */
1320 _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
1321 _GL_CXXALIASWARN (sethostname);
1322 #elif defined GNULIB_POSIXCHECK
1324 # if HAVE_RAW_DECL_SETHOSTNAME
1325 _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
1326 "use gnulib module sethostname for portability");
1332 /* Pause the execution of the current thread for N seconds.
1333 Returns the number of seconds left to sleep.
1334 See the POSIX:2008 specification
1335 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
1336 # if @REPLACE_SLEEP@
1337 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1339 # define sleep rpl_sleep
1341 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1342 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1345 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1347 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1349 _GL_CXXALIASWARN (sleep);
1350 #elif defined GNULIB_POSIXCHECK
1352 # if HAVE_RAW_DECL_SLEEP
1353 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
1354 "use gnulib module sleep for portability");
1359 #if @GNULIB_SYMLINK@
1360 # if @REPLACE_SYMLINK@
1361 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1363 # define symlink rpl_symlink
1365 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1366 _GL_ARG_NONNULL ((1, 2)));
1367 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1369 # if !@HAVE_SYMLINK@
1370 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1371 _GL_ARG_NONNULL ((1, 2)));
1373 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1375 _GL_CXXALIASWARN (symlink);
1376 #elif defined GNULIB_POSIXCHECK
1378 # if HAVE_RAW_DECL_SYMLINK
1379 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
1380 "use gnulib module symlink for portability");
1385 #if @GNULIB_SYMLINKAT@
1386 # if !@HAVE_SYMLINKAT@
1387 _GL_FUNCDECL_SYS (symlinkat, int,
1388 (char const *contents, int fd, char const *file)
1389 _GL_ARG_NONNULL ((1, 3)));
1391 _GL_CXXALIAS_SYS (symlinkat, int,
1392 (char const *contents, int fd, char const *file));
1393 _GL_CXXALIASWARN (symlinkat);
1394 #elif defined GNULIB_POSIXCHECK
1396 # if HAVE_RAW_DECL_SYMLINKAT
1397 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1398 "use gnulib module symlinkat for portability");
1403 #if @GNULIB_TTYNAME_R@
1404 /* Store at most BUFLEN characters of the pathname of the terminal FD is
1405 open on in BUF. Return 0 on success, otherwise an error number. */
1406 # if @REPLACE_TTYNAME_R@
1407 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1409 # define ttyname_r rpl_ttyname_r
1411 _GL_FUNCDECL_RPL (ttyname_r, int,
1412 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1413 _GL_CXXALIAS_RPL (ttyname_r, int,
1414 (int fd, char *buf, size_t buflen));
1416 # if !@HAVE_DECL_TTYNAME_R@
1417 _GL_FUNCDECL_SYS (ttyname_r, int,
1418 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1420 _GL_CXXALIAS_SYS (ttyname_r, int,
1421 (int fd, char *buf, size_t buflen));
1423 _GL_CXXALIASWARN (ttyname_r);
1424 #elif defined GNULIB_POSIXCHECK
1426 # if HAVE_RAW_DECL_TTYNAME_R
1427 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1428 "use gnulib module ttyname_r for portability");
1434 # if @REPLACE_UNLINK@
1435 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1437 # define unlink rpl_unlink
1439 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1440 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
1442 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
1444 _GL_CXXALIASWARN (unlink);
1445 #elif defined GNULIB_POSIXCHECK
1447 # if HAVE_RAW_DECL_UNLINK
1448 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
1449 "use gnulib module unlink for portability");
1454 #if @GNULIB_UNLINKAT@
1455 # if @REPLACE_UNLINKAT@
1456 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1458 # define unlinkat rpl_unlinkat
1460 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1461 _GL_ARG_NONNULL ((2)));
1462 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1464 # if !@HAVE_UNLINKAT@
1465 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1466 _GL_ARG_NONNULL ((2)));
1468 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1470 _GL_CXXALIASWARN (unlinkat);
1471 #elif defined GNULIB_POSIXCHECK
1473 # if HAVE_RAW_DECL_UNLINKAT
1474 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1475 "use gnulib module openat for portability");
1481 /* Pause the execution of the current thread for N microseconds.
1482 Returns 0 on completion, or -1 on range error.
1483 See the POSIX:2001 specification
1484 <http://www.opengroup.org/susv3xsh/usleep.html>. */
1485 # if @REPLACE_USLEEP@
1486 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1488 # define usleep rpl_usleep
1490 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1491 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1494 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1496 _GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
1498 _GL_CXXALIASWARN (usleep);
1499 #elif defined GNULIB_POSIXCHECK
1501 # if HAVE_RAW_DECL_USLEEP
1502 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1503 "use gnulib module usleep for portability");
1509 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
1510 See the POSIX:2008 specification
1511 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
1512 # if @REPLACE_WRITE@
1513 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1515 # define write rpl_write
1517 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1518 _GL_ARG_NONNULL ((2)));
1519 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1521 /* Need to cast, because on mingw, the third parameter is
1523 and the return type is 'int'. */
1524 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1526 _GL_CXXALIASWARN (write);
1529 _GL_INLINE_HEADER_END
1531 #endif /* _@GUARD_PREFIX@_UNISTD_H */
1532 #endif /* _@GUARD_PREFIX@_UNISTD_H */