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