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.h561
1 files changed, 365 insertions, 196 deletions
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index 4812fdb1..9f057d30 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-2025 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,24 @@
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
107/* FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, and glibc 2.41
108 do not define O_CLOEXEC in <unistd.h>. */
74/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in 109/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
75 <unistd.h>. */ 110 <unistd.h>. */
76/* But avoid namespace pollution on glibc systems. */ 111/* But avoid namespace pollution on glibc systems. */
77#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ 112#if ! defined O_CLOEXEC \
78 && (defined __CYGWIN__ || defined __ANDROID__) \ 113 || ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
79 && ! defined __GLIBC__ 114 && (defined __CYGWIN__ || defined __ANDROID__) \
115 && ! defined __GLIBC__)
80# include <fcntl.h> 116# include <fcntl.h>
81#endif 117#endif
82 118
@@ -93,15 +129,6 @@
93# undef __need_system_stdlib_h 129# undef __need_system_stdlib_h
94#endif 130#endif
95 131
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>. */ 132/* Native Windows platforms declare _execl*, _execv* in <process.h>. */
106#if defined _WIN32 && !defined __CYGWIN__ 133#if defined _WIN32 && !defined __CYGWIN__
107# include <process.h> 134# include <process.h>
@@ -135,8 +162,9 @@
135#endif 162#endif
136 163
137/* MSVC defines off_t in <sys/types.h>. 164/* MSVC defines off_t in <sys/types.h>.
138 May also define off_t to a 64-bit type on native Windows. */ 165 May also define off_t to a 64-bit type on native Windows.
139/* Get off_t, ssize_t, mode_t. */ 166 Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */
167/* Get off_t, off64_t, ssize_t, mode_t. */
140#include <sys/types.h> 168#include <sys/types.h>
141 169
142/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 170/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -152,13 +180,13 @@
152# include <getopt-pfx-core.h> 180# include <getopt-pfx-core.h>
153#endif 181#endif
154 182
155#ifndef _GL_INLINE_HEADER_BEGIN
156 #error "Please include config.h first."
157#endif
158_GL_INLINE_HEADER_BEGIN 183_GL_INLINE_HEADER_BEGIN
159#ifndef _GL_UNISTD_INLINE 184#ifndef _GL_UNISTD_INLINE
160# define _GL_UNISTD_INLINE _GL_INLINE 185# define _GL_UNISTD_INLINE _GL_INLINE
161#endif 186#endif
187#ifndef _GL_GETPAGESIZE_INLINE
188# define _GL_GETPAGESIZE_INLINE _GL_INLINE
189#endif
162 190
163/* Hide some function declarations from <winsock2.h>. */ 191/* Hide some function declarations from <winsock2.h>. */
164 192
@@ -265,7 +293,7 @@ _GL_INLINE_HEADER_BEGIN
265# undef access 293# undef access
266# define access rpl_access 294# define access rpl_access
267# endif 295# endif
268_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) 296_GL_FUNCDECL_RPL (access, int, (const char *file, int mode),
269 _GL_ARG_NONNULL ((1))); 297 _GL_ARG_NONNULL ((1)));
270_GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); 298_GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
271# elif defined _WIN32 && !defined __CYGWIN__ 299# elif defined _WIN32 && !defined __CYGWIN__
@@ -318,7 +346,7 @@ _GL_CXXALIASWARN (chdir);
318#elif defined GNULIB_POSIXCHECK 346#elif defined GNULIB_POSIXCHECK
319# undef chdir 347# undef chdir
320# if HAVE_RAW_DECL_CHDIR 348# if HAVE_RAW_DECL_CHDIR
321_GL_WARN_ON_USE (chown, "chdir is not always in <unistd.h> - " 349_GL_WARN_ON_USE (chdir, "chdir is not always in <unistd.h> - "
322 "use gnulib module chdir for portability"); 350 "use gnulib module chdir for portability");
323# endif 351# endif
324#elif @GNULIB_MDA_CHDIR@ 352#elif @GNULIB_MDA_CHDIR@
@@ -349,13 +377,13 @@ _GL_CXXALIASWARN (chdir);
349# undef chown 377# undef chown
350# define chown rpl_chown 378# define chown rpl_chown
351# endif 379# endif
352_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid) 380_GL_FUNCDECL_RPL (chown, int, (const char *file, uid_t uid, gid_t gid),
353 _GL_ARG_NONNULL ((1))); 381 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
354_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid)); 382_GL_CXXALIAS_RPL (chown, int, (const char *file, uid_t uid, gid_t gid));
355# else 383# else
356# if !@HAVE_CHOWN@ 384# if !@HAVE_CHOWN@
357_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid) 385_GL_FUNCDECL_SYS (chown, int, (const char *file, uid_t uid, gid_t gid),
358 _GL_ARG_NONNULL ((1))); 386 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
359# endif 387# endif
360_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid)); 388_GL_CXXALIAS_SYS (chown, int, (const char *file, uid_t uid, gid_t gid));
361# endif 389# endif
@@ -377,7 +405,7 @@ _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
377# undef close 405# undef close
378# define close rpl_close 406# define close rpl_close
379# endif 407# endif
380_GL_FUNCDECL_RPL (close, int, (int fd)); 408_GL_FUNCDECL_RPL (close, int, (int fd), );
381_GL_CXXALIAS_RPL (close, int, (int fd)); 409_GL_CXXALIAS_RPL (close, int, (int fd));
382# elif defined _WIN32 && !defined __CYGWIN__ 410# elif defined _WIN32 && !defined __CYGWIN__
383# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 411# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -390,8 +418,10 @@ _GL_CXXALIAS_SYS (close, int, (int fd));
390# endif 418# endif
391_GL_CXXALIASWARN (close); 419_GL_CXXALIASWARN (close);
392#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ 420#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
393# undef close 421# if !GNULIB_CLOSE
394# define close close_used_without_requesting_gnulib_module_close 422# undef close
423# define close close_used_without_requesting_gnulib_module_close
424# endif
395#elif defined GNULIB_POSIXCHECK 425#elif defined GNULIB_POSIXCHECK
396# undef close 426# undef close
397/* Assume close is always declared. */ 427/* Assume close is always declared. */
@@ -422,7 +452,7 @@ _GL_CXXALIASWARN (close);
422# endif 452# endif
423_GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, 453_GL_FUNCDECL_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
424 int ofd, off_t *opos, 454 int ofd, off_t *opos,
425 size_t len, unsigned flags)); 455 size_t len, unsigned flags), );
426_GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos, 456_GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
427 int ofd, off_t *opos, 457 int ofd, off_t *opos,
428 size_t len, unsigned flags)); 458 size_t len, unsigned flags));
@@ -430,13 +460,15 @@ _GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
430# if !@HAVE_COPY_FILE_RANGE@ 460# if !@HAVE_COPY_FILE_RANGE@
431_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 461_GL_FUNCDECL_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
432 int ofd, off_t *opos, 462 int ofd, off_t *opos,
433 size_t len, unsigned flags)); 463 size_t len, unsigned flags), );
434# endif 464# endif
435_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos, 465_GL_CXXALIAS_SYS (copy_file_range, ssize_t, (int ifd, off_t *ipos,
436 int ofd, off_t *opos, 466 int ofd, off_t *opos,
437 size_t len, unsigned flags)); 467 size_t len, unsigned flags));
438# endif 468# endif
469# if __GLIBC__ >= 2
439_GL_CXXALIASWARN (copy_file_range); 470_GL_CXXALIASWARN (copy_file_range);
471# endif
440#elif defined GNULIB_POSIXCHECK 472#elif defined GNULIB_POSIXCHECK
441# undef copy_file_range 473# undef copy_file_range
442# if HAVE_RAW_DECL_COPY_FILE_RANGE 474# if HAVE_RAW_DECL_COPY_FILE_RANGE
@@ -452,7 +484,7 @@ _GL_WARN_ON_USE (copy_file_range,
452# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 484# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
453# define dup rpl_dup 485# define dup rpl_dup
454# endif 486# endif
455_GL_FUNCDECL_RPL (dup, int, (int oldfd)); 487_GL_FUNCDECL_RPL (dup, int, (int oldfd), _GL_ATTRIBUTE_NODISCARD);
456_GL_CXXALIAS_RPL (dup, int, (int oldfd)); 488_GL_CXXALIAS_RPL (dup, int, (int oldfd));
457# elif defined _WIN32 && !defined __CYGWIN__ 489# elif defined _WIN32 && !defined __CYGWIN__
458# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 490# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -497,7 +529,7 @@ _GL_CXXALIASWARN (dup);
497# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 529# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
498# define dup2 rpl_dup2 530# define dup2 rpl_dup2
499# endif 531# endif
500_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); 532_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd), );
501_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); 533_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
502# elif defined _WIN32 && !defined __CYGWIN__ 534# elif defined _WIN32 && !defined __CYGWIN__
503# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 535# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -541,17 +573,22 @@ _GL_CXXALIASWARN (dup2);
541 Return newfd if successful, otherwise -1 and errno set. 573 Return newfd if successful, otherwise -1 and errno set.
542 See the Linux man page at 574 See the Linux man page at
543 <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */ 575 <https://www.kernel.org/doc/man-pages/online/pages/man2/dup3.2.html>. */
544# if @HAVE_DUP3@ 576# if @REPLACE_DUP3@
545# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 577# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
578# undef dup3
546# define dup3 rpl_dup3 579# define dup3 rpl_dup3
547# endif 580# endif
548_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); 581_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags), );
549_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); 582_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
550# else 583# else
551_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); 584# if !@HAVE_DUP3@
585_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags), );
586# endif
552_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); 587_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
553# endif 588# endif
589# if __GLIBC__ >= 2
554_GL_CXXALIASWARN (dup3); 590_GL_CXXALIASWARN (dup3);
591# endif
555#elif defined GNULIB_POSIXCHECK 592#elif defined GNULIB_POSIXCHECK
556# undef dup3 593# undef dup3
557# if HAVE_RAW_DECL_DUP3 594# if HAVE_RAW_DECL_DUP3
@@ -610,7 +647,7 @@ rpl_environ (void)
610/* Like access(), except that it uses the effective user id and group id of 647/* Like access(), except that it uses the effective user id and group id of
611 the current process. */ 648 the current process. */
612# if !@HAVE_EUIDACCESS@ 649# if !@HAVE_EUIDACCESS@
613_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) 650_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode),
614 _GL_ARG_NONNULL ((1))); 651 _GL_ARG_NONNULL ((1)));
615# endif 652# endif
616_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); 653_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
@@ -635,7 +672,7 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
635# undef execl 672# undef execl
636# define execl rpl_execl 673# define execl rpl_execl
637# endif 674# endif
638_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...) 675_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...),
639 _GL_ARG_NONNULL ((1))); 676 _GL_ARG_NONNULL ((1)));
640_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...)); 677_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
641# else 678# else
@@ -670,7 +707,7 @@ _GL_CXXALIASWARN (execl);
670# undef execle 707# undef execle
671# define execle rpl_execle 708# define execle rpl_execle
672# endif 709# endif
673_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...) 710_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...),
674 _GL_ARG_NONNULL ((1))); 711 _GL_ARG_NONNULL ((1)));
675_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...)); 712_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
676# else 713# else
@@ -706,7 +743,7 @@ _GL_CXXALIASWARN (execle);
706# undef execlp 743# undef execlp
707# define execlp rpl_execlp 744# define execlp rpl_execlp
708# endif 745# endif
709_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...) 746_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...),
710 _GL_ARG_NONNULL ((1))); 747 _GL_ARG_NONNULL ((1)));
711_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...)); 748_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
712# else 749# else
@@ -743,7 +780,7 @@ _GL_CXXALIASWARN (execlp);
743# undef execv 780# undef execv
744# define execv rpl_execv 781# define execv rpl_execv
745# endif 782# endif
746_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv) 783_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv),
747 _GL_ARG_NONNULL ((1, 2))); 784 _GL_ARG_NONNULL ((1, 2)));
748_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv)); 785_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
749# else 786# else
@@ -780,7 +817,7 @@ _GL_CXXALIASWARN (execv);
780# define execve rpl_execve 817# define execve rpl_execve
781# endif 818# endif
782_GL_FUNCDECL_RPL (execve, int, 819_GL_FUNCDECL_RPL (execve, int,
783 (const char *program, char * const *argv, char * const *env) 820 (const char *program, char * const *argv, char * const *env),
784 _GL_ARG_NONNULL ((1, 2))); 821 _GL_ARG_NONNULL ((1, 2)));
785_GL_CXXALIAS_RPL (execve, int, 822_GL_CXXALIAS_RPL (execve, int,
786 (const char *program, char * const *argv, char * const *env)); 823 (const char *program, char * const *argv, char * const *env));
@@ -820,7 +857,7 @@ _GL_CXXALIASWARN (execve);
820# undef execvp 857# undef execvp
821# define execvp rpl_execvp 858# define execvp rpl_execvp
822# endif 859# endif
823_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv) 860_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv),
824 _GL_ARG_NONNULL ((1, 2))); 861 _GL_ARG_NONNULL ((1, 2)));
825_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv)); 862_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
826# else 863# else
@@ -857,20 +894,22 @@ _GL_CXXALIASWARN (execvp);
857# define execvpe rpl_execvpe 894# define execvpe rpl_execvpe
858# endif 895# endif
859_GL_FUNCDECL_RPL (execvpe, int, 896_GL_FUNCDECL_RPL (execvpe, int,
860 (const char *program, char * const *argv, char * const *env) 897 (const char *program, char * const *argv, char * const *env),
861 _GL_ARG_NONNULL ((1, 2))); 898 _GL_ARG_NONNULL ((1, 2)));
862_GL_CXXALIAS_RPL (execvpe, int, 899_GL_CXXALIAS_RPL (execvpe, int,
863 (const char *program, char * const *argv, char * const *env)); 900 (const char *program, char * const *argv, char * const *env));
864# else 901# else
865# if !@HAVE_DECL_EXECVPE@ 902# if !@HAVE_DECL_EXECVPE@
866_GL_FUNCDECL_SYS (execvpe, int, 903_GL_FUNCDECL_SYS (execvpe, int,
867 (const char *program, char * const *argv, char * const *env) 904 (const char *program, char * const *argv, char * const *env),
868 _GL_ARG_NONNULL ((1, 2))); 905 _GL_ARG_NONNULL ((1, 2)));
869# endif 906# endif
870_GL_CXXALIAS_SYS (execvpe, int, 907_GL_CXXALIAS_SYS (execvpe, int,
871 (const char *program, char * const *argv, char * const *env)); 908 (const char *program, char * const *argv, char * const *env));
872# endif 909# endif
910# if __GLIBC__ >= 2
873_GL_CXXALIASWARN (execvpe); 911_GL_CXXALIASWARN (execvpe);
912# endif
874#elif defined GNULIB_POSIXCHECK 913#elif defined GNULIB_POSIXCHECK
875# undef execvpe 914# undef execvpe
876# if HAVE_RAW_DECL_EXECVPE 915# if HAVE_RAW_DECL_EXECVPE
@@ -893,7 +932,7 @@ _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
893# elif @HAVE_EXECVPE@ 932# elif @HAVE_EXECVPE@
894# if !@HAVE_DECL_EXECVPE@ 933# if !@HAVE_DECL_EXECVPE@
895_GL_FUNCDECL_SYS (execvpe, int, 934_GL_FUNCDECL_SYS (execvpe, int,
896 (const char *program, char * const *argv, char * const *env) 935 (const char *program, char * const *argv, char * const *env),
897 _GL_ARG_NONNULL ((1, 2))); 936 _GL_ARG_NONNULL ((1, 2)));
898# endif 937# endif
899_GL_CXXALIAS_SYS (execvpe, int, 938_GL_CXXALIAS_SYS (execvpe, int,
@@ -912,20 +951,22 @@ _GL_CXXALIASWARN (execvpe);
912# define faccessat rpl_faccessat 951# define faccessat rpl_faccessat
913# endif 952# endif
914_GL_FUNCDECL_RPL (faccessat, int, 953_GL_FUNCDECL_RPL (faccessat, int,
915 (int fd, char const *name, int mode, int flag) 954 (int fd, char const *name, int mode, int flag),
916 _GL_ARG_NONNULL ((2))); 955 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
917_GL_CXXALIAS_RPL (faccessat, int, 956_GL_CXXALIAS_RPL (faccessat, int,
918 (int fd, char const *name, int mode, int flag)); 957 (int fd, char const *name, int mode, int flag));
919# else 958# else
920# if !@HAVE_FACCESSAT@ 959# if !@HAVE_FACCESSAT@
921_GL_FUNCDECL_SYS (faccessat, int, 960_GL_FUNCDECL_SYS (faccessat, int,
922 (int fd, char const *file, int mode, int flag) 961 (int fd, char const *file, int mode, int flag),
923 _GL_ARG_NONNULL ((2))); 962 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
924# endif 963# endif
925_GL_CXXALIAS_SYS (faccessat, int, 964_GL_CXXALIAS_SYS (faccessat, int,
926 (int fd, char const *file, int mode, int flag)); 965 (int fd, char const *file, int mode, int flag));
927# endif 966# endif
967# if __GLIBC__ >= 2
928_GL_CXXALIASWARN (faccessat); 968_GL_CXXALIASWARN (faccessat);
969# endif
929#elif defined GNULIB_POSIXCHECK 970#elif defined GNULIB_POSIXCHECK
930# undef faccessat 971# undef faccessat
931# if HAVE_RAW_DECL_FACCESSAT 972# if HAVE_RAW_DECL_FACCESSAT
@@ -941,23 +982,28 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
941 Return 0 if successful, otherwise -1 and errno set. 982 Return 0 if successful, otherwise -1 and errno set.
942 See the POSIX:2008 specification 983 See the POSIX:2008 specification
943 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */ 984 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchdir.html>. */
944# if ! @HAVE_FCHDIR@ 985# if @REPLACE_FCHDIR@
945_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 986# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
946 987# undef fchdir
988# define fchdir rpl_fchdir
989# endif
990_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
991_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/));
992# else
993# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@
994_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
995# endif
996_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
997# endif
998_GL_CXXALIASWARN (fchdir);
999# if @REPLACE_FCHDIR@ || !@HAVE_FCHDIR@
947/* Gnulib internal hooks needed to maintain the fchdir metadata. */ 1000/* Gnulib internal hooks needed to maintain the fchdir metadata. */
948_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) 1001_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename)
949 _GL_ARG_NONNULL ((2)); 1002 _GL_ARG_NONNULL ((2));
950_GL_EXTERN_C void _gl_unregister_fd (int fd); 1003_GL_EXTERN_C void _gl_unregister_fd (int fd);
951_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); 1004_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd);
952_GL_EXTERN_C const char *_gl_directory_name (int fd); 1005_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 1006# endif
959_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
960_GL_CXXALIASWARN (fchdir);
961#elif defined GNULIB_POSIXCHECK 1007#elif defined GNULIB_POSIXCHECK
962# undef fchdir 1008# undef fchdir
963# if HAVE_RAW_DECL_FCHDIR 1009# if HAVE_RAW_DECL_FCHDIR
@@ -974,15 +1020,15 @@ _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
974# define fchownat rpl_fchownat 1020# define fchownat rpl_fchownat
975# endif 1021# endif
976_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, 1022_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
977 uid_t owner, gid_t group, int flag) 1023 uid_t owner, gid_t group, int flag),
978 _GL_ARG_NONNULL ((2))); 1024 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
979_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, 1025_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
980 uid_t owner, gid_t group, int flag)); 1026 uid_t owner, gid_t group, int flag));
981# else 1027# else
982# if !@HAVE_FCHOWNAT@ 1028# if !@HAVE_FCHOWNAT@
983_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, 1029_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
984 uid_t owner, gid_t group, int flag) 1030 uid_t owner, gid_t group, int flag),
985 _GL_ARG_NONNULL ((2))); 1031 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
986# endif 1032# endif
987_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, 1033_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
988 uid_t owner, gid_t group, int flag)); 1034 uid_t owner, gid_t group, int flag));
@@ -1002,11 +1048,22 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
1002 Return 0 if successful, otherwise -1 and errno set. 1048 Return 0 if successful, otherwise -1 and errno set.
1003 See POSIX:2008 specification 1049 See POSIX:2008 specification
1004 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */ 1050 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html>. */
1005# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ 1051# if @REPLACE_FDATASYNC@
1006_GL_FUNCDECL_SYS (fdatasync, int, (int fd)); 1052# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1007# endif 1053# undef fdatasync
1054# define fdatasync rpl_fdatasync
1055# endif
1056_GL_FUNCDECL_RPL (fdatasync, int, (int fd), );
1057_GL_CXXALIAS_RPL (fdatasync, int, (int fd));
1058# else
1059# if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@
1060_GL_FUNCDECL_SYS (fdatasync, int, (int fd), );
1061# endif
1008_GL_CXXALIAS_SYS (fdatasync, int, (int fd)); 1062_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
1063# endif
1064# if __GLIBC__ >= 2
1009_GL_CXXALIASWARN (fdatasync); 1065_GL_CXXALIASWARN (fdatasync);
1066# endif
1010#elif defined GNULIB_POSIXCHECK 1067#elif defined GNULIB_POSIXCHECK
1011# undef fdatasync 1068# undef fdatasync
1012# if HAVE_RAW_DECL_FDATASYNC 1069# if HAVE_RAW_DECL_FDATASYNC
@@ -1022,7 +1079,7 @@ _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
1022 See POSIX:2008 specification 1079 See POSIX:2008 specification
1023 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ 1080 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
1024# if !@HAVE_FSYNC@ 1081# if !@HAVE_FSYNC@
1025_GL_FUNCDECL_SYS (fsync, int, (int fd)); 1082_GL_FUNCDECL_SYS (fsync, int, (int fd), );
1026# endif 1083# endif
1027_GL_CXXALIAS_SYS (fsync, int, (int fd)); 1084_GL_CXXALIAS_SYS (fsync, int, (int fd));
1028_GL_CXXALIASWARN (fsync); 1085_GL_CXXALIASWARN (fsync);
@@ -1045,15 +1102,21 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
1045# undef ftruncate 1102# undef ftruncate
1046# define ftruncate rpl_ftruncate 1103# define ftruncate rpl_ftruncate
1047# endif 1104# endif
1048_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); 1105_GL_FUNCDECL_RPL (ftruncate, int,
1049_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); 1106 (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
1107_GL_CXXALIAS_RPL (ftruncate, int,
1108 (int fd, off_t length));
1050# else 1109# else
1051# if !@HAVE_FTRUNCATE@ 1110# if !@HAVE_FTRUNCATE@
1052_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); 1111_GL_FUNCDECL_SYS (ftruncate, int,
1112 (int fd, off_t length), _GL_ATTRIBUTE_NODISCARD);
1053# endif 1113# endif
1054_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); 1114_GL_CXXALIAS_SYS (ftruncate, int,
1115 (int fd, off_t length));
1055# endif 1116# endif
1117# if __GLIBC__ >= 2
1056_GL_CXXALIASWARN (ftruncate); 1118_GL_CXXALIASWARN (ftruncate);
1119# endif
1057#elif defined GNULIB_POSIXCHECK 1120#elif defined GNULIB_POSIXCHECK
1058# undef ftruncate 1121# undef ftruncate
1059# if HAVE_RAW_DECL_FTRUNCATE 1122# if HAVE_RAW_DECL_FTRUNCATE
@@ -1070,15 +1133,16 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
1070 or SIZE was too small. 1133 or SIZE was too small.
1071 See the POSIX:2008 specification 1134 See the POSIX:2008 specification
1072 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>. 1135 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html>.
1073 Additionally, the gnulib module 'getcwd' guarantees the following GNU 1136 Additionally, the gnulib module 'getcwd' or 'getcwd-lgpl' guarantees the
1074 extension: If BUF is NULL, an array is allocated with 'malloc'; the array 1137 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 1138 'malloc'; the array is SIZE bytes long, unless SIZE == 0, in which case
1076 necessary. */ 1139 it is as big as necessary. */
1077# if @REPLACE_GETCWD@ 1140# if @REPLACE_GETCWD@
1078# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1141# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1079# define getcwd rpl_getcwd 1142# define getcwd rpl_getcwd
1080# endif 1143# endif
1081_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); 1144_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size),
1145 _GL_ATTRIBUTE_NODISCARD);
1082_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); 1146_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
1083# elif defined _WIN32 && !defined __CYGWIN__ 1147# elif defined _WIN32 && !defined __CYGWIN__
1084# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1148# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1133,15 +1197,19 @@ _GL_CXXALIASWARN (getcwd);
1133# undef getdomainname 1197# undef getdomainname
1134# define getdomainname rpl_getdomainname 1198# define getdomainname rpl_getdomainname
1135# endif 1199# endif
1136_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) 1200_GL_FUNCDECL_RPL (getdomainname, int,
1137 _GL_ARG_NONNULL ((1))); 1201 (char *name, size_t len),
1138_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); 1202 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1203_GL_CXXALIAS_RPL (getdomainname, int,
1204 (char *name, size_t len));
1139# else 1205# else
1140# if !@HAVE_DECL_GETDOMAINNAME@ 1206# if !@HAVE_DECL_GETDOMAINNAME@
1141_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) 1207_GL_FUNCDECL_SYS (getdomainname, int,
1142 _GL_ARG_NONNULL ((1))); 1208 (char *name, size_t len),
1209 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1143# endif 1210# endif
1144_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); 1211_GL_CXXALIAS_SYS (getdomainname, int,
1212 (char *name, size_t len));
1145# endif 1213# endif
1146# if __GLIBC__ >= 2 1214# if __GLIBC__ >= 2
1147_GL_CXXALIASWARN (getdomainname); 1215_GL_CXXALIASWARN (getdomainname);
@@ -1163,11 +1231,11 @@ _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
1163# undef getdtablesize 1231# undef getdtablesize
1164# define getdtablesize rpl_getdtablesize 1232# define getdtablesize rpl_getdtablesize
1165# endif 1233# endif
1166_GL_FUNCDECL_RPL (getdtablesize, int, (void)); 1234_GL_FUNCDECL_RPL (getdtablesize, int, (void), );
1167_GL_CXXALIAS_RPL (getdtablesize, int, (void)); 1235_GL_CXXALIAS_RPL (getdtablesize, int, (void));
1168# else 1236# else
1169# if !@HAVE_GETDTABLESIZE@ 1237# if !@HAVE_GETDTABLESIZE@
1170_GL_FUNCDECL_SYS (getdtablesize, int, (void)); 1238_GL_FUNCDECL_SYS (getdtablesize, int, (void), );
1171# endif 1239# endif
1172/* Need to cast, because on AIX, the parameter list is 1240/* Need to cast, because on AIX, the parameter list is
1173 (...). */ 1241 (...). */
@@ -1185,11 +1253,26 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
1185 1253
1186#if @GNULIB_GETENTROPY@ 1254#if @GNULIB_GETENTROPY@
1187/* Fill a buffer with random bytes. */ 1255/* Fill a buffer with random bytes. */
1188# if !@HAVE_GETENTROPY@ 1256# if @REPLACE_GETENTROPY@
1189_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); 1257# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1258# undef getentropy
1259# define getentropy rpl_getentropy
1260# endif
1261_GL_FUNCDECL_RPL (getentropy, int,
1262 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1263_GL_CXXALIAS_RPL (getentropy, int,
1264 (void *buffer, size_t length));
1265# else
1266# if !@HAVE_GETENTROPY@
1267_GL_FUNCDECL_SYS (getentropy, int,
1268 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1269# endif
1270_GL_CXXALIAS_SYS (getentropy, int,
1271 (void *buffer, size_t length));
1190# endif 1272# endif
1191_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); 1273# if __GLIBC__ >= 2
1192_GL_CXXALIASWARN (getentropy); 1274_GL_CXXALIASWARN (getentropy);
1275# endif
1193#elif defined GNULIB_POSIXCHECK 1276#elif defined GNULIB_POSIXCHECK
1194# undef getentropy 1277# undef getentropy
1195# if HAVE_RAW_DECL_GETENTROPY 1278# if HAVE_RAW_DECL_GETENTROPY
@@ -1210,13 +1293,17 @@ _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
1210# undef getgroups 1293# undef getgroups
1211# define getgroups rpl_getgroups 1294# define getgroups rpl_getgroups
1212# endif 1295# endif
1213_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); 1296_GL_FUNCDECL_RPL (getgroups, int,
1214_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); 1297 (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
1298_GL_CXXALIAS_RPL (getgroups, int,
1299 (int n, gid_t *groups));
1215# else 1300# else
1216# if !@HAVE_GETGROUPS@ 1301# if !@HAVE_GETGROUPS@
1217_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); 1302_GL_FUNCDECL_SYS (getgroups, int,
1303 (int n, gid_t *groups), _GL_ATTRIBUTE_NODISCARD);
1218# endif 1304# endif
1219_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); 1305_GL_CXXALIAS_SYS (getgroups, int,
1306 (int n, gid_t *groups));
1220# endif 1307# endif
1221_GL_CXXALIASWARN (getgroups); 1308_GL_CXXALIASWARN (getgroups);
1222#elif defined GNULIB_POSIXCHECK 1309#elif defined GNULIB_POSIXCHECK
@@ -1241,12 +1328,12 @@ _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
1241# undef gethostname 1328# undef gethostname
1242# define gethostname rpl_gethostname 1329# define gethostname rpl_gethostname
1243# endif 1330# endif
1244_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) 1331_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len),
1245 _GL_ARG_NONNULL ((1))); 1332 _GL_ARG_NONNULL ((1)));
1246_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); 1333_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
1247# else 1334# else
1248# if !@HAVE_GETHOSTNAME@ 1335# if !@HAVE_GETHOSTNAME@
1249_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) 1336_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len),
1250 _GL_ARG_NONNULL ((1))); 1337 _GL_ARG_NONNULL ((1)));
1251# endif 1338# endif
1252/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second 1339/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
@@ -1256,8 +1343,10 @@ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
1256# endif 1343# endif
1257_GL_CXXALIASWARN (gethostname); 1344_GL_CXXALIASWARN (gethostname);
1258#elif @UNISTD_H_HAVE_WINSOCK2_H@ 1345#elif @UNISTD_H_HAVE_WINSOCK2_H@
1259# undef gethostname 1346# if !GNULIB_GETHOSTNAME
1260# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname 1347# undef gethostname
1348# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
1349# endif
1261#elif defined GNULIB_POSIXCHECK 1350#elif defined GNULIB_POSIXCHECK
1262# undef gethostname 1351# undef gethostname
1263# if HAVE_RAW_DECL_GETHOSTNAME 1352# if HAVE_RAW_DECL_GETHOSTNAME
@@ -1278,11 +1367,21 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
1278 ${LOGNAME-$USER} on Unix platforms, 1367 ${LOGNAME-$USER} on Unix platforms,
1279 $USERNAME on native Windows platforms. 1368 $USERNAME on native Windows platforms.
1280 */ 1369 */
1281# if !@HAVE_DECL_GETLOGIN@ 1370# if @REPLACE_GETLOGIN@
1282_GL_FUNCDECL_SYS (getlogin, char *, (void)); 1371# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1283# endif 1372# define getlogin rpl_getlogin
1373# endif
1374_GL_FUNCDECL_RPL (getlogin, char *, (void), );
1375_GL_CXXALIAS_RPL (getlogin, char *, (void));
1376# else
1377# if !@HAVE_DECL_GETLOGIN@
1378_GL_FUNCDECL_SYS (getlogin, char *, (void), );
1379# endif
1284_GL_CXXALIAS_SYS (getlogin, char *, (void)); 1380_GL_CXXALIAS_SYS (getlogin, char *, (void));
1381# endif
1382# if __GLIBC__ >= 2
1285_GL_CXXALIASWARN (getlogin); 1383_GL_CXXALIASWARN (getlogin);
1384# endif
1286#elif defined GNULIB_POSIXCHECK 1385#elif defined GNULIB_POSIXCHECK
1287# undef getlogin 1386# undef getlogin
1288# if HAVE_RAW_DECL_GETLOGIN 1387# if HAVE_RAW_DECL_GETLOGIN
@@ -1311,19 +1410,21 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
1311# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1410# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1312# define getlogin_r rpl_getlogin_r 1411# define getlogin_r rpl_getlogin_r
1313# endif 1412# endif
1314_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) 1413_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size),
1315 _GL_ARG_NONNULL ((1))); 1414 _GL_ARG_NONNULL ((1)));
1316_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); 1415_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
1317# else 1416# else
1318# if !@HAVE_DECL_GETLOGIN_R@ 1417# if !@HAVE_DECL_GETLOGIN_R@
1319_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) 1418_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size),
1320 _GL_ARG_NONNULL ((1))); 1419 _GL_ARG_NONNULL ((1)));
1321# endif 1420# endif
1322/* Need to cast, because on Solaris 10 systems, the second argument is 1421/* Need to cast, because on Solaris 10 systems, the second argument is
1323 int size. */ 1422 int size. */
1324_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); 1423_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size));
1325# endif 1424# endif
1425# if __GLIBC__ >= 2
1326_GL_CXXALIASWARN (getlogin_r); 1426_GL_CXXALIASWARN (getlogin_r);
1427# endif
1327#elif defined GNULIB_POSIXCHECK 1428#elif defined GNULIB_POSIXCHECK
1328# undef getlogin_r 1429# undef getlogin_r
1329# if HAVE_RAW_DECL_GETLOGIN_R 1430# if HAVE_RAW_DECL_GETLOGIN_R
@@ -1338,13 +1439,13 @@ _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
1338# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1439# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1339# define getpagesize rpl_getpagesize 1440# define getpagesize rpl_getpagesize
1340# endif 1441# endif
1341_GL_FUNCDECL_RPL (getpagesize, int, (void)); 1442_GL_FUNCDECL_RPL (getpagesize, int, (void), );
1342_GL_CXXALIAS_RPL (getpagesize, int, (void)); 1443_GL_CXXALIAS_RPL (getpagesize, int, (void));
1343# else 1444# else
1344/* On HP-UX, getpagesize exists, but it is not declared in <unistd.h> even if 1445/* 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. */ 1446 the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */
1346# if defined __hpux 1447# if defined __hpux
1347_GL_FUNCDECL_SYS (getpagesize, int, (void)); 1448_GL_FUNCDECL_SYS (getpagesize, int, (void), );
1348# endif 1449# endif
1349# if !@HAVE_GETPAGESIZE@ 1450# if !@HAVE_GETPAGESIZE@
1350# if !defined getpagesize 1451# if !defined getpagesize
@@ -1395,7 +1496,7 @@ _GL_FUNCDECL_SYS (getpagesize, int, (void));
1395# define getpagesize() _gl_getpagesize () 1496# define getpagesize() _gl_getpagesize ()
1396# else 1497# else
1397# if !GNULIB_defined_getpagesize_function 1498# if !GNULIB_defined_getpagesize_function
1398_GL_UNISTD_INLINE int 1499_GL_GETPAGESIZE_INLINE int
1399getpagesize () 1500getpagesize ()
1400{ 1501{
1401 return _gl_getpagesize (); 1502 return _gl_getpagesize ();
@@ -1431,12 +1532,12 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1431# undef getpass 1532# undef getpass
1432# define getpass rpl_getpass 1533# define getpass rpl_getpass
1433# endif 1534# endif
1434_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) 1535_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt),
1435 _GL_ARG_NONNULL ((1))); 1536 _GL_ARG_NONNULL ((1)));
1436_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); 1537_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
1437# else 1538# else
1438# if !@HAVE_GETPASS@ 1539# if !@HAVE_GETPASS@
1439_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) 1540_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt),
1440 _GL_ARG_NONNULL ((1))); 1541 _GL_ARG_NONNULL ((1)));
1441# endif 1542# endif
1442_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); 1543_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
@@ -1469,12 +1570,21 @@ _GL_CXXALIASWARN (getpid);
1469 1570
1470 1571
1471#if @GNULIB_GETUSERSHELL@ 1572#if @GNULIB_GETUSERSHELL@
1573# if @REPLACE_GETUSERSHELL@
1472/* Return the next valid login shell on the system, or NULL when the end of 1574/* Return the next valid login shell on the system, or NULL when the end of
1473 the list has been reached. */ 1575 the list has been reached. */
1474# if !@HAVE_DECL_GETUSERSHELL@ 1576# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1475_GL_FUNCDECL_SYS (getusershell, char *, (void)); 1577# undef getusershell
1476# endif 1578# define getusershell rpl_getusershell
1579# endif
1580_GL_FUNCDECL_RPL (getusershell, char *, (void), );
1581_GL_CXXALIAS_RPL (getusershell, char *, (void));
1582# else
1583# if !@HAVE_DECL_GETUSERSHELL@
1584_GL_FUNCDECL_SYS (getusershell, char *, (void), );
1585# endif
1477_GL_CXXALIAS_SYS (getusershell, char *, (void)); 1586_GL_CXXALIAS_SYS (getusershell, char *, (void));
1587# endif
1478_GL_CXXALIASWARN (getusershell); 1588_GL_CXXALIASWARN (getusershell);
1479#elif defined GNULIB_POSIXCHECK 1589#elif defined GNULIB_POSIXCHECK
1480# undef getusershell 1590# undef getusershell
@@ -1486,10 +1596,19 @@ _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
1486 1596
1487#if @GNULIB_GETUSERSHELL@ 1597#if @GNULIB_GETUSERSHELL@
1488/* Rewind to pointer that is advanced at each getusershell() call. */ 1598/* Rewind to pointer that is advanced at each getusershell() call. */
1489# if !@HAVE_DECL_GETUSERSHELL@ 1599# if @REPLACE_GETUSERSHELL@
1490_GL_FUNCDECL_SYS (setusershell, void, (void)); 1600# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1491# endif 1601# undef setusershell
1602# define setusershell rpl_setusershell
1603# endif
1604_GL_FUNCDECL_RPL (setusershell, void, (void), );
1605_GL_CXXALIAS_RPL (setusershell, void, (void));
1606# else
1607# if !@HAVE_DECL_GETUSERSHELL@
1608_GL_FUNCDECL_SYS (setusershell, void, (void), );
1609# endif
1492_GL_CXXALIAS_SYS (setusershell, void, (void)); 1610_GL_CXXALIAS_SYS (setusershell, void, (void));
1611# endif
1493_GL_CXXALIASWARN (setusershell); 1612_GL_CXXALIASWARN (setusershell);
1494#elif defined GNULIB_POSIXCHECK 1613#elif defined GNULIB_POSIXCHECK
1495# undef setusershell 1614# undef setusershell
@@ -1502,10 +1621,19 @@ _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
1502#if @GNULIB_GETUSERSHELL@ 1621#if @GNULIB_GETUSERSHELL@
1503/* Free the pointer that is advanced at each getusershell() call and 1622/* Free the pointer that is advanced at each getusershell() call and
1504 associated resources. */ 1623 associated resources. */
1505# if !@HAVE_DECL_GETUSERSHELL@ 1624# if @REPLACE_GETUSERSHELL@
1506_GL_FUNCDECL_SYS (endusershell, void, (void)); 1625# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1507# endif 1626# undef endusershell
1627# define endusershell rpl_endusershell
1628# endif
1629_GL_FUNCDECL_RPL (endusershell, void, (void), );
1630_GL_CXXALIAS_RPL (endusershell, void, (void));
1631# else
1632# if !@HAVE_DECL_GETUSERSHELL@
1633_GL_FUNCDECL_SYS (endusershell, void, (void), );
1634# endif
1508_GL_CXXALIAS_SYS (endusershell, void, (void)); 1635_GL_CXXALIAS_SYS (endusershell, void, (void));
1636# endif
1509_GL_CXXALIASWARN (endusershell); 1637_GL_CXXALIASWARN (endusershell);
1510#elif defined GNULIB_POSIXCHECK 1638#elif defined GNULIB_POSIXCHECK
1511# undef endusershell 1639# undef endusershell
@@ -1519,7 +1647,7 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
1519#if @GNULIB_GROUP_MEMBER@ 1647#if @GNULIB_GROUP_MEMBER@
1520/* Determine whether group id is in calling user's group list. */ 1648/* Determine whether group id is in calling user's group list. */
1521# if !@HAVE_GROUP_MEMBER@ 1649# if !@HAVE_GROUP_MEMBER@
1522_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); 1650_GL_FUNCDECL_SYS (group_member, int, (gid_t gid), );
1523# endif 1651# endif
1524_GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); 1652_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
1525_GL_CXXALIASWARN (group_member); 1653_GL_CXXALIASWARN (group_member);
@@ -1539,7 +1667,7 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
1539# define isatty rpl_isatty 1667# define isatty rpl_isatty
1540# endif 1668# endif
1541# define GNULIB_defined_isatty 1 1669# define GNULIB_defined_isatty 1
1542_GL_FUNCDECL_RPL (isatty, int, (int fd)); 1670_GL_FUNCDECL_RPL (isatty, int, (int fd), );
1543_GL_CXXALIAS_RPL (isatty, int, (int fd)); 1671_GL_CXXALIAS_RPL (isatty, int, (int fd));
1544# elif defined _WIN32 && !defined __CYGWIN__ 1672# elif defined _WIN32 && !defined __CYGWIN__
1545# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1673# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1585,13 +1713,13 @@ _GL_CXXALIASWARN (isatty);
1585# undef lchown 1713# undef lchown
1586# define lchown rpl_lchown 1714# define lchown rpl_lchown
1587# endif 1715# endif
1588_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) 1716_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group),
1589 _GL_ARG_NONNULL ((1))); 1717 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1590_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); 1718_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group));
1591# else 1719# else
1592# if !@HAVE_LCHOWN@ 1720# if !@HAVE_LCHOWN@
1593_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) 1721_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group),
1594 _GL_ARG_NONNULL ((1))); 1722 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1595# endif 1723# endif
1596_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); 1724_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group));
1597# endif 1725# endif
@@ -1614,13 +1742,13 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1614# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1742# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1615# define link rpl_link 1743# define link rpl_link
1616# endif 1744# endif
1617_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) 1745_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2),
1618 _GL_ARG_NONNULL ((1, 2))); 1746 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1619_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); 1747_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1620# else 1748# else
1621# if !@HAVE_LINK@ 1749# if !@HAVE_LINK@
1622_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) 1750_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2),
1623 _GL_ARG_NONNULL ((1, 2))); 1751 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1624# endif 1752# endif
1625_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); 1753_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1626# endif 1754# endif
@@ -1645,8 +1773,8 @@ _GL_WARN_ON_USE (link, "link is unportable - "
1645# endif 1773# endif
1646_GL_FUNCDECL_RPL (linkat, int, 1774_GL_FUNCDECL_RPL (linkat, int,
1647 (int fd1, const char *path1, int fd2, const char *path2, 1775 (int fd1, const char *path1, int fd2, const char *path2,
1648 int flag) 1776 int flag),
1649 _GL_ARG_NONNULL ((2, 4))); 1777 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1650_GL_CXXALIAS_RPL (linkat, int, 1778_GL_CXXALIAS_RPL (linkat, int,
1651 (int fd1, const char *path1, int fd2, const char *path2, 1779 (int fd1, const char *path1, int fd2, const char *path2,
1652 int flag)); 1780 int flag));
@@ -1654,14 +1782,16 @@ _GL_CXXALIAS_RPL (linkat, int,
1654# if !@HAVE_LINKAT@ 1782# if !@HAVE_LINKAT@
1655_GL_FUNCDECL_SYS (linkat, int, 1783_GL_FUNCDECL_SYS (linkat, int,
1656 (int fd1, const char *path1, int fd2, const char *path2, 1784 (int fd1, const char *path1, int fd2, const char *path2,
1657 int flag) 1785 int flag),
1658 _GL_ARG_NONNULL ((2, 4))); 1786 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1659# endif 1787# endif
1660_GL_CXXALIAS_SYS (linkat, int, 1788_GL_CXXALIAS_SYS (linkat, int,
1661 (int fd1, const char *path1, int fd2, const char *path2, 1789 (int fd1, const char *path1, int fd2, const char *path2,
1662 int flag)); 1790 int flag));
1663# endif 1791# endif
1792# if __GLIBC__ >= 2
1664_GL_CXXALIASWARN (linkat); 1793_GL_CXXALIASWARN (linkat);
1794# endif
1665#elif defined GNULIB_POSIXCHECK 1795#elif defined GNULIB_POSIXCHECK
1666# undef linkat 1796# undef linkat
1667# if HAVE_RAW_DECL_LINKAT 1797# if HAVE_RAW_DECL_LINKAT
@@ -1680,7 +1810,7 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1680# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1810# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1681# define lseek rpl_lseek 1811# define lseek rpl_lseek
1682# endif 1812# endif
1683_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); 1813_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)); 1814_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence));
1685# elif defined _WIN32 && !defined __CYGWIN__ 1815# elif defined _WIN32 && !defined __CYGWIN__
1686# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1816# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1720,7 +1850,8 @@ _GL_CXXALIASWARN (lseek);
1720 Store the read-end as fd[0] and the write-end as fd[1]. 1850 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. */ 1851 Return 0 upon success, or -1 with errno set upon failure. */
1722# if !@HAVE_PIPE@ 1852# if !@HAVE_PIPE@
1723_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); 1853_GL_FUNCDECL_SYS (pipe, int, (int fd[2]),
1854 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1724# endif 1855# endif
1725_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); 1856_GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1726_GL_CXXALIASWARN (pipe); 1857_GL_CXXALIASWARN (pipe);
@@ -1742,17 +1873,22 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1742 Return 0 upon success, or -1 with errno set upon failure. 1873 Return 0 upon success, or -1 with errno set upon failure.
1743 See also the Linux man page at 1874 See also the Linux man page at
1744 <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */ 1875 <https://www.kernel.org/doc/man-pages/online/pages/man2/pipe2.2.html>. */
1745# if @HAVE_PIPE2@ 1876# if @REPLACE_PIPE2@
1746# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1877# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1878# undef pipe2
1747# define pipe2 rpl_pipe2 1879# define pipe2 rpl_pipe2
1748# endif 1880# endif
1749_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1881_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags),
1882 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1750_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); 1883_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1751# else 1884# else
1752_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); 1885_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags),
1886 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1753_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); 1887_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1754# endif 1888# endif
1889# if __GLIBC__ >= 2
1755_GL_CXXALIASWARN (pipe2); 1890_GL_CXXALIASWARN (pipe2);
1891# endif
1756#elif defined GNULIB_POSIXCHECK 1892#elif defined GNULIB_POSIXCHECK
1757# undef pipe2 1893# undef pipe2
1758# if HAVE_RAW_DECL_PIPE2 1894# if HAVE_RAW_DECL_PIPE2
@@ -1774,20 +1910,22 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1774# define pread rpl_pread 1910# define pread rpl_pread
1775# endif 1911# endif
1776_GL_FUNCDECL_RPL (pread, ssize_t, 1912_GL_FUNCDECL_RPL (pread, ssize_t,
1777 (int fd, void *buf, size_t bufsize, off_t offset) 1913 (int fd, void *buf, size_t bufsize, off_t offset),
1778 _GL_ARG_NONNULL ((2))); 1914 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1779_GL_CXXALIAS_RPL (pread, ssize_t, 1915_GL_CXXALIAS_RPL (pread, ssize_t,
1780 (int fd, void *buf, size_t bufsize, off_t offset)); 1916 (int fd, void *buf, size_t bufsize, off_t offset));
1781# else 1917# else
1782# if !@HAVE_PREAD@ 1918# if !@HAVE_PREAD@
1783_GL_FUNCDECL_SYS (pread, ssize_t, 1919_GL_FUNCDECL_SYS (pread, ssize_t,
1784 (int fd, void *buf, size_t bufsize, off_t offset) 1920 (int fd, void *buf, size_t bufsize, off_t offset),
1785 _GL_ARG_NONNULL ((2))); 1921 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1786# endif 1922# endif
1787_GL_CXXALIAS_SYS (pread, ssize_t, 1923_GL_CXXALIAS_SYS (pread, ssize_t,
1788 (int fd, void *buf, size_t bufsize, off_t offset)); 1924 (int fd, void *buf, size_t bufsize, off_t offset));
1789# endif 1925# endif
1926# if __GLIBC__ >= 2
1790_GL_CXXALIASWARN (pread); 1927_GL_CXXALIASWARN (pread);
1928# endif
1791#elif defined GNULIB_POSIXCHECK 1929#elif defined GNULIB_POSIXCHECK
1792# undef pread 1930# undef pread
1793# if HAVE_RAW_DECL_PREAD 1931# if HAVE_RAW_DECL_PREAD
@@ -1809,20 +1947,22 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
1809# define pwrite rpl_pwrite 1947# define pwrite rpl_pwrite
1810# endif 1948# endif
1811_GL_FUNCDECL_RPL (pwrite, ssize_t, 1949_GL_FUNCDECL_RPL (pwrite, ssize_t,
1812 (int fd, const void *buf, size_t bufsize, off_t offset) 1950 (int fd, const void *buf, size_t bufsize, off_t offset),
1813 _GL_ARG_NONNULL ((2))); 1951 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1814_GL_CXXALIAS_RPL (pwrite, ssize_t, 1952_GL_CXXALIAS_RPL (pwrite, ssize_t,
1815 (int fd, const void *buf, size_t bufsize, off_t offset)); 1953 (int fd, const void *buf, size_t bufsize, off_t offset));
1816# else 1954# else
1817# if !@HAVE_PWRITE@ 1955# if !@HAVE_PWRITE@
1818_GL_FUNCDECL_SYS (pwrite, ssize_t, 1956_GL_FUNCDECL_SYS (pwrite, ssize_t,
1819 (int fd, const void *buf, size_t bufsize, off_t offset) 1957 (int fd, const void *buf, size_t bufsize, off_t offset),
1820 _GL_ARG_NONNULL ((2))); 1958 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1821# endif 1959# endif
1822_GL_CXXALIAS_SYS (pwrite, ssize_t, 1960_GL_CXXALIAS_SYS (pwrite, ssize_t,
1823 (int fd, const void *buf, size_t bufsize, off_t offset)); 1961 (int fd, const void *buf, size_t bufsize, off_t offset));
1824# endif 1962# endif
1963# if __GLIBC__ >= 2
1825_GL_CXXALIASWARN (pwrite); 1964_GL_CXXALIASWARN (pwrite);
1965# endif
1826#elif defined GNULIB_POSIXCHECK 1966#elif defined GNULIB_POSIXCHECK
1827# undef pwrite 1967# undef pwrite
1828# if HAVE_RAW_DECL_PWRITE 1968# if HAVE_RAW_DECL_PWRITE
@@ -1841,8 +1981,9 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1841# undef read 1981# undef read
1842# define read rpl_read 1982# define read rpl_read
1843# endif 1983# endif
1844_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) 1984
1845 _GL_ARG_NONNULL ((2))); 1985_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count),
1986 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1846_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); 1987_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count));
1847# elif defined _WIN32 && !defined __CYGWIN__ 1988# elif defined _WIN32 && !defined __CYGWIN__
1848# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1989# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1863,11 +2004,7 @@ _GL_CXXALIASWARN (read);
1863# undef read 2004# undef read
1864# define read _read 2005# define read _read
1865# endif 2006# endif
1866# ifdef __MINGW32__ 2007_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 2008# else
1872_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); 2009_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count));
1873# endif 2010# endif
@@ -1887,8 +2024,8 @@ _GL_CXXALIASWARN (read);
1887# endif 2024# endif
1888_GL_FUNCDECL_RPL (readlink, ssize_t, 2025_GL_FUNCDECL_RPL (readlink, ssize_t,
1889 (const char *restrict file, 2026 (const char *restrict file,
1890 char *restrict buf, size_t bufsize) 2027 char *restrict buf, size_t bufsize),
1891 _GL_ARG_NONNULL ((1, 2))); 2028 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1892_GL_CXXALIAS_RPL (readlink, ssize_t, 2029_GL_CXXALIAS_RPL (readlink, ssize_t,
1893 (const char *restrict file, 2030 (const char *restrict file,
1894 char *restrict buf, size_t bufsize)); 2031 char *restrict buf, size_t bufsize));
@@ -1896,8 +2033,8 @@ _GL_CXXALIAS_RPL (readlink, ssize_t,
1896# if !@HAVE_READLINK@ 2033# if !@HAVE_READLINK@
1897_GL_FUNCDECL_SYS (readlink, ssize_t, 2034_GL_FUNCDECL_SYS (readlink, ssize_t,
1898 (const char *restrict file, 2035 (const char *restrict file,
1899 char *restrict buf, size_t bufsize) 2036 char *restrict buf, size_t bufsize),
1900 _GL_ARG_NONNULL ((1, 2))); 2037 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1901# endif 2038# endif
1902_GL_CXXALIAS_SYS (readlink, ssize_t, 2039_GL_CXXALIAS_SYS (readlink, ssize_t,
1903 (const char *restrict file, 2040 (const char *restrict file,
@@ -1920,8 +2057,8 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1920# endif 2057# endif
1921_GL_FUNCDECL_RPL (readlinkat, ssize_t, 2058_GL_FUNCDECL_RPL (readlinkat, ssize_t,
1922 (int fd, char const *restrict file, 2059 (int fd, char const *restrict file,
1923 char *restrict buf, size_t len) 2060 char *restrict buf, size_t len),
1924 _GL_ARG_NONNULL ((2, 3))); 2061 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
1925_GL_CXXALIAS_RPL (readlinkat, ssize_t, 2062_GL_CXXALIAS_RPL (readlinkat, ssize_t,
1926 (int fd, char const *restrict file, 2063 (int fd, char const *restrict file,
1927 char *restrict buf, size_t len)); 2064 char *restrict buf, size_t len));
@@ -1929,14 +2066,16 @@ _GL_CXXALIAS_RPL (readlinkat, ssize_t,
1929# if !@HAVE_READLINKAT@ 2066# if !@HAVE_READLINKAT@
1930_GL_FUNCDECL_SYS (readlinkat, ssize_t, 2067_GL_FUNCDECL_SYS (readlinkat, ssize_t,
1931 (int fd, char const *restrict file, 2068 (int fd, char const *restrict file,
1932 char *restrict buf, size_t len) 2069 char *restrict buf, size_t len),
1933 _GL_ARG_NONNULL ((2, 3))); 2070 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
1934# endif 2071# endif
1935_GL_CXXALIAS_SYS (readlinkat, ssize_t, 2072_GL_CXXALIAS_SYS (readlinkat, ssize_t,
1936 (int fd, char const *restrict file, 2073 (int fd, char const *restrict file,
1937 char *restrict buf, size_t len)); 2074 char *restrict buf, size_t len));
1938# endif 2075# endif
2076# if __GLIBC__ >= 2
1939_GL_CXXALIASWARN (readlinkat); 2077_GL_CXXALIASWARN (readlinkat);
2078# endif
1940#elif defined GNULIB_POSIXCHECK 2079#elif defined GNULIB_POSIXCHECK
1941# undef readlinkat 2080# undef readlinkat
1942# if HAVE_RAW_DECL_READLINKAT 2081# if HAVE_RAW_DECL_READLINKAT
@@ -1952,7 +2091,7 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
1952# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2091# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1953# define rmdir rpl_rmdir 2092# define rmdir rpl_rmdir
1954# endif 2093# endif
1955_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); 2094_GL_FUNCDECL_RPL (rmdir, int, (char const *name), _GL_ARG_NONNULL ((1)));
1956_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); 2095_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
1957# elif defined _WIN32 && !defined __CYGWIN__ 2096# elif defined _WIN32 && !defined __CYGWIN__
1958# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2097# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1996,15 +2135,31 @@ _GL_CXXALIASWARN (rmdir);
1996 2135
1997 Platforms with no ability to set the hostname return -1 and set 2136 Platforms with no ability to set the hostname return -1 and set
1998 errno = ENOSYS. */ 2137 errno = ENOSYS. */
1999# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ 2138# if @REPLACE_SETHOSTNAME@
2000_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) 2139# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2001 _GL_ARG_NONNULL ((1))); 2140# undef sethostname
2002# endif 2141# define sethostname rpl_sethostname
2142# endif
2143_GL_FUNCDECL_RPL (sethostname, int,
2144 (const char *name, size_t len),
2145 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2146_GL_CXXALIAS_RPL (sethostname, int,
2147 (const char *name, size_t len));
2148# else
2149# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
2150_GL_FUNCDECL_SYS (sethostname, int,
2151 (const char *name, size_t len),
2152 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2153# endif
2003/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 2154/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
2004 and FreeBSD 6.4 the second parameter is int. On Solaris 11 2155 and FreeBSD 6.4 the second parameter is int. On Solaris 11
2005 2011-10, the first parameter is not const. */ 2156 2011-10, the first parameter is not const. */
2006_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); 2157_GL_CXXALIAS_SYS_CAST (sethostname, int,
2158 (const char *name, size_t len));
2159# endif
2160# if __GLIBC__ >= 2
2007_GL_CXXALIASWARN (sethostname); 2161_GL_CXXALIASWARN (sethostname);
2162# endif
2008#elif defined GNULIB_POSIXCHECK 2163#elif defined GNULIB_POSIXCHECK
2009# undef sethostname 2164# undef sethostname
2010# if HAVE_RAW_DECL_SETHOSTNAME 2165# if HAVE_RAW_DECL_SETHOSTNAME
@@ -2024,11 +2179,11 @@ _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
2024# undef sleep 2179# undef sleep
2025# define sleep rpl_sleep 2180# define sleep rpl_sleep
2026# endif 2181# endif
2027_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); 2182_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n), );
2028_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); 2183_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
2029# else 2184# else
2030# if !@HAVE_SLEEP@ 2185# if !@HAVE_SLEEP@
2031_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); 2186_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n), );
2032# endif 2187# endif
2033_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); 2188_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
2034# endif 2189# endif
@@ -2073,15 +2228,19 @@ _GL_CXXALIASWARN (swab);
2073# undef symlink 2228# undef symlink
2074# define symlink rpl_symlink 2229# define symlink rpl_symlink
2075# endif 2230# endif
2076_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) 2231_GL_FUNCDECL_RPL (symlink, int,
2077 _GL_ARG_NONNULL ((1, 2))); 2232 (char const *contents, char const *file),
2078_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); 2233 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
2234_GL_CXXALIAS_RPL (symlink, int,
2235 (char const *contents, char const *file));
2079# else 2236# else
2080# if !@HAVE_SYMLINK@ 2237# if !@HAVE_SYMLINK@
2081_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) 2238_GL_FUNCDECL_SYS (symlink, int,
2082 _GL_ARG_NONNULL ((1, 2))); 2239 (char const *contents, char const *file),
2240 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
2083# endif 2241# endif
2084_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); 2242_GL_CXXALIAS_SYS (symlink, int,
2243 (char const *contents, char const *file));
2085# endif 2244# endif
2086_GL_CXXALIASWARN (symlink); 2245_GL_CXXALIASWARN (symlink);
2087#elif defined GNULIB_POSIXCHECK 2246#elif defined GNULIB_POSIXCHECK
@@ -2100,20 +2259,22 @@ _GL_WARN_ON_USE (symlink, "symlink is not portable - "
2100# define symlinkat rpl_symlinkat 2259# define symlinkat rpl_symlinkat
2101# endif 2260# endif
2102_GL_FUNCDECL_RPL (symlinkat, int, 2261_GL_FUNCDECL_RPL (symlinkat, int,
2103 (char const *contents, int fd, char const *file) 2262 (char const *contents, int fd, char const *file),
2104 _GL_ARG_NONNULL ((1, 3))); 2263 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2105_GL_CXXALIAS_RPL (symlinkat, int, 2264_GL_CXXALIAS_RPL (symlinkat, int,
2106 (char const *contents, int fd, char const *file)); 2265 (char const *contents, int fd, char const *file));
2107# else 2266# else
2108# if !@HAVE_SYMLINKAT@ 2267# if !@HAVE_SYMLINKAT@
2109_GL_FUNCDECL_SYS (symlinkat, int, 2268_GL_FUNCDECL_SYS (symlinkat, int,
2110 (char const *contents, int fd, char const *file) 2269 (char const *contents, int fd, char const *file),
2111 _GL_ARG_NONNULL ((1, 3))); 2270 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2112# endif 2271# endif
2113_GL_CXXALIAS_SYS (symlinkat, int, 2272_GL_CXXALIAS_SYS (symlinkat, int,
2114 (char const *contents, int fd, char const *file)); 2273 (char const *contents, int fd, char const *file));
2115# endif 2274# endif
2275# if __GLIBC__ >= 2
2116_GL_CXXALIASWARN (symlinkat); 2276_GL_CXXALIASWARN (symlinkat);
2277# endif
2117#elif defined GNULIB_POSIXCHECK 2278#elif defined GNULIB_POSIXCHECK
2118# undef symlinkat 2279# undef symlinkat
2119# if HAVE_RAW_DECL_SYMLINKAT 2280# if HAVE_RAW_DECL_SYMLINKAT
@@ -2133,17 +2294,19 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
2133# undef truncate 2294# undef truncate
2134# define truncate rpl_truncate 2295# define truncate rpl_truncate
2135# endif 2296# endif
2136_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) 2297_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length),
2137 _GL_ARG_NONNULL ((1))); 2298 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2138_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); 2299_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
2139# else 2300# else
2140# if !@HAVE_DECL_TRUNCATE@ 2301# if !@HAVE_DECL_TRUNCATE@
2141_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) 2302_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length),
2142 _GL_ARG_NONNULL ((1))); 2303 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2143# endif 2304# endif
2144_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); 2305_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
2145# endif 2306# endif
2307# if __GLIBC__ >= 2
2146_GL_CXXALIASWARN (truncate); 2308_GL_CXXALIASWARN (truncate);
2309# endif
2147#elif defined GNULIB_POSIXCHECK 2310#elif defined GNULIB_POSIXCHECK
2148# undef truncate 2311# undef truncate
2149# if HAVE_RAW_DECL_TRUNCATE 2312# if HAVE_RAW_DECL_TRUNCATE
@@ -2162,18 +2325,22 @@ _GL_WARN_ON_USE (truncate, "truncate is unportable - "
2162# define ttyname_r rpl_ttyname_r 2325# define ttyname_r rpl_ttyname_r
2163# endif 2326# endif
2164_GL_FUNCDECL_RPL (ttyname_r, int, 2327_GL_FUNCDECL_RPL (ttyname_r, int,
2165 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2328 (int fd, char *buf, size_t buflen),
2329 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2166_GL_CXXALIAS_RPL (ttyname_r, int, 2330_GL_CXXALIAS_RPL (ttyname_r, int,
2167 (int fd, char *buf, size_t buflen)); 2331 (int fd, char *buf, size_t buflen));
2168# else 2332# else
2169# if !@HAVE_DECL_TTYNAME_R@ 2333# if !@HAVE_DECL_TTYNAME_R@
2170_GL_FUNCDECL_SYS (ttyname_r, int, 2334_GL_FUNCDECL_SYS (ttyname_r, int,
2171 (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); 2335 (int fd, char *buf, size_t buflen),
2336 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2172# endif 2337# endif
2173_GL_CXXALIAS_SYS (ttyname_r, int, 2338_GL_CXXALIAS_SYS (ttyname_r, int,
2174 (int fd, char *buf, size_t buflen)); 2339 (int fd, char *buf, size_t buflen));
2175# endif 2340# endif
2341# if __GLIBC__ >= 2
2176_GL_CXXALIASWARN (ttyname_r); 2342_GL_CXXALIASWARN (ttyname_r);
2343# endif
2177#elif defined GNULIB_POSIXCHECK 2344#elif defined GNULIB_POSIXCHECK
2178# undef ttyname_r 2345# undef ttyname_r
2179# if HAVE_RAW_DECL_TTYNAME_R 2346# if HAVE_RAW_DECL_TTYNAME_R
@@ -2189,7 +2356,7 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
2189# undef unlink 2356# undef unlink
2190# define unlink rpl_unlink 2357# define unlink rpl_unlink
2191# endif 2358# endif
2192_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); 2359_GL_FUNCDECL_RPL (unlink, int, (char const *file), _GL_ARG_NONNULL ((1)));
2193_GL_CXXALIAS_RPL (unlink, int, (char const *file)); 2360_GL_CXXALIAS_RPL (unlink, int, (char const *file));
2194# elif defined _WIN32 && !defined __CYGWIN__ 2361# elif defined _WIN32 && !defined __CYGWIN__
2195# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2362# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2230,12 +2397,12 @@ _GL_CXXALIASWARN (unlink);
2230# undef unlinkat 2397# undef unlinkat
2231# define unlinkat rpl_unlinkat 2398# define unlinkat rpl_unlinkat
2232# endif 2399# endif
2233_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) 2400_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag),
2234 _GL_ARG_NONNULL ((2))); 2401 _GL_ARG_NONNULL ((2)));
2235_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); 2402_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag));
2236# else 2403# else
2237# if !@HAVE_UNLINKAT@ 2404# if !@HAVE_UNLINKAT@
2238_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) 2405_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag),
2239 _GL_ARG_NONNULL ((2))); 2406 _GL_ARG_NONNULL ((2)));
2240# endif 2407# endif
2241_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); 2408_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag));
@@ -2253,18 +2420,18 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
2253#if @GNULIB_USLEEP@ 2420#if @GNULIB_USLEEP@
2254/* Pause the execution of the current thread for N microseconds. 2421/* Pause the execution of the current thread for N microseconds.
2255 Returns 0 on completion, or -1 on range error. 2422 Returns 0 on completion, or -1 on range error.
2256 See the POSIX:2001 specification 2423 See the POSIX.1-2004 specification
2257 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ 2424 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
2258# if @REPLACE_USLEEP@ 2425# if @REPLACE_USLEEP@
2259# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2426# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2260# undef usleep 2427# undef usleep
2261# define usleep rpl_usleep 2428# define usleep rpl_usleep
2262# endif 2429# endif
2263_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); 2430_GL_FUNCDECL_RPL (usleep, int, (useconds_t n), );
2264_GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); 2431_GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
2265# else 2432# else
2266# if !@HAVE_USLEEP@ 2433# if !@HAVE_USLEEP@
2267_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); 2434_GL_FUNCDECL_SYS (usleep, int, (useconds_t n), );
2268# endif 2435# endif
2269/* Need to cast, because on Haiku, the first parameter is 2436/* Need to cast, because on Haiku, the first parameter is
2270 unsigned int n. */ 2437 unsigned int n. */
@@ -2289,17 +2456,21 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
2289# undef write 2456# undef write
2290# define write rpl_write 2457# define write rpl_write
2291# endif 2458# endif
2292_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) 2459_GL_FUNCDECL_RPL (write, ssize_t,
2293 _GL_ARG_NONNULL ((2))); 2460 (int fd, const void *buf, size_t count),
2294_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); 2461 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
2462_GL_CXXALIAS_RPL (write, ssize_t,
2463 (int fd, const void *buf, size_t count));
2295# elif defined _WIN32 && !defined __CYGWIN__ 2464# elif defined _WIN32 && !defined __CYGWIN__
2296# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2465# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2297# undef write 2466# undef write
2298# define write _write 2467# define write _write
2299# endif 2468# endif
2300_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count)); 2469_GL_CXXALIAS_MDA (write, ssize_t,
2470 (int fd, const void *buf, size_t count));
2301# else 2471# else
2302_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2472_GL_CXXALIAS_SYS (write, ssize_t,
2473 (int fd, const void *buf, size_t count));
2303# endif 2474# endif
2304_GL_CXXALIASWARN (write); 2475_GL_CXXALIASWARN (write);
2305#elif @GNULIB_MDA_WRITE@ 2476#elif @GNULIB_MDA_WRITE@
@@ -2311,13 +2482,11 @@ _GL_CXXALIASWARN (write);
2311# undef write 2482# undef write
2312# define write _write 2483# define write _write
2313# endif 2484# endif
2314# ifdef __MINGW32__ 2485_GL_CXXALIAS_MDA_CAST (write, ssize_t,
2315_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count)); 2486 (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 2487# else
2320_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); 2488_GL_CXXALIAS_SYS (write, ssize_t,
2489 (int fd, const void *buf, size_t count));
2321# endif 2490# endif
2322_GL_CXXALIASWARN (write); 2491_GL_CXXALIASWARN (write);
2323#endif 2492#endif