exp2l: Work around a NetBSD 10.0/i386 bug.
[gnulib.git] / lib / unistd.in.h
blobb412966367d40c04b139816bbcd509cf5f2c5e29
1 /* Substitute for and wrapper around <unistd.h>.
2 Copyright (C) 2003-2024 Free Software Foundation, Inc.
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser 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 /* Avoid lseek bugs in FreeBSD, macOS <https://bugs.gnu.org/61386>.
44 This bug is fixed after FreeBSD 13; see <https://bugs.freebsd.org/256205>.
45 Use macOS "9999" to stand for a future fixed macOS version. */
46 #if defined __FreeBSD__ && __FreeBSD__ < 14
47 # undef SEEK_DATA
48 # undef SEEK_HOLE
49 #elif defined __APPLE__ && defined __MACH__ && defined SEEK_DATA
50 # ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
51 # include <AvailabilityMacros.h>
52 # endif
53 # if (!defined MAC_OS_X_VERSION_MIN_REQUIRED \
54 || MAC_OS_X_VERSION_MIN_REQUIRED < 99990000)
55 # include <sys/fcntl.h> /* It also defines the two macros. */
56 # undef SEEK_DATA
57 # undef SEEK_HOLE
58 # endif
59 #endif
61 /* Get all possible declarations of gethostname(). */
62 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
63 && !defined _GL_INCLUDING_WINSOCK2_H
64 # define _GL_INCLUDING_WINSOCK2_H
65 # include <winsock2.h>
66 # undef _GL_INCLUDING_WINSOCK2_H
67 #endif
69 #if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
70 #define _@GUARD_PREFIX@_UNISTD_H
72 /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK,
73 HAVE_RAW_DECL_*. */
74 #if !_GL_CONFIG_H_INCLUDED
75 #error "Please include config.h first."
76 #endif
78 /* NetBSD 5.0 mis-defines NULL. Also get size_t. */
79 /* But avoid namespace pollution on glibc systems. */
80 #ifndef __GLIBC__
81 # include <stddef.h>
82 #endif
84 /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
85 /* MSVC declares 'unlink' in <stdio.h>, not in <unistd.h>. We must include
86 it before we #define unlink rpl_unlink. */
87 /* Cygwin 1.7.1 declares symlinkat in <stdio.h>, not in <unistd.h>. */
88 /* But avoid namespace pollution on glibc systems. */
89 #if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \
90 || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \
91 && (defined _WIN32 && ! defined __CYGWIN__)) \
92 || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \
93 && defined __CYGWIN__)) \
94 && ! defined __GLIBC__
95 # include <stdio.h>
96 #endif
98 /* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
99 <unistd.h>. */
100 /* But avoid namespace pollution on glibc systems. */
101 #if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
102 && (defined __CYGWIN__ || defined __ANDROID__) \
103 && ! defined __GLIBC__
104 # include <fcntl.h>
105 #endif
107 /* mingw fails to declare _exit in <unistd.h>. */
108 /* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
109 <unistd.h>. */
110 /* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
111 /* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
112 included here. */
113 /* But avoid namespace pollution on glibc systems. */
114 #if !defined __GLIBC__ && !defined __osf__
115 # define __need_system_stdlib_h
116 # include <stdlib.h>
117 # undef __need_system_stdlib_h
118 #endif
120 /* Native Windows platforms declare _chdir, _getcwd, _rmdir in
121 <io.h> and/or <direct.h>, not in <unistd.h>.
122 They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
123 _lseek(), _read(), _unlink(), _write() in <io.h>. */
124 #if defined _WIN32 && !defined __CYGWIN__
125 # include <io.h>
126 # include <direct.h>
127 #endif
129 /* Native Windows platforms declare _execl*, _execv* in <process.h>. */
130 #if defined _WIN32 && !defined __CYGWIN__
131 # include <process.h>
132 #endif
134 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
135 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
136 /* But avoid namespace pollution on glibc systems. */
137 #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
138 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
139 && !defined __GLIBC__
140 # include <netdb.h>
141 #endif
143 /* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in
144 <sys/random.h>, not in <unistd.h>. */
145 /* But avoid namespace pollution on glibc systems. */
146 #if (@GNULIB_GETENTROPY@ || defined GNULIB_POSIXCHECK) \
147 && ((defined __APPLE__ && defined __MACH__) || defined __sun \
148 || defined __ANDROID__) \
149 && @UNISTD_H_HAVE_SYS_RANDOM_H@ \
150 && !defined __GLIBC__
151 # include <sys/random.h>
152 #endif
154 /* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */
155 /* But avoid namespace pollution on glibc systems. */
156 #if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
157 && !defined __GLIBC__
158 # include <sys/stat.h>
159 #endif
161 /* MSVC defines off_t in <sys/types.h>.
162 May also define off_t to a 64-bit type on native Windows. */
163 /* Get off_t, ssize_t, mode_t. */
164 #include <sys/types.h>
166 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
168 /* The definition of _GL_ARG_NONNULL is copied here. */
170 /* The definition of _GL_WARN_ON_USE is copied here. */
173 /* Get getopt(), optarg, optind, opterr, optopt. */
174 #if @GNULIB_GETOPT_POSIX@ && @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
175 # include <getopt-cdefs.h>
176 # include <getopt-pfx-core.h>
177 #endif
179 _GL_INLINE_HEADER_BEGIN
180 #ifndef _GL_UNISTD_INLINE
181 # define _GL_UNISTD_INLINE _GL_INLINE
182 #endif
184 /* Hide some function declarations from <winsock2.h>. */
186 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
187 # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
188 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
189 # undef socket
190 # define socket socket_used_without_including_sys_socket_h
191 # undef connect
192 # define connect connect_used_without_including_sys_socket_h
193 # undef accept
194 # define accept accept_used_without_including_sys_socket_h
195 # undef bind
196 # define bind bind_used_without_including_sys_socket_h
197 # undef getpeername
198 # define getpeername getpeername_used_without_including_sys_socket_h
199 # undef getsockname
200 # define getsockname getsockname_used_without_including_sys_socket_h
201 # undef getsockopt
202 # define getsockopt getsockopt_used_without_including_sys_socket_h
203 # undef listen
204 # define listen listen_used_without_including_sys_socket_h
205 # undef recv
206 # define recv recv_used_without_including_sys_socket_h
207 # undef send
208 # define send send_used_without_including_sys_socket_h
209 # undef recvfrom
210 # define recvfrom recvfrom_used_without_including_sys_socket_h
211 # undef sendto
212 # define sendto sendto_used_without_including_sys_socket_h
213 # undef setsockopt
214 # define setsockopt setsockopt_used_without_including_sys_socket_h
215 # undef shutdown
216 # define shutdown shutdown_used_without_including_sys_socket_h
217 # else
218 _GL_WARN_ON_USE (socket,
219 "socket() used without including <sys/socket.h>");
220 _GL_WARN_ON_USE (connect,
221 "connect() used without including <sys/socket.h>");
222 _GL_WARN_ON_USE (accept,
223 "accept() used without including <sys/socket.h>");
224 _GL_WARN_ON_USE (bind,
225 "bind() used without including <sys/socket.h>");
226 _GL_WARN_ON_USE (getpeername,
227 "getpeername() used without including <sys/socket.h>");
228 _GL_WARN_ON_USE (getsockname,
229 "getsockname() used without including <sys/socket.h>");
230 _GL_WARN_ON_USE (getsockopt,
231 "getsockopt() used without including <sys/socket.h>");
232 _GL_WARN_ON_USE (listen,
233 "listen() used without including <sys/socket.h>");
234 _GL_WARN_ON_USE (recv,
235 "recv() used without including <sys/socket.h>");
236 _GL_WARN_ON_USE (send,
237 "send() used without including <sys/socket.h>");
238 _GL_WARN_ON_USE (recvfrom,
239 "recvfrom() used without including <sys/socket.h>");
240 _GL_WARN_ON_USE (sendto,
241 "sendto() used without including <sys/socket.h>");
242 _GL_WARN_ON_USE (setsockopt,
243 "setsockopt() used without including <sys/socket.h>");
244 _GL_WARN_ON_USE (shutdown,
245 "shutdown() used without including <sys/socket.h>");
246 # endif
247 # endif
248 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
249 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
250 # undef select
251 # define select select_used_without_including_sys_select_h
252 # else
253 _GL_WARN_ON_USE (select,
254 "select() used without including <sys/select.h>");
255 # endif
256 # endif
257 #endif
260 /* OS/2 EMX lacks these macros. */
261 #ifndef STDIN_FILENO
262 # define STDIN_FILENO 0
263 #endif
264 #ifndef STDOUT_FILENO
265 # define STDOUT_FILENO 1
266 #endif
267 #ifndef STDERR_FILENO
268 # define STDERR_FILENO 2
269 #endif
271 /* Ensure *_OK macros exist. */
272 #ifndef F_OK
273 # define F_OK 0
274 # define X_OK 1
275 # define W_OK 2
276 # define R_OK 4
277 #endif
280 /* Declare overridden functions. */
283 #if @GNULIB_ACCESS@
284 # if @REPLACE_ACCESS@
285 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
286 # undef access
287 # define access rpl_access
288 # endif
289 _GL_FUNCDECL_RPL (access, int, (const char *file, int mode)
290 _GL_ARG_NONNULL ((1)));
291 _GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
292 # elif defined _WIN32 && !defined __CYGWIN__
293 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
294 # undef access
295 # define access _access
296 # endif
297 _GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
298 # else
299 _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
300 # endif
301 _GL_CXXALIASWARN (access);
302 #elif defined GNULIB_POSIXCHECK
303 # undef access
304 # if HAVE_RAW_DECL_ACCESS
305 /* The access() function is a security risk. */
306 _GL_WARN_ON_USE (access, "access does not always support X_OK - "
307 "use gnulib module access for portability; "
308 "also, this function is a security risk - "
309 "use the gnulib module faccessat instead");
310 # endif
311 #elif @GNULIB_MDA_ACCESS@
312 /* On native Windows, map 'access' to '_access', so that -loldnames is not
313 required. In C++ with GNULIB_NAMESPACE, avoid differences between
314 platforms by defining GNULIB_NAMESPACE::access always. */
315 # if defined _WIN32 && !defined __CYGWIN__
316 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
317 # undef access
318 # define access _access
319 # endif
320 _GL_CXXALIAS_MDA (access, int, (const char *file, int mode));
321 # else
322 _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
323 # endif
324 _GL_CXXALIASWARN (access);
325 #endif
328 #if @GNULIB_CHDIR@
329 # if defined _WIN32 && !defined __CYGWIN__
330 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
331 # undef chdir
332 # define chdir _chdir
333 # endif
334 _GL_CXXALIAS_MDA (chdir, int, (const char *file));
335 # else
336 _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
337 # endif
338 _GL_CXXALIASWARN (chdir);
339 #elif defined GNULIB_POSIXCHECK
340 # undef chdir
341 # if HAVE_RAW_DECL_CHDIR
342 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
343 "use gnulib module chdir for portability");
344 # endif
345 #elif @GNULIB_MDA_CHDIR@
346 /* On native Windows, map 'chdir' to '_chdir', so that -loldnames is not
347 required. In C++ with GNULIB_NAMESPACE, avoid differences between
348 platforms by defining GNULIB_NAMESPACE::chdir always. */
349 # if defined _WIN32 && !defined __CYGWIN__
350 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
351 # undef chdir
352 # define chdir _chdir
353 # endif
354 _GL_CXXALIAS_MDA (chdir, int, (const char *file));
355 # else
356 _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
357 # endif
358 _GL_CXXALIASWARN (chdir);
359 #endif
362 #if @GNULIB_CHOWN@
363 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
364 to GID (if GID is not -1). Follow symbolic links.
365 Return 0 if successful, otherwise -1 and errno set.
366 See the POSIX:2008 specification
367 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
368 # if @REPLACE_CHOWN@
369 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
370 # undef chown
371 # define chown rpl_chown
372 # endif
373 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
374 _GL_ARG_NONNULL ((1)));
375 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
376 # else
377 # if !@HAVE_CHOWN@
378 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
379 _GL_ARG_NONNULL ((1)));
380 # endif
381 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
382 # endif
383 _GL_CXXALIASWARN (chown);
384 #elif defined GNULIB_POSIXCHECK
385 # undef chown
386 # if HAVE_RAW_DECL_CHOWN
387 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
388 "doesn't treat a uid or gid of -1 on some systems - "
389 "use gnulib module chown for portability");
390 # endif
391 #endif
394 #if @GNULIB_CLOSE@
395 # if @REPLACE_CLOSE@
396 /* Automatically included by modules that need a replacement for close. */
397 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
398 # undef close
399 # define close rpl_close
400 # endif
401 _GL_FUNCDECL_RPL (close, int, (int fd));
402 _GL_CXXALIAS_RPL (close, int, (int fd));
403 # elif defined _WIN32 && !defined __CYGWIN__
404 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
405 # undef close
406 # define close _close
407 # endif
408 _GL_CXXALIAS_MDA (close, int, (int fd));
409 # else
410 _GL_CXXALIAS_SYS (close, int, (int fd));
411 # endif
412 _GL_CXXALIASWARN (close);
413 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
414 # undef close
415 # define close close_used_without_requesting_gnulib_module_close
416 #elif defined GNULIB_POSIXCHECK
417 # undef close
418 /* Assume close is always declared. */
419 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
420 "use gnulib module close for portability");
421 #elif @GNULIB_MDA_CLOSE@
422 /* On native Windows, map 'close' to '_close', so that -loldnames is not
423 required. In C++ with GNULIB_NAMESPACE, avoid differences between
424 platforms by defining GNULIB_NAMESPACE::close always. */
425 # if defined _WIN32 && !defined __CYGWIN__
426 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
427 # undef close
428 # define close _close
429 # endif
430 _GL_CXXALIAS_MDA (close, int, (int fd));
431 # else
432 _GL_CXXALIAS_SYS (close, int, (int fd));
433 # endif
434 _GL_CXXALIASWARN (close);
435 #endif
438 #if @GNULIB_COPY_FILE_RANGE@
439 # if @REPLACE_COPY_FILE_RANGE@
440 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
441 # undef copy_file_range
442 # define copy_file_range rpl_copy_file_range
443 # endif
444 _GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
445 int ofd, off_t *opos,
446 size_t len, unsigned flags));
447 _GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
448 int ofd, off_t *opos,
449 size_t len, unsigned flags));
450 # else
451 # if !@HAVE_COPY_FILE_RANGE@
452 _GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
453 int ofd, off_t *opos,
454 size_t len, unsigned flags));
455 # endif
456 _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
457 int ofd, off_t *opos,
458 size_t len, unsigned flags));
459 # endif
460 _GL_CXXALIASWARN (copy_file_range);
461 #elif defined GNULIB_POSIXCHECK
462 # undef copy_file_range
463 # if HAVE_RAW_DECL_COPY_FILE_RANGE
464 _GL_WARN_ON_USE (copy_file_range,
465 "copy_file_range is unportable - "
466 "use gnulib module copy_file_range for portability");
467 # endif
468 #endif
471 #if @GNULIB_DUP@
472 # if @REPLACE_DUP@
473 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
474 # define dup rpl_dup
475 # endif
476 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
477 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
478 # elif defined _WIN32 && !defined __CYGWIN__
479 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
480 # undef dup
481 # define dup _dup
482 # endif
483 _GL_CXXALIAS_MDA (dup, int, (int oldfd));
484 # else
485 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
486 # endif
487 _GL_CXXALIASWARN (dup);
488 #elif defined GNULIB_POSIXCHECK
489 # undef dup
490 # if HAVE_RAW_DECL_DUP
491 _GL_WARN_ON_USE (dup, "dup is unportable - "
492 "use gnulib module dup for portability");
493 # endif
494 #elif @GNULIB_MDA_DUP@
495 /* On native Windows, map 'dup' to '_dup', so that -loldnames is not
496 required. In C++ with GNULIB_NAMESPACE, avoid differences between
497 platforms by defining GNULIB_NAMESPACE::dup always. */
498 # if defined _WIN32 && !defined __CYGWIN__
499 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
500 # undef dup
501 # define dup _dup
502 # endif
503 _GL_CXXALIAS_MDA (dup, int, (int oldfd));
504 # else
505 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
506 # endif
507 _GL_CXXALIASWARN (dup);
508 #endif
511 #if @GNULIB_DUP2@
512 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
513 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
514 Return newfd if successful, otherwise -1 and errno set.
515 See the POSIX:2008 specification
516 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
517 # if @REPLACE_DUP2@
518 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
519 # define dup2 rpl_dup2
520 # endif
521 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
522 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
523 # elif defined _WIN32 && !defined __CYGWIN__
524 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
525 # undef dup2
526 # define dup2 _dup2
527 # endif
528 _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
529 # else
530 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
531 # endif
532 _GL_CXXALIASWARN (dup2);
533 #elif defined GNULIB_POSIXCHECK
534 # undef dup2
535 # if HAVE_RAW_DECL_DUP2
536 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
537 "use gnulib module dup2 for portability");
538 # endif
539 #elif @GNULIB_MDA_DUP2@
540 /* On native Windows, map 'dup2' to '_dup2', so that -loldnames is not
541 required. In C++ with GNULIB_NAMESPACE, avoid differences between
542 platforms by defining GNULIB_NAMESPACE::dup2 always. */
543 # if defined _WIN32 && !defined __CYGWIN__
544 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
545 # undef dup2
546 # define dup2 _dup2
547 # endif
548 _GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd));
549 # else
550 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
551 # endif
552 _GL_CXXALIASWARN (dup2);
553 #endif
556 #if @GNULIB_DUP3@
557 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
558 specified flags.
559 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
560 and O_TEXT, O_BINARY (defined in "binary-io.h").
561 Close NEWFD first if it is open.
562 Return newfd if successful, otherwise -1 and errno set.
563 See the Linux man page at
564 <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
565 # if @REPLACE_DUP3@
566 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
567 # undef dup3
568 # define dup3 rpl_dup3
569 # endif
570 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
571 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
572 # else
573 # if !@HAVE_DUP3@
574 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
575 # endif
576 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
577 # endif
578 # if __GLIBC__ >= 2
579 _GL_CXXALIASWARN (dup3);
580 # endif
581 #elif defined GNULIB_POSIXCHECK
582 # undef dup3
583 # if HAVE_RAW_DECL_DUP3
584 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
585 "use gnulib module dup3 for portability");
586 # endif
587 #endif
590 #if @GNULIB_ENVIRON@
591 # if defined __CYGWIN__ && !defined __i386__
592 /* The 'environ' variable is defined in a DLL. Therefore its declaration needs
593 the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it.
594 This leads to a link error on 64-bit Cygwin when the option
595 -Wl,--disable-auto-import is in use. */
596 _GL_EXTERN_C __declspec(dllimport) char **environ;
597 # endif
598 # if !@HAVE_DECL_ENVIRON@
599 /* Set of environment variables and values. An array of strings of the form
600 "VARIABLE=VALUE", terminated with a NULL. */
601 # if defined __APPLE__ && defined __MACH__
602 # include <TargetConditionals.h>
603 # if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
604 # define _GL_USE_CRT_EXTERNS
605 # endif
606 # endif
607 # ifdef _GL_USE_CRT_EXTERNS
608 # include <crt_externs.h>
609 # define environ (*_NSGetEnviron ())
610 # else
611 # ifdef __cplusplus
612 extern "C" {
613 # endif
614 extern char **environ;
615 # ifdef __cplusplus
617 # endif
618 # endif
619 # endif
620 #elif defined GNULIB_POSIXCHECK
621 # if HAVE_RAW_DECL_ENVIRON
622 _GL_UNISTD_INLINE char ***
623 _GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - "
624 "use gnulib module environ for portability")
625 rpl_environ (void)
627 return &environ;
629 # undef environ
630 # define environ (*rpl_environ ())
631 # endif
632 #endif
635 #if @GNULIB_EUIDACCESS@
636 /* Like access(), except that it uses the effective user id and group id of
637 the current process. */
638 # if !@HAVE_EUIDACCESS@
639 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
640 _GL_ARG_NONNULL ((1)));
641 # endif
642 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
643 _GL_CXXALIASWARN (euidaccess);
644 # if defined GNULIB_POSIXCHECK
645 /* Like access(), this function is a security risk. */
646 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
647 "use the gnulib module faccessat instead");
648 # endif
649 #elif defined GNULIB_POSIXCHECK
650 # undef euidaccess
651 # if HAVE_RAW_DECL_EUIDACCESS
652 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
653 "use gnulib module euidaccess for portability");
654 # endif
655 #endif
658 #if @GNULIB_EXECL@
659 # if @REPLACE_EXECL@
660 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
661 # undef execl
662 # define execl rpl_execl
663 # endif
664 _GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...)
665 _GL_ARG_NONNULL ((1)));
666 _GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
667 # else
668 _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
669 # endif
670 _GL_CXXALIASWARN (execl);
671 #elif defined GNULIB_POSIXCHECK
672 # undef execl
673 # if HAVE_RAW_DECL_EXECL
674 _GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - "
675 "use gnulib module execl for portability");
676 # endif
677 #elif @GNULIB_MDA_EXECL@
678 /* On native Windows, map 'execl' to '_execl', so that -loldnames is not
679 required. In C++ with GNULIB_NAMESPACE, avoid differences between
680 platforms by defining GNULIB_NAMESPACE::execl always. */
681 # if defined _WIN32 && !defined __CYGWIN__
682 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
683 # undef execl
684 # define execl _execl
685 # endif
686 _GL_CXXALIAS_MDA (execl, intptr_t, (const char *program, const char *arg, ...));
687 # else
688 _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
689 # endif
690 _GL_CXXALIASWARN (execl);
691 #endif
693 #if @GNULIB_EXECLE@
694 # if @REPLACE_EXECLE@
695 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
696 # undef execle
697 # define execle rpl_execle
698 # endif
699 _GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...)
700 _GL_ARG_NONNULL ((1)));
701 _GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
702 # else
703 _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
704 # endif
705 _GL_CXXALIASWARN (execle);
706 #elif defined GNULIB_POSIXCHECK
707 # undef execle
708 # if HAVE_RAW_DECL_EXECLE
709 _GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - "
710 "use gnulib module execle for portability");
711 # endif
712 #elif @GNULIB_MDA_EXECLE@
713 /* On native Windows, map 'execle' to '_execle', so that -loldnames is not
714 required. In C++ with GNULIB_NAMESPACE, avoid differences between
715 platforms by defining GNULIB_NAMESPACE::execle always. */
716 # if defined _WIN32 && !defined __CYGWIN__
717 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
718 # undef execle
719 # define execle _execle
720 # endif
721 _GL_CXXALIAS_MDA (execle, intptr_t,
722 (const char *program, const char *arg, ...));
723 # else
724 _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
725 # endif
726 _GL_CXXALIASWARN (execle);
727 #endif
729 #if @GNULIB_EXECLP@
730 # if @REPLACE_EXECLP@
731 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
732 # undef execlp
733 # define execlp rpl_execlp
734 # endif
735 _GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...)
736 _GL_ARG_NONNULL ((1)));
737 _GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
738 # else
739 _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
740 # endif
741 _GL_CXXALIASWARN (execlp);
742 #elif defined GNULIB_POSIXCHECK
743 # undef execlp
744 # if HAVE_RAW_DECL_EXECLP
745 _GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - "
746 "use gnulib module execlp for portability");
747 # endif
748 #elif @GNULIB_MDA_EXECLP@
749 /* On native Windows, map 'execlp' to '_execlp', so that -loldnames is not
750 required. In C++ with GNULIB_NAMESPACE, avoid differences between
751 platforms by defining GNULIB_NAMESPACE::execlp always. */
752 # if defined _WIN32 && !defined __CYGWIN__
753 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
754 # undef execlp
755 # define execlp _execlp
756 # endif
757 _GL_CXXALIAS_MDA (execlp, intptr_t,
758 (const char *program, const char *arg, ...));
759 # else
760 _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
761 # endif
762 _GL_CXXALIASWARN (execlp);
763 #endif
766 #if @GNULIB_EXECV@
767 # if @REPLACE_EXECV@
768 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
769 # undef execv
770 # define execv rpl_execv
771 # endif
772 _GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv)
773 _GL_ARG_NONNULL ((1, 2)));
774 _GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
775 # else
776 _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
777 # endif
778 _GL_CXXALIASWARN (execv);
779 #elif defined GNULIB_POSIXCHECK
780 # undef execv
781 # if HAVE_RAW_DECL_EXECV
782 _GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - "
783 "use gnulib module execv for portability");
784 # endif
785 #elif @GNULIB_MDA_EXECV@
786 /* On native Windows, map 'execv' to '_execv', so that -loldnames is not
787 required. In C++ with GNULIB_NAMESPACE, avoid differences between
788 platforms by defining GNULIB_NAMESPACE::execv always. */
789 # if defined _WIN32 && !defined __CYGWIN__
790 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
791 # undef execv
792 # define execv _execv
793 # endif
794 _GL_CXXALIAS_MDA_CAST (execv, intptr_t,
795 (const char *program, char * const *argv));
796 # else
797 _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
798 # endif
799 _GL_CXXALIASWARN (execv);
800 #endif
802 #if @GNULIB_EXECVE@
803 # if @REPLACE_EXECVE@
804 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
805 # undef execve
806 # define execve rpl_execve
807 # endif
808 _GL_FUNCDECL_RPL (execve, int,
809 (const char *program, char * const *argv, char * const *env)
810 _GL_ARG_NONNULL ((1, 2)));
811 _GL_CXXALIAS_RPL (execve, int,
812 (const char *program, char * const *argv, char * const *env));
813 # else
814 _GL_CXXALIAS_SYS (execve, int,
815 (const char *program, char * const *argv, char * const *env));
816 # endif
817 _GL_CXXALIASWARN (execve);
818 #elif defined GNULIB_POSIXCHECK
819 # undef execve
820 # if HAVE_RAW_DECL_EXECVE
821 _GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - "
822 "use gnulib module execve for portability");
823 # endif
824 #elif @GNULIB_MDA_EXECVE@
825 /* On native Windows, map 'execve' to '_execve', so that -loldnames is not
826 required. In C++ with GNULIB_NAMESPACE, avoid differences between
827 platforms by defining GNULIB_NAMESPACE::execve always. */
828 # if defined _WIN32 && !defined __CYGWIN__
829 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
830 # undef execve
831 # define execve _execve
832 # endif
833 _GL_CXXALIAS_MDA_CAST (execve, intptr_t,
834 (const char *program, char * const *argv,
835 char * const *env));
836 # else
837 _GL_CXXALIAS_SYS (execve, int,
838 (const char *program, char * const *argv, char * const *env));
839 # endif
840 _GL_CXXALIASWARN (execve);
841 #endif
843 #if @GNULIB_EXECVP@
844 # if @REPLACE_EXECVP@
845 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
846 # undef execvp
847 # define execvp rpl_execvp
848 # endif
849 _GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv)
850 _GL_ARG_NONNULL ((1, 2)));
851 _GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
852 # else
853 _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
854 # endif
855 _GL_CXXALIASWARN (execvp);
856 #elif defined GNULIB_POSIXCHECK
857 # undef execvp
858 # if HAVE_RAW_DECL_EXECVP
859 _GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - "
860 "use gnulib module execvp for portability");
861 # endif
862 #elif @GNULIB_MDA_EXECVP@
863 /* On native Windows, map 'execvp' to '_execvp', so that -loldnames is not
864 required. In C++ with GNULIB_NAMESPACE, avoid differences between
865 platforms by defining GNULIB_NAMESPACE::execvp always. */
866 # if defined _WIN32 && !defined __CYGWIN__
867 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
868 # undef execvp
869 # define execvp _execvp
870 # endif
871 _GL_CXXALIAS_MDA_CAST (execvp, intptr_t,
872 (const char *program, char * const *argv));
873 # else
874 _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
875 # endif
876 _GL_CXXALIASWARN (execvp);
877 #endif
879 #if @GNULIB_EXECVPE@
880 # if @REPLACE_EXECVPE@
881 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
882 # undef execvpe
883 # define execvpe rpl_execvpe
884 # endif
885 _GL_FUNCDECL_RPL (execvpe, int,
886 (const char *program, char * const *argv, char * const *env)
887 _GL_ARG_NONNULL ((1, 2)));
888 _GL_CXXALIAS_RPL (execvpe, int,
889 (const char *program, char * const *argv, char * const *env));
890 # else
891 # if !@HAVE_DECL_EXECVPE@
892 _GL_FUNCDECL_SYS (execvpe, int,
893 (const char *program, char * const *argv, char * const *env)
894 _GL_ARG_NONNULL ((1, 2)));
895 # endif
896 _GL_CXXALIAS_SYS (execvpe, int,
897 (const char *program, char * const *argv, char * const *env));
898 # endif
899 # if __GLIBC__ >= 2
900 _GL_CXXALIASWARN (execvpe);
901 # endif
902 #elif defined GNULIB_POSIXCHECK
903 # undef execvpe
904 # if HAVE_RAW_DECL_EXECVPE
905 _GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - "
906 "use gnulib module execvpe for portability");
907 # endif
908 #elif @GNULIB_MDA_EXECVPE@
909 /* On native Windows, map 'execvpe' to '_execvpe', so that -loldnames is not
910 required. In C++ with GNULIB_NAMESPACE, avoid differences between
911 platforms by defining GNULIB_NAMESPACE::execvpe on all platforms that have
912 it. */
913 # if defined _WIN32 && !defined __CYGWIN__
914 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
915 # undef execvpe
916 # define execvpe _execvpe
917 # endif
918 _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
919 (const char *program, char * const *argv,
920 char * const *env));
921 # elif @HAVE_EXECVPE@
922 # if !@HAVE_DECL_EXECVPE@
923 _GL_FUNCDECL_SYS (execvpe, int,
924 (const char *program, char * const *argv, char * const *env)
925 _GL_ARG_NONNULL ((1, 2)));
926 # endif
927 _GL_CXXALIAS_SYS (execvpe, int,
928 (const char *program, char * const *argv, char * const *env));
929 # endif
930 # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_EXECVPE@
931 _GL_CXXALIASWARN (execvpe);
932 # endif
933 #endif
936 #if @GNULIB_FACCESSAT@
937 # if @REPLACE_FACCESSAT@
938 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
939 # undef faccessat
940 # define faccessat rpl_faccessat
941 # endif
942 _GL_FUNCDECL_RPL (faccessat, int,
943 (int fd, char const *name, int mode, int flag)
944 _GL_ARG_NONNULL ((2)));
945 _GL_CXXALIAS_RPL (faccessat, int,
946 (int fd, char const *name, int mode, int flag));
947 # else
948 # if !@HAVE_FACCESSAT@
949 _GL_FUNCDECL_SYS (faccessat, int,
950 (int fd, char const *file, int mode, int flag)
951 _GL_ARG_NONNULL ((2)));
952 # endif
953 _GL_CXXALIAS_SYS (faccessat, int,
954 (int fd, char const *file, int mode, int flag));
955 # endif
956 # if __GLIBC__ >= 2
957 _GL_CXXALIASWARN (faccessat);
958 # endif
959 #elif defined GNULIB_POSIXCHECK
960 # undef faccessat
961 # if HAVE_RAW_DECL_FACCESSAT
962 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
963 "use gnulib module faccessat for portability");
964 # endif
965 #endif
968 #if @GNULIB_FCHDIR@
969 /* Change the process' current working directory to the directory on which
970 the given file descriptor is open.
971 Return 0 if successful, otherwise -1 and errno set.
972 See the POSIX:2008 specification
973 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
974 # if @REPLACE_FCHDIR@
975 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
976 # undef fchdir
977 # define fchdir rpl_fchdir
978 # endif
979 _GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/));
980 _GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/));
981 # else
982 # if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@
983 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
984 # endif
985 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
986 # endif
987 _GL_CXXALIASWARN (fchdir);
988 # if @REPLACE_FCHDIR@ || !@HAVE_FCHDIR@
989 /* Gnulib internal hooks needed to maintain the fchdir metadata. */
990 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
991 _GL_ARG_NONNULL ((2));
992 _GL_EXTERN_C void _gl_unregister_fd (int fd);
993 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
994 _GL_EXTERN_C const char *_gl_directory_name (int fd);
995 # endif
996 #elif defined GNULIB_POSIXCHECK
997 # undef fchdir
998 # if HAVE_RAW_DECL_FCHDIR
999 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
1000 "use gnulib module fchdir for portability");
1001 # endif
1002 #endif
1005 #if @GNULIB_FCHOWNAT@
1006 # if @REPLACE_FCHOWNAT@
1007 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1008 # undef fchownat
1009 # define fchownat rpl_fchownat
1010 # endif
1011 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
1012 uid_t owner, gid_t group, int flag)
1013 _GL_ARG_NONNULL ((2)));
1014 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
1015 uid_t owner, gid_t group, int flag));
1016 # else
1017 # if !@HAVE_FCHOWNAT@
1018 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
1019 uid_t owner, gid_t group, int flag)
1020 _GL_ARG_NONNULL ((2)));
1021 # endif
1022 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
1023 uid_t owner, gid_t group, int flag));
1024 # endif
1025 _GL_CXXALIASWARN (fchownat);
1026 #elif defined GNULIB_POSIXCHECK
1027 # undef fchownat
1028 # if HAVE_RAW_DECL_FCHOWNAT
1029 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
1030 "use gnulib module fchownat for portability");
1031 # endif
1032 #endif
1035 #if @GNULIB_FDATASYNC@
1036 /* Synchronize changes to a file.
1037 Return 0 if successful, otherwise -1 and errno set.
1038 See POSIX:2008 specification
1039 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
1040 # if @REPLACE_FDATASYNC@
1041 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1042 # undef fdatasync
1043 # define fdatasync rpl_fdatasync
1044 # endif
1045 _GL_FUNCDECL_RPL (fdatasync, int, (int fd));
1046 _GL_CXXALIAS_RPL (fdatasync, int, (int fd));
1047 # else
1048 # if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@
1049 _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
1050 # endif
1051 _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
1052 # endif
1053 # if __GLIBC__ >= 2
1054 _GL_CXXALIASWARN (fdatasync);
1055 # endif
1056 #elif defined GNULIB_POSIXCHECK
1057 # undef fdatasync
1058 # if HAVE_RAW_DECL_FDATASYNC
1059 _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
1060 "use gnulib module fdatasync for portability");
1061 # endif
1062 #endif
1065 #if @GNULIB_FSYNC@
1066 /* Synchronize changes, including metadata, to a file.
1067 Return 0 if successful, otherwise -1 and errno set.
1068 See POSIX:2008 specification
1069 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
1070 # if !@HAVE_FSYNC@
1071 _GL_FUNCDECL_SYS (fsync, int, (int fd));
1072 # endif
1073 _GL_CXXALIAS_SYS (fsync, int, (int fd));
1074 _GL_CXXALIASWARN (fsync);
1075 #elif defined GNULIB_POSIXCHECK
1076 # undef fsync
1077 # if HAVE_RAW_DECL_FSYNC
1078 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
1079 "use gnulib module fsync for portability");
1080 # endif
1081 #endif
1084 #if @GNULIB_FTRUNCATE@
1085 /* Change the size of the file to which FD is opened to become equal to LENGTH.
1086 Return 0 if successful, otherwise -1 and errno set.
1087 See the POSIX:2008 specification
1088 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
1089 # if @REPLACE_FTRUNCATE@
1090 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1091 # undef ftruncate
1092 # define ftruncate rpl_ftruncate
1093 # endif
1094 _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
1095 _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
1096 # else
1097 # if !@HAVE_FTRUNCATE@
1098 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
1099 # endif
1100 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
1101 # endif
1102 # if __GLIBC__ >= 2
1103 _GL_CXXALIASWARN (ftruncate);
1104 # endif
1105 #elif defined GNULIB_POSIXCHECK
1106 # undef ftruncate
1107 # if HAVE_RAW_DECL_FTRUNCATE
1108 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
1109 "use gnulib module ftruncate for portability");
1110 # endif
1111 #endif
1114 #if @GNULIB_GETCWD@
1115 /* Get the name of the current working directory, and put it in SIZE bytes
1116 of BUF.
1117 Return BUF if successful, or NULL if the directory couldn't be determined
1118 or SIZE was too small.
1119 See the POSIX:2008 specification
1120 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
1121 Additionally, the gnulib module 'getcwd' or 'getcwd-lgpl' guarantees the
1122 following GNU extension: If BUF is NULL, an array is allocated with
1123 'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case
1124 it is as big as necessary. */
1125 # if @REPLACE_GETCWD@
1126 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1127 # define getcwd rpl_getcwd
1128 # endif
1129 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
1130 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
1131 # elif defined _WIN32 && !defined __CYGWIN__
1132 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1133 # undef getcwd
1134 # define getcwd _getcwd
1135 # endif
1136 _GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size));
1137 # else
1138 /* Need to cast, because on mingw, the second parameter is
1139 int size. */
1140 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
1141 # endif
1142 _GL_CXXALIASWARN (getcwd);
1143 #elif defined GNULIB_POSIXCHECK
1144 # undef getcwd
1145 # if HAVE_RAW_DECL_GETCWD
1146 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
1147 "use gnulib module getcwd for portability");
1148 # endif
1149 #elif @GNULIB_MDA_GETCWD@
1150 /* On native Windows, map 'getcwd' to '_getcwd', so that -loldnames is not
1151 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1152 platforms by defining GNULIB_NAMESPACE::getcwd always. */
1153 # if defined _WIN32 && !defined __CYGWIN__
1154 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1155 # undef getcwd
1156 # define getcwd _getcwd
1157 # endif
1158 /* Need to cast, because on mingw, the second parameter is either
1159 'int size' or 'size_t size'. */
1160 _GL_CXXALIAS_MDA_CAST (getcwd, char *, (char *buf, size_t size));
1161 # else
1162 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
1163 # endif
1164 _GL_CXXALIASWARN (getcwd);
1165 #endif
1168 #if @GNULIB_GETDOMAINNAME@
1169 /* Return the NIS domain name of the machine.
1170 WARNING! The NIS domain name is unrelated to the fully qualified host name
1171 of the machine. It is also unrelated to email addresses.
1172 WARNING! The NIS domain name is usually the empty string or "(none)" when
1173 not using NIS.
1175 Put up to LEN bytes of the NIS domain name into NAME.
1176 Null terminate it if the name is shorter than LEN.
1177 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
1178 Return 0 if successful, otherwise set errno and return -1. */
1179 # if @REPLACE_GETDOMAINNAME@
1180 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1181 # undef getdomainname
1182 # define getdomainname rpl_getdomainname
1183 # endif
1184 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
1185 _GL_ARG_NONNULL ((1)));
1186 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
1187 # else
1188 # if !@HAVE_DECL_GETDOMAINNAME@
1189 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
1190 _GL_ARG_NONNULL ((1)));
1191 # endif
1192 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
1193 # endif
1194 # if __GLIBC__ >= 2
1195 _GL_CXXALIASWARN (getdomainname);
1196 # endif
1197 #elif defined GNULIB_POSIXCHECK
1198 # undef getdomainname
1199 # if HAVE_RAW_DECL_GETDOMAINNAME
1200 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
1201 "use gnulib module getdomainname for portability");
1202 # endif
1203 #endif
1206 #if @GNULIB_GETDTABLESIZE@
1207 /* Return the maximum number of file descriptors in the current process.
1208 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
1209 # if @REPLACE_GETDTABLESIZE@
1210 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1211 # undef getdtablesize
1212 # define getdtablesize rpl_getdtablesize
1213 # endif
1214 _GL_FUNCDECL_RPL (getdtablesize, int, (void));
1215 _GL_CXXALIAS_RPL (getdtablesize, int, (void));
1216 # else
1217 # if !@HAVE_GETDTABLESIZE@
1218 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
1219 # endif
1220 /* Need to cast, because on AIX, the parameter list is
1221 (...). */
1222 _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
1223 # endif
1224 _GL_CXXALIASWARN (getdtablesize);
1225 #elif defined GNULIB_POSIXCHECK
1226 # undef getdtablesize
1227 # if HAVE_RAW_DECL_GETDTABLESIZE
1228 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
1229 "use gnulib module getdtablesize for portability");
1230 # endif
1231 #endif
1234 #if @GNULIB_GETENTROPY@
1235 /* Fill a buffer with random bytes. */
1236 # if @REPLACE_GETENTROPY@
1237 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1238 # undef getentropy
1239 # define getentropy rpl_getentropy
1240 # endif
1241 _GL_FUNCDECL_RPL (getentropy, int, (void *buffer, size_t length));
1242 _GL_CXXALIAS_RPL (getentropy, int, (void *buffer, size_t length));
1243 # else
1244 # if !@HAVE_GETENTROPY@
1245 _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
1246 # endif
1247 _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
1248 # endif
1249 # if __GLIBC__ >= 2
1250 _GL_CXXALIASWARN (getentropy);
1251 # endif
1252 #elif defined GNULIB_POSIXCHECK
1253 # undef getentropy
1254 # if HAVE_RAW_DECL_GETENTROPY
1255 _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
1256 "use gnulib module getentropy for portability");
1257 # endif
1258 #endif
1261 #if @GNULIB_GETGROUPS@
1262 /* Return the supplemental groups that the current process belongs to.
1263 It is unspecified whether the effective group id is in the list.
1264 If N is 0, return the group count; otherwise, N describes how many
1265 entries are available in GROUPS. Return -1 and set errno if N is
1266 not 0 and not large enough. Fails with ENOSYS on some systems. */
1267 # if @REPLACE_GETGROUPS@
1268 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1269 # undef getgroups
1270 # define getgroups rpl_getgroups
1271 # endif
1272 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
1273 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
1274 # else
1275 # if !@HAVE_GETGROUPS@
1276 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
1277 # endif
1278 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
1279 # endif
1280 _GL_CXXALIASWARN (getgroups);
1281 #elif defined GNULIB_POSIXCHECK
1282 # undef getgroups
1283 # if HAVE_RAW_DECL_GETGROUPS
1284 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
1285 "use gnulib module getgroups for portability");
1286 # endif
1287 #endif
1290 #if @GNULIB_GETHOSTNAME@
1291 /* Return the standard host name of the machine.
1292 WARNING! The host name may or may not be fully qualified.
1294 Put up to LEN bytes of the host name into NAME.
1295 Null terminate it if the name is shorter than LEN.
1296 If the host name is longer than LEN, set errno = EINVAL and return -1.
1297 Return 0 if successful, otherwise set errno and return -1. */
1298 # if @UNISTD_H_HAVE_WINSOCK2_H@
1299 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1300 # undef gethostname
1301 # define gethostname rpl_gethostname
1302 # endif
1303 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
1304 _GL_ARG_NONNULL ((1)));
1305 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
1306 # else
1307 # if !@HAVE_GETHOSTNAME@
1308 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
1309 _GL_ARG_NONNULL ((1)));
1310 # endif
1311 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
1312 parameter is
1313 int len. */
1314 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
1315 # endif
1316 _GL_CXXALIASWARN (gethostname);
1317 #elif @UNISTD_H_HAVE_WINSOCK2_H@
1318 # undef gethostname
1319 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
1320 #elif defined GNULIB_POSIXCHECK
1321 # undef gethostname
1322 # if HAVE_RAW_DECL_GETHOSTNAME
1323 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
1324 "use gnulib module gethostname for portability");
1325 # endif
1326 #endif
1329 #if @GNULIB_GETLOGIN@
1330 /* Returns the user's login name, or NULL if it cannot be found. Upon error,
1331 returns NULL with errno set.
1333 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
1335 Most programs don't need to use this function, because the information is
1336 available through environment variables:
1337 ${LOGNAME-$USER} on Unix platforms,
1338 $USERNAME on native Windows platforms.
1340 # if !@HAVE_DECL_GETLOGIN@
1341 _GL_FUNCDECL_SYS (getlogin, char *, (void));
1342 # endif
1343 _GL_CXXALIAS_SYS (getlogin, char *, (void));
1344 _GL_CXXALIASWARN (getlogin);
1345 #elif defined GNULIB_POSIXCHECK
1346 # undef getlogin
1347 # if HAVE_RAW_DECL_GETLOGIN
1348 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
1349 "use gnulib module getlogin for portability");
1350 # endif
1351 #endif
1354 #if @GNULIB_GETLOGIN_R@
1355 /* Copies the user's login name to NAME.
1356 The array pointed to by NAME has room for SIZE bytes.
1358 Returns 0 if successful. Upon error, an error number is returned, or -1 in
1359 the case that the login name cannot be found but no specific error is
1360 provided (this case is hopefully rare but is left open by the POSIX spec).
1362 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
1364 Most programs don't need to use this function, because the information is
1365 available through environment variables:
1366 ${LOGNAME-$USER} on Unix platforms,
1367 $USERNAME on native Windows platforms.
1369 # if @REPLACE_GETLOGIN_R@
1370 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1371 # define getlogin_r rpl_getlogin_r
1372 # endif
1373 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
1374 _GL_ARG_NONNULL ((1)));
1375 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
1376 # else
1377 # if !@HAVE_DECL_GETLOGIN_R@
1378 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
1379 _GL_ARG_NONNULL ((1)));
1380 # endif
1381 /* Need to cast, because on Solaris 10 systems, the second argument is
1382 int size. */
1383 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
1384 # endif
1385 # if __GLIBC__ >= 2
1386 _GL_CXXALIASWARN (getlogin_r);
1387 # endif
1388 #elif defined GNULIB_POSIXCHECK
1389 # undef getlogin_r
1390 # if HAVE_RAW_DECL_GETLOGIN_R
1391 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
1392 "use gnulib module getlogin_r for portability");
1393 # endif
1394 #endif
1397 #if @GNULIB_GETPAGESIZE@
1398 # if @REPLACE_GETPAGESIZE@
1399 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1400 # define getpagesize rpl_getpagesize
1401 # endif
1402 _GL_FUNCDECL_RPL (getpagesize, int, (void));
1403 _GL_CXXALIAS_RPL (getpagesize, int, (void));
1404 # else
1405 /* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
1406 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
1407 # if defined __hpux
1408 _GL_FUNCDECL_SYS (getpagesize, int, (void));
1409 # endif
1410 # if !@HAVE_GETPAGESIZE@
1411 # if !defined getpagesize
1412 /* This is for POSIX systems. */
1413 # if !defined _gl_getpagesize && defined _SC_PAGESIZE
1414 # if ! (defined __VMS && __VMS_VER < 70000000)
1415 # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
1416 # endif
1417 # endif
1418 /* This is for older VMS. */
1419 # if !defined _gl_getpagesize && defined __VMS
1420 # ifdef __ALPHA
1421 # define _gl_getpagesize() 8192
1422 # else
1423 # define _gl_getpagesize() 512
1424 # endif
1425 # endif
1426 /* This is for BeOS. */
1427 # if !defined _gl_getpagesize && @HAVE_OS_H@
1428 # include <OS.h>
1429 # if defined B_PAGE_SIZE
1430 # define _gl_getpagesize() B_PAGE_SIZE
1431 # endif
1432 # endif
1433 /* This is for AmigaOS4.0. */
1434 # if !defined _gl_getpagesize && defined __amigaos4__
1435 # define _gl_getpagesize() 2048
1436 # endif
1437 /* This is for older Unix systems. */
1438 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
1439 # include <sys/param.h>
1440 # ifdef EXEC_PAGESIZE
1441 # define _gl_getpagesize() EXEC_PAGESIZE
1442 # else
1443 # ifdef NBPG
1444 # ifndef CLSIZE
1445 # define CLSIZE 1
1446 # endif
1447 # define _gl_getpagesize() (NBPG * CLSIZE)
1448 # else
1449 # ifdef NBPC
1450 # define _gl_getpagesize() NBPC
1451 # endif
1452 # endif
1453 # endif
1454 # endif
1455 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1456 # define getpagesize() _gl_getpagesize ()
1457 # else
1458 # if !GNULIB_defined_getpagesize_function
1459 _GL_UNISTD_INLINE int
1460 getpagesize ()
1462 return _gl_getpagesize ();
1464 # define GNULIB_defined_getpagesize_function 1
1465 # endif
1466 # endif
1467 # endif
1468 # endif
1469 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
1470 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
1471 # endif
1472 # if @HAVE_DECL_GETPAGESIZE@
1473 _GL_CXXALIASWARN (getpagesize);
1474 # endif
1475 #elif defined GNULIB_POSIXCHECK
1476 # undef getpagesize
1477 # if HAVE_RAW_DECL_GETPAGESIZE
1478 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1479 "use gnulib module getpagesize for portability");
1480 # endif
1481 #endif
1484 #if @GNULIB_GETPASS@
1485 /* Function getpass() from module 'getpass':
1486 Read a password from /dev/tty or stdin.
1487 Function getpass() from module 'getpass-gnu':
1488 Read a password of arbitrary length from /dev/tty or stdin. */
1489 # if (@GNULIB_GETPASS@ && @REPLACE_GETPASS@) \
1490 || (@GNULIB_GETPASS_GNU@ && @REPLACE_GETPASS_FOR_GETPASS_GNU@)
1491 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1492 # undef getpass
1493 # define getpass rpl_getpass
1494 # endif
1495 _GL_FUNCDECL_RPL (getpass, char *, (const char *prompt)
1496 _GL_ARG_NONNULL ((1)));
1497 _GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
1498 # else
1499 # if !@HAVE_GETPASS@
1500 _GL_FUNCDECL_SYS (getpass, char *, (const char *prompt)
1501 _GL_ARG_NONNULL ((1)));
1502 # endif
1503 _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
1504 # endif
1505 _GL_CXXALIASWARN (getpass);
1506 #elif defined GNULIB_POSIXCHECK
1507 # undef getpass
1508 # if HAVE_RAW_DECL_GETPASS
1509 _GL_WARN_ON_USE (getpass, "getpass is unportable - "
1510 "use gnulib module getpass or getpass-gnu for portability");
1511 # endif
1512 #endif
1515 #if @GNULIB_MDA_GETPID@
1516 /* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not
1517 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1518 platforms by defining GNULIB_NAMESPACE::getpid always. */
1519 # if defined _WIN32 && !defined __CYGWIN__
1520 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1521 # undef getpid
1522 # define getpid _getpid
1523 # endif
1524 _GL_CXXALIAS_MDA (getpid, int, (void));
1525 # else
1526 _GL_CXXALIAS_SYS (getpid, pid_t, (void));
1527 # endif
1528 _GL_CXXALIASWARN (getpid);
1529 #endif
1532 #if @GNULIB_GETUSERSHELL@
1533 /* Return the next valid login shell on the system, or NULL when the end of
1534 the list has been reached. */
1535 # if !@HAVE_DECL_GETUSERSHELL@
1536 _GL_FUNCDECL_SYS (getusershell, char *, (void));
1537 # endif
1538 _GL_CXXALIAS_SYS (getusershell, char *, (void));
1539 _GL_CXXALIASWARN (getusershell);
1540 #elif defined GNULIB_POSIXCHECK
1541 # undef getusershell
1542 # if HAVE_RAW_DECL_GETUSERSHELL
1543 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
1544 "use gnulib module getusershell for portability");
1545 # endif
1546 #endif
1548 #if @GNULIB_GETUSERSHELL@
1549 /* Rewind to pointer that is advanced at each getusershell() call. */
1550 # if !@HAVE_DECL_GETUSERSHELL@
1551 _GL_FUNCDECL_SYS (setusershell, void, (void));
1552 # endif
1553 _GL_CXXALIAS_SYS (setusershell, void, (void));
1554 _GL_CXXALIASWARN (setusershell);
1555 #elif defined GNULIB_POSIXCHECK
1556 # undef setusershell
1557 # if HAVE_RAW_DECL_SETUSERSHELL
1558 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
1559 "use gnulib module getusershell for portability");
1560 # endif
1561 #endif
1563 #if @GNULIB_GETUSERSHELL@
1564 /* Free the pointer that is advanced at each getusershell() call and
1565 associated resources. */
1566 # if !@HAVE_DECL_GETUSERSHELL@
1567 _GL_FUNCDECL_SYS (endusershell, void, (void));
1568 # endif
1569 _GL_CXXALIAS_SYS (endusershell, void, (void));
1570 _GL_CXXALIASWARN (endusershell);
1571 #elif defined GNULIB_POSIXCHECK
1572 # undef endusershell
1573 # if HAVE_RAW_DECL_ENDUSERSHELL
1574 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
1575 "use gnulib module getusershell for portability");
1576 # endif
1577 #endif
1580 #if @GNULIB_GROUP_MEMBER@
1581 /* Determine whether group id is in calling user's group list. */
1582 # if !@HAVE_GROUP_MEMBER@
1583 _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
1584 # endif
1585 _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
1586 _GL_CXXALIASWARN (group_member);
1587 #elif defined GNULIB_POSIXCHECK
1588 # undef group_member
1589 # if HAVE_RAW_DECL_GROUP_MEMBER
1590 _GL_WARN_ON_USE (group_member, "group_member is unportable - "
1591 "use gnulib module group-member for portability");
1592 # endif
1593 #endif
1596 #if @GNULIB_ISATTY@
1597 # if @REPLACE_ISATTY@
1598 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1599 # undef isatty
1600 # define isatty rpl_isatty
1601 # endif
1602 # define GNULIB_defined_isatty 1
1603 _GL_FUNCDECL_RPL (isatty, int, (int fd));
1604 _GL_CXXALIAS_RPL (isatty, int, (int fd));
1605 # elif defined _WIN32 && !defined __CYGWIN__
1606 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1607 # undef isatty
1608 # define isatty _isatty
1609 # endif
1610 _GL_CXXALIAS_MDA (isatty, int, (int fd));
1611 # else
1612 _GL_CXXALIAS_SYS (isatty, int, (int fd));
1613 # endif
1614 _GL_CXXALIASWARN (isatty);
1615 #elif defined GNULIB_POSIXCHECK
1616 # undef isatty
1617 # if HAVE_RAW_DECL_ISATTY
1618 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
1619 "use gnulib module isatty for portability");
1620 # endif
1621 #elif @GNULIB_MDA_ISATTY@
1622 /* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not
1623 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1624 platforms by defining GNULIB_NAMESPACE::isatty always. */
1625 # if defined _WIN32 && !defined __CYGWIN__
1626 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1627 # undef isatty
1628 # define isatty _isatty
1629 # endif
1630 _GL_CXXALIAS_MDA (isatty, int, (int fd));
1631 # else
1632 _GL_CXXALIAS_SYS (isatty, int, (int fd));
1633 # endif
1634 _GL_CXXALIASWARN (isatty);
1635 #endif
1638 #if @GNULIB_LCHOWN@
1639 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
1640 to GID (if GID is not -1). Do not follow symbolic links.
1641 Return 0 if successful, otherwise -1 and errno set.
1642 See the POSIX:2008 specification
1643 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
1644 # if @REPLACE_LCHOWN@
1645 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1646 # undef lchown
1647 # define lchown rpl_lchown
1648 # endif
1649 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
1650 _GL_ARG_NONNULL ((1)));
1651 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
1652 # else
1653 # if !@HAVE_LCHOWN@
1654 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
1655 _GL_ARG_NONNULL ((1)));
1656 # endif
1657 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
1658 # endif
1659 _GL_CXXALIASWARN (lchown);
1660 #elif defined GNULIB_POSIXCHECK
1661 # undef lchown
1662 # if HAVE_RAW_DECL_LCHOWN
1663 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1664 "use gnulib module lchown for portability");
1665 # endif
1666 #endif
1669 #if @GNULIB_LINK@
1670 /* Create a new hard link for an existing file.
1671 Return 0 if successful, otherwise -1 and errno set.
1672 See POSIX:2008 specification
1673 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
1674 # if @REPLACE_LINK@
1675 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1676 # define link rpl_link
1677 # endif
1678 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
1679 _GL_ARG_NONNULL ((1, 2)));
1680 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1681 # else
1682 # if !@HAVE_LINK@
1683 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
1684 _GL_ARG_NONNULL ((1, 2)));
1685 # endif
1686 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1687 # endif
1688 _GL_CXXALIASWARN (link);
1689 #elif defined GNULIB_POSIXCHECK
1690 # undef link
1691 # if HAVE_RAW_DECL_LINK
1692 _GL_WARN_ON_USE (link, "link is unportable - "
1693 "use gnulib module link for portability");
1694 # endif
1695 #endif
1698 #if @GNULIB_LINKAT@
1699 /* Create a new hard link for an existing file, relative to two
1700 directories. FLAG controls whether symlinks are followed.
1701 Return 0 if successful, otherwise -1 and errno set. */
1702 # if @REPLACE_LINKAT@
1703 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1704 # undef linkat
1705 # define linkat rpl_linkat
1706 # endif
1707 _GL_FUNCDECL_RPL (linkat, int,
1708 (int fd1, const char *path1, int fd2, const char *path2,
1709 int flag)
1710 _GL_ARG_NONNULL ((2, 4)));
1711 _GL_CXXALIAS_RPL (linkat, int,
1712 (int fd1, const char *path1, int fd2, const char *path2,
1713 int flag));
1714 # else
1715 # if !@HAVE_LINKAT@
1716 _GL_FUNCDECL_SYS (linkat, int,
1717 (int fd1, const char *path1, int fd2, const char *path2,
1718 int flag)
1719 _GL_ARG_NONNULL ((2, 4)));
1720 # endif
1721 _GL_CXXALIAS_SYS (linkat, int,
1722 (int fd1, const char *path1, int fd2, const char *path2,
1723 int flag));
1724 # endif
1725 # if __GLIBC__ >= 2
1726 _GL_CXXALIASWARN (linkat);
1727 # endif
1728 #elif defined GNULIB_POSIXCHECK
1729 # undef linkat
1730 # if HAVE_RAW_DECL_LINKAT
1731 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1732 "use gnulib module linkat for portability");
1733 # endif
1734 #endif
1737 #if @GNULIB_LSEEK@
1738 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
1739 Return the new offset if successful, otherwise -1 and errno set.
1740 See the POSIX:2008 specification
1741 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
1742 # if @REPLACE_LSEEK@
1743 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1744 # define lseek rpl_lseek
1745 # endif
1746 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1747 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1748 # elif defined _WIN32 && !defined __CYGWIN__
1749 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1750 # undef lseek
1751 # define lseek _lseek
1752 # endif
1753 _GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence));
1754 # else
1755 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1756 # endif
1757 _GL_CXXALIASWARN (lseek);
1758 #elif defined GNULIB_POSIXCHECK
1759 # undef lseek
1760 # if HAVE_RAW_DECL_LSEEK
1761 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1762 "systems - use gnulib module lseek for portability");
1763 # endif
1764 #elif @GNULIB_MDA_LSEEK@
1765 /* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not
1766 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1767 platforms by defining GNULIB_NAMESPACE::lseek always. */
1768 # if defined _WIN32 && !defined __CYGWIN__
1769 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1770 # undef lseek
1771 # define lseek _lseek
1772 # endif
1773 _GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence));
1774 # else
1775 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1776 # endif
1777 _GL_CXXALIASWARN (lseek);
1778 #endif
1781 #if @GNULIB_PIPE@
1782 /* Create a pipe, defaulting to O_BINARY mode.
1783 Store the read-end as fd[0] and the write-end as fd[1].
1784 Return 0 upon success, or -1 with errno set upon failure. */
1785 # if !@HAVE_PIPE@
1786 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
1787 # endif
1788 _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1789 _GL_CXXALIASWARN (pipe);
1790 #elif defined GNULIB_POSIXCHECK
1791 # undef pipe
1792 # if HAVE_RAW_DECL_PIPE
1793 _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1794 "use gnulib module pipe-posix for portability");
1795 # endif
1796 #endif
1799 #if @GNULIB_PIPE2@
1800 /* Create a pipe, applying the given flags when opening the read-end of the
1801 pipe and the write-end of the pipe.
1802 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1803 and O_TEXT, O_BINARY (defined in "binary-io.h").
1804 Store the read-end as fd[0] and the write-end as fd[1].
1805 Return 0 upon success, or -1 with errno set upon failure.
1806 See also the Linux man page at
1807 <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
1808 # if @REPLACE_PIPE2@
1809 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1810 # undef pipe2
1811 # define pipe2 rpl_pipe2
1812 # endif
1813 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1814 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1815 # else
1816 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1817 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1818 # endif
1819 # if __GLIBC__ >= 2
1820 _GL_CXXALIASWARN (pipe2);
1821 # endif
1822 #elif defined GNULIB_POSIXCHECK
1823 # undef pipe2
1824 # if HAVE_RAW_DECL_PIPE2
1825 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1826 "use gnulib module pipe2 for portability");
1827 # endif
1828 #endif
1831 #if @GNULIB_PREAD@
1832 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1833 Return the number of bytes placed into BUF if successful, otherwise
1834 set errno and return -1. 0 indicates EOF.
1835 See the POSIX:2008 specification
1836 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
1837 # if @REPLACE_PREAD@
1838 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1839 # undef pread
1840 # define pread rpl_pread
1841 # endif
1842 _GL_FUNCDECL_RPL (pread, ssize_t,
1843 (int fd, void *buf, size_t bufsize, off_t offset)
1844 _GL_ARG_NONNULL ((2)));
1845 _GL_CXXALIAS_RPL (pread, ssize_t,
1846 (int fd, void *buf, size_t bufsize, off_t offset));
1847 # else
1848 # if !@HAVE_PREAD@
1849 _GL_FUNCDECL_SYS (pread, ssize_t,
1850 (int fd, void *buf, size_t bufsize, off_t offset)
1851 _GL_ARG_NONNULL ((2)));
1852 # endif
1853 _GL_CXXALIAS_SYS (pread, ssize_t,
1854 (int fd, void *buf, size_t bufsize, off_t offset));
1855 # endif
1856 # if __GLIBC__ >= 2
1857 _GL_CXXALIASWARN (pread);
1858 # endif
1859 #elif defined GNULIB_POSIXCHECK
1860 # undef pread
1861 # if HAVE_RAW_DECL_PREAD
1862 _GL_WARN_ON_USE (pread, "pread is unportable - "
1863 "use gnulib module pread for portability");
1864 # endif
1865 #endif
1868 #if @GNULIB_PWRITE@
1869 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1870 Return the number of bytes written if successful, otherwise
1871 set errno and return -1. 0 indicates nothing written. See the
1872 POSIX:2008 specification
1873 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
1874 # if @REPLACE_PWRITE@
1875 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1876 # undef pwrite
1877 # define pwrite rpl_pwrite
1878 # endif
1879 _GL_FUNCDECL_RPL (pwrite, ssize_t,
1880 (int fd, const void *buf, size_t bufsize, off_t offset)
1881 _GL_ARG_NONNULL ((2)));
1882 _GL_CXXALIAS_RPL (pwrite, ssize_t,
1883 (int fd, const void *buf, size_t bufsize, off_t offset));
1884 # else
1885 # if !@HAVE_PWRITE@
1886 _GL_FUNCDECL_SYS (pwrite, ssize_t,
1887 (int fd, const void *buf, size_t bufsize, off_t offset)
1888 _GL_ARG_NONNULL ((2)));
1889 # endif
1890 _GL_CXXALIAS_SYS (pwrite, ssize_t,
1891 (int fd, const void *buf, size_t bufsize, off_t offset));
1892 # endif
1893 # if __GLIBC__ >= 2
1894 _GL_CXXALIASWARN (pwrite);
1895 # endif
1896 #elif defined GNULIB_POSIXCHECK
1897 # undef pwrite
1898 # if HAVE_RAW_DECL_PWRITE
1899 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1900 "use gnulib module pwrite for portability");
1901 # endif
1902 #endif
1905 #if @GNULIB_READ@
1906 /* Read up to COUNT bytes from file descriptor FD into the buffer starting
1907 at BUF. See the POSIX:2008 specification
1908 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
1909 # if @REPLACE_READ@
1910 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1911 # undef read
1912 # define read rpl_read
1913 # endif
1914 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1915 _GL_ARG_NONNULL ((2)));
1916 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1917 # elif defined _WIN32 && !defined __CYGWIN__
1918 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1919 # undef read
1920 # define read _read
1921 # endif
1922 _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count));
1923 # else
1924 _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
1925 # endif
1926 _GL_CXXALIASWARN (read);
1927 #elif @GNULIB_MDA_READ@
1928 /* On native Windows, map 'read' to '_read', so that -loldnames is not
1929 required. In C++ with GNULIB_NAMESPACE, avoid differences between
1930 platforms by defining GNULIB_NAMESPACE::read always. */
1931 # if defined _WIN32 && !defined __CYGWIN__
1932 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1933 # undef read
1934 # define read _read
1935 # endif
1936 # ifdef __MINGW32__
1937 _GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count));
1938 # else
1939 _GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count));
1940 # endif
1941 # else
1942 _GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
1943 # endif
1944 _GL_CXXALIASWARN (read);
1945 #endif
1948 #if @GNULIB_READLINK@
1949 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
1950 bytes of it into BUF. Return the number of bytes placed into BUF if
1951 successful, otherwise -1 and errno set.
1952 See the POSIX:2008 specification
1953 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
1954 # if @REPLACE_READLINK@
1955 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1956 # define readlink rpl_readlink
1957 # endif
1958 _GL_FUNCDECL_RPL (readlink, ssize_t,
1959 (const char *restrict file,
1960 char *restrict buf, size_t bufsize)
1961 _GL_ARG_NONNULL ((1, 2)));
1962 _GL_CXXALIAS_RPL (readlink, ssize_t,
1963 (const char *restrict file,
1964 char *restrict buf, size_t bufsize));
1965 # else
1966 # if !@HAVE_READLINK@
1967 _GL_FUNCDECL_SYS (readlink, ssize_t,
1968 (const char *restrict file,
1969 char *restrict buf, size_t bufsize)
1970 _GL_ARG_NONNULL ((1, 2)));
1971 # endif
1972 _GL_CXXALIAS_SYS (readlink, ssize_t,
1973 (const char *restrict file,
1974 char *restrict buf, size_t bufsize));
1975 # endif
1976 _GL_CXXALIASWARN (readlink);
1977 #elif defined GNULIB_POSIXCHECK
1978 # undef readlink
1979 # if HAVE_RAW_DECL_READLINK
1980 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1981 "use gnulib module readlink for portability");
1982 # endif
1983 #endif
1986 #if @GNULIB_READLINKAT@
1987 # if @REPLACE_READLINKAT@
1988 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1989 # define readlinkat rpl_readlinkat
1990 # endif
1991 _GL_FUNCDECL_RPL (readlinkat, ssize_t,
1992 (int fd, char const *restrict file,
1993 char *restrict buf, size_t len)
1994 _GL_ARG_NONNULL ((2, 3)));
1995 _GL_CXXALIAS_RPL (readlinkat, ssize_t,
1996 (int fd, char const *restrict file,
1997 char *restrict buf, size_t len));
1998 # else
1999 # if !@HAVE_READLINKAT@
2000 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
2001 (int fd, char const *restrict file,
2002 char *restrict buf, size_t len)
2003 _GL_ARG_NONNULL ((2, 3)));
2004 # endif
2005 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
2006 (int fd, char const *restrict file,
2007 char *restrict buf, size_t len));
2008 # endif
2009 # if __GLIBC__ >= 2
2010 _GL_CXXALIASWARN (readlinkat);
2011 # endif
2012 #elif defined GNULIB_POSIXCHECK
2013 # undef readlinkat
2014 # if HAVE_RAW_DECL_READLINKAT
2015 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
2016 "use gnulib module readlinkat for portability");
2017 # endif
2018 #endif
2021 #if @GNULIB_RMDIR@
2022 /* Remove the directory DIR. */
2023 # if @REPLACE_RMDIR@
2024 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2025 # define rmdir rpl_rmdir
2026 # endif
2027 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
2028 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
2029 # elif defined _WIN32 && !defined __CYGWIN__
2030 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2031 # undef rmdir
2032 # define rmdir _rmdir
2033 # endif
2034 _GL_CXXALIAS_MDA (rmdir, int, (char const *name));
2035 # else
2036 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
2037 # endif
2038 _GL_CXXALIASWARN (rmdir);
2039 #elif defined GNULIB_POSIXCHECK
2040 # undef rmdir
2041 # if HAVE_RAW_DECL_RMDIR
2042 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
2043 "use gnulib module rmdir for portability");
2044 # endif
2045 #elif @GNULIB_MDA_RMDIR@
2046 /* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not
2047 required. In C++ with GNULIB_NAMESPACE, avoid differences between
2048 platforms by defining GNULIB_NAMESPACE::rmdir always. */
2049 # if defined _WIN32 && !defined __CYGWIN__
2050 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2051 # undef rmdir
2052 # define rmdir _rmdir
2053 # endif
2054 _GL_CXXALIAS_MDA (rmdir, int, (char const *name));
2055 # else
2056 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
2057 # endif
2058 _GL_CXXALIASWARN (rmdir);
2059 #endif
2062 #if @GNULIB_SETHOSTNAME@
2063 /* Set the host name of the machine.
2064 The host name may or may not be fully qualified.
2066 Put LEN bytes of NAME into the host name.
2067 Return 0 if successful, otherwise, set errno and return -1.
2069 Platforms with no ability to set the hostname return -1 and set
2070 errno = ENOSYS. */
2071 # if @REPLACE_SETHOSTNAME@
2072 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2073 # undef sethostname
2074 # define sethostname rpl_sethostname
2075 # endif
2076 _GL_FUNCDECL_RPL (sethostname, int, (const char *name, size_t len)
2077 _GL_ARG_NONNULL ((1)));
2078 _GL_CXXALIAS_RPL (sethostname, int, (const char *name, size_t len));
2079 # else
2080 # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
2081 _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
2082 _GL_ARG_NONNULL ((1)));
2083 # endif
2084 /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
2085 and FreeBSD 6.4 the second parameter is int. On Solaris 11
2086 2011-10, the first parameter is not const. */
2087 _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
2088 # endif
2089 # if __GLIBC__ >= 2
2090 _GL_CXXALIASWARN (sethostname);
2091 # endif
2092 #elif defined GNULIB_POSIXCHECK
2093 # undef sethostname
2094 # if HAVE_RAW_DECL_SETHOSTNAME
2095 _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
2096 "use gnulib module sethostname for portability");
2097 # endif
2098 #endif
2101 #if @GNULIB_SLEEP@
2102 /* Pause the execution of the current thread for N seconds.
2103 Returns the number of seconds left to sleep.
2104 See the POSIX:2008 specification
2105 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
2106 # if @REPLACE_SLEEP@
2107 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2108 # undef sleep
2109 # define sleep rpl_sleep
2110 # endif
2111 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
2112 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
2113 # else
2114 # if !@HAVE_SLEEP@
2115 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
2116 # endif
2117 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
2118 # endif
2119 _GL_CXXALIASWARN (sleep);
2120 #elif defined GNULIB_POSIXCHECK
2121 # undef sleep
2122 # if HAVE_RAW_DECL_SLEEP
2123 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
2124 "use gnulib module sleep for portability");
2125 # endif
2126 #endif
2129 #if @GNULIB_MDA_SWAB@
2130 /* On native Windows, map 'swab' to '_swab', so that -loldnames is not
2131 required. In C++ with GNULIB_NAMESPACE, avoid differences between
2132 platforms by defining GNULIB_NAMESPACE::swab always. */
2133 # if defined _WIN32 && !defined __CYGWIN__
2134 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2135 # undef swab
2136 # define swab _swab
2137 # endif
2138 /* Need to cast, because in old mingw the arguments are
2139 (const char *from, char *to, size_t n). */
2140 _GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n));
2141 # else
2142 # if defined __hpux /* HP-UX */
2143 _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n));
2144 # elif defined __sun && (defined __SunOS_5_10 || defined __XOPEN_OR_POSIX) && !defined _XPG4 /* Solaris */
2145 _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n));
2146 # else
2147 _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n));
2148 # endif
2149 # endif
2150 _GL_CXXALIASWARN (swab);
2151 #endif
2154 #if @GNULIB_SYMLINK@
2155 # if @REPLACE_SYMLINK@
2156 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2157 # undef symlink
2158 # define symlink rpl_symlink
2159 # endif
2160 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
2161 _GL_ARG_NONNULL ((1, 2)));
2162 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
2163 # else
2164 # if !@HAVE_SYMLINK@
2165 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
2166 _GL_ARG_NONNULL ((1, 2)));
2167 # endif
2168 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
2169 # endif
2170 _GL_CXXALIASWARN (symlink);
2171 #elif defined GNULIB_POSIXCHECK
2172 # undef symlink
2173 # if HAVE_RAW_DECL_SYMLINK
2174 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
2175 "use gnulib module symlink for portability");
2176 # endif
2177 #endif
2180 #if @GNULIB_SYMLINKAT@
2181 # if @REPLACE_SYMLINKAT@
2182 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2183 # undef symlinkat
2184 # define symlinkat rpl_symlinkat
2185 # endif
2186 _GL_FUNCDECL_RPL (symlinkat, int,
2187 (char const *contents, int fd, char const *file)
2188 _GL_ARG_NONNULL ((1, 3)));
2189 _GL_CXXALIAS_RPL (symlinkat, int,
2190 (char const *contents, int fd, char const *file));
2191 # else
2192 # if !@HAVE_SYMLINKAT@
2193 _GL_FUNCDECL_SYS (symlinkat, int,
2194 (char const *contents, int fd, char const *file)
2195 _GL_ARG_NONNULL ((1, 3)));
2196 # endif
2197 _GL_CXXALIAS_SYS (symlinkat, int,
2198 (char const *contents, int fd, char const *file));
2199 # endif
2200 # if __GLIBC__ >= 2
2201 _GL_CXXALIASWARN (symlinkat);
2202 # endif
2203 #elif defined GNULIB_POSIXCHECK
2204 # undef symlinkat
2205 # if HAVE_RAW_DECL_SYMLINKAT
2206 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
2207 "use gnulib module symlinkat for portability");
2208 # endif
2209 #endif
2212 #if @GNULIB_TRUNCATE@
2213 /* Change the size of the file designated by FILENAME to become equal to LENGTH.
2214 Return 0 if successful, otherwise -1 and errno set.
2215 See the POSIX:2008 specification
2216 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */
2217 # if @REPLACE_TRUNCATE@
2218 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2219 # undef truncate
2220 # define truncate rpl_truncate
2221 # endif
2222 _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
2223 _GL_ARG_NONNULL ((1)));
2224 _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
2225 # else
2226 # if !@HAVE_DECL_TRUNCATE@
2227 _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
2228 _GL_ARG_NONNULL ((1)));
2229 # endif
2230 _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
2231 # endif
2232 # if __GLIBC__ >= 2
2233 _GL_CXXALIASWARN (truncate);
2234 # endif
2235 #elif defined GNULIB_POSIXCHECK
2236 # undef truncate
2237 # if HAVE_RAW_DECL_TRUNCATE
2238 _GL_WARN_ON_USE (truncate, "truncate is unportable - "
2239 "use gnulib module truncate for portability");
2240 # endif
2241 #endif
2244 #if @GNULIB_TTYNAME_R@
2245 /* Store at most BUFLEN characters of the pathname of the terminal FD is
2246 open on in BUF. Return 0 on success, otherwise an error number. */
2247 # if @REPLACE_TTYNAME_R@
2248 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2249 # undef ttyname_r
2250 # define ttyname_r rpl_ttyname_r
2251 # endif
2252 _GL_FUNCDECL_RPL (ttyname_r, int,
2253 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
2254 _GL_CXXALIAS_RPL (ttyname_r, int,
2255 (int fd, char *buf, size_t buflen));
2256 # else
2257 # if !@HAVE_DECL_TTYNAME_R@
2258 _GL_FUNCDECL_SYS (ttyname_r, int,
2259 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
2260 # endif
2261 _GL_CXXALIAS_SYS (ttyname_r, int,
2262 (int fd, char *buf, size_t buflen));
2263 # endif
2264 # if __GLIBC__ >= 2
2265 _GL_CXXALIASWARN (ttyname_r);
2266 # endif
2267 #elif defined GNULIB_POSIXCHECK
2268 # undef ttyname_r
2269 # if HAVE_RAW_DECL_TTYNAME_R
2270 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
2271 "use gnulib module ttyname_r for portability");
2272 # endif
2273 #endif
2276 #if @GNULIB_UNLINK@
2277 # if @REPLACE_UNLINK@
2278 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2279 # undef unlink
2280 # define unlink rpl_unlink
2281 # endif
2282 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
2283 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
2284 # elif defined _WIN32 && !defined __CYGWIN__
2285 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2286 # undef unlink
2287 # define unlink _unlink
2288 # endif
2289 _GL_CXXALIAS_MDA (unlink, int, (char const *file));
2290 # else
2291 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
2292 # endif
2293 _GL_CXXALIASWARN (unlink);
2294 #elif defined GNULIB_POSIXCHECK
2295 # undef unlink
2296 # if HAVE_RAW_DECL_UNLINK
2297 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
2298 "use gnulib module unlink for portability");
2299 # endif
2300 #elif @GNULIB_MDA_UNLINK@
2301 /* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not
2302 required. In C++ with GNULIB_NAMESPACE, avoid differences between
2303 platforms by defining GNULIB_NAMESPACE::unlink always. */
2304 # if defined _WIN32 && !defined __CYGWIN__
2305 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2306 # undef unlink
2307 # define unlink _unlink
2308 # endif
2309 _GL_CXXALIAS_MDA (unlink, int, (char const *file));
2310 # else
2311 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
2312 # endif
2313 _GL_CXXALIASWARN (unlink);
2314 #endif
2317 #if @GNULIB_UNLINKAT@
2318 # if @REPLACE_UNLINKAT@
2319 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2320 # undef unlinkat
2321 # define unlinkat rpl_unlinkat
2322 # endif
2323 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
2324 _GL_ARG_NONNULL ((2)));
2325 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
2326 # else
2327 # if !@HAVE_UNLINKAT@
2328 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
2329 _GL_ARG_NONNULL ((2)));
2330 # endif
2331 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
2332 # endif
2333 _GL_CXXALIASWARN (unlinkat);
2334 #elif defined GNULIB_POSIXCHECK
2335 # undef unlinkat
2336 # if HAVE_RAW_DECL_UNLINKAT
2337 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
2338 "use gnulib module unlinkat for portability");
2339 # endif
2340 #endif
2343 #if @GNULIB_USLEEP@
2344 /* Pause the execution of the current thread for N microseconds.
2345 Returns 0 on completion, or -1 on range error.
2346 See the POSIX:2001 specification
2347 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
2348 # if @REPLACE_USLEEP@
2349 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2350 # undef usleep
2351 # define usleep rpl_usleep
2352 # endif
2353 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
2354 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
2355 # else
2356 # if !@HAVE_USLEEP@
2357 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
2358 # endif
2359 /* Need to cast, because on Haiku, the first parameter is
2360 unsigned int n. */
2361 _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n));
2362 # endif
2363 _GL_CXXALIASWARN (usleep);
2364 #elif defined GNULIB_POSIXCHECK
2365 # undef usleep
2366 # if HAVE_RAW_DECL_USLEEP
2367 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
2368 "use gnulib module usleep for portability");
2369 # endif
2370 #endif
2373 #if @GNULIB_WRITE@
2374 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
2375 See the POSIX:2008 specification
2376 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
2377 # if @REPLACE_WRITE@
2378 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2379 # undef write
2380 # define write rpl_write
2381 # endif
2382 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
2383 _GL_ARG_NONNULL ((2)));
2384 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
2385 # elif defined _WIN32 && !defined __CYGWIN__
2386 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2387 # undef write
2388 # define write _write
2389 # endif
2390 _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count));
2391 # else
2392 _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
2393 # endif
2394 _GL_CXXALIASWARN (write);
2395 #elif @GNULIB_MDA_WRITE@
2396 /* On native Windows, map 'write' to '_write', so that -loldnames is not
2397 required. In C++ with GNULIB_NAMESPACE, avoid differences between
2398 platforms by defining GNULIB_NAMESPACE::write always. */
2399 # if defined _WIN32 && !defined __CYGWIN__
2400 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2401 # undef write
2402 # define write _write
2403 # endif
2404 # ifdef __MINGW32__
2405 _GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count));
2406 # else
2407 _GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count));
2408 # endif
2409 # else
2410 _GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count));
2411 # endif
2412 _GL_CXXALIASWARN (write);
2413 #endif
2415 _GL_INLINE_HEADER_END
2417 #endif /* _@GUARD_PREFIX@_UNISTD_H */
2418 #endif /* _GL_INCLUDING_UNISTD_H */
2419 #endif /* _@GUARD_PREFIX@_UNISTD_H */