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