Support compiling without -loldnames on native Windows.
[gnulib.git] / lib / unistd.in.h
blobefe237fb2f4fc4e2a6124ee50e9198bcea3d046a
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 /* Assume copy_file_range is always declared. */
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
407 #if @GNULIB_DUP@
408 # if @REPLACE_DUP@
409 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
410 # define dup rpl_dup
411 # endif
412 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
413 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
414 # elif defined _WIN32 && !defined __CYGWIN__
415 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
416 # undef dup
417 # define dup _dup
418 # endif
419 _GL_CXXALIAS_MDA (dup, int, (int oldfd));
420 # else
421 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
422 # endif
423 _GL_CXXALIASWARN (dup);
424 #elif defined GNULIB_POSIXCHECK
425 # undef dup
426 # if HAVE_RAW_DECL_DUP
427 _GL_WARN_ON_USE (dup, "dup is unportable - "
428 "use gnulib module dup for portability");
429 # endif
430 #elif defined _WIN32 && !defined __CYGWIN__
431 # undef dup
432 # define dup _dup
433 #endif
436 #if @GNULIB_DUP2@
437 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
438 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
439 Return newfd if successful, otherwise -1 and errno set.
440 See the POSIX:2008 specification
441 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
442 # if @REPLACE_DUP2@
443 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
444 # define dup2 rpl_dup2
445 # endif
446 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
447 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
448 # elif defined _WIN32 && !defined __CYGWIN__
449 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
450 # undef dup2
451 # define dup2 _dup2
452 # endif
453 _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
454 # else
455 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
456 # endif
457 _GL_CXXALIASWARN (dup2);
458 #elif defined GNULIB_POSIXCHECK
459 # undef dup2
460 # if HAVE_RAW_DECL_DUP2
461 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
462 "use gnulib module dup2 for portability");
463 # endif
464 #elif defined _WIN32 && !defined __CYGWIN__
465 # undef dup2
466 # define dup2 _dup2
467 #endif
470 #if @GNULIB_DUP3@
471 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
472 specified flags.
473 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
474 and O_TEXT, O_BINARY (defined in "binary-io.h").
475 Close NEWFD first if it is open.
476 Return newfd if successful, otherwise -1 and errno set.
477 See the Linux man page at
478 <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
479 # if @HAVE_DUP3@
480 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
481 # define dup3 rpl_dup3
482 # endif
483 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
484 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
485 # else
486 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
487 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
488 # endif
489 _GL_CXXALIASWARN (dup3);
490 #elif defined GNULIB_POSIXCHECK
491 # undef dup3
492 # if HAVE_RAW_DECL_DUP3
493 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
494 "use gnulib module dup3 for portability");
495 # endif
496 #endif
499 #if @GNULIB_ENVIRON@
500 # if defined __CYGWIN__ && !defined __i386__
501 /* The 'environ' variable is defined in a DLL. Therefore its declaration needs
502 the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it.
503 This leads to a link error on 64-bit Cygwin when the option
504 -Wl,--disable-auto-import is in use. */
505 _GL_EXTERN_C __declspec(dllimport) char **environ;
506 # endif
507 # if !@HAVE_DECL_ENVIRON@
508 /* Set of environment variables and values. An array of strings of the form
509 "VARIABLE=VALUE", terminated with a NULL. */
510 # if defined __APPLE__ && defined __MACH__
511 # include <TargetConditionals.h>
512 # if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
513 # define _GL_USE_CRT_EXTERNS
514 # endif
515 # endif
516 # ifdef _GL_USE_CRT_EXTERNS
517 # include <crt_externs.h>
518 # define environ (*_NSGetEnviron ())
519 # else
520 # ifdef __cplusplus
521 extern "C" {
522 # endif
523 extern char **environ;
524 # ifdef __cplusplus
526 # endif
527 # endif
528 # endif
529 #elif defined GNULIB_POSIXCHECK
530 # if HAVE_RAW_DECL_ENVIRON
531 _GL_UNISTD_INLINE char ***
532 _GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - "
533 "use gnulib module environ for portability")
534 rpl_environ (void)
536 return &environ;
538 # undef environ
539 # define environ (*rpl_environ ())
540 # endif
541 #endif
544 #if @GNULIB_EUIDACCESS@
545 /* Like access(), except that it uses the effective user id and group id of
546 the current process. */
547 # if !@HAVE_EUIDACCESS@
548 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
549 _GL_ARG_NONNULL ((1)));
550 # endif
551 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
552 _GL_CXXALIASWARN (euidaccess);
553 # if defined GNULIB_POSIXCHECK
554 /* Like access(), this function is a security risk. */
555 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
556 "use the gnulib module faccessat instead");
557 # endif
558 #elif defined GNULIB_POSIXCHECK
559 # undef euidaccess
560 # if HAVE_RAW_DECL_EUIDACCESS
561 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
562 "use gnulib module euidaccess for portability");
563 # endif
564 #endif
567 #if defined _WIN32 && !defined __CYGWIN__
568 # undef execl
569 # define execl _execl
570 #endif
572 #if defined _WIN32 && !defined __CYGWIN__
573 # undef execle
574 # define execle _execle
575 #endif
577 #if defined _WIN32 && !defined __CYGWIN__
578 # undef execlp
579 # define execlp _execlp
580 #endif
583 #if defined _WIN32 && !defined __CYGWIN__
584 # undef execv
585 # define execv _execv
586 #endif
588 #if defined _WIN32 && !defined __CYGWIN__
589 # undef execve
590 # define execve _execve
591 #endif
593 #if defined _WIN32 && !defined __CYGWIN__
594 # undef execvp
595 # define execvp _execvp
596 #endif
598 #if defined _WIN32 && !defined __CYGWIN__
599 # undef execvpe
600 # define execvpe _execvpe
601 #endif
604 #if @GNULIB_FACCESSAT@
605 # if @REPLACE_FACCESSAT@
606 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
607 # undef faccessat
608 # define faccessat rpl_faccessat
609 # endif
610 _GL_FUNCDECL_RPL (faccessat, int,
611 (int fd, char const *name, int mode, int flag)
612 _GL_ARG_NONNULL ((2)));
613 _GL_CXXALIAS_RPL (faccessat, int,
614 (int fd, char const *name, int mode, int flag));
615 # else
616 # if !@HAVE_FACCESSAT@
617 _GL_FUNCDECL_SYS (faccessat, int,
618 (int fd, char const *file, int mode, int flag)
619 _GL_ARG_NONNULL ((2)));
620 # endif
621 _GL_CXXALIAS_SYS (faccessat, int,
622 (int fd, char const *file, int mode, int flag));
623 # endif
624 _GL_CXXALIASWARN (faccessat);
625 #elif defined GNULIB_POSIXCHECK
626 # undef faccessat
627 # if HAVE_RAW_DECL_FACCESSAT
628 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
629 "use gnulib module faccessat for portability");
630 # endif
631 #endif
634 #if @GNULIB_FCHDIR@
635 /* Change the process' current working directory to the directory on which
636 the given file descriptor is open.
637 Return 0 if successful, otherwise -1 and errno set.
638 See the POSIX:2008 specification
639 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
640 # if ! @HAVE_FCHDIR@
641 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
643 /* Gnulib internal hooks needed to maintain the fchdir metadata. */
644 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
645 _GL_ARG_NONNULL ((2));
646 _GL_EXTERN_C void _gl_unregister_fd (int fd);
647 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
648 _GL_EXTERN_C const char *_gl_directory_name (int fd);
650 # else
651 # if !@HAVE_DECL_FCHDIR@
652 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
653 # endif
654 # endif
655 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
656 _GL_CXXALIASWARN (fchdir);
657 #elif defined GNULIB_POSIXCHECK
658 # undef fchdir
659 # if HAVE_RAW_DECL_FCHDIR
660 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
661 "use gnulib module fchdir for portability");
662 # endif
663 #endif
666 #if @GNULIB_FCHOWNAT@
667 # if @REPLACE_FCHOWNAT@
668 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
669 # undef fchownat
670 # define fchownat rpl_fchownat
671 # endif
672 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
673 uid_t owner, gid_t group, int flag)
674 _GL_ARG_NONNULL ((2)));
675 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
676 uid_t owner, gid_t group, int flag));
677 # else
678 # if !@HAVE_FCHOWNAT@
679 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
680 uid_t owner, gid_t group, int flag)
681 _GL_ARG_NONNULL ((2)));
682 # endif
683 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
684 uid_t owner, gid_t group, int flag));
685 # endif
686 _GL_CXXALIASWARN (fchownat);
687 #elif defined GNULIB_POSIXCHECK
688 # undef fchownat
689 # if HAVE_RAW_DECL_FCHOWNAT
690 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
691 "use gnulib module openat for portability");
692 # endif
693 #endif
696 #if @GNULIB_FDATASYNC@
697 /* Synchronize changes to a file.
698 Return 0 if successful, otherwise -1 and errno set.
699 See POSIX:2008 specification
700 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
701 # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
702 _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
703 # endif
704 _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
705 _GL_CXXALIASWARN (fdatasync);
706 #elif defined GNULIB_POSIXCHECK
707 # undef fdatasync
708 # if HAVE_RAW_DECL_FDATASYNC
709 _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
710 "use gnulib module fdatasync for portability");
711 # endif
712 #endif
715 #if @GNULIB_FSYNC@
716 /* Synchronize changes, including metadata, to a file.
717 Return 0 if successful, otherwise -1 and errno set.
718 See POSIX:2008 specification
719 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
720 # if !@HAVE_FSYNC@
721 _GL_FUNCDECL_SYS (fsync, int, (int fd));
722 # endif
723 _GL_CXXALIAS_SYS (fsync, int, (int fd));
724 _GL_CXXALIASWARN (fsync);
725 #elif defined GNULIB_POSIXCHECK
726 # undef fsync
727 # if HAVE_RAW_DECL_FSYNC
728 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
729 "use gnulib module fsync for portability");
730 # endif
731 #endif
734 #if @GNULIB_FTRUNCATE@
735 /* Change the size of the file to which FD is opened to become equal to LENGTH.
736 Return 0 if successful, otherwise -1 and errno set.
737 See the POSIX:2008 specification
738 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
739 # if @REPLACE_FTRUNCATE@
740 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
741 # undef ftruncate
742 # define ftruncate rpl_ftruncate
743 # endif
744 _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
745 _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
746 # else
747 # if !@HAVE_FTRUNCATE@
748 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
749 # endif
750 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
751 # endif
752 _GL_CXXALIASWARN (ftruncate);
753 #elif defined GNULIB_POSIXCHECK
754 # undef ftruncate
755 # if HAVE_RAW_DECL_FTRUNCATE
756 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
757 "use gnulib module ftruncate for portability");
758 # endif
759 #endif
762 #if @GNULIB_GETCWD@
763 /* Get the name of the current working directory, and put it in SIZE bytes
764 of BUF.
765 Return BUF if successful, or NULL if the directory couldn't be determined
766 or SIZE was too small.
767 See the POSIX:2008 specification
768 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
769 Additionally, the gnulib module 'getcwd' guarantees the following GNU
770 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
771 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
772 necessary. */
773 # if @REPLACE_GETCWD@
774 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
775 # define getcwd rpl_getcwd
776 # endif
777 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
778 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
779 # elif defined _WIN32 && !defined __CYGWIN__
780 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
781 # undef getcwd
782 # define getcwd _getcwd
783 # endif
784 _GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
785 # else
786 /* Need to cast, because on mingw, the second parameter is
787 int size. */
788 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
789 # endif
790 _GL_CXXALIASWARN (getcwd);
791 #elif defined GNULIB_POSIXCHECK
792 # undef getcwd
793 # if HAVE_RAW_DECL_GETCWD
794 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
795 "use gnulib module getcwd for portability");
796 # endif
797 #elif defined _WIN32 && !defined __CYGWIN__
798 # undef getcwd
799 # define getcwd _getcwd
800 #endif
803 #if @GNULIB_GETDOMAINNAME@
804 /* Return the NIS domain name of the machine.
805 WARNING! The NIS domain name is unrelated to the fully qualified host name
806 of the machine. It is also unrelated to email addresses.
807 WARNING! The NIS domain name is usually the empty string or "(none)" when
808 not using NIS.
810 Put up to LEN bytes of the NIS domain name into NAME.
811 Null terminate it if the name is shorter than LEN.
812 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
813 Return 0 if successful, otherwise set errno and return -1. */
814 # if @REPLACE_GETDOMAINNAME@
815 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
816 # undef getdomainname
817 # define getdomainname rpl_getdomainname
818 # endif
819 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
820 _GL_ARG_NONNULL ((1)));
821 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
822 # else
823 # if !@HAVE_DECL_GETDOMAINNAME@
824 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
825 _GL_ARG_NONNULL ((1)));
826 # endif
827 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
828 # endif
829 _GL_CXXALIASWARN (getdomainname);
830 #elif defined GNULIB_POSIXCHECK
831 # undef getdomainname
832 # if HAVE_RAW_DECL_GETDOMAINNAME
833 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
834 "use gnulib module getdomainname for portability");
835 # endif
836 #endif
839 #if @GNULIB_GETDTABLESIZE@
840 /* Return the maximum number of file descriptors in the current process.
841 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
842 # if @REPLACE_GETDTABLESIZE@
843 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
844 # undef getdtablesize
845 # define getdtablesize rpl_getdtablesize
846 # endif
847 _GL_FUNCDECL_RPL (getdtablesize, int, (void));
848 _GL_CXXALIAS_RPL (getdtablesize, int, (void));
849 # else
850 # if !@HAVE_GETDTABLESIZE@
851 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
852 # endif
853 /* Need to cast, because on AIX, the parameter list is
854 (...). */
855 _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
856 # endif
857 _GL_CXXALIASWARN (getdtablesize);
858 #elif defined GNULIB_POSIXCHECK
859 # undef getdtablesize
860 # if HAVE_RAW_DECL_GETDTABLESIZE
861 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
862 "use gnulib module getdtablesize for portability");
863 # endif
864 #endif
867 #if @GNULIB_GETENTROPY@
868 /* Fill a buffer with random bytes. */
869 # if !@HAVE_GETENTROPY@
870 _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
871 # endif
872 _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
873 _GL_CXXALIASWARN (getentropy);
874 #elif defined GNULIB_POSIXCHECK
875 # undef getentropy
876 # if HAVE_RAW_DECL_GETENTROPY
877 _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
878 "use gnulib module getentropy for portability");
879 # endif
880 #endif
883 #if @GNULIB_GETGROUPS@
884 /* Return the supplemental groups that the current process belongs to.
885 It is unspecified whether the effective group id is in the list.
886 If N is 0, return the group count; otherwise, N describes how many
887 entries are available in GROUPS. Return -1 and set errno if N is
888 not 0 and not large enough. Fails with ENOSYS on some systems. */
889 # if @REPLACE_GETGROUPS@
890 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
891 # undef getgroups
892 # define getgroups rpl_getgroups
893 # endif
894 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
895 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
896 # else
897 # if !@HAVE_GETGROUPS@
898 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
899 # endif
900 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
901 # endif
902 _GL_CXXALIASWARN (getgroups);
903 #elif defined GNULIB_POSIXCHECK
904 # undef getgroups
905 # if HAVE_RAW_DECL_GETGROUPS
906 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
907 "use gnulib module getgroups for portability");
908 # endif
909 #endif
912 #if @GNULIB_GETHOSTNAME@
913 /* Return the standard host name of the machine.
914 WARNING! The host name may or may not be fully qualified.
916 Put up to LEN bytes of the host name into NAME.
917 Null terminate it if the name is shorter than LEN.
918 If the host name is longer than LEN, set errno = EINVAL and return -1.
919 Return 0 if successful, otherwise set errno and return -1. */
920 # if @UNISTD_H_HAVE_WINSOCK2_H@
921 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
922 # undef gethostname
923 # define gethostname rpl_gethostname
924 # endif
925 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
926 _GL_ARG_NONNULL ((1)));
927 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
928 # else
929 # if !@HAVE_GETHOSTNAME@
930 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
931 _GL_ARG_NONNULL ((1)));
932 # endif
933 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
934 parameter is
935 int len. */
936 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
937 # endif
938 _GL_CXXALIASWARN (gethostname);
939 #elif @UNISTD_H_HAVE_WINSOCK2_H@
940 # undef gethostname
941 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
942 #elif defined GNULIB_POSIXCHECK
943 # undef gethostname
944 # if HAVE_RAW_DECL_GETHOSTNAME
945 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
946 "use gnulib module gethostname for portability");
947 # endif
948 #endif
951 #if @GNULIB_GETLOGIN@
952 /* Returns the user's login name, or NULL if it cannot be found. Upon error,
953 returns NULL with errno set.
955 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
957 Most programs don't need to use this function, because the information is
958 available through environment variables:
959 ${LOGNAME-$USER} on Unix platforms,
960 $USERNAME on native Windows platforms.
962 # if !@HAVE_DECL_GETLOGIN@
963 _GL_FUNCDECL_SYS (getlogin, char *, (void));
964 # endif
965 _GL_CXXALIAS_SYS (getlogin, char *, (void));
966 _GL_CXXALIASWARN (getlogin);
967 #elif defined GNULIB_POSIXCHECK
968 # undef getlogin
969 # if HAVE_RAW_DECL_GETLOGIN
970 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
971 "use gnulib module getlogin for portability");
972 # endif
973 #endif
976 #if @GNULIB_GETLOGIN_R@
977 /* Copies the user's login name to NAME.
978 The array pointed to by NAME has room for SIZE bytes.
980 Returns 0 if successful. Upon error, an error number is returned, or -1 in
981 the case that the login name cannot be found but no specific error is
982 provided (this case is hopefully rare but is left open by the POSIX spec).
984 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
986 Most programs don't need to use this function, because the information is
987 available through environment variables:
988 ${LOGNAME-$USER} on Unix platforms,
989 $USERNAME on native Windows platforms.
991 # if @REPLACE_GETLOGIN_R@
992 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
993 # define getlogin_r rpl_getlogin_r
994 # endif
995 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
996 _GL_ARG_NONNULL ((1)));
997 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
998 # else
999 # if !@HAVE_DECL_GETLOGIN_R@
1000 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
1001 _GL_ARG_NONNULL ((1)));
1002 # endif
1003 /* Need to cast, because on Solaris 10 systems, the second argument is
1004 int size. */
1005 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
1006 # endif
1007 _GL_CXXALIASWARN (getlogin_r);
1008 #elif defined GNULIB_POSIXCHECK
1009 # undef getlogin_r
1010 # if HAVE_RAW_DECL_GETLOGIN_R
1011 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
1012 "use gnulib module getlogin_r for portability");
1013 # endif
1014 #endif
1017 #if @GNULIB_GETPAGESIZE@
1018 # if @REPLACE_GETPAGESIZE@
1019 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1020 # define getpagesize rpl_getpagesize
1021 # endif
1022 _GL_FUNCDECL_RPL (getpagesize, int, (void));
1023 _GL_CXXALIAS_RPL (getpagesize, int, (void));
1024 # else
1025 /* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
1026 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
1027 # if defined __hpux
1028 _GL_FUNCDECL_SYS (getpagesize, int, (void));
1029 # endif
1030 # if !@HAVE_GETPAGESIZE@
1031 # if !defined getpagesize
1032 /* This is for POSIX systems. */
1033 # if !defined _gl_getpagesize && defined _SC_PAGESIZE
1034 # if ! (defined __VMS && __VMS_VER < 70000000)
1035 # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
1036 # endif
1037 # endif
1038 /* This is for older VMS. */
1039 # if !defined _gl_getpagesize && defined __VMS
1040 # ifdef __ALPHA
1041 # define _gl_getpagesize() 8192
1042 # else
1043 # define _gl_getpagesize() 512
1044 # endif
1045 # endif
1046 /* This is for BeOS. */
1047 # if !defined _gl_getpagesize && @HAVE_OS_H@
1048 # include <OS.h>
1049 # if defined B_PAGE_SIZE
1050 # define _gl_getpagesize() B_PAGE_SIZE
1051 # endif
1052 # endif
1053 /* This is for AmigaOS4.0. */
1054 # if !defined _gl_getpagesize && defined __amigaos4__
1055 # define _gl_getpagesize() 2048
1056 # endif
1057 /* This is for older Unix systems. */
1058 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
1059 # include <sys/param.h>
1060 # ifdef EXEC_PAGESIZE
1061 # define _gl_getpagesize() EXEC_PAGESIZE
1062 # else
1063 # ifdef NBPG
1064 # ifndef CLSIZE
1065 # define CLSIZE 1
1066 # endif
1067 # define _gl_getpagesize() (NBPG * CLSIZE)
1068 # else
1069 # ifdef NBPC
1070 # define _gl_getpagesize() NBPC
1071 # endif
1072 # endif
1073 # endif
1074 # endif
1075 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1076 # define getpagesize() _gl_getpagesize ()
1077 # else
1078 # if !GNULIB_defined_getpagesize_function
1079 _GL_UNISTD_INLINE int
1080 getpagesize ()
1082 return _gl_getpagesize ();
1084 # define GNULIB_defined_getpagesize_function 1
1085 # endif
1086 # endif
1087 # endif
1088 # endif
1089 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
1090 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
1091 # endif
1092 # if @HAVE_DECL_GETPAGESIZE@
1093 _GL_CXXALIASWARN (getpagesize);
1094 # endif
1095 #elif defined GNULIB_POSIXCHECK
1096 # undef getpagesize
1097 # if HAVE_RAW_DECL_GETPAGESIZE
1098 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1099 "use gnulib module getpagesize for portability");
1100 # endif
1101 #endif
1104 #if @GNULIB_GETPASS@
1105 /* Function getpass() from module 'getpass':
1106 Read a password from /dev/tty or stdin.
1107 Function getpass() from module 'getpass-gnu':
1108 Read a password of arbitrary length from /dev/tty or stdin. */
1109 # if @REPLACE_GETPASS@
1110 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1111 # undef getpass
1112 # define getpass rpl_getpass
1113 # endif
1114 _GL_FUNCDECL_RPL (getpass, char *, (const char *prompt)
1115 _GL_ARG_NONNULL ((1)));
1116 _GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
1117 # else
1118 # if !@HAVE_GETPASS@
1119 _GL_FUNCDECL_SYS (getpass, char *, (const char *prompt)
1120 _GL_ARG_NONNULL ((1)));
1121 # endif
1122 _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
1123 # endif
1124 _GL_CXXALIASWARN (getpass);
1125 #elif defined GNULIB_POSIXCHECK
1126 # undef getpass
1127 # if HAVE_RAW_DECL_GETPASS
1128 _GL_WARN_ON_USE (getpass, "getpass is unportable - "
1129 "use gnulib module getpass or getpass-gnu for portability");
1130 # endif
1131 #endif
1134 #if defined _WIN32 && !defined __CYGWIN__
1135 # undef getpid
1136 # define getpid _getpid
1137 #endif
1140 #if @GNULIB_GETUSERSHELL@
1141 /* Return the next valid login shell on the system, or NULL when the end of
1142 the list has been reached. */
1143 # if !@HAVE_DECL_GETUSERSHELL@
1144 _GL_FUNCDECL_SYS (getusershell, char *, (void));
1145 # endif
1146 _GL_CXXALIAS_SYS (getusershell, char *, (void));
1147 _GL_CXXALIASWARN (getusershell);
1148 #elif defined GNULIB_POSIXCHECK
1149 # undef getusershell
1150 # if HAVE_RAW_DECL_GETUSERSHELL
1151 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
1152 "use gnulib module getusershell for portability");
1153 # endif
1154 #endif
1156 #if @GNULIB_GETUSERSHELL@
1157 /* Rewind to pointer that is advanced at each getusershell() call. */
1158 # if !@HAVE_DECL_GETUSERSHELL@
1159 _GL_FUNCDECL_SYS (setusershell, void, (void));
1160 # endif
1161 _GL_CXXALIAS_SYS (setusershell, void, (void));
1162 _GL_CXXALIASWARN (setusershell);
1163 #elif defined GNULIB_POSIXCHECK
1164 # undef setusershell
1165 # if HAVE_RAW_DECL_SETUSERSHELL
1166 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
1167 "use gnulib module getusershell for portability");
1168 # endif
1169 #endif
1171 #if @GNULIB_GETUSERSHELL@
1172 /* Free the pointer that is advanced at each getusershell() call and
1173 associated resources. */
1174 # if !@HAVE_DECL_GETUSERSHELL@
1175 _GL_FUNCDECL_SYS (endusershell, void, (void));
1176 # endif
1177 _GL_CXXALIAS_SYS (endusershell, void, (void));
1178 _GL_CXXALIASWARN (endusershell);
1179 #elif defined GNULIB_POSIXCHECK
1180 # undef endusershell
1181 # if HAVE_RAW_DECL_ENDUSERSHELL
1182 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
1183 "use gnulib module getusershell for portability");
1184 # endif
1185 #endif
1188 #if @GNULIB_GROUP_MEMBER@
1189 /* Determine whether group id is in calling user's group list. */
1190 # if !@HAVE_GROUP_MEMBER@
1191 _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
1192 # endif
1193 _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
1194 _GL_CXXALIASWARN (group_member);
1195 #elif defined GNULIB_POSIXCHECK
1196 # undef group_member
1197 # if HAVE_RAW_DECL_GROUP_MEMBER
1198 _GL_WARN_ON_USE (group_member, "group_member is unportable - "
1199 "use gnulib module group-member for portability");
1200 # endif
1201 #endif
1204 #if @GNULIB_ISATTY@
1205 # if @REPLACE_ISATTY@
1206 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1207 # undef isatty
1208 # define isatty rpl_isatty
1209 # endif
1210 _GL_FUNCDECL_RPL (isatty, int, (int fd));
1211 _GL_CXXALIAS_RPL (isatty, int, (int fd));
1212 # elif defined _WIN32 && !defined __CYGWIN__
1213 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1214 # undef isatty
1215 # define isatty _isatty
1216 # endif
1217 _GL_CXXALIAS_MDA (isatty, int, (int fd));
1218 # else
1219 _GL_CXXALIAS_SYS (isatty, int, (int fd));
1220 # endif
1221 _GL_CXXALIASWARN (isatty);
1222 #elif defined GNULIB_POSIXCHECK
1223 # undef isatty
1224 # if HAVE_RAW_DECL_ISATTY
1225 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
1226 "use gnulib module isatty for portability");
1227 # endif
1228 #elif defined _WIN32 && !defined __CYGWIN__
1229 # undef isatty
1230 # define isatty _isatty
1231 #endif
1234 #if @GNULIB_LCHOWN@
1235 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
1236 to GID (if GID is not -1). Do not follow symbolic links.
1237 Return 0 if successful, otherwise -1 and errno set.
1238 See the POSIX:2008 specification
1239 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
1240 # if @REPLACE_LCHOWN@
1241 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1242 # undef lchown
1243 # define lchown rpl_lchown
1244 # endif
1245 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
1246 _GL_ARG_NONNULL ((1)));
1247 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
1248 # else
1249 # if !@HAVE_LCHOWN@
1250 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
1251 _GL_ARG_NONNULL ((1)));
1252 # endif
1253 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
1254 # endif
1255 _GL_CXXALIASWARN (lchown);
1256 #elif defined GNULIB_POSIXCHECK
1257 # undef lchown
1258 # if HAVE_RAW_DECL_LCHOWN
1259 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1260 "use gnulib module lchown for portability");
1261 # endif
1262 #endif
1265 #if @GNULIB_LINK@
1266 /* Create a new hard link for an existing file.
1267 Return 0 if successful, otherwise -1 and errno set.
1268 See POSIX:2008 specification
1269 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
1270 # if @REPLACE_LINK@
1271 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1272 # define link rpl_link
1273 # endif
1274 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
1275 _GL_ARG_NONNULL ((1, 2)));
1276 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1277 # else
1278 # if !@HAVE_LINK@
1279 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
1280 _GL_ARG_NONNULL ((1, 2)));
1281 # endif
1282 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1283 # endif
1284 _GL_CXXALIASWARN (link);
1285 #elif defined GNULIB_POSIXCHECK
1286 # undef link
1287 # if HAVE_RAW_DECL_LINK
1288 _GL_WARN_ON_USE (link, "link is unportable - "
1289 "use gnulib module link for portability");
1290 # endif
1291 #endif
1294 #if @GNULIB_LINKAT@
1295 /* Create a new hard link for an existing file, relative to two
1296 directories. FLAG controls whether symlinks are followed.
1297 Return 0 if successful, otherwise -1 and errno set. */
1298 # if @REPLACE_LINKAT@
1299 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1300 # undef linkat
1301 # define linkat rpl_linkat
1302 # endif
1303 _GL_FUNCDECL_RPL (linkat, int,
1304 (int fd1, const char *path1, int fd2, const char *path2,
1305 int flag)
1306 _GL_ARG_NONNULL ((2, 4)));
1307 _GL_CXXALIAS_RPL (linkat, int,
1308 (int fd1, const char *path1, int fd2, const char *path2,
1309 int flag));
1310 # else
1311 # if !@HAVE_LINKAT@
1312 _GL_FUNCDECL_SYS (linkat, int,
1313 (int fd1, const char *path1, int fd2, const char *path2,
1314 int flag)
1315 _GL_ARG_NONNULL ((2, 4)));
1316 # endif
1317 _GL_CXXALIAS_SYS (linkat, int,
1318 (int fd1, const char *path1, int fd2, const char *path2,
1319 int flag));
1320 # endif
1321 _GL_CXXALIASWARN (linkat);
1322 #elif defined GNULIB_POSIXCHECK
1323 # undef linkat
1324 # if HAVE_RAW_DECL_LINKAT
1325 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1326 "use gnulib module linkat for portability");
1327 # endif
1328 #endif
1331 #if @GNULIB_LSEEK@
1332 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
1333 Return the new offset if successful, otherwise -1 and errno set.
1334 See the POSIX:2008 specification
1335 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
1336 # if @REPLACE_LSEEK@
1337 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1338 # define lseek rpl_lseek
1339 # endif
1340 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1341 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1342 # elif defined _WIN32 && !defined __CYGWIN__
1343 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1344 # undef lseek
1345 # define lseek _lseek
1346 # endif
1347 _GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence));
1348 # else
1349 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1350 # endif
1351 _GL_CXXALIASWARN (lseek);
1352 #elif defined GNULIB_POSIXCHECK
1353 # undef lseek
1354 # if HAVE_RAW_DECL_LSEEK
1355 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1356 "systems - use gnulib module lseek for portability");
1357 # endif
1358 #elif defined _WIN32 && !defined __CYGWIN__
1359 # undef lseek
1360 # define lseek _lseek
1361 #endif
1364 #if @GNULIB_PIPE@
1365 /* Create a pipe, defaulting to O_BINARY mode.
1366 Store the read-end as fd[0] and the write-end as fd[1].
1367 Return 0 upon success, or -1 with errno set upon failure. */
1368 # if !@HAVE_PIPE@
1369 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
1370 # endif
1371 _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1372 _GL_CXXALIASWARN (pipe);
1373 #elif defined GNULIB_POSIXCHECK
1374 # undef pipe
1375 # if HAVE_RAW_DECL_PIPE
1376 _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1377 "use gnulib module pipe-posix for portability");
1378 # endif
1379 #endif
1382 #if @GNULIB_PIPE2@
1383 /* Create a pipe, applying the given flags when opening the read-end of the
1384 pipe and the write-end of the pipe.
1385 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1386 and O_TEXT, O_BINARY (defined in "binary-io.h").
1387 Store the read-end as fd[0] and the write-end as fd[1].
1388 Return 0 upon success, or -1 with errno set upon failure.
1389 See also the Linux man page at
1390 <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
1391 # if @HAVE_PIPE2@
1392 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1393 # define pipe2 rpl_pipe2
1394 # endif
1395 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1396 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1397 # else
1398 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1399 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1400 # endif
1401 _GL_CXXALIASWARN (pipe2);
1402 #elif defined GNULIB_POSIXCHECK
1403 # undef pipe2
1404 # if HAVE_RAW_DECL_PIPE2
1405 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1406 "use gnulib module pipe2 for portability");
1407 # endif
1408 #endif
1411 #if @GNULIB_PREAD@
1412 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1413 Return the number of bytes placed into BUF if successful, otherwise
1414 set errno and return -1. 0 indicates EOF.
1415 See the POSIX:2008 specification
1416 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
1417 # if @REPLACE_PREAD@
1418 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1419 # undef pread
1420 # define pread rpl_pread
1421 # endif
1422 _GL_FUNCDECL_RPL (pread, ssize_t,
1423 (int fd, void *buf, size_t bufsize, off_t offset)
1424 _GL_ARG_NONNULL ((2)));
1425 _GL_CXXALIAS_RPL (pread, ssize_t,
1426 (int fd, void *buf, size_t bufsize, off_t offset));
1427 # else
1428 # if !@HAVE_PREAD@
1429 _GL_FUNCDECL_SYS (pread, ssize_t,
1430 (int fd, void *buf, size_t bufsize, off_t offset)
1431 _GL_ARG_NONNULL ((2)));
1432 # endif
1433 _GL_CXXALIAS_SYS (pread, ssize_t,
1434 (int fd, void *buf, size_t bufsize, off_t offset));
1435 # endif
1436 _GL_CXXALIASWARN (pread);
1437 #elif defined GNULIB_POSIXCHECK
1438 # undef pread
1439 # if HAVE_RAW_DECL_PREAD
1440 _GL_WARN_ON_USE (pread, "pread is unportable - "
1441 "use gnulib module pread for portability");
1442 # endif
1443 #endif
1446 #if @GNULIB_PWRITE@
1447 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1448 Return the number of bytes written if successful, otherwise
1449 set errno and return -1. 0 indicates nothing written. See the
1450 POSIX:2008 specification
1451 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
1452 # if @REPLACE_PWRITE@
1453 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1454 # undef pwrite
1455 # define pwrite rpl_pwrite
1456 # endif
1457 _GL_FUNCDECL_RPL (pwrite, ssize_t,
1458 (int fd, const void *buf, size_t bufsize, off_t offset)
1459 _GL_ARG_NONNULL ((2)));
1460 _GL_CXXALIAS_RPL (pwrite, ssize_t,
1461 (int fd, const void *buf, size_t bufsize, off_t offset));
1462 # else
1463 # if !@HAVE_PWRITE@
1464 _GL_FUNCDECL_SYS (pwrite, ssize_t,
1465 (int fd, const void *buf, size_t bufsize, off_t offset)
1466 _GL_ARG_NONNULL ((2)));
1467 # endif
1468 _GL_CXXALIAS_SYS (pwrite, ssize_t,
1469 (int fd, const void *buf, size_t bufsize, off_t offset));
1470 # endif
1471 _GL_CXXALIASWARN (pwrite);
1472 #elif defined GNULIB_POSIXCHECK
1473 # undef pwrite
1474 # if HAVE_RAW_DECL_PWRITE
1475 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1476 "use gnulib module pwrite for portability");
1477 # endif
1478 #endif
1481 #if @GNULIB_READ@
1482 /* Read up to COUNT bytes from file descriptor FD into the buffer starting
1483 at BUF. See the POSIX:2008 specification
1484 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
1485 # if @REPLACE_READ@
1486 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1487 # undef read
1488 # define read rpl_read
1489 # endif
1490 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1491 _GL_ARG_NONNULL ((2)));
1492 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1493 # elif defined _WIN32 && !defined __CYGWIN__
1494 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1495 # undef read
1496 # define read _read
1497 # endif
1498 _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
1499 # else
1500 /* Need to cast, because on mingw, the third parameter is
1501 unsigned int count
1502 and the return type is 'int'. */
1503 _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
1504 # endif
1505 _GL_CXXALIASWARN (read);
1506 #elif defined _WIN32 && !defined __CYGWIN__
1507 # undef read
1508 # define read _read
1509 #endif
1512 #if @GNULIB_READLINK@
1513 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
1514 bytes of it into BUF. Return the number of bytes placed into BUF if
1515 successful, otherwise -1 and errno set.
1516 See the POSIX:2008 specification
1517 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
1518 # if @REPLACE_READLINK@
1519 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1520 # define readlink rpl_readlink
1521 # endif
1522 _GL_FUNCDECL_RPL (readlink, ssize_t,
1523 (const char *restrict file,
1524 char *restrict buf, size_t bufsize)
1525 _GL_ARG_NONNULL ((1, 2)));
1526 _GL_CXXALIAS_RPL (readlink, ssize_t,
1527 (const char *restrict file,
1528 char *restrict buf, size_t bufsize));
1529 # else
1530 # if !@HAVE_READLINK@
1531 _GL_FUNCDECL_SYS (readlink, ssize_t,
1532 (const char *restrict file,
1533 char *restrict buf, size_t bufsize)
1534 _GL_ARG_NONNULL ((1, 2)));
1535 # endif
1536 _GL_CXXALIAS_SYS (readlink, ssize_t,
1537 (const char *restrict file,
1538 char *restrict buf, size_t bufsize));
1539 # endif
1540 _GL_CXXALIASWARN (readlink);
1541 #elif defined GNULIB_POSIXCHECK
1542 # undef readlink
1543 # if HAVE_RAW_DECL_READLINK
1544 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1545 "use gnulib module readlink for portability");
1546 # endif
1547 #endif
1550 #if @GNULIB_READLINKAT@
1551 # if @REPLACE_READLINKAT@
1552 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1553 # define readlinkat rpl_readlinkat
1554 # endif
1555 _GL_FUNCDECL_RPL (readlinkat, ssize_t,
1556 (int fd, char const *restrict file,
1557 char *restrict buf, size_t len)
1558 _GL_ARG_NONNULL ((2, 3)));
1559 _GL_CXXALIAS_RPL (readlinkat, ssize_t,
1560 (int fd, char const *restrict file,
1561 char *restrict buf, size_t len));
1562 # else
1563 # if !@HAVE_READLINKAT@
1564 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
1565 (int fd, char const *restrict file,
1566 char *restrict buf, size_t len)
1567 _GL_ARG_NONNULL ((2, 3)));
1568 # endif
1569 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
1570 (int fd, char const *restrict file,
1571 char *restrict buf, size_t len));
1572 # endif
1573 _GL_CXXALIASWARN (readlinkat);
1574 #elif defined GNULIB_POSIXCHECK
1575 # undef readlinkat
1576 # if HAVE_RAW_DECL_READLINKAT
1577 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1578 "use gnulib module readlinkat for portability");
1579 # endif
1580 #endif
1583 #if @GNULIB_RMDIR@
1584 /* Remove the directory DIR. */
1585 # if @REPLACE_RMDIR@
1586 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1587 # define rmdir rpl_rmdir
1588 # endif
1589 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1590 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1591 # elif defined _WIN32 && !defined __CYGWIN__
1592 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1593 # undef rmdir
1594 # define rmdir _rmdir
1595 # endif
1596 _GL_CXXALIAS_MDA (rmdir, int, (char const *name));
1597 # else
1598 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1599 # endif
1600 _GL_CXXALIASWARN (rmdir);
1601 #elif defined GNULIB_POSIXCHECK
1602 # undef rmdir
1603 # if HAVE_RAW_DECL_RMDIR
1604 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1605 "use gnulib module rmdir for portability");
1606 # endif
1607 #elif defined _WIN32 && !defined __CYGWIN__
1608 # undef rmdir
1609 # define rmdir _rmdir
1610 #endif
1613 #if @GNULIB_SETHOSTNAME@
1614 /* Set the host name of the machine.
1615 The host name may or may not be fully qualified.
1617 Put LEN bytes of NAME into the host name.
1618 Return 0 if successful, otherwise, set errno and return -1.
1620 Platforms with no ability to set the hostname return -1 and set
1621 errno = ENOSYS. */
1622 # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
1623 _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
1624 _GL_ARG_NONNULL ((1)));
1625 # endif
1626 /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
1627 and FreeBSD 6.4 the second parameter is int. On Solaris 11
1628 2011-10, the first parameter is not const. */
1629 _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
1630 _GL_CXXALIASWARN (sethostname);
1631 #elif defined GNULIB_POSIXCHECK
1632 # undef sethostname
1633 # if HAVE_RAW_DECL_SETHOSTNAME
1634 _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
1635 "use gnulib module sethostname for portability");
1636 # endif
1637 #endif
1640 #if @GNULIB_SLEEP@
1641 /* Pause the execution of the current thread for N seconds.
1642 Returns the number of seconds left to sleep.
1643 See the POSIX:2008 specification
1644 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
1645 # if @REPLACE_SLEEP@
1646 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1647 # undef sleep
1648 # define sleep rpl_sleep
1649 # endif
1650 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1651 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1652 # else
1653 # if !@HAVE_SLEEP@
1654 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1655 # endif
1656 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1657 # endif
1658 _GL_CXXALIASWARN (sleep);
1659 #elif defined GNULIB_POSIXCHECK
1660 # undef sleep
1661 # if HAVE_RAW_DECL_SLEEP
1662 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
1663 "use gnulib module sleep for portability");
1664 # endif
1665 #endif
1668 #if defined _WIN32 && !defined __CYGWIN__
1669 # undef swab
1670 # define swab _swab
1671 #endif
1674 #if @GNULIB_SYMLINK@
1675 # if @REPLACE_SYMLINK@
1676 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1677 # undef symlink
1678 # define symlink rpl_symlink
1679 # endif
1680 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1681 _GL_ARG_NONNULL ((1, 2)));
1682 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1683 # else
1684 # if !@HAVE_SYMLINK@
1685 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1686 _GL_ARG_NONNULL ((1, 2)));
1687 # endif
1688 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1689 # endif
1690 _GL_CXXALIASWARN (symlink);
1691 #elif defined GNULIB_POSIXCHECK
1692 # undef symlink
1693 # if HAVE_RAW_DECL_SYMLINK
1694 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
1695 "use gnulib module symlink for portability");
1696 # endif
1697 #endif
1700 #if @GNULIB_SYMLINKAT@
1701 # if @REPLACE_SYMLINKAT@
1702 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1703 # undef symlinkat
1704 # define symlinkat rpl_symlinkat
1705 # endif
1706 _GL_FUNCDECL_RPL (symlinkat, int,
1707 (char const *contents, int fd, char const *file)
1708 _GL_ARG_NONNULL ((1, 3)));
1709 _GL_CXXALIAS_RPL (symlinkat, int,
1710 (char const *contents, int fd, char const *file));
1711 # else
1712 # if !@HAVE_SYMLINKAT@
1713 _GL_FUNCDECL_SYS (symlinkat, int,
1714 (char const *contents, int fd, char const *file)
1715 _GL_ARG_NONNULL ((1, 3)));
1716 # endif
1717 _GL_CXXALIAS_SYS (symlinkat, int,
1718 (char const *contents, int fd, char const *file));
1719 # endif
1720 _GL_CXXALIASWARN (symlinkat);
1721 #elif defined GNULIB_POSIXCHECK
1722 # undef symlinkat
1723 # if HAVE_RAW_DECL_SYMLINKAT
1724 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1725 "use gnulib module symlinkat for portability");
1726 # endif
1727 #endif
1730 #if @GNULIB_TRUNCATE@
1731 /* Change the size of the file designated by FILENAME to become equal to LENGTH.
1732 Return 0 if successful, otherwise -1 and errno set.
1733 See the POSIX:2008 specification
1734 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */
1735 # if @REPLACE_TRUNCATE@
1736 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1737 # undef truncate
1738 # define truncate rpl_truncate
1739 # endif
1740 _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
1741 _GL_ARG_NONNULL ((1)));
1742 _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
1743 # else
1744 # if !@HAVE_DECL_TRUNCATE@
1745 _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
1746 _GL_ARG_NONNULL ((1)));
1747 # endif
1748 _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
1749 # endif
1750 _GL_CXXALIASWARN (truncate);
1751 #elif defined GNULIB_POSIXCHECK
1752 # undef truncate
1753 # if HAVE_RAW_DECL_TRUNCATE
1754 _GL_WARN_ON_USE (truncate, "truncate is unportable - "
1755 "use gnulib module truncate for portability");
1756 # endif
1757 #endif
1760 #if @GNULIB_TTYNAME_R@
1761 /* Store at most BUFLEN characters of the pathname of the terminal FD is
1762 open on in BUF. Return 0 on success, otherwise an error number. */
1763 # if @REPLACE_TTYNAME_R@
1764 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1765 # undef ttyname_r
1766 # define ttyname_r rpl_ttyname_r
1767 # endif
1768 _GL_FUNCDECL_RPL (ttyname_r, int,
1769 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1770 _GL_CXXALIAS_RPL (ttyname_r, int,
1771 (int fd, char *buf, size_t buflen));
1772 # else
1773 # if !@HAVE_DECL_TTYNAME_R@
1774 _GL_FUNCDECL_SYS (ttyname_r, int,
1775 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1776 # endif
1777 _GL_CXXALIAS_SYS (ttyname_r, int,
1778 (int fd, char *buf, size_t buflen));
1779 # endif
1780 _GL_CXXALIASWARN (ttyname_r);
1781 #elif defined GNULIB_POSIXCHECK
1782 # undef ttyname_r
1783 # if HAVE_RAW_DECL_TTYNAME_R
1784 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1785 "use gnulib module ttyname_r for portability");
1786 # endif
1787 #endif
1790 #if @GNULIB_UNLINK@
1791 # if @REPLACE_UNLINK@
1792 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1793 # undef unlink
1794 # define unlink rpl_unlink
1795 # endif
1796 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1797 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
1798 # elif defined _WIN32 && !defined __CYGWIN__
1799 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1800 # undef unlink
1801 # define unlink _unlink
1802 # endif
1803 _GL_CXXALIAS_MDA (unlink, int, (char const *file));
1804 # else
1805 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
1806 # endif
1807 _GL_CXXALIASWARN (unlink);
1808 #elif defined GNULIB_POSIXCHECK
1809 # undef unlink
1810 # if HAVE_RAW_DECL_UNLINK
1811 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
1812 "use gnulib module unlink for portability");
1813 # endif
1814 #elif defined _WIN32 && !defined __CYGWIN__
1815 # undef unlink
1816 # define unlink _unlink
1817 #endif
1820 #if @GNULIB_UNLINKAT@
1821 # if @REPLACE_UNLINKAT@
1822 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1823 # undef unlinkat
1824 # define unlinkat rpl_unlinkat
1825 # endif
1826 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1827 _GL_ARG_NONNULL ((2)));
1828 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1829 # else
1830 # if !@HAVE_UNLINKAT@
1831 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1832 _GL_ARG_NONNULL ((2)));
1833 # endif
1834 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1835 # endif
1836 _GL_CXXALIASWARN (unlinkat);
1837 #elif defined GNULIB_POSIXCHECK
1838 # undef unlinkat
1839 # if HAVE_RAW_DECL_UNLINKAT
1840 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1841 "use gnulib module openat for portability");
1842 # endif
1843 #endif
1846 #if @GNULIB_USLEEP@
1847 /* Pause the execution of the current thread for N microseconds.
1848 Returns 0 on completion, or -1 on range error.
1849 See the POSIX:2001 specification
1850 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
1851 # if @REPLACE_USLEEP@
1852 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1853 # undef usleep
1854 # define usleep rpl_usleep
1855 # endif
1856 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1857 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1858 # else
1859 # if !@HAVE_USLEEP@
1860 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1861 # endif
1862 /* Need to cast, because on Haiku, the first parameter is
1863 unsigned int n. */
1864 _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n));
1865 # endif
1866 _GL_CXXALIASWARN (usleep);
1867 #elif defined GNULIB_POSIXCHECK
1868 # undef usleep
1869 # if HAVE_RAW_DECL_USLEEP
1870 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1871 "use gnulib module usleep for portability");
1872 # endif
1873 #endif
1876 #if @GNULIB_WRITE@
1877 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
1878 See the POSIX:2008 specification
1879 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
1880 # if @REPLACE_WRITE@
1881 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1882 # undef write
1883 # define write rpl_write
1884 # endif
1885 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1886 _GL_ARG_NONNULL ((2)));
1887 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1888 # elif defined _WIN32 && !defined __CYGWIN__
1889 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1890 # undef write
1891 # define write _write
1892 # endif
1893 _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
1894 # else
1895 /* Need to cast, because on mingw, the third parameter is
1896 unsigned int count
1897 and the return type is 'int'. */
1898 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1899 # endif
1900 _GL_CXXALIASWARN (write);
1901 #elif defined _WIN32 && !defined __CYGWIN__
1902 # undef write
1903 # define write _write
1904 #endif
1906 _GL_INLINE_HEADER_END
1908 #endif /* _@GUARD_PREFIX@_UNISTD_H */
1909 #endif /* _GL_INCLUDING_UNISTD_H */
1910 #endif /* _@GUARD_PREFIX@_UNISTD_H */