Enchant: enchant-2.6.5/lib/unistd.in.h Source File

Enchant Generic spell checking library

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