Debian Codegraph @

gnulib/unistd.in.h

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