1 /* Substitute for and wrapper around <unistd.h>.
2 Copyright (C) 2003-2010 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 @PRAGMA_SYSTEM_HEADER@
22 /* Special invocation convention:
23 - On mingw, several headers, including <winsock2.h>, include <unistd.h>,
24 but we need to ensure that both the system <unistd.h> and <winsock2.h>
25 are completely included before we replace gethostname. */
26 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
27 && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H
28 /* <unistd.h> is being indirectly included for the first time from
29 <winsock2.h>; avoid declaring any overrides. */
31 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
33 # error unexpected; report this to bug-gnulib@gnu.org
35 # define _GL_WINSOCK2_H_WITNESS
37 /* Normal invocation. */
38 #elif !defined _GL_UNISTD_H
40 /* The include_next requires a split double-inclusion guard. */
42 # @INCLUDE_NEXT@ @NEXT_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 _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_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 __GLIBC__
68 /* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
69 /* But avoid namespace pollution on glibc systems. */
70 #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__
74 /* mingw fails to declare _exit in <unistd.h>. */
75 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
76 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
77 /* But avoid namespace pollution on glibc systems. */
82 /* mingw declares getcwd in <io.h>, not in <unistd.h>. */
83 #if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
84 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
88 #if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
89 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
91 # include <sys/types.h>
94 /* Get getopt(), optarg, optind, opterr, optopt.
95 But avoid namespace pollution on glibc systems. */
96 /* Also, don't include <getopt.h> inside libgettextpo, because we use
97 the getopt module only in gettext-tools/gnulib-lib/, not in
98 gettext-tools/libgettextpo/, but there is only a single
99 GNULIB_UNISTD_H_GETOPT variable for both. */
100 #if @GNULIB_UNISTD_H_GETOPT@ && !defined GTPO_CONFIG_H && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
104 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
106 /* The definition of _GL_ARG_NONNULL is copied here. */
108 /* The definition of _GL_WARN_ON_USE is copied here. */
111 #if @GNULIB_GETHOSTNAME@
112 /* Get all possible declarations of gethostname(). */
113 # if @UNISTD_H_HAVE_WINSOCK2_H@
114 # if !defined _GL_SYS_SOCKET_H
115 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
117 # define socket socket_used_without_including_sys_socket_h
119 # define connect connect_used_without_including_sys_socket_h
121 # define accept accept_used_without_including_sys_socket_h
123 # define bind bind_used_without_including_sys_socket_h
125 # define getpeername getpeername_used_without_including_sys_socket_h
127 # define getsockname getsockname_used_without_including_sys_socket_h
129 # define getsockopt getsockopt_used_without_including_sys_socket_h
131 # define listen listen_used_without_including_sys_socket_h
133 # define recv recv_used_without_including_sys_socket_h
135 # define send send_used_without_including_sys_socket_h
137 # define recvfrom recvfrom_used_without_including_sys_socket_h
139 # define sendto sendto_used_without_including_sys_socket_h
141 # define setsockopt setsockopt_used_without_including_sys_socket_h
143 # define shutdown shutdown_used_without_including_sys_socket_h
145 _GL_WARN_ON_USE (socket,
146 "socket() used without including <sys/socket.h>");
147 _GL_WARN_ON_USE (connect,
148 "connect() used without including <sys/socket.h>");
149 _GL_WARN_ON_USE (accept,
150 "accept() used without including <sys/socket.h>");
151 _GL_WARN_ON_USE (bind,
152 "bind() used without including <sys/socket.h>");
153 _GL_WARN_ON_USE (getpeername,
154 "getpeername() used without including <sys/socket.h>");
155 _GL_WARN_ON_USE (getsockname,
156 "getsockname() used without including <sys/socket.h>");
157 _GL_WARN_ON_USE (getsockopt,
158 "getsockopt() used without including <sys/socket.h>");
159 _GL_WARN_ON_USE (listen,
160 "listen() used without including <sys/socket.h>");
161 _GL_WARN_ON_USE (recv,
162 "recv() used without including <sys/socket.h>");
163 _GL_WARN_ON_USE (send,
164 "send() used without including <sys/socket.h>");
165 _GL_WARN_ON_USE (recvfrom,
166 "recvfrom() used without including <sys/socket.h>");
167 _GL_WARN_ON_USE (sendto,
168 "sendto() used without including <sys/socket.h>");
169 _GL_WARN_ON_USE (setsockopt,
170 "setsockopt() used without including <sys/socket.h>");
171 _GL_WARN_ON_USE (shutdown,
172 "shutdown() used without including <sys/socket.h>");
175 # if !defined _GL_SYS_SELECT_H
176 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
178 # define select select_used_without_including_sys_select_h
180 _GL_WARN_ON_USE (select,
181 "select() used without including <sys/select.h>");
188 /* OS/2 EMX lacks these macros. */
190 # define STDIN_FILENO 0
192 #ifndef STDOUT_FILENO
193 # define STDOUT_FILENO 1
195 #ifndef STDERR_FILENO
196 # define STDERR_FILENO 2
199 /* Ensure *_OK macros exist. */
208 /* Declare overridden functions. */
211 #if defined GNULIB_POSIXCHECK
212 /* The access() function is a security risk. */
213 _GL_WARN_ON_USE (access, "the access function is a security risk - "
214 "use the gnulib module faccessat instead");
219 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
220 to GID (if GID is not -1). Follow symbolic links.
221 Return 0 if successful, otherwise -1 and errno set.
222 See the POSIX:2001 specification
223 <http://www.opengroup.org/susv3xsh/chown.html>. */
225 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
227 # define chown rpl_chown
229 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
230 _GL_ARG_NONNULL ((1)));
231 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
234 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
235 _GL_ARG_NONNULL ((1)));
237 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
239 _GL_CXXALIASWARN (chown);
240 #elif defined GNULIB_POSIXCHECK
242 # if HAVE_RAW_DECL_CHOWN
243 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
244 "doesn't treat a uid or gid of -1 on some systems - "
245 "use gnulib module chown for portability");
252 /* Automatically included by modules that need a replacement for close. */
253 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
255 # define close rpl_close
257 _GL_FUNCDECL_RPL (close, int, (int fd));
258 _GL_CXXALIAS_RPL (close, int, (int fd));
260 _GL_CXXALIAS_SYS (close, int, (int fd));
262 _GL_CXXALIASWARN (close);
263 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
265 # define close close_used_without_requesting_gnulib_module_close
266 #elif defined GNULIB_POSIXCHECK
268 /* Assume close is always declared. */
269 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
270 "use gnulib module close for portability");
275 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
278 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
279 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
281 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
283 _GL_CXXALIASWARN (dup);
287 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
288 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
289 Return newfd if successful, otherwise -1 and errno set.
290 See the POSIX:2001 specification
291 <http://www.opengroup.org/susv3xsh/dup2.html>. */
293 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
294 # define dup2 rpl_dup2
296 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
297 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
300 _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
302 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
304 _GL_CXXALIASWARN (dup2);
305 #elif defined GNULIB_POSIXCHECK
307 # if HAVE_RAW_DECL_DUP2
308 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
309 "use gnulib module dup2 for portability");
315 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
317 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
318 and O_TEXT, O_BINARY (defined in "binary-io.h").
319 Close NEWFD first if it is open.
320 Return newfd if successful, otherwise -1 and errno set.
321 See the Linux man page at
322 <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
324 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
325 # define dup3 rpl_dup3
327 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
328 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
330 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
331 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
333 _GL_CXXALIASWARN (dup3);
334 #elif defined GNULIB_POSIXCHECK
336 # if HAVE_RAW_DECL_DUP3
337 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
338 "use gnulib module dup3 for portability");
344 # if !@HAVE_DECL_ENVIRON@
345 /* Set of environment variables and values. An array of strings of the form
346 "VARIABLE=VALUE", terminated with a NULL. */
347 # if defined __APPLE__ && defined __MACH__
348 # include <crt_externs.h>
349 # define environ (*_NSGetEnviron ())
354 extern char **environ;
360 #elif defined GNULIB_POSIXCHECK
361 # if HAVE_RAW_DECL_ENVIRON
362 static inline char ***
367 _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
368 "use gnulib module environ for portability");
370 # define environ (*rpl_environ ())
375 #if @GNULIB_EUIDACCESS@
376 /* Like access(), except that it uses the effective user id and group id of
377 the current process. */
378 # if !@HAVE_EUIDACCESS@
379 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
380 _GL_ARG_NONNULL ((1)));
382 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
383 _GL_CXXALIASWARN (euidaccess);
384 # if defined GNULIB_POSIXCHECK
385 /* Like access(), this function is a security risk. */
386 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
387 "use the gnulib module faccessat instead");
389 #elif defined GNULIB_POSIXCHECK
391 # if HAVE_RAW_DECL_EUIDACCESS
392 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
393 "use gnulib module euidaccess for portability");
398 #if @GNULIB_FACCESSAT@
399 # if !@HAVE_FACCESSAT@
400 _GL_FUNCDECL_SYS (faccessat, int,
401 (int fd, char const *file, int mode, int flag)
402 _GL_ARG_NONNULL ((2)));
404 _GL_CXXALIAS_SYS (faccessat, int,
405 (int fd, char const *file, int mode, int flag));
406 _GL_CXXALIASWARN (faccessat);
407 #elif defined GNULIB_POSIXCHECK
409 # if HAVE_RAW_DECL_FACCESSAT
410 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
411 "use gnulib module faccessat for portability");
417 /* Change the process' current working directory to the directory on which
418 the given file descriptor is open.
419 Return 0 if successful, otherwise -1 and errno set.
420 See the POSIX:2001 specification
421 <http://www.opengroup.org/susv3xsh/fchdir.html>. */
423 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
425 /* Gnulib internal hooks needed to maintain the fchdir metadata. */
426 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
427 _GL_ARG_NONNULL ((2));
428 _GL_EXTERN_C void _gl_unregister_fd (int fd);
429 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
430 _GL_EXTERN_C const char *_gl_directory_name (int fd);
433 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
434 _GL_CXXALIASWARN (fchdir);
435 #elif defined GNULIB_POSIXCHECK
437 # if HAVE_RAW_DECL_FCHDIR
438 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
439 "use gnulib module fchdir for portability");
444 #if @GNULIB_FCHOWNAT@
445 # if @REPLACE_FCHOWNAT@
446 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
448 # define fchownat rpl_fchownat
450 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
451 uid_t owner, gid_t group, int flag)
452 _GL_ARG_NONNULL ((2)));
453 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
454 uid_t owner, gid_t group, int flag));
456 # if !@HAVE_FCHOWNAT@
457 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
458 uid_t owner, gid_t group, int flag)
459 _GL_ARG_NONNULL ((2)));
461 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
462 uid_t owner, gid_t group, int flag));
464 _GL_CXXALIASWARN (fchownat);
465 #elif defined GNULIB_POSIXCHECK
467 # if HAVE_RAW_DECL_FCHOWNAT
468 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
469 "use gnulib module openat for portability");
475 /* Synchronize changes to a file.
476 Return 0 if successful, otherwise -1 and errno set.
477 See POSIX:2001 specification
478 <http://www.opengroup.org/susv3xsh/fsync.html>. */
480 _GL_FUNCDECL_SYS (fsync, int, (int fd));
482 _GL_CXXALIAS_SYS (fsync, int, (int fd));
483 _GL_CXXALIASWARN (fsync);
484 #elif defined GNULIB_POSIXCHECK
486 # if HAVE_RAW_DECL_FSYNC
487 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
488 "use gnulib module fsync for portability");
493 #if @GNULIB_FTRUNCATE@
494 /* Change the size of the file to which FD is opened to become equal to LENGTH.
495 Return 0 if successful, otherwise -1 and errno set.
496 See the POSIX:2001 specification
497 <http://www.opengroup.org/susv3xsh/ftruncate.html>. */
498 # if !@HAVE_FTRUNCATE@
499 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
501 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
502 _GL_CXXALIASWARN (ftruncate);
503 #elif defined GNULIB_POSIXCHECK
505 # if HAVE_RAW_DECL_FTRUNCATE
506 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
507 "use gnulib module ftruncate for portability");
513 /* Get the name of the current working directory, and put it in SIZE bytes
515 Return BUF if successful, or NULL if the directory couldn't be determined
516 or SIZE was too small.
517 See the POSIX:2001 specification
518 <http://www.opengroup.org/susv3xsh/getcwd.html>.
519 Additionally, the gnulib module 'getcwd' guarantees the following GNU
520 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
521 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
523 # if @REPLACE_GETCWD@
524 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
525 # define getcwd rpl_getcwd
527 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
528 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
530 /* Need to cast, because on mingw, the second parameter is
532 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
534 _GL_CXXALIASWARN (getcwd);
535 #elif defined GNULIB_POSIXCHECK
537 # if HAVE_RAW_DECL_GETCWD
538 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
539 "use gnulib module getcwd for portability");
544 #if @GNULIB_GETDOMAINNAME@
545 /* Return the NIS domain name of the machine.
546 WARNING! The NIS domain name is unrelated to the fully qualified host name
547 of the machine. It is also unrelated to email addresses.
548 WARNING! The NIS domain name is usually the empty string or "(none)" when
551 Put up to LEN bytes of the NIS domain name into NAME.
552 Null terminate it if the name is shorter than LEN.
553 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
554 Return 0 if successful, otherwise set errno and return -1. */
555 # if !@HAVE_GETDOMAINNAME@
556 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
557 _GL_ARG_NONNULL ((1)));
559 /* Need to cast, because on MacOS X 10.5 systems, the second parameter is
561 _GL_CXXALIAS_SYS_CAST (getdomainname, int, (char *name, size_t len));
562 _GL_CXXALIASWARN (getdomainname);
563 #elif defined GNULIB_POSIXCHECK
564 # undef getdomainname
565 # if HAVE_RAW_DECL_GETDOMAINNAME
566 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
567 "use gnulib module getdomainname for portability");
572 #if @GNULIB_GETDTABLESIZE@
573 /* Return the maximum number of file descriptors in the current process.
574 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
575 # if !@HAVE_GETDTABLESIZE@
576 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
578 _GL_CXXALIAS_SYS (getdtablesize, int, (void));
579 _GL_CXXALIASWARN (getdtablesize);
580 #elif defined GNULIB_POSIXCHECK
581 # undef getdtablesize
582 # if HAVE_RAW_DECL_GETDTABLESIZE
583 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
584 "use gnulib module getdtablesize for portability");
589 #if @GNULIB_GETGROUPS@
590 /* Return the supplemental groups that the current process belongs to.
591 It is unspecified whether the effective group id is in the list.
592 If N is 0, return the group count; otherwise, N describes how many
593 entries are available in GROUPS. Return -1 and set errno if N is
594 not 0 and not large enough. Fails with ENOSYS on some systems. */
595 # if @REPLACE_GETGROUPS@
596 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
598 # define getgroups rpl_getgroups
600 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
601 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
603 # if !@HAVE_GETGROUPS@
604 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
606 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
608 _GL_CXXALIASWARN (getgroups);
609 #elif defined GNULIB_POSIXCHECK
611 # if HAVE_RAW_DECL_GETGROUPS
612 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
613 "use gnulib module getgroups for portability");
618 #if @GNULIB_GETHOSTNAME@
619 /* Return the standard host name of the machine.
620 WARNING! The host name may or may not be fully qualified.
622 Put up to LEN bytes of the host name into NAME.
623 Null terminate it if the name is shorter than LEN.
624 If the host name is longer than LEN, set errno = EINVAL and return -1.
625 Return 0 if successful, otherwise set errno and return -1. */
626 # if @UNISTD_H_HAVE_WINSOCK2_H@
627 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
629 # define gethostname rpl_gethostname
631 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
632 _GL_ARG_NONNULL ((1)));
633 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
635 # if !@HAVE_GETHOSTNAME@
636 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
637 _GL_ARG_NONNULL ((1)));
639 /* Need to cast, because on Solaris 10 systems, the second parameter is
641 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
643 _GL_CXXALIASWARN (gethostname);
644 #elif @UNISTD_H_HAVE_WINSOCK2_H@
646 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
647 #elif defined GNULIB_POSIXCHECK
649 # if HAVE_RAW_DECL_GETHOSTNAME
650 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
651 "use gnulib module gethostname for portability");
656 #if @GNULIB_GETLOGIN@
657 /* Returns the user's login name, or NULL if it cannot be found. Upon error,
658 returns NULL with errno set.
660 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
662 Most programs don't need to use this function, because the information is
663 available through environment variables:
664 ${LOGNAME-$USER} on Unix platforms,
665 $USERNAME on native Windows platforms.
667 # if !@HAVE_GETLOGIN@
668 _GL_FUNCDECL_SYS (getlogin, char *, (void));
670 _GL_CXXALIAS_SYS (getlogin, char *, (void));
671 _GL_CXXALIASWARN (getlogin);
672 #elif defined GNULIB_POSIXCHECK
674 # if HAVE_RAW_DECL_GETLOGIN
675 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
676 "use gnulib module getlogin for portability");
681 #if @GNULIB_GETLOGIN_R@
682 /* Copies the user's login name to NAME.
683 The array pointed to by NAME has room for SIZE bytes.
685 Returns 0 if successful. Upon error, an error number is returned, or -1 in
686 the case that the login name cannot be found but no specific error is
687 provided (this case is hopefully rare but is left open by the POSIX spec).
689 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
691 Most programs don't need to use this function, because the information is
692 available through environment variables:
693 ${LOGNAME-$USER} on Unix platforms,
694 $USERNAME on native Windows platforms.
696 # if !@HAVE_DECL_GETLOGIN_R@
697 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
698 _GL_ARG_NONNULL ((1)));
700 /* Need to cast, because on Solaris 10 systems, the second argument is
702 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
703 _GL_CXXALIASWARN (getlogin_r);
704 #elif defined GNULIB_POSIXCHECK
706 # if HAVE_RAW_DECL_GETLOGIN_R
707 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
708 "use gnulib module getlogin_r for portability");
713 #if @GNULIB_GETPAGESIZE@
714 # if @REPLACE_GETPAGESIZE@
715 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
716 # define getpagesize rpl_getpagesize
718 _GL_FUNCDECL_RPL (getpagesize, int, (void));
719 _GL_CXXALIAS_RPL (getpagesize, int, (void));
721 # if !@HAVE_GETPAGESIZE@
722 # if !defined getpagesize
723 /* This is for POSIX systems. */
724 # if !defined _gl_getpagesize && defined _SC_PAGESIZE
725 # if ! (defined __VMS && __VMS_VER < 70000000)
726 # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
729 /* This is for older VMS. */
730 # if !defined _gl_getpagesize && defined __VMS
732 # define _gl_getpagesize() 8192
734 # define _gl_getpagesize() 512
737 /* This is for BeOS. */
738 # if !defined _gl_getpagesize && @HAVE_OS_H@
740 # if defined B_PAGE_SIZE
741 # define _gl_getpagesize() B_PAGE_SIZE
744 /* This is for AmigaOS4.0. */
745 # if !defined _gl_getpagesize && defined __amigaos4__
746 # define _gl_getpagesize() 2048
748 /* This is for older Unix systems. */
749 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
750 # include <sys/param.h>
751 # ifdef EXEC_PAGESIZE
752 # define _gl_getpagesize() EXEC_PAGESIZE
758 # define _gl_getpagesize() (NBPG * CLSIZE)
761 # define _gl_getpagesize() NBPC
766 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
767 # define getpagesize() _gl_getpagesize ()
772 return _gl_getpagesize ();
777 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
778 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
780 # if @HAVE_DECL_GETPAGESIZE@
781 _GL_CXXALIASWARN (getpagesize);
783 #elif defined GNULIB_POSIXCHECK
785 # if HAVE_RAW_DECL_GETPAGESIZE
786 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
787 "use gnulib module getpagesize for portability");
792 #if @GNULIB_GETUSERSHELL@
793 /* Return the next valid login shell on the system, or NULL when the end of
794 the list has been reached. */
795 # if !@HAVE_DECL_GETUSERSHELL@
796 _GL_FUNCDECL_SYS (getusershell, char *, (void));
798 _GL_CXXALIAS_SYS (getusershell, char *, (void));
799 _GL_CXXALIASWARN (getusershell);
800 #elif defined GNULIB_POSIXCHECK
802 # if HAVE_RAW_DECL_GETUSERSHELL
803 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
804 "use gnulib module getusershell for portability");
808 #if @GNULIB_GETUSERSHELL@
809 /* Rewind to pointer that is advanced at each getusershell() call. */
810 # if !@HAVE_DECL_GETUSERSHELL@
811 _GL_FUNCDECL_SYS (setusershell, void, (void));
813 _GL_CXXALIAS_SYS (setusershell, void, (void));
814 _GL_CXXALIASWARN (setusershell);
815 #elif defined GNULIB_POSIXCHECK
817 # if HAVE_RAW_DECL_SETUSERSHELL
818 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
819 "use gnulib module getusershell for portability");
823 #if @GNULIB_GETUSERSHELL@
824 /* Free the pointer that is advanced at each getusershell() call and
825 associated resources. */
826 # if !@HAVE_DECL_GETUSERSHELL@
827 _GL_FUNCDECL_SYS (endusershell, void, (void));
829 _GL_CXXALIAS_SYS (endusershell, void, (void));
830 _GL_CXXALIASWARN (endusershell);
831 #elif defined GNULIB_POSIXCHECK
833 # if HAVE_RAW_DECL_ENDUSERSHELL
834 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
835 "use gnulib module getusershell for portability");
841 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
842 to GID (if GID is not -1). Do not follow symbolic links.
843 Return 0 if successful, otherwise -1 and errno set.
844 See the POSIX:2001 specification
845 <http://www.opengroup.org/susv3xsh/lchown.html>. */
846 # if @REPLACE_LCHOWN@
847 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
849 # define lchown rpl_lchown
851 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
852 _GL_ARG_NONNULL ((1)));
853 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
856 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
857 _GL_ARG_NONNULL ((1)));
859 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
861 _GL_CXXALIASWARN (lchown);
862 #elif defined GNULIB_POSIXCHECK
864 # if HAVE_RAW_DECL_LCHOWN
865 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
866 "use gnulib module lchown for portability");
872 /* Create a new hard link for an existing file.
873 Return 0 if successful, otherwise -1 and errno set.
874 See POSIX:2001 specification
875 <http://www.opengroup.org/susv3xsh/link.html>. */
877 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
878 # define link rpl_link
880 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
881 _GL_ARG_NONNULL ((1, 2)));
882 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
885 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
886 _GL_ARG_NONNULL ((1, 2)));
888 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
890 _GL_CXXALIASWARN (link);
891 #elif defined GNULIB_POSIXCHECK
893 # if HAVE_RAW_DECL_LINK
894 _GL_WARN_ON_USE (link, "link is unportable - "
895 "use gnulib module link for portability");
901 /* Create a new hard link for an existing file, relative to two
902 directories. FLAG controls whether symlinks are followed.
903 Return 0 if successful, otherwise -1 and errno set. */
904 # if @REPLACE_LINKAT@
905 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
907 # define linkat rpl_linkat
909 _GL_FUNCDECL_RPL (linkat, int,
910 (int fd1, const char *path1, int fd2, const char *path2,
912 _GL_ARG_NONNULL ((2, 4)));
913 _GL_CXXALIAS_RPL (linkat, int,
914 (int fd1, const char *path1, int fd2, const char *path2,
918 _GL_FUNCDECL_SYS (linkat, int,
919 (int fd1, const char *path1, int fd2, const char *path2,
921 _GL_ARG_NONNULL ((2, 4)));
923 _GL_CXXALIAS_SYS (linkat, int,
924 (int fd1, const char *path1, int fd2, const char *path2,
927 _GL_CXXALIASWARN (linkat);
928 #elif defined GNULIB_POSIXCHECK
930 # if HAVE_RAW_DECL_LINKAT
931 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
932 "use gnulib module linkat for portability");
938 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
939 Return the new offset if successful, otherwise -1 and errno set.
940 See the POSIX:2001 specification
941 <http://www.opengroup.org/susv3xsh/lseek.html>. */
943 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
944 # define lseek rpl_lseek
946 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
947 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
949 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
951 _GL_CXXALIASWARN (lseek);
952 #elif defined GNULIB_POSIXCHECK
954 # if HAVE_RAW_DECL_LSEEK
955 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
956 "systems - use gnulib module lseek for portability");
962 /* Create a pipe, applying the given flags when opening the read-end of the
963 pipe and the write-end of the pipe.
964 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
965 and O_TEXT, O_BINARY (defined in "binary-io.h").
966 Store the read-end as fd[0] and the write-end as fd[1].
967 Return 0 upon success, or -1 with errno set upon failure.
968 See also the Linux man page at
969 <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
971 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
972 # define pipe2 rpl_pipe2
974 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
975 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
977 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
978 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
980 _GL_CXXALIASWARN (pipe2);
981 #elif defined GNULIB_POSIXCHECK
983 # if HAVE_RAW_DECL_PIPE2
984 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
985 "use gnulib module pipe2 for portability");
991 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
992 Return the number of bytes placed into BUF if successful, otherwise
993 set errno and return -1. 0 indicates EOF. See the POSIX:2001
994 specification <http://www.opengroup.org/susv3xsh/pread.html>. */
996 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
997 # define pread rpl_pread
999 _GL_FUNCDECL_RPL (pread, ssize_t,
1000 (int fd, void *buf, size_t bufsize, off_t offset)
1001 _GL_ARG_NONNULL ((2)));
1002 _GL_CXXALIAS_RPL (pread, ssize_t,
1003 (int fd, void *buf, size_t bufsize, off_t offset));
1006 _GL_FUNCDECL_SYS (pread, ssize_t,
1007 (int fd, void *buf, size_t bufsize, off_t offset)
1008 _GL_ARG_NONNULL ((2)));
1010 _GL_CXXALIAS_SYS (pread, ssize_t,
1011 (int fd, void *buf, size_t bufsize, off_t offset));
1013 _GL_CXXALIASWARN (pread);
1014 #elif defined GNULIB_POSIXCHECK
1016 # if HAVE_RAW_DECL_PREAD
1017 _GL_WARN_ON_USE (pread, "pread is unportable - "
1018 "use gnulib module pread for portability");
1024 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1025 Return the number of bytes written if successful, otherwise
1026 set errno and return -1. 0 indicates nothing written. See the
1027 POSIX:2001 specification
1028 <http://www.opengroup.org/susv3xsh/pwrite.html>. */
1029 # if @REPLACE_PWRITE@
1030 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1031 # define pwrite rpl_pwrite
1033 _GL_FUNCDECL_RPL (pwrite, ssize_t,
1034 (int fd, const void *buf, size_t bufsize, off_t offset)
1035 _GL_ARG_NONNULL ((2)));
1036 _GL_CXXALIAS_RPL (pwrite, ssize_t,
1037 (int fd, const void *buf, size_t bufsize, off_t offset));
1040 _GL_FUNCDECL_SYS (pwrite, ssize_t,
1041 (int fd, const void *buf, size_t bufsize, off_t offset)
1042 _GL_ARG_NONNULL ((2)));
1044 _GL_CXXALIAS_SYS (pwrite, ssize_t,
1045 (int fd, const void *buf, size_t bufsize, off_t offset));
1047 _GL_CXXALIASWARN (pwrite);
1048 #elif defined GNULIB_POSIXCHECK
1050 # if HAVE_RAW_DECL_PWRITE
1051 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1052 "use gnulib module pwrite for portability");
1057 #if @GNULIB_READLINK@
1058 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
1059 bytes of it into BUF. Return the number of bytes placed into BUF if
1060 successful, otherwise -1 and errno set.
1061 See the POSIX:2001 specification
1062 <http://www.opengroup.org/susv3xsh/readlink.html>. */
1063 # if @REPLACE_READLINK@
1064 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1065 # define readlink rpl_readlink
1067 _GL_FUNCDECL_RPL (readlink, ssize_t,
1068 (const char *file, char *buf, size_t bufsize)
1069 _GL_ARG_NONNULL ((1, 2)));
1070 _GL_CXXALIAS_RPL (readlink, ssize_t,
1071 (const char *file, char *buf, size_t bufsize));
1073 # if !@HAVE_READLINK@
1074 _GL_FUNCDECL_SYS (readlink, ssize_t,
1075 (const char *file, char *buf, size_t bufsize)
1076 _GL_ARG_NONNULL ((1, 2)));
1078 _GL_CXXALIAS_SYS (readlink, ssize_t,
1079 (const char *file, char *buf, size_t bufsize));
1081 _GL_CXXALIASWARN (readlink);
1082 #elif defined GNULIB_POSIXCHECK
1084 # if HAVE_RAW_DECL_READLINK
1085 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1086 "use gnulib module readlink for portability");
1091 #if @GNULIB_READLINKAT@
1092 # if !@HAVE_READLINKAT@
1093 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
1094 (int fd, char const *file, char *buf, size_t len)
1095 _GL_ARG_NONNULL ((2, 3)));
1097 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
1098 (int fd, char const *file, char *buf, size_t len));
1099 _GL_CXXALIASWARN (readlinkat);
1100 #elif defined GNULIB_POSIXCHECK
1102 # if HAVE_RAW_DECL_READLINKAT
1103 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1104 "use gnulib module symlinkat for portability");
1110 /* Remove the directory DIR. */
1111 # if @REPLACE_RMDIR@
1112 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1113 # define rmdir rpl_rmdir
1115 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1116 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1118 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1120 _GL_CXXALIASWARN (rmdir);
1121 #elif defined GNULIB_POSIXCHECK
1123 # if HAVE_RAW_DECL_RMDIR
1124 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1125 "use gnulib module rmdir for portability");
1131 /* Pause the execution of the current thread for N seconds.
1132 Returns the number of seconds left to sleep.
1133 See the POSIX:2001 specification
1134 <http://www.opengroup.org/susv3xsh/sleep.html>. */
1135 # if @REPLACE_SLEEP@
1136 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1138 # define sleep rpl_sleep
1140 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1141 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1144 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1146 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1148 _GL_CXXALIASWARN (sleep);
1149 #elif defined GNULIB_POSIXCHECK
1151 # if HAVE_RAW_DECL_SLEEP
1152 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
1153 "use gnulib module sleep for portability");
1158 #if @GNULIB_SYMLINK@
1159 # if @REPLACE_SYMLINK@
1160 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1162 # define symlink rpl_symlink
1164 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1165 _GL_ARG_NONNULL ((1, 2)));
1166 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1168 # if !@HAVE_SYMLINK@
1169 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1170 _GL_ARG_NONNULL ((1, 2)));
1172 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1174 _GL_CXXALIASWARN (symlink);
1175 #elif defined GNULIB_POSIXCHECK
1177 # if HAVE_RAW_DECL_SYMLINK
1178 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
1179 "use gnulib module symlink for portability");
1184 #if @GNULIB_SYMLINKAT@
1185 # if !@HAVE_SYMLINKAT@
1186 _GL_FUNCDECL_SYS (symlinkat, int,
1187 (char const *contents, int fd, char const *file)
1188 _GL_ARG_NONNULL ((1, 3)));
1190 _GL_CXXALIAS_SYS (symlinkat, int,
1191 (char const *contents, int fd, char const *file));
1192 _GL_CXXALIASWARN (symlinkat);
1193 #elif defined GNULIB_POSIXCHECK
1195 # if HAVE_RAW_DECL_SYMLINKAT
1196 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1197 "use gnulib module symlinkat for portability");
1202 #if @GNULIB_TTYNAME_R@
1203 /* Store at most BUFLEN characters of the pathname of the terminal FD is
1204 open on in BUF. Return 0 on success, otherwise an error number. */
1205 # if @REPLACE_TTYNAME_R@
1206 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1208 # define ttyname_r rpl_ttyname_r
1210 _GL_FUNCDECL_RPL (ttyname_r, int,
1211 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1212 _GL_CXXALIAS_RPL (ttyname_r, int,
1213 (int fd, char *buf, size_t buflen));
1215 # if !@HAVE_TTYNAME_R@
1216 _GL_FUNCDECL_SYS (ttyname_r, int,
1217 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1219 _GL_CXXALIAS_SYS (ttyname_r, int,
1220 (int fd, char *buf, size_t buflen));
1222 _GL_CXXALIASWARN (ttyname_r);
1223 #elif defined GNULIB_POSIXCHECK
1225 # if HAVE_RAW_DECL_TTYNAME_R
1226 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1227 "use gnulib module ttyname_r for portability");
1233 # if @REPLACE_UNLINK@
1234 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1236 # define unlink rpl_unlink
1238 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1239 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
1241 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
1243 _GL_CXXALIASWARN (unlink);
1244 #elif defined GNULIB_POSIXCHECK
1246 # if HAVE_RAW_DECL_UNLINK
1247 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
1248 "use gnulib module unlink for portability");
1253 #if @GNULIB_UNLINKAT@
1254 # if @REPLACE_UNLINKAT@
1255 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1257 # define unlinkat rpl_unlinkat
1259 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1260 _GL_ARG_NONNULL ((2)));
1261 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1263 # if !@HAVE_UNLINKAT@
1264 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1265 _GL_ARG_NONNULL ((2)));
1267 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1269 _GL_CXXALIASWARN (unlinkat);
1270 #elif defined GNULIB_POSIXCHECK
1272 # if HAVE_RAW_DECL_UNLINKAT
1273 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1274 "use gnulib module openat for portability");
1280 /* Pause the execution of the current thread for N microseconds.
1281 Returns 0 on completion, or -1 on range error.
1282 See the POSIX:2001 specification
1283 <http://www.opengroup.org/susv3xsh/sleep.html>. */
1284 # if @REPLACE_USLEEP@
1285 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1287 # define usleep rpl_usleep
1289 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1290 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1293 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1295 _GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
1297 _GL_CXXALIASWARN (usleep);
1298 #elif defined GNULIB_POSIXCHECK
1300 # if HAVE_RAW_DECL_USLEEP
1301 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1302 "use gnulib module usleep for portability");
1308 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
1309 See the POSIX:2001 specification
1310 <http://www.opengroup.org/susv3xsh/write.html>. */
1311 # if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
1312 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1314 # define write rpl_write
1316 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1317 _GL_ARG_NONNULL ((2)));
1318 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1320 /* Need to cast, because on mingw, the third parameter is
1322 and the return type is 'int'. */
1323 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1325 _GL_CXXALIASWARN (write);
1329 #endif /* _GL_UNISTD_H */
1330 #endif /* _GL_UNISTD_H */