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-2014 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 #ifdef _GL_INCLUDING_UNISTD_H
27 /* Special invocation convention:
28 - On Mac OS X 10.3.9 we have a sequence of nested includes
29 <unistd.h> -> <signal.h> -> <pthread.h> -> <unistd.h>
30 In this situation, the functions are not yet declared, therefore we cannot
31 provide the C++ aliases. */
33 #@INCLUDE_NEXT@ @NEXT_UNISTD_H@
36 /* Normal invocation convention. */
38 /* The include_next requires a split double-inclusion guard. */
40 # define _GL_INCLUDING_UNISTD_H
41 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
42 # undef _GL_INCLUDING_UNISTD_H
45 /* Get all possible declarations of gethostname(). */
46 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
47 && !defined _GL_INCLUDING_WINSOCK2_H
48 # define _GL_INCLUDING_WINSOCK2_H
49 # include <winsock2.h>
50 # undef _GL_INCLUDING_WINSOCK2_H
53 #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
54 #define _@GUARD_PREFIX@_UNISTD_H
56 /* NetBSD 5.0 mis-defines NULL. Also get size_t. */
59 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
60 /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
61 /* But avoid namespace pollution on glibc systems. */
62 #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
63 || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
64 && defined __CYGWIN__)) \
65 && ! defined __GLIBC__
69 /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
70 /* But avoid namespace pollution on glibc systems. */
71 #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
72 && ! defined __GLIBC__
76 /* mingw fails to declare _exit in <unistd.h>. */
77 /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
79 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
80 /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
82 /* But avoid namespace pollution on glibc systems. */
83 #if !defined __GLIBC__ && !defined __osf__
84 # define __need_system_stdlib_h
86 # undef __need_system_stdlib_h
89 /* Native Windows platforms declare chdir, getcwd, rmdir in
90 <io.h> and/or <direct.h>, not in <unistd.h>.
91 They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
92 lseek(), read(), unlink(), write() in <io.h>. */
93 #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
94 || defined GNULIB_POSIXCHECK) \
95 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
96 # include <io.h> /* mingw32, mingw64 */
97 # include <direct.h> /* mingw64, MSVC 9 */
98 #elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
99 || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
100 || defined GNULIB_POSIXCHECK) \
101 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
105 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
106 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
107 /* But avoid namespace pollution on glibc systems. */
108 #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
109 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
110 && !defined __GLIBC__
114 /* MSVC defines off_t in <sys/types.h>.
115 May also define off_t to a 64-bit type on native Windows. */
116 #if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
118 # include <sys/types.h>
121 #if (@GNULIB_READ@ || @GNULIB_WRITE@ \
122 || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
123 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
125 # include <sys/types.h>
128 /* Get getopt(), optarg, optind, opterr, optopt.
129 But avoid namespace pollution on glibc systems. */
130 #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
131 # define __need_getopt
135 #ifndef _GL_INLINE_HEADER_BEGIN
136 #error "Please include config.h first."
138 _GL_INLINE_HEADER_BEGIN
139 #ifndef _GL_UNISTD_INLINE
140 # define _GL_UNISTD_INLINE _GL_INLINE
143 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
145 /* The definition of _GL_ARG_NONNULL is copied here. */
147 /* The definition of _GL_WARN_ON_USE is copied here. */
150 /* Hide some function declarations from <winsock2.h>. */
152 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
153 # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
154 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
156 # define socket socket_used_without_including_sys_socket_h
158 # define connect connect_used_without_including_sys_socket_h
160 # define accept accept_used_without_including_sys_socket_h
162 # define bind bind_used_without_including_sys_socket_h
164 # define getpeername getpeername_used_without_including_sys_socket_h
166 # define getsockname getsockname_used_without_including_sys_socket_h
168 # define getsockopt getsockopt_used_without_including_sys_socket_h
170 # define listen listen_used_without_including_sys_socket_h
172 # define recv recv_used_without_including_sys_socket_h
174 # define send send_used_without_including_sys_socket_h
176 # define recvfrom recvfrom_used_without_including_sys_socket_h
178 # define sendto sendto_used_without_including_sys_socket_h
180 # define setsockopt setsockopt_used_without_including_sys_socket_h
182 # define shutdown shutdown_used_without_including_sys_socket_h
184 _GL_WARN_ON_USE (socket,
185 "socket() used without including <sys/socket.h>");
186 _GL_WARN_ON_USE (connect,
187 "connect() used without including <sys/socket.h>");
188 _GL_WARN_ON_USE (accept,
189 "accept() used without including <sys/socket.h>");
190 _GL_WARN_ON_USE (bind,
191 "bind() used without including <sys/socket.h>");
192 _GL_WARN_ON_USE (getpeername,
193 "getpeername() used without including <sys/socket.h>");
194 _GL_WARN_ON_USE (getsockname,
195 "getsockname() used without including <sys/socket.h>");
196 _GL_WARN_ON_USE (getsockopt,
197 "getsockopt() used without including <sys/socket.h>");
198 _GL_WARN_ON_USE (listen,
199 "listen() used without including <sys/socket.h>");
200 _GL_WARN_ON_USE (recv,
201 "recv() used without including <sys/socket.h>");
202 _GL_WARN_ON_USE (send,
203 "send() used without including <sys/socket.h>");
204 _GL_WARN_ON_USE (recvfrom,
205 "recvfrom() used without including <sys/socket.h>");
206 _GL_WARN_ON_USE (sendto,
207 "sendto() used without including <sys/socket.h>");
208 _GL_WARN_ON_USE (setsockopt,
209 "setsockopt() used without including <sys/socket.h>");
210 _GL_WARN_ON_USE (shutdown,
211 "shutdown() used without including <sys/socket.h>");
214 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
215 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
217 # define select select_used_without_including_sys_select_h
219 _GL_WARN_ON_USE (select,
220 "select() used without including <sys/select.h>");
226 /* OS/2 EMX lacks these macros. */
228 # define STDIN_FILENO 0
230 #ifndef STDOUT_FILENO
231 # define STDOUT_FILENO 1
233 #ifndef STDERR_FILENO
234 # define STDERR_FILENO 2
237 /* Ensure *_OK macros exist. */
246 /* Declare overridden functions. */
249 #if defined GNULIB_POSIXCHECK
250 /* The access() function is a security risk. */
251 _GL_WARN_ON_USE (access, "the access function is a security risk - "
252 "use the gnulib module faccessat instead");
257 _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
258 _GL_CXXALIASWARN (chdir);
259 #elif defined GNULIB_POSIXCHECK
261 # if HAVE_RAW_DECL_CHDIR
262 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
263 "use gnulib module chdir for portability");
269 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
270 to GID (if GID is not -1). Follow symbolic links.
271 Return 0 if successful, otherwise -1 and errno set.
272 See the POSIX:2008 specification
273 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
275 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
277 # define chown rpl_chown
279 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
280 _GL_ARG_NONNULL ((1)));
281 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
284 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
285 _GL_ARG_NONNULL ((1)));
287 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
289 _GL_CXXALIASWARN (chown);
290 #elif defined GNULIB_POSIXCHECK
292 # if HAVE_RAW_DECL_CHOWN
293 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
294 "doesn't treat a uid or gid of -1 on some systems - "
295 "use gnulib module chown for portability");
302 /* Automatically included by modules that need a replacement for close. */
303 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
305 # define close rpl_close
307 _GL_FUNCDECL_RPL (close, int, (int fd));
308 _GL_CXXALIAS_RPL (close, int, (int fd));
310 _GL_CXXALIAS_SYS (close, int, (int fd));
312 _GL_CXXALIASWARN (close);
313 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
315 # define close close_used_without_requesting_gnulib_module_close
316 #elif defined GNULIB_POSIXCHECK
318 /* Assume close is always declared. */
319 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
320 "use gnulib module close for portability");
326 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
329 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
330 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
332 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
334 _GL_CXXALIASWARN (dup);
335 #elif defined GNULIB_POSIXCHECK
337 # if HAVE_RAW_DECL_DUP
338 _GL_WARN_ON_USE (dup, "dup is unportable - "
339 "use gnulib module dup for portability");
345 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
346 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
347 Return newfd if successful, otherwise -1 and errno set.
348 See the POSIX:2008 specification
349 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
351 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
352 # define dup2 rpl_dup2
354 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
355 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
358 _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
360 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
362 _GL_CXXALIASWARN (dup2);
363 #elif defined GNULIB_POSIXCHECK
365 # if HAVE_RAW_DECL_DUP2
366 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
367 "use gnulib module dup2 for portability");
373 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
375 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
376 and O_TEXT, O_BINARY (defined in "binary-io.h").
377 Close NEWFD first if it is open.
378 Return newfd if successful, otherwise -1 and errno set.
379 See the Linux man page at
380 <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
382 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
383 # define dup3 rpl_dup3
385 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
386 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
388 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
389 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
391 _GL_CXXALIASWARN (dup3);
392 #elif defined GNULIB_POSIXCHECK
394 # if HAVE_RAW_DECL_DUP3
395 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
396 "use gnulib module dup3 for portability");
402 # if !@HAVE_DECL_ENVIRON@
403 /* Set of environment variables and values. An array of strings of the form
404 "VARIABLE=VALUE", terminated with a NULL. */
405 # if defined __APPLE__ && defined __MACH__
406 # include <crt_externs.h>
407 # define environ (*_NSGetEnviron ())
412 extern char **environ;
418 #elif defined GNULIB_POSIXCHECK
419 # if HAVE_RAW_DECL_ENVIRON
420 _GL_UNISTD_INLINE char ***
425 _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
426 "use gnulib module environ for portability");
428 # define environ (*rpl_environ ())
433 #if @GNULIB_EUIDACCESS@
434 /* Like access(), except that it uses the effective user id and group id of
435 the current process. */
436 # if !@HAVE_EUIDACCESS@
437 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
438 _GL_ARG_NONNULL ((1)));
440 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
441 _GL_CXXALIASWARN (euidaccess);
442 # if defined GNULIB_POSIXCHECK
443 /* Like access(), this function is a security risk. */
444 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
445 "use the gnulib module faccessat instead");
447 #elif defined GNULIB_POSIXCHECK
449 # if HAVE_RAW_DECL_EUIDACCESS
450 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
451 "use gnulib module euidaccess for portability");
456 #if @GNULIB_FACCESSAT@
457 # if !@HAVE_FACCESSAT@
458 _GL_FUNCDECL_SYS (faccessat, int,
459 (int fd, char const *file, int mode, int flag)
460 _GL_ARG_NONNULL ((2)));
462 _GL_CXXALIAS_SYS (faccessat, int,
463 (int fd, char const *file, int mode, int flag));
464 _GL_CXXALIASWARN (faccessat);
465 #elif defined GNULIB_POSIXCHECK
467 # if HAVE_RAW_DECL_FACCESSAT
468 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
469 "use gnulib module faccessat for portability");
475 /* Change the process' current working directory to the directory on which
476 the given file descriptor is open.
477 Return 0 if successful, otherwise -1 and errno set.
478 See the POSIX:2008 specification
479 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
481 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
483 /* Gnulib internal hooks needed to maintain the fchdir metadata. */
484 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
485 _GL_ARG_NONNULL ((2));
486 _GL_EXTERN_C void _gl_unregister_fd (int fd);
487 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
488 _GL_EXTERN_C const char *_gl_directory_name (int fd);
491 # if !@HAVE_DECL_FCHDIR@
492 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
495 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
496 _GL_CXXALIASWARN (fchdir);
497 #elif defined GNULIB_POSIXCHECK
499 # if HAVE_RAW_DECL_FCHDIR
500 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
501 "use gnulib module fchdir for portability");
506 #if @GNULIB_FCHOWNAT@
507 # if @REPLACE_FCHOWNAT@
508 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
510 # define fchownat rpl_fchownat
512 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
513 uid_t owner, gid_t group, int flag)
514 _GL_ARG_NONNULL ((2)));
515 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
516 uid_t owner, gid_t group, int flag));
518 # if !@HAVE_FCHOWNAT@
519 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
520 uid_t owner, gid_t group, int flag)
521 _GL_ARG_NONNULL ((2)));
523 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
524 uid_t owner, gid_t group, int flag));
526 _GL_CXXALIASWARN (fchownat);
527 #elif defined GNULIB_POSIXCHECK
529 # if HAVE_RAW_DECL_FCHOWNAT
530 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
531 "use gnulib module openat for portability");
536 #if @GNULIB_FDATASYNC@
537 /* Synchronize changes to a file.
538 Return 0 if successful, otherwise -1 and errno set.
539 See POSIX:2008 specification
540 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
541 # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
542 _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
544 _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
545 _GL_CXXALIASWARN (fdatasync);
546 #elif defined GNULIB_POSIXCHECK
548 # if HAVE_RAW_DECL_FDATASYNC
549 _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
550 "use gnulib module fdatasync for portability");
556 /* Synchronize changes, including metadata, to a file.
557 Return 0 if successful, otherwise -1 and errno set.
558 See POSIX:2008 specification
559 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
561 _GL_FUNCDECL_SYS (fsync, int, (int fd));
563 _GL_CXXALIAS_SYS (fsync, int, (int fd));
564 _GL_CXXALIASWARN (fsync);
565 #elif defined GNULIB_POSIXCHECK
567 # if HAVE_RAW_DECL_FSYNC
568 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
569 "use gnulib module fsync for portability");
574 #if @GNULIB_FTRUNCATE@
575 /* Change the size of the file to which FD is opened to become equal to LENGTH.
576 Return 0 if successful, otherwise -1 and errno set.
577 See the POSIX:2008 specification
578 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
579 # if @REPLACE_FTRUNCATE@
580 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
582 # define ftruncate rpl_ftruncate
584 _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
585 _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
587 # if !@HAVE_FTRUNCATE@
588 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
590 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
592 _GL_CXXALIASWARN (ftruncate);
593 #elif defined GNULIB_POSIXCHECK
595 # if HAVE_RAW_DECL_FTRUNCATE
596 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
597 "use gnulib module ftruncate for portability");
603 /* Get the name of the current working directory, and put it in SIZE bytes
605 Return BUF if successful, or NULL if the directory couldn't be determined
606 or SIZE was too small.
607 See the POSIX:2008 specification
608 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
609 Additionally, the gnulib module 'getcwd' guarantees the following GNU
610 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
611 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
613 # if @REPLACE_GETCWD@
614 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
615 # define getcwd rpl_getcwd
617 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
618 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
620 /* Need to cast, because on mingw, the second parameter is
622 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
624 _GL_CXXALIASWARN (getcwd);
625 #elif defined GNULIB_POSIXCHECK
627 # if HAVE_RAW_DECL_GETCWD
628 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
629 "use gnulib module getcwd for portability");
634 #if @GNULIB_GETDOMAINNAME@
635 /* Return the NIS domain name of the machine.
636 WARNING! The NIS domain name is unrelated to the fully qualified host name
637 of the machine. It is also unrelated to email addresses.
638 WARNING! The NIS domain name is usually the empty string or "(none)" when
641 Put up to LEN bytes of the NIS domain name into NAME.
642 Null terminate it if the name is shorter than LEN.
643 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
644 Return 0 if successful, otherwise set errno and return -1. */
645 # if @REPLACE_GETDOMAINNAME@
646 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
647 # undef getdomainname
648 # define getdomainname rpl_getdomainname
650 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
651 _GL_ARG_NONNULL ((1)));
652 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
654 # if !@HAVE_DECL_GETDOMAINNAME@
655 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
656 _GL_ARG_NONNULL ((1)));
658 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
660 _GL_CXXALIASWARN (getdomainname);
661 #elif defined GNULIB_POSIXCHECK
662 # undef getdomainname
663 # if HAVE_RAW_DECL_GETDOMAINNAME
664 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
665 "use gnulib module getdomainname for portability");
670 #if @GNULIB_GETDTABLESIZE@
671 /* Return the maximum number of file descriptors in the current process.
672 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
673 # if @REPLACE_GETDTABLESIZE@
674 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
675 # undef getdtablesize
676 # define getdtablesize rpl_getdtablesize
678 _GL_FUNCDECL_RPL (getdtablesize, int, (void));
679 _GL_CXXALIAS_RPL (getdtablesize, int, (void));
681 # if !@HAVE_GETDTABLESIZE@
682 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
684 _GL_CXXALIAS_SYS (getdtablesize, int, (void));
686 _GL_CXXALIASWARN (getdtablesize);
687 #elif defined GNULIB_POSIXCHECK
688 # undef getdtablesize
689 # if HAVE_RAW_DECL_GETDTABLESIZE
690 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
691 "use gnulib module getdtablesize for portability");
696 #if @GNULIB_GETGROUPS@
697 /* Return the supplemental groups that the current process belongs to.
698 It is unspecified whether the effective group id is in the list.
699 If N is 0, return the group count; otherwise, N describes how many
700 entries are available in GROUPS. Return -1 and set errno if N is
701 not 0 and not large enough. Fails with ENOSYS on some systems. */
702 # if @REPLACE_GETGROUPS@
703 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
705 # define getgroups rpl_getgroups
707 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
708 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
710 # if !@HAVE_GETGROUPS@
711 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
713 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
715 _GL_CXXALIASWARN (getgroups);
716 #elif defined GNULIB_POSIXCHECK
718 # if HAVE_RAW_DECL_GETGROUPS
719 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
720 "use gnulib module getgroups for portability");
725 #if @GNULIB_GETHOSTNAME@
726 /* Return the standard host name of the machine.
727 WARNING! The host name may or may not be fully qualified.
729 Put up to LEN bytes of the host name into NAME.
730 Null terminate it if the name is shorter than LEN.
731 If the host name is longer than LEN, set errno = EINVAL and return -1.
732 Return 0 if successful, otherwise set errno and return -1. */
733 # if @UNISTD_H_HAVE_WINSOCK2_H@
734 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
736 # define gethostname rpl_gethostname
738 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
739 _GL_ARG_NONNULL ((1)));
740 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
742 # if !@HAVE_GETHOSTNAME@
743 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
744 _GL_ARG_NONNULL ((1)));
746 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
749 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
751 _GL_CXXALIASWARN (gethostname);
752 #elif @UNISTD_H_HAVE_WINSOCK2_H@
754 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
755 #elif defined GNULIB_POSIXCHECK
757 # if HAVE_RAW_DECL_GETHOSTNAME
758 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
759 "use gnulib module gethostname for portability");
764 #if @GNULIB_GETLOGIN@
765 /* Returns the user's login name, or NULL if it cannot be found. Upon error,
766 returns NULL with errno set.
768 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
770 Most programs don't need to use this function, because the information is
771 available through environment variables:
772 ${LOGNAME-$USER} on Unix platforms,
773 $USERNAME on native Windows platforms.
775 # if !@HAVE_GETLOGIN@
776 _GL_FUNCDECL_SYS (getlogin, char *, (void));
778 _GL_CXXALIAS_SYS (getlogin, char *, (void));
779 _GL_CXXALIASWARN (getlogin);
780 #elif defined GNULIB_POSIXCHECK
782 # if HAVE_RAW_DECL_GETLOGIN
783 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
784 "use gnulib module getlogin for portability");
789 #if @GNULIB_GETLOGIN_R@
790 /* Copies the user's login name to NAME.
791 The array pointed to by NAME has room for SIZE bytes.
793 Returns 0 if successful. Upon error, an error number is returned, or -1 in
794 the case that the login name cannot be found but no specific error is
795 provided (this case is hopefully rare but is left open by the POSIX spec).
797 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
799 Most programs don't need to use this function, because the information is
800 available through environment variables:
801 ${LOGNAME-$USER} on Unix platforms,
802 $USERNAME on native Windows platforms.
804 # if @REPLACE_GETLOGIN_R@
805 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
806 # define getlogin_r rpl_getlogin_r
808 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
809 _GL_ARG_NONNULL ((1)));
810 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
812 # if !@HAVE_DECL_GETLOGIN_R@
813 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
814 _GL_ARG_NONNULL ((1)));
816 /* Need to cast, because on Solaris 10 systems, the second argument is
818 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
820 _GL_CXXALIASWARN (getlogin_r);
821 #elif defined GNULIB_POSIXCHECK
823 # if HAVE_RAW_DECL_GETLOGIN_R
824 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
825 "use gnulib module getlogin_r for portability");
830 #if @GNULIB_GETPAGESIZE@
831 # if @REPLACE_GETPAGESIZE@
832 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
833 # define getpagesize rpl_getpagesize
835 _GL_FUNCDECL_RPL (getpagesize, int, (void));
836 _GL_CXXALIAS_RPL (getpagesize, int, (void));
838 # if !@HAVE_GETPAGESIZE@
839 # if !defined getpagesize
840 /* This is for POSIX systems. */
841 # if !defined _gl_getpagesize && defined _SC_PAGESIZE
842 # if ! (defined __VMS && __VMS_VER < 70000000)
843 # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
846 /* This is for older VMS. */
847 # if !defined _gl_getpagesize && defined __VMS
849 # define _gl_getpagesize() 8192
851 # define _gl_getpagesize() 512
854 /* This is for BeOS. */
855 # if !defined _gl_getpagesize && @HAVE_OS_H@
857 # if defined B_PAGE_SIZE
858 # define _gl_getpagesize() B_PAGE_SIZE
861 /* This is for AmigaOS4.0. */
862 # if !defined _gl_getpagesize && defined __amigaos4__
863 # define _gl_getpagesize() 2048
865 /* This is for older Unix systems. */
866 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
867 # include <sys/param.h>
868 # ifdef EXEC_PAGESIZE
869 # define _gl_getpagesize() EXEC_PAGESIZE
875 # define _gl_getpagesize() (NBPG * CLSIZE)
878 # define _gl_getpagesize() NBPC
883 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
884 # define getpagesize() _gl_getpagesize ()
886 # if !GNULIB_defined_getpagesize_function
887 _GL_UNISTD_INLINE int
890 return _gl_getpagesize ();
892 # define GNULIB_defined_getpagesize_function 1
897 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
898 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
900 # if @HAVE_DECL_GETPAGESIZE@
901 _GL_CXXALIASWARN (getpagesize);
903 #elif defined GNULIB_POSIXCHECK
905 # if HAVE_RAW_DECL_GETPAGESIZE
906 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
907 "use gnulib module getpagesize for portability");
912 #if @GNULIB_GETUSERSHELL@
913 /* Return the next valid login shell on the system, or NULL when the end of
914 the list has been reached. */
915 # if !@HAVE_DECL_GETUSERSHELL@
916 _GL_FUNCDECL_SYS (getusershell, char *, (void));
918 _GL_CXXALIAS_SYS (getusershell, char *, (void));
919 _GL_CXXALIASWARN (getusershell);
920 #elif defined GNULIB_POSIXCHECK
922 # if HAVE_RAW_DECL_GETUSERSHELL
923 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
924 "use gnulib module getusershell for portability");
928 #if @GNULIB_GETUSERSHELL@
929 /* Rewind to pointer that is advanced at each getusershell() call. */
930 # if !@HAVE_DECL_GETUSERSHELL@
931 _GL_FUNCDECL_SYS (setusershell, void, (void));
933 _GL_CXXALIAS_SYS (setusershell, void, (void));
934 _GL_CXXALIASWARN (setusershell);
935 #elif defined GNULIB_POSIXCHECK
937 # if HAVE_RAW_DECL_SETUSERSHELL
938 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
939 "use gnulib module getusershell for portability");
943 #if @GNULIB_GETUSERSHELL@
944 /* Free the pointer that is advanced at each getusershell() call and
945 associated resources. */
946 # if !@HAVE_DECL_GETUSERSHELL@
947 _GL_FUNCDECL_SYS (endusershell, void, (void));
949 _GL_CXXALIAS_SYS (endusershell, void, (void));
950 _GL_CXXALIASWARN (endusershell);
951 #elif defined GNULIB_POSIXCHECK
953 # if HAVE_RAW_DECL_ENDUSERSHELL
954 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
955 "use gnulib module getusershell for portability");
960 #if @GNULIB_GROUP_MEMBER@
961 /* Determine whether group id is in calling user's group list. */
962 # if !@HAVE_GROUP_MEMBER@
963 _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
965 _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
966 _GL_CXXALIASWARN (group_member);
967 #elif defined GNULIB_POSIXCHECK
969 # if HAVE_RAW_DECL_GROUP_MEMBER
970 _GL_WARN_ON_USE (group_member, "group_member is unportable - "
971 "use gnulib module group-member for portability");
977 # if @REPLACE_ISATTY@
978 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
980 # define isatty rpl_isatty
982 _GL_FUNCDECL_RPL (isatty, int, (int fd));
983 _GL_CXXALIAS_RPL (isatty, int, (int fd));
985 _GL_CXXALIAS_SYS (isatty, int, (int fd));
987 _GL_CXXALIASWARN (isatty);
988 #elif defined GNULIB_POSIXCHECK
990 # if HAVE_RAW_DECL_ISATTY
991 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
992 "use gnulib module isatty for portability");
998 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
999 to GID (if GID is not -1). Do not follow symbolic links.
1000 Return 0 if successful, otherwise -1 and errno set.
1001 See the POSIX:2008 specification
1002 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
1003 # if @REPLACE_LCHOWN@
1004 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1006 # define lchown rpl_lchown
1008 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
1009 _GL_ARG_NONNULL ((1)));
1010 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
1013 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
1014 _GL_ARG_NONNULL ((1)));
1016 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
1018 _GL_CXXALIASWARN (lchown);
1019 #elif defined GNULIB_POSIXCHECK
1021 # if HAVE_RAW_DECL_LCHOWN
1022 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1023 "use gnulib module lchown for portability");
1029 /* Create a new hard link for an existing file.
1030 Return 0 if successful, otherwise -1 and errno set.
1031 See POSIX:2008 specification
1032 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
1034 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1035 # define link rpl_link
1037 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
1038 _GL_ARG_NONNULL ((1, 2)));
1039 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1042 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
1043 _GL_ARG_NONNULL ((1, 2)));
1045 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1047 _GL_CXXALIASWARN (link);
1048 #elif defined GNULIB_POSIXCHECK
1050 # if HAVE_RAW_DECL_LINK
1051 _GL_WARN_ON_USE (link, "link is unportable - "
1052 "use gnulib module link for portability");
1058 /* Create a new hard link for an existing file, relative to two
1059 directories. FLAG controls whether symlinks are followed.
1060 Return 0 if successful, otherwise -1 and errno set. */
1061 # if @REPLACE_LINKAT@
1062 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1064 # define linkat rpl_linkat
1066 _GL_FUNCDECL_RPL (linkat, int,
1067 (int fd1, const char *path1, int fd2, const char *path2,
1069 _GL_ARG_NONNULL ((2, 4)));
1070 _GL_CXXALIAS_RPL (linkat, int,
1071 (int fd1, const char *path1, int fd2, const char *path2,
1075 _GL_FUNCDECL_SYS (linkat, int,
1076 (int fd1, const char *path1, int fd2, const char *path2,
1078 _GL_ARG_NONNULL ((2, 4)));
1080 _GL_CXXALIAS_SYS (linkat, int,
1081 (int fd1, const char *path1, int fd2, const char *path2,
1084 _GL_CXXALIASWARN (linkat);
1085 #elif defined GNULIB_POSIXCHECK
1087 # if HAVE_RAW_DECL_LINKAT
1088 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1089 "use gnulib module linkat for portability");
1095 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
1096 Return the new offset if successful, otherwise -1 and errno set.
1097 See the POSIX:2008 specification
1098 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
1099 # if @REPLACE_LSEEK@
1100 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1101 # define lseek rpl_lseek
1103 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1104 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1106 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1108 _GL_CXXALIASWARN (lseek);
1109 #elif defined GNULIB_POSIXCHECK
1111 # if HAVE_RAW_DECL_LSEEK
1112 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1113 "systems - use gnulib module lseek for portability");
1119 /* Create a pipe, defaulting to O_BINARY mode.
1120 Store the read-end as fd[0] and the write-end as fd[1].
1121 Return 0 upon success, or -1 with errno set upon failure. */
1123 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
1125 _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1126 _GL_CXXALIASWARN (pipe);
1127 #elif defined GNULIB_POSIXCHECK
1129 # if HAVE_RAW_DECL_PIPE
1130 _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1131 "use gnulib module pipe-posix for portability");
1137 /* Create a pipe, applying the given flags when opening the read-end of the
1138 pipe and the write-end of the pipe.
1139 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1140 and O_TEXT, O_BINARY (defined in "binary-io.h").
1141 Store the read-end as fd[0] and the write-end as fd[1].
1142 Return 0 upon success, or -1 with errno set upon failure.
1143 See also the Linux man page at
1144 <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
1146 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1147 # define pipe2 rpl_pipe2
1149 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1150 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1152 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1153 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1155 _GL_CXXALIASWARN (pipe2);
1156 #elif defined GNULIB_POSIXCHECK
1158 # if HAVE_RAW_DECL_PIPE2
1159 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1160 "use gnulib module pipe2 for portability");
1166 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1167 Return the number of bytes placed into BUF if successful, otherwise
1168 set errno and return -1. 0 indicates EOF.
1169 See the POSIX:2008 specification
1170 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
1171 # if @REPLACE_PREAD@
1172 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1174 # define pread rpl_pread
1176 _GL_FUNCDECL_RPL (pread, ssize_t,
1177 (int fd, void *buf, size_t bufsize, off_t offset)
1178 _GL_ARG_NONNULL ((2)));
1179 _GL_CXXALIAS_RPL (pread, ssize_t,
1180 (int fd, void *buf, size_t bufsize, off_t offset));
1183 _GL_FUNCDECL_SYS (pread, ssize_t,
1184 (int fd, void *buf, size_t bufsize, off_t offset)
1185 _GL_ARG_NONNULL ((2)));
1187 _GL_CXXALIAS_SYS (pread, ssize_t,
1188 (int fd, void *buf, size_t bufsize, off_t offset));
1190 _GL_CXXALIASWARN (pread);
1191 #elif defined GNULIB_POSIXCHECK
1193 # if HAVE_RAW_DECL_PREAD
1194 _GL_WARN_ON_USE (pread, "pread is unportable - "
1195 "use gnulib module pread for portability");
1201 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1202 Return the number of bytes written if successful, otherwise
1203 set errno and return -1. 0 indicates nothing written. See the
1204 POSIX:2008 specification
1205 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
1206 # if @REPLACE_PWRITE@
1207 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1209 # define pwrite rpl_pwrite
1211 _GL_FUNCDECL_RPL (pwrite, ssize_t,
1212 (int fd, const void *buf, size_t bufsize, off_t offset)
1213 _GL_ARG_NONNULL ((2)));
1214 _GL_CXXALIAS_RPL (pwrite, ssize_t,
1215 (int fd, const void *buf, size_t bufsize, off_t offset));
1218 _GL_FUNCDECL_SYS (pwrite, ssize_t,
1219 (int fd, const void *buf, size_t bufsize, off_t offset)
1220 _GL_ARG_NONNULL ((2)));
1222 _GL_CXXALIAS_SYS (pwrite, ssize_t,
1223 (int fd, const void *buf, size_t bufsize, off_t offset));
1225 _GL_CXXALIASWARN (pwrite);
1226 #elif defined GNULIB_POSIXCHECK
1228 # if HAVE_RAW_DECL_PWRITE
1229 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1230 "use gnulib module pwrite for portability");
1236 /* Read up to COUNT bytes from file descriptor FD into the buffer starting
1237 at BUF. See the POSIX:2008 specification
1238 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
1240 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1242 # define read rpl_read
1244 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1245 _GL_ARG_NONNULL ((2)));
1246 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1248 /* Need to cast, because on mingw, the third parameter is
1250 and the return type is 'int'. */
1251 _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
1253 _GL_CXXALIASWARN (read);
1257 #if @GNULIB_READLINK@
1258 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
1259 bytes of it into BUF. Return the number of bytes placed into BUF if
1260 successful, otherwise -1 and errno set.
1261 See the POSIX:2008 specification
1262 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
1263 # if @REPLACE_READLINK@
1264 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1265 # define readlink rpl_readlink
1267 _GL_FUNCDECL_RPL (readlink, ssize_t,
1268 (const char *file, char *buf, size_t bufsize)
1269 _GL_ARG_NONNULL ((1, 2)));
1270 _GL_CXXALIAS_RPL (readlink, ssize_t,
1271 (const char *file, char *buf, size_t bufsize));
1273 # if !@HAVE_READLINK@
1274 _GL_FUNCDECL_SYS (readlink, ssize_t,
1275 (const char *file, char *buf, size_t bufsize)
1276 _GL_ARG_NONNULL ((1, 2)));
1278 _GL_CXXALIAS_SYS (readlink, ssize_t,
1279 (const char *file, char *buf, size_t bufsize));
1281 _GL_CXXALIASWARN (readlink);
1282 #elif defined GNULIB_POSIXCHECK
1284 # if HAVE_RAW_DECL_READLINK
1285 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1286 "use gnulib module readlink for portability");
1291 #if @GNULIB_READLINKAT@
1292 # if !@HAVE_READLINKAT@
1293 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
1294 (int fd, char const *file, char *buf, size_t len)
1295 _GL_ARG_NONNULL ((2, 3)));
1297 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
1298 (int fd, char const *file, char *buf, size_t len));
1299 _GL_CXXALIASWARN (readlinkat);
1300 #elif defined GNULIB_POSIXCHECK
1302 # if HAVE_RAW_DECL_READLINKAT
1303 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1304 "use gnulib module readlinkat for portability");
1310 /* Remove the directory DIR. */
1311 # if @REPLACE_RMDIR@
1312 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1313 # define rmdir rpl_rmdir
1315 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1316 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1318 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1320 _GL_CXXALIASWARN (rmdir);
1321 #elif defined GNULIB_POSIXCHECK
1323 # if HAVE_RAW_DECL_RMDIR
1324 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1325 "use gnulib module rmdir for portability");
1330 #if @GNULIB_SETHOSTNAME@
1331 /* Set the host name of the machine.
1332 The host name may or may not be fully qualified.
1334 Put LEN bytes of NAME into the host name.
1335 Return 0 if successful, otherwise, set errno and return -1.
1337 Platforms with no ability to set the hostname return -1 and set
1339 # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
1340 _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
1341 _GL_ARG_NONNULL ((1)));
1343 /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
1344 and FreeBSD 6.4 the second parameter is int. On Solaris 11
1345 2011-10, the first parameter is not const. */
1346 _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
1347 _GL_CXXALIASWARN (sethostname);
1348 #elif defined GNULIB_POSIXCHECK
1350 # if HAVE_RAW_DECL_SETHOSTNAME
1351 _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
1352 "use gnulib module sethostname for portability");
1358 /* Pause the execution of the current thread for N seconds.
1359 Returns the number of seconds left to sleep.
1360 See the POSIX:2008 specification
1361 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
1362 # if @REPLACE_SLEEP@
1363 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1365 # define sleep rpl_sleep
1367 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1368 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1371 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1373 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1375 _GL_CXXALIASWARN (sleep);
1376 #elif defined GNULIB_POSIXCHECK
1378 # if HAVE_RAW_DECL_SLEEP
1379 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
1380 "use gnulib module sleep for portability");
1385 #if @GNULIB_SYMLINK@
1386 # if @REPLACE_SYMLINK@
1387 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1389 # define symlink rpl_symlink
1391 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1392 _GL_ARG_NONNULL ((1, 2)));
1393 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1395 # if !@HAVE_SYMLINK@
1396 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1397 _GL_ARG_NONNULL ((1, 2)));
1399 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1401 _GL_CXXALIASWARN (symlink);
1402 #elif defined GNULIB_POSIXCHECK
1404 # if HAVE_RAW_DECL_SYMLINK
1405 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
1406 "use gnulib module symlink for portability");
1411 #if @GNULIB_SYMLINKAT@
1412 # if !@HAVE_SYMLINKAT@
1413 _GL_FUNCDECL_SYS (symlinkat, int,
1414 (char const *contents, int fd, char const *file)
1415 _GL_ARG_NONNULL ((1, 3)));
1417 _GL_CXXALIAS_SYS (symlinkat, int,
1418 (char const *contents, int fd, char const *file));
1419 _GL_CXXALIASWARN (symlinkat);
1420 #elif defined GNULIB_POSIXCHECK
1422 # if HAVE_RAW_DECL_SYMLINKAT
1423 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1424 "use gnulib module symlinkat for portability");
1429 #if @GNULIB_TTYNAME_R@
1430 /* Store at most BUFLEN characters of the pathname of the terminal FD is
1431 open on in BUF. Return 0 on success, otherwise an error number. */
1432 # if @REPLACE_TTYNAME_R@
1433 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1435 # define ttyname_r rpl_ttyname_r
1437 _GL_FUNCDECL_RPL (ttyname_r, int,
1438 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1439 _GL_CXXALIAS_RPL (ttyname_r, int,
1440 (int fd, char *buf, size_t buflen));
1442 # if !@HAVE_DECL_TTYNAME_R@
1443 _GL_FUNCDECL_SYS (ttyname_r, int,
1444 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1446 _GL_CXXALIAS_SYS (ttyname_r, int,
1447 (int fd, char *buf, size_t buflen));
1449 _GL_CXXALIASWARN (ttyname_r);
1450 #elif defined GNULIB_POSIXCHECK
1452 # if HAVE_RAW_DECL_TTYNAME_R
1453 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1454 "use gnulib module ttyname_r for portability");
1460 # if @REPLACE_UNLINK@
1461 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1463 # define unlink rpl_unlink
1465 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1466 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
1468 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
1470 _GL_CXXALIASWARN (unlink);
1471 #elif defined GNULIB_POSIXCHECK
1473 # if HAVE_RAW_DECL_UNLINK
1474 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
1475 "use gnulib module unlink for portability");
1480 #if @GNULIB_UNLINKAT@
1481 # if @REPLACE_UNLINKAT@
1482 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1484 # define unlinkat rpl_unlinkat
1486 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1487 _GL_ARG_NONNULL ((2)));
1488 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1490 # if !@HAVE_UNLINKAT@
1491 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1492 _GL_ARG_NONNULL ((2)));
1494 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1496 _GL_CXXALIASWARN (unlinkat);
1497 #elif defined GNULIB_POSIXCHECK
1499 # if HAVE_RAW_DECL_UNLINKAT
1500 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1501 "use gnulib module openat for portability");
1507 /* Pause the execution of the current thread for N microseconds.
1508 Returns 0 on completion, or -1 on range error.
1509 See the POSIX:2001 specification
1510 <http://www.opengroup.org/susv3xsh/usleep.html>. */
1511 # if @REPLACE_USLEEP@
1512 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1514 # define usleep rpl_usleep
1516 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1517 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1520 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1522 _GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
1524 _GL_CXXALIASWARN (usleep);
1525 #elif defined GNULIB_POSIXCHECK
1527 # if HAVE_RAW_DECL_USLEEP
1528 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1529 "use gnulib module usleep for portability");
1535 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
1536 See the POSIX:2008 specification
1537 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
1538 # if @REPLACE_WRITE@
1539 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1541 # define write rpl_write
1543 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1544 _GL_ARG_NONNULL ((2)));
1545 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1547 /* Need to cast, because on mingw, the third parameter is
1549 and the return type is 'int'. */
1550 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1552 _GL_CXXALIASWARN (write);
1555 _GL_INLINE_HEADER_END
1557 #endif /* _@GUARD_PREFIX@_UNISTD_H */
1558 #endif /* _GL_INCLUDING_UNISTD_H */
1559 #endif /* _@GUARD_PREFIX@_UNISTD_H */