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 2, 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@
23 /* Special invocation convention:
24 - On mingw, several headers, including <winsock2.h>, include <unistd.h>,
25 but we need to ensure that both the system <unistd.h> and <winsock2.h>
26 are completely included before we replace gethostname. */
27 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
28 && !defined _GL_WINSOCK2_H_WITNESS && defined _WINSOCK2_H
29 /* <unistd.h> is being indirectly included for the first time from
30 <winsock2.h>; avoid declaring any overrides. */
32 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
34 # error unexpected; report this to bug-gnulib@gnu.org
36 # define _GL_WINSOCK2_H_WITNESS
38 /* Normal invocation. */
39 #elif !defined _GL_UNISTD_H
41 /* The include_next requires a split double-inclusion guard. */
43 # @INCLUDE_NEXT@ @NEXT_UNISTD_H@
46 /* Get all possible declarations of gethostname(). */
47 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
48 && !defined _GL_INCLUDING_WINSOCK2_H
49 # define _GL_INCLUDING_WINSOCK2_H
50 # include <winsock2.h>
51 # undef _GL_INCLUDING_WINSOCK2_H
54 #if !defined _GL_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
57 /* NetBSD 5.0 mis-defines NULL. Also get size_t. */
60 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
61 /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
62 /* But avoid namespace pollution on glibc systems. */
63 #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
64 || (@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK)) \
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 __GLIBC__
75 /* mingw fails to declare _exit in <unistd.h>. */
76 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
77 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
78 /* But avoid namespace pollution on glibc systems. */
83 /* mingw declares getcwd in <io.h>, not in <unistd.h>. */
84 #if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
85 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
89 #if (@GNULIB_WRITE@ || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
90 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
92 # include <sys/types.h>
95 /* Get getopt(), optarg, optind, opterr, optopt.
96 But avoid namespace pollution on glibc systems. */
97 #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
101 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
103 /* The definition of _GL_ARG_NONNULL is copied here. */
105 /* The definition of _GL_WARN_ON_USE is copied here. */
108 #if @GNULIB_GETHOSTNAME@
109 /* Get all possible declarations of gethostname(). */
110 # if @UNISTD_H_HAVE_WINSOCK2_H@
111 # if !defined _GL_SYS_SOCKET_H
112 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
114 # define socket socket_used_without_including_sys_socket_h
116 # define connect connect_used_without_including_sys_socket_h
118 # define accept accept_used_without_including_sys_socket_h
120 # define bind bind_used_without_including_sys_socket_h
122 # define getpeername getpeername_used_without_including_sys_socket_h
124 # define getsockname getsockname_used_without_including_sys_socket_h
126 # define getsockopt getsockopt_used_without_including_sys_socket_h
128 # define listen listen_used_without_including_sys_socket_h
130 # define recv recv_used_without_including_sys_socket_h
132 # define send send_used_without_including_sys_socket_h
134 # define recvfrom recvfrom_used_without_including_sys_socket_h
136 # define sendto sendto_used_without_including_sys_socket_h
138 # define setsockopt setsockopt_used_without_including_sys_socket_h
140 # define shutdown shutdown_used_without_including_sys_socket_h
142 _GL_WARN_ON_USE (socket,
143 "socket() used without including <sys/socket.h>");
144 _GL_WARN_ON_USE (connect,
145 "connect() used without including <sys/socket.h>");
146 _GL_WARN_ON_USE (accept,
147 "accept() used without including <sys/socket.h>");
148 _GL_WARN_ON_USE (bind,
149 "bind() used without including <sys/socket.h>");
150 _GL_WARN_ON_USE (getpeername,
151 "getpeername() used without including <sys/socket.h>");
152 _GL_WARN_ON_USE (getsockname,
153 "getsockname() used without including <sys/socket.h>");
154 _GL_WARN_ON_USE (getsockopt,
155 "getsockopt() used without including <sys/socket.h>");
156 _GL_WARN_ON_USE (listen,
157 "listen() used without including <sys/socket.h>");
158 _GL_WARN_ON_USE (recv,
159 "recv() used without including <sys/socket.h>");
160 _GL_WARN_ON_USE (send,
161 "send() used without including <sys/socket.h>");
162 _GL_WARN_ON_USE (recvfrom,
163 "recvfrom() used without including <sys/socket.h>");
164 _GL_WARN_ON_USE (sendto,
165 "sendto() used without including <sys/socket.h>");
166 _GL_WARN_ON_USE (setsockopt,
167 "setsockopt() used without including <sys/socket.h>");
168 _GL_WARN_ON_USE (shutdown,
169 "shutdown() used without including <sys/socket.h>");
172 # if !defined _GL_SYS_SELECT_H
173 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
175 # define select select_used_without_including_sys_select_h
177 _GL_WARN_ON_USE (select,
178 "select() used without including <sys/select.h>");
185 /* OS/2 EMX lacks these macros. */
187 # define STDIN_FILENO 0
189 #ifndef STDOUT_FILENO
190 # define STDOUT_FILENO 1
192 #ifndef STDERR_FILENO
193 # define STDERR_FILENO 2
196 /* Ensure *_OK macros exist. */
205 /* Declare overridden functions. */
208 #if defined GNULIB_POSIXCHECK
209 /* The access() function is a security risk. */
210 _GL_WARN_ON_USE (access, "the access function is a security risk - "
211 "use the gnulib module faccessat instead");
216 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
217 to GID (if GID is not -1). Follow symbolic links.
218 Return 0 if successful, otherwise -1 and errno set.
219 See the POSIX:2001 specification
220 <http://www.opengroup.org/susv3xsh/chown.html>. */
222 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
224 # define chown rpl_chown
226 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
227 _GL_ARG_NONNULL ((1)));
228 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
231 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
232 _GL_ARG_NONNULL ((1)));
234 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
236 _GL_CXXALIASWARN (chown);
237 #elif defined GNULIB_POSIXCHECK
239 # if HAVE_RAW_DECL_CHOWN
240 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
241 "doesn't treat a uid or gid of -1 on some systems - "
242 "use gnulib module chown for portability");
249 /* Automatically included by modules that need a replacement for close. */
250 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
252 # define close rpl_close
254 _GL_FUNCDECL_RPL (close, int, (int fd));
255 _GL_CXXALIAS_RPL (close, int, (int fd));
257 _GL_CXXALIAS_SYS (close, int, (int fd));
259 _GL_CXXALIASWARN (close);
260 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
262 # define close close_used_without_requesting_gnulib_module_close
263 #elif defined GNULIB_POSIXCHECK
265 /* Assume close is always declared. */
266 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
267 "use gnulib module close for portability");
272 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
275 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
276 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
278 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
280 _GL_CXXALIASWARN (dup);
284 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
285 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
286 Return newfd if successful, otherwise -1 and errno set.
287 See the POSIX:2001 specification
288 <http://www.opengroup.org/susv3xsh/dup2.html>. */
290 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
291 # define dup2 rpl_dup2
293 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
294 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
297 _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
299 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
301 _GL_CXXALIASWARN (dup2);
302 #elif defined GNULIB_POSIXCHECK
304 # if HAVE_RAW_DECL_DUP2
305 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
306 "use gnulib module dup2 for portability");
312 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
314 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
315 and O_TEXT, O_BINARY (defined in "binary-io.h").
316 Close NEWFD first if it is open.
317 Return newfd if successful, otherwise -1 and errno set.
318 See the Linux man page at
319 <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
321 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
322 # define dup3 rpl_dup3
324 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
325 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
327 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
328 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
330 _GL_CXXALIASWARN (dup3);
331 #elif defined GNULIB_POSIXCHECK
333 # if HAVE_RAW_DECL_DUP3
334 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
335 "use gnulib module dup3 for portability");
341 # if !@HAVE_DECL_ENVIRON@
342 /* Set of environment variables and values. An array of strings of the form
343 "VARIABLE=VALUE", terminated with a NULL. */
344 # if defined __APPLE__ && defined __MACH__
345 # include <crt_externs.h>
346 # define environ (*_NSGetEnviron ())
351 extern char **environ;
357 #elif defined GNULIB_POSIXCHECK
358 # if HAVE_RAW_DECL_ENVIRON
359 static inline char ***
364 _GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
365 "use gnulib module environ for portability");
367 # define environ (*rpl_environ ())
372 #if @GNULIB_EUIDACCESS@
373 /* Like access(), except that it uses the effective user id and group id of
374 the current process. */
375 # if !@HAVE_EUIDACCESS@
376 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
377 _GL_ARG_NONNULL ((1)));
379 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
380 _GL_CXXALIASWARN (euidaccess);
381 # if defined GNULIB_POSIXCHECK
382 /* Like access(), this function is a security risk. */
383 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
384 "use the gnulib module faccessat instead");
386 #elif defined GNULIB_POSIXCHECK
388 # if HAVE_RAW_DECL_EUIDACCESS
389 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
390 "use gnulib module euidaccess for portability");
395 #if @GNULIB_FACCESSAT@
396 # if !@HAVE_FACCESSAT@
397 _GL_FUNCDECL_SYS (faccessat, int,
398 (int fd, char const *file, int mode, int flag)
399 _GL_ARG_NONNULL ((2)));
401 _GL_CXXALIAS_SYS (faccessat, int,
402 (int fd, char const *file, int mode, int flag));
403 _GL_CXXALIASWARN (faccessat);
404 #elif defined GNULIB_POSIXCHECK
406 # if HAVE_RAW_DECL_FACCESSAT
407 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
408 "use gnulib module faccessat for portability");
414 /* Change the process' current working directory to the directory on which
415 the given file descriptor is open.
416 Return 0 if successful, otherwise -1 and errno set.
417 See the POSIX:2001 specification
418 <http://www.opengroup.org/susv3xsh/fchdir.html>. */
420 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
422 /* Gnulib internal hooks needed to maintain the fchdir metadata. */
423 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
424 _GL_ARG_NONNULL ((2));
425 _GL_EXTERN_C void _gl_unregister_fd (int fd);
426 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
427 _GL_EXTERN_C const char *_gl_directory_name (int fd);
430 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
431 _GL_CXXALIASWARN (fchdir);
432 #elif defined GNULIB_POSIXCHECK
434 # if HAVE_RAW_DECL_FCHDIR
435 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
436 "use gnulib module fchdir for portability");
441 #if @GNULIB_FCHOWNAT@
442 # if @REPLACE_FCHOWNAT@
443 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
445 # define fchownat rpl_fchownat
447 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
448 uid_t owner, gid_t group, int flag)
449 _GL_ARG_NONNULL ((2)));
450 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
451 uid_t owner, gid_t group, int flag));
453 # if !@HAVE_FCHOWNAT@
454 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
455 uid_t owner, gid_t group, int flag)
456 _GL_ARG_NONNULL ((2)));
458 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
459 uid_t owner, gid_t group, int flag));
461 _GL_CXXALIASWARN (fchownat);
462 #elif defined GNULIB_POSIXCHECK
464 # if HAVE_RAW_DECL_FCHOWNAT
465 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
466 "use gnulib module openat for portability");
472 /* Synchronize changes to a file.
473 Return 0 if successful, otherwise -1 and errno set.
474 See POSIX:2001 specification
475 <http://www.opengroup.org/susv3xsh/fsync.html>. */
477 _GL_FUNCDECL_SYS (fsync, int, (int fd));
479 _GL_CXXALIAS_SYS (fsync, int, (int fd));
480 _GL_CXXALIASWARN (fsync);
481 #elif defined GNULIB_POSIXCHECK
483 # if HAVE_RAW_DECL_FSYNC
484 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
485 "use gnulib module fsync for portability");
490 #if @GNULIB_FTRUNCATE@
491 /* Change the size of the file to which FD is opened to become equal to LENGTH.
492 Return 0 if successful, otherwise -1 and errno set.
493 See the POSIX:2001 specification
494 <http://www.opengroup.org/susv3xsh/ftruncate.html>. */
495 # if !@HAVE_FTRUNCATE@
496 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
498 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
499 _GL_CXXALIASWARN (ftruncate);
500 #elif defined GNULIB_POSIXCHECK
502 # if HAVE_RAW_DECL_FTRUNCATE
503 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
504 "use gnulib module ftruncate for portability");
510 /* Get the name of the current working directory, and put it in SIZE bytes
512 Return BUF if successful, or NULL if the directory couldn't be determined
513 or SIZE was too small.
514 See the POSIX:2001 specification
515 <http://www.opengroup.org/susv3xsh/getcwd.html>.
516 Additionally, the gnulib module 'getcwd' guarantees the following GNU
517 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
518 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
520 # if @REPLACE_GETCWD@
521 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
522 # define getcwd rpl_getcwd
524 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
525 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
527 /* Need to cast, because on mingw, the second parameter is
529 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
531 _GL_CXXALIASWARN (getcwd);
532 #elif defined GNULIB_POSIXCHECK
534 # if HAVE_RAW_DECL_GETCWD
535 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
536 "use gnulib module getcwd for portability");
541 #if @GNULIB_GETDOMAINNAME@
542 /* Return the NIS domain name of the machine.
543 WARNING! The NIS domain name is unrelated to the fully qualified host name
544 of the machine. It is also unrelated to email addresses.
545 WARNING! The NIS domain name is usually the empty string or "(none)" when
548 Put up to LEN bytes of the NIS domain name into NAME.
549 Null terminate it if the name is shorter than LEN.
550 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
551 Return 0 if successful, otherwise set errno and return -1. */
552 # if !@HAVE_GETDOMAINNAME@
553 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
554 _GL_ARG_NONNULL ((1)));
556 /* Need to cast, because on MacOS X 10.5 systems, the second parameter is
558 _GL_CXXALIAS_SYS_CAST (getdomainname, int, (char *name, size_t len));
559 _GL_CXXALIASWARN (getdomainname);
560 #elif defined GNULIB_POSIXCHECK
561 # undef getdomainname
562 # if HAVE_RAW_DECL_GETDOMAINNAME
563 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
564 "use gnulib module getdomainname for portability");
569 #if @GNULIB_GETDTABLESIZE@
570 /* Return the maximum number of file descriptors in the current process.
571 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
572 # if !@HAVE_GETDTABLESIZE@
573 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
575 _GL_CXXALIAS_SYS (getdtablesize, int, (void));
576 _GL_CXXALIASWARN (getdtablesize);
577 #elif defined GNULIB_POSIXCHECK
578 # undef getdtablesize
579 # if HAVE_RAW_DECL_GETDTABLESIZE
580 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
581 "use gnulib module getdtablesize for portability");
586 #if @GNULIB_GETGROUPS@
587 /* Return the supplemental groups that the current process belongs to.
588 It is unspecified whether the effective group id is in the list.
589 If N is 0, return the group count; otherwise, N describes how many
590 entries are available in GROUPS. Return -1 and set errno if N is
591 not 0 and not large enough. Fails with ENOSYS on some systems. */
592 # if @REPLACE_GETGROUPS@
593 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
595 # define getgroups rpl_getgroups
597 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
598 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
600 # if !@HAVE_GETGROUPS@
601 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
603 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
605 _GL_CXXALIASWARN (getgroups);
606 #elif defined GNULIB_POSIXCHECK
608 # if HAVE_RAW_DECL_GETGROUPS
609 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
610 "use gnulib module getgroups for portability");
615 #if @GNULIB_GETHOSTNAME@
616 /* Return the standard host name of the machine.
617 WARNING! The host name may or may not be fully qualified.
619 Put up to LEN bytes of the host name into NAME.
620 Null terminate it if the name is shorter than LEN.
621 If the host name is longer than LEN, set errno = EINVAL and return -1.
622 Return 0 if successful, otherwise set errno and return -1. */
623 # if @UNISTD_H_HAVE_WINSOCK2_H@
624 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
626 # define gethostname rpl_gethostname
628 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
629 _GL_ARG_NONNULL ((1)));
630 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
632 # if !@HAVE_GETHOSTNAME@
633 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
634 _GL_ARG_NONNULL ((1)));
636 /* Need to cast, because on Solaris 10 systems, the second parameter is
638 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
640 _GL_CXXALIASWARN (gethostname);
641 #elif @UNISTD_H_HAVE_WINSOCK2_H@
643 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
644 #elif defined GNULIB_POSIXCHECK
646 # if HAVE_RAW_DECL_GETHOSTNAME
647 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
648 "use gnulib module gethostname for portability");
653 #if @GNULIB_GETLOGIN@
654 /* Returns the user's login name, or NULL if it cannot be found. Upon error,
655 returns NULL with errno set.
657 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
659 Most programs don't need to use this function, because the information is
660 available through environment variables:
661 ${LOGNAME-$USER} on Unix platforms,
662 $USERNAME on native Windows platforms.
664 # if !@HAVE_GETLOGIN@
665 _GL_FUNCDECL_SYS (getlogin, char *, (void));
667 _GL_CXXALIAS_SYS (getlogin, char *, (void));
668 _GL_CXXALIASWARN (getlogin);
669 #elif defined GNULIB_POSIXCHECK
671 # if HAVE_RAW_DECL_GETLOGIN
672 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
673 "use gnulib module getlogin for portability");
678 #if @GNULIB_GETLOGIN_R@
679 /* Copies the user's login name to NAME.
680 The array pointed to by NAME has room for SIZE bytes.
682 Returns 0 if successful. Upon error, an error number is returned, or -1 in
683 the case that the login name cannot be found but no specific error is
684 provided (this case is hopefully rare but is left open by the POSIX spec).
686 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
688 Most programs don't need to use this function, because the information is
689 available through environment variables:
690 ${LOGNAME-$USER} on Unix platforms,
691 $USERNAME on native Windows platforms.
693 # if !@HAVE_DECL_GETLOGIN_R@
694 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
695 _GL_ARG_NONNULL ((1)));
697 /* Need to cast, because on Solaris 10 systems, the second argument is
699 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
700 _GL_CXXALIASWARN (getlogin_r);
701 #elif defined GNULIB_POSIXCHECK
703 # if HAVE_RAW_DECL_GETLOGIN_R
704 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
705 "use gnulib module getlogin_r for portability");
710 #if @GNULIB_GETPAGESIZE@
711 # if @REPLACE_GETPAGESIZE@
712 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
713 # define getpagesize rpl_getpagesize
715 _GL_FUNCDECL_RPL (getpagesize, int, (void));
716 _GL_CXXALIAS_RPL (getpagesize, int, (void));
718 # if !@HAVE_GETPAGESIZE@
719 # if !defined getpagesize
720 /* This is for POSIX systems. */
721 # if !defined _gl_getpagesize && defined _SC_PAGESIZE
722 # if ! (defined __VMS && __VMS_VER < 70000000)
723 # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
726 /* This is for older VMS. */
727 # if !defined _gl_getpagesize && defined __VMS
729 # define _gl_getpagesize() 8192
731 # define _gl_getpagesize() 512
734 /* This is for BeOS. */
735 # if !defined _gl_getpagesize && @HAVE_OS_H@
737 # if defined B_PAGE_SIZE
738 # define _gl_getpagesize() B_PAGE_SIZE
741 /* This is for AmigaOS4.0. */
742 # if !defined _gl_getpagesize && defined __amigaos4__
743 # define _gl_getpagesize() 2048
745 /* This is for older Unix systems. */
746 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
747 # include <sys/param.h>
748 # ifdef EXEC_PAGESIZE
749 # define _gl_getpagesize() EXEC_PAGESIZE
755 # define _gl_getpagesize() (NBPG * CLSIZE)
758 # define _gl_getpagesize() NBPC
763 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
764 # define getpagesize() _gl_getpagesize ()
769 return _gl_getpagesize ();
774 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
775 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
777 # if @HAVE_DECL_GETPAGESIZE@
778 _GL_CXXALIASWARN (getpagesize);
780 #elif defined GNULIB_POSIXCHECK
782 # if HAVE_RAW_DECL_GETPAGESIZE
783 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
784 "use gnulib module getpagesize for portability");
789 #if @GNULIB_GETUSERSHELL@
790 /* Return the next valid login shell on the system, or NULL when the end of
791 the list has been reached. */
792 # if !@HAVE_DECL_GETUSERSHELL@
793 _GL_FUNCDECL_SYS (getusershell, char *, (void));
795 _GL_CXXALIAS_SYS (getusershell, char *, (void));
796 _GL_CXXALIASWARN (getusershell);
797 #elif defined GNULIB_POSIXCHECK
799 # if HAVE_RAW_DECL_GETUSERSHELL
800 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
801 "use gnulib module getusershell for portability");
805 #if @GNULIB_GETUSERSHELL@
806 /* Rewind to pointer that is advanced at each getusershell() call. */
807 # if !@HAVE_DECL_GETUSERSHELL@
808 _GL_FUNCDECL_SYS (setusershell, void, (void));
810 _GL_CXXALIAS_SYS (setusershell, void, (void));
811 _GL_CXXALIASWARN (setusershell);
812 #elif defined GNULIB_POSIXCHECK
814 # if HAVE_RAW_DECL_SETUSERSHELL
815 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
816 "use gnulib module getusershell for portability");
820 #if @GNULIB_GETUSERSHELL@
821 /* Free the pointer that is advanced at each getusershell() call and
822 associated resources. */
823 # if !@HAVE_DECL_GETUSERSHELL@
824 _GL_FUNCDECL_SYS (endusershell, void, (void));
826 _GL_CXXALIAS_SYS (endusershell, void, (void));
827 _GL_CXXALIASWARN (endusershell);
828 #elif defined GNULIB_POSIXCHECK
830 # if HAVE_RAW_DECL_ENDUSERSHELL
831 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
832 "use gnulib module getusershell for portability");
838 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
839 to GID (if GID is not -1). Do not follow symbolic links.
840 Return 0 if successful, otherwise -1 and errno set.
841 See the POSIX:2001 specification
842 <http://www.opengroup.org/susv3xsh/lchown.html>. */
843 # if @REPLACE_LCHOWN@
844 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
846 # define lchown rpl_lchown
848 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
849 _GL_ARG_NONNULL ((1)));
850 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
853 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
854 _GL_ARG_NONNULL ((1)));
856 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
858 _GL_CXXALIASWARN (lchown);
859 #elif defined GNULIB_POSIXCHECK
861 # if HAVE_RAW_DECL_LCHOWN
862 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
863 "use gnulib module lchown for portability");
869 /* Create a new hard link for an existing file.
870 Return 0 if successful, otherwise -1 and errno set.
871 See POSIX:2001 specification
872 <http://www.opengroup.org/susv3xsh/link.html>. */
874 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
875 # define link rpl_link
877 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
878 _GL_ARG_NONNULL ((1, 2)));
879 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
882 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
883 _GL_ARG_NONNULL ((1, 2)));
885 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
887 _GL_CXXALIASWARN (link);
888 #elif defined GNULIB_POSIXCHECK
890 # if HAVE_RAW_DECL_LINK
891 _GL_WARN_ON_USE (link, "link is unportable - "
892 "use gnulib module link for portability");
898 /* Create a new hard link for an existing file, relative to two
899 directories. FLAG controls whether symlinks are followed.
900 Return 0 if successful, otherwise -1 and errno set. */
901 # if @REPLACE_LINKAT@
902 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
904 # define linkat rpl_linkat
906 _GL_FUNCDECL_RPL (linkat, int,
907 (int fd1, const char *path1, int fd2, const char *path2,
909 _GL_ARG_NONNULL ((2, 4)));
910 _GL_CXXALIAS_RPL (linkat, int,
911 (int fd1, const char *path1, int fd2, const char *path2,
915 _GL_FUNCDECL_SYS (linkat, int,
916 (int fd1, const char *path1, int fd2, const char *path2,
918 _GL_ARG_NONNULL ((2, 4)));
920 _GL_CXXALIAS_SYS (linkat, int,
921 (int fd1, const char *path1, int fd2, const char *path2,
924 _GL_CXXALIASWARN (linkat);
925 #elif defined GNULIB_POSIXCHECK
927 # if HAVE_RAW_DECL_LINKAT
928 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
929 "use gnulib module linkat for portability");
935 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
936 Return the new offset if successful, otherwise -1 and errno set.
937 See the POSIX:2001 specification
938 <http://www.opengroup.org/susv3xsh/lseek.html>. */
940 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
941 # define lseek rpl_lseek
943 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
944 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
946 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
948 _GL_CXXALIASWARN (lseek);
949 #elif defined GNULIB_POSIXCHECK
951 # if HAVE_RAW_DECL_LSEEK
952 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
953 "systems - use gnulib module lseek for portability");
959 /* Create a pipe, applying the given flags when opening the read-end of the
960 pipe and the write-end of the pipe.
961 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
962 and O_TEXT, O_BINARY (defined in "binary-io.h").
963 Store the read-end as fd[0] and the write-end as fd[1].
964 Return 0 upon success, or -1 with errno set upon failure.
965 See also the Linux man page at
966 <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
968 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
969 # define pipe2 rpl_pipe2
971 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
972 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
974 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
975 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
977 _GL_CXXALIASWARN (pipe2);
978 #elif defined GNULIB_POSIXCHECK
980 # if HAVE_RAW_DECL_PIPE2
981 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
982 "use gnulib module pipe2 for portability");
988 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
989 Return the number of bytes placed into BUF if successful, otherwise
990 set errno and return -1. 0 indicates EOF. See the POSIX:2001
991 specification <http://www.opengroup.org/susv3xsh/pread.html>. */
993 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
994 # define pread rpl_pread
996 _GL_FUNCDECL_RPL (pread, ssize_t,
997 (int fd, void *buf, size_t bufsize, off_t offset)
998 _GL_ARG_NONNULL ((2)));
999 _GL_CXXALIAS_RPL (pread, ssize_t,
1000 (int fd, void *buf, size_t bufsize, off_t offset));
1003 _GL_FUNCDECL_SYS (pread, ssize_t,
1004 (int fd, void *buf, size_t bufsize, off_t offset)
1005 _GL_ARG_NONNULL ((2)));
1007 _GL_CXXALIAS_SYS (pread, ssize_t,
1008 (int fd, void *buf, size_t bufsize, off_t offset));
1010 _GL_CXXALIASWARN (pread);
1011 #elif defined GNULIB_POSIXCHECK
1013 # if HAVE_RAW_DECL_PREAD
1014 _GL_WARN_ON_USE (pread, "pread is unportable - "
1015 "use gnulib module pread for portability");
1021 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1022 Return the number of bytes written if successful, otherwise
1023 set errno and return -1. 0 indicates nothing written. See the
1024 POSIX:2001 specification
1025 <http://www.opengroup.org/susv3xsh/pwrite.html>. */
1026 # if @REPLACE_PWRITE@
1027 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1028 # define pwrite rpl_pwrite
1030 _GL_FUNCDECL_RPL (pwrite, ssize_t,
1031 (int fd, const void *buf, size_t bufsize, off_t offset)
1032 _GL_ARG_NONNULL ((2)));
1033 _GL_CXXALIAS_RPL (pwrite, ssize_t,
1034 (int fd, const void *buf, size_t bufsize, off_t offset));
1037 _GL_FUNCDECL_SYS (pwrite, ssize_t,
1038 (int fd, const void *buf, size_t bufsize, off_t offset)
1039 _GL_ARG_NONNULL ((2)));
1041 _GL_CXXALIAS_SYS (pwrite, ssize_t,
1042 (int fd, const void *buf, size_t bufsize, off_t offset));
1044 _GL_CXXALIASWARN (pwrite);
1045 #elif defined GNULIB_POSIXCHECK
1047 # if HAVE_RAW_DECL_PWRITE
1048 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1049 "use gnulib module pwrite for portability");
1054 #if @GNULIB_READLINK@
1055 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
1056 bytes of it into BUF. Return the number of bytes placed into BUF if
1057 successful, otherwise -1 and errno set.
1058 See the POSIX:2001 specification
1059 <http://www.opengroup.org/susv3xsh/readlink.html>. */
1060 # if @REPLACE_READLINK@
1061 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1062 # define readlink rpl_readlink
1064 _GL_FUNCDECL_RPL (readlink, ssize_t,
1065 (const char *file, char *buf, size_t bufsize)
1066 _GL_ARG_NONNULL ((1, 2)));
1067 _GL_CXXALIAS_RPL (readlink, ssize_t,
1068 (const char *file, char *buf, size_t bufsize));
1070 # if !@HAVE_READLINK@
1071 _GL_FUNCDECL_SYS (readlink, ssize_t,
1072 (const char *file, char *buf, size_t bufsize)
1073 _GL_ARG_NONNULL ((1, 2)));
1075 _GL_CXXALIAS_SYS (readlink, ssize_t,
1076 (const char *file, char *buf, size_t bufsize));
1078 _GL_CXXALIASWARN (readlink);
1079 #elif defined GNULIB_POSIXCHECK
1081 # if HAVE_RAW_DECL_READLINK
1082 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1083 "use gnulib module readlink for portability");
1088 #if @GNULIB_READLINKAT@
1089 # if !@HAVE_READLINKAT@
1090 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
1091 (int fd, char const *file, char *buf, size_t len)
1092 _GL_ARG_NONNULL ((2, 3)));
1094 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
1095 (int fd, char const *file, char *buf, size_t len));
1096 _GL_CXXALIASWARN (readlinkat);
1097 #elif defined GNULIB_POSIXCHECK
1099 # if HAVE_RAW_DECL_READLINKAT
1100 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1101 "use gnulib module readlinkat for portability");
1107 /* Remove the directory DIR. */
1108 # if @REPLACE_RMDIR@
1109 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1110 # define rmdir rpl_rmdir
1112 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1113 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1115 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1117 _GL_CXXALIASWARN (rmdir);
1118 #elif defined GNULIB_POSIXCHECK
1120 # if HAVE_RAW_DECL_RMDIR
1121 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1122 "use gnulib module rmdir for portability");
1128 /* Pause the execution of the current thread for N seconds.
1129 Returns the number of seconds left to sleep.
1130 See the POSIX:2001 specification
1131 <http://www.opengroup.org/susv3xsh/sleep.html>. */
1132 # if @REPLACE_SLEEP@
1133 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1135 # define sleep rpl_sleep
1137 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1138 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1141 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1143 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1145 _GL_CXXALIASWARN (sleep);
1146 #elif defined GNULIB_POSIXCHECK
1148 # if HAVE_RAW_DECL_SLEEP
1149 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
1150 "use gnulib module sleep for portability");
1155 #if @GNULIB_SYMLINK@
1156 # if @REPLACE_SYMLINK@
1157 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1159 # define symlink rpl_symlink
1161 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1162 _GL_ARG_NONNULL ((1, 2)));
1163 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1165 # if !@HAVE_SYMLINK@
1166 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1167 _GL_ARG_NONNULL ((1, 2)));
1169 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1171 _GL_CXXALIASWARN (symlink);
1172 #elif defined GNULIB_POSIXCHECK
1174 # if HAVE_RAW_DECL_SYMLINK
1175 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
1176 "use gnulib module symlink for portability");
1181 #if @GNULIB_SYMLINKAT@
1182 # if !@HAVE_SYMLINKAT@
1183 _GL_FUNCDECL_SYS (symlinkat, int,
1184 (char const *contents, int fd, char const *file)
1185 _GL_ARG_NONNULL ((1, 3)));
1187 _GL_CXXALIAS_SYS (symlinkat, int,
1188 (char const *contents, int fd, char const *file));
1189 _GL_CXXALIASWARN (symlinkat);
1190 #elif defined GNULIB_POSIXCHECK
1192 # if HAVE_RAW_DECL_SYMLINKAT
1193 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1194 "use gnulib module symlinkat for portability");
1199 #if @GNULIB_TTYNAME_R@
1200 /* Store at most BUFLEN characters of the pathname of the terminal FD is
1201 open on in BUF. Return 0 on success, otherwise an error number. */
1202 # if @REPLACE_TTYNAME_R@
1203 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1205 # define ttyname_r rpl_ttyname_r
1207 _GL_FUNCDECL_RPL (ttyname_r, int,
1208 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1209 _GL_CXXALIAS_RPL (ttyname_r, int,
1210 (int fd, char *buf, size_t buflen));
1212 # if !@HAVE_TTYNAME_R@
1213 _GL_FUNCDECL_SYS (ttyname_r, int,
1214 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1216 _GL_CXXALIAS_SYS (ttyname_r, int,
1217 (int fd, char *buf, size_t buflen));
1219 _GL_CXXALIASWARN (ttyname_r);
1220 #elif defined GNULIB_POSIXCHECK
1222 # if HAVE_RAW_DECL_TTYNAME_R
1223 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1224 "use gnulib module ttyname_r for portability");
1230 # if @REPLACE_UNLINK@
1231 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1233 # define unlink rpl_unlink
1235 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1236 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
1238 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
1240 _GL_CXXALIASWARN (unlink);
1241 #elif defined GNULIB_POSIXCHECK
1243 # if HAVE_RAW_DECL_UNLINK
1244 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
1245 "use gnulib module unlink for portability");
1250 #if @GNULIB_UNLINKAT@
1251 # if @REPLACE_UNLINKAT@
1252 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1254 # define unlinkat rpl_unlinkat
1256 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1257 _GL_ARG_NONNULL ((2)));
1258 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1260 # if !@HAVE_UNLINKAT@
1261 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1262 _GL_ARG_NONNULL ((2)));
1264 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1266 _GL_CXXALIASWARN (unlinkat);
1267 #elif defined GNULIB_POSIXCHECK
1269 # if HAVE_RAW_DECL_UNLINKAT
1270 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1271 "use gnulib module openat for portability");
1277 /* Pause the execution of the current thread for N microseconds.
1278 Returns 0 on completion, or -1 on range error.
1279 See the POSIX:2001 specification
1280 <http://www.opengroup.org/susv3xsh/sleep.html>. */
1281 # if @REPLACE_USLEEP@
1282 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1284 # define usleep rpl_usleep
1286 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1287 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1290 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1292 _GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
1294 _GL_CXXALIASWARN (usleep);
1295 #elif defined GNULIB_POSIXCHECK
1297 # if HAVE_RAW_DECL_USLEEP
1298 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1299 "use gnulib module usleep for portability");
1305 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
1306 See the POSIX:2001 specification
1307 <http://www.opengroup.org/susv3xsh/write.html>. */
1308 # if @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
1309 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1311 # define write rpl_write
1313 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1314 _GL_ARG_NONNULL ((2)));
1315 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1317 /* Need to cast, because on mingw, the third parameter is
1319 and the return type is 'int'. */
1320 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1322 _GL_CXXALIASWARN (write);
1326 #endif /* _GL_UNISTD_H */
1327 #endif /* _GL_UNISTD_H */