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