summaryrefslogtreecommitdiffstats
path: root/gl/unistd.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/unistd.in.h')
-rw-r--r--gl/unistd.in.h642
1 files changed, 380 insertions, 262 deletions
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 4812fdb1..f7e4450c 100644
--- a/gl/unistd.in.h
+++ b/gl/unistd.in.h
@@ -1,5 +1,5 @@
1/* Substitute for and wrapper around <unistd.h>. 1/* Substitute for and wrapper around <unistd.h>.
2 Copyright (C) 2003-2023 Free Software Foundation, Inc. 2 Copyright (C) 2003-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 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 5 it under the terms of the GNU Lesser General Public License as
@@ -40,6 +40,24 @@
40# undef _GL_INCLUDING_UNISTD_H 40# undef _GL_INCLUDING_UNISTD_H
41#endif 41#endif
42 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
43/* Get all possible declarations of gethostname(). */ 61/* Get all possible declarations of gethostname(). */
44#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ 62#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \
45 && !defined _GL_INCLUDING_WINSOCK2_H 63 && !defined _GL_INCLUDING_WINSOCK2_H
@@ -51,6 +69,12 @@
51#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H 69#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
52#define _@GUARD_PREFIX@_UNISTD_H 70#define _@GUARD_PREFIX@_UNISTD_H
53 71
72/* This file uses _GL_ATTRIBUTE_NODISCARD, _GL_INLINE_HEADER_BEGIN, _GL_INLINE,
73 GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
74#if !_GL_CONFIG_H_INCLUDED
75 #error "Please include config.h first."
76#endif
77
54/* NetBSD 5.0 mis-defines NULL. Also get size_t. */ 78/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
55/* But avoid namespace pollution on glibc systems. */ 79/* But avoid namespace pollution on glibc systems. */
56#ifndef __GLIBC__ 80#ifndef __GLIBC__
@@ -71,12 +95,21 @@
71# include <stdio.h> 95# include <stdio.h>
72#endif 96#endif
73 97
98/* Native Windows platforms declare _chdir, _getcwd, _rmdir in
99 <io.h> and/or <direct.h>, not in <unistd.h>.
100 They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
101 _lseek(), _read(), _unlink(), _write() in <io.h>. */
102#if defined _WIN32 && !defined __CYGWIN__
103# include <io.h>
104# include <direct.h>
105#endif
106
74/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in 107/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
75 <unistd.h>. */ 108 <unistd.h>. */
76/* But avoid namespace pollution on glibc systems. */ 109/* But avoid namespace pollution on glibc systems. */
77#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ 110#if ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
78 && (defined __CYGWIN__ || defined __ANDROID__) \ 111 && (defined __CYGWIN__ || defined __ANDROID__) \
79 && ! defined __GLIBC__ 112 && ! defined __GLIBC__)
80# include <fcntl.h> 113# include <fcntl.h>
81#endif 114#endif
82 115
@@ -84,33 +117,22 @@
84/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in 117/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
85 <unistd.h>. */ 118 <unistd.h>. */
86/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ 119/* 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. */ 120/* But avoid namespace pollution on glibc systems. */
90#if !defined __GLIBC__ && !defined __osf__ 121#if !defined __GLIBC__
91# define __need_system_stdlib_h 122# define __need_system_stdlib_h
92# include <stdlib.h> 123# include <stdlib.h>
93# undef __need_system_stdlib_h 124# undef __need_system_stdlib_h
94#endif 125#endif
95 126
96/* Native Windows platforms declare _chdir, _getcwd, _rmdir in
97 <io.h> and/or <direct.h>, not in <unistd.h>.
98 They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
99 _lseek(), _read(), _unlink(), _write() in <io.h>. */
100#if defined _WIN32 && !defined __CYGWIN__
101# include <io.h>
102# include <direct.h>
103#endif
104
105/* Native Windows platforms declare _execl*, _execv* in <process.h>. */ 127/* Native Windows platforms declare _execl*, _execv* in <process.h>. */
106#if defined _WIN32 && !defined __CYGWIN__ 128#if defined _WIN32 && !defined __CYGWIN__
107# include <process.h> 129# include <process.h>
108#endif 130#endif
109 131
110/* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>. 132/* AIX declares getdomainname in <netdb.h>, not in <unistd.h>.
111 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */ 133 NonStop Kernel declares gethostname in <netdb.h>, not in <unistd.h>. */
112/* But avoid namespace pollution on glibc systems. */ 134/* But avoid namespace pollution on glibc systems. */
113#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \ 135#if ((@GNULIB_GETDOMAINNAME@ && defined _AIX) \
114 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \ 136 || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \
115 && !defined __GLIBC__ 137 && !defined __GLIBC__
116# include <netdb.h> 138# include <netdb.h>
@@ -135,8 +157,9 @@
135#endif 157#endif
136 158
137/* MSVC defines off_t in <sys/types.h>. 159/* MSVC defines off_t in <sys/types.h>.
138 May also define off_t to a 64-bit type on native Windows. */ 160 May also define off_t to a 64-bit type on native Windows.
139/* Get off_t, ssize_t, mode_t. */ 161 Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */
162/* Get off_t, off64_t, ssize_t, mode_t. */
140#include <sys/types.h> 163#include <sys/types.h>
141 164
142/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 165/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -152,13 +175,13 @@
152# include <getopt-pfx-core.h> 175# include <getopt-pfx-core.h>
153#endif 176#endif
154 177
155#ifndef _GL_INLINE_HEADER_BEGIN
156 #error "Please include config.h first."
157#endif
158_GL_INLINE_HEADER_BEGIN 178_GL_INLINE_HEADER_BEGIN
159#ifndef _GL_UNISTD_INLINE 179#ifndef _GL_UNISTD_INLINE
160# define _GL_UNISTD_INLINE _GL_INLINE 180# define _GL_UNISTD_INLINE _GL_INLINE
161#endif 181#endif
182#ifndef _GL_GETPAGESIZE_INLINE
183# define _GL_GETPAGESIZE_INLINE _GL_INLINE
184#endif
162 185
163/* Hide some function declarations from <winsock2.h>. */ 186/* Hide some function declarations from <winsock2.h>. */
164 187
@@ -265,7 +288,7 @@ _GL_INLINE_HEADER_BEGIN
265# undef access 288# undef access
266# define access rpl_access 289# define access rpl_access
267# endif 290# endif
268_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) 291_GL_FUNCDECL_RPL (access, int, (const char *file, int mode),
269 _GL_ARG_NONNULL ((1))); 292 _GL_ARG_NONNULL ((1)));
270_GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); 293_GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
271# elif defined _WIN32 && !defined __CYGWIN__ 294# elif defined _WIN32 && !defined __CYGWIN__
@@ -279,7 +302,6 @@ _GL_CXXALIAS_SYS (access, int, (const char *file, int mode));
279# endif 302# endif
280_GL_CXXALIASWARN (access); 303_GL_CXXALIASWARN (access);
281#elif defined GNULIB_POSIXCHECK 304#elif defined GNULIB_POSIXCHECK
282# undef access
283# if HAVE_RAW_DECL_ACCESS 305# if HAVE_RAW_DECL_ACCESS
284/* The access() function is a security risk. */ 306/* The access() function is a security risk. */
285_GL_WARN_ON_USE (access, "access does not always support X_OK - " 307_GL_WARN_ON_USE (access, "access does not always support X_OK - "
@@ -316,9 +338,8 @@ _GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1)));
316# endif 338# endif
317_GL_CXXALIASWARN (chdir); 339_GL_CXXALIASWARN (chdir);
318#elif defined GNULIB_POSIXCHECK 340#elif defined GNULIB_POSIXCHECK
319# undef chdir
320# if HAVE_RAW_DECL_CHDIR 341# if HAVE_RAW_DECL_CHDIR
321_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " 342_GL_WARN_ON_USE (chdir, "chdir is not always in <unistd.h> - "
322 "use gnulib module chdir for portability"); 343 "use gnulib module chdir for portability");
323# endif 344# endif
324#elif @GNULIB_MDA_CHDIR@ 345#elif @GNULIB_MDA_CHDIR@
@@ -349,19 +370,18 @@ _GL_CXXALIASWARN (chdir);
349# undef chown 370# undef chown
350# define chown rpl_chown 371# define chown rpl_chown
351# endif 372# endif
352_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) 373_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid),
353 _GL_ARG_NONNULL ((1))); 374 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
354_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); 375_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
355# else 376# else
356# if !@HAVE_CHOWN@ 377# if !@HAVE_CHOWN@
357_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) 378_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid),
358 _GL_ARG_NONNULL ((1))); 379 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
359# endif 380# endif
360_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); 381_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
361# endif 382# endif
362_GL_CXXALIASWARN (chown); 383_GL_CXXALIASWARN (chown);
363#elif defined GNULIB_POSIXCHECK 384#elif defined GNULIB_POSIXCHECK
364# undef chown
365# if HAVE_RAW_DECL_CHOWN 385# if HAVE_RAW_DECL_CHOWN
366_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and " 386_GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
367 "doesn't treat a uid or gid of -1 on some systems - " 387 "doesn't treat a uid or gid of -1 on some systems - "
@@ -377,7 +397,7 @@ _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
377# undef close 397# undef close
378# define close rpl_close 398# define close rpl_close
379# endif 399# endif
380_GL_FUNCDECL_RPL (close, int, (int fd)); 400_GL_FUNCDECL_RPL (close, int, (int fd), );
381_GL_CXXALIAS_RPL (close, int, (int fd)); 401_GL_CXXALIAS_RPL (close, int, (int fd));
382# elif defined _WIN32 && !defined __CYGWIN__ 402# elif defined _WIN32 && !defined __CYGWIN__
383# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 403# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -390,10 +410,11 @@ _GL_CXXALIAS_SYS (close, int, (int fd));
390# endif 410# endif
391_GL_CXXALIASWARN (close); 411_GL_CXXALIASWARN (close);
392#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ 412#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
393# undef close 413# if !GNULIB_CLOSE
394# define close close_used_without_requesting_gnulib_module_close 414# undef close
415# define close close_used_without_requesting_gnulib_module_close
416# endif
395#elif defined GNULIB_POSIXCHECK 417#elif defined GNULIB_POSIXCHECK
396# undef close
397/* Assume close is always declared. */ 418/* Assume close is always declared. */
398_GL_WARN_ON_USE (close, "close does not portably work on sockets - " 419_GL_WARN_ON_USE (close, "close does not portably work on sockets - "
399 "use gnulib module close for portability"); 420 "use gnulib module close for portability");
@@ -422,7 +443,7 @@ _GL_CXXALIASWARN (close);
422# endif 443# endif
423_GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, 444_GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
424 int ofd, off_t *opos, 445 int ofd, off_t *opos,
425 size_t len, unsigned flags)); 446 size_t len, unsigned flags), );
426_GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, 447_GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
427 int ofd, off_t *opos, 448 int ofd, off_t *opos,
428 size_t len, unsigned flags)); 449 size_t len, unsigned flags));
@@ -430,15 +451,16 @@ _GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
430# if !@HAVE_COPY_FILE_RANGE@ 451# if !@HAVE_COPY_FILE_RANGE@
431_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 452_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
432 int ofd, off_t *opos, 453 int ofd, off_t *opos,
433 size_t len, unsigned flags)); 454 size_t len, unsigned flags), );
434# endif 455# endif
435_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 456_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
436 int ofd, off_t *opos, 457 int ofd, off_t *opos,
437 size_t len, unsigned flags)); 458 size_t len, unsigned flags));
438# endif 459# endif
460# if __GLIBC__ >= 2
439_GL_CXXALIASWARN (copy_file_range); 461_GL_CXXALIASWARN (copy_file_range);
462# endif
440#elif defined GNULIB_POSIXCHECK 463#elif defined GNULIB_POSIXCHECK
441# undef copy_file_range
442# if HAVE_RAW_DECL_COPY_FILE_RANGE 464# if HAVE_RAW_DECL_COPY_FILE_RANGE
443_GL_WARN_ON_USE (copy_file_range, 465_GL_WARN_ON_USE (copy_file_range,
444 "copy_file_range is unportable - " 466 "copy_file_range is unportable - "
@@ -452,7 +474,7 @@ _GL_WARN_ON_USE (copy_file_range,
452# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 474# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
453# define dup rpl_dup 475# define dup rpl_dup
454# endif 476# endif
455_GL_FUNCDECL_RPL (dup, int, (int oldfd)); 477_GL_FUNCDECL_RPL (dup, int, (int oldfd), _GL_ATTRIBUTE_NODISCARD);
456_GL_CXXALIAS_RPL (dup, int, (int oldfd)); 478_GL_CXXALIAS_RPL (dup, int, (int oldfd));
457# elif defined _WIN32 && !defined __CYGWIN__ 479# elif defined _WIN32 && !defined __CYGWIN__
458# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 480# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -465,7 +487,6 @@ _GL_CXXALIAS_SYS (dup, int, (int oldfd));
465# endif 487# endif
466_GL_CXXALIASWARN (dup); 488_GL_CXXALIASWARN (dup);
467#elif defined GNULIB_POSIXCHECK 489#elif defined GNULIB_POSIXCHECK
468# undef dup
469# if HAVE_RAW_DECL_DUP 490# if HAVE_RAW_DECL_DUP
470_GL_WARN_ON_USE (dup, "dup is unportable - " 491_GL_WARN_ON_USE (dup, "dup is unportable - "
471 "use gnulib module dup for portability"); 492 "use gnulib module dup for portability");
@@ -497,7 +518,7 @@ _GL_CXXALIASWARN (dup);
497# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 518# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
498# define dup2 rpl_dup2 519# define dup2 rpl_dup2
499# endif 520# endif
500_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); 521_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd), );
501_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); 522_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
502# elif defined _WIN32 && !defined __CYGWIN__ 523# elif defined _WIN32 && !defined __CYGWIN__
503# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 524# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -510,7 +531,6 @@ _GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd));
510# endif 531# endif
511_GL_CXXALIASWARN (dup2); 532_GL_CXXALIASWARN (dup2);
512#elif defined GNULIB_POSIXCHECK 533#elif defined GNULIB_POSIXCHECK
513# undef dup2
514# if HAVE_RAW_DECL_DUP2 534# if HAVE_RAW_DECL_DUP2
515_GL_WARN_ON_USE (dup2, "dup2 is unportable - " 535_GL_WARN_ON_USE (dup2, "dup2 is unportable - "
516 "use gnulib module dup2 for portability"); 536 "use gnulib module dup2 for portability");
@@ -541,19 +561,23 @@ _GL_CXXALIASWARN (dup2);
541 Return newfd if successful, otherwise -1 and errno set. 561 Return newfd if successful, otherwise -1 and errno set.
542 See the Linux man page at 562 See the Linux man page at
543 <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ 563 <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
544# if @HAVE_DUP3@ 564# if @REPLACE_DUP3@
545# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 565# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
566# undef dup3
546# define dup3 rpl_dup3 567# define dup3 rpl_dup3
547# endif 568# endif
548_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); 569_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags), );
549_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); 570_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
550# else 571# else
551_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); 572# if !@HAVE_DUP3@
573_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags), );
574# endif
552_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); 575_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
553# endif 576# endif
577# if __GLIBC__ >= 2
554_GL_CXXALIASWARN (dup3); 578_GL_CXXALIASWARN (dup3);
579# endif
555#elif defined GNULIB_POSIXCHECK 580#elif defined GNULIB_POSIXCHECK
556# undef dup3
557# if HAVE_RAW_DECL_DUP3 581# if HAVE_RAW_DECL_DUP3
558_GL_WARN_ON_USE (dup3, "dup3 is unportable - " 582_GL_WARN_ON_USE (dup3, "dup3 is unportable - "
559 "use gnulib module dup3 for portability"); 583 "use gnulib module dup3 for portability");
@@ -610,7 +634,7 @@ rpl_environ (void)
610/* Like access(), except that it uses the effective user id and group id of 634/* Like access(), except that it uses the effective user id and group id of
611 the current process. */ 635 the current process. */
612# if !@HAVE_EUIDACCESS@ 636# if !@HAVE_EUIDACCESS@
613_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) 637_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode),
614 _GL_ARG_NONNULL ((1))); 638 _GL_ARG_NONNULL ((1)));
615# endif 639# endif
616_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); 640_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
@@ -621,7 +645,6 @@ _GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - "
621 "use the gnulib module faccessat instead"); 645 "use the gnulib module faccessat instead");
622# endif 646# endif
623#elif defined GNULIB_POSIXCHECK 647#elif defined GNULIB_POSIXCHECK
624# undef euidaccess
625# if HAVE_RAW_DECL_EUIDACCESS 648# if HAVE_RAW_DECL_EUIDACCESS
626_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " 649_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
627 "use gnulib module euidaccess for portability"); 650 "use gnulib module euidaccess for portability");
@@ -635,7 +658,7 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
635# undef execl 658# undef execl
636# define execl rpl_execl 659# define execl rpl_execl
637# endif 660# endif
638_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...) 661_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...),
639 _GL_ARG_NONNULL ((1))); 662 _GL_ARG_NONNULL ((1)));
640_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...)); 663_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
641# else 664# else
@@ -643,7 +666,6 @@ _GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...));
643# endif 666# endif
644_GL_CXXALIASWARN (execl); 667_GL_CXXALIASWARN (execl);
645#elif defined GNULIB_POSIXCHECK 668#elif defined GNULIB_POSIXCHECK
646# undef execl
647# if HAVE_RAW_DECL_EXECL 669# if HAVE_RAW_DECL_EXECL
648_GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - " 670_GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - "
649 "use gnulib module execl for portability"); 671 "use gnulib module execl for portability");
@@ -670,7 +692,7 @@ _GL_CXXALIASWARN (execl);
670# undef execle 692# undef execle
671# define execle rpl_execle 693# define execle rpl_execle
672# endif 694# endif
673_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...) 695_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...),
674 _GL_ARG_NONNULL ((1))); 696 _GL_ARG_NONNULL ((1)));
675_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...)); 697_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
676# else 698# else
@@ -678,7 +700,6 @@ _GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...));
678# endif 700# endif
679_GL_CXXALIASWARN (execle); 701_GL_CXXALIASWARN (execle);
680#elif defined GNULIB_POSIXCHECK 702#elif defined GNULIB_POSIXCHECK
681# undef execle
682# if HAVE_RAW_DECL_EXECLE 703# if HAVE_RAW_DECL_EXECLE
683_GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - " 704_GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - "
684 "use gnulib module execle for portability"); 705 "use gnulib module execle for portability");
@@ -706,7 +727,7 @@ _GL_CXXALIASWARN (execle);
706# undef execlp 727# undef execlp
707# define execlp rpl_execlp 728# define execlp rpl_execlp
708# endif 729# endif
709_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...) 730_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...),
710 _GL_ARG_NONNULL ((1))); 731 _GL_ARG_NONNULL ((1)));
711_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...)); 732_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
712# else 733# else
@@ -714,7 +735,6 @@ _GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...));
714# endif 735# endif
715_GL_CXXALIASWARN (execlp); 736_GL_CXXALIASWARN (execlp);
716#elif defined GNULIB_POSIXCHECK 737#elif defined GNULIB_POSIXCHECK
717# undef execlp
718# if HAVE_RAW_DECL_EXECLP 738# if HAVE_RAW_DECL_EXECLP
719_GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - " 739_GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - "
720 "use gnulib module execlp for portability"); 740 "use gnulib module execlp for portability");
@@ -743,7 +763,7 @@ _GL_CXXALIASWARN (execlp);
743# undef execv 763# undef execv
744# define execv rpl_execv 764# define execv rpl_execv
745# endif 765# endif
746_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv) 766_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv),
747 _GL_ARG_NONNULL ((1, 2))); 767 _GL_ARG_NONNULL ((1, 2)));
748_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv)); 768_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
749# else 769# else
@@ -751,7 +771,6 @@ _GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv));
751# endif 771# endif
752_GL_CXXALIASWARN (execv); 772_GL_CXXALIASWARN (execv);
753#elif defined GNULIB_POSIXCHECK 773#elif defined GNULIB_POSIXCHECK
754# undef execv
755# if HAVE_RAW_DECL_EXECV 774# if HAVE_RAW_DECL_EXECV
756_GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - " 775_GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - "
757 "use gnulib module execv for portability"); 776 "use gnulib module execv for portability");
@@ -780,7 +799,7 @@ _GL_CXXALIASWARN (execv);
780# define execve rpl_execve 799# define execve rpl_execve
781# endif 800# endif
782_GL_FUNCDECL_RPL (execve, int, 801_GL_FUNCDECL_RPL (execve, int,
783 (const char *program, char * const *argv, char * const *env) 802 (const char *program, char * const *argv, char * const *env),
784 _GL_ARG_NONNULL ((1, 2))); 803 _GL_ARG_NONNULL ((1, 2)));
785_GL_CXXALIAS_RPL (execve, int, 804_GL_CXXALIAS_RPL (execve, int,
786 (const char *program, char * const *argv, char * const *env)); 805 (const char *program, char * const *argv, char * const *env));
@@ -790,7 +809,6 @@ _GL_CXXALIAS_SYS (execve, int,
790# endif 809# endif
791_GL_CXXALIASWARN (execve); 810_GL_CXXALIASWARN (execve);
792#elif defined GNULIB_POSIXCHECK 811#elif defined GNULIB_POSIXCHECK
793# undef execve
794# if HAVE_RAW_DECL_EXECVE 812# if HAVE_RAW_DECL_EXECVE
795_GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - " 813_GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - "
796 "use gnulib module execve for portability"); 814 "use gnulib module execve for portability");
@@ -820,7 +838,7 @@ _GL_CXXALIASWARN (execve);
820# undef execvp 838# undef execvp
821# define execvp rpl_execvp 839# define execvp rpl_execvp
822# endif 840# endif
823_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv) 841_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv),
824 _GL_ARG_NONNULL ((1, 2))); 842 _GL_ARG_NONNULL ((1, 2)));
825_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv)); 843_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
826# else 844# else
@@ -828,7 +846,6 @@ _GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv));
828# endif 846# endif
829_GL_CXXALIASWARN (execvp); 847_GL_CXXALIASWARN (execvp);
830#elif defined GNULIB_POSIXCHECK 848#elif defined GNULIB_POSIXCHECK
831# undef execvp
832# if HAVE_RAW_DECL_EXECVP 849# if HAVE_RAW_DECL_EXECVP
833_GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - " 850_GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - "
834 "use gnulib module execvp for portability"); 851 "use gnulib module execvp for portability");
@@ -857,22 +874,23 @@ _GL_CXXALIASWARN (execvp);
857# define execvpe rpl_execvpe 874# define execvpe rpl_execvpe
858# endif 875# endif
859_GL_FUNCDECL_RPL (execvpe, int, 876_GL_FUNCDECL_RPL (execvpe, int,
860 (const char *program, char * const *argv, char * const *env) 877 (const char *program, char * const *argv, char * const *env),
861 _GL_ARG_NONNULL ((1, 2))); 878 _GL_ARG_NONNULL ((1, 2)));
862_GL_CXXALIAS_RPL (execvpe, int, 879_GL_CXXALIAS_RPL (execvpe, int,
863 (const char *program, char * const *argv, char * const *env)); 880 (const char *program, char * const *argv, char * const *env));
864# else 881# else
865# if !@HAVE_DECL_EXECVPE@ 882# if !@HAVE_DECL_EXECVPE@
866_GL_FUNCDECL_SYS (execvpe, int, 883_GL_FUNCDECL_SYS (execvpe, int,
867 (const char *program, char * const *argv, char * const *env) 884 (const char *program, char * const *argv, char * const *env),
868 _GL_ARG_NONNULL ((1, 2))); 885 _GL_ARG_NONNULL ((1, 2)));
869# endif 886# endif
870_GL_CXXALIAS_SYS (execvpe, int, 887_GL_CXXALIAS_SYS (execvpe, int,
871 (const char *program, char * const *argv, char * const *env)); 888 (const char *program, char * const *argv, char * const *env));
872# endif 889# endif
890# if __GLIBC__ >= 2
873_GL_CXXALIASWARN (execvpe); 891_GL_CXXALIASWARN (execvpe);
892# endif
874#elif defined GNULIB_POSIXCHECK 893#elif defined GNULIB_POSIXCHECK
875# undef execvpe
876# if HAVE_RAW_DECL_EXECVPE 894# if HAVE_RAW_DECL_EXECVPE
877_GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - " 895_GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - "
878 "use gnulib module execvpe for portability"); 896 "use gnulib module execvpe for portability");
@@ -893,7 +911,7 @@ _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
893# elif @HAVE_EXECVPE@ 911# elif @HAVE_EXECVPE@
894# if !@HAVE_DECL_EXECVPE@ 912# if !@HAVE_DECL_EXECVPE@
895_GL_FUNCDECL_SYS (execvpe, int, 913_GL_FUNCDECL_SYS (execvpe, int,
896 (const char *program, char * const *argv, char * const *env) 914 (const char *program, char * const *argv, char * const *env),
897 _GL_ARG_NONNULL ((1, 2))); 915 _GL_ARG_NONNULL ((1, 2)));
898# endif 916# endif
899_GL_CXXALIAS_SYS (execvpe, int, 917_GL_CXXALIAS_SYS (execvpe, int,
@@ -912,22 +930,23 @@ _GL_CXXALIASWARN (execvpe);
912# define faccessat rpl_faccessat 930# define faccessat rpl_faccessat
913# endif 931# endif
914_GL_FUNCDECL_RPL (faccessat, int, 932_GL_FUNCDECL_RPL (faccessat, int,
915 (int fd, char const *name, int mode, int flag) 933 (int fd, char const *name, int mode, int flag),
916 _GL_ARG_NONNULL ((2))); 934 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
917_GL_CXXALIAS_RPL (faccessat, int, 935_GL_CXXALIAS_RPL (faccessat, int,
918 (int fd, char const *name, int mode, int flag)); 936 (int fd, char const *name, int mode, int flag));
919# else 937# else
920# if !@HAVE_FACCESSAT@ 938# if !@HAVE_FACCESSAT@
921_GL_FUNCDECL_SYS (faccessat, int, 939_GL_FUNCDECL_SYS (faccessat, int,
922 (int fd, char const *file, int mode, int flag) 940 (int fd, char const *file, int mode, int flag),
923 _GL_ARG_NONNULL ((2))); 941 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
924# endif 942# endif
925_GL_CXXALIAS_SYS (faccessat, int, 943_GL_CXXALIAS_SYS (faccessat, int,
926 (int fd, char const *file, int mode, int flag)); 944 (int fd, char const *file, int mode, int flag));
927# endif 945# endif
946# if __GLIBC__ >= 2
928_GL_CXXALIASWARN (faccessat); 947_GL_CXXALIASWARN (faccessat);
948# endif
929#elif defined GNULIB_POSIXCHECK 949#elif defined GNULIB_POSIXCHECK
930# undef faccessat
931# if HAVE_RAW_DECL_FACCESSAT 950# if HAVE_RAW_DECL_FACCESSAT
932_GL_WARN_ON_USE (faccessat, "faccessat is not portable - " 951_GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
933 "use gnulib module faccessat for portability"); 952 "use gnulib module faccessat for portability");
@@ -941,25 +960,29 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
941 Return 0 if successful, otherwise -1 and errno set. 960 Return 0 if successful, otherwise -1 and errno set.
942 See the POSIX:2008 specification 961 See the POSIX:2008 specification
943 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ 962 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
944# if ! @HAVE_FCHDIR@ 963# if @REPLACE_FCHDIR@
945_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 964# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
946 965# undef fchdir
966# define fchdir rpl_fchdir
967# endif
968_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
969_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/));
970# else
971# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@
972_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
973# endif
974_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
975# endif
976_GL_CXXALIASWARN (fchdir);
977# if @REPLACE_FCHDIR@ || !@HAVE_FCHDIR@
947/* Gnulib internal hooks needed to maintain the fchdir metadata. */ 978/* Gnulib internal hooks needed to maintain the fchdir metadata. */
948_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) 979_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
949 _GL_ARG_NONNULL ((2)); 980 _GL_ARG_NONNULL ((2));
950_GL_EXTERN_C void _gl_unregister_fd (int fd); 981_GL_EXTERN_C void _gl_unregister_fd (int fd);
951_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); 982_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
952_GL_EXTERN_C const char *_gl_directory_name (int fd); 983_GL_EXTERN_C const char *_gl_directory_name (int fd);
953
954# else
955# if !@HAVE_DECL_FCHDIR@
956_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/));
957# endif
958# endif 984# endif
959_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
960_GL_CXXALIASWARN (fchdir);
961#elif defined GNULIB_POSIXCHECK 985#elif defined GNULIB_POSIXCHECK
962# undef fchdir
963# if HAVE_RAW_DECL_FCHDIR 986# if HAVE_RAW_DECL_FCHDIR
964_GL_WARN_ON_USE (fchdir, "fchdir is unportable - " 987_GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
965 "use gnulib module fchdir for portability"); 988 "use gnulib module fchdir for portability");
@@ -974,22 +997,21 @@ _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
974# define fchownat rpl_fchownat 997# define fchownat rpl_fchownat
975# endif 998# endif
976_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, 999_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
977 uid_t owner, gid_t group, int flag) 1000 uid_t owner, gid_t group, int flag),
978 _GL_ARG_NONNULL ((2))); 1001 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
979_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, 1002_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
980 uid_t owner, gid_t group, int flag)); 1003 uid_t owner, gid_t group, int flag));
981# else 1004# else
982# if !@HAVE_FCHOWNAT@ 1005# if !@HAVE_FCHOWNAT@
983_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, 1006_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
984 uid_t owner, gid_t group, int flag) 1007 uid_t owner, gid_t group, int flag),
985 _GL_ARG_NONNULL ((2))); 1008 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
986# endif 1009# endif
987_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, 1010_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
988 uid_t owner, gid_t group, int flag)); 1011 uid_t owner, gid_t group, int flag));
989# endif 1012# endif
990_GL_CXXALIASWARN (fchownat); 1013_GL_CXXALIASWARN (fchownat);
991#elif defined GNULIB_POSIXCHECK 1014#elif defined GNULIB_POSIXCHECK
992# undef fchownat
993# if HAVE_RAW_DECL_FCHOWNAT 1015# if HAVE_RAW_DECL_FCHOWNAT
994_GL_WARN_ON_USE (fchownat, "fchownat is not portable - " 1016_GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
995 "use gnulib module fchownat for portability"); 1017 "use gnulib module fchownat for portability");
@@ -1002,13 +1024,23 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
1002 Return 0 if successful, otherwise -1 and errno set. 1024 Return 0 if successful, otherwise -1 and errno set.
1003 See POSIX:2008 specification 1025 See POSIX:2008 specification
1004 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ 1026 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
1005# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ 1027# if @REPLACE_FDATASYNC@
1006_GL_FUNCDECL_SYS (fdatasync, int, (int fd)); 1028# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1007# endif 1029# undef fdatasync
1030# define fdatasync rpl_fdatasync
1031# endif
1032_GL_FUNCDECL_RPL (fdatasync, int, (int fd), );
1033_GL_CXXALIAS_RPL (fdatasync, int, (int fd));
1034# else
1035# if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@
1036_GL_FUNCDECL_SYS (fdatasync, int, (int fd), );
1037# endif
1008_GL_CXXALIAS_SYS (fdatasync, int, (int fd)); 1038_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
1039# endif
1040# if __GLIBC__ >= 2
1009_GL_CXXALIASWARN (fdatasync); 1041_GL_CXXALIASWARN (fdatasync);
1042# endif
1010#elif defined GNULIB_POSIXCHECK 1043#elif defined GNULIB_POSIXCHECK
1011# undef fdatasync
1012# if HAVE_RAW_DECL_FDATASYNC 1044# if HAVE_RAW_DECL_FDATASYNC
1013_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " 1045_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
1014 "use gnulib module fdatasync for portability"); 1046 "use gnulib module fdatasync for portability");
@@ -1022,12 +1054,11 @@ _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
1022 See POSIX:2008 specification 1054 See POSIX:2008 specification
1023 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ 1055 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
1024# if !@HAVE_FSYNC@ 1056# if !@HAVE_FSYNC@
1025_GL_FUNCDECL_SYS (fsync, int, (int fd)); 1057_GL_FUNCDECL_SYS (fsync, int, (int fd), );
1026# endif 1058# endif
1027_GL_CXXALIAS_SYS (fsync, int, (int fd)); 1059_GL_CXXALIAS_SYS (fsync, int, (int fd));
1028_GL_CXXALIASWARN (fsync); 1060_GL_CXXALIASWARN (fsync);
1029#elif defined GNULIB_POSIXCHECK 1061#elif defined GNULIB_POSIXCHECK
1030# undef fsync
1031# if HAVE_RAW_DECL_FSYNC 1062# if HAVE_RAW_DECL_FSYNC
1032_GL_WARN_ON_USE (fsync, "fsync is unportable - " 1063_GL_WARN_ON_USE (fsync, "fsync is unportable - "
1033 "use gnulib module fsync for portability"); 1064 "use gnulib module fsync for portability");
@@ -1045,17 +1076,22 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
1045# undef ftruncate 1076# undef ftruncate
1046# define ftruncate rpl_ftruncate 1077# define ftruncate rpl_ftruncate
1047# endif 1078# endif
1048_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); 1079_GL_FUNCDECL_RPL (ftruncate, int,
1049_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); 1080 (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
1081_GL_CXXALIAS_RPL (ftruncate, int,
1082 (int fd, off_t length));
1050# else 1083# else
1051# if !@HAVE_FTRUNCATE@ 1084# if !@HAVE_FTRUNCATE@
1052_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); 1085_GL_FUNCDECL_SYS (ftruncate, int,
1086 (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
1053# endif 1087# endif
1054_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); 1088_GL_CXXALIAS_SYS (ftruncate, int,
1089 (int fd, off_t length));
1055# endif 1090# endif
1091# if __GLIBC__ >= 2
1056_GL_CXXALIASWARN (ftruncate); 1092_GL_CXXALIASWARN (ftruncate);
1093# endif
1057#elif defined GNULIB_POSIXCHECK 1094#elif defined GNULIB_POSIXCHECK
1058# undef ftruncate
1059# if HAVE_RAW_DECL_FTRUNCATE 1095# if HAVE_RAW_DECL_FTRUNCATE
1060_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " 1096_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
1061 "use gnulib module ftruncate for portability"); 1097 "use gnulib module ftruncate for portability");
@@ -1070,15 +1106,16 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
1070 or SIZE was too small. 1106 or SIZE was too small.
1071 See the POSIX:2008 specification 1107 See the POSIX:2008 specification
1072 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. 1108 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
1073 Additionally, the gnulib module 'getcwd' guarantees the following GNU 1109 Additionally, the gnulib module 'getcwd' or 'getcwd-lgpl' guarantees the
1074 extension: If BUF is NULL, an array is allocated with 'malloc'; the array 1110 following GNU extension: If BUF is NULL, an array is allocated with
1075 is SIZE bytes long, unless SIZE == 0, in which case it is as big as 1111 'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case
1076 necessary. */ 1112 it is as big as necessary. */
1077# if @REPLACE_GETCWD@ 1113# if @REPLACE_GETCWD@
1078# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1114# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1079# define getcwd rpl_getcwd 1115# define getcwd rpl_getcwd
1080# endif 1116# endif
1081_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); 1117_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size),
1118 _GL_ATTRIBUTE_NODISCARD);
1082_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); 1119_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
1083# elif defined _WIN32 && !defined __CYGWIN__ 1120# elif defined _WIN32 && !defined __CYGWIN__
1084# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1121# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1093,7 +1130,6 @@ _GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size));
1093# endif 1130# endif
1094_GL_CXXALIASWARN (getcwd); 1131_GL_CXXALIASWARN (getcwd);
1095#elif defined GNULIB_POSIXCHECK 1132#elif defined GNULIB_POSIXCHECK
1096# undef getcwd
1097# if HAVE_RAW_DECL_GETCWD 1133# if HAVE_RAW_DECL_GETCWD
1098_GL_WARN_ON_USE (getcwd, "getcwd is unportable - " 1134_GL_WARN_ON_USE (getcwd, "getcwd is unportable - "
1099 "use gnulib module getcwd for portability"); 1135 "use gnulib module getcwd for portability");
@@ -1133,21 +1169,24 @@ _GL_CXXALIASWARN (getcwd);
1133# undef getdomainname 1169# undef getdomainname
1134# define getdomainname rpl_getdomainname 1170# define getdomainname rpl_getdomainname
1135# endif 1171# endif
1136_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) 1172_GL_FUNCDECL_RPL (getdomainname, int,
1137 _GL_ARG_NONNULL ((1))); 1173 (char *name, size_t len),
1138_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); 1174 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1175_GL_CXXALIAS_RPL (getdomainname, int,
1176 (char *name, size_t len));
1139# else 1177# else
1140# if !@HAVE_DECL_GETDOMAINNAME@ 1178# if !@HAVE_DECL_GETDOMAINNAME@
1141_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) 1179_GL_FUNCDECL_SYS (getdomainname, int,
1142 _GL_ARG_NONNULL ((1))); 1180 (char *name, size_t len),
1181 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1143# endif 1182# endif
1144_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); 1183_GL_CXXALIAS_SYS (getdomainname, int,
1184 (char *name, size_t len));
1145# endif 1185# endif
1146# if __GLIBC__ >= 2 1186# if __GLIBC__ >= 2
1147_GL_CXXALIASWARN (getdomainname); 1187_GL_CXXALIASWARN (getdomainname);
1148# endif 1188# endif
1149#elif defined GNULIB_POSIXCHECK 1189#elif defined GNULIB_POSIXCHECK
1150# undef getdomainname
1151# if HAVE_RAW_DECL_GETDOMAINNAME 1190# if HAVE_RAW_DECL_GETDOMAINNAME
1152_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " 1191_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
1153 "use gnulib module getdomainname for portability"); 1192 "use gnulib module getdomainname for portability");
@@ -1163,11 +1202,11 @@ _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
1163# undef getdtablesize 1202# undef getdtablesize
1164# define getdtablesize rpl_getdtablesize 1203# define getdtablesize rpl_getdtablesize
1165# endif 1204# endif
1166_GL_FUNCDECL_RPL (getdtablesize, int, (void)); 1205_GL_FUNCDECL_RPL (getdtablesize, int, (void), );
1167_GL_CXXALIAS_RPL (getdtablesize, int, (void)); 1206_GL_CXXALIAS_RPL (getdtablesize, int, (void));
1168# else 1207# else
1169# if !@HAVE_GETDTABLESIZE@ 1208# if !@HAVE_GETDTABLESIZE@
1170_GL_FUNCDECL_SYS (getdtablesize, int, (void)); 1209_GL_FUNCDECL_SYS (getdtablesize, int, (void), );
1171# endif 1210# endif
1172/* Need to cast, because on AIX, the parameter list is 1211/* Need to cast, because on AIX, the parameter list is
1173 (...). */ 1212 (...). */
@@ -1175,7 +1214,6 @@ _GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void));
1175# endif 1214# endif
1176_GL_CXXALIASWARN (getdtablesize); 1215_GL_CXXALIASWARN (getdtablesize);
1177#elif defined GNULIB_POSIXCHECK 1216#elif defined GNULIB_POSIXCHECK
1178# undef getdtablesize
1179# if HAVE_RAW_DECL_GETDTABLESIZE 1217# if HAVE_RAW_DECL_GETDTABLESIZE
1180_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " 1218_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
1181 "use gnulib module getdtablesize for portability"); 1219 "use gnulib module getdtablesize for portability");
@@ -1185,13 +1223,27 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
1185 1223
1186#if @GNULIB_GETENTROPY@ 1224#if @GNULIB_GETENTROPY@
1187/* Fill a buffer with random bytes. */ 1225/* Fill a buffer with random bytes. */
1188# if !@HAVE_GETENTROPY@ 1226# if @REPLACE_GETENTROPY@
1189_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); 1227# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1228# undef getentropy
1229# define getentropy rpl_getentropy
1230# endif
1231_GL_FUNCDECL_RPL (getentropy, int,
1232 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1233_GL_CXXALIAS_RPL (getentropy, int,
1234 (void *buffer, size_t length));
1235# else
1236# if !@HAVE_GETENTROPY@
1237_GL_FUNCDECL_SYS (getentropy, int,
1238 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1239# endif
1240_GL_CXXALIAS_SYS (getentropy, int,
1241 (void *buffer, size_t length));
1190# endif 1242# endif
1191_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); 1243# if __GLIBC__ >= 2
1192_GL_CXXALIASWARN (getentropy); 1244_GL_CXXALIASWARN (getentropy);
1245# endif
1193#elif defined GNULIB_POSIXCHECK 1246#elif defined GNULIB_POSIXCHECK
1194# undef getentropy
1195# if HAVE_RAW_DECL_GETENTROPY 1247# if HAVE_RAW_DECL_GETENTROPY
1196_GL_WARN_ON_USE (getentropy, "getentropy is unportable - " 1248_GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
1197 "use gnulib module getentropy for portability"); 1249 "use gnulib module getentropy for portability");
@@ -1210,17 +1262,20 @@ _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
1210# undef getgroups 1262# undef getgroups
1211# define getgroups rpl_getgroups 1263# define getgroups rpl_getgroups
1212# endif 1264# endif
1213_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); 1265_GL_FUNCDECL_RPL (getgroups, int,
1214_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); 1266 (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
1267_GL_CXXALIAS_RPL (getgroups, int,
1268 (int n, gid_t *groups));
1215# else 1269# else
1216# if !@HAVE_GETGROUPS@ 1270# if !@HAVE_GETGROUPS@
1217_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); 1271_GL_FUNCDECL_SYS (getgroups, int,
1272 (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
1218# endif 1273# endif
1219_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); 1274_GL_CXXALIAS_SYS (getgroups, int,
1275 (int n, gid_t *groups));
1220# endif 1276# endif
1221_GL_CXXALIASWARN (getgroups); 1277_GL_CXXALIASWARN (getgroups);
1222#elif defined GNULIB_POSIXCHECK 1278#elif defined GNULIB_POSIXCHECK
1223# undef getgroups
1224# if HAVE_RAW_DECL_GETGROUPS 1279# if HAVE_RAW_DECL_GETGROUPS
1225_GL_WARN_ON_USE (getgroups, "getgroups is unportable - " 1280_GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
1226 "use gnulib module getgroups for portability"); 1281 "use gnulib module getgroups for portability");
@@ -1241,25 +1296,25 @@ _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
1241# undef gethostname 1296# undef gethostname
1242# define gethostname rpl_gethostname 1297# define gethostname rpl_gethostname
1243# endif 1298# endif
1244_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) 1299_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len),
1245 _GL_ARG_NONNULL ((1))); 1300 _GL_ARG_NONNULL ((1)));
1246_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); 1301_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
1247# else 1302# else
1248# if !@HAVE_GETHOSTNAME@ 1303# if !@HAVE_GETHOSTNAME@
1249_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) 1304_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len),
1250 _GL_ARG_NONNULL ((1))); 1305 _GL_ARG_NONNULL ((1)));
1251# endif 1306# endif
1252/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second 1307/* Need to cast, because on Solaris 10 systems, the second parameter is
1253 parameter is
1254 int len. */ 1308 int len. */
1255_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); 1309_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
1256# endif 1310# endif
1257_GL_CXXALIASWARN (gethostname); 1311_GL_CXXALIASWARN (gethostname);
1258#elif @UNISTD_H_HAVE_WINSOCK2_H@ 1312#elif @UNISTD_H_HAVE_WINSOCK2_H@
1259# undef gethostname 1313# if !GNULIB_GETHOSTNAME
1260# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname 1314# undef gethostname
1315# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
1316# endif
1261#elif defined GNULIB_POSIXCHECK 1317#elif defined GNULIB_POSIXCHECK
1262# undef gethostname
1263# if HAVE_RAW_DECL_GETHOSTNAME 1318# if HAVE_RAW_DECL_GETHOSTNAME
1264_GL_WARN_ON_USE (gethostname, "gethostname is unportable - " 1319_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
1265 "use gnulib module gethostname for portability"); 1320 "use gnulib module gethostname for portability");
@@ -1278,13 +1333,22 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
1278 ${LOGNAME-$USER} on Unix platforms, 1333 ${LOGNAME-$USER} on Unix platforms,
1279 $USERNAME on native Windows platforms. 1334 $USERNAME on native Windows platforms.
1280 */ 1335 */
1281# if !@HAVE_DECL_GETLOGIN@ 1336# if @REPLACE_GETLOGIN@
1282_GL_FUNCDECL_SYS (getlogin, char *, (void)); 1337# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1283# endif 1338# define getlogin rpl_getlogin
1339# endif
1340_GL_FUNCDECL_RPL (getlogin, char *, (void), );
1341_GL_CXXALIAS_RPL (getlogin, char *, (void));
1342# else
1343# if !@HAVE_DECL_GETLOGIN@
1344_GL_FUNCDECL_SYS (getlogin, char *, (void), );
1345# endif
1284_GL_CXXALIAS_SYS (getlogin, char *, (void)); 1346_GL_CXXALIAS_SYS (getlogin, char *, (void));
1347# endif
1348# if __GLIBC__ >= 2
1285_GL_CXXALIASWARN (getlogin); 1349_GL_CXXALIASWARN (getlogin);
1350# endif
1286#elif defined GNULIB_POSIXCHECK 1351#elif defined GNULIB_POSIXCHECK
1287# undef getlogin
1288# if HAVE_RAW_DECL_GETLOGIN 1352# if HAVE_RAW_DECL_GETLOGIN
1289_GL_WARN_ON_USE (getlogin, "getlogin is unportable - " 1353_GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
1290 "use gnulib module getlogin for portability"); 1354 "use gnulib module getlogin for portability");
@@ -1311,21 +1375,22 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
1311# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1375# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1312# define getlogin_r rpl_getlogin_r 1376# define getlogin_r rpl_getlogin_r
1313# endif 1377# endif
1314_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) 1378_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size),
1315 _GL_ARG_NONNULL ((1))); 1379 _GL_ARG_NONNULL ((1)));
1316_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); 1380_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
1317# else 1381# else
1318# if !@HAVE_DECL_GETLOGIN_R@ 1382# if !@HAVE_DECL_GETLOGIN_R@
1319_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) 1383_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size),
1320 _GL_ARG_NONNULL ((1))); 1384 _GL_ARG_NONNULL ((1)));
1321# endif 1385# endif
1322/* Need to cast, because on Solaris 10 systems, the second argument is 1386/* Need to cast, because on Solaris 10 systems, the second argument is
1323 int size. */ 1387 int size. */
1324_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); 1388_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
1325# endif 1389# endif
1390# if __GLIBC__ >= 2
1326_GL_CXXALIASWARN (getlogin_r); 1391_GL_CXXALIASWARN (getlogin_r);
1392# endif
1327#elif defined GNULIB_POSIXCHECK 1393#elif defined GNULIB_POSIXCHECK
1328# undef getlogin_r
1329# if HAVE_RAW_DECL_GETLOGIN_R 1394# if HAVE_RAW_DECL_GETLOGIN_R
1330_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " 1395_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
1331 "use gnulib module getlogin_r for portability"); 1396 "use gnulib module getlogin_r for portability");
@@ -1338,13 +1403,13 @@ _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
1338# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1403# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1339# define getpagesize rpl_getpagesize 1404# define getpagesize rpl_getpagesize
1340# endif 1405# endif
1341_GL_FUNCDECL_RPL (getpagesize, int, (void)); 1406_GL_FUNCDECL_RPL (getpagesize, int, (void), );
1342_GL_CXXALIAS_RPL (getpagesize, int, (void)); 1407_GL_CXXALIAS_RPL (getpagesize, int, (void));
1343# else 1408# else
1344/* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if 1409/* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if
1345 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */ 1410 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
1346# if defined __hpux 1411# if defined __hpux
1347_GL_FUNCDECL_SYS (getpagesize, int, (void)); 1412_GL_FUNCDECL_SYS (getpagesize, int, (void), );
1348# endif 1413# endif
1349# if !@HAVE_GETPAGESIZE@ 1414# if !@HAVE_GETPAGESIZE@
1350# if !defined getpagesize 1415# if !defined getpagesize
@@ -1395,7 +1460,7 @@ _GL_FUNCDECL_SYS (getpagesize, int, (void));
1395# define getpagesize() _gl_getpagesize () 1460# define getpagesize() _gl_getpagesize ()
1396# else 1461# else
1397# if !GNULIB_defined_getpagesize_function 1462# if !GNULIB_defined_getpagesize_function
1398_GL_UNISTD_INLINE int 1463_GL_GETPAGESIZE_INLINE int
1399getpagesize () 1464getpagesize ()
1400{ 1465{
1401 return _gl_getpagesize (); 1466 return _gl_getpagesize ();
@@ -1412,7 +1477,6 @@ _GL_CXXALIAS_SYS_CAST (getpagesize, int, (void));
1412_GL_CXXALIASWARN (getpagesize); 1477_GL_CXXALIASWARN (getpagesize);
1413# endif 1478# endif
1414#elif defined GNULIB_POSIXCHECK 1479#elif defined GNULIB_POSIXCHECK
1415# undef getpagesize
1416# if HAVE_RAW_DECL_GETPAGESIZE 1480# if HAVE_RAW_DECL_GETPAGESIZE
1417_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " 1481_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1418 "use gnulib module getpagesize for portability"); 1482 "use gnulib module getpagesize for portability");
@@ -1431,19 +1495,18 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1431# undef getpass 1495# undef getpass
1432# define getpass rpl_getpass 1496# define getpass rpl_getpass
1433# endif 1497# endif
1434_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) 1498_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt),
1435 _GL_ARG_NONNULL ((1))); 1499 _GL_ARG_NONNULL ((1)));
1436_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); 1500_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
1437# else 1501# else
1438# if !@HAVE_GETPASS@ 1502# if !@HAVE_GETPASS@
1439_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) 1503_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt),
1440 _GL_ARG_NONNULL ((1))); 1504 _GL_ARG_NONNULL ((1)));
1441# endif 1505# endif
1442_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); 1506_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
1443# endif 1507# endif
1444_GL_CXXALIASWARN (getpass); 1508_GL_CXXALIASWARN (getpass);
1445#elif defined GNULIB_POSIXCHECK 1509#elif defined GNULIB_POSIXCHECK
1446# undef getpass
1447# if HAVE_RAW_DECL_GETPASS 1510# if HAVE_RAW_DECL_GETPASS
1448_GL_WARN_ON_USE (getpass, "getpass is unportable - " 1511_GL_WARN_ON_USE (getpass, "getpass is unportable - "
1449 "use gnulib module getpass or getpass-gnu for portability"); 1512 "use gnulib module getpass or getpass-gnu for portability");
@@ -1469,15 +1532,23 @@ _GL_CXXALIASWARN (getpid);
1469 1532
1470 1533
1471#if @GNULIB_GETUSERSHELL@ 1534#if @GNULIB_GETUSERSHELL@
1535# if @REPLACE_GETUSERSHELL@
1472/* Return the next valid login shell on the system, or NULL when the end of 1536/* Return the next valid login shell on the system, or NULL when the end of
1473 the list has been reached. */ 1537 the list has been reached. */
1474# if !@HAVE_DECL_GETUSERSHELL@ 1538# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1475_GL_FUNCDECL_SYS (getusershell, char *, (void)); 1539# undef getusershell
1476# endif 1540# define getusershell rpl_getusershell
1541# endif
1542_GL_FUNCDECL_RPL (getusershell, char *, (void), );
1543_GL_CXXALIAS_RPL (getusershell, char *, (void));
1544# else
1545# if !@HAVE_DECL_GETUSERSHELL@
1546_GL_FUNCDECL_SYS (getusershell, char *, (void), );
1547# endif
1477_GL_CXXALIAS_SYS (getusershell, char *, (void)); 1548_GL_CXXALIAS_SYS (getusershell, char *, (void));
1549# endif
1478_GL_CXXALIASWARN (getusershell); 1550_GL_CXXALIASWARN (getusershell);
1479#elif defined GNULIB_POSIXCHECK 1551#elif defined GNULIB_POSIXCHECK
1480# undef getusershell
1481# if HAVE_RAW_DECL_GETUSERSHELL 1552# if HAVE_RAW_DECL_GETUSERSHELL
1482_GL_WARN_ON_USE (getusershell, "getusershell is unportable - " 1553_GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
1483 "use gnulib module getusershell for portability"); 1554 "use gnulib module getusershell for portability");
@@ -1486,13 +1557,21 @@ _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
1486 1557
1487#if @GNULIB_GETUSERSHELL@ 1558#if @GNULIB_GETUSERSHELL@
1488/* Rewind to pointer that is advanced at each getusershell() call. */ 1559/* Rewind to pointer that is advanced at each getusershell() call. */
1489# if !@HAVE_DECL_GETUSERSHELL@ 1560# if @REPLACE_GETUSERSHELL@
1490_GL_FUNCDECL_SYS (setusershell, void, (void)); 1561# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1491# endif 1562# undef setusershell
1563# define setusershell rpl_setusershell
1564# endif
1565_GL_FUNCDECL_RPL (setusershell, void, (void), );
1566_GL_CXXALIAS_RPL (setusershell, void, (void));
1567# else
1568# if !@HAVE_DECL_GETUSERSHELL@
1569_GL_FUNCDECL_SYS (setusershell, void, (void), );
1570# endif
1492_GL_CXXALIAS_SYS (setusershell, void, (void)); 1571_GL_CXXALIAS_SYS (setusershell, void, (void));
1572# endif
1493_GL_CXXALIASWARN (setusershell); 1573_GL_CXXALIASWARN (setusershell);
1494#elif defined GNULIB_POSIXCHECK 1574#elif defined GNULIB_POSIXCHECK
1495# undef setusershell
1496# if HAVE_RAW_DECL_SETUSERSHELL 1575# if HAVE_RAW_DECL_SETUSERSHELL
1497_GL_WARN_ON_USE (setusershell, "setusershell is unportable - " 1576_GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
1498 "use gnulib module getusershell for portability"); 1577 "use gnulib module getusershell for portability");
@@ -1502,13 +1581,21 @@ _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
1502#if @GNULIB_GETUSERSHELL@ 1581#if @GNULIB_GETUSERSHELL@
1503/* Free the pointer that is advanced at each getusershell() call and 1582/* Free the pointer that is advanced at each getusershell() call and
1504 associated resources. */ 1583 associated resources. */
1505# if !@HAVE_DECL_GETUSERSHELL@ 1584# if @REPLACE_GETUSERSHELL@
1506_GL_FUNCDECL_SYS (endusershell, void, (void)); 1585# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1507# endif 1586# undef endusershell
1587# define endusershell rpl_endusershell
1588# endif
1589_GL_FUNCDECL_RPL (endusershell, void, (void), );
1590_GL_CXXALIAS_RPL (endusershell, void, (void));
1591# else
1592# if !@HAVE_DECL_GETUSERSHELL@
1593_GL_FUNCDECL_SYS (endusershell, void, (void), );
1594# endif
1508_GL_CXXALIAS_SYS (endusershell, void, (void)); 1595_GL_CXXALIAS_SYS (endusershell, void, (void));
1596# endif
1509_GL_CXXALIASWARN (endusershell); 1597_GL_CXXALIASWARN (endusershell);
1510#elif defined GNULIB_POSIXCHECK 1598#elif defined GNULIB_POSIXCHECK
1511# undef endusershell
1512# if HAVE_RAW_DECL_ENDUSERSHELL 1599# if HAVE_RAW_DECL_ENDUSERSHELL
1513_GL_WARN_ON_USE (endusershell, "endusershell is unportable - " 1600_GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
1514 "use gnulib module getusershell for portability"); 1601 "use gnulib module getusershell for portability");
@@ -1519,12 +1606,11 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
1519#if @GNULIB_GROUP_MEMBER@ 1606#if @GNULIB_GROUP_MEMBER@
1520/* Determine whether group id is in calling user's group list. */ 1607/* Determine whether group id is in calling user's group list. */
1521# if !@HAVE_GROUP_MEMBER@ 1608# if !@HAVE_GROUP_MEMBER@
1522_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); 1609_GL_FUNCDECL_SYS (group_member, int, (gid_t gid), );
1523# endif 1610# endif
1524_GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); 1611_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
1525_GL_CXXALIASWARN (group_member); 1612_GL_CXXALIASWARN (group_member);
1526#elif defined GNULIB_POSIXCHECK 1613#elif defined GNULIB_POSIXCHECK
1527# undef group_member
1528# if HAVE_RAW_DECL_GROUP_MEMBER 1614# if HAVE_RAW_DECL_GROUP_MEMBER
1529_GL_WARN_ON_USE (group_member, "group_member is unportable - " 1615_GL_WARN_ON_USE (group_member, "group_member is unportable - "
1530 "use gnulib module group-member for portability"); 1616 "use gnulib module group-member for portability");
@@ -1539,7 +1625,7 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
1539# define isatty rpl_isatty 1625# define isatty rpl_isatty
1540# endif 1626# endif
1541# define GNULIB_defined_isatty 1 1627# define GNULIB_defined_isatty 1
1542_GL_FUNCDECL_RPL (isatty, int, (int fd)); 1628_GL_FUNCDECL_RPL (isatty, int, (int fd), );
1543_GL_CXXALIAS_RPL (isatty, int, (int fd)); 1629_GL_CXXALIAS_RPL (isatty, int, (int fd));
1544# elif defined _WIN32 && !defined __CYGWIN__ 1630# elif defined _WIN32 && !defined __CYGWIN__
1545# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1631# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1552,7 +1638,6 @@ _GL_CXXALIAS_SYS (isatty, int, (int fd));
1552# endif 1638# endif
1553_GL_CXXALIASWARN (isatty); 1639_GL_CXXALIASWARN (isatty);
1554#elif defined GNULIB_POSIXCHECK 1640#elif defined GNULIB_POSIXCHECK
1555# undef isatty
1556# if HAVE_RAW_DECL_ISATTY 1641# if HAVE_RAW_DECL_ISATTY
1557_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " 1642_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
1558 "use gnulib module isatty for portability"); 1643 "use gnulib module isatty for portability");
@@ -1585,19 +1670,18 @@ _GL_CXXALIASWARN (isatty);
1585# undef lchown 1670# undef lchown
1586# define lchown rpl_lchown 1671# define lchown rpl_lchown
1587# endif 1672# endif
1588_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) 1673_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group),
1589 _GL_ARG_NONNULL ((1))); 1674 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1590_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); 1675_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
1591# else 1676# else
1592# if !@HAVE_LCHOWN@ 1677# if !@HAVE_LCHOWN@
1593_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) 1678_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group),
1594 _GL_ARG_NONNULL ((1))); 1679 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1595# endif 1680# endif
1596_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); 1681_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
1597# endif 1682# endif
1598_GL_CXXALIASWARN (lchown); 1683_GL_CXXALIASWARN (lchown);
1599#elif defined GNULIB_POSIXCHECK 1684#elif defined GNULIB_POSIXCHECK
1600# undef lchown
1601# if HAVE_RAW_DECL_LCHOWN 1685# if HAVE_RAW_DECL_LCHOWN
1602_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " 1686_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1603 "use gnulib module lchown for portability"); 1687 "use gnulib module lchown for portability");
@@ -1614,19 +1698,18 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1614# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1698# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1615# define link rpl_link 1699# define link rpl_link
1616# endif 1700# endif
1617_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) 1701_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2),
1618 _GL_ARG_NONNULL ((1, 2))); 1702 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1619_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); 1703_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1620# else 1704# else
1621# if !@HAVE_LINK@ 1705# if !@HAVE_LINK@
1622_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) 1706_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2),
1623 _GL_ARG_NONNULL ((1, 2))); 1707 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1624# endif 1708# endif
1625_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); 1709_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1626# endif 1710# endif
1627_GL_CXXALIASWARN (link); 1711_GL_CXXALIASWARN (link);
1628#elif defined GNULIB_POSIXCHECK 1712#elif defined GNULIB_POSIXCHECK
1629# undef link
1630# if HAVE_RAW_DECL_LINK 1713# if HAVE_RAW_DECL_LINK
1631_GL_WARN_ON_USE (link, "link is unportable - " 1714_GL_WARN_ON_USE (link, "link is unportable - "
1632 "use gnulib module link for portability"); 1715 "use gnulib module link for portability");
@@ -1645,8 +1728,8 @@ _GL_WARN_ON_USE (link, "link is unportable - "
1645# endif 1728# endif
1646_GL_FUNCDECL_RPL (linkat, int, 1729_GL_FUNCDECL_RPL (linkat, int,
1647 (int fd1, const char *path1, int fd2, const char *path2, 1730 (int fd1, const char *path1, int fd2, const char *path2,
1648 int flag) 1731 int flag),
1649 _GL_ARG_NONNULL ((2, 4))); 1732 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1650_GL_CXXALIAS_RPL (linkat, int, 1733_GL_CXXALIAS_RPL (linkat, int,
1651 (int fd1, const char *path1, int fd2, const char *path2, 1734 (int fd1, const char *path1, int fd2, const char *path2,
1652 int flag)); 1735 int flag));
@@ -1654,16 +1737,17 @@ _GL_CXXALIAS_RPL (linkat, int,
1654# if !@HAVE_LINKAT@ 1737# if !@HAVE_LINKAT@
1655_GL_FUNCDECL_SYS (linkat, int, 1738_GL_FUNCDECL_SYS (linkat, int,
1656 (int fd1, const char *path1, int fd2, const char *path2, 1739 (int fd1, const char *path1, int fd2, const char *path2,
1657 int flag) 1740 int flag),
1658 _GL_ARG_NONNULL ((2, 4))); 1741 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1659# endif 1742# endif
1660_GL_CXXALIAS_SYS (linkat, int, 1743_GL_CXXALIAS_SYS (linkat, int,
1661 (int fd1, const char *path1, int fd2, const char *path2, 1744 (int fd1, const char *path1, int fd2, const char *path2,
1662 int flag)); 1745 int flag));
1663# endif 1746# endif
1747# if __GLIBC__ >= 2
1664_GL_CXXALIASWARN (linkat); 1748_GL_CXXALIASWARN (linkat);
1749# endif
1665#elif defined GNULIB_POSIXCHECK 1750#elif defined GNULIB_POSIXCHECK
1666# undef linkat
1667# if HAVE_RAW_DECL_LINKAT 1751# if HAVE_RAW_DECL_LINKAT
1668_GL_WARN_ON_USE (linkat, "linkat is unportable - " 1752_GL_WARN_ON_USE (linkat, "linkat is unportable - "
1669 "use gnulib module linkat for portability"); 1753 "use gnulib module linkat for portability");
@@ -1680,7 +1764,7 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1680# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1764# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1681# define lseek rpl_lseek 1765# define lseek rpl_lseek
1682# endif 1766# endif
1683_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1767_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence), );
1684_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1768_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1685# elif defined _WIN32 && !defined __CYGWIN__ 1769# elif defined _WIN32 && !defined __CYGWIN__
1686# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1770# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1693,7 +1777,6 @@ _GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence));
1693# endif 1777# endif
1694_GL_CXXALIASWARN (lseek); 1778_GL_CXXALIASWARN (lseek);
1695#elif defined GNULIB_POSIXCHECK 1779#elif defined GNULIB_POSIXCHECK
1696# undef lseek
1697# if HAVE_RAW_DECL_LSEEK 1780# if HAVE_RAW_DECL_LSEEK
1698_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " 1781_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some "
1699 "systems - use gnulib module lseek for portability"); 1782 "systems - use gnulib module lseek for portability");
@@ -1720,12 +1803,12 @@ _GL_CXXALIASWARN (lseek);
1720 Store the read-end as fd[0] and the write-end as fd[1]. 1803 Store the read-end as fd[0] and the write-end as fd[1].
1721 Return 0 upon success, or -1 with errno set upon failure. */ 1804 Return 0 upon success, or -1 with errno set upon failure. */
1722# if !@HAVE_PIPE@ 1805# if !@HAVE_PIPE@
1723_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); 1806_GL_FUNCDECL_SYS (pipe, int, (int fd[2]),
1807 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1724# endif 1808# endif
1725_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); 1809_GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1726_GL_CXXALIASWARN (pipe); 1810_GL_CXXALIASWARN (pipe);
1727#elif defined GNULIB_POSIXCHECK 1811#elif defined GNULIB_POSIXCHECK
1728# undef pipe
1729# if HAVE_RAW_DECL_PIPE 1812# if HAVE_RAW_DECL_PIPE
1730_GL_WARN_ON_USE (pipe, "pipe is unportable - " 1813_GL_WARN_ON_USE (pipe, "pipe is unportable - "
1731 "use gnulib module pipe-posix for portability"); 1814 "use gnulib module pipe-posix for portability");
@@ -1742,19 +1825,23 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1742 Return 0 upon success, or -1 with errno set upon failure. 1825 Return 0 upon success, or -1 with errno set upon failure.
1743 See also the Linux man page at 1826 See also the Linux man page at
1744 <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ 1827 <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
1745# if @HAVE_PIPE2@ 1828# if @REPLACE_PIPE2@
1746# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1829# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1830# undef pipe2
1747# define pipe2 rpl_pipe2 1831# define pipe2 rpl_pipe2
1748# endif 1832# endif
1749_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1833_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags),
1834 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1750_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); 1835_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1751# else 1836# else
1752_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1837_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags),
1838 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1753_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); 1839_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1754# endif 1840# endif
1841# if __GLIBC__ >= 2
1755_GL_CXXALIASWARN (pipe2); 1842_GL_CXXALIASWARN (pipe2);
1843# endif
1756#elif defined GNULIB_POSIXCHECK 1844#elif defined GNULIB_POSIXCHECK
1757# undef pipe2
1758# if HAVE_RAW_DECL_PIPE2 1845# if HAVE_RAW_DECL_PIPE2
1759_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " 1846_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1760 "use gnulib module pipe2 for portability"); 1847 "use gnulib module pipe2 for portability");
@@ -1774,22 +1861,23 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1774# define pread rpl_pread 1861# define pread rpl_pread
1775# endif 1862# endif
1776_GL_FUNCDECL_RPL (pread, ssize_t, 1863_GL_FUNCDECL_RPL (pread, ssize_t,
1777 (int fd, void *buf, size_t bufsize, off_t offset) 1864 (int fd, void *buf, size_t bufsize, off_t offset),
1778 _GL_ARG_NONNULL ((2))); 1865 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1779_GL_CXXALIAS_RPL (pread, ssize_t, 1866_GL_CXXALIAS_RPL (pread, ssize_t,
1780 (int fd, void *buf, size_t bufsize, off_t offset)); 1867 (int fd, void *buf, size_t bufsize, off_t offset));
1781# else 1868# else
1782# if !@HAVE_PREAD@ 1869# if !@HAVE_PREAD@
1783_GL_FUNCDECL_SYS (pread, ssize_t, 1870_GL_FUNCDECL_SYS (pread, ssize_t,
1784 (int fd, void *buf, size_t bufsize, off_t offset) 1871 (int fd, void *buf, size_t bufsize, off_t offset),
1785 _GL_ARG_NONNULL ((2))); 1872 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1786# endif 1873# endif
1787_GL_CXXALIAS_SYS (pread, ssize_t, 1874_GL_CXXALIAS_SYS (pread, ssize_t,
1788 (int fd, void *buf, size_t bufsize, off_t offset)); 1875 (int fd, void *buf, size_t bufsize, off_t offset));
1789# endif 1876# endif
1877# if __GLIBC__ >= 2
1790_GL_CXXALIASWARN (pread); 1878_GL_CXXALIASWARN (pread);
1879# endif
1791#elif defined GNULIB_POSIXCHECK 1880#elif defined GNULIB_POSIXCHECK
1792# undef pread
1793# if HAVE_RAW_DECL_PREAD 1881# if HAVE_RAW_DECL_PREAD
1794_GL_WARN_ON_USE (pread, "pread is unportable - " 1882_GL_WARN_ON_USE (pread, "pread is unportable - "
1795 "use gnulib module pread for portability"); 1883 "use gnulib module pread for portability");
@@ -1809,22 +1897,23 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
1809# define pwrite rpl_pwrite 1897# define pwrite rpl_pwrite
1810# endif 1898# endif
1811_GL_FUNCDECL_RPL (pwrite, ssize_t, 1899_GL_FUNCDECL_RPL (pwrite, ssize_t,
1812 (int fd, const void *buf, size_t bufsize, off_t offset) 1900 (int fd, const void *buf, size_t bufsize, off_t offset),
1813 _GL_ARG_NONNULL ((2))); 1901 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1814_GL_CXXALIAS_RPL (pwrite, ssize_t, 1902_GL_CXXALIAS_RPL (pwrite, ssize_t,
1815 (int fd, const void *buf, size_t bufsize, off_t offset)); 1903 (int fd, const void *buf, size_t bufsize, off_t offset));
1816# else 1904# else
1817# if !@HAVE_PWRITE@ 1905# if !@HAVE_PWRITE@
1818_GL_FUNCDECL_SYS (pwrite, ssize_t, 1906_GL_FUNCDECL_SYS (pwrite, ssize_t,
1819 (int fd, const void *buf, size_t bufsize, off_t offset) 1907 (int fd, const void *buf, size_t bufsize, off_t offset),
1820 _GL_ARG_NONNULL ((2))); 1908 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1821# endif 1909# endif
1822_GL_CXXALIAS_SYS (pwrite, ssize_t, 1910_GL_CXXALIAS_SYS (pwrite, ssize_t,
1823 (int fd, const void *buf, size_t bufsize, off_t offset)); 1911 (int fd, const void *buf, size_t bufsize, off_t offset));
1824# endif 1912# endif
1913# if __GLIBC__ >= 2
1825_GL_CXXALIASWARN (pwrite); 1914_GL_CXXALIASWARN (pwrite);
1915# endif
1826#elif defined GNULIB_POSIXCHECK 1916#elif defined GNULIB_POSIXCHECK
1827# undef pwrite
1828# if HAVE_RAW_DECL_PWRITE 1917# if HAVE_RAW_DECL_PWRITE
1829_GL_WARN_ON_USE (pwrite, "pwrite is unportable - " 1918_GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1830 "use gnulib module pwrite for portability"); 1919 "use gnulib module pwrite for portability");
@@ -1841,8 +1930,9 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1841# undef read 1930# undef read
1842# define read rpl_read 1931# define read rpl_read
1843# endif 1932# endif
1844_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) 1933
1845 _GL_ARG_NONNULL ((2))); 1934_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count),
1935 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1846_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); 1936_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1847# elif defined _WIN32 && !defined __CYGWIN__ 1937# elif defined _WIN32 && !defined __CYGWIN__
1848# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1938# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1863,11 +1953,7 @@ _GL_CXXALIASWARN (read);
1863# undef read 1953# undef read
1864# define read _read 1954# define read _read
1865# endif 1955# endif
1866# ifdef __MINGW32__ 1956_GL_CXXALIAS_MDA_CAST (read, ssize_t, (int fd, void *buf, unsigned int count));
1867_GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count));
1868# else
1869_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count));
1870# endif
1871# else 1957# else
1872_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); 1958_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
1873# endif 1959# endif
@@ -1887,8 +1973,8 @@ _GL_CXXALIASWARN (read);
1887# endif 1973# endif
1888_GL_FUNCDECL_RPL (readlink, ssize_t, 1974_GL_FUNCDECL_RPL (readlink, ssize_t,
1889 (const char *restrict file, 1975 (const char *restrict file,
1890 char *restrict buf, size_t bufsize) 1976 char *restrict buf, size_t bufsize),
1891 _GL_ARG_NONNULL ((1, 2))); 1977 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1892_GL_CXXALIAS_RPL (readlink, ssize_t, 1978_GL_CXXALIAS_RPL (readlink, ssize_t,
1893 (const char *restrict file, 1979 (const char *restrict file,
1894 char *restrict buf, size_t bufsize)); 1980 char *restrict buf, size_t bufsize));
@@ -1896,8 +1982,8 @@ _GL_CXXALIAS_RPL (readlink, ssize_t,
1896# if !@HAVE_READLINK@ 1982# if !@HAVE_READLINK@
1897_GL_FUNCDECL_SYS (readlink, ssize_t, 1983_GL_FUNCDECL_SYS (readlink, ssize_t,
1898 (const char *restrict file, 1984 (const char *restrict file,
1899 char *restrict buf, size_t bufsize) 1985 char *restrict buf, size_t bufsize),
1900 _GL_ARG_NONNULL ((1, 2))); 1986 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1901# endif 1987# endif
1902_GL_CXXALIAS_SYS (readlink, ssize_t, 1988_GL_CXXALIAS_SYS (readlink, ssize_t,
1903 (const char *restrict file, 1989 (const char *restrict file,
@@ -1905,7 +1991,6 @@ _GL_CXXALIAS_SYS (readlink, ssize_t,
1905# endif 1991# endif
1906_GL_CXXALIASWARN (readlink); 1992_GL_CXXALIASWARN (readlink);
1907#elif defined GNULIB_POSIXCHECK 1993#elif defined GNULIB_POSIXCHECK
1908# undef readlink
1909# if HAVE_RAW_DECL_READLINK 1994# if HAVE_RAW_DECL_READLINK
1910_GL_WARN_ON_USE (readlink, "readlink is unportable - " 1995_GL_WARN_ON_USE (readlink, "readlink is unportable - "
1911 "use gnulib module readlink for portability"); 1996 "use gnulib module readlink for portability");
@@ -1920,8 +2005,8 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1920# endif 2005# endif
1921_GL_FUNCDECL_RPL (readlinkat, ssize_t, 2006_GL_FUNCDECL_RPL (readlinkat, ssize_t,
1922 (int fd, char const *restrict file, 2007 (int fd, char const *restrict file,
1923 char *restrict buf, size_t len) 2008 char *restrict buf, size_t len),
1924 _GL_ARG_NONNULL ((2, 3))); 2009 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
1925_GL_CXXALIAS_RPL (readlinkat, ssize_t, 2010_GL_CXXALIAS_RPL (readlinkat, ssize_t,
1926 (int fd, char const *restrict file, 2011 (int fd, char const *restrict file,
1927 char *restrict buf, size_t len)); 2012 char *restrict buf, size_t len));
@@ -1929,16 +2014,17 @@ _GL_CXXALIAS_RPL (readlinkat, ssize_t,
1929# if !@HAVE_READLINKAT@ 2014# if !@HAVE_READLINKAT@
1930_GL_FUNCDECL_SYS (readlinkat, ssize_t, 2015_GL_FUNCDECL_SYS (readlinkat, ssize_t,
1931 (int fd, char const *restrict file, 2016 (int fd, char const *restrict file,
1932 char *restrict buf, size_t len) 2017 char *restrict buf, size_t len),
1933 _GL_ARG_NONNULL ((2, 3))); 2018 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
1934# endif 2019# endif
1935_GL_CXXALIAS_SYS (readlinkat, ssize_t, 2020_GL_CXXALIAS_SYS (readlinkat, ssize_t,
1936 (int fd, char const *restrict file, 2021 (int fd, char const *restrict file,
1937 char *restrict buf, size_t len)); 2022 char *restrict buf, size_t len));
1938# endif 2023# endif
2024# if __GLIBC__ >= 2
1939_GL_CXXALIASWARN (readlinkat); 2025_GL_CXXALIASWARN (readlinkat);
2026# endif
1940#elif defined GNULIB_POSIXCHECK 2027#elif defined GNULIB_POSIXCHECK
1941# undef readlinkat
1942# if HAVE_RAW_DECL_READLINKAT 2028# if HAVE_RAW_DECL_READLINKAT
1943_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " 2029_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1944 "use gnulib module readlinkat for portability"); 2030 "use gnulib module readlinkat for portability");
@@ -1952,7 +2038,7 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1952# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2038# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1953# define rmdir rpl_rmdir 2039# define rmdir rpl_rmdir
1954# endif 2040# endif
1955_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); 2041_GL_FUNCDECL_RPL (rmdir, int, (char const *name), _GL_ARG_NONNULL ((1)));
1956_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); 2042_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1957# elif defined _WIN32 && !defined __CYGWIN__ 2043# elif defined _WIN32 && !defined __CYGWIN__
1958# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2044# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1965,7 +2051,6 @@ _GL_CXXALIAS_SYS (rmdir, int, (char const *name));
1965# endif 2051# endif
1966_GL_CXXALIASWARN (rmdir); 2052_GL_CXXALIASWARN (rmdir);
1967#elif defined GNULIB_POSIXCHECK 2053#elif defined GNULIB_POSIXCHECK
1968# undef rmdir
1969# if HAVE_RAW_DECL_RMDIR 2054# if HAVE_RAW_DECL_RMDIR
1970_GL_WARN_ON_USE (rmdir, "rmdir is unportable - " 2055_GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
1971 "use gnulib module rmdir for portability"); 2056 "use gnulib module rmdir for portability");
@@ -1996,17 +2081,32 @@ _GL_CXXALIASWARN (rmdir);
1996 2081
1997 Platforms with no ability to set the hostname return -1 and set 2082 Platforms with no ability to set the hostname return -1 and set
1998 errno = ENOSYS. */ 2083 errno = ENOSYS. */
1999# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ 2084# if @REPLACE_SETHOSTNAME@
2000_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) 2085# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2001 _GL_ARG_NONNULL ((1))); 2086# undef sethostname
2087# define sethostname rpl_sethostname
2088# endif
2089_GL_FUNCDECL_RPL (sethostname, int,
2090 (const char *name, size_t len),
2091 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2092_GL_CXXALIAS_RPL (sethostname, int,
2093 (const char *name, size_t len));
2094# else
2095# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
2096_GL_FUNCDECL_SYS (sethostname, int,
2097 (const char *name, size_t len),
2098 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2099# endif
2100/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, and FreeBSD 6.4
2101 the second parameter is int. On Solaris 11 2011-10, the first parameter is
2102 not const. */
2103_GL_CXXALIAS_SYS_CAST (sethostname, int,
2104 (const char *name, size_t len));
2002# endif 2105# endif
2003/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 2106# if __GLIBC__ >= 2
2004 and FreeBSD 6.4 the second parameter is int. On Solaris 11
2005 2011-10, the first parameter is not const. */
2006_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
2007_GL_CXXALIASWARN (sethostname); 2107_GL_CXXALIASWARN (sethostname);
2108# endif
2008#elif defined GNULIB_POSIXCHECK 2109#elif defined GNULIB_POSIXCHECK
2009# undef sethostname
2010# if HAVE_RAW_DECL_SETHOSTNAME 2110# if HAVE_RAW_DECL_SETHOSTNAME
2011_GL_WARN_ON_USE (sethostname, "sethostname is unportable - " 2111_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
2012 "use gnulib module sethostname for portability"); 2112 "use gnulib module sethostname for portability");
@@ -2024,17 +2124,16 @@ _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
2024# undef sleep 2124# undef sleep
2025# define sleep rpl_sleep 2125# define sleep rpl_sleep
2026# endif 2126# endif
2027_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); 2127_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n), );
2028_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); 2128_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
2029# else 2129# else
2030# if !@HAVE_SLEEP@ 2130# if !@HAVE_SLEEP@
2031_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); 2131_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n), );
2032# endif 2132# endif
2033_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); 2133_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
2034# endif 2134# endif
2035_GL_CXXALIASWARN (sleep); 2135_GL_CXXALIASWARN (sleep);
2036#elif defined GNULIB_POSIXCHECK 2136#elif defined GNULIB_POSIXCHECK
2037# undef sleep
2038# if HAVE_RAW_DECL_SLEEP 2137# if HAVE_RAW_DECL_SLEEP
2039_GL_WARN_ON_USE (sleep, "sleep is unportable - " 2138_GL_WARN_ON_USE (sleep, "sleep is unportable - "
2040 "use gnulib module sleep for portability"); 2139 "use gnulib module sleep for portability");
@@ -2073,19 +2172,22 @@ _GL_CXXALIASWARN (swab);
2073# undef symlink 2172# undef symlink
2074# define symlink rpl_symlink 2173# define symlink rpl_symlink
2075# endif 2174# endif
2076_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) 2175_GL_FUNCDECL_RPL (symlink, int,
2077 _GL_ARG_NONNULL ((1, 2))); 2176 (char const *contents, char const *file),
2078_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); 2177 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
2178_GL_CXXALIAS_RPL (symlink, int,
2179 (char const *contents, char const *file));
2079# else 2180# else
2080# if !@HAVE_SYMLINK@ 2181# if !@HAVE_SYMLINK@
2081_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) 2182_GL_FUNCDECL_SYS (symlink, int,
2082 _GL_ARG_NONNULL ((1, 2))); 2183 (char const *contents, char const *file),
2184 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
2083# endif 2185# endif
2084_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); 2186_GL_CXXALIAS_SYS (symlink, int,
2187 (char const *contents, char const *file));
2085# endif 2188# endif
2086_GL_CXXALIASWARN (symlink); 2189_GL_CXXALIASWARN (symlink);
2087#elif defined GNULIB_POSIXCHECK 2190#elif defined GNULIB_POSIXCHECK
2088# undef symlink
2089# if HAVE_RAW_DECL_SYMLINK 2191# if HAVE_RAW_DECL_SYMLINK
2090_GL_WARN_ON_USE (symlink, "symlink is not portable - " 2192_GL_WARN_ON_USE (symlink, "symlink is not portable - "
2091 "use gnulib module symlink for portability"); 2193 "use gnulib module symlink for portability");
@@ -2100,22 +2202,23 @@ _GL_WARN_ON_USE (symlink, "symlink is not portable - "
2100# define symlinkat rpl_symlinkat 2202# define symlinkat rpl_symlinkat
2101# endif 2203# endif
2102_GL_FUNCDECL_RPL (symlinkat, int, 2204_GL_FUNCDECL_RPL (symlinkat, int,
2103 (char const *contents, int fd, char const *file) 2205 (char const *contents, int fd, char const *file),
2104 _GL_ARG_NONNULL ((1, 3))); 2206 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2105_GL_CXXALIAS_RPL (symlinkat, int, 2207_GL_CXXALIAS_RPL (symlinkat, int,
2106 (char const *contents, int fd, char const *file)); 2208 (char const *contents, int fd, char const *file));
2107# else 2209# else
2108# if !@HAVE_SYMLINKAT@ 2210# if !@HAVE_SYMLINKAT@
2109_GL_FUNCDECL_SYS (symlinkat, int, 2211_GL_FUNCDECL_SYS (symlinkat, int,
2110 (char const *contents, int fd, char const *file) 2212 (char const *contents, int fd, char const *file),
2111 _GL_ARG_NONNULL ((1, 3))); 2213 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2112# endif 2214# endif
2113_GL_CXXALIAS_SYS (symlinkat, int, 2215_GL_CXXALIAS_SYS (symlinkat, int,
2114 (char const *contents, int fd, char const *file)); 2216 (char const *contents, int fd, char const *file));
2115# endif 2217# endif
2218# if __GLIBC__ >= 2
2116_GL_CXXALIASWARN (symlinkat); 2219_GL_CXXALIASWARN (symlinkat);
2220# endif
2117#elif defined GNULIB_POSIXCHECK 2221#elif defined GNULIB_POSIXCHECK
2118# undef symlinkat
2119# if HAVE_RAW_DECL_SYMLINKAT 2222# if HAVE_RAW_DECL_SYMLINKAT
2120_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " 2223_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
2121 "use gnulib module symlinkat for portability"); 2224 "use gnulib module symlinkat for portability");
@@ -2133,19 +2236,20 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
2133# undef truncate 2236# undef truncate
2134# define truncate rpl_truncate 2237# define truncate rpl_truncate
2135# endif 2238# endif
2136_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) 2239_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length),
2137 _GL_ARG_NONNULL ((1))); 2240 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2138_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); 2241_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
2139# else 2242# else
2140# if !@HAVE_DECL_TRUNCATE@ 2243# if !@HAVE_DECL_TRUNCATE@
2141_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) 2244_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length),
2142 _GL_ARG_NONNULL ((1))); 2245 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2143# endif 2246# endif
2144_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); 2247_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
2145# endif 2248# endif
2249# if __GLIBC__ >= 2
2146_GL_CXXALIASWARN (truncate); 2250_GL_CXXALIASWARN (truncate);
2251# endif
2147#elif defined GNULIB_POSIXCHECK 2252#elif defined GNULIB_POSIXCHECK
2148# undef truncate
2149# if HAVE_RAW_DECL_TRUNCATE 2253# if HAVE_RAW_DECL_TRUNCATE
2150_GL_WARN_ON_USE (truncate, "truncate is unportable - " 2254_GL_WARN_ON_USE (truncate, "truncate is unportable - "
2151 "use gnulib module truncate for portability"); 2255 "use gnulib module truncate for portability");
@@ -2162,20 +2266,23 @@ _GL_WARN_ON_USE (truncate, "truncate is unportable - "
2162# define ttyname_r rpl_ttyname_r 2266# define ttyname_r rpl_ttyname_r
2163# endif 2267# endif
2164_GL_FUNCDECL_RPL (ttyname_r, int, 2268_GL_FUNCDECL_RPL (ttyname_r, int,
2165 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2269 (int fd, char *buf, size_t buflen),
2270 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2166_GL_CXXALIAS_RPL (ttyname_r, int, 2271_GL_CXXALIAS_RPL (ttyname_r, int,
2167 (int fd, char *buf, size_t buflen)); 2272 (int fd, char *buf, size_t buflen));
2168# else 2273# else
2169# if !@HAVE_DECL_TTYNAME_R@ 2274# if !@HAVE_DECL_TTYNAME_R@
2170_GL_FUNCDECL_SYS (ttyname_r, int, 2275_GL_FUNCDECL_SYS (ttyname_r, int,
2171 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2276 (int fd, char *buf, size_t buflen),
2277 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2172# endif 2278# endif
2173_GL_CXXALIAS_SYS (ttyname_r, int, 2279_GL_CXXALIAS_SYS (ttyname_r, int,
2174 (int fd, char *buf, size_t buflen)); 2280 (int fd, char *buf, size_t buflen));
2175# endif 2281# endif
2282# if __GLIBC__ >= 2
2176_GL_CXXALIASWARN (ttyname_r); 2283_GL_CXXALIASWARN (ttyname_r);
2284# endif
2177#elif defined GNULIB_POSIXCHECK 2285#elif defined GNULIB_POSIXCHECK
2178# undef ttyname_r
2179# if HAVE_RAW_DECL_TTYNAME_R 2286# if HAVE_RAW_DECL_TTYNAME_R
2180_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " 2287_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
2181 "use gnulib module ttyname_r for portability"); 2288 "use gnulib module ttyname_r for portability");
@@ -2189,7 +2296,7 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
2189# undef unlink 2296# undef unlink
2190# define unlink rpl_unlink 2297# define unlink rpl_unlink
2191# endif 2298# endif
2192_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); 2299_GL_FUNCDECL_RPL (unlink, int, (char const *file), _GL_ARG_NONNULL ((1)));
2193_GL_CXXALIAS_RPL (unlink, int, (char const *file)); 2300_GL_CXXALIAS_RPL (unlink, int, (char const *file));
2194# elif defined _WIN32 && !defined __CYGWIN__ 2301# elif defined _WIN32 && !defined __CYGWIN__
2195# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2302# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2202,7 +2309,6 @@ _GL_CXXALIAS_SYS (unlink, int, (char const *file));
2202# endif 2309# endif
2203_GL_CXXALIASWARN (unlink); 2310_GL_CXXALIASWARN (unlink);
2204#elif defined GNULIB_POSIXCHECK 2311#elif defined GNULIB_POSIXCHECK
2205# undef unlink
2206# if HAVE_RAW_DECL_UNLINK 2312# if HAVE_RAW_DECL_UNLINK
2207_GL_WARN_ON_USE (unlink, "unlink is not portable - " 2313_GL_WARN_ON_USE (unlink, "unlink is not portable - "
2208 "use gnulib module unlink for portability"); 2314 "use gnulib module unlink for portability");
@@ -2230,19 +2336,18 @@ _GL_CXXALIASWARN (unlink);
2230# undef unlinkat 2336# undef unlinkat
2231# define unlinkat rpl_unlinkat 2337# define unlinkat rpl_unlinkat
2232# endif 2338# endif
2233_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) 2339_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag),
2234 _GL_ARG_NONNULL ((2))); 2340 _GL_ARG_NONNULL ((2)));
2235_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); 2341_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
2236# else 2342# else
2237# if !@HAVE_UNLINKAT@ 2343# if !@HAVE_UNLINKAT@
2238_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) 2344_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag),
2239 _GL_ARG_NONNULL ((2))); 2345 _GL_ARG_NONNULL ((2)));
2240# endif 2346# endif
2241_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); 2347_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
2242# endif 2348# endif
2243_GL_CXXALIASWARN (unlinkat); 2349_GL_CXXALIASWARN (unlinkat);
2244#elif defined GNULIB_POSIXCHECK 2350#elif defined GNULIB_POSIXCHECK
2245# undef unlinkat
2246# if HAVE_RAW_DECL_UNLINKAT 2351# if HAVE_RAW_DECL_UNLINKAT
2247_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " 2352_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
2248 "use gnulib module unlinkat for portability"); 2353 "use gnulib module unlinkat for portability");
@@ -2253,18 +2358,18 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
2253#if @GNULIB_USLEEP@ 2358#if @GNULIB_USLEEP@
2254/* Pause the execution of the current thread for N microseconds. 2359/* Pause the execution of the current thread for N microseconds.
2255 Returns 0 on completion, or -1 on range error. 2360 Returns 0 on completion, or -1 on range error.
2256 See the POSIX:2001 specification 2361 See the POSIX.1-2004 specification
2257 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ 2362 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
2258# if @REPLACE_USLEEP@ 2363# if @REPLACE_USLEEP@
2259# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2364# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2260# undef usleep 2365# undef usleep
2261# define usleep rpl_usleep 2366# define usleep rpl_usleep
2262# endif 2367# endif
2263_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); 2368_GL_FUNCDECL_RPL (usleep, int, (useconds_t n), );
2264_GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); 2369_GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
2265# else 2370# else
2266# if !@HAVE_USLEEP@ 2371# if !@HAVE_USLEEP@
2267_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); 2372_GL_FUNCDECL_SYS (usleep, int, (useconds_t n), );
2268# endif 2373# endif
2269/* Need to cast, because on Haiku, the first parameter is 2374/* Need to cast, because on Haiku, the first parameter is
2270 unsigned int n. */ 2375 unsigned int n. */
@@ -2272,7 +2377,6 @@ _GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n));
2272# endif 2377# endif
2273_GL_CXXALIASWARN (usleep); 2378_GL_CXXALIASWARN (usleep);
2274#elif defined GNULIB_POSIXCHECK 2379#elif defined GNULIB_POSIXCHECK
2275# undef usleep
2276# if HAVE_RAW_DECL_USLEEP 2380# if HAVE_RAW_DECL_USLEEP
2277_GL_WARN_ON_USE (usleep, "usleep is unportable - " 2381_GL_WARN_ON_USE (usleep, "usleep is unportable - "
2278 "use gnulib module usleep for portability"); 2382 "use gnulib module usleep for portability");
@@ -2289,17 +2393,21 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
2289# undef write 2393# undef write
2290# define write rpl_write 2394# define write rpl_write
2291# endif 2395# endif
2292_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) 2396_GL_FUNCDECL_RPL (write, ssize_t,
2293 _GL_ARG_NONNULL ((2))); 2397 (int fd, const void *buf, size_t count),
2294_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); 2398 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2399_GL_CXXALIAS_RPL (write, ssize_t,
2400 (int fd, const void *buf, size_t count));
2295# elif defined _WIN32 && !defined __CYGWIN__ 2401# elif defined _WIN32 && !defined __CYGWIN__
2296# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2402# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2297# undef write 2403# undef write
2298# define write _write 2404# define write _write
2299# endif 2405# endif
2300_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count)); 2406_GL_CXXALIAS_MDA (write, ssize_t,
2407 (int fd, const void *buf, size_t count));
2301# else 2408# else
2302_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2409_GL_CXXALIAS_SYS (write, ssize_t,
2410 (int fd, const void *buf, size_t count));
2303# endif 2411# endif
2304_GL_CXXALIASWARN (write); 2412_GL_CXXALIASWARN (write);
2305#elif @GNULIB_MDA_WRITE@ 2413#elif @GNULIB_MDA_WRITE@
@@ -2311,19 +2419,29 @@ _GL_CXXALIASWARN (write);
2311# undef write 2419# undef write
2312# define write _write 2420# define write _write
2313# endif 2421# endif
2314# ifdef __MINGW32__ 2422_GL_CXXALIAS_MDA_CAST (write, ssize_t,
2315_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count)); 2423 (int fd, const void *buf, unsigned int count));
2316# else
2317_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count));
2318# endif
2319# else 2424# else
2320_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2425_GL_CXXALIAS_SYS (write, ssize_t,
2426 (int fd, const void *buf, size_t count));
2321# endif 2427# endif
2322_GL_CXXALIASWARN (write); 2428_GL_CXXALIASWARN (write);
2323#endif 2429#endif
2324 2430
2325_GL_INLINE_HEADER_END 2431_GL_INLINE_HEADER_END
2326 2432
2433
2434/* Includes that provide only macros that don't need to be overridden.
2435 (Includes that are needed for type definitions and function declarations
2436 have their place above, before the function overrides.) */
2437
2438/* FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, and glibc 2.41
2439 do not define O_CLOEXEC in <unistd.h>. */
2440#if ! defined O_CLOEXEC
2441# include <fcntl.h>
2442#endif
2443
2444
2327#endif /* _@GUARD_PREFIX@_UNISTD_H */ 2445#endif /* _@GUARD_PREFIX@_UNISTD_H */
2328#endif /* _GL_INCLUDING_UNISTD_H */ 2446#endif /* _GL_INCLUDING_UNISTD_H */
2329#endif /* _@GUARD_PREFIX@_UNISTD_H */ 2447#endif /* _@GUARD_PREFIX@_UNISTD_H */