execute, spawn-pipe: Make multithread-safe on native Windows.
[gnulib.git] / lib / unistd.in.h
blob5cf6f9d2476498bb5c1f20c8e320063d7b99f872
1 /* Substitute for and wrapper around <unistd.h>.
2 Copyright (C) 2003-2020 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 #if @HAVE_UNISTD_H@ && defined _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 /* But avoid namespace pollution on glibc systems. */
56 #ifndef __GLIBC__
57 # include <stddef.h>
58 #endif
60 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
61 /* MSVC declares 'unlink' in <stdio.h>, not in <unistd.h>. We must include
62 it before we #define unlink rpl_unlink. */
63 /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
64 /* But avoid namespace pollution on glibc systems. */
65 #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
66 || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \
67 && (defined _WIN32 && ! defined __CYGWIN__)) \
68 || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
69 && defined __CYGWIN__)) \
70 && ! defined __GLIBC__
71 # include <stdio.h>
72 #endif
74 /* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
75 <unistd.h>. */
76 /* But avoid namespace pollution on glibc systems. */
77 #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
78 && (defined __CYGWIN__ || defined __ANDROID__) \
79 && ! defined __GLIBC__
80 # include <fcntl.h>
81 #endif
83 /* mingw fails to declare _exit in <unistd.h>. */
84 /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
85 <unistd.h>. */
86 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
87 /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
88 included here. */
89 /* But avoid namespace pollution on glibc systems. */
90 #if !defined __GLIBC__ && !defined __osf__
91 # define __need_system_stdlib_h
92 # include <stdlib.h>
93 # undef __need_system_stdlib_h
94 #endif
96 /* Native Windows platforms declare chdir, getcwd, rmdir in
97 <io.h> and/or <direct.h>, not in <unistd.h>.
98 They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
99 lseek(), read(), unlink(), write() in <io.h>. */
100 #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
101 || defined GNULIB_POSIXCHECK) \
102 && (defined _WIN32 && ! defined __CYGWIN__))
103 # include <io.h> /* mingw32, mingw64 */
104 # include <direct.h> /* mingw64, MSVC 9 */
105 #elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
106 || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
107 || defined GNULIB_POSIXCHECK) \
108 && (defined _WIN32 && ! defined __CYGWIN__)
109 # include <io.h>
110 #endif
112 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
113 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
114 /* But avoid namespace pollution on glibc systems. */
115 #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
116 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
117 && !defined __GLIBC__
118 # include <netdb.h>
119 #endif
121 /* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in
122 <sys/random.h>, not in <unistd.h>. */
123 /* But avoid namespace pollution on glibc systems. */
124 #if (@GNULIB_GETENTROPY@ || defined GNULIB_POSIXCHECK) \
125 && ((defined __APPLE__ && defined __MACH__) || defined __sun \
126 || defined __ANDROID__) \
127 && @UNISTD_H_HAVE_SYS_RANDOM_H@ \
128 && !defined __GLIBC__
129 # include <sys/random.h>
130 #endif
132 /* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */
133 /* But avoid namespace pollution on glibc systems. */
134 #if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
135 && !defined __GLIBC__
136 # include <sys/stat.h>
137 #endif
139 /* MSVC defines off_t in <sys/types.h>.
140 May also define off_t to a 64-bit type on native Windows. */
141 /* But avoid namespace pollution on glibc systems. */
142 #ifndef __GLIBC__
143 /* Get off_t, ssize_t. */
144 # include <sys/types.h>
145 #endif
147 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
149 /* The definition of _GL_ARG_NONNULL is copied here. */
151 /* The definition of _GL_WARN_ON_USE is copied here. */
154 /* Get getopt(), optarg, optind, opterr, optopt. */
155 #if @GNULIB_GETOPT_POSIX@ && @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
156 # include <getopt-cdefs.h>
157 # include <getopt-pfx-core.h>
158 #endif
160 #ifndef _GL_INLINE_HEADER_BEGIN
161 #error "Please include config.h first."
162 #endif
163 _GL_INLINE_HEADER_BEGIN
164 #ifndef _GL_UNISTD_INLINE
165 # define _GL_UNISTD_INLINE _GL_INLINE
166 #endif
168 /* Hide some function declarations from <winsock2.h>. */
170 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
171 # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
172 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
173 # undef socket
174 # define socket socket_used_without_including_sys_socket_h
175 # undef connect
176 # define connect connect_used_without_including_sys_socket_h
177 # undef accept
178 # define accept accept_used_without_including_sys_socket_h
179 # undef bind
180 # define bind bind_used_without_including_sys_socket_h
181 # undef getpeername
182 # define getpeername getpeername_used_without_including_sys_socket_h
183 # undef getsockname
184 # define getsockname getsockname_used_without_including_sys_socket_h
185 # undef getsockopt
186 # define getsockopt getsockopt_used_without_including_sys_socket_h
187 # undef listen
188 # define listen listen_used_without_including_sys_socket_h
189 # undef recv
190 # define recv recv_used_without_including_sys_socket_h
191 # undef send
192 # define send send_used_without_including_sys_socket_h
193 # undef recvfrom
194 # define recvfrom recvfrom_used_without_including_sys_socket_h
195 # undef sendto
196 # define sendto sendto_used_without_including_sys_socket_h
197 # undef setsockopt
198 # define setsockopt setsockopt_used_without_including_sys_socket_h
199 # undef shutdown
200 # define shutdown shutdown_used_without_including_sys_socket_h
201 # else
202 _GL_WARN_ON_USE (socket,
203 "socket() used without including <sys/socket.h>");
204 _GL_WARN_ON_USE (connect,
205 "connect() used without including <sys/socket.h>");
206 _GL_WARN_ON_USE (accept,
207 "accept() used without including <sys/socket.h>");
208 _GL_WARN_ON_USE (bind,
209 "bind() used without including <sys/socket.h>");
210 _GL_WARN_ON_USE (getpeername,
211 "getpeername() used without including <sys/socket.h>");
212 _GL_WARN_ON_USE (getsockname,
213 "getsockname() used without including <sys/socket.h>");
214 _GL_WARN_ON_USE (getsockopt,
215 "getsockopt() used without including <sys/socket.h>");
216 _GL_WARN_ON_USE (listen,
217 "listen() used without including <sys/socket.h>");
218 _GL_WARN_ON_USE (recv,
219 "recv() used without including <sys/socket.h>");
220 _GL_WARN_ON_USE (send,
221 "send() used without including <sys/socket.h>");
222 _GL_WARN_ON_USE (recvfrom,
223 "recvfrom() used without including <sys/socket.h>");
224 _GL_WARN_ON_USE (sendto,
225 "sendto() used without including <sys/socket.h>");
226 _GL_WARN_ON_USE (setsockopt,
227 "setsockopt() used without including <sys/socket.h>");
228 _GL_WARN_ON_USE (shutdown,
229 "shutdown() used without including <sys/socket.h>");
230 # endif
231 # endif
232 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
233 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
234 # undef select
235 # define select select_used_without_including_sys_select_h
236 # else
237 _GL_WARN_ON_USE (select,
238 "select() used without including <sys/select.h>");
239 # endif
240 # endif
241 #endif
244 /* OS/2 EMX lacks these macros. */
245 #ifndef STDIN_FILENO
246 # define STDIN_FILENO 0
247 #endif
248 #ifndef STDOUT_FILENO
249 # define STDOUT_FILENO 1
250 #endif
251 #ifndef STDERR_FILENO
252 # define STDERR_FILENO 2
253 #endif
255 /* Ensure *_OK macros exist. */
256 #ifndef F_OK
257 # define F_OK 0
258 # define X_OK 1
259 # define W_OK 2
260 # define R_OK 4
261 #endif
264 /* Declare overridden functions. */
267 #if @GNULIB_ACCESS@
268 # if @REPLACE_ACCESS@
269 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
270 # undef access
271 # define access rpl_access
272 # endif
273 _GL_FUNCDECL_RPL (access, int, (const char *file, int mode)
274 _GL_ARG_NONNULL ((1)));
275 _GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
276 # elif defined _WIN32 && !defined __CYGWIN__
277 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
278 # undef access
279 # define access _access
280 # endif
281 _GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
282 # else
283 _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
284 # endif
285 _GL_CXXALIASWARN (access);
286 #elif defined GNULIB_POSIXCHECK
287 # undef access
288 # if HAVE_RAW_DECL_ACCESS
289 /* The access() function is a security risk. */
290 _GL_WARN_ON_USE (access, "access does not always support X_OK - "
291 "use gnulib module access for portability; "
292 "also, this function is a security risk - "
293 "use the gnulib module faccessat instead");
294 # endif
295 #elif defined _WIN32 && !defined __CYGWIN__
296 # undef access
297 # define access _access
298 #endif
301 #if @GNULIB_CHDIR@
302 # if defined _WIN32 && !defined __CYGWIN__
303 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
304 # undef chdir
305 # define chdir _chdir
306 # endif
307 _GL_CXXALIAS_MDA (chdir, int, (const char *file));
308 # else
309 _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
310 # endif
311 _GL_CXXALIASWARN (chdir);
312 #elif defined GNULIB_POSIXCHECK
313 # undef chdir
314 # if HAVE_RAW_DECL_CHDIR
315 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
316 "use gnulib module chdir for portability");
317 # endif
318 #elif defined _WIN32 && !defined __CYGWIN__
319 # undef chdir
320 # define chdir _chdir
321 #endif
324 #if @GNULIB_CHOWN@
325 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
326 to GID (if GID is not -1). Follow symbolic links.
327 Return 0 if successful, otherwise -1 and errno set.
328 See the POSIX:2008 specification
329 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
330 # if @REPLACE_CHOWN@
331 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
332 # undef chown
333 # define chown rpl_chown
334 # endif
335 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
336 _GL_ARG_NONNULL ((1)));
337 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
338 # else
339 # if !@HAVE_CHOWN@
340 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
341 _GL_ARG_NONNULL ((1)));
342 # endif
343 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
344 # endif
345 _GL_CXXALIASWARN (chown);
346 #elif defined GNULIB_POSIXCHECK
347 # undef chown
348 # if HAVE_RAW_DECL_CHOWN
349 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
350 "doesn't treat a uid or gid of -1 on some systems - "
351 "use gnulib module chown for portability");
352 # endif
353 #endif
356 #if @GNULIB_CLOSE@
357 # if @REPLACE_CLOSE@
358 /* Automatically included by modules that need a replacement for close. */
359 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
360 # undef close
361 # define close rpl_close
362 # endif
363 _GL_FUNCDECL_RPL (close, int, (int fd));
364 _GL_CXXALIAS_RPL (close, int, (int fd));
365 # elif defined _WIN32 && !defined __CYGWIN__
366 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
367 # undef close
368 # define close _close
369 # endif
370 _GL_CXXALIAS_MDA (close, int, (int fd));
371 # else
372 _GL_CXXALIAS_SYS (close, int, (int fd));
373 # endif
374 _GL_CXXALIASWARN (close);
375 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
376 # undef close
377 # define close close_used_without_requesting_gnulib_module_close
378 #elif defined GNULIB_POSIXCHECK
379 # undef close
380 /* Assume close is always declared. */
381 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
382 "use gnulib module close for portability");
383 #elif defined _WIN32 && !defined __CYGWIN__
384 # undef close
385 # define close _close
386 #endif
389 #if @GNULIB_COPY_FILE_RANGE@
390 # if !@HAVE_COPY_FILE_RANGE@
391 _GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
392 int ofd, off_t *opos,
393 size_t len, unsigned flags));
394 _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
395 int ofd, off_t *opos,
396 size_t len, unsigned flags));
397 # endif
398 _GL_CXXALIASWARN (copy_file_range);
399 #elif defined GNULIB_POSIXCHECK
400 # if HAVE_RAW_DECL_COPY_FILE_RANGE
401 _GL_WARN_ON_USE (copy_file_range,
402 "copy_file_range is unportable - "
403 "use gnulib module copy_file_range for portability");
404 # endif
405 #endif
408 #if @GNULIB_DUP@
409 # if @REPLACE_DUP@
410 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
411 # define dup rpl_dup
412 # endif
413 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
414 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
415 # elif defined _WIN32 && !defined __CYGWIN__
416 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
417 # undef dup
418 # define dup _dup
419 # endif
420 _GL_CXXALIAS_MDA (dup, int, (int oldfd));
421 # else
422 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
423 # endif
424 _GL_CXXALIASWARN (dup);
425 #elif defined GNULIB_POSIXCHECK
426 # undef dup
427 # if HAVE_RAW_DECL_DUP
428 _GL_WARN_ON_USE (dup, "dup is unportable - "
429 "use gnulib module dup for portability");
430 # endif
431 #elif defined _WIN32 && !defined __CYGWIN__
432 # undef dup
433 # define dup _dup
434 #endif
437 #if @GNULIB_DUP2@
438 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
439 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
440 Return newfd if successful, otherwise -1 and errno set.
441 See the POSIX:2008 specification
442 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
443 # if @REPLACE_DUP2@
444 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
445 # define dup2 rpl_dup2
446 # endif
447 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
448 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
449 # elif defined _WIN32 && !defined __CYGWIN__
450 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
451 # undef dup2
452 # define dup2 _dup2
453 # endif
454 _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
455 # else
456 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
457 # endif
458 _GL_CXXALIASWARN (dup2);
459 #elif defined GNULIB_POSIXCHECK
460 # undef dup2
461 # if HAVE_RAW_DECL_DUP2
462 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
463 "use gnulib module dup2 for portability");
464 # endif
465 #elif defined _WIN32 && !defined __CYGWIN__
466 # undef dup2
467 # define dup2 _dup2
468 #endif
471 #if @GNULIB_DUP3@
472 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
473 specified flags.
474 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
475 and O_TEXT, O_BINARY (defined in "binary-io.h").
476 Close NEWFD first if it is open.
477 Return newfd if successful, otherwise -1 and errno set.
478 See the Linux man page at
479 <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
480 # if @HAVE_DUP3@
481 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
482 # define dup3 rpl_dup3
483 # endif
484 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
485 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
486 # else
487 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
488 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
489 # endif
490 _GL_CXXALIASWARN (dup3);
491 #elif defined GNULIB_POSIXCHECK
492 # undef dup3
493 # if HAVE_RAW_DECL_DUP3
494 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
495 "use gnulib module dup3 for portability");
496 # endif
497 #endif
500 #if @GNULIB_ENVIRON@
501 # if defined __CYGWIN__ && !defined __i386__
502 /* The 'environ' variable is defined in a DLL. Therefore its declaration needs
503 the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it.
504 This leads to a link error on 64-bit Cygwin when the option
505 -Wl,--disable-auto-import is in use. */
506 _GL_EXTERN_C __declspec(dllimport) char **environ;
507 # endif
508 # if !@HAVE_DECL_ENVIRON@
509 /* Set of environment variables and values. An array of strings of the form
510 "VARIABLE=VALUE", terminated with a NULL. */
511 # if defined __APPLE__ && defined __MACH__
512 # include <TargetConditionals.h>
513 # if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
514 # define _GL_USE_CRT_EXTERNS
515 # endif
516 # endif
517 # ifdef _GL_USE_CRT_EXTERNS
518 # include <crt_externs.h>
519 # define environ (*_NSGetEnviron ())
520 # else
521 # ifdef __cplusplus
522 extern "C" {
523 # endif
524 extern char **environ;
525 # ifdef __cplusplus
527 # endif
528 # endif
529 # endif
530 #elif defined GNULIB_POSIXCHECK
531 # if HAVE_RAW_DECL_ENVIRON
532 _GL_UNISTD_INLINE char ***
533 _GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - "
534 "use gnulib module environ for portability")
535 rpl_environ (void)
537 return &environ;
539 # undef environ
540 # define environ (*rpl_environ ())
541 # endif
542 #endif
545 #if @GNULIB_EUIDACCESS@
546 /* Like access(), except that it uses the effective user id and group id of
547 the current process. */
548 # if !@HAVE_EUIDACCESS@
549 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
550 _GL_ARG_NONNULL ((1)));
551 # endif
552 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
553 _GL_CXXALIASWARN (euidaccess);
554 # if defined GNULIB_POSIXCHECK
555 /* Like access(), this function is a security risk. */
556 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
557 "use the gnulib module faccessat instead");
558 # endif
559 #elif defined GNULIB_POSIXCHECK
560 # undef euidaccess
561 # if HAVE_RAW_DECL_EUIDACCESS
562 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
563 "use gnulib module euidaccess for portability");
564 # endif
565 #endif
568 #if defined _WIN32 && !defined __CYGWIN__
569 # undef execl
570 # define execl _execl
571 #endif
573 #if defined _WIN32 && !defined __CYGWIN__
574 # undef execle
575 # define execle _execle
576 #endif
578 #if defined _WIN32 && !defined __CYGWIN__
579 # undef execlp
580 # define execlp _execlp
581 #endif
584 #if defined _WIN32 && !defined __CYGWIN__
585 # undef execv
586 # define execv _execv
587 #endif
589 #if defined _WIN32 && !defined __CYGWIN__
590 # undef execve
591 # define execve _execve
592 #endif
594 #if defined _WIN32 && !defined __CYGWIN__
595 # undef execvp
596 # define execvp _execvp
597 #endif
599 #if defined _WIN32 && !defined __CYGWIN__
600 # undef execvpe
601 # define execvpe _execvpe
602 #endif
605 #if @GNULIB_FACCESSAT@
606 # if @REPLACE_FACCESSAT@
607 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
608 # undef faccessat
609 # define faccessat rpl_faccessat
610 # endif
611 _GL_FUNCDECL_RPL (faccessat, int,
612 (int fd, char const *name, int mode, int flag)
613 _GL_ARG_NONNULL ((2)));
614 _GL_CXXALIAS_RPL (faccessat, int,
615 (int fd, char const *name, int mode, int flag));
616 # else
617 # if !@HAVE_FACCESSAT@
618 _GL_FUNCDECL_SYS (faccessat, int,
619 (int fd, char const *file, int mode, int flag)
620 _GL_ARG_NONNULL ((2)));
621 # endif
622 _GL_CXXALIAS_SYS (faccessat, int,
623 (int fd, char const *file, int mode, int flag));
624 # endif
625 _GL_CXXALIASWARN (faccessat);
626 #elif defined GNULIB_POSIXCHECK
627 # undef faccessat
628 # if HAVE_RAW_DECL_FACCESSAT
629 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
630 "use gnulib module faccessat for portability");
631 # endif
632 #endif
635 #if @GNULIB_FCHDIR@
636 /* Change the process' current working directory to the directory on which
637 the given file descriptor is open.
638 Return 0 if successful, otherwise -1 and errno set.
639 See the POSIX:2008 specification
640 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
641 # if ! @HAVE_FCHDIR@
642 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
644 /* Gnulib internal hooks needed to maintain the fchdir metadata. */
645 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
646 _GL_ARG_NONNULL ((2));
647 _GL_EXTERN_C void _gl_unregister_fd (int fd);
648 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
649 _GL_EXTERN_C const char *_gl_directory_name (int fd);
651 # else
652 # if !@HAVE_DECL_FCHDIR@
653 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
654 # endif
655 # endif
656 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
657 _GL_CXXALIASWARN (fchdir);
658 #elif defined GNULIB_POSIXCHECK
659 # undef fchdir
660 # if HAVE_RAW_DECL_FCHDIR
661 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
662 "use gnulib module fchdir for portability");
663 # endif
664 #endif
667 #if @GNULIB_FCHOWNAT@
668 # if @REPLACE_FCHOWNAT@
669 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
670 # undef fchownat
671 # define fchownat rpl_fchownat
672 # endif
673 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
674 uid_t owner, gid_t group, int flag)
675 _GL_ARG_NONNULL ((2)));
676 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
677 uid_t owner, gid_t group, int flag));
678 # else
679 # if !@HAVE_FCHOWNAT@
680 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
681 uid_t owner, gid_t group, int flag)
682 _GL_ARG_NONNULL ((2)));
683 # endif
684 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
685 uid_t owner, gid_t group, int flag));
686 # endif
687 _GL_CXXALIASWARN (fchownat);
688 #elif defined GNULIB_POSIXCHECK
689 # undef fchownat
690 # if HAVE_RAW_DECL_FCHOWNAT
691 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
692 "use gnulib module openat for portability");
693 # endif
694 #endif
697 #if @GNULIB_FDATASYNC@
698 /* Synchronize changes to a file.
699 Return 0 if successful, otherwise -1 and errno set.
700 See POSIX:2008 specification
701 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
702 # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
703 _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
704 # endif
705 _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
706 _GL_CXXALIASWARN (fdatasync);
707 #elif defined GNULIB_POSIXCHECK
708 # undef fdatasync
709 # if HAVE_RAW_DECL_FDATASYNC
710 _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
711 "use gnulib module fdatasync for portability");
712 # endif
713 #endif
716 #if @GNULIB_FSYNC@
717 /* Synchronize changes, including metadata, to a file.
718 Return 0 if successful, otherwise -1 and errno set.
719 See POSIX:2008 specification
720 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
721 # if !@HAVE_FSYNC@
722 _GL_FUNCDECL_SYS (fsync, int, (int fd));
723 # endif
724 _GL_CXXALIAS_SYS (fsync, int, (int fd));
725 _GL_CXXALIASWARN (fsync);
726 #elif defined GNULIB_POSIXCHECK
727 # undef fsync
728 # if HAVE_RAW_DECL_FSYNC
729 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
730 "use gnulib module fsync for portability");
731 # endif
732 #endif
735 #if @GNULIB_FTRUNCATE@
736 /* Change the size of the file to which FD is opened to become equal to LENGTH.
737 Return 0 if successful, otherwise -1 and errno set.
738 See the POSIX:2008 specification
739 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
740 # if @REPLACE_FTRUNCATE@
741 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
742 # undef ftruncate
743 # define ftruncate rpl_ftruncate
744 # endif
745 _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
746 _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
747 # else
748 # if !@HAVE_FTRUNCATE@
749 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
750 # endif
751 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
752 # endif
753 _GL_CXXALIASWARN (ftruncate);
754 #elif defined GNULIB_POSIXCHECK
755 # undef ftruncate
756 # if HAVE_RAW_DECL_FTRUNCATE
757 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
758 "use gnulib module ftruncate for portability");
759 # endif
760 #endif
763 #if @GNULIB_GETCWD@
764 /* Get the name of the current working directory, and put it in SIZE bytes
765 of BUF.
766 Return BUF if successful, or NULL if the directory couldn't be determined
767 or SIZE was too small.
768 See the POSIX:2008 specification
769 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
770 Additionally, the gnulib module 'getcwd' guarantees the following GNU
771 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
772 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
773 necessary. */
774 # if @REPLACE_GETCWD@
775 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
776 # define getcwd rpl_getcwd
777 # endif
778 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
779 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
780 # elif defined _WIN32 && !defined __CYGWIN__
781 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
782 # undef getcwd
783 # define getcwd _getcwd
784 # endif
785 _GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
786 # else
787 /* Need to cast, because on mingw, the second parameter is
788 int size. */
789 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
790 # endif
791 _GL_CXXALIASWARN (getcwd);
792 #elif defined GNULIB_POSIXCHECK
793 # undef getcwd
794 # if HAVE_RAW_DECL_GETCWD
795 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
796 "use gnulib module getcwd for portability");
797 # endif
798 #elif defined _WIN32 && !defined __CYGWIN__
799 # undef getcwd
800 # define getcwd _getcwd
801 #endif
804 #if @GNULIB_GETDOMAINNAME@
805 /* Return the NIS domain name of the machine.
806 WARNING! The NIS domain name is unrelated to the fully qualified host name
807 of the machine. It is also unrelated to email addresses.
808 WARNING! The NIS domain name is usually the empty string or "(none)" when
809 not using NIS.
811 Put up to LEN bytes of the NIS domain name into NAME.
812 Null terminate it if the name is shorter than LEN.
813 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
814 Return 0 if successful, otherwise set errno and return -1. */
815 # if @REPLACE_GETDOMAINNAME@
816 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
817 # undef getdomainname
818 # define getdomainname rpl_getdomainname
819 # endif
820 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
821 _GL_ARG_NONNULL ((1)));
822 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
823 # else
824 # if !@HAVE_DECL_GETDOMAINNAME@
825 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
826 _GL_ARG_NONNULL ((1)));
827 # endif
828 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
829 # endif
830 _GL_CXXALIASWARN (getdomainname);
831 #elif defined GNULIB_POSIXCHECK
832 # undef getdomainname
833 # if HAVE_RAW_DECL_GETDOMAINNAME
834 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
835 "use gnulib module getdomainname for portability");
836 # endif
837 #endif
840 #if @GNULIB_GETDTABLESIZE@
841 /* Return the maximum number of file descriptors in the current process.
842 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
843 # if @REPLACE_GETDTABLESIZE@
844 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
845 # undef getdtablesize
846 # define getdtablesize rpl_getdtablesize
847 # endif
848 _GL_FUNCDECL_RPL (getdtablesize, int, (void));
849 _GL_CXXALIAS_RPL (getdtablesize, int, (void));
850 # else
851 # if !@HAVE_GETDTABLESIZE@
852 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
853 # endif
854 /* Need to cast, because on AIX, the parameter list is
855 (...). */
856 _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
857 # endif
858 _GL_CXXALIASWARN (getdtablesize);
859 #elif defined GNULIB_POSIXCHECK
860 # undef getdtablesize
861 # if HAVE_RAW_DECL_GETDTABLESIZE
862 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
863 "use gnulib module getdtablesize for portability");
864 # endif
865 #endif
868 #if @GNULIB_GETENTROPY@
869 /* Fill a buffer with random bytes. */
870 # if !@HAVE_GETENTROPY@
871 _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
872 # endif
873 _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
874 _GL_CXXALIASWARN (getentropy);
875 #elif defined GNULIB_POSIXCHECK
876 # undef getentropy
877 # if HAVE_RAW_DECL_GETENTROPY
878 _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
879 "use gnulib module getentropy for portability");
880 # endif
881 #endif
884 #if @GNULIB_GETGROUPS@
885 /* Return the supplemental groups that the current process belongs to.
886 It is unspecified whether the effective group id is in the list.
887 If N is 0, return the group count; otherwise, N describes how many
888 entries are available in GROUPS. Return -1 and set errno if N is
889 not 0 and not large enough. Fails with ENOSYS on some systems. */
890 # if @REPLACE_GETGROUPS@
891 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
892 # undef getgroups
893 # define getgroups rpl_getgroups
894 # endif
895 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
896 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
897 # else
898 # if !@HAVE_GETGROUPS@
899 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
900 # endif
901 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
902 # endif
903 _GL_CXXALIASWARN (getgroups);
904 #elif defined GNULIB_POSIXCHECK
905 # undef getgroups
906 # if HAVE_RAW_DECL_GETGROUPS
907 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
908 "use gnulib module getgroups for portability");
909 # endif
910 #endif
913 #if @GNULIB_GETHOSTNAME@
914 /* Return the standard host name of the machine.
915 WARNING! The host name may or may not be fully qualified.
917 Put up to LEN bytes of the host name into NAME.
918 Null terminate it if the name is shorter than LEN.
919 If the host name is longer than LEN, set errno = EINVAL and return -1.
920 Return 0 if successful, otherwise set errno and return -1. */
921 # if @UNISTD_H_HAVE_WINSOCK2_H@
922 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
923 # undef gethostname
924 # define gethostname rpl_gethostname
925 # endif
926 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
927 _GL_ARG_NONNULL ((1)));
928 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
929 # else
930 # if !@HAVE_GETHOSTNAME@
931 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
932 _GL_ARG_NONNULL ((1)));
933 # endif
934 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
935 parameter is
936 int len. */
937 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
938 # endif
939 _GL_CXXALIASWARN (gethostname);
940 #elif @UNISTD_H_HAVE_WINSOCK2_H@
941 # undef gethostname
942 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
943 #elif defined GNULIB_POSIXCHECK
944 # undef gethostname
945 # if HAVE_RAW_DECL_GETHOSTNAME
946 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
947 "use gnulib module gethostname for portability");
948 # endif
949 #endif
952 #if @GNULIB_GETLOGIN@
953 /* Returns the user's login name, or NULL if it cannot be found. Upon error,
954 returns NULL with errno set.
956 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
958 Most programs don't need to use this function, because the information is
959 available through environment variables:
960 ${LOGNAME-$USER} on Unix platforms,
961 $USERNAME on native Windows platforms.
963 # if !@HAVE_DECL_GETLOGIN@
964 _GL_FUNCDECL_SYS (getlogin, char *, (void));
965 # endif
966 _GL_CXXALIAS_SYS (getlogin, char *, (void));
967 _GL_CXXALIASWARN (getlogin);
968 #elif defined GNULIB_POSIXCHECK
969 # undef getlogin
970 # if HAVE_RAW_DECL_GETLOGIN
971 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
972 "use gnulib module getlogin for portability");
973 # endif
974 #endif
977 #if @GNULIB_GETLOGIN_R@
978 /* Copies the user's login name to NAME.
979 The array pointed to by NAME has room for SIZE bytes.
981 Returns 0 if successful. Upon error, an error number is returned, or -1 in
982 the case that the login name cannot be found but no specific error is
983 provided (this case is hopefully rare but is left open by the POSIX spec).
985 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
987 Most programs don't need to use this function, because the information is
988 available through environment variables:
989 ${LOGNAME-$USER} on Unix platforms,
990 $USERNAME on native Windows platforms.
992 # if @REPLACE_GETLOGIN_R@
993 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
994 # define getlogin_r rpl_getlogin_r
995 # endif
996 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
997 _GL_ARG_NONNULL ((1)));
998 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
999 # else
1000 # if !@HAVE_DECL_GETLOGIN_R@
1001 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
1002 _GL_ARG_NONNULL ((1)));
1003 # endif
1004 /* Need to cast, because on Solaris 10 systems, the second argument is
1005 int size. */
1006 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
1007 # endif
1008 _GL_CXXALIASWARN (getlogin_r);
1009 #elif defined GNULIB_POSIXCHECK
1010 # undef getlogin_r
1011 # if HAVE_RAW_DECL_GETLOGIN_R
1012 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
1013 "use gnulib module getlogin_r for portability");
1014 # endif
1015 #endif
1018 #if @GNULIB_GETPAGESIZE@
1019 # if @REPLACE_GETPAGESIZE@
1020 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1021 # define getpagesize rpl_getpagesize
1022 # endif
1023 _GL_FUNCDECL_RPL (getpagesize, int, (void));
1024 _GL_CXXALIAS_RPL (getpagesize, int, (void));
1025 # else
1026 /* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
1027 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
1028 # if defined __hpux
1029 _GL_FUNCDECL_SYS (getpagesize, int, (void));
1030 # endif
1031 # if !@HAVE_GETPAGESIZE@
1032 # if !defined getpagesize
1033 /* This is for POSIX systems. */
1034 # if !defined _gl_getpagesize && defined _SC_PAGESIZE
1035 # if ! (defined __VMS && __VMS_VER < 70000000)
1036 # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
1037 # endif
1038 # endif
1039 /* This is for older VMS. */
1040 # if !defined _gl_getpagesize && defined __VMS
1041 # ifdef __ALPHA
1042 # define _gl_getpagesize() 8192
1043 # else
1044 # define _gl_getpagesize() 512
1045 # endif
1046 # endif
1047 /* This is for BeOS. */
1048 # if !defined _gl_getpagesize && @HAVE_OS_H@
1049 # include <OS.h>
1050 # if defined B_PAGE_SIZE
1051 # define _gl_getpagesize() B_PAGE_SIZE
1052 # endif
1053 # endif
1054 /* This is for AmigaOS4.0. */
1055 # if !defined _gl_getpagesize && defined __amigaos4__
1056 # define _gl_getpagesize() 2048
1057 # endif
1058 /* This is for older Unix systems. */
1059 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
1060 # include <sys/param.h>
1061 # ifdef EXEC_PAGESIZE
1062 # define _gl_getpagesize() EXEC_PAGESIZE
1063 # else
1064 # ifdef NBPG
1065 # ifndef CLSIZE
1066 # define CLSIZE 1
1067 # endif
1068 # define _gl_getpagesize() (NBPG * CLSIZE)
1069 # else
1070 # ifdef NBPC
1071 # define _gl_getpagesize() NBPC
1072 # endif
1073 # endif
1074 # endif
1075 # endif
1076 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1077 # define getpagesize() _gl_getpagesize ()
1078 # else
1079 # if !GNULIB_defined_getpagesize_function
1080 _GL_UNISTD_INLINE int
1081 getpagesize ()
1083 return _gl_getpagesize ();
1085 # define GNULIB_defined_getpagesize_function 1
1086 # endif
1087 # endif
1088 # endif
1089 # endif
1090 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
1091 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
1092 # endif
1093 # if @HAVE_DECL_GETPAGESIZE@
1094 _GL_CXXALIASWARN (getpagesize);
1095 # endif
1096 #elif defined GNULIB_POSIXCHECK
1097 # undef getpagesize
1098 # if HAVE_RAW_DECL_GETPAGESIZE
1099 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1100 "use gnulib module getpagesize for portability");
1101 # endif
1102 #endif
1105 #if @GNULIB_GETPASS@
1106 /* Function getpass() from module 'getpass':
1107 Read a password from /dev/tty or stdin.
1108 Function getpass() from module 'getpass-gnu':
1109 Read a password of arbitrary length from /dev/tty or stdin. */
1110 # if @REPLACE_GETPASS@
1111 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1112 # undef getpass
1113 # define getpass rpl_getpass
1114 # endif
1115 _GL_FUNCDECL_RPL (getpass, char *, (const char *prompt)
1116 _GL_ARG_NONNULL ((1)));
1117 _GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
1118 # else
1119 # if !@HAVE_GETPASS@
1120 _GL_FUNCDECL_SYS (getpass, char *, (const char *prompt)
1121 _GL_ARG_NONNULL ((1)));
1122 # endif
1123 _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
1124 # endif
1125 _GL_CXXALIASWARN (getpass);
1126 #elif defined GNULIB_POSIXCHECK
1127 # undef getpass
1128 # if HAVE_RAW_DECL_GETPASS
1129 _GL_WARN_ON_USE (getpass, "getpass is unportable - "
1130 "use gnulib module getpass or getpass-gnu for portability");
1131 # endif
1132 #endif
1135 #if defined _WIN32 && !defined __CYGWIN__
1136 # undef getpid
1137 # define getpid _getpid
1138 #endif
1141 #if @GNULIB_GETUSERSHELL@
1142 /* Return the next valid login shell on the system, or NULL when the end of
1143 the list has been reached. */
1144 # if !@HAVE_DECL_GETUSERSHELL@
1145 _GL_FUNCDECL_SYS (getusershell, char *, (void));
1146 # endif
1147 _GL_CXXALIAS_SYS (getusershell, char *, (void));
1148 _GL_CXXALIASWARN (getusershell);
1149 #elif defined GNULIB_POSIXCHECK
1150 # undef getusershell
1151 # if HAVE_RAW_DECL_GETUSERSHELL
1152 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
1153 "use gnulib module getusershell for portability");
1154 # endif
1155 #endif
1157 #if @GNULIB_GETUSERSHELL@
1158 /* Rewind to pointer that is advanced at each getusershell() call. */
1159 # if !@HAVE_DECL_GETUSERSHELL@
1160 _GL_FUNCDECL_SYS (setusershell, void, (void));
1161 # endif
1162 _GL_CXXALIAS_SYS (setusershell, void, (void));
1163 _GL_CXXALIASWARN (setusershell);
1164 #elif defined GNULIB_POSIXCHECK
1165 # undef setusershell
1166 # if HAVE_RAW_DECL_SETUSERSHELL
1167 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
1168 "use gnulib module getusershell for portability");
1169 # endif
1170 #endif
1172 #if @GNULIB_GETUSERSHELL@
1173 /* Free the pointer that is advanced at each getusershell() call and
1174 associated resources. */
1175 # if !@HAVE_DECL_GETUSERSHELL@
1176 _GL_FUNCDECL_SYS (endusershell, void, (void));
1177 # endif
1178 _GL_CXXALIAS_SYS (endusershell, void, (void));
1179 _GL_CXXALIASWARN (endusershell);
1180 #elif defined GNULIB_POSIXCHECK
1181 # undef endusershell
1182 # if HAVE_RAW_DECL_ENDUSERSHELL
1183 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
1184 "use gnulib module getusershell for portability");
1185 # endif
1186 #endif
1189 #if @GNULIB_GROUP_MEMBER@
1190 /* Determine whether group id is in calling user's group list. */
1191 # if !@HAVE_GROUP_MEMBER@
1192 _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
1193 # endif
1194 _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
1195 _GL_CXXALIASWARN (group_member);
1196 #elif defined GNULIB_POSIXCHECK
1197 # undef group_member
1198 # if HAVE_RAW_DECL_GROUP_MEMBER
1199 _GL_WARN_ON_USE (group_member, "group_member is unportable - "
1200 "use gnulib module group-member for portability");
1201 # endif
1202 #endif
1205 #if @GNULIB_ISATTY@
1206 # if @REPLACE_ISATTY@
1207 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1208 # undef isatty
1209 # define isatty rpl_isatty
1210 # endif
1211 _GL_FUNCDECL_RPL (isatty, int, (int fd));
1212 _GL_CXXALIAS_RPL (isatty, int, (int fd));
1213 # elif defined _WIN32 && !defined __CYGWIN__
1214 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1215 # undef isatty
1216 # define isatty _isatty
1217 # endif
1218 _GL_CXXALIAS_MDA (isatty, int, (int fd));
1219 # else
1220 _GL_CXXALIAS_SYS (isatty, int, (int fd));
1221 # endif
1222 _GL_CXXALIASWARN (isatty);
1223 #elif defined GNULIB_POSIXCHECK
1224 # undef isatty
1225 # if HAVE_RAW_DECL_ISATTY
1226 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
1227 "use gnulib module isatty for portability");
1228 # endif
1229 #elif defined _WIN32 && !defined __CYGWIN__
1230 # undef isatty
1231 # define isatty _isatty
1232 #endif
1235 #if @GNULIB_LCHOWN@
1236 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
1237 to GID (if GID is not -1). Do not follow symbolic links.
1238 Return 0 if successful, otherwise -1 and errno set.
1239 See the POSIX:2008 specification
1240 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
1241 # if @REPLACE_LCHOWN@
1242 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1243 # undef lchown
1244 # define lchown rpl_lchown
1245 # endif
1246 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
1247 _GL_ARG_NONNULL ((1)));
1248 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
1249 # else
1250 # if !@HAVE_LCHOWN@
1251 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
1252 _GL_ARG_NONNULL ((1)));
1253 # endif
1254 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
1255 # endif
1256 _GL_CXXALIASWARN (lchown);
1257 #elif defined GNULIB_POSIXCHECK
1258 # undef lchown
1259 # if HAVE_RAW_DECL_LCHOWN
1260 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1261 "use gnulib module lchown for portability");
1262 # endif
1263 #endif
1266 #if @GNULIB_LINK@
1267 /* Create a new hard link for an existing file.
1268 Return 0 if successful, otherwise -1 and errno set.
1269 See POSIX:2008 specification
1270 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
1271 # if @REPLACE_LINK@
1272 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1273 # define link rpl_link
1274 # endif
1275 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
1276 _GL_ARG_NONNULL ((1, 2)));
1277 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1278 # else
1279 # if !@HAVE_LINK@
1280 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
1281 _GL_ARG_NONNULL ((1, 2)));
1282 # endif
1283 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1284 # endif
1285 _GL_CXXALIASWARN (link);
1286 #elif defined GNULIB_POSIXCHECK
1287 # undef link
1288 # if HAVE_RAW_DECL_LINK
1289 _GL_WARN_ON_USE (link, "link is unportable - "
1290 "use gnulib module link for portability");
1291 # endif
1292 #endif
1295 #if @GNULIB_LINKAT@
1296 /* Create a new hard link for an existing file, relative to two
1297 directories. FLAG controls whether symlinks are followed.
1298 Return 0 if successful, otherwise -1 and errno set. */
1299 # if @REPLACE_LINKAT@
1300 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1301 # undef linkat
1302 # define linkat rpl_linkat
1303 # endif
1304 _GL_FUNCDECL_RPL (linkat, int,
1305 (int fd1, const char *path1, int fd2, const char *path2,
1306 int flag)
1307 _GL_ARG_NONNULL ((2, 4)));
1308 _GL_CXXALIAS_RPL (linkat, int,
1309 (int fd1, const char *path1, int fd2, const char *path2,
1310 int flag));
1311 # else
1312 # if !@HAVE_LINKAT@
1313 _GL_FUNCDECL_SYS (linkat, int,
1314 (int fd1, const char *path1, int fd2, const char *path2,
1315 int flag)
1316 _GL_ARG_NONNULL ((2, 4)));
1317 # endif
1318 _GL_CXXALIAS_SYS (linkat, int,
1319 (int fd1, const char *path1, int fd2, const char *path2,
1320 int flag));
1321 # endif
1322 _GL_CXXALIASWARN (linkat);
1323 #elif defined GNULIB_POSIXCHECK
1324 # undef linkat
1325 # if HAVE_RAW_DECL_LINKAT
1326 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1327 "use gnulib module linkat for portability");
1328 # endif
1329 #endif
1332 #if @GNULIB_LSEEK@
1333 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
1334 Return the new offset if successful, otherwise -1 and errno set.
1335 See the POSIX:2008 specification
1336 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
1337 # if @REPLACE_LSEEK@
1338 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1339 # define lseek rpl_lseek
1340 # endif
1341 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1342 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1343 # elif defined _WIN32 && !defined __CYGWIN__
1344 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1345 # undef lseek
1346 # define lseek _lseek
1347 # endif
1348 _GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence));
1349 # else
1350 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1351 # endif
1352 _GL_CXXALIASWARN (lseek);
1353 #elif defined GNULIB_POSIXCHECK
1354 # undef lseek
1355 # if HAVE_RAW_DECL_LSEEK
1356 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1357 "systems - use gnulib module lseek for portability");
1358 # endif
1359 #elif defined _WIN32 && !defined __CYGWIN__
1360 # undef lseek
1361 # define lseek _lseek
1362 #endif
1365 #if @GNULIB_PIPE@
1366 /* Create a pipe, defaulting to O_BINARY mode.
1367 Store the read-end as fd[0] and the write-end as fd[1].
1368 Return 0 upon success, or -1 with errno set upon failure. */
1369 # if !@HAVE_PIPE@
1370 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
1371 # endif
1372 _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1373 _GL_CXXALIASWARN (pipe);
1374 #elif defined GNULIB_POSIXCHECK
1375 # undef pipe
1376 # if HAVE_RAW_DECL_PIPE
1377 _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1378 "use gnulib module pipe-posix for portability");
1379 # endif
1380 #endif
1383 #if @GNULIB_PIPE2@
1384 /* Create a pipe, applying the given flags when opening the read-end of the
1385 pipe and the write-end of the pipe.
1386 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1387 and O_TEXT, O_BINARY (defined in "binary-io.h").
1388 Store the read-end as fd[0] and the write-end as fd[1].
1389 Return 0 upon success, or -1 with errno set upon failure.
1390 See also the Linux man page at
1391 <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
1392 # if @HAVE_PIPE2@
1393 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1394 # define pipe2 rpl_pipe2
1395 # endif
1396 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1397 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1398 # else
1399 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1400 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1401 # endif
1402 _GL_CXXALIASWARN (pipe2);
1403 #elif defined GNULIB_POSIXCHECK
1404 # undef pipe2
1405 # if HAVE_RAW_DECL_PIPE2
1406 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1407 "use gnulib module pipe2 for portability");
1408 # endif
1409 #endif
1412 #if @GNULIB_PREAD@
1413 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1414 Return the number of bytes placed into BUF if successful, otherwise
1415 set errno and return -1. 0 indicates EOF.
1416 See the POSIX:2008 specification
1417 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
1418 # if @REPLACE_PREAD@
1419 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1420 # undef pread
1421 # define pread rpl_pread
1422 # endif
1423 _GL_FUNCDECL_RPL (pread, ssize_t,
1424 (int fd, void *buf, size_t bufsize, off_t offset)
1425 _GL_ARG_NONNULL ((2)));
1426 _GL_CXXALIAS_RPL (pread, ssize_t,
1427 (int fd, void *buf, size_t bufsize, off_t offset));
1428 # else
1429 # if !@HAVE_PREAD@
1430 _GL_FUNCDECL_SYS (pread, ssize_t,
1431 (int fd, void *buf, size_t bufsize, off_t offset)
1432 _GL_ARG_NONNULL ((2)));
1433 # endif
1434 _GL_CXXALIAS_SYS (pread, ssize_t,
1435 (int fd, void *buf, size_t bufsize, off_t offset));
1436 # endif
1437 _GL_CXXALIASWARN (pread);
1438 #elif defined GNULIB_POSIXCHECK
1439 # undef pread
1440 # if HAVE_RAW_DECL_PREAD
1441 _GL_WARN_ON_USE (pread, "pread is unportable - "
1442 "use gnulib module pread for portability");
1443 # endif
1444 #endif
1447 #if @GNULIB_PWRITE@
1448 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1449 Return the number of bytes written if successful, otherwise
1450 set errno and return -1. 0 indicates nothing written. See the
1451 POSIX:2008 specification
1452 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
1453 # if @REPLACE_PWRITE@
1454 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1455 # undef pwrite
1456 # define pwrite rpl_pwrite
1457 # endif
1458 _GL_FUNCDECL_RPL (pwrite, ssize_t,
1459 (int fd, const void *buf, size_t bufsize, off_t offset)
1460 _GL_ARG_NONNULL ((2)));
1461 _GL_CXXALIAS_RPL (pwrite, ssize_t,
1462 (int fd, const void *buf, size_t bufsize, off_t offset));
1463 # else
1464 # if !@HAVE_PWRITE@
1465 _GL_FUNCDECL_SYS (pwrite, ssize_t,
1466 (int fd, const void *buf, size_t bufsize, off_t offset)
1467 _GL_ARG_NONNULL ((2)));
1468 # endif
1469 _GL_CXXALIAS_SYS (pwrite, ssize_t,
1470 (int fd, const void *buf, size_t bufsize, off_t offset));
1471 # endif
1472 _GL_CXXALIASWARN (pwrite);
1473 #elif defined GNULIB_POSIXCHECK
1474 # undef pwrite
1475 # if HAVE_RAW_DECL_PWRITE
1476 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1477 "use gnulib module pwrite for portability");
1478 # endif
1479 #endif
1482 #if @GNULIB_READ@
1483 /* Read up to COUNT bytes from file descriptor FD into the buffer starting
1484 at BUF. See the POSIX:2008 specification
1485 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
1486 # if @REPLACE_READ@
1487 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1488 # undef read
1489 # define read rpl_read
1490 # endif
1491 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1492 _GL_ARG_NONNULL ((2)));
1493 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1494 # elif defined _WIN32 && !defined __CYGWIN__
1495 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1496 # undef read
1497 # define read _read
1498 # endif
1499 _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
1500 # else
1501 /* Need to cast, because on mingw, the third parameter is
1502 unsigned int count
1503 and the return type is 'int'. */
1504 _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
1505 # endif
1506 _GL_CXXALIASWARN (read);
1507 #elif defined _WIN32 && !defined __CYGWIN__
1508 # undef read
1509 # define read _read
1510 #endif
1513 #if @GNULIB_READLINK@
1514 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
1515 bytes of it into BUF. Return the number of bytes placed into BUF if
1516 successful, otherwise -1 and errno set.
1517 See the POSIX:2008 specification
1518 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
1519 # if @REPLACE_READLINK@
1520 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1521 # define readlink rpl_readlink
1522 # endif
1523 _GL_FUNCDECL_RPL (readlink, ssize_t,
1524 (const char *restrict file,
1525 char *restrict buf, size_t bufsize)
1526 _GL_ARG_NONNULL ((1, 2)));
1527 _GL_CXXALIAS_RPL (readlink, ssize_t,
1528 (const char *restrict file,
1529 char *restrict buf, size_t bufsize));
1530 # else
1531 # if !@HAVE_READLINK@
1532 _GL_FUNCDECL_SYS (readlink, ssize_t,
1533 (const char *restrict file,
1534 char *restrict buf, size_t bufsize)
1535 _GL_ARG_NONNULL ((1, 2)));
1536 # endif
1537 _GL_CXXALIAS_SYS (readlink, ssize_t,
1538 (const char *restrict file,
1539 char *restrict buf, size_t bufsize));
1540 # endif
1541 _GL_CXXALIASWARN (readlink);
1542 #elif defined GNULIB_POSIXCHECK
1543 # undef readlink
1544 # if HAVE_RAW_DECL_READLINK
1545 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1546 "use gnulib module readlink for portability");
1547 # endif
1548 #endif
1551 #if @GNULIB_READLINKAT@
1552 # if @REPLACE_READLINKAT@
1553 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1554 # define readlinkat rpl_readlinkat
1555 # endif
1556 _GL_FUNCDECL_RPL (readlinkat, ssize_t,
1557 (int fd, char const *restrict file,
1558 char *restrict buf, size_t len)
1559 _GL_ARG_NONNULL ((2, 3)));
1560 _GL_CXXALIAS_RPL (readlinkat, ssize_t,
1561 (int fd, char const *restrict file,
1562 char *restrict buf, size_t len));
1563 # else
1564 # if !@HAVE_READLINKAT@
1565 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
1566 (int fd, char const *restrict file,
1567 char *restrict buf, size_t len)
1568 _GL_ARG_NONNULL ((2, 3)));
1569 # endif
1570 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
1571 (int fd, char const *restrict file,
1572 char *restrict buf, size_t len));
1573 # endif
1574 _GL_CXXALIASWARN (readlinkat);
1575 #elif defined GNULIB_POSIXCHECK
1576 # undef readlinkat
1577 # if HAVE_RAW_DECL_READLINKAT
1578 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1579 "use gnulib module readlinkat for portability");
1580 # endif
1581 #endif
1584 #if @GNULIB_RMDIR@
1585 /* Remove the directory DIR. */
1586 # if @REPLACE_RMDIR@
1587 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1588 # define rmdir rpl_rmdir
1589 # endif
1590 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1591 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1592 # elif defined _WIN32 && !defined __CYGWIN__
1593 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1594 # undef rmdir
1595 # define rmdir _rmdir
1596 # endif
1597 _GL_CXXALIAS_MDA (rmdir, int, (char const *name));
1598 # else
1599 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1600 # endif
1601 _GL_CXXALIASWARN (rmdir);
1602 #elif defined GNULIB_POSIXCHECK
1603 # undef rmdir
1604 # if HAVE_RAW_DECL_RMDIR
1605 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1606 "use gnulib module rmdir for portability");
1607 # endif
1608 #elif defined _WIN32 && !defined __CYGWIN__
1609 # undef rmdir
1610 # define rmdir _rmdir
1611 #endif
1614 #if @GNULIB_SETHOSTNAME@
1615 /* Set the host name of the machine.
1616 The host name may or may not be fully qualified.
1618 Put LEN bytes of NAME into the host name.
1619 Return 0 if successful, otherwise, set errno and return -1.
1621 Platforms with no ability to set the hostname return -1 and set
1622 errno = ENOSYS. */
1623 # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
1624 _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
1625 _GL_ARG_NONNULL ((1)));
1626 # endif
1627 /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
1628 and FreeBSD 6.4 the second parameter is int. On Solaris 11
1629 2011-10, the first parameter is not const. */
1630 _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
1631 _GL_CXXALIASWARN (sethostname);
1632 #elif defined GNULIB_POSIXCHECK
1633 # undef sethostname
1634 # if HAVE_RAW_DECL_SETHOSTNAME
1635 _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
1636 "use gnulib module sethostname for portability");
1637 # endif
1638 #endif
1641 #if @GNULIB_SLEEP@
1642 /* Pause the execution of the current thread for N seconds.
1643 Returns the number of seconds left to sleep.
1644 See the POSIX:2008 specification
1645 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
1646 # if @REPLACE_SLEEP@
1647 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1648 # undef sleep
1649 # define sleep rpl_sleep
1650 # endif
1651 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1652 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1653 # else
1654 # if !@HAVE_SLEEP@
1655 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1656 # endif
1657 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1658 # endif
1659 _GL_CXXALIASWARN (sleep);
1660 #elif defined GNULIB_POSIXCHECK
1661 # undef sleep
1662 # if HAVE_RAW_DECL_SLEEP
1663 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
1664 "use gnulib module sleep for portability");
1665 # endif
1666 #endif
1669 #if defined _WIN32 && !defined __CYGWIN__
1670 # undef swab
1671 # define swab _swab
1672 #endif
1675 #if @GNULIB_SYMLINK@
1676 # if @REPLACE_SYMLINK@
1677 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1678 # undef symlink
1679 # define symlink rpl_symlink
1680 # endif
1681 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1682 _GL_ARG_NONNULL ((1, 2)));
1683 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1684 # else
1685 # if !@HAVE_SYMLINK@
1686 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1687 _GL_ARG_NONNULL ((1, 2)));
1688 # endif
1689 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1690 # endif
1691 _GL_CXXALIASWARN (symlink);
1692 #elif defined GNULIB_POSIXCHECK
1693 # undef symlink
1694 # if HAVE_RAW_DECL_SYMLINK
1695 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
1696 "use gnulib module symlink for portability");
1697 # endif
1698 #endif
1701 #if @GNULIB_SYMLINKAT@
1702 # if @REPLACE_SYMLINKAT@
1703 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1704 # undef symlinkat
1705 # define symlinkat rpl_symlinkat
1706 # endif
1707 _GL_FUNCDECL_RPL (symlinkat, int,
1708 (char const *contents, int fd, char const *file)
1709 _GL_ARG_NONNULL ((1, 3)));
1710 _GL_CXXALIAS_RPL (symlinkat, int,
1711 (char const *contents, int fd, char const *file));
1712 # else
1713 # if !@HAVE_SYMLINKAT@
1714 _GL_FUNCDECL_SYS (symlinkat, int,
1715 (char const *contents, int fd, char const *file)
1716 _GL_ARG_NONNULL ((1, 3)));
1717 # endif
1718 _GL_CXXALIAS_SYS (symlinkat, int,
1719 (char const *contents, int fd, char const *file));
1720 # endif
1721 _GL_CXXALIASWARN (symlinkat);
1722 #elif defined GNULIB_POSIXCHECK
1723 # undef symlinkat
1724 # if HAVE_RAW_DECL_SYMLINKAT
1725 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1726 "use gnulib module symlinkat for portability");
1727 # endif
1728 #endif
1731 #if @GNULIB_TRUNCATE@
1732 /* Change the size of the file designated by FILENAME to become equal to LENGTH.
1733 Return 0 if successful, otherwise -1 and errno set.
1734 See the POSIX:2008 specification
1735 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */
1736 # if @REPLACE_TRUNCATE@
1737 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1738 # undef truncate
1739 # define truncate rpl_truncate
1740 # endif
1741 _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
1742 _GL_ARG_NONNULL ((1)));
1743 _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
1744 # else
1745 # if !@HAVE_DECL_TRUNCATE@
1746 _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
1747 _GL_ARG_NONNULL ((1)));
1748 # endif
1749 _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
1750 # endif
1751 _GL_CXXALIASWARN (truncate);
1752 #elif defined GNULIB_POSIXCHECK
1753 # undef truncate
1754 # if HAVE_RAW_DECL_TRUNCATE
1755 _GL_WARN_ON_USE (truncate, "truncate is unportable - "
1756 "use gnulib module truncate for portability");
1757 # endif
1758 #endif
1761 #if @GNULIB_TTYNAME_R@
1762 /* Store at most BUFLEN characters of the pathname of the terminal FD is
1763 open on in BUF. Return 0 on success, otherwise an error number. */
1764 # if @REPLACE_TTYNAME_R@
1765 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1766 # undef ttyname_r
1767 # define ttyname_r rpl_ttyname_r
1768 # endif
1769 _GL_FUNCDECL_RPL (ttyname_r, int,
1770 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1771 _GL_CXXALIAS_RPL (ttyname_r, int,
1772 (int fd, char *buf, size_t buflen));
1773 # else
1774 # if !@HAVE_DECL_TTYNAME_R@
1775 _GL_FUNCDECL_SYS (ttyname_r, int,
1776 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1777 # endif
1778 _GL_CXXALIAS_SYS (ttyname_r, int,
1779 (int fd, char *buf, size_t buflen));
1780 # endif
1781 _GL_CXXALIASWARN (ttyname_r);
1782 #elif defined GNULIB_POSIXCHECK
1783 # undef ttyname_r
1784 # if HAVE_RAW_DECL_TTYNAME_R
1785 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1786 "use gnulib module ttyname_r for portability");
1787 # endif
1788 #endif
1791 #if @GNULIB_UNLINK@
1792 # if @REPLACE_UNLINK@
1793 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1794 # undef unlink
1795 # define unlink rpl_unlink
1796 # endif
1797 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1798 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
1799 # elif defined _WIN32 && !defined __CYGWIN__
1800 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1801 # undef unlink
1802 # define unlink _unlink
1803 # endif
1804 _GL_CXXALIAS_MDA (unlink, int, (char const *file));
1805 # else
1806 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
1807 # endif
1808 _GL_CXXALIASWARN (unlink);
1809 #elif defined GNULIB_POSIXCHECK
1810 # undef unlink
1811 # if HAVE_RAW_DECL_UNLINK
1812 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
1813 "use gnulib module unlink for portability");
1814 # endif
1815 #elif defined _WIN32 && !defined __CYGWIN__
1816 # undef unlink
1817 # define unlink _unlink
1818 #endif
1821 #if @GNULIB_UNLINKAT@
1822 # if @REPLACE_UNLINKAT@
1823 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1824 # undef unlinkat
1825 # define unlinkat rpl_unlinkat
1826 # endif
1827 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1828 _GL_ARG_NONNULL ((2)));
1829 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1830 # else
1831 # if !@HAVE_UNLINKAT@
1832 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1833 _GL_ARG_NONNULL ((2)));
1834 # endif
1835 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1836 # endif
1837 _GL_CXXALIASWARN (unlinkat);
1838 #elif defined GNULIB_POSIXCHECK
1839 # undef unlinkat
1840 # if HAVE_RAW_DECL_UNLINKAT
1841 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1842 "use gnulib module openat for portability");
1843 # endif
1844 #endif
1847 #if @GNULIB_USLEEP@
1848 /* Pause the execution of the current thread for N microseconds.
1849 Returns 0 on completion, or -1 on range error.
1850 See the POSIX:2001 specification
1851 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
1852 # if @REPLACE_USLEEP@
1853 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1854 # undef usleep
1855 # define usleep rpl_usleep
1856 # endif
1857 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1858 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1859 # else
1860 # if !@HAVE_USLEEP@
1861 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1862 # endif
1863 /* Need to cast, because on Haiku, the first parameter is
1864 unsigned int n. */
1865 _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n));
1866 # endif
1867 _GL_CXXALIASWARN (usleep);
1868 #elif defined GNULIB_POSIXCHECK
1869 # undef usleep
1870 # if HAVE_RAW_DECL_USLEEP
1871 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1872 "use gnulib module usleep for portability");
1873 # endif
1874 #endif
1877 #if @GNULIB_WRITE@
1878 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
1879 See the POSIX:2008 specification
1880 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
1881 # if @REPLACE_WRITE@
1882 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1883 # undef write
1884 # define write rpl_write
1885 # endif
1886 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1887 _GL_ARG_NONNULL ((2)));
1888 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1889 # elif defined _WIN32 && !defined __CYGWIN__
1890 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1891 # undef write
1892 # define write _write
1893 # endif
1894 _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
1895 # else
1896 /* Need to cast, because on mingw, the third parameter is
1897 unsigned int count
1898 and the return type is 'int'. */
1899 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1900 # endif
1901 _GL_CXXALIASWARN (write);
1902 #elif defined _WIN32 && !defined __CYGWIN__
1903 # undef write
1904 # define write _write
1905 #endif
1907 _GL_INLINE_HEADER_END
1909 #endif /* _@GUARD_PREFIX@_UNISTD_H */
1910 #endif /* _GL_INCLUDING_UNISTD_H */
1911 #endif /* _@GUARD_PREFIX@_UNISTD_H */