Merge remote-tracking branch 'origin/stable-2.0'
[bpt/guile.git] / lib / unistd.in.h
CommitLineData
9b36a80c 1/* Substitute for and wrapper around <unistd.h>.
af07e104 2 Copyright (C) 2003-2013 Free Software Foundation, Inc.
9b36a80c
LC
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
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 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
005de2e8 15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
9b36a80c 16
af07e104
AW
17#ifndef _@GUARD_PREFIX@_UNISTD_H
18
9b36a80c
LC
19#if __GNUC__ >= 3
20@PRAGMA_SYSTEM_HEADER@
21#endif
0f00f2c3 22@PRAGMA_COLUMNS@
9b36a80c
LC
23
24/* The include_next requires a split double-inclusion guard. */
25#if @HAVE_UNISTD_H@
26# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
27#endif
28
a927b6c1
LC
29/* Get all possible declarations of gethostname(). */
30#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
31 && !defined _GL_INCLUDING_WINSOCK2_H
32# define _GL_INCLUDING_WINSOCK2_H
33# include <winsock2.h>
34# undef _GL_INCLUDING_WINSOCK2_H
35#endif
36
3d458a81
AW
37#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
38#define _@GUARD_PREFIX@_UNISTD_H
9b36a80c 39
8912421c
LC
40/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
41#include <stddef.h>
42
f240aacb 43/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
61cd9dc9
LC
44/* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
45/* But avoid namespace pollution on glibc systems. */
46#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
0f00f2c3
LC
47 || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
48 && defined __CYGWIN__)) \
61cd9dc9 49 && ! defined __GLIBC__
9b36a80c
LC
50# include <stdio.h>
51#endif
52
61cd9dc9
LC
53/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>. */
54/* But avoid namespace pollution on glibc systems. */
0f00f2c3
LC
55#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
56 && ! defined __GLIBC__
61cd9dc9
LC
57# include <fcntl.h>
58#endif
59
9b36a80c 60/* mingw fails to declare _exit in <unistd.h>. */
35428fb6
LC
61/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
62 <unistd.h>. */
61cd9dc9
LC
63/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
64/* But avoid namespace pollution on glibc systems. */
65#ifndef __GLIBC__
af07e104 66# define __need_system_stdlib_h
61cd9dc9 67# include <stdlib.h>
af07e104 68# undef __need_system_stdlib_h
61cd9dc9 69#endif
9b36a80c 70
35428fb6 71/* Native Windows platforms declare chdir, getcwd, rmdir in
f0007cad
LC
72 <io.h> and/or <direct.h>, not in <unistd.h>.
73 They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
74 lseek(), read(), unlink(), write() in <io.h>. */
35428fb6
LC
75#if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
76 || defined GNULIB_POSIXCHECK) \
61cd9dc9 77 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
35428fb6
LC
78# include <io.h> /* mingw32, mingw64 */
79# include <direct.h> /* mingw64, MSVC 9 */
f0007cad
LC
80#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
81 || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
82 || defined GNULIB_POSIXCHECK) \
83 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
84# include <io.h>
61cd9dc9
LC
85#endif
86
49114fd4
LC
87/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
88 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
0f00f2c3 89/* But avoid namespace pollution on glibc systems. */
49114fd4
LC
90#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
91 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
0f00f2c3
LC
92 && !defined __GLIBC__
93# include <netdb.h>
94#endif
95
005de2e8
LC
96/* MSVC defines off_t in <sys/types.h>.
97 May also define off_t to a 64-bit type on native Windows. */
98#if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
35428fb6
LC
99/* Get off_t. */
100# include <sys/types.h>
101#endif
102
dd7d0148
LC
103#if (@GNULIB_READ@ || @GNULIB_WRITE@ \
104 || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \
a927b6c1 105 || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK)
9b36a80c
LC
106/* Get ssize_t. */
107# include <sys/types.h>
108#endif
109
61cd9dc9
LC
110/* Get getopt(), optarg, optind, opterr, optopt.
111 But avoid namespace pollution on glibc systems. */
112#if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
af07e104 113# define __need_getopt
8912421c
LC
114# include <getopt.h>
115#endif
116
af07e104
AW
117_GL_INLINE_HEADER_BEGIN
118#ifndef _GL_UNISTD_INLINE
119# define _GL_UNISTD_INLINE _GL_INLINE
120#endif
121
a927b6c1
LC
122/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
123
124/* The definition of _GL_ARG_NONNULL is copied here. */
125
126/* The definition of _GL_WARN_ON_USE is copied here. */
127
128
35428fb6
LC
129/* Hide some function declarations from <winsock2.h>. */
130
131#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
132# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
133# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
134# undef socket
135# define socket socket_used_without_including_sys_socket_h
136# undef connect
137# define connect connect_used_without_including_sys_socket_h
138# undef accept
139# define accept accept_used_without_including_sys_socket_h
140# undef bind
141# define bind bind_used_without_including_sys_socket_h
142# undef getpeername
143# define getpeername getpeername_used_without_including_sys_socket_h
144# undef getsockname
145# define getsockname getsockname_used_without_including_sys_socket_h
146# undef getsockopt
147# define getsockopt getsockopt_used_without_including_sys_socket_h
148# undef listen
149# define listen listen_used_without_including_sys_socket_h
150# undef recv
151# define recv recv_used_without_including_sys_socket_h
152# undef send
153# define send send_used_without_including_sys_socket_h
154# undef recvfrom
155# define recvfrom recvfrom_used_without_including_sys_socket_h
156# undef sendto
157# define sendto sendto_used_without_including_sys_socket_h
158# undef setsockopt
159# define setsockopt setsockopt_used_without_including_sys_socket_h
160# undef shutdown
161# define shutdown shutdown_used_without_including_sys_socket_h
162# else
163 _GL_WARN_ON_USE (socket,
164 "socket() used without including <sys/socket.h>");
165 _GL_WARN_ON_USE (connect,
166 "connect() used without including <sys/socket.h>");
167 _GL_WARN_ON_USE (accept,
168 "accept() used without including <sys/socket.h>");
169 _GL_WARN_ON_USE (bind,
170 "bind() used without including <sys/socket.h>");
171 _GL_WARN_ON_USE (getpeername,
172 "getpeername() used without including <sys/socket.h>");
173 _GL_WARN_ON_USE (getsockname,
174 "getsockname() used without including <sys/socket.h>");
175 _GL_WARN_ON_USE (getsockopt,
176 "getsockopt() used without including <sys/socket.h>");
177 _GL_WARN_ON_USE (listen,
178 "listen() used without including <sys/socket.h>");
179 _GL_WARN_ON_USE (recv,
180 "recv() used without including <sys/socket.h>");
181 _GL_WARN_ON_USE (send,
182 "send() used without including <sys/socket.h>");
183 _GL_WARN_ON_USE (recvfrom,
184 "recvfrom() used without including <sys/socket.h>");
185 _GL_WARN_ON_USE (sendto,
186 "sendto() used without including <sys/socket.h>");
187 _GL_WARN_ON_USE (setsockopt,
188 "setsockopt() used without including <sys/socket.h>");
189 _GL_WARN_ON_USE (shutdown,
190 "shutdown() used without including <sys/socket.h>");
9b36a80c 191# endif
35428fb6
LC
192# endif
193# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
194# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
195# undef select
196# define select select_used_without_including_sys_select_h
197# else
198 _GL_WARN_ON_USE (select,
199 "select() used without including <sys/select.h>");
9b36a80c
LC
200# endif
201# endif
202#endif
203
9b36a80c 204
f240aacb
LC
205/* OS/2 EMX lacks these macros. */
206#ifndef STDIN_FILENO
207# define STDIN_FILENO 0
208#endif
209#ifndef STDOUT_FILENO
210# define STDOUT_FILENO 1
211#endif
212#ifndef STDERR_FILENO
213# define STDERR_FILENO 2
214#endif
215
8912421c
LC
216/* Ensure *_OK macros exist. */
217#ifndef F_OK
218# define F_OK 0
219# define X_OK 1
220# define W_OK 2
221# define R_OK 4
222#endif
223
224
9b36a80c
LC
225/* Declare overridden functions. */
226
f4c79b3c
LC
227
228#if defined GNULIB_POSIXCHECK
229/* The access() function is a security risk. */
230_GL_WARN_ON_USE (access, "the access function is a security risk - "
231 "use the gnulib module faccessat instead");
9b36a80c
LC
232#endif
233
234
35428fb6
LC
235#if @GNULIB_CHDIR@
236_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
237_GL_CXXALIASWARN (chdir);
238#elif defined GNULIB_POSIXCHECK
239# undef chdir
240# if HAVE_RAW_DECL_CHDIR
241_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
242 "use gnulib module chdir for portability");
243# endif
244#endif
245
246
9b36a80c 247#if @GNULIB_CHOWN@
9b36a80c
LC
248/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
249 to GID (if GID is not -1). Follow symbolic links.
250 Return 0 if successful, otherwise -1 and errno set.
35428fb6
LC
251 See the POSIX:2008 specification
252 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
f4c79b3c
LC
253# if @REPLACE_CHOWN@
254# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
255# undef chown
256# define chown rpl_chown
257# endif
258_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
259 _GL_ARG_NONNULL ((1)));
260_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
261# else
262# if !@HAVE_CHOWN@
263_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
264 _GL_ARG_NONNULL ((1)));
265# endif
266_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
9b36a80c 267# endif
f4c79b3c 268_GL_CXXALIASWARN (chown);
9b36a80c
LC
269#elif defined GNULIB_POSIXCHECK
270# undef chown
61cd9dc9
LC
271# if HAVE_RAW_DECL_CHOWN
272_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
273 "doesn't treat a uid or gid of -1 on some systems - "
274 "use gnulib module chown for portability");
275# endif
9b36a80c
LC
276#endif
277
278
279#if @GNULIB_CLOSE@
9b36a80c
LC
280# if @REPLACE_CLOSE@
281/* Automatically included by modules that need a replacement for close. */
f4c79b3c
LC
282# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
283# undef close
284# define close rpl_close
285# endif
286_GL_FUNCDECL_RPL (close, int, (int fd));
287_GL_CXXALIAS_RPL (close, int, (int fd));
288# else
289_GL_CXXALIAS_SYS (close, int, (int fd));
9b36a80c 290# endif
f4c79b3c 291_GL_CXXALIASWARN (close);
8912421c 292#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
9b36a80c
LC
293# undef close
294# define close close_used_without_requesting_gnulib_module_close
295#elif defined GNULIB_POSIXCHECK
296# undef close
61cd9dc9
LC
297/* Assume close is always declared. */
298_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
299 "use gnulib module close for portability");
9b36a80c
LC
300#endif
301
302
35428fb6
LC
303#if @GNULIB_DUP@
304# if @REPLACE_DUP@
305# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
306# define dup rpl_dup
307# endif
f4c79b3c
LC
308_GL_FUNCDECL_RPL (dup, int, (int oldfd));
309_GL_CXXALIAS_RPL (dup, int, (int oldfd));
35428fb6 310# else
f4c79b3c 311_GL_CXXALIAS_SYS (dup, int, (int oldfd));
35428fb6 312# endif
f4c79b3c 313_GL_CXXALIASWARN (dup);
35428fb6
LC
314#elif defined GNULIB_POSIXCHECK
315# undef dup
316# if HAVE_RAW_DECL_DUP
317_GL_WARN_ON_USE (dup, "dup is unportable - "
318 "use gnulib module dup for portability");
319# endif
320#endif
8912421c
LC
321
322
9b36a80c 323#if @GNULIB_DUP2@
9b36a80c
LC
324/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
325 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
25361e4b 326 Return newfd if successful, otherwise -1 and errno set.
35428fb6
LC
327 See the POSIX:2008 specification
328 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
f4c79b3c
LC
329# if @REPLACE_DUP2@
330# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
331# define dup2 rpl_dup2
332# endif
333_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
334_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
335# else
336# if !@HAVE_DUP2@
337_GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
338# endif
339_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
9b36a80c 340# endif
f4c79b3c 341_GL_CXXALIASWARN (dup2);
9b36a80c
LC
342#elif defined GNULIB_POSIXCHECK
343# undef dup2
61cd9dc9
LC
344# if HAVE_RAW_DECL_DUP2
345_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
346 "use gnulib module dup2 for portability");
347# endif
9b36a80c
LC
348#endif
349
350
8912421c
LC
351#if @GNULIB_DUP3@
352/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
353 specified flags.
354 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
355 and O_TEXT, O_BINARY (defined in "binary-io.h").
356 Close NEWFD first if it is open.
357 Return newfd if successful, otherwise -1 and errno set.
358 See the Linux man page at
359 <http://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
360# if @HAVE_DUP3@
f4c79b3c
LC
361# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
362# define dup3 rpl_dup3
363# endif
364_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
365_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
366# else
367_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
368_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
8912421c 369# endif
f4c79b3c 370_GL_CXXALIASWARN (dup3);
8912421c
LC
371#elif defined GNULIB_POSIXCHECK
372# undef dup3
61cd9dc9
LC
373# if HAVE_RAW_DECL_DUP3
374_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
375 "use gnulib module dup3 for portability");
376# endif
8912421c
LC
377#endif
378
379
9b36a80c
LC
380#if @GNULIB_ENVIRON@
381# if !@HAVE_DECL_ENVIRON@
382/* Set of environment variables and values. An array of strings of the form
383 "VARIABLE=VALUE", terminated with a NULL. */
384# if defined __APPLE__ && defined __MACH__
385# include <crt_externs.h>
386# define environ (*_NSGetEnviron ())
387# else
f4c79b3c
LC
388# ifdef __cplusplus
389extern "C" {
390# endif
9b36a80c 391extern char **environ;
f4c79b3c
LC
392# ifdef __cplusplus
393}
394# endif
9b36a80c
LC
395# endif
396# endif
397#elif defined GNULIB_POSIXCHECK
61cd9dc9 398# if HAVE_RAW_DECL_ENVIRON
af07e104 399_GL_UNISTD_INLINE char ***
61cd9dc9
LC
400rpl_environ (void)
401{
402 return &environ;
403}
404_GL_WARN_ON_USE (rpl_environ, "environ is unportable - "
405 "use gnulib module environ for portability");
406# undef environ
407# define environ (*rpl_environ ())
408# endif
9b36a80c
LC
409#endif
410
411
412#if @GNULIB_EUIDACCESS@
8912421c 413/* Like access(), except that it uses the effective user id and group id of
9b36a80c 414 the current process. */
f4c79b3c
LC
415# if !@HAVE_EUIDACCESS@
416_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
417 _GL_ARG_NONNULL ((1)));
418# endif
419_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
420_GL_CXXALIASWARN (euidaccess);
421# if defined GNULIB_POSIXCHECK
422/* Like access(), this function is a security risk. */
423_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
424 "use the gnulib module faccessat instead");
9b36a80c
LC
425# endif
426#elif defined GNULIB_POSIXCHECK
427# undef euidaccess
61cd9dc9
LC
428# if HAVE_RAW_DECL_EUIDACCESS
429_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
430 "use gnulib module euidaccess for portability");
431# endif
9b36a80c
LC
432#endif
433
434
8912421c
LC
435#if @GNULIB_FACCESSAT@
436# if !@HAVE_FACCESSAT@
f4c79b3c
LC
437_GL_FUNCDECL_SYS (faccessat, int,
438 (int fd, char const *file, int mode, int flag)
439 _GL_ARG_NONNULL ((2)));
8912421c 440# endif
f4c79b3c
LC
441_GL_CXXALIAS_SYS (faccessat, int,
442 (int fd, char const *file, int mode, int flag));
443_GL_CXXALIASWARN (faccessat);
8912421c
LC
444#elif defined GNULIB_POSIXCHECK
445# undef faccessat
61cd9dc9
LC
446# if HAVE_RAW_DECL_FACCESSAT
447_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
448 "use gnulib module faccessat for portability");
449# endif
8912421c
LC
450#endif
451
452
9b36a80c 453#if @GNULIB_FCHDIR@
9b36a80c
LC
454/* Change the process' current working directory to the directory on which
455 the given file descriptor is open.
456 Return 0 if successful, otherwise -1 and errno set.
35428fb6
LC
457 See the POSIX:2008 specification
458 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
a927b6c1
LC
459# if ! @HAVE_FCHDIR@
460_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
9b36a80c 461
8912421c 462/* Gnulib internal hooks needed to maintain the fchdir metadata. */
f4c79b3c 463_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
1cd4fffc 464 _GL_ARG_NONNULL ((2));
f4c79b3c
LC
465_GL_EXTERN_C void _gl_unregister_fd (int fd);
466_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
467_GL_EXTERN_C const char *_gl_directory_name (int fd);
9b36a80c 468
ab4d62ad
LC
469# else
470# if !@HAVE_DECL_FCHDIR@
471_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
472# endif
9b36a80c 473# endif
a927b6c1 474_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
f4c79b3c 475_GL_CXXALIASWARN (fchdir);
9b36a80c
LC
476#elif defined GNULIB_POSIXCHECK
477# undef fchdir
61cd9dc9
LC
478# if HAVE_RAW_DECL_FCHDIR
479_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
480 "use gnulib module fchdir for portability");
481# endif
9b36a80c
LC
482#endif
483
484
8912421c
LC
485#if @GNULIB_FCHOWNAT@
486# if @REPLACE_FCHOWNAT@
f4c79b3c
LC
487# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
488# undef fchownat
489# define fchownat rpl_fchownat
490# endif
491_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
492 uid_t owner, gid_t group, int flag)
493 _GL_ARG_NONNULL ((2)));
494_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
495 uid_t owner, gid_t group, int flag));
496# else
497# if !@HAVE_FCHOWNAT@
498_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
499 uid_t owner, gid_t group, int flag)
500 _GL_ARG_NONNULL ((2)));
501# endif
502_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
503 uid_t owner, gid_t group, int flag));
8912421c 504# endif
f4c79b3c 505_GL_CXXALIASWARN (fchownat);
8912421c
LC
506#elif defined GNULIB_POSIXCHECK
507# undef fchownat
61cd9dc9
LC
508# if HAVE_RAW_DECL_FCHOWNAT
509_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
510 "use gnulib module openat for portability");
511# endif
8912421c
LC
512#endif
513
514
35428fb6 515#if @GNULIB_FDATASYNC@
9b36a80c
LC
516/* Synchronize changes to a file.
517 Return 0 if successful, otherwise -1 and errno set.
35428fb6
LC
518 See POSIX:2008 specification
519 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
520# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
521_GL_FUNCDECL_SYS (fdatasync, int, (int fd));
522# endif
523_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
524_GL_CXXALIASWARN (fdatasync);
525#elif defined GNULIB_POSIXCHECK
526# undef fdatasync
527# if HAVE_RAW_DECL_FDATASYNC
528_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
529 "use gnulib module fdatasync for portability");
530# endif
531#endif
532
533
534#if @GNULIB_FSYNC@
535/* Synchronize changes, including metadata, to a file.
536 Return 0 if successful, otherwise -1 and errno set.
537 See POSIX:2008 specification
538 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
9b36a80c 539# if !@HAVE_FSYNC@
f4c79b3c 540_GL_FUNCDECL_SYS (fsync, int, (int fd));
9b36a80c 541# endif
f4c79b3c
LC
542_GL_CXXALIAS_SYS (fsync, int, (int fd));
543_GL_CXXALIASWARN (fsync);
9b36a80c
LC
544#elif defined GNULIB_POSIXCHECK
545# undef fsync
61cd9dc9
LC
546# if HAVE_RAW_DECL_FSYNC
547_GL_WARN_ON_USE (fsync, "fsync is unportable - "
548 "use gnulib module fsync for portability");
549# endif
9b36a80c
LC
550#endif
551
552
553#if @GNULIB_FTRUNCATE@
9b36a80c
LC
554/* Change the size of the file to which FD is opened to become equal to LENGTH.
555 Return 0 if successful, otherwise -1 and errno set.
35428fb6
LC
556 See the POSIX:2008 specification
557 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
005de2e8
LC
558# if @REPLACE_FTRUNCATE@
559# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
560# undef ftruncate
561# define ftruncate rpl_ftruncate
562# endif
563_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
564_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
565# else
566# if !@HAVE_FTRUNCATE@
f4c79b3c 567_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
005de2e8 568# endif
f4c79b3c 569_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
005de2e8 570# endif
f4c79b3c 571_GL_CXXALIASWARN (ftruncate);
9b36a80c
LC
572#elif defined GNULIB_POSIXCHECK
573# undef ftruncate
61cd9dc9
LC
574# if HAVE_RAW_DECL_FTRUNCATE
575_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
576 "use gnulib module ftruncate for portability");
577# endif
9b36a80c
LC
578#endif
579
580
581#if @GNULIB_GETCWD@
9b36a80c
LC
582/* Get the name of the current working directory, and put it in SIZE bytes
583 of BUF.
584 Return BUF if successful, or NULL if the directory couldn't be determined
585 or SIZE was too small.
35428fb6
LC
586 See the POSIX:2008 specification
587 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
9b36a80c
LC
588 Additionally, the gnulib module 'getcwd' guarantees the following GNU
589 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
590 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
591 necessary. */
f4c79b3c
LC
592# if @REPLACE_GETCWD@
593# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
594# define getcwd rpl_getcwd
595# endif
596_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
597_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
598# else
a927b6c1
LC
599/* Need to cast, because on mingw, the second parameter is
600 int size. */
601_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
9b36a80c 602# endif
f4c79b3c 603_GL_CXXALIASWARN (getcwd);
9b36a80c
LC
604#elif defined GNULIB_POSIXCHECK
605# undef getcwd
61cd9dc9
LC
606# if HAVE_RAW_DECL_GETCWD
607_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
608 "use gnulib module getcwd for portability");
609# endif
9b36a80c
LC
610#endif
611
612
613#if @GNULIB_GETDOMAINNAME@
614/* Return the NIS domain name of the machine.
615 WARNING! The NIS domain name is unrelated to the fully qualified host name
616 of the machine. It is also unrelated to email addresses.
617 WARNING! The NIS domain name is usually the empty string or "(none)" when
618 not using NIS.
619
620 Put up to LEN bytes of the NIS domain name into NAME.
621 Null terminate it if the name is shorter than LEN.
622 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
623 Return 0 if successful, otherwise set errno and return -1. */
0f00f2c3
LC
624# if @REPLACE_GETDOMAINNAME@
625# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
626# undef getdomainname
627# define getdomainname rpl_getdomainname
628# endif
629_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
630 _GL_ARG_NONNULL ((1)));
631_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
632# else
633# if !@HAVE_DECL_GETDOMAINNAME@
f4c79b3c
LC
634_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
635 _GL_ARG_NONNULL ((1)));
0f00f2c3
LC
636# endif
637_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
9b36a80c 638# endif
f4c79b3c 639_GL_CXXALIASWARN (getdomainname);
9b36a80c
LC
640#elif defined GNULIB_POSIXCHECK
641# undef getdomainname
61cd9dc9
LC
642# if HAVE_RAW_DECL_GETDOMAINNAME
643_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
644 "use gnulib module getdomainname for portability");
645# endif
9b36a80c
LC
646#endif
647
648
649#if @GNULIB_GETDTABLESIZE@
8912421c
LC
650/* Return the maximum number of file descriptors in the current process.
651 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
f4c79b3c
LC
652# if !@HAVE_GETDTABLESIZE@
653_GL_FUNCDECL_SYS (getdtablesize, int, (void));
9b36a80c 654# endif
f4c79b3c
LC
655_GL_CXXALIAS_SYS (getdtablesize, int, (void));
656_GL_CXXALIASWARN (getdtablesize);
9b36a80c
LC
657#elif defined GNULIB_POSIXCHECK
658# undef getdtablesize
61cd9dc9
LC
659# if HAVE_RAW_DECL_GETDTABLESIZE
660_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
661 "use gnulib module getdtablesize for portability");
662# endif
9b36a80c
LC
663#endif
664
665
f29ded4b 666#if @GNULIB_GETGROUPS@
f29ded4b
LC
667/* Return the supplemental groups that the current process belongs to.
668 It is unspecified whether the effective group id is in the list.
669 If N is 0, return the group count; otherwise, N describes how many
670 entries are available in GROUPS. Return -1 and set errno if N is
671 not 0 and not large enough. Fails with ENOSYS on some systems. */
f4c79b3c
LC
672# if @REPLACE_GETGROUPS@
673# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
674# undef getgroups
675# define getgroups rpl_getgroups
676# endif
677_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
678_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
679# else
680# if !@HAVE_GETGROUPS@
681_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
682# endif
683_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
f29ded4b 684# endif
f4c79b3c 685_GL_CXXALIASWARN (getgroups);
f29ded4b
LC
686#elif defined GNULIB_POSIXCHECK
687# undef getgroups
61cd9dc9
LC
688# if HAVE_RAW_DECL_GETGROUPS
689_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
690 "use gnulib module getgroups for portability");
691# endif
f29ded4b
LC
692#endif
693
694
9b36a80c
LC
695#if @GNULIB_GETHOSTNAME@
696/* Return the standard host name of the machine.
697 WARNING! The host name may or may not be fully qualified.
698
699 Put up to LEN bytes of the host name into NAME.
700 Null terminate it if the name is shorter than LEN.
701 If the host name is longer than LEN, set errno = EINVAL and return -1.
702 Return 0 if successful, otherwise set errno and return -1. */
703# if @UNISTD_H_HAVE_WINSOCK2_H@
f4c79b3c
LC
704# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
705# undef gethostname
706# define gethostname rpl_gethostname
707# endif
708_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
709 _GL_ARG_NONNULL ((1)));
710_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
711# else
712# if !@HAVE_GETHOSTNAME@
713_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
714 _GL_ARG_NONNULL ((1)));
715# endif
ab4d62ad
LC
716/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
717 parameter is
f4c79b3c
LC
718 int len. */
719_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
9b36a80c 720# endif
f4c79b3c 721_GL_CXXALIASWARN (gethostname);
9b36a80c
LC
722#elif @UNISTD_H_HAVE_WINSOCK2_H@
723# undef gethostname
724# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
725#elif defined GNULIB_POSIXCHECK
726# undef gethostname
61cd9dc9
LC
727# if HAVE_RAW_DECL_GETHOSTNAME
728_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
729 "use gnulib module gethostname for portability");
730# endif
731#endif
732
733
734#if @GNULIB_GETLOGIN@
735/* Returns the user's login name, or NULL if it cannot be found. Upon error,
736 returns NULL with errno set.
737
738 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
739
740 Most programs don't need to use this function, because the information is
741 available through environment variables:
742 ${LOGNAME-$USER} on Unix platforms,
743 $USERNAME on native Windows platforms.
744 */
745# if !@HAVE_GETLOGIN@
f4c79b3c 746_GL_FUNCDECL_SYS (getlogin, char *, (void));
61cd9dc9 747# endif
f4c79b3c
LC
748_GL_CXXALIAS_SYS (getlogin, char *, (void));
749_GL_CXXALIASWARN (getlogin);
61cd9dc9
LC
750#elif defined GNULIB_POSIXCHECK
751# undef getlogin
752# if HAVE_RAW_DECL_GETLOGIN
753_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
754 "use gnulib module getlogin for portability");
755# endif
9b36a80c
LC
756#endif
757
758
759#if @GNULIB_GETLOGIN_R@
760/* Copies the user's login name to NAME.
761 The array pointed to by NAME has room for SIZE bytes.
762
763 Returns 0 if successful. Upon error, an error number is returned, or -1 in
764 the case that the login name cannot be found but no specific error is
765 provided (this case is hopefully rare but is left open by the POSIX spec).
766
767 See <http://www.opengroup.org/susv3xsh/getlogin.html>.
61cd9dc9
LC
768
769 Most programs don't need to use this function, because the information is
770 available through environment variables:
771 ${LOGNAME-$USER} on Unix platforms,
772 $USERNAME on native Windows platforms.
9b36a80c 773 */
49114fd4
LC
774# if @REPLACE_GETLOGIN_R@
775# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
776# define getlogin_r rpl_getlogin_r
777# endif
778_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
779 _GL_ARG_NONNULL ((1)));
780_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
781# else
782# if !@HAVE_DECL_GETLOGIN_R@
f4c79b3c
LC
783_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
784 _GL_ARG_NONNULL ((1)));
49114fd4 785# endif
f4c79b3c
LC
786/* Need to cast, because on Solaris 10 systems, the second argument is
787 int size. */
788_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
49114fd4 789# endif
f4c79b3c 790_GL_CXXALIASWARN (getlogin_r);
9b36a80c
LC
791#elif defined GNULIB_POSIXCHECK
792# undef getlogin_r
61cd9dc9
LC
793# if HAVE_RAW_DECL_GETLOGIN_R
794_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
795 "use gnulib module getlogin_r for portability");
796# endif
9b36a80c
LC
797#endif
798
799
800#if @GNULIB_GETPAGESIZE@
801# if @REPLACE_GETPAGESIZE@
f4c79b3c
LC
802# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
803# define getpagesize rpl_getpagesize
9b36a80c 804# endif
f4c79b3c
LC
805_GL_FUNCDECL_RPL (getpagesize, int, (void));
806_GL_CXXALIAS_RPL (getpagesize, int, (void));
807# else
808# if !@HAVE_GETPAGESIZE@
809# if !defined getpagesize
810/* This is for POSIX systems. */
811# if !defined _gl_getpagesize && defined _SC_PAGESIZE
812# if ! (defined __VMS && __VMS_VER < 70000000)
813# define _gl_getpagesize() sysconf (_SC_PAGESIZE)
814# endif
815# endif
9b36a80c 816/* This is for older VMS. */
f4c79b3c
LC
817# if !defined _gl_getpagesize && defined __VMS
818# ifdef __ALPHA
819# define _gl_getpagesize() 8192
820# else
821# define _gl_getpagesize() 512
822# endif
823# endif
9b36a80c 824/* This is for BeOS. */
f4c79b3c
LC
825# if !defined _gl_getpagesize && @HAVE_OS_H@
826# include <OS.h>
827# if defined B_PAGE_SIZE
828# define _gl_getpagesize() B_PAGE_SIZE
829# endif
830# endif
9b36a80c 831/* This is for AmigaOS4.0. */
f4c79b3c
LC
832# if !defined _gl_getpagesize && defined __amigaos4__
833# define _gl_getpagesize() 2048
834# endif
9b36a80c 835/* This is for older Unix systems. */
f4c79b3c
LC
836# if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
837# include <sys/param.h>
838# ifdef EXEC_PAGESIZE
839# define _gl_getpagesize() EXEC_PAGESIZE
840# else
841# ifdef NBPG
842# ifndef CLSIZE
843# define CLSIZE 1
844# endif
845# define _gl_getpagesize() (NBPG * CLSIZE)
846# else
847# ifdef NBPC
848# define _gl_getpagesize() NBPC
849# endif
850# endif
9b36a80c 851# endif
f4c79b3c
LC
852# endif
853# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
854# define getpagesize() _gl_getpagesize ()
9b36a80c 855# else
49114fd4 856# if !GNULIB_defined_getpagesize_function
af07e104 857_GL_UNISTD_INLINE int
f4c79b3c
LC
858getpagesize ()
859{
860 return _gl_getpagesize ();
861}
49114fd4
LC
862# define GNULIB_defined_getpagesize_function 1
863# endif
9b36a80c
LC
864# endif
865# endif
866# endif
f4c79b3c
LC
867/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
868_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
9b36a80c 869# endif
a927b6c1 870# if @HAVE_DECL_GETPAGESIZE@
f4c79b3c 871_GL_CXXALIASWARN (getpagesize);
a927b6c1 872# endif
9b36a80c
LC
873#elif defined GNULIB_POSIXCHECK
874# undef getpagesize
61cd9dc9
LC
875# if HAVE_RAW_DECL_GETPAGESIZE
876_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
877 "use gnulib module getpagesize for portability");
878# endif
9b36a80c
LC
879#endif
880
881
882#if @GNULIB_GETUSERSHELL@
9b36a80c
LC
883/* Return the next valid login shell on the system, or NULL when the end of
884 the list has been reached. */
a927b6c1 885# if !@HAVE_DECL_GETUSERSHELL@
f4c79b3c 886_GL_FUNCDECL_SYS (getusershell, char *, (void));
9b36a80c 887# endif
f4c79b3c
LC
888_GL_CXXALIAS_SYS (getusershell, char *, (void));
889_GL_CXXALIASWARN (getusershell);
9b36a80c
LC
890#elif defined GNULIB_POSIXCHECK
891# undef getusershell
61cd9dc9
LC
892# if HAVE_RAW_DECL_GETUSERSHELL
893_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
894 "use gnulib module getusershell for portability");
895# endif
f4c79b3c
LC
896#endif
897
898#if @GNULIB_GETUSERSHELL@
899/* Rewind to pointer that is advanced at each getusershell() call. */
a927b6c1 900# if !@HAVE_DECL_GETUSERSHELL@
f4c79b3c
LC
901_GL_FUNCDECL_SYS (setusershell, void, (void));
902# endif
903_GL_CXXALIAS_SYS (setusershell, void, (void));
904_GL_CXXALIASWARN (setusershell);
905#elif defined GNULIB_POSIXCHECK
9b36a80c 906# undef setusershell
61cd9dc9
LC
907# if HAVE_RAW_DECL_SETUSERSHELL
908_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
909 "use gnulib module getusershell for portability");
910# endif
f4c79b3c
LC
911#endif
912
913#if @GNULIB_GETUSERSHELL@
914/* Free the pointer that is advanced at each getusershell() call and
915 associated resources. */
a927b6c1 916# if !@HAVE_DECL_GETUSERSHELL@
f4c79b3c
LC
917_GL_FUNCDECL_SYS (endusershell, void, (void));
918# endif
919_GL_CXXALIAS_SYS (endusershell, void, (void));
920_GL_CXXALIASWARN (endusershell);
921#elif defined GNULIB_POSIXCHECK
9b36a80c 922# undef endusershell
61cd9dc9
LC
923# if HAVE_RAW_DECL_ENDUSERSHELL
924_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
925 "use gnulib module getusershell for portability");
926# endif
9b36a80c
LC
927#endif
928
929
3d458a81
AW
930#if @GNULIB_GROUP_MEMBER@
931/* Determine whether group id is in calling user's group list. */
932# if !@HAVE_GROUP_MEMBER@
933_GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
934# endif
935_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
936_GL_CXXALIASWARN (group_member);
937#elif defined GNULIB_POSIXCHECK
938# undef group_member
939# if HAVE_RAW_DECL_GROUP_MEMBER
940_GL_WARN_ON_USE (group_member, "group_member is unportable - "
941 "use gnulib module group-member for portability");
942# endif
943#endif
944
945
f0007cad
LC
946#if @GNULIB_ISATTY@
947# if @REPLACE_ISATTY@
948# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
949# undef isatty
950# define isatty rpl_isatty
951# endif
952_GL_FUNCDECL_RPL (isatty, int, (int fd));
953_GL_CXXALIAS_RPL (isatty, int, (int fd));
954# else
955_GL_CXXALIAS_SYS (isatty, int, (int fd));
956# endif
957_GL_CXXALIASWARN (isatty);
958#elif defined GNULIB_POSIXCHECK
959# undef isatty
960# if HAVE_RAW_DECL_ISATTY
961_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
962 "use gnulib module isatty for portability");
963# endif
964#endif
965
966
9b36a80c 967#if @GNULIB_LCHOWN@
9b36a80c
LC
968/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
969 to GID (if GID is not -1). Do not follow symbolic links.
970 Return 0 if successful, otherwise -1 and errno set.
35428fb6
LC
971 See the POSIX:2008 specification
972 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
f4c79b3c
LC
973# if @REPLACE_LCHOWN@
974# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
975# undef lchown
976# define lchown rpl_lchown
977# endif
978_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
979 _GL_ARG_NONNULL ((1)));
980_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
981# else
982# if !@HAVE_LCHOWN@
983_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
984 _GL_ARG_NONNULL ((1)));
985# endif
986_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
9b36a80c 987# endif
f4c79b3c 988_GL_CXXALIASWARN (lchown);
9b36a80c
LC
989#elif defined GNULIB_POSIXCHECK
990# undef lchown
61cd9dc9
LC
991# if HAVE_RAW_DECL_LCHOWN
992_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
993 "use gnulib module lchown for portability");
994# endif
9b36a80c
LC
995#endif
996
997
f240aacb
LC
998#if @GNULIB_LINK@
999/* Create a new hard link for an existing file.
1000 Return 0 if successful, otherwise -1 and errno set.
35428fb6
LC
1001 See POSIX:2008 specification
1002 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
f4c79b3c
LC
1003# if @REPLACE_LINK@
1004# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1005# define link rpl_link
1006# endif
1007_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
1008 _GL_ARG_NONNULL ((1, 2)));
1009_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1010# else
1011# if !@HAVE_LINK@
1012_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
1013 _GL_ARG_NONNULL ((1, 2)));
1014# endif
1015_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
f240aacb 1016# endif
f4c79b3c 1017_GL_CXXALIASWARN (link);
f240aacb
LC
1018#elif defined GNULIB_POSIXCHECK
1019# undef link
61cd9dc9
LC
1020# if HAVE_RAW_DECL_LINK
1021_GL_WARN_ON_USE (link, "link is unportable - "
1022 "use gnulib module link for portability");
1023# endif
f240aacb
LC
1024#endif
1025
f4c79b3c 1026
8912421c 1027#if @GNULIB_LINKAT@
8912421c
LC
1028/* Create a new hard link for an existing file, relative to two
1029 directories. FLAG controls whether symlinks are followed.
1030 Return 0 if successful, otherwise -1 and errno set. */
f4c79b3c
LC
1031# if @REPLACE_LINKAT@
1032# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1033# undef linkat
1034# define linkat rpl_linkat
1035# endif
1036_GL_FUNCDECL_RPL (linkat, int,
1037 (int fd1, const char *path1, int fd2, const char *path2,
1cd4fffc 1038 int flag)
f4c79b3c
LC
1039 _GL_ARG_NONNULL ((2, 4)));
1040_GL_CXXALIAS_RPL (linkat, int,
1041 (int fd1, const char *path1, int fd2, const char *path2,
1042 int flag));
1043# else
1044# if !@HAVE_LINKAT@
1045_GL_FUNCDECL_SYS (linkat, int,
1046 (int fd1, const char *path1, int fd2, const char *path2,
1047 int flag)
1048 _GL_ARG_NONNULL ((2, 4)));
1049# endif
1050_GL_CXXALIAS_SYS (linkat, int,
1051 (int fd1, const char *path1, int fd2, const char *path2,
1052 int flag));
8912421c 1053# endif
f4c79b3c 1054_GL_CXXALIASWARN (linkat);
8912421c
LC
1055#elif defined GNULIB_POSIXCHECK
1056# undef linkat
61cd9dc9
LC
1057# if HAVE_RAW_DECL_LINKAT
1058_GL_WARN_ON_USE (linkat, "linkat is unportable - "
1059 "use gnulib module linkat for portability");
1060# endif
8912421c 1061#endif
f240aacb 1062
f4c79b3c 1063
9b36a80c 1064#if @GNULIB_LSEEK@
9b36a80c
LC
1065/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
1066 Return the new offset if successful, otherwise -1 and errno set.
35428fb6
LC
1067 See the POSIX:2008 specification
1068 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
f4c79b3c
LC
1069# if @REPLACE_LSEEK@
1070# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1071# define lseek rpl_lseek
1072# endif
1073_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1074_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1075# else
1076_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
9b36a80c 1077# endif
f4c79b3c 1078_GL_CXXALIASWARN (lseek);
9b36a80c
LC
1079#elif defined GNULIB_POSIXCHECK
1080# undef lseek
61cd9dc9
LC
1081# if HAVE_RAW_DECL_LSEEK
1082_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1083 "systems - use gnulib module lseek for portability");
1084# endif
9b36a80c
LC
1085#endif
1086
1087
ab4d62ad
LC
1088#if @GNULIB_PIPE@
1089/* Create a pipe, defaulting to O_BINARY mode.
1090 Store the read-end as fd[0] and the write-end as fd[1].
1091 Return 0 upon success, or -1 with errno set upon failure. */
1092# if !@HAVE_PIPE@
1093_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
1094# endif
1095_GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1096_GL_CXXALIASWARN (pipe);
1097#elif defined GNULIB_POSIXCHECK
1098# undef pipe
1099# if HAVE_RAW_DECL_PIPE
1100_GL_WARN_ON_USE (pipe, "pipe is unportable - "
1101 "use gnulib module pipe-posix for portability");
1102# endif
1103#endif
1104
1105
8912421c
LC
1106#if @GNULIB_PIPE2@
1107/* Create a pipe, applying the given flags when opening the read-end of the
1108 pipe and the write-end of the pipe.
1109 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1110 and O_TEXT, O_BINARY (defined in "binary-io.h").
1111 Store the read-end as fd[0] and the write-end as fd[1].
1112 Return 0 upon success, or -1 with errno set upon failure.
1113 See also the Linux man page at
1114 <http://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
1115# if @HAVE_PIPE2@
f4c79b3c
LC
1116# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1117# define pipe2 rpl_pipe2
1118# endif
1119_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1120_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1121# else
1122_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1123_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
8912421c 1124# endif
f4c79b3c 1125_GL_CXXALIASWARN (pipe2);
8912421c
LC
1126#elif defined GNULIB_POSIXCHECK
1127# undef pipe2
61cd9dc9
LC
1128# if HAVE_RAW_DECL_PIPE2
1129_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1130 "use gnulib module pipe2 for portability");
1131# endif
8912421c
LC
1132#endif
1133
1134
1cd4fffc 1135#if @GNULIB_PREAD@
1cd4fffc
LC
1136/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1137 Return the number of bytes placed into BUF if successful, otherwise
35428fb6
LC
1138 set errno and return -1. 0 indicates EOF.
1139 See the POSIX:2008 specification
1140 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
f4c79b3c
LC
1141# if @REPLACE_PREAD@
1142# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
231c0e0e 1143# undef pread
f4c79b3c
LC
1144# define pread rpl_pread
1145# endif
1146_GL_FUNCDECL_RPL (pread, ssize_t,
1147 (int fd, void *buf, size_t bufsize, off_t offset)
1148 _GL_ARG_NONNULL ((2)));
1149_GL_CXXALIAS_RPL (pread, ssize_t,
1150 (int fd, void *buf, size_t bufsize, off_t offset));
1151# else
1152# if !@HAVE_PREAD@
1153_GL_FUNCDECL_SYS (pread, ssize_t,
1154 (int fd, void *buf, size_t bufsize, off_t offset)
1155 _GL_ARG_NONNULL ((2)));
1156# endif
1157_GL_CXXALIAS_SYS (pread, ssize_t,
1158 (int fd, void *buf, size_t bufsize, off_t offset));
1cd4fffc 1159# endif
f4c79b3c 1160_GL_CXXALIASWARN (pread);
1cd4fffc
LC
1161#elif defined GNULIB_POSIXCHECK
1162# undef pread
61cd9dc9
LC
1163# if HAVE_RAW_DECL_PREAD
1164_GL_WARN_ON_USE (pread, "pread is unportable - "
1165 "use gnulib module pread for portability");
1166# endif
1cd4fffc
LC
1167#endif
1168
1169
a927b6c1
LC
1170#if @GNULIB_PWRITE@
1171/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1172 Return the number of bytes written if successful, otherwise
1173 set errno and return -1. 0 indicates nothing written. See the
35428fb6
LC
1174 POSIX:2008 specification
1175 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
a927b6c1
LC
1176# if @REPLACE_PWRITE@
1177# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
231c0e0e 1178# undef pwrite
a927b6c1
LC
1179# define pwrite rpl_pwrite
1180# endif
1181_GL_FUNCDECL_RPL (pwrite, ssize_t,
1182 (int fd, const void *buf, size_t bufsize, off_t offset)
1183 _GL_ARG_NONNULL ((2)));
1184_GL_CXXALIAS_RPL (pwrite, ssize_t,
1185 (int fd, const void *buf, size_t bufsize, off_t offset));
1186# else
1187# if !@HAVE_PWRITE@
1188_GL_FUNCDECL_SYS (pwrite, ssize_t,
1189 (int fd, const void *buf, size_t bufsize, off_t offset)
1190 _GL_ARG_NONNULL ((2)));
1191# endif
1192_GL_CXXALIAS_SYS (pwrite, ssize_t,
1193 (int fd, const void *buf, size_t bufsize, off_t offset));
1194# endif
1195_GL_CXXALIASWARN (pwrite);
1196#elif defined GNULIB_POSIXCHECK
1197# undef pwrite
1198# if HAVE_RAW_DECL_PWRITE
1199_GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1200 "use gnulib module pwrite for portability");
1201# endif
1202#endif
1203
1204
dd7d0148
LC
1205#if @GNULIB_READ@
1206/* Read up to COUNT bytes from file descriptor FD into the buffer starting
35428fb6
LC
1207 at BUF. See the POSIX:2008 specification
1208 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
1209# if @REPLACE_READ@
dd7d0148
LC
1210# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1211# undef read
1212# define read rpl_read
1213# endif
1214_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1215 _GL_ARG_NONNULL ((2)));
1216_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1217# else
1218/* Need to cast, because on mingw, the third parameter is
1219 unsigned int count
1220 and the return type is 'int'. */
1221_GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
1222# endif
1223_GL_CXXALIASWARN (read);
1224#endif
1225
1226
9b36a80c
LC
1227#if @GNULIB_READLINK@
1228/* Read the contents of the symbolic link FILE and place the first BUFSIZE
1229 bytes of it into BUF. Return the number of bytes placed into BUF if
1230 successful, otherwise -1 and errno set.
35428fb6
LC
1231 See the POSIX:2008 specification
1232 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
f4c79b3c
LC
1233# if @REPLACE_READLINK@
1234# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1235# define readlink rpl_readlink
1236# endif
1237_GL_FUNCDECL_RPL (readlink, ssize_t,
1238 (const char *file, char *buf, size_t bufsize)
1239 _GL_ARG_NONNULL ((1, 2)));
1240_GL_CXXALIAS_RPL (readlink, ssize_t,
1241 (const char *file, char *buf, size_t bufsize));
1242# else
1243# if !@HAVE_READLINK@
1244_GL_FUNCDECL_SYS (readlink, ssize_t,
1245 (const char *file, char *buf, size_t bufsize)
1246 _GL_ARG_NONNULL ((1, 2)));
1247# endif
1248_GL_CXXALIAS_SYS (readlink, ssize_t,
1249 (const char *file, char *buf, size_t bufsize));
9b36a80c 1250# endif
f4c79b3c 1251_GL_CXXALIASWARN (readlink);
9b36a80c
LC
1252#elif defined GNULIB_POSIXCHECK
1253# undef readlink
61cd9dc9
LC
1254# if HAVE_RAW_DECL_READLINK
1255_GL_WARN_ON_USE (readlink, "readlink is unportable - "
1256 "use gnulib module readlink for portability");
1257# endif
9b36a80c
LC
1258#endif
1259
1260
8912421c
LC
1261#if @GNULIB_READLINKAT@
1262# if !@HAVE_READLINKAT@
f4c79b3c
LC
1263_GL_FUNCDECL_SYS (readlinkat, ssize_t,
1264 (int fd, char const *file, char *buf, size_t len)
1265 _GL_ARG_NONNULL ((2, 3)));
8912421c 1266# endif
f4c79b3c
LC
1267_GL_CXXALIAS_SYS (readlinkat, ssize_t,
1268 (int fd, char const *file, char *buf, size_t len));
1269_GL_CXXALIASWARN (readlinkat);
8912421c
LC
1270#elif defined GNULIB_POSIXCHECK
1271# undef readlinkat
61cd9dc9
LC
1272# if HAVE_RAW_DECL_READLINKAT
1273_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
9157d901 1274 "use gnulib module readlinkat for portability");
61cd9dc9 1275# endif
8912421c
LC
1276#endif
1277
1278
1279#if @GNULIB_RMDIR@
8912421c 1280/* Remove the directory DIR. */
f4c79b3c
LC
1281# if @REPLACE_RMDIR@
1282# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1283# define rmdir rpl_rmdir
1284# endif
1285_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1286_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1287# else
1288_GL_CXXALIAS_SYS (rmdir, int, (char const *name));
8912421c 1289# endif
f4c79b3c 1290_GL_CXXALIASWARN (rmdir);
8912421c
LC
1291#elif defined GNULIB_POSIXCHECK
1292# undef rmdir
61cd9dc9
LC
1293# if HAVE_RAW_DECL_RMDIR
1294_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1295 "use gnulib module rmdir for portability");
1296# endif
8912421c
LC
1297#endif
1298
1299
7f1ea859
LC
1300#if @GNULIB_SETHOSTNAME@
1301/* Set the host name of the machine.
1302 The host name may or may not be fully qualified.
1303
1304 Put LEN bytes of NAME into the host name.
1305 Return 0 if successful, otherwise, set errno and return -1.
1306
1307 Platforms with no ability to set the hostname return -1 and set
1308 errno = ENOSYS. */
1309# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
1310_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
1311 _GL_ARG_NONNULL ((1)));
1312# endif
005de2e8 1313/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
7f1ea859
LC
1314 and FreeBSD 6.4 the second parameter is int. On Solaris 11
1315 2011-10, the first parameter is not const. */
1316_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
1317_GL_CXXALIASWARN (sethostname);
1318#elif defined GNULIB_POSIXCHECK
1319# undef sethostname
1320# if HAVE_RAW_DECL_SETHOSTNAME
1321_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
1322 "use gnulib module sethostname for portability");
1323# endif
1324#endif
1325
1326
9b36a80c
LC
1327#if @GNULIB_SLEEP@
1328/* Pause the execution of the current thread for N seconds.
1329 Returns the number of seconds left to sleep.
35428fb6
LC
1330 See the POSIX:2008 specification
1331 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
f4c79b3c
LC
1332# if @REPLACE_SLEEP@
1333# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1334# undef sleep
1335# define sleep rpl_sleep
1336# endif
1337_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1338_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1339# else
1340# if !@HAVE_SLEEP@
1341_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1342# endif
1343_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
9b36a80c 1344# endif
f4c79b3c 1345_GL_CXXALIASWARN (sleep);
9b36a80c
LC
1346#elif defined GNULIB_POSIXCHECK
1347# undef sleep
61cd9dc9
LC
1348# if HAVE_RAW_DECL_SLEEP
1349_GL_WARN_ON_USE (sleep, "sleep is unportable - "
1350 "use gnulib module sleep for portability");
1351# endif
9b36a80c
LC
1352#endif
1353
1354
8912421c
LC
1355#if @GNULIB_SYMLINK@
1356# if @REPLACE_SYMLINK@
f4c79b3c
LC
1357# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1358# undef symlink
1359# define symlink rpl_symlink
1360# endif
1361_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1362 _GL_ARG_NONNULL ((1, 2)));
1363_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1364# else
1365# if !@HAVE_SYMLINK@
1366_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1367 _GL_ARG_NONNULL ((1, 2)));
1368# endif
1369_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
8912421c 1370# endif
f4c79b3c 1371_GL_CXXALIASWARN (symlink);
8912421c
LC
1372#elif defined GNULIB_POSIXCHECK
1373# undef symlink
61cd9dc9
LC
1374# if HAVE_RAW_DECL_SYMLINK
1375_GL_WARN_ON_USE (symlink, "symlink is not portable - "
1376 "use gnulib module symlink for portability");
1377# endif
8912421c
LC
1378#endif
1379
1380
1381#if @GNULIB_SYMLINKAT@
1382# if !@HAVE_SYMLINKAT@
f4c79b3c
LC
1383_GL_FUNCDECL_SYS (symlinkat, int,
1384 (char const *contents, int fd, char const *file)
1385 _GL_ARG_NONNULL ((1, 3)));
8912421c 1386# endif
f4c79b3c
LC
1387_GL_CXXALIAS_SYS (symlinkat, int,
1388 (char const *contents, int fd, char const *file));
1389_GL_CXXALIASWARN (symlinkat);
8912421c
LC
1390#elif defined GNULIB_POSIXCHECK
1391# undef symlinkat
61cd9dc9
LC
1392# if HAVE_RAW_DECL_SYMLINKAT
1393_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1394 "use gnulib module symlinkat for portability");
1395# endif
8912421c
LC
1396#endif
1397
1398
a927b6c1
LC
1399#if @GNULIB_TTYNAME_R@
1400/* Store at most BUFLEN characters of the pathname of the terminal FD is
1401 open on in BUF. Return 0 on success, otherwise an error number. */
1402# if @REPLACE_TTYNAME_R@
1403# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1404# undef ttyname_r
1405# define ttyname_r rpl_ttyname_r
1406# endif
1407_GL_FUNCDECL_RPL (ttyname_r, int,
1408 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1409_GL_CXXALIAS_RPL (ttyname_r, int,
1410 (int fd, char *buf, size_t buflen));
1411# else
ab4d62ad 1412# if !@HAVE_DECL_TTYNAME_R@
a927b6c1
LC
1413_GL_FUNCDECL_SYS (ttyname_r, int,
1414 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1415# endif
1416_GL_CXXALIAS_SYS (ttyname_r, int,
1417 (int fd, char *buf, size_t buflen));
1418# endif
1419_GL_CXXALIASWARN (ttyname_r);
1420#elif defined GNULIB_POSIXCHECK
1421# undef ttyname_r
1422# if HAVE_RAW_DECL_TTYNAME_R
1423_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1424 "use gnulib module ttyname_r for portability");
1425# endif
1426#endif
1427
1428
8912421c
LC
1429#if @GNULIB_UNLINK@
1430# if @REPLACE_UNLINK@
f4c79b3c
LC
1431# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1432# undef unlink
1433# define unlink rpl_unlink
1434# endif
1435_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1436_GL_CXXALIAS_RPL (unlink, int, (char const *file));
1437# else
1438_GL_CXXALIAS_SYS (unlink, int, (char const *file));
8912421c 1439# endif
f4c79b3c 1440_GL_CXXALIASWARN (unlink);
8912421c
LC
1441#elif defined GNULIB_POSIXCHECK
1442# undef unlink
61cd9dc9
LC
1443# if HAVE_RAW_DECL_UNLINK
1444_GL_WARN_ON_USE (unlink, "unlink is not portable - "
1445 "use gnulib module unlink for portability");
1446# endif
8912421c
LC
1447#endif
1448
1449
1450#if @GNULIB_UNLINKAT@
1451# if @REPLACE_UNLINKAT@
f4c79b3c
LC
1452# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1453# undef unlinkat
1454# define unlinkat rpl_unlinkat
1455# endif
1456_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1457 _GL_ARG_NONNULL ((2)));
1458_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1459# else
1460# if !@HAVE_UNLINKAT@
1461_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1462 _GL_ARG_NONNULL ((2)));
1463# endif
1464_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
8912421c 1465# endif
f4c79b3c 1466_GL_CXXALIASWARN (unlinkat);
8912421c
LC
1467#elif defined GNULIB_POSIXCHECK
1468# undef unlinkat
61cd9dc9
LC
1469# if HAVE_RAW_DECL_UNLINKAT
1470_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1471 "use gnulib module openat for portability");
1472# endif
8912421c
LC
1473#endif
1474
1475
414e4441 1476#if @GNULIB_USLEEP@
414e4441
LC
1477/* Pause the execution of the current thread for N microseconds.
1478 Returns 0 on completion, or -1 on range error.
1479 See the POSIX:2001 specification
35428fb6 1480 <http://www.opengroup.org/susv3xsh/usleep.html>. */
f4c79b3c
LC
1481# if @REPLACE_USLEEP@
1482# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1483# undef usleep
1484# define usleep rpl_usleep
1485# endif
1486_GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1487_GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1488# else
1489# if !@HAVE_USLEEP@
1490_GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1491# endif
1492_GL_CXXALIAS_SYS (usleep, int, (useconds_t n));
414e4441 1493# endif
f4c79b3c 1494_GL_CXXALIASWARN (usleep);
414e4441
LC
1495#elif defined GNULIB_POSIXCHECK
1496# undef usleep
61cd9dc9
LC
1497# if HAVE_RAW_DECL_USLEEP
1498_GL_WARN_ON_USE (usleep, "usleep is unportable - "
1499 "use gnulib module usleep for portability");
1500# endif
414e4441
LC
1501#endif
1502
1503
f4c79b3c 1504#if @GNULIB_WRITE@
9b36a80c 1505/* Write up to COUNT bytes starting at BUF to file descriptor FD.
35428fb6
LC
1506 See the POSIX:2008 specification
1507 <http://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
1508# if @REPLACE_WRITE@
f4c79b3c
LC
1509# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1510# undef write
1511# define write rpl_write
1512# endif
1513_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1514 _GL_ARG_NONNULL ((2)));
1515_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1516# else
a927b6c1
LC
1517/* Need to cast, because on mingw, the third parameter is
1518 unsigned int count
1519 and the return type is 'int'. */
1520_GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
f4c79b3c
LC
1521# endif
1522_GL_CXXALIASWARN (write);
9b36a80c
LC
1523#endif
1524
af07e104 1525_GL_INLINE_HEADER_END
9b36a80c 1526
3d458a81
AW
1527#endif /* _@GUARD_PREFIX@_UNISTD_H */
1528#endif /* _@GUARD_PREFIX@_UNISTD_H */