Debian Codegraph @

lib/unistd.in.h

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