]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gnulib/import/unistd.in.h
b211e4d61f7951d1bc031653e0d835ef21b5e770
[thirdparty/binutils-gdb.git] / gnulib / import / unistd.in.h
1 /* Substitute for and wrapper around <unistd.h>.
2 Copyright (C) 2003-2020 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, see <https://www.gnu.org/licenses/>. */
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 ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
101 || defined GNULIB_POSIXCHECK) \
102 && (defined _WIN32 && ! defined __CYGWIN__))
103 # include <io.h> /* mingw32, mingw64 */
104 # include <direct.h> /* mingw64, MSVC 9 */
105 #elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
106 || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
107 || defined GNULIB_POSIXCHECK) \
108 && (defined _WIN32 && ! defined __CYGWIN__)
109 # include <io.h>
110 #endif
111
112 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
113 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
114 /* But avoid namespace pollution on glibc systems. */
115 #if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \
116 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
117 && !defined __GLIBC__
118 # include <netdb.h>
119 #endif
120
121 /* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in
122 <sys/random.h>, not in <unistd.h>. */
123 /* But avoid namespace pollution on glibc systems. */
124 #if (@GNULIB_GETENTROPY@ || defined GNULIB_POSIXCHECK) \
125 && ((defined __APPLE__ && defined __MACH__) || defined __sun \
126 || defined __ANDROID__) \
127 && @UNISTD_H_HAVE_SYS_RANDOM_H@ \
128 && !defined __GLIBC__
129 # include <sys/random.h>
130 #endif
131
132 /* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */
133 /* But avoid namespace pollution on glibc systems. */
134 #if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
135 && !defined __GLIBC__
136 # include <sys/stat.h>
137 #endif
138
139 /* MSVC defines off_t in <sys/types.h>.
140 May also define off_t to a 64-bit type on native Windows. */
141 /* But avoid namespace pollution on glibc systems. */
142 #ifndef __GLIBC__
143 /* Get off_t, ssize_t. */
144 # include <sys/types.h>
145 #endif
146
147 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
148
149 /* The definition of _GL_ARG_NONNULL is copied here. */
150
151 /* The definition of _GL_WARN_ON_USE is copied here. */
152
153
154 /* Get getopt(), optarg, optind, opterr, optopt. */
155 #if @GNULIB_GETOPT_POSIX@ && @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT
156 # include <getopt-cdefs.h>
157 # include <getopt-pfx-core.h>
158 #endif
159
160 #ifndef _GL_INLINE_HEADER_BEGIN
161 #error "Please include config.h first."
162 #endif
163 _GL_INLINE_HEADER_BEGIN
164 #ifndef _GL_UNISTD_INLINE
165 # define _GL_UNISTD_INLINE _GL_INLINE
166 #endif
167
168 /* Hide some function declarations from <winsock2.h>. */
169
170 #if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@
171 # if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
172 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
173 # undef socket
174 # define socket socket_used_without_including_sys_socket_h
175 # undef connect
176 # define connect connect_used_without_including_sys_socket_h
177 # undef accept
178 # define accept accept_used_without_including_sys_socket_h
179 # undef bind
180 # define bind bind_used_without_including_sys_socket_h
181 # undef getpeername
182 # define getpeername getpeername_used_without_including_sys_socket_h
183 # undef getsockname
184 # define getsockname getsockname_used_without_including_sys_socket_h
185 # undef getsockopt
186 # define getsockopt getsockopt_used_without_including_sys_socket_h
187 # undef listen
188 # define listen listen_used_without_including_sys_socket_h
189 # undef recv
190 # define recv recv_used_without_including_sys_socket_h
191 # undef send
192 # define send send_used_without_including_sys_socket_h
193 # undef recvfrom
194 # define recvfrom recvfrom_used_without_including_sys_socket_h
195 # undef sendto
196 # define sendto sendto_used_without_including_sys_socket_h
197 # undef setsockopt
198 # define setsockopt setsockopt_used_without_including_sys_socket_h
199 # undef shutdown
200 # define shutdown shutdown_used_without_including_sys_socket_h
201 # else
202 _GL_WARN_ON_USE (socket,
203 "socket() used without including <sys/socket.h>");
204 _GL_WARN_ON_USE (connect,
205 "connect() used without including <sys/socket.h>");
206 _GL_WARN_ON_USE (accept,
207 "accept() used without including <sys/socket.h>");
208 _GL_WARN_ON_USE (bind,
209 "bind() used without including <sys/socket.h>");
210 _GL_WARN_ON_USE (getpeername,
211 "getpeername() used without including <sys/socket.h>");
212 _GL_WARN_ON_USE (getsockname,
213 "getsockname() used without including <sys/socket.h>");
214 _GL_WARN_ON_USE (getsockopt,
215 "getsockopt() used without including <sys/socket.h>");
216 _GL_WARN_ON_USE (listen,
217 "listen() used without including <sys/socket.h>");
218 _GL_WARN_ON_USE (recv,
219 "recv() used without including <sys/socket.h>");
220 _GL_WARN_ON_USE (send,
221 "send() used without including <sys/socket.h>");
222 _GL_WARN_ON_USE (recvfrom,
223 "recvfrom() used without including <sys/socket.h>");
224 _GL_WARN_ON_USE (sendto,
225 "sendto() used without including <sys/socket.h>");
226 _GL_WARN_ON_USE (setsockopt,
227 "setsockopt() used without including <sys/socket.h>");
228 _GL_WARN_ON_USE (shutdown,
229 "shutdown() used without including <sys/socket.h>");
230 # endif
231 # endif
232 # if !defined _@GUARD_PREFIX@_SYS_SELECT_H
233 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
234 # undef select
235 # define select select_used_without_including_sys_select_h
236 # else
237 _GL_WARN_ON_USE (select,
238 "select() used without including <sys/select.h>");
239 # endif
240 # endif
241 #endif
242
243
244 /* OS/2 EMX lacks these macros. */
245 #ifndef STDIN_FILENO
246 # define STDIN_FILENO 0
247 #endif
248 #ifndef STDOUT_FILENO
249 # define STDOUT_FILENO 1
250 #endif
251 #ifndef STDERR_FILENO
252 # define STDERR_FILENO 2
253 #endif
254
255 /* Ensure *_OK macros exist. */
256 #ifndef F_OK
257 # define F_OK 0
258 # define X_OK 1
259 # define W_OK 2
260 # define R_OK 4
261 #endif
262
263
264 /* Declare overridden functions. */
265
266
267 #if @GNULIB_ACCESS@
268 # if @REPLACE_ACCESS@
269 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
270 # undef access
271 # define access rpl_access
272 # endif
273 _GL_FUNCDECL_RPL (access, int, (const char *file, int mode)
274 _GL_ARG_NONNULL ((1)));
275 _GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
276 # else
277 _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
278 # endif
279 _GL_CXXALIASWARN (access);
280 #elif defined GNULIB_POSIXCHECK
281 # undef access
282 # if HAVE_RAW_DECL_ACCESS
283 /* The access() function is a security risk. */
284 _GL_WARN_ON_USE (access, "access does not always support X_OK - "
285 "use gnulib module access for portability; "
286 "also, this function is a security risk - "
287 "use the gnulib module faccessat instead");
288 # endif
289 #endif
290
291
292 #if @GNULIB_CHDIR@
293 _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
294 _GL_CXXALIASWARN (chdir);
295 #elif defined GNULIB_POSIXCHECK
296 # undef chdir
297 # if HAVE_RAW_DECL_CHDIR
298 _GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - "
299 "use gnulib module chdir for portability");
300 # endif
301 #endif
302
303
304 #if @GNULIB_CHOWN@
305 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
306 to GID (if GID is not -1). Follow symbolic links.
307 Return 0 if successful, otherwise -1 and errno set.
308 See the POSIX:2008 specification
309 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html. */
310 # if @REPLACE_CHOWN@
311 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
312 # undef chown
313 # define chown rpl_chown
314 # endif
315 _GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)
316 _GL_ARG_NONNULL ((1)));
317 _GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
318 # else
319 # if !@HAVE_CHOWN@
320 _GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)
321 _GL_ARG_NONNULL ((1)));
322 # endif
323 _GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
324 # endif
325 _GL_CXXALIASWARN (chown);
326 #elif defined GNULIB_POSIXCHECK
327 # undef chown
328 # if HAVE_RAW_DECL_CHOWN
329 _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
330 "doesn't treat a uid or gid of -1 on some systems - "
331 "use gnulib module chown for portability");
332 # endif
333 #endif
334
335
336 #if @GNULIB_CLOSE@
337 # if @REPLACE_CLOSE@
338 /* Automatically included by modules that need a replacement for close. */
339 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
340 # undef close
341 # define close rpl_close
342 # endif
343 _GL_FUNCDECL_RPL (close, int, (int fd));
344 _GL_CXXALIAS_RPL (close, int, (int fd));
345 # else
346 _GL_CXXALIAS_SYS (close, int, (int fd));
347 # endif
348 _GL_CXXALIASWARN (close);
349 #elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
350 # undef close
351 # define close close_used_without_requesting_gnulib_module_close
352 #elif defined GNULIB_POSIXCHECK
353 # undef close
354 /* Assume close is always declared. */
355 _GL_WARN_ON_USE (close, "close does not portably work on sockets - "
356 "use gnulib module close for portability");
357 #endif
358
359
360 #if @GNULIB_COPY_FILE_RANGE@
361 # if !@HAVE_COPY_FILE_RANGE@
362 _GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
363 int ofd, off_t *opos,
364 size_t len, unsigned flags));
365 _GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
366 int ofd, off_t *opos,
367 size_t len, unsigned flags));
368 # endif
369 _GL_CXXALIASWARN (copy_file_range);
370 #elif defined GNULIB_POSIXCHECK
371 /* Assume copy_file_range is always declared. */
372 _GL_WARN_ON_USE (copy_file_range,
373 "copy_file_range is unportable - "
374 "use gnulib module copy_file_range for portability");
375 #endif
376
377
378 #if @GNULIB_DUP@
379 # if @REPLACE_DUP@
380 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
381 # define dup rpl_dup
382 # endif
383 _GL_FUNCDECL_RPL (dup, int, (int oldfd));
384 _GL_CXXALIAS_RPL (dup, int, (int oldfd));
385 # else
386 _GL_CXXALIAS_SYS (dup, int, (int oldfd));
387 # endif
388 _GL_CXXALIASWARN (dup);
389 #elif defined GNULIB_POSIXCHECK
390 # undef dup
391 # if HAVE_RAW_DECL_DUP
392 _GL_WARN_ON_USE (dup, "dup is unportable - "
393 "use gnulib module dup for portability");
394 # endif
395 #endif
396
397
398 #if @GNULIB_DUP2@
399 /* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
400 NEWFD = OLDFD, otherwise close NEWFD first if it is open.
401 Return newfd if successful, otherwise -1 and errno set.
402 See the POSIX:2008 specification
403 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html>. */
404 # if @REPLACE_DUP2@
405 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
406 # define dup2 rpl_dup2
407 # endif
408 _GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd));
409 _GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
410 # else
411 # if !@HAVE_DUP2@
412 _GL_FUNCDECL_SYS (dup2, int, (int oldfd, int newfd));
413 # endif
414 _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
415 # endif
416 _GL_CXXALIASWARN (dup2);
417 #elif defined GNULIB_POSIXCHECK
418 # undef dup2
419 # if HAVE_RAW_DECL_DUP2
420 _GL_WARN_ON_USE (dup2, "dup2 is unportable - "
421 "use gnulib module dup2 for portability");
422 # endif
423 #endif
424
425
426 #if @GNULIB_DUP3@
427 /* Copy the file descriptor OLDFD into file descriptor NEWFD, with the
428 specified flags.
429 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
430 and O_TEXT, O_BINARY (defined in "binary-io.h").
431 Close NEWFD first if it is open.
432 Return newfd if successful, otherwise -1 and errno set.
433 See the Linux man page at
434 <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
435 # if @HAVE_DUP3@
436 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
437 # define dup3 rpl_dup3
438 # endif
439 _GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags));
440 _GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
441 # else
442 _GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags));
443 _GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
444 # endif
445 _GL_CXXALIASWARN (dup3);
446 #elif defined GNULIB_POSIXCHECK
447 # undef dup3
448 # if HAVE_RAW_DECL_DUP3
449 _GL_WARN_ON_USE (dup3, "dup3 is unportable - "
450 "use gnulib module dup3 for portability");
451 # endif
452 #endif
453
454
455 #if @GNULIB_ENVIRON@
456 # if defined __CYGWIN__ && !defined __i386__
457 /* The 'environ' variable is defined in a DLL. Therefore its declaration needs
458 the '__declspec(dllimport)' attribute, but the system's <unistd.h> lacks it.
459 This leads to a link error on 64-bit Cygwin when the option
460 -Wl,--disable-auto-import is in use. */
461 _GL_EXTERN_C __declspec(dllimport) char **environ;
462 # endif
463 # if !@HAVE_DECL_ENVIRON@
464 /* Set of environment variables and values. An array of strings of the form
465 "VARIABLE=VALUE", terminated with a NULL. */
466 # if defined __APPLE__ && defined __MACH__
467 # include <TargetConditionals.h>
468 # if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR
469 # define _GL_USE_CRT_EXTERNS
470 # endif
471 # endif
472 # ifdef _GL_USE_CRT_EXTERNS
473 # include <crt_externs.h>
474 # define environ (*_NSGetEnviron ())
475 # else
476 # ifdef __cplusplus
477 extern "C" {
478 # endif
479 extern char **environ;
480 # ifdef __cplusplus
481 }
482 # endif
483 # endif
484 # endif
485 #elif defined GNULIB_POSIXCHECK
486 # if HAVE_RAW_DECL_ENVIRON
487 _GL_UNISTD_INLINE char ***
488 _GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - "
489 "use gnulib module environ for portability")
490 rpl_environ (void)
491 {
492 return &environ;
493 }
494 # undef environ
495 # define environ (*rpl_environ ())
496 # endif
497 #endif
498
499
500 #if @GNULIB_EUIDACCESS@
501 /* Like access(), except that it uses the effective user id and group id of
502 the current process. */
503 # if !@HAVE_EUIDACCESS@
504 _GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode)
505 _GL_ARG_NONNULL ((1)));
506 # endif
507 _GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
508 _GL_CXXALIASWARN (euidaccess);
509 # if defined GNULIB_POSIXCHECK
510 /* Like access(), this function is a security risk. */
511 _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
512 "use the gnulib module faccessat instead");
513 # endif
514 #elif defined GNULIB_POSIXCHECK
515 # undef euidaccess
516 # if HAVE_RAW_DECL_EUIDACCESS
517 _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
518 "use gnulib module euidaccess for portability");
519 # endif
520 #endif
521
522
523 #if @GNULIB_FACCESSAT@
524 # if @REPLACE_FACCESSAT@
525 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
526 # undef faccessat
527 # define faccessat rpl_faccessat
528 # endif
529 _GL_FUNCDECL_RPL (faccessat, int,
530 (int fd, char const *name, int mode, int flag)
531 _GL_ARG_NONNULL ((2)));
532 _GL_CXXALIAS_RPL (faccessat, int,
533 (int fd, char const *name, int mode, int flag));
534 # else
535 # if !@HAVE_FACCESSAT@
536 _GL_FUNCDECL_SYS (faccessat, int,
537 (int fd, char const *file, int mode, int flag)
538 _GL_ARG_NONNULL ((2)));
539 # endif
540 _GL_CXXALIAS_SYS (faccessat, int,
541 (int fd, char const *file, int mode, int flag));
542 # endif
543 _GL_CXXALIASWARN (faccessat);
544 #elif defined GNULIB_POSIXCHECK
545 # undef faccessat
546 # if HAVE_RAW_DECL_FACCESSAT
547 _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
548 "use gnulib module faccessat for portability");
549 # endif
550 #endif
551
552
553 #if @GNULIB_FCHDIR@
554 /* Change the process' current working directory to the directory on which
555 the given file descriptor is open.
556 Return 0 if successful, otherwise -1 and errno set.
557 See the POSIX:2008 specification
558 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
559 # if ! @HAVE_FCHDIR@
560 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
561
562 /* Gnulib internal hooks needed to maintain the fchdir metadata. */
563 _GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
564 _GL_ARG_NONNULL ((2));
565 _GL_EXTERN_C void _gl_unregister_fd (int fd);
566 _GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
567 _GL_EXTERN_C const char *_gl_directory_name (int fd);
568
569 # else
570 # if !@HAVE_DECL_FCHDIR@
571 _GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
572 # endif
573 # endif
574 _GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
575 _GL_CXXALIASWARN (fchdir);
576 #elif defined GNULIB_POSIXCHECK
577 # undef fchdir
578 # if HAVE_RAW_DECL_FCHDIR
579 _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
580 "use gnulib module fchdir for portability");
581 # endif
582 #endif
583
584
585 #if @GNULIB_FCHOWNAT@
586 # if @REPLACE_FCHOWNAT@
587 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
588 # undef fchownat
589 # define fchownat rpl_fchownat
590 # endif
591 _GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
592 uid_t owner, gid_t group, int flag)
593 _GL_ARG_NONNULL ((2)));
594 _GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
595 uid_t owner, gid_t group, int flag));
596 # else
597 # if !@HAVE_FCHOWNAT@
598 _GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
599 uid_t owner, gid_t group, int flag)
600 _GL_ARG_NONNULL ((2)));
601 # endif
602 _GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
603 uid_t owner, gid_t group, int flag));
604 # endif
605 _GL_CXXALIASWARN (fchownat);
606 #elif defined GNULIB_POSIXCHECK
607 # undef fchownat
608 # if HAVE_RAW_DECL_FCHOWNAT
609 _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
610 "use gnulib module openat for portability");
611 # endif
612 #endif
613
614
615 #if @GNULIB_FDATASYNC@
616 /* Synchronize changes to a file.
617 Return 0 if successful, otherwise -1 and errno set.
618 See POSIX:2008 specification
619 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
620 # if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@
621 _GL_FUNCDECL_SYS (fdatasync, int, (int fd));
622 # endif
623 _GL_CXXALIAS_SYS (fdatasync, int, (int fd));
624 _GL_CXXALIASWARN (fdatasync);
625 #elif defined GNULIB_POSIXCHECK
626 # undef fdatasync
627 # if HAVE_RAW_DECL_FDATASYNC
628 _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
629 "use gnulib module fdatasync for portability");
630 # endif
631 #endif
632
633
634 #if @GNULIB_FSYNC@
635 /* Synchronize changes, including metadata, to a file.
636 Return 0 if successful, otherwise -1 and errno set.
637 See POSIX:2008 specification
638 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
639 # if !@HAVE_FSYNC@
640 _GL_FUNCDECL_SYS (fsync, int, (int fd));
641 # endif
642 _GL_CXXALIAS_SYS (fsync, int, (int fd));
643 _GL_CXXALIASWARN (fsync);
644 #elif defined GNULIB_POSIXCHECK
645 # undef fsync
646 # if HAVE_RAW_DECL_FSYNC
647 _GL_WARN_ON_USE (fsync, "fsync is unportable - "
648 "use gnulib module fsync for portability");
649 # endif
650 #endif
651
652
653 #if @GNULIB_FTRUNCATE@
654 /* Change the size of the file to which FD is opened to become equal to LENGTH.
655 Return 0 if successful, otherwise -1 and errno set.
656 See the POSIX:2008 specification
657 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
658 # if @REPLACE_FTRUNCATE@
659 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
660 # undef ftruncate
661 # define ftruncate rpl_ftruncate
662 # endif
663 _GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
664 _GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
665 # else
666 # if !@HAVE_FTRUNCATE@
667 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
668 # endif
669 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
670 # endif
671 _GL_CXXALIASWARN (ftruncate);
672 #elif defined GNULIB_POSIXCHECK
673 # undef ftruncate
674 # if HAVE_RAW_DECL_FTRUNCATE
675 _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
676 "use gnulib module ftruncate for portability");
677 # endif
678 #endif
679
680
681 #if @GNULIB_GETCWD@
682 /* Get the name of the current working directory, and put it in SIZE bytes
683 of BUF.
684 Return BUF if successful, or NULL if the directory couldn't be determined
685 or SIZE was too small.
686 See the POSIX:2008 specification
687 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
688 Additionally, the gnulib module 'getcwd' guarantees the following GNU
689 extension: If BUF is NULL, an array is allocated with 'malloc'; the array
690 is SIZE bytes long, unless SIZE == 0, in which case it is as big as
691 necessary. */
692 # if @REPLACE_GETCWD@
693 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
694 # define getcwd rpl_getcwd
695 # endif
696 _GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size));
697 _GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
698 # else
699 /* Need to cast, because on mingw, the second parameter is
700 int size. */
701 _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
702 # endif
703 _GL_CXXALIASWARN (getcwd);
704 #elif defined GNULIB_POSIXCHECK
705 # undef getcwd
706 # if HAVE_RAW_DECL_GETCWD
707 _GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
708 "use gnulib module getcwd for portability");
709 # endif
710 #endif
711
712
713 #if @GNULIB_GETDOMAINNAME@
714 /* Return the NIS domain name of the machine.
715 WARNING! The NIS domain name is unrelated to the fully qualified host name
716 of the machine. It is also unrelated to email addresses.
717 WARNING! The NIS domain name is usually the empty string or "(none)" when
718 not using NIS.
719
720 Put up to LEN bytes of the NIS domain name into NAME.
721 Null terminate it if the name is shorter than LEN.
722 If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
723 Return 0 if successful, otherwise set errno and return -1. */
724 # if @REPLACE_GETDOMAINNAME@
725 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
726 # undef getdomainname
727 # define getdomainname rpl_getdomainname
728 # endif
729 _GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len)
730 _GL_ARG_NONNULL ((1)));
731 _GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len));
732 # else
733 # if !@HAVE_DECL_GETDOMAINNAME@
734 _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len)
735 _GL_ARG_NONNULL ((1)));
736 # endif
737 _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len));
738 # endif
739 _GL_CXXALIASWARN (getdomainname);
740 #elif defined GNULIB_POSIXCHECK
741 # undef getdomainname
742 # if HAVE_RAW_DECL_GETDOMAINNAME
743 _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
744 "use gnulib module getdomainname for portability");
745 # endif
746 #endif
747
748
749 #if @GNULIB_GETDTABLESIZE@
750 /* Return the maximum number of file descriptors in the current process.
751 In POSIX, this is same as sysconf (_SC_OPEN_MAX). */
752 # if @REPLACE_GETDTABLESIZE@
753 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
754 # undef getdtablesize
755 # define getdtablesize rpl_getdtablesize
756 # endif
757 _GL_FUNCDECL_RPL (getdtablesize, int, (void));
758 _GL_CXXALIAS_RPL (getdtablesize, int, (void));
759 # else
760 # if !@HAVE_GETDTABLESIZE@
761 _GL_FUNCDECL_SYS (getdtablesize, int, (void));
762 # endif
763 /* Need to cast, because on AIX, the parameter list is
764 (...). */
765 _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
766 # endif
767 _GL_CXXALIASWARN (getdtablesize);
768 #elif defined GNULIB_POSIXCHECK
769 # undef getdtablesize
770 # if HAVE_RAW_DECL_GETDTABLESIZE
771 _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
772 "use gnulib module getdtablesize for portability");
773 # endif
774 #endif
775
776
777 #if @GNULIB_GETENTROPY@
778 /* Fill a buffer with random bytes. */
779 # if !@HAVE_GETENTROPY@
780 _GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length));
781 # endif
782 _GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length));
783 _GL_CXXALIASWARN (getentropy);
784 #elif defined GNULIB_POSIXCHECK
785 # undef getentropy
786 # if HAVE_RAW_DECL_GETENTROPY
787 _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
788 "use gnulib module getentropy for portability");
789 # endif
790 #endif
791
792
793 #if @GNULIB_GETGROUPS@
794 /* Return the supplemental groups that the current process belongs to.
795 It is unspecified whether the effective group id is in the list.
796 If N is 0, return the group count; otherwise, N describes how many
797 entries are available in GROUPS. Return -1 and set errno if N is
798 not 0 and not large enough. Fails with ENOSYS on some systems. */
799 # if @REPLACE_GETGROUPS@
800 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
801 # undef getgroups
802 # define getgroups rpl_getgroups
803 # endif
804 _GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups));
805 _GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups));
806 # else
807 # if !@HAVE_GETGROUPS@
808 _GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups));
809 # endif
810 _GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups));
811 # endif
812 _GL_CXXALIASWARN (getgroups);
813 #elif defined GNULIB_POSIXCHECK
814 # undef getgroups
815 # if HAVE_RAW_DECL_GETGROUPS
816 _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
817 "use gnulib module getgroups for portability");
818 # endif
819 #endif
820
821
822 #if @GNULIB_GETHOSTNAME@
823 /* Return the standard host name of the machine.
824 WARNING! The host name may or may not be fully qualified.
825
826 Put up to LEN bytes of the host name into NAME.
827 Null terminate it if the name is shorter than LEN.
828 If the host name is longer than LEN, set errno = EINVAL and return -1.
829 Return 0 if successful, otherwise set errno and return -1. */
830 # if @UNISTD_H_HAVE_WINSOCK2_H@
831 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
832 # undef gethostname
833 # define gethostname rpl_gethostname
834 # endif
835 _GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
836 _GL_ARG_NONNULL ((1)));
837 _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
838 # else
839 # if !@HAVE_GETHOSTNAME@
840 _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
841 _GL_ARG_NONNULL ((1)));
842 # endif
843 /* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
844 parameter is
845 int len. */
846 _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
847 # endif
848 _GL_CXXALIASWARN (gethostname);
849 #elif @UNISTD_H_HAVE_WINSOCK2_H@
850 # undef gethostname
851 # define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
852 #elif defined GNULIB_POSIXCHECK
853 # undef gethostname
854 # if HAVE_RAW_DECL_GETHOSTNAME
855 _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
856 "use gnulib module gethostname for portability");
857 # endif
858 #endif
859
860
861 #if @GNULIB_GETLOGIN@
862 /* Returns the user's login name, or NULL if it cannot be found. Upon error,
863 returns NULL with errno set.
864
865 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
866
867 Most programs don't need to use this function, because the information is
868 available through environment variables:
869 ${LOGNAME-$USER} on Unix platforms,
870 $USERNAME on native Windows platforms.
871 */
872 # if !@HAVE_DECL_GETLOGIN@
873 _GL_FUNCDECL_SYS (getlogin, char *, (void));
874 # endif
875 _GL_CXXALIAS_SYS (getlogin, char *, (void));
876 _GL_CXXALIASWARN (getlogin);
877 #elif defined GNULIB_POSIXCHECK
878 # undef getlogin
879 # if HAVE_RAW_DECL_GETLOGIN
880 _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
881 "use gnulib module getlogin for portability");
882 # endif
883 #endif
884
885
886 #if @GNULIB_GETLOGIN_R@
887 /* Copies the user's login name to NAME.
888 The array pointed to by NAME has room for SIZE bytes.
889
890 Returns 0 if successful. Upon error, an error number is returned, or -1 in
891 the case that the login name cannot be found but no specific error is
892 provided (this case is hopefully rare but is left open by the POSIX spec).
893
894 See <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html>.
895
896 Most programs don't need to use this function, because the information is
897 available through environment variables:
898 ${LOGNAME-$USER} on Unix platforms,
899 $USERNAME on native Windows platforms.
900 */
901 # if @REPLACE_GETLOGIN_R@
902 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
903 # define getlogin_r rpl_getlogin_r
904 # endif
905 _GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size)
906 _GL_ARG_NONNULL ((1)));
907 _GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
908 # else
909 # if !@HAVE_DECL_GETLOGIN_R@
910 _GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size)
911 _GL_ARG_NONNULL ((1)));
912 # endif
913 /* Need to cast, because on Solaris 10 systems, the second argument is
914 int size. */
915 _GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
916 # endif
917 _GL_CXXALIASWARN (getlogin_r);
918 #elif defined GNULIB_POSIXCHECK
919 # undef getlogin_r
920 # if HAVE_RAW_DECL_GETLOGIN_R
921 _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
922 "use gnulib module getlogin_r for portability");
923 # endif
924 #endif
925
926
927 #if @GNULIB_GETPAGESIZE@
928 # if @REPLACE_GETPAGESIZE@
929 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
930 # define getpagesize rpl_getpagesize
931 # endif
932 _GL_FUNCDECL_RPL (getpagesize, int, (void));
933 _GL_CXXALIAS_RPL (getpagesize, int, (void));
934 # else
935 /* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
936 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
937 # if defined __hpux
938 _GL_FUNCDECL_SYS (getpagesize, int, (void));
939 # endif
940 # if !@HAVE_GETPAGESIZE@
941 # if !defined getpagesize
942 /* This is for POSIX systems. */
943 # if !defined _gl_getpagesize && defined _SC_PAGESIZE
944 # if ! (defined __VMS && __VMS_VER < 70000000)
945 # define _gl_getpagesize() sysconf (_SC_PAGESIZE)
946 # endif
947 # endif
948 /* This is for older VMS. */
949 # if !defined _gl_getpagesize && defined __VMS
950 # ifdef __ALPHA
951 # define _gl_getpagesize() 8192
952 # else
953 # define _gl_getpagesize() 512
954 # endif
955 # endif
956 /* This is for BeOS. */
957 # if !defined _gl_getpagesize && @HAVE_OS_H@
958 # include <OS.h>
959 # if defined B_PAGE_SIZE
960 # define _gl_getpagesize() B_PAGE_SIZE
961 # endif
962 # endif
963 /* This is for AmigaOS4.0. */
964 # if !defined _gl_getpagesize && defined __amigaos4__
965 # define _gl_getpagesize() 2048
966 # endif
967 /* This is for older Unix systems. */
968 # if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@
969 # include <sys/param.h>
970 # ifdef EXEC_PAGESIZE
971 # define _gl_getpagesize() EXEC_PAGESIZE
972 # else
973 # ifdef NBPG
974 # ifndef CLSIZE
975 # define CLSIZE 1
976 # endif
977 # define _gl_getpagesize() (NBPG * CLSIZE)
978 # else
979 # ifdef NBPC
980 # define _gl_getpagesize() NBPC
981 # endif
982 # endif
983 # endif
984 # endif
985 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
986 # define getpagesize() _gl_getpagesize ()
987 # else
988 # if !GNULIB_defined_getpagesize_function
989 _GL_UNISTD_INLINE int
990 getpagesize ()
991 {
992 return _gl_getpagesize ();
993 }
994 # define GNULIB_defined_getpagesize_function 1
995 # endif
996 # endif
997 # endif
998 # endif
999 /* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */
1000 _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
1001 # endif
1002 # if @HAVE_DECL_GETPAGESIZE@
1003 _GL_CXXALIASWARN (getpagesize);
1004 # endif
1005 #elif defined GNULIB_POSIXCHECK
1006 # undef getpagesize
1007 # if HAVE_RAW_DECL_GETPAGESIZE
1008 _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1009 "use gnulib module getpagesize for portability");
1010 # endif
1011 #endif
1012
1013
1014 #if @GNULIB_GETPASS@
1015 /* Function getpass() from module 'getpass':
1016 Read a password from /dev/tty or stdin.
1017 Function getpass() from module 'getpass-gnu':
1018 Read a password of arbitrary length from /dev/tty or stdin. */
1019 # if @REPLACE_GETPASS@
1020 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1021 # undef getpass
1022 # define getpass rpl_getpass
1023 # endif
1024 _GL_FUNCDECL_RPL (getpass, char *, (const char *prompt)
1025 _GL_ARG_NONNULL ((1)));
1026 _GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
1027 # else
1028 # if !@HAVE_GETPASS@
1029 _GL_FUNCDECL_SYS (getpass, char *, (const char *prompt)
1030 _GL_ARG_NONNULL ((1)));
1031 # endif
1032 _GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
1033 # endif
1034 _GL_CXXALIASWARN (getpass);
1035 #elif defined GNULIB_POSIXCHECK
1036 # undef getpass
1037 # if HAVE_RAW_DECL_GETPASS
1038 _GL_WARN_ON_USE (getpass, "getpass is unportable - "
1039 "use gnulib module getpass or getpass-gnu for portability");
1040 # endif
1041 #endif
1042
1043
1044 #if @GNULIB_GETUSERSHELL@
1045 /* Return the next valid login shell on the system, or NULL when the end of
1046 the list has been reached. */
1047 # if !@HAVE_DECL_GETUSERSHELL@
1048 _GL_FUNCDECL_SYS (getusershell, char *, (void));
1049 # endif
1050 _GL_CXXALIAS_SYS (getusershell, char *, (void));
1051 _GL_CXXALIASWARN (getusershell);
1052 #elif defined GNULIB_POSIXCHECK
1053 # undef getusershell
1054 # if HAVE_RAW_DECL_GETUSERSHELL
1055 _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
1056 "use gnulib module getusershell for portability");
1057 # endif
1058 #endif
1059
1060 #if @GNULIB_GETUSERSHELL@
1061 /* Rewind to pointer that is advanced at each getusershell() call. */
1062 # if !@HAVE_DECL_GETUSERSHELL@
1063 _GL_FUNCDECL_SYS (setusershell, void, (void));
1064 # endif
1065 _GL_CXXALIAS_SYS (setusershell, void, (void));
1066 _GL_CXXALIASWARN (setusershell);
1067 #elif defined GNULIB_POSIXCHECK
1068 # undef setusershell
1069 # if HAVE_RAW_DECL_SETUSERSHELL
1070 _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
1071 "use gnulib module getusershell for portability");
1072 # endif
1073 #endif
1074
1075 #if @GNULIB_GETUSERSHELL@
1076 /* Free the pointer that is advanced at each getusershell() call and
1077 associated resources. */
1078 # if !@HAVE_DECL_GETUSERSHELL@
1079 _GL_FUNCDECL_SYS (endusershell, void, (void));
1080 # endif
1081 _GL_CXXALIAS_SYS (endusershell, void, (void));
1082 _GL_CXXALIASWARN (endusershell);
1083 #elif defined GNULIB_POSIXCHECK
1084 # undef endusershell
1085 # if HAVE_RAW_DECL_ENDUSERSHELL
1086 _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
1087 "use gnulib module getusershell for portability");
1088 # endif
1089 #endif
1090
1091
1092 #if @GNULIB_GROUP_MEMBER@
1093 /* Determine whether group id is in calling user's group list. */
1094 # if !@HAVE_GROUP_MEMBER@
1095 _GL_FUNCDECL_SYS (group_member, int, (gid_t gid));
1096 # endif
1097 _GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
1098 _GL_CXXALIASWARN (group_member);
1099 #elif defined GNULIB_POSIXCHECK
1100 # undef group_member
1101 # if HAVE_RAW_DECL_GROUP_MEMBER
1102 _GL_WARN_ON_USE (group_member, "group_member is unportable - "
1103 "use gnulib module group-member for portability");
1104 # endif
1105 #endif
1106
1107
1108 #if @GNULIB_ISATTY@
1109 # if @REPLACE_ISATTY@
1110 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1111 # undef isatty
1112 # define isatty rpl_isatty
1113 # endif
1114 _GL_FUNCDECL_RPL (isatty, int, (int fd));
1115 _GL_CXXALIAS_RPL (isatty, int, (int fd));
1116 # else
1117 _GL_CXXALIAS_SYS (isatty, int, (int fd));
1118 # endif
1119 _GL_CXXALIASWARN (isatty);
1120 #elif defined GNULIB_POSIXCHECK
1121 # undef isatty
1122 # if HAVE_RAW_DECL_ISATTY
1123 _GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
1124 "use gnulib module isatty for portability");
1125 # endif
1126 #endif
1127
1128
1129 #if @GNULIB_LCHOWN@
1130 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
1131 to GID (if GID is not -1). Do not follow symbolic links.
1132 Return 0 if successful, otherwise -1 and errno set.
1133 See the POSIX:2008 specification
1134 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html>. */
1135 # if @REPLACE_LCHOWN@
1136 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1137 # undef lchown
1138 # define lchown rpl_lchown
1139 # endif
1140 _GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)
1141 _GL_ARG_NONNULL ((1)));
1142 _GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
1143 # else
1144 # if !@HAVE_LCHOWN@
1145 _GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)
1146 _GL_ARG_NONNULL ((1)));
1147 # endif
1148 _GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
1149 # endif
1150 _GL_CXXALIASWARN (lchown);
1151 #elif defined GNULIB_POSIXCHECK
1152 # undef lchown
1153 # if HAVE_RAW_DECL_LCHOWN
1154 _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1155 "use gnulib module lchown for portability");
1156 # endif
1157 #endif
1158
1159
1160 #if @GNULIB_LINK@
1161 /* Create a new hard link for an existing file.
1162 Return 0 if successful, otherwise -1 and errno set.
1163 See POSIX:2008 specification
1164 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html>. */
1165 # if @REPLACE_LINK@
1166 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1167 # define link rpl_link
1168 # endif
1169 _GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2)
1170 _GL_ARG_NONNULL ((1, 2)));
1171 _GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1172 # else
1173 # if !@HAVE_LINK@
1174 _GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2)
1175 _GL_ARG_NONNULL ((1, 2)));
1176 # endif
1177 _GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1178 # endif
1179 _GL_CXXALIASWARN (link);
1180 #elif defined GNULIB_POSIXCHECK
1181 # undef link
1182 # if HAVE_RAW_DECL_LINK
1183 _GL_WARN_ON_USE (link, "link is unportable - "
1184 "use gnulib module link for portability");
1185 # endif
1186 #endif
1187
1188
1189 #if @GNULIB_LINKAT@
1190 /* Create a new hard link for an existing file, relative to two
1191 directories. FLAG controls whether symlinks are followed.
1192 Return 0 if successful, otherwise -1 and errno set. */
1193 # if @REPLACE_LINKAT@
1194 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1195 # undef linkat
1196 # define linkat rpl_linkat
1197 # endif
1198 _GL_FUNCDECL_RPL (linkat, int,
1199 (int fd1, const char *path1, int fd2, const char *path2,
1200 int flag)
1201 _GL_ARG_NONNULL ((2, 4)));
1202 _GL_CXXALIAS_RPL (linkat, int,
1203 (int fd1, const char *path1, int fd2, const char *path2,
1204 int flag));
1205 # else
1206 # if !@HAVE_LINKAT@
1207 _GL_FUNCDECL_SYS (linkat, int,
1208 (int fd1, const char *path1, int fd2, const char *path2,
1209 int flag)
1210 _GL_ARG_NONNULL ((2, 4)));
1211 # endif
1212 _GL_CXXALIAS_SYS (linkat, int,
1213 (int fd1, const char *path1, int fd2, const char *path2,
1214 int flag));
1215 # endif
1216 _GL_CXXALIASWARN (linkat);
1217 #elif defined GNULIB_POSIXCHECK
1218 # undef linkat
1219 # if HAVE_RAW_DECL_LINKAT
1220 _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1221 "use gnulib module linkat for portability");
1222 # endif
1223 #endif
1224
1225
1226 #if @GNULIB_LSEEK@
1227 /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
1228 Return the new offset if successful, otherwise -1 and errno set.
1229 See the POSIX:2008 specification
1230 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html>. */
1231 # if @REPLACE_LSEEK@
1232 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1233 # define lseek rpl_lseek
1234 # endif
1235 _GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1236 _GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1237 # else
1238 _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1239 # endif
1240 _GL_CXXALIASWARN (lseek);
1241 #elif defined GNULIB_POSIXCHECK
1242 # undef lseek
1243 # if HAVE_RAW_DECL_LSEEK
1244 _GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1245 "systems - use gnulib module lseek for portability");
1246 # endif
1247 #endif
1248
1249
1250 #if @GNULIB_PIPE@
1251 /* Create a pipe, defaulting to O_BINARY mode.
1252 Store the read-end as fd[0] and the write-end as fd[1].
1253 Return 0 upon success, or -1 with errno set upon failure. */
1254 # if !@HAVE_PIPE@
1255 _GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1)));
1256 # endif
1257 _GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1258 _GL_CXXALIASWARN (pipe);
1259 #elif defined GNULIB_POSIXCHECK
1260 # undef pipe
1261 # if HAVE_RAW_DECL_PIPE
1262 _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1263 "use gnulib module pipe-posix for portability");
1264 # endif
1265 #endif
1266
1267
1268 #if @GNULIB_PIPE2@
1269 /* Create a pipe, applying the given flags when opening the read-end of the
1270 pipe and the write-end of the pipe.
1271 The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
1272 and O_TEXT, O_BINARY (defined in "binary-io.h").
1273 Store the read-end as fd[0] and the write-end as fd[1].
1274 Return 0 upon success, or -1 with errno set upon failure.
1275 See also the Linux man page at
1276 <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
1277 # if @HAVE_PIPE2@
1278 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1279 # define pipe2 rpl_pipe2
1280 # endif
1281 _GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1282 _GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1283 # else
1284 _GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1)));
1285 _GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1286 # endif
1287 _GL_CXXALIASWARN (pipe2);
1288 #elif defined GNULIB_POSIXCHECK
1289 # undef pipe2
1290 # if HAVE_RAW_DECL_PIPE2
1291 _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1292 "use gnulib module pipe2 for portability");
1293 # endif
1294 #endif
1295
1296
1297 #if @GNULIB_PREAD@
1298 /* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET.
1299 Return the number of bytes placed into BUF if successful, otherwise
1300 set errno and return -1. 0 indicates EOF.
1301 See the POSIX:2008 specification
1302 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html>. */
1303 # if @REPLACE_PREAD@
1304 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1305 # undef pread
1306 # define pread rpl_pread
1307 # endif
1308 _GL_FUNCDECL_RPL (pread, ssize_t,
1309 (int fd, void *buf, size_t bufsize, off_t offset)
1310 _GL_ARG_NONNULL ((2)));
1311 _GL_CXXALIAS_RPL (pread, ssize_t,
1312 (int fd, void *buf, size_t bufsize, off_t offset));
1313 # else
1314 # if !@HAVE_PREAD@
1315 _GL_FUNCDECL_SYS (pread, ssize_t,
1316 (int fd, void *buf, size_t bufsize, off_t offset)
1317 _GL_ARG_NONNULL ((2)));
1318 # endif
1319 _GL_CXXALIAS_SYS (pread, ssize_t,
1320 (int fd, void *buf, size_t bufsize, off_t offset));
1321 # endif
1322 _GL_CXXALIASWARN (pread);
1323 #elif defined GNULIB_POSIXCHECK
1324 # undef pread
1325 # if HAVE_RAW_DECL_PREAD
1326 _GL_WARN_ON_USE (pread, "pread is unportable - "
1327 "use gnulib module pread for portability");
1328 # endif
1329 #endif
1330
1331
1332 #if @GNULIB_PWRITE@
1333 /* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET.
1334 Return the number of bytes written if successful, otherwise
1335 set errno and return -1. 0 indicates nothing written. See the
1336 POSIX:2008 specification
1337 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html>. */
1338 # if @REPLACE_PWRITE@
1339 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1340 # undef pwrite
1341 # define pwrite rpl_pwrite
1342 # endif
1343 _GL_FUNCDECL_RPL (pwrite, ssize_t,
1344 (int fd, const void *buf, size_t bufsize, off_t offset)
1345 _GL_ARG_NONNULL ((2)));
1346 _GL_CXXALIAS_RPL (pwrite, ssize_t,
1347 (int fd, const void *buf, size_t bufsize, off_t offset));
1348 # else
1349 # if !@HAVE_PWRITE@
1350 _GL_FUNCDECL_SYS (pwrite, ssize_t,
1351 (int fd, const void *buf, size_t bufsize, off_t offset)
1352 _GL_ARG_NONNULL ((2)));
1353 # endif
1354 _GL_CXXALIAS_SYS (pwrite, ssize_t,
1355 (int fd, const void *buf, size_t bufsize, off_t offset));
1356 # endif
1357 _GL_CXXALIASWARN (pwrite);
1358 #elif defined GNULIB_POSIXCHECK
1359 # undef pwrite
1360 # if HAVE_RAW_DECL_PWRITE
1361 _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1362 "use gnulib module pwrite for portability");
1363 # endif
1364 #endif
1365
1366
1367 #if @GNULIB_READ@
1368 /* Read up to COUNT bytes from file descriptor FD into the buffer starting
1369 at BUF. See the POSIX:2008 specification
1370 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html>. */
1371 # if @REPLACE_READ@
1372 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1373 # undef read
1374 # define read rpl_read
1375 # endif
1376 _GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count)
1377 _GL_ARG_NONNULL ((2)));
1378 _GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1379 # else
1380 /* Need to cast, because on mingw, the third parameter is
1381 unsigned int count
1382 and the return type is 'int'. */
1383 _GL_CXXALIAS_SYS_CAST (read, ssize_t, (int fd, void *buf, size_t count));
1384 # endif
1385 _GL_CXXALIASWARN (read);
1386 #endif
1387
1388
1389 #if @GNULIB_READLINK@
1390 /* Read the contents of the symbolic link FILE and place the first BUFSIZE
1391 bytes of it into BUF. Return the number of bytes placed into BUF if
1392 successful, otherwise -1 and errno set.
1393 See the POSIX:2008 specification
1394 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>. */
1395 # if @REPLACE_READLINK@
1396 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1397 # define readlink rpl_readlink
1398 # endif
1399 _GL_FUNCDECL_RPL (readlink, ssize_t,
1400 (const char *restrict file,
1401 char *restrict buf, size_t bufsize)
1402 _GL_ARG_NONNULL ((1, 2)));
1403 _GL_CXXALIAS_RPL (readlink, ssize_t,
1404 (const char *restrict file,
1405 char *restrict buf, size_t bufsize));
1406 # else
1407 # if !@HAVE_READLINK@
1408 _GL_FUNCDECL_SYS (readlink, ssize_t,
1409 (const char *restrict file,
1410 char *restrict buf, size_t bufsize)
1411 _GL_ARG_NONNULL ((1, 2)));
1412 # endif
1413 _GL_CXXALIAS_SYS (readlink, ssize_t,
1414 (const char *restrict file,
1415 char *restrict buf, size_t bufsize));
1416 # endif
1417 _GL_CXXALIASWARN (readlink);
1418 #elif defined GNULIB_POSIXCHECK
1419 # undef readlink
1420 # if HAVE_RAW_DECL_READLINK
1421 _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1422 "use gnulib module readlink for portability");
1423 # endif
1424 #endif
1425
1426
1427 #if @GNULIB_READLINKAT@
1428 # if @REPLACE_READLINKAT@
1429 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1430 # define readlinkat rpl_readlinkat
1431 # endif
1432 _GL_FUNCDECL_RPL (readlinkat, ssize_t,
1433 (int fd, char const *restrict file,
1434 char *restrict buf, size_t len)
1435 _GL_ARG_NONNULL ((2, 3)));
1436 _GL_CXXALIAS_RPL (readlinkat, ssize_t,
1437 (int fd, char const *restrict file,
1438 char *restrict buf, size_t len));
1439 # else
1440 # if !@HAVE_READLINKAT@
1441 _GL_FUNCDECL_SYS (readlinkat, ssize_t,
1442 (int fd, char const *restrict file,
1443 char *restrict buf, size_t len)
1444 _GL_ARG_NONNULL ((2, 3)));
1445 # endif
1446 _GL_CXXALIAS_SYS (readlinkat, ssize_t,
1447 (int fd, char const *restrict file,
1448 char *restrict buf, size_t len));
1449 # endif
1450 _GL_CXXALIASWARN (readlinkat);
1451 #elif defined GNULIB_POSIXCHECK
1452 # undef readlinkat
1453 # if HAVE_RAW_DECL_READLINKAT
1454 _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1455 "use gnulib module readlinkat for portability");
1456 # endif
1457 #endif
1458
1459
1460 #if @GNULIB_RMDIR@
1461 /* Remove the directory DIR. */
1462 # if @REPLACE_RMDIR@
1463 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1464 # define rmdir rpl_rmdir
1465 # endif
1466 _GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1)));
1467 _GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1468 # else
1469 _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1470 # endif
1471 _GL_CXXALIASWARN (rmdir);
1472 #elif defined GNULIB_POSIXCHECK
1473 # undef rmdir
1474 # if HAVE_RAW_DECL_RMDIR
1475 _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1476 "use gnulib module rmdir for portability");
1477 # endif
1478 #endif
1479
1480
1481 #if @GNULIB_SETHOSTNAME@
1482 /* Set the host name of the machine.
1483 The host name may or may not be fully qualified.
1484
1485 Put LEN bytes of NAME into the host name.
1486 Return 0 if successful, otherwise, set errno and return -1.
1487
1488 Platforms with no ability to set the hostname return -1 and set
1489 errno = ENOSYS. */
1490 # if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
1491 _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
1492 _GL_ARG_NONNULL ((1)));
1493 # endif
1494 /* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
1495 and FreeBSD 6.4 the second parameter is int. On Solaris 11
1496 2011-10, the first parameter is not const. */
1497 _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
1498 _GL_CXXALIASWARN (sethostname);
1499 #elif defined GNULIB_POSIXCHECK
1500 # undef sethostname
1501 # if HAVE_RAW_DECL_SETHOSTNAME
1502 _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
1503 "use gnulib module sethostname for portability");
1504 # endif
1505 #endif
1506
1507
1508 #if @GNULIB_SLEEP@
1509 /* Pause the execution of the current thread for N seconds.
1510 Returns the number of seconds left to sleep.
1511 See the POSIX:2008 specification
1512 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/sleep.html>. */
1513 # if @REPLACE_SLEEP@
1514 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1515 # undef sleep
1516 # define sleep rpl_sleep
1517 # endif
1518 _GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n));
1519 _GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
1520 # else
1521 # if !@HAVE_SLEEP@
1522 _GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n));
1523 # endif
1524 _GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
1525 # endif
1526 _GL_CXXALIASWARN (sleep);
1527 #elif defined GNULIB_POSIXCHECK
1528 # undef sleep
1529 # if HAVE_RAW_DECL_SLEEP
1530 _GL_WARN_ON_USE (sleep, "sleep is unportable - "
1531 "use gnulib module sleep for portability");
1532 # endif
1533 #endif
1534
1535
1536 #if @GNULIB_SYMLINK@
1537 # if @REPLACE_SYMLINK@
1538 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1539 # undef symlink
1540 # define symlink rpl_symlink
1541 # endif
1542 _GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file)
1543 _GL_ARG_NONNULL ((1, 2)));
1544 _GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file));
1545 # else
1546 # if !@HAVE_SYMLINK@
1547 _GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file)
1548 _GL_ARG_NONNULL ((1, 2)));
1549 # endif
1550 _GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file));
1551 # endif
1552 _GL_CXXALIASWARN (symlink);
1553 #elif defined GNULIB_POSIXCHECK
1554 # undef symlink
1555 # if HAVE_RAW_DECL_SYMLINK
1556 _GL_WARN_ON_USE (symlink, "symlink is not portable - "
1557 "use gnulib module symlink for portability");
1558 # endif
1559 #endif
1560
1561
1562 #if @GNULIB_SYMLINKAT@
1563 # if @REPLACE_SYMLINKAT@
1564 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1565 # undef symlinkat
1566 # define symlinkat rpl_symlinkat
1567 # endif
1568 _GL_FUNCDECL_RPL (symlinkat, int,
1569 (char const *contents, int fd, char const *file)
1570 _GL_ARG_NONNULL ((1, 3)));
1571 _GL_CXXALIAS_RPL (symlinkat, int,
1572 (char const *contents, int fd, char const *file));
1573 # else
1574 # if !@HAVE_SYMLINKAT@
1575 _GL_FUNCDECL_SYS (symlinkat, int,
1576 (char const *contents, int fd, char const *file)
1577 _GL_ARG_NONNULL ((1, 3)));
1578 # endif
1579 _GL_CXXALIAS_SYS (symlinkat, int,
1580 (char const *contents, int fd, char const *file));
1581 # endif
1582 _GL_CXXALIASWARN (symlinkat);
1583 #elif defined GNULIB_POSIXCHECK
1584 # undef symlinkat
1585 # if HAVE_RAW_DECL_SYMLINKAT
1586 _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
1587 "use gnulib module symlinkat for portability");
1588 # endif
1589 #endif
1590
1591
1592 #if @GNULIB_TRUNCATE@
1593 /* Change the size of the file designated by FILENAME to become equal to LENGTH.
1594 Return 0 if successful, otherwise -1 and errno set.
1595 See the POSIX:2008 specification
1596 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html>. */
1597 # if @REPLACE_TRUNCATE@
1598 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1599 # undef truncate
1600 # define truncate rpl_truncate
1601 # endif
1602 _GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length)
1603 _GL_ARG_NONNULL ((1)));
1604 _GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
1605 # else
1606 # if !@HAVE_DECL_TRUNCATE@
1607 _GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length)
1608 _GL_ARG_NONNULL ((1)));
1609 # endif
1610 _GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
1611 # endif
1612 _GL_CXXALIASWARN (truncate);
1613 #elif defined GNULIB_POSIXCHECK
1614 # undef truncate
1615 # if HAVE_RAW_DECL_TRUNCATE
1616 _GL_WARN_ON_USE (truncate, "truncate is unportable - "
1617 "use gnulib module truncate for portability");
1618 # endif
1619 #endif
1620
1621
1622 #if @GNULIB_TTYNAME_R@
1623 /* Store at most BUFLEN characters of the pathname of the terminal FD is
1624 open on in BUF. Return 0 on success, otherwise an error number. */
1625 # if @REPLACE_TTYNAME_R@
1626 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1627 # undef ttyname_r
1628 # define ttyname_r rpl_ttyname_r
1629 # endif
1630 _GL_FUNCDECL_RPL (ttyname_r, int,
1631 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1632 _GL_CXXALIAS_RPL (ttyname_r, int,
1633 (int fd, char *buf, size_t buflen));
1634 # else
1635 # if !@HAVE_DECL_TTYNAME_R@
1636 _GL_FUNCDECL_SYS (ttyname_r, int,
1637 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2)));
1638 # endif
1639 _GL_CXXALIAS_SYS (ttyname_r, int,
1640 (int fd, char *buf, size_t buflen));
1641 # endif
1642 _GL_CXXALIASWARN (ttyname_r);
1643 #elif defined GNULIB_POSIXCHECK
1644 # undef ttyname_r
1645 # if HAVE_RAW_DECL_TTYNAME_R
1646 _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
1647 "use gnulib module ttyname_r for portability");
1648 # endif
1649 #endif
1650
1651
1652 #if @GNULIB_UNLINK@
1653 # if @REPLACE_UNLINK@
1654 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1655 # undef unlink
1656 # define unlink rpl_unlink
1657 # endif
1658 _GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1)));
1659 _GL_CXXALIAS_RPL (unlink, int, (char const *file));
1660 # else
1661 _GL_CXXALIAS_SYS (unlink, int, (char const *file));
1662 # endif
1663 _GL_CXXALIASWARN (unlink);
1664 #elif defined GNULIB_POSIXCHECK
1665 # undef unlink
1666 # if HAVE_RAW_DECL_UNLINK
1667 _GL_WARN_ON_USE (unlink, "unlink is not portable - "
1668 "use gnulib module unlink for portability");
1669 # endif
1670 #endif
1671
1672
1673 #if @GNULIB_UNLINKAT@
1674 # if @REPLACE_UNLINKAT@
1675 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1676 # undef unlinkat
1677 # define unlinkat rpl_unlinkat
1678 # endif
1679 _GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag)
1680 _GL_ARG_NONNULL ((2)));
1681 _GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
1682 # else
1683 # if !@HAVE_UNLINKAT@
1684 _GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag)
1685 _GL_ARG_NONNULL ((2)));
1686 # endif
1687 _GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
1688 # endif
1689 _GL_CXXALIASWARN (unlinkat);
1690 #elif defined GNULIB_POSIXCHECK
1691 # undef unlinkat
1692 # if HAVE_RAW_DECL_UNLINKAT
1693 _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
1694 "use gnulib module openat for portability");
1695 # endif
1696 #endif
1697
1698
1699 #if @GNULIB_USLEEP@
1700 /* Pause the execution of the current thread for N microseconds.
1701 Returns 0 on completion, or -1 on range error.
1702 See the POSIX:2001 specification
1703 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
1704 # if @REPLACE_USLEEP@
1705 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1706 # undef usleep
1707 # define usleep rpl_usleep
1708 # endif
1709 _GL_FUNCDECL_RPL (usleep, int, (useconds_t n));
1710 _GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
1711 # else
1712 # if !@HAVE_USLEEP@
1713 _GL_FUNCDECL_SYS (usleep, int, (useconds_t n));
1714 # endif
1715 /* Need to cast, because on Haiku, the first parameter is
1716 unsigned int n. */
1717 _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n));
1718 # endif
1719 _GL_CXXALIASWARN (usleep);
1720 #elif defined GNULIB_POSIXCHECK
1721 # undef usleep
1722 # if HAVE_RAW_DECL_USLEEP
1723 _GL_WARN_ON_USE (usleep, "usleep is unportable - "
1724 "use gnulib module usleep for portability");
1725 # endif
1726 #endif
1727
1728
1729 #if @GNULIB_WRITE@
1730 /* Write up to COUNT bytes starting at BUF to file descriptor FD.
1731 See the POSIX:2008 specification
1732 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html>. */
1733 # if @REPLACE_WRITE@
1734 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1735 # undef write
1736 # define write rpl_write
1737 # endif
1738 _GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count)
1739 _GL_ARG_NONNULL ((2)));
1740 _GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count));
1741 # else
1742 /* Need to cast, because on mingw, the third parameter is
1743 unsigned int count
1744 and the return type is 'int'. */
1745 _GL_CXXALIAS_SYS_CAST (write, ssize_t, (int fd, const void *buf, size_t count));
1746 # endif
1747 _GL_CXXALIASWARN (write);
1748 #endif
1749
1750 _GL_INLINE_HEADER_END
1751
1752 #endif /* _@GUARD_PREFIX@_UNISTD_H */
1753 #endif /* _GL_INCLUDING_UNISTD_H */
1754 #endif /* _@GUARD_PREFIX@_UNISTD_H */