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.h443
1 files changed, 261 insertions, 182 deletions
diff --git a/gl/unistd.in.h b/gl/unistd.in.h
index b4129663..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-2024 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
@@ -69,8 +69,8 @@
69#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H 69#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H
70#define _@GUARD_PREFIX@_UNISTD_H 70#define _@GUARD_PREFIX@_UNISTD_H
71 71
72/* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE, GNULIB_POSIXCHECK, 72/* This file uses _GL_ATTRIBUTE_NODISCARD, _GL_INLINE_HEADER_BEGIN, _GL_INLINE,
73 HAVE_RAW_DECL_*. */ 73 GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
74#if !_GL_CONFIG_H_INCLUDED 74#if !_GL_CONFIG_H_INCLUDED
75 #error "Please include config.h first." 75 #error "Please include config.h first."
76#endif 76#endif
@@ -95,12 +95,24 @@
95# include <stdio.h> 95# include <stdio.h>
96#endif 96#endif
97 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>. */
98/* 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
99 <unistd.h>. */ 110 <unistd.h>. */
100/* But avoid namespace pollution on glibc systems. */ 111/* But avoid namespace pollution on glibc systems. */
101#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ 112#if ! defined O_CLOEXEC \
102 && (defined __CYGWIN__ || defined __ANDROID__) \ 113 || ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
103 && ! defined __GLIBC__ 114 && (defined __CYGWIN__ || defined __ANDROID__) \
115 && ! defined __GLIBC__)
104# include <fcntl.h> 116# include <fcntl.h>
105#endif 117#endif
106 118
@@ -117,15 +129,6 @@
117# undef __need_system_stdlib_h 129# undef __need_system_stdlib_h
118#endif 130#endif
119 131
120/* Native Windows platforms declare _chdir, _getcwd, _rmdir in
121 <io.h> and/or <direct.h>, not in <unistd.h>.
122 They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(),
123 _lseek(), _read(), _unlink(), _write() in <io.h>. */
124#if defined _WIN32 && !defined __CYGWIN__
125# include <io.h>
126# include <direct.h>
127#endif
128
129/* Native Windows platforms declare _execl*, _execv* in <process.h>. */ 132/* Native Windows platforms declare _execl*, _execv* in <process.h>. */
130#if defined _WIN32 && !defined __CYGWIN__ 133#if defined _WIN32 && !defined __CYGWIN__
131# include <process.h> 134# include <process.h>
@@ -159,8 +162,9 @@
159#endif 162#endif
160 163
161/* MSVC defines off_t in <sys/types.h>. 164/* MSVC defines off_t in <sys/types.h>.
162 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.
163/* 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. */
164#include <sys/types.h> 168#include <sys/types.h>
165 169
166/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 170/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -180,6 +184,9 @@ _GL_INLINE_HEADER_BEGIN
180#ifndef _GL_UNISTD_INLINE 184#ifndef _GL_UNISTD_INLINE
181# define _GL_UNISTD_INLINE _GL_INLINE 185# define _GL_UNISTD_INLINE _GL_INLINE
182#endif 186#endif
187#ifndef _GL_GETPAGESIZE_INLINE
188# define _GL_GETPAGESIZE_INLINE _GL_INLINE
189#endif
183 190
184/* Hide some function declarations from <winsock2.h>. */ 191/* Hide some function declarations from <winsock2.h>. */
185 192
@@ -286,7 +293,7 @@ _GL_INLINE_HEADER_BEGIN
286# undef access 293# undef access
287# define access rpl_access 294# define access rpl_access
288# endif 295# endif
289_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) 296_GL_FUNCDECL_RPL (access, int, (const char *file, int mode),
290 _GL_ARG_NONNULL ((1))); 297 _GL_ARG_NONNULL ((1)));
291_GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); 298_GL_CXXALIAS_RPL (access, int, (const char *file, int mode));
292# elif defined _WIN32 && !defined __CYGWIN__ 299# elif defined _WIN32 && !defined __CYGWIN__
@@ -339,7 +346,7 @@ _GL_CXXALIASWARN (chdir);
339#elif defined GNULIB_POSIXCHECK 346#elif defined GNULIB_POSIXCHECK
340# undef chdir 347# undef chdir
341# if HAVE_RAW_DECL_CHDIR 348# if HAVE_RAW_DECL_CHDIR
342_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> - "
343 "use gnulib module chdir for portability"); 350 "use gnulib module chdir for portability");
344# endif 351# endif
345#elif @GNULIB_MDA_CHDIR@ 352#elif @GNULIB_MDA_CHDIR@
@@ -370,13 +377,13 @@ _GL_CXXALIASWARN (chdir);
370# undef chown 377# undef chown
371# define chown rpl_chown 378# define chown rpl_chown
372# endif 379# endif
373_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),
374 _GL_ARG_NONNULL ((1))); 381 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
375_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));
376# else 383# else
377# if !@HAVE_CHOWN@ 384# if !@HAVE_CHOWN@
378_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),
379 _GL_ARG_NONNULL ((1))); 386 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
380# endif 387# endif
381_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));
382# endif 389# endif
@@ -398,7 +405,7 @@ _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
398# undef close 405# undef close
399# define close rpl_close 406# define close rpl_close
400# endif 407# endif
401_GL_FUNCDECL_RPL (close, int, (int fd)); 408_GL_FUNCDECL_RPL (close, int, (int fd), );
402_GL_CXXALIAS_RPL (close, int, (int fd)); 409_GL_CXXALIAS_RPL (close, int, (int fd));
403# elif defined _WIN32 && !defined __CYGWIN__ 410# elif defined _WIN32 && !defined __CYGWIN__
404# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 411# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -411,8 +418,10 @@ _GL_CXXALIAS_SYS (close, int, (int fd));
411# endif 418# endif
412_GL_CXXALIASWARN (close); 419_GL_CXXALIASWARN (close);
413#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ 420#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
414# undef close 421# if !GNULIB_CLOSE
415# define close close_used_without_requesting_gnulib_module_close 422# undef close
423# define close close_used_without_requesting_gnulib_module_close
424# endif
416#elif defined GNULIB_POSIXCHECK 425#elif defined GNULIB_POSIXCHECK
417# undef close 426# undef close
418/* Assume close is always declared. */ 427/* Assume close is always declared. */
@@ -443,7 +452,7 @@ _GL_CXXALIASWARN (close);
443# endif 452# endif
444_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,
445 int ofd, off_t *opos, 454 int ofd, off_t *opos,
446 size_t len, unsigned flags)); 455 size_t len, unsigned flags), );
447_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,
448 int ofd, off_t *opos, 457 int ofd, off_t *opos,
449 size_t len, unsigned flags)); 458 size_t len, unsigned flags));
@@ -451,13 +460,15 @@ _GL_CXXALIAS_RPL (copy_file_range, ssize_t, (int ifd, off_t *ipos,
451# if !@HAVE_COPY_FILE_RANGE@ 460# if !@HAVE_COPY_FILE_RANGE@
452_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,
453 int ofd, off_t *opos, 462 int ofd, off_t *opos,
454 size_t len, unsigned flags)); 463 size_t len, unsigned flags), );
455# endif 464# endif
456_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,
457 int ofd, off_t *opos, 466 int ofd, off_t *opos,
458 size_t len, unsigned flags)); 467 size_t len, unsigned flags));
459# endif 468# endif
469# if __GLIBC__ >= 2
460_GL_CXXALIASWARN (copy_file_range); 470_GL_CXXALIASWARN (copy_file_range);
471# endif
461#elif defined GNULIB_POSIXCHECK 472#elif defined GNULIB_POSIXCHECK
462# undef copy_file_range 473# undef copy_file_range
463# if HAVE_RAW_DECL_COPY_FILE_RANGE 474# if HAVE_RAW_DECL_COPY_FILE_RANGE
@@ -473,7 +484,7 @@ _GL_WARN_ON_USE (copy_file_range,
473# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 484# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
474# define dup rpl_dup 485# define dup rpl_dup
475# endif 486# endif
476_GL_FUNCDECL_RPL (dup, int, (int oldfd)); 487_GL_FUNCDECL_RPL (dup, int, (int oldfd), _GL_ATTRIBUTE_NODISCARD);
477_GL_CXXALIAS_RPL (dup, int, (int oldfd)); 488_GL_CXXALIAS_RPL (dup, int, (int oldfd));
478# elif defined _WIN32 && !defined __CYGWIN__ 489# elif defined _WIN32 && !defined __CYGWIN__
479# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 490# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -518,7 +529,7 @@ _GL_CXXALIASWARN (dup);
518# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 529# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
519# define dup2 rpl_dup2 530# define dup2 rpl_dup2
520# endif 531# endif
521_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); 532_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd), );
522_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); 533_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd));
523# elif defined _WIN32 && !defined __CYGWIN__ 534# elif defined _WIN32 && !defined __CYGWIN__
524# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 535# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -567,11 +578,11 @@ _GL_CXXALIASWARN (dup2);
567# undef dup3 578# undef dup3
568# define dup3 rpl_dup3 579# define dup3 rpl_dup3
569# endif 580# endif
570_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); 581_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags), );
571_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); 582_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags));
572# else 583# else
573# if !@HAVE_DUP3@ 584# if !@HAVE_DUP3@
574_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); 585_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags), );
575# endif 586# endif
576_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); 587_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags));
577# endif 588# endif
@@ -636,7 +647,7 @@ rpl_environ (void)
636/* 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
637 the current process. */ 648 the current process. */
638# if !@HAVE_EUIDACCESS@ 649# if !@HAVE_EUIDACCESS@
639_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) 650_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode),
640 _GL_ARG_NONNULL ((1))); 651 _GL_ARG_NONNULL ((1)));
641# endif 652# endif
642_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); 653_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode));
@@ -661,7 +672,7 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
661# undef execl 672# undef execl
662# define execl rpl_execl 673# define execl rpl_execl
663# endif 674# endif
664_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...) 675_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...),
665 _GL_ARG_NONNULL ((1))); 676 _GL_ARG_NONNULL ((1)));
666_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...)); 677_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...));
667# else 678# else
@@ -696,7 +707,7 @@ _GL_CXXALIASWARN (execl);
696# undef execle 707# undef execle
697# define execle rpl_execle 708# define execle rpl_execle
698# endif 709# endif
699_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...) 710_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...),
700 _GL_ARG_NONNULL ((1))); 711 _GL_ARG_NONNULL ((1)));
701_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...)); 712_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...));
702# else 713# else
@@ -732,7 +743,7 @@ _GL_CXXALIASWARN (execle);
732# undef execlp 743# undef execlp
733# define execlp rpl_execlp 744# define execlp rpl_execlp
734# endif 745# endif
735_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...) 746_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...),
736 _GL_ARG_NONNULL ((1))); 747 _GL_ARG_NONNULL ((1)));
737_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...)); 748_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...));
738# else 749# else
@@ -769,7 +780,7 @@ _GL_CXXALIASWARN (execlp);
769# undef execv 780# undef execv
770# define execv rpl_execv 781# define execv rpl_execv
771# endif 782# endif
772_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv) 783_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv),
773 _GL_ARG_NONNULL ((1, 2))); 784 _GL_ARG_NONNULL ((1, 2)));
774_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv)); 785_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv));
775# else 786# else
@@ -806,7 +817,7 @@ _GL_CXXALIASWARN (execv);
806# define execve rpl_execve 817# define execve rpl_execve
807# endif 818# endif
808_GL_FUNCDECL_RPL (execve, int, 819_GL_FUNCDECL_RPL (execve, int,
809 (const char *program, char * const *argv, char * const *env) 820 (const char *program, char * const *argv, char * const *env),
810 _GL_ARG_NONNULL ((1, 2))); 821 _GL_ARG_NONNULL ((1, 2)));
811_GL_CXXALIAS_RPL (execve, int, 822_GL_CXXALIAS_RPL (execve, int,
812 (const char *program, char * const *argv, char * const *env)); 823 (const char *program, char * const *argv, char * const *env));
@@ -846,7 +857,7 @@ _GL_CXXALIASWARN (execve);
846# undef execvp 857# undef execvp
847# define execvp rpl_execvp 858# define execvp rpl_execvp
848# endif 859# endif
849_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv) 860_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv),
850 _GL_ARG_NONNULL ((1, 2))); 861 _GL_ARG_NONNULL ((1, 2)));
851_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv)); 862_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv));
852# else 863# else
@@ -883,14 +894,14 @@ _GL_CXXALIASWARN (execvp);
883# define execvpe rpl_execvpe 894# define execvpe rpl_execvpe
884# endif 895# endif
885_GL_FUNCDECL_RPL (execvpe, int, 896_GL_FUNCDECL_RPL (execvpe, int,
886 (const char *program, char * const *argv, char * const *env) 897 (const char *program, char * const *argv, char * const *env),
887 _GL_ARG_NONNULL ((1, 2))); 898 _GL_ARG_NONNULL ((1, 2)));
888_GL_CXXALIAS_RPL (execvpe, int, 899_GL_CXXALIAS_RPL (execvpe, int,
889 (const char *program, char * const *argv, char * const *env)); 900 (const char *program, char * const *argv, char * const *env));
890# else 901# else
891# if !@HAVE_DECL_EXECVPE@ 902# if !@HAVE_DECL_EXECVPE@
892_GL_FUNCDECL_SYS (execvpe, int, 903_GL_FUNCDECL_SYS (execvpe, int,
893 (const char *program, char * const *argv, char * const *env) 904 (const char *program, char * const *argv, char * const *env),
894 _GL_ARG_NONNULL ((1, 2))); 905 _GL_ARG_NONNULL ((1, 2)));
895# endif 906# endif
896_GL_CXXALIAS_SYS (execvpe, int, 907_GL_CXXALIAS_SYS (execvpe, int,
@@ -921,7 +932,7 @@ _GL_CXXALIAS_MDA_CAST (execvpe, intptr_t,
921# elif @HAVE_EXECVPE@ 932# elif @HAVE_EXECVPE@
922# if !@HAVE_DECL_EXECVPE@ 933# if !@HAVE_DECL_EXECVPE@
923_GL_FUNCDECL_SYS (execvpe, int, 934_GL_FUNCDECL_SYS (execvpe, int,
924 (const char *program, char * const *argv, char * const *env) 935 (const char *program, char * const *argv, char * const *env),
925 _GL_ARG_NONNULL ((1, 2))); 936 _GL_ARG_NONNULL ((1, 2)));
926# endif 937# endif
927_GL_CXXALIAS_SYS (execvpe, int, 938_GL_CXXALIAS_SYS (execvpe, int,
@@ -940,15 +951,15 @@ _GL_CXXALIASWARN (execvpe);
940# define faccessat rpl_faccessat 951# define faccessat rpl_faccessat
941# endif 952# endif
942_GL_FUNCDECL_RPL (faccessat, int, 953_GL_FUNCDECL_RPL (faccessat, int,
943 (int fd, char const *name, int mode, int flag) 954 (int fd, char const *name, int mode, int flag),
944 _GL_ARG_NONNULL ((2))); 955 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
945_GL_CXXALIAS_RPL (faccessat, int, 956_GL_CXXALIAS_RPL (faccessat, int,
946 (int fd, char const *name, int mode, int flag)); 957 (int fd, char const *name, int mode, int flag));
947# else 958# else
948# if !@HAVE_FACCESSAT@ 959# if !@HAVE_FACCESSAT@
949_GL_FUNCDECL_SYS (faccessat, int, 960_GL_FUNCDECL_SYS (faccessat, int,
950 (int fd, char const *file, int mode, int flag) 961 (int fd, char const *file, int mode, int flag),
951 _GL_ARG_NONNULL ((2))); 962 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
952# endif 963# endif
953_GL_CXXALIAS_SYS (faccessat, int, 964_GL_CXXALIAS_SYS (faccessat, int,
954 (int fd, char const *file, int mode, int flag)); 965 (int fd, char const *file, int mode, int flag));
@@ -976,11 +987,11 @@ _GL_WARN_ON_USE (faccessat, "faccessat is not portable - "
976# undef fchdir 987# undef fchdir
977# define fchdir rpl_fchdir 988# define fchdir rpl_fchdir
978# endif 989# endif
979_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/)); 990_GL_FUNCDECL_RPL (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
980_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/)); 991_GL_CXXALIAS_RPL (fchdir, int, (int /*fd*/));
981# else 992# else
982# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@ 993# if !@HAVE_FCHDIR@ || !@HAVE_DECL_FCHDIR@
983_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); 994_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/), _GL_ATTRIBUTE_NODISCARD);
984# endif 995# endif
985_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); 996_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/));
986# endif 997# endif
@@ -1009,15 +1020,15 @@ _GL_WARN_ON_USE (fchdir, "fchdir is unportable - "
1009# define fchownat rpl_fchownat 1020# define fchownat rpl_fchownat
1010# endif 1021# endif
1011_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, 1022_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file,
1012 uid_t owner, gid_t group, int flag) 1023 uid_t owner, gid_t group, int flag),
1013 _GL_ARG_NONNULL ((2))); 1024 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1014_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, 1025_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file,
1015 uid_t owner, gid_t group, int flag)); 1026 uid_t owner, gid_t group, int flag));
1016# else 1027# else
1017# if !@HAVE_FCHOWNAT@ 1028# if !@HAVE_FCHOWNAT@
1018_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, 1029_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file,
1019 uid_t owner, gid_t group, int flag) 1030 uid_t owner, gid_t group, int flag),
1020 _GL_ARG_NONNULL ((2))); 1031 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1021# endif 1032# endif
1022_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, 1033_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file,
1023 uid_t owner, gid_t group, int flag)); 1034 uid_t owner, gid_t group, int flag));
@@ -1042,11 +1053,11 @@ _GL_WARN_ON_USE (fchownat, "fchownat is not portable - "
1042# undef fdatasync 1053# undef fdatasync
1043# define fdatasync rpl_fdatasync 1054# define fdatasync rpl_fdatasync
1044# endif 1055# endif
1045_GL_FUNCDECL_RPL (fdatasync, int, (int fd)); 1056_GL_FUNCDECL_RPL (fdatasync, int, (int fd), );
1046_GL_CXXALIAS_RPL (fdatasync, int, (int fd)); 1057_GL_CXXALIAS_RPL (fdatasync, int, (int fd));
1047# else 1058# else
1048# if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@ 1059# if !@HAVE_FDATASYNC@|| !@HAVE_DECL_FDATASYNC@
1049_GL_FUNCDECL_SYS (fdatasync, int, (int fd)); 1060_GL_FUNCDECL_SYS (fdatasync, int, (int fd), );
1050# endif 1061# endif
1051_GL_CXXALIAS_SYS (fdatasync, int, (int fd)); 1062_GL_CXXALIAS_SYS (fdatasync, int, (int fd));
1052# endif 1063# endif
@@ -1068,7 +1079,7 @@ _GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - "
1068 See POSIX:2008 specification 1079 See POSIX:2008 specification
1069 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */ 1080 <https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsync.html>. */
1070# if !@HAVE_FSYNC@ 1081# if !@HAVE_FSYNC@
1071_GL_FUNCDECL_SYS (fsync, int, (int fd)); 1082_GL_FUNCDECL_SYS (fsync, int, (int fd), );
1072# endif 1083# endif
1073_GL_CXXALIAS_SYS (fsync, int, (int fd)); 1084_GL_CXXALIAS_SYS (fsync, int, (int fd));
1074_GL_CXXALIASWARN (fsync); 1085_GL_CXXALIASWARN (fsync);
@@ -1091,13 +1102,17 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
1091# undef ftruncate 1102# undef ftruncate
1092# define ftruncate rpl_ftruncate 1103# define ftruncate rpl_ftruncate
1093# endif 1104# endif
1094_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); 1105_GL_FUNCDECL_RPL (ftruncate, int,
1095_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));
1096# else 1109# else
1097# if !@HAVE_FTRUNCATE@ 1110# if !@HAVE_FTRUNCATE@
1098_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);
1099# endif 1113# endif
1100_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); 1114_GL_CXXALIAS_SYS (ftruncate, int,
1115 (int fd, off_t length));
1101# endif 1116# endif
1102# if __GLIBC__ >= 2 1117# if __GLIBC__ >= 2
1103_GL_CXXALIASWARN (ftruncate); 1118_GL_CXXALIASWARN (ftruncate);
@@ -1126,7 +1141,8 @@ _GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - "
1126# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1141# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1127# define getcwd rpl_getcwd 1142# define getcwd rpl_getcwd
1128# endif 1143# endif
1129_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);
1130_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); 1146_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size));
1131# elif defined _WIN32 && !defined __CYGWIN__ 1147# elif defined _WIN32 && !defined __CYGWIN__
1132# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1148# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1181,15 +1197,19 @@ _GL_CXXALIASWARN (getcwd);
1181# undef getdomainname 1197# undef getdomainname
1182# define getdomainname rpl_getdomainname 1198# define getdomainname rpl_getdomainname
1183# endif 1199# endif
1184_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) 1200_GL_FUNCDECL_RPL (getdomainname, int,
1185 _GL_ARG_NONNULL ((1))); 1201 (char *name, size_t len),
1186_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));
1187# else 1205# else
1188# if !@HAVE_DECL_GETDOMAINNAME@ 1206# if !@HAVE_DECL_GETDOMAINNAME@
1189_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) 1207_GL_FUNCDECL_SYS (getdomainname, int,
1190 _GL_ARG_NONNULL ((1))); 1208 (char *name, size_t len),
1209 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1191# endif 1210# endif
1192_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); 1211_GL_CXXALIAS_SYS (getdomainname, int,
1212 (char *name, size_t len));
1193# endif 1213# endif
1194# if __GLIBC__ >= 2 1214# if __GLIBC__ >= 2
1195_GL_CXXALIASWARN (getdomainname); 1215_GL_CXXALIASWARN (getdomainname);
@@ -1211,11 +1231,11 @@ _GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - "
1211# undef getdtablesize 1231# undef getdtablesize
1212# define getdtablesize rpl_getdtablesize 1232# define getdtablesize rpl_getdtablesize
1213# endif 1233# endif
1214_GL_FUNCDECL_RPL (getdtablesize, int, (void)); 1234_GL_FUNCDECL_RPL (getdtablesize, int, (void), );
1215_GL_CXXALIAS_RPL (getdtablesize, int, (void)); 1235_GL_CXXALIAS_RPL (getdtablesize, int, (void));
1216# else 1236# else
1217# if !@HAVE_GETDTABLESIZE@ 1237# if !@HAVE_GETDTABLESIZE@
1218_GL_FUNCDECL_SYS (getdtablesize, int, (void)); 1238_GL_FUNCDECL_SYS (getdtablesize, int, (void), );
1219# endif 1239# endif
1220/* Need to cast, because on AIX, the parameter list is 1240/* Need to cast, because on AIX, the parameter list is
1221 (...). */ 1241 (...). */
@@ -1238,13 +1258,17 @@ _GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - "
1238# undef getentropy 1258# undef getentropy
1239# define getentropy rpl_getentropy 1259# define getentropy rpl_getentropy
1240# endif 1260# endif
1241_GL_FUNCDECL_RPL (getentropy, int, (void *buffer, size_t length)); 1261_GL_FUNCDECL_RPL (getentropy, int,
1242_GL_CXXALIAS_RPL (getentropy, int, (void *buffer, size_t length)); 1262 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1263_GL_CXXALIAS_RPL (getentropy, int,
1264 (void *buffer, size_t length));
1243# else 1265# else
1244# if !@HAVE_GETENTROPY@ 1266# if !@HAVE_GETENTROPY@
1245_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); 1267_GL_FUNCDECL_SYS (getentropy, int,
1268 (void *buffer, size_t length), _GL_ATTRIBUTE_NODISCARD);
1246# endif 1269# endif
1247_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); 1270_GL_CXXALIAS_SYS (getentropy, int,
1271 (void *buffer, size_t length));
1248# endif 1272# endif
1249# if __GLIBC__ >= 2 1273# if __GLIBC__ >= 2
1250_GL_CXXALIASWARN (getentropy); 1274_GL_CXXALIASWARN (getentropy);
@@ -1269,13 +1293,17 @@ _GL_WARN_ON_USE (getentropy, "getentropy is unportable - "
1269# undef getgroups 1293# undef getgroups
1270# define getgroups rpl_getgroups 1294# define getgroups rpl_getgroups
1271# endif 1295# endif
1272_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); 1296_GL_FUNCDECL_RPL (getgroups, int,
1273_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));
1274# else 1300# else
1275# if !@HAVE_GETGROUPS@ 1301# if !@HAVE_GETGROUPS@
1276_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);
1277# endif 1304# endif
1278_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); 1305_GL_CXXALIAS_SYS (getgroups, int,
1306 (int n, gid_t *groups));
1279# endif 1307# endif
1280_GL_CXXALIASWARN (getgroups); 1308_GL_CXXALIASWARN (getgroups);
1281#elif defined GNULIB_POSIXCHECK 1309#elif defined GNULIB_POSIXCHECK
@@ -1300,12 +1328,12 @@ _GL_WARN_ON_USE (getgroups, "getgroups is unportable - "
1300# undef gethostname 1328# undef gethostname
1301# define gethostname rpl_gethostname 1329# define gethostname rpl_gethostname
1302# endif 1330# endif
1303_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) 1331_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len),
1304 _GL_ARG_NONNULL ((1))); 1332 _GL_ARG_NONNULL ((1)));
1305_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); 1333_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
1306# else 1334# else
1307# if !@HAVE_GETHOSTNAME@ 1335# if !@HAVE_GETHOSTNAME@
1308_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) 1336_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len),
1309 _GL_ARG_NONNULL ((1))); 1337 _GL_ARG_NONNULL ((1)));
1310# endif 1338# endif
1311/* 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
@@ -1315,8 +1343,10 @@ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
1315# endif 1343# endif
1316_GL_CXXALIASWARN (gethostname); 1344_GL_CXXALIASWARN (gethostname);
1317#elif @UNISTD_H_HAVE_WINSOCK2_H@ 1345#elif @UNISTD_H_HAVE_WINSOCK2_H@
1318# undef gethostname 1346# if !GNULIB_GETHOSTNAME
1319# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname 1347# undef gethostname
1348# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
1349# endif
1320#elif defined GNULIB_POSIXCHECK 1350#elif defined GNULIB_POSIXCHECK
1321# undef gethostname 1351# undef gethostname
1322# if HAVE_RAW_DECL_GETHOSTNAME 1352# if HAVE_RAW_DECL_GETHOSTNAME
@@ -1337,11 +1367,21 @@ _GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
1337 ${LOGNAME-$USER} on Unix platforms, 1367 ${LOGNAME-$USER} on Unix platforms,
1338 $USERNAME on native Windows platforms. 1368 $USERNAME on native Windows platforms.
1339 */ 1369 */
1340# if !@HAVE_DECL_GETLOGIN@ 1370# if @REPLACE_GETLOGIN@
1341_GL_FUNCDECL_SYS (getlogin, char *, (void)); 1371# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1342# 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
1343_GL_CXXALIAS_SYS (getlogin, char *, (void)); 1380_GL_CXXALIAS_SYS (getlogin, char *, (void));
1381# endif
1382# if __GLIBC__ >= 2
1344_GL_CXXALIASWARN (getlogin); 1383_GL_CXXALIASWARN (getlogin);
1384# endif
1345#elif defined GNULIB_POSIXCHECK 1385#elif defined GNULIB_POSIXCHECK
1346# undef getlogin 1386# undef getlogin
1347# if HAVE_RAW_DECL_GETLOGIN 1387# if HAVE_RAW_DECL_GETLOGIN
@@ -1370,12 +1410,12 @@ _GL_WARN_ON_USE (getlogin, "getlogin is unportable - "
1370# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1410# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1371# define getlogin_r rpl_getlogin_r 1411# define getlogin_r rpl_getlogin_r
1372# endif 1412# endif
1373_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) 1413_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size),
1374 _GL_ARG_NONNULL ((1))); 1414 _GL_ARG_NONNULL ((1)));
1375_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); 1415_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size));
1376# else 1416# else
1377# if !@HAVE_DECL_GETLOGIN_R@ 1417# if !@HAVE_DECL_GETLOGIN_R@
1378_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) 1418_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size),
1379 _GL_ARG_NONNULL ((1))); 1419 _GL_ARG_NONNULL ((1)));
1380# endif 1420# endif
1381/* 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
@@ -1399,13 +1439,13 @@ _GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - "
1399# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1439# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1400# define getpagesize rpl_getpagesize 1440# define getpagesize rpl_getpagesize
1401# endif 1441# endif
1402_GL_FUNCDECL_RPL (getpagesize, int, (void)); 1442_GL_FUNCDECL_RPL (getpagesize, int, (void), );
1403_GL_CXXALIAS_RPL (getpagesize, int, (void)); 1443_GL_CXXALIAS_RPL (getpagesize, int, (void));
1404# else 1444# else
1405/* 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
1406 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. */
1407# if defined __hpux 1447# if defined __hpux
1408_GL_FUNCDECL_SYS (getpagesize, int, (void)); 1448_GL_FUNCDECL_SYS (getpagesize, int, (void), );
1409# endif 1449# endif
1410# if !@HAVE_GETPAGESIZE@ 1450# if !@HAVE_GETPAGESIZE@
1411# if !defined getpagesize 1451# if !defined getpagesize
@@ -1456,7 +1496,7 @@ _GL_FUNCDECL_SYS (getpagesize, int, (void));
1456# define getpagesize() _gl_getpagesize () 1496# define getpagesize() _gl_getpagesize ()
1457# else 1497# else
1458# if !GNULIB_defined_getpagesize_function 1498# if !GNULIB_defined_getpagesize_function
1459_GL_UNISTD_INLINE int 1499_GL_GETPAGESIZE_INLINE int
1460getpagesize () 1500getpagesize ()
1461{ 1501{
1462 return _gl_getpagesize (); 1502 return _gl_getpagesize ();
@@ -1492,12 +1532,12 @@ _GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - "
1492# undef getpass 1532# undef getpass
1493# define getpass rpl_getpass 1533# define getpass rpl_getpass
1494# endif 1534# endif
1495_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) 1535_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt),
1496 _GL_ARG_NONNULL ((1))); 1536 _GL_ARG_NONNULL ((1)));
1497_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); 1537_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt));
1498# else 1538# else
1499# if !@HAVE_GETPASS@ 1539# if !@HAVE_GETPASS@
1500_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) 1540_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt),
1501 _GL_ARG_NONNULL ((1))); 1541 _GL_ARG_NONNULL ((1)));
1502# endif 1542# endif
1503_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); 1543_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt));
@@ -1530,12 +1570,21 @@ _GL_CXXALIASWARN (getpid);
1530 1570
1531 1571
1532#if @GNULIB_GETUSERSHELL@ 1572#if @GNULIB_GETUSERSHELL@
1573# if @REPLACE_GETUSERSHELL@
1533/* 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
1534 the list has been reached. */ 1575 the list has been reached. */
1535# if !@HAVE_DECL_GETUSERSHELL@ 1576# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1536_GL_FUNCDECL_SYS (getusershell, char *, (void)); 1577# undef getusershell
1537# 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
1538_GL_CXXALIAS_SYS (getusershell, char *, (void)); 1586_GL_CXXALIAS_SYS (getusershell, char *, (void));
1587# endif
1539_GL_CXXALIASWARN (getusershell); 1588_GL_CXXALIASWARN (getusershell);
1540#elif defined GNULIB_POSIXCHECK 1589#elif defined GNULIB_POSIXCHECK
1541# undef getusershell 1590# undef getusershell
@@ -1547,10 +1596,19 @@ _GL_WARN_ON_USE (getusershell, "getusershell is unportable - "
1547 1596
1548#if @GNULIB_GETUSERSHELL@ 1597#if @GNULIB_GETUSERSHELL@
1549/* Rewind to pointer that is advanced at each getusershell() call. */ 1598/* Rewind to pointer that is advanced at each getusershell() call. */
1550# if !@HAVE_DECL_GETUSERSHELL@ 1599# if @REPLACE_GETUSERSHELL@
1551_GL_FUNCDECL_SYS (setusershell, void, (void)); 1600# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1552# 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
1553_GL_CXXALIAS_SYS (setusershell, void, (void)); 1610_GL_CXXALIAS_SYS (setusershell, void, (void));
1611# endif
1554_GL_CXXALIASWARN (setusershell); 1612_GL_CXXALIASWARN (setusershell);
1555#elif defined GNULIB_POSIXCHECK 1613#elif defined GNULIB_POSIXCHECK
1556# undef setusershell 1614# undef setusershell
@@ -1563,10 +1621,19 @@ _GL_WARN_ON_USE (setusershell, "setusershell is unportable - "
1563#if @GNULIB_GETUSERSHELL@ 1621#if @GNULIB_GETUSERSHELL@
1564/* Free the pointer that is advanced at each getusershell() call and 1622/* Free the pointer that is advanced at each getusershell() call and
1565 associated resources. */ 1623 associated resources. */
1566# if !@HAVE_DECL_GETUSERSHELL@ 1624# if @REPLACE_GETUSERSHELL@
1567_GL_FUNCDECL_SYS (endusershell, void, (void)); 1625# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1568# 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
1569_GL_CXXALIAS_SYS (endusershell, void, (void)); 1635_GL_CXXALIAS_SYS (endusershell, void, (void));
1636# endif
1570_GL_CXXALIASWARN (endusershell); 1637_GL_CXXALIASWARN (endusershell);
1571#elif defined GNULIB_POSIXCHECK 1638#elif defined GNULIB_POSIXCHECK
1572# undef endusershell 1639# undef endusershell
@@ -1580,7 +1647,7 @@ _GL_WARN_ON_USE (endusershell, "endusershell is unportable - "
1580#if @GNULIB_GROUP_MEMBER@ 1647#if @GNULIB_GROUP_MEMBER@
1581/* Determine whether group id is in calling user's group list. */ 1648/* Determine whether group id is in calling user's group list. */
1582# if !@HAVE_GROUP_MEMBER@ 1649# if !@HAVE_GROUP_MEMBER@
1583_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); 1650_GL_FUNCDECL_SYS (group_member, int, (gid_t gid), );
1584# endif 1651# endif
1585_GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); 1652_GL_CXXALIAS_SYS (group_member, int, (gid_t gid));
1586_GL_CXXALIASWARN (group_member); 1653_GL_CXXALIASWARN (group_member);
@@ -1600,7 +1667,7 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
1600# define isatty rpl_isatty 1667# define isatty rpl_isatty
1601# endif 1668# endif
1602# define GNULIB_defined_isatty 1 1669# define GNULIB_defined_isatty 1
1603_GL_FUNCDECL_RPL (isatty, int, (int fd)); 1670_GL_FUNCDECL_RPL (isatty, int, (int fd), );
1604_GL_CXXALIAS_RPL (isatty, int, (int fd)); 1671_GL_CXXALIAS_RPL (isatty, int, (int fd));
1605# elif defined _WIN32 && !defined __CYGWIN__ 1672# elif defined _WIN32 && !defined __CYGWIN__
1606# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1673# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1646,13 +1713,13 @@ _GL_CXXALIASWARN (isatty);
1646# undef lchown 1713# undef lchown
1647# define lchown rpl_lchown 1714# define lchown rpl_lchown
1648# endif 1715# endif
1649_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),
1650 _GL_ARG_NONNULL ((1))); 1717 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1651_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));
1652# else 1719# else
1653# if !@HAVE_LCHOWN@ 1720# if !@HAVE_LCHOWN@
1654_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),
1655 _GL_ARG_NONNULL ((1))); 1722 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
1656# endif 1723# endif
1657_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));
1658# endif 1725# endif
@@ -1675,13 +1742,13 @@ _GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - "
1675# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1742# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1676# define link rpl_link 1743# define link rpl_link
1677# endif 1744# endif
1678_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) 1745_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2),
1679 _GL_ARG_NONNULL ((1, 2))); 1746 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1680_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); 1747_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2));
1681# else 1748# else
1682# if !@HAVE_LINK@ 1749# if !@HAVE_LINK@
1683_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) 1750_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2),
1684 _GL_ARG_NONNULL ((1, 2))); 1751 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1685# endif 1752# endif
1686_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); 1753_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2));
1687# endif 1754# endif
@@ -1706,8 +1773,8 @@ _GL_WARN_ON_USE (link, "link is unportable - "
1706# endif 1773# endif
1707_GL_FUNCDECL_RPL (linkat, int, 1774_GL_FUNCDECL_RPL (linkat, int,
1708 (int fd1, const char *path1, int fd2, const char *path2, 1775 (int fd1, const char *path1, int fd2, const char *path2,
1709 int flag) 1776 int flag),
1710 _GL_ARG_NONNULL ((2, 4))); 1777 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1711_GL_CXXALIAS_RPL (linkat, int, 1778_GL_CXXALIAS_RPL (linkat, int,
1712 (int fd1, const char *path1, int fd2, const char *path2, 1779 (int fd1, const char *path1, int fd2, const char *path2,
1713 int flag)); 1780 int flag));
@@ -1715,8 +1782,8 @@ _GL_CXXALIAS_RPL (linkat, int,
1715# if !@HAVE_LINKAT@ 1782# if !@HAVE_LINKAT@
1716_GL_FUNCDECL_SYS (linkat, int, 1783_GL_FUNCDECL_SYS (linkat, int,
1717 (int fd1, const char *path1, int fd2, const char *path2, 1784 (int fd1, const char *path1, int fd2, const char *path2,
1718 int flag) 1785 int flag),
1719 _GL_ARG_NONNULL ((2, 4))); 1786 _GL_ARG_NONNULL ((2, 4)) _GL_ATTRIBUTE_NODISCARD);
1720# endif 1787# endif
1721_GL_CXXALIAS_SYS (linkat, int, 1788_GL_CXXALIAS_SYS (linkat, int,
1722 (int fd1, const char *path1, int fd2, const char *path2, 1789 (int fd1, const char *path1, int fd2, const char *path2,
@@ -1743,7 +1810,7 @@ _GL_WARN_ON_USE (linkat, "linkat is unportable - "
1743# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1810# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1744# define lseek rpl_lseek 1811# define lseek rpl_lseek
1745# endif 1812# endif
1746_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), );
1747_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));
1748# elif defined _WIN32 && !defined __CYGWIN__ 1815# elif defined _WIN32 && !defined __CYGWIN__
1749# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1816# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1783,7 +1850,8 @@ _GL_CXXALIASWARN (lseek);
1783 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].
1784 Return 0 upon success, or -1 with errno set upon failure. */ 1851 Return 0 upon success, or -1 with errno set upon failure. */
1785# if !@HAVE_PIPE@ 1852# if !@HAVE_PIPE@
1786_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);
1787# endif 1855# endif
1788_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); 1856_GL_CXXALIAS_SYS (pipe, int, (int fd[2]));
1789_GL_CXXALIASWARN (pipe); 1857_GL_CXXALIASWARN (pipe);
@@ -1810,10 +1878,12 @@ _GL_WARN_ON_USE (pipe, "pipe is unportable - "
1810# undef pipe2 1878# undef pipe2
1811# define pipe2 rpl_pipe2 1879# define pipe2 rpl_pipe2
1812# endif 1880# endif
1813_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);
1814_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); 1883_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags));
1815# else 1884# else
1816_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);
1817_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); 1887_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags));
1818# endif 1888# endif
1819# if __GLIBC__ >= 2 1889# if __GLIBC__ >= 2
@@ -1840,15 +1910,15 @@ _GL_WARN_ON_USE (pipe2, "pipe2 is unportable - "
1840# define pread rpl_pread 1910# define pread rpl_pread
1841# endif 1911# endif
1842_GL_FUNCDECL_RPL (pread, ssize_t, 1912_GL_FUNCDECL_RPL (pread, ssize_t,
1843 (int fd, void *buf, size_t bufsize, off_t offset) 1913 (int fd, void *buf, size_t bufsize, off_t offset),
1844 _GL_ARG_NONNULL ((2))); 1914 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1845_GL_CXXALIAS_RPL (pread, ssize_t, 1915_GL_CXXALIAS_RPL (pread, ssize_t,
1846 (int fd, void *buf, size_t bufsize, off_t offset)); 1916 (int fd, void *buf, size_t bufsize, off_t offset));
1847# else 1917# else
1848# if !@HAVE_PREAD@ 1918# if !@HAVE_PREAD@
1849_GL_FUNCDECL_SYS (pread, ssize_t, 1919_GL_FUNCDECL_SYS (pread, ssize_t,
1850 (int fd, void *buf, size_t bufsize, off_t offset) 1920 (int fd, void *buf, size_t bufsize, off_t offset),
1851 _GL_ARG_NONNULL ((2))); 1921 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1852# endif 1922# endif
1853_GL_CXXALIAS_SYS (pread, ssize_t, 1923_GL_CXXALIAS_SYS (pread, ssize_t,
1854 (int fd, void *buf, size_t bufsize, off_t offset)); 1924 (int fd, void *buf, size_t bufsize, off_t offset));
@@ -1877,15 +1947,15 @@ _GL_WARN_ON_USE (pread, "pread is unportable - "
1877# define pwrite rpl_pwrite 1947# define pwrite rpl_pwrite
1878# endif 1948# endif
1879_GL_FUNCDECL_RPL (pwrite, ssize_t, 1949_GL_FUNCDECL_RPL (pwrite, ssize_t,
1880 (int fd, const void *buf, size_t bufsize, off_t offset) 1950 (int fd, const void *buf, size_t bufsize, off_t offset),
1881 _GL_ARG_NONNULL ((2))); 1951 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1882_GL_CXXALIAS_RPL (pwrite, ssize_t, 1952_GL_CXXALIAS_RPL (pwrite, ssize_t,
1883 (int fd, const void *buf, size_t bufsize, off_t offset)); 1953 (int fd, const void *buf, size_t bufsize, off_t offset));
1884# else 1954# else
1885# if !@HAVE_PWRITE@ 1955# if !@HAVE_PWRITE@
1886_GL_FUNCDECL_SYS (pwrite, ssize_t, 1956_GL_FUNCDECL_SYS (pwrite, ssize_t,
1887 (int fd, const void *buf, size_t bufsize, off_t offset) 1957 (int fd, const void *buf, size_t bufsize, off_t offset),
1888 _GL_ARG_NONNULL ((2))); 1958 _GL_ARG_NONNULL ((2)) _GL_ATTRIBUTE_NODISCARD);
1889# endif 1959# endif
1890_GL_CXXALIAS_SYS (pwrite, ssize_t, 1960_GL_CXXALIAS_SYS (pwrite, ssize_t,
1891 (int fd, const void *buf, size_t bufsize, off_t offset)); 1961 (int fd, const void *buf, size_t bufsize, off_t offset));
@@ -1911,8 +1981,9 @@ _GL_WARN_ON_USE (pwrite, "pwrite is unportable - "
1911# undef read 1981# undef read
1912# define read rpl_read 1982# define read rpl_read
1913# endif 1983# endif
1914_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) 1984
1915 _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);
1916_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));
1917# elif defined _WIN32 && !defined __CYGWIN__ 1988# elif defined _WIN32 && !defined __CYGWIN__
1918# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 1989# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -1933,11 +2004,7 @@ _GL_CXXALIASWARN (read);
1933# undef read 2004# undef read
1934# define read _read 2005# define read _read
1935# endif 2006# endif
1936# ifdef __MINGW32__ 2007_GL_CXXALIAS_MDA_CAST (read, ssize_t, (int fd, void *buf, unsigned int count));
1937_GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count));
1938# else
1939_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count));
1940# endif
1941# else 2008# else
1942_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));
1943# endif 2010# endif
@@ -1957,8 +2024,8 @@ _GL_CXXALIASWARN (read);
1957# endif 2024# endif
1958_GL_FUNCDECL_RPL (readlink, ssize_t, 2025_GL_FUNCDECL_RPL (readlink, ssize_t,
1959 (const char *restrict file, 2026 (const char *restrict file,
1960 char *restrict buf, size_t bufsize) 2027 char *restrict buf, size_t bufsize),
1961 _GL_ARG_NONNULL ((1, 2))); 2028 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1962_GL_CXXALIAS_RPL (readlink, ssize_t, 2029_GL_CXXALIAS_RPL (readlink, ssize_t,
1963 (const char *restrict file, 2030 (const char *restrict file,
1964 char *restrict buf, size_t bufsize)); 2031 char *restrict buf, size_t bufsize));
@@ -1966,8 +2033,8 @@ _GL_CXXALIAS_RPL (readlink, ssize_t,
1966# if !@HAVE_READLINK@ 2033# if !@HAVE_READLINK@
1967_GL_FUNCDECL_SYS (readlink, ssize_t, 2034_GL_FUNCDECL_SYS (readlink, ssize_t,
1968 (const char *restrict file, 2035 (const char *restrict file,
1969 char *restrict buf, size_t bufsize) 2036 char *restrict buf, size_t bufsize),
1970 _GL_ARG_NONNULL ((1, 2))); 2037 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
1971# endif 2038# endif
1972_GL_CXXALIAS_SYS (readlink, ssize_t, 2039_GL_CXXALIAS_SYS (readlink, ssize_t,
1973 (const char *restrict file, 2040 (const char *restrict file,
@@ -1990,8 +2057,8 @@ _GL_WARN_ON_USE (readlink, "readlink is unportable - "
1990# endif 2057# endif
1991_GL_FUNCDECL_RPL (readlinkat, ssize_t, 2058_GL_FUNCDECL_RPL (readlinkat, ssize_t,
1992 (int fd, char const *restrict file, 2059 (int fd, char const *restrict file,
1993 char *restrict buf, size_t len) 2060 char *restrict buf, size_t len),
1994 _GL_ARG_NONNULL ((2, 3))); 2061 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
1995_GL_CXXALIAS_RPL (readlinkat, ssize_t, 2062_GL_CXXALIAS_RPL (readlinkat, ssize_t,
1996 (int fd, char const *restrict file, 2063 (int fd, char const *restrict file,
1997 char *restrict buf, size_t len)); 2064 char *restrict buf, size_t len));
@@ -1999,8 +2066,8 @@ _GL_CXXALIAS_RPL (readlinkat, ssize_t,
1999# if !@HAVE_READLINKAT@ 2066# if !@HAVE_READLINKAT@
2000_GL_FUNCDECL_SYS (readlinkat, ssize_t, 2067_GL_FUNCDECL_SYS (readlinkat, ssize_t,
2001 (int fd, char const *restrict file, 2068 (int fd, char const *restrict file,
2002 char *restrict buf, size_t len) 2069 char *restrict buf, size_t len),
2003 _GL_ARG_NONNULL ((2, 3))); 2070 _GL_ARG_NONNULL ((2, 3)) _GL_ATTRIBUTE_NODISCARD);
2004# endif 2071# endif
2005_GL_CXXALIAS_SYS (readlinkat, ssize_t, 2072_GL_CXXALIAS_SYS (readlinkat, ssize_t,
2006 (int fd, char const *restrict file, 2073 (int fd, char const *restrict file,
@@ -2024,7 +2091,7 @@ _GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - "
2024# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2091# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2025# define rmdir rpl_rmdir 2092# define rmdir rpl_rmdir
2026# endif 2093# endif
2027_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)));
2028_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); 2095_GL_CXXALIAS_RPL (rmdir, int, (char const *name));
2029# elif defined _WIN32 && !defined __CYGWIN__ 2096# elif defined _WIN32 && !defined __CYGWIN__
2030# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2097# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2073,18 +2140,22 @@ _GL_CXXALIASWARN (rmdir);
2073# undef sethostname 2140# undef sethostname
2074# define sethostname rpl_sethostname 2141# define sethostname rpl_sethostname
2075# endif 2142# endif
2076_GL_FUNCDECL_RPL (sethostname, int, (const char *name, size_t len) 2143_GL_FUNCDECL_RPL (sethostname, int,
2077 _GL_ARG_NONNULL ((1))); 2144 (const char *name, size_t len),
2078_GL_CXXALIAS_RPL (sethostname, int, (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));
2079# else 2148# else
2080# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ 2149# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
2081_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) 2150_GL_FUNCDECL_SYS (sethostname, int,
2082 _GL_ARG_NONNULL ((1))); 2151 (const char *name, size_t len),
2152 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2083# endif 2153# endif
2084/* 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
2085 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
2086 2011-10, the first parameter is not const. */ 2156 2011-10, the first parameter is not const. */
2087_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));
2088# endif 2159# endif
2089# if __GLIBC__ >= 2 2160# if __GLIBC__ >= 2
2090_GL_CXXALIASWARN (sethostname); 2161_GL_CXXALIASWARN (sethostname);
@@ -2108,11 +2179,11 @@ _GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
2108# undef sleep 2179# undef sleep
2109# define sleep rpl_sleep 2180# define sleep rpl_sleep
2110# endif 2181# endif
2111_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); 2182_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n), );
2112_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); 2183_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n));
2113# else 2184# else
2114# if !@HAVE_SLEEP@ 2185# if !@HAVE_SLEEP@
2115_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); 2186_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n), );
2116# endif 2187# endif
2117_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); 2188_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n));
2118# endif 2189# endif
@@ -2157,15 +2228,19 @@ _GL_CXXALIASWARN (swab);
2157# undef symlink 2228# undef symlink
2158# define symlink rpl_symlink 2229# define symlink rpl_symlink
2159# endif 2230# endif
2160_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) 2231_GL_FUNCDECL_RPL (symlink, int,
2161 _GL_ARG_NONNULL ((1, 2))); 2232 (char const *contents, char const *file),
2162_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));
2163# else 2236# else
2164# if !@HAVE_SYMLINK@ 2237# if !@HAVE_SYMLINK@
2165_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) 2238_GL_FUNCDECL_SYS (symlink, int,
2166 _GL_ARG_NONNULL ((1, 2))); 2239 (char const *contents, char const *file),
2240 _GL_ARG_NONNULL ((1, 2)) _GL_ATTRIBUTE_NODISCARD);
2167# endif 2241# endif
2168_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); 2242_GL_CXXALIAS_SYS (symlink, int,
2243 (char const *contents, char const *file));
2169# endif 2244# endif
2170_GL_CXXALIASWARN (symlink); 2245_GL_CXXALIASWARN (symlink);
2171#elif defined GNULIB_POSIXCHECK 2246#elif defined GNULIB_POSIXCHECK
@@ -2184,15 +2259,15 @@ _GL_WARN_ON_USE (symlink, "symlink is not portable - "
2184# define symlinkat rpl_symlinkat 2259# define symlinkat rpl_symlinkat
2185# endif 2260# endif
2186_GL_FUNCDECL_RPL (symlinkat, int, 2261_GL_FUNCDECL_RPL (symlinkat, int,
2187 (char const *contents, int fd, char const *file) 2262 (char const *contents, int fd, char const *file),
2188 _GL_ARG_NONNULL ((1, 3))); 2263 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2189_GL_CXXALIAS_RPL (symlinkat, int, 2264_GL_CXXALIAS_RPL (symlinkat, int,
2190 (char const *contents, int fd, char const *file)); 2265 (char const *contents, int fd, char const *file));
2191# else 2266# else
2192# if !@HAVE_SYMLINKAT@ 2267# if !@HAVE_SYMLINKAT@
2193_GL_FUNCDECL_SYS (symlinkat, int, 2268_GL_FUNCDECL_SYS (symlinkat, int,
2194 (char const *contents, int fd, char const *file) 2269 (char const *contents, int fd, char const *file),
2195 _GL_ARG_NONNULL ((1, 3))); 2270 _GL_ARG_NONNULL ((1, 3)) _GL_ATTRIBUTE_NODISCARD);
2196# endif 2271# endif
2197_GL_CXXALIAS_SYS (symlinkat, int, 2272_GL_CXXALIAS_SYS (symlinkat, int,
2198 (char const *contents, int fd, char const *file)); 2273 (char const *contents, int fd, char const *file));
@@ -2219,13 +2294,13 @@ _GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - "
2219# undef truncate 2294# undef truncate
2220# define truncate rpl_truncate 2295# define truncate rpl_truncate
2221# endif 2296# endif
2222_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) 2297_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length),
2223 _GL_ARG_NONNULL ((1))); 2298 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2224_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); 2299_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length));
2225# else 2300# else
2226# if !@HAVE_DECL_TRUNCATE@ 2301# if !@HAVE_DECL_TRUNCATE@
2227_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) 2302_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length),
2228 _GL_ARG_NONNULL ((1))); 2303 _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD);
2229# endif 2304# endif
2230_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); 2305_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length));
2231# endif 2306# endif
@@ -2250,13 +2325,15 @@ _GL_WARN_ON_USE (truncate, "truncate is unportable - "
2250# define ttyname_r rpl_ttyname_r 2325# define ttyname_r rpl_ttyname_r
2251# endif 2326# endif
2252_GL_FUNCDECL_RPL (ttyname_r, int, 2327_GL_FUNCDECL_RPL (ttyname_r, int,
2253 (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);
2254_GL_CXXALIAS_RPL (ttyname_r, int, 2330_GL_CXXALIAS_RPL (ttyname_r, int,
2255 (int fd, char *buf, size_t buflen)); 2331 (int fd, char *buf, size_t buflen));
2256# else 2332# else
2257# if !@HAVE_DECL_TTYNAME_R@ 2333# if !@HAVE_DECL_TTYNAME_R@
2258_GL_FUNCDECL_SYS (ttyname_r, int, 2334_GL_FUNCDECL_SYS (ttyname_r, int,
2259 (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);
2260# endif 2337# endif
2261_GL_CXXALIAS_SYS (ttyname_r, int, 2338_GL_CXXALIAS_SYS (ttyname_r, int,
2262 (int fd, char *buf, size_t buflen)); 2339 (int fd, char *buf, size_t buflen));
@@ -2279,7 +2356,7 @@ _GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - "
2279# undef unlink 2356# undef unlink
2280# define unlink rpl_unlink 2357# define unlink rpl_unlink
2281# endif 2358# endif
2282_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)));
2283_GL_CXXALIAS_RPL (unlink, int, (char const *file)); 2360_GL_CXXALIAS_RPL (unlink, int, (char const *file));
2284# elif defined _WIN32 && !defined __CYGWIN__ 2361# elif defined _WIN32 && !defined __CYGWIN__
2285# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2362# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -2320,12 +2397,12 @@ _GL_CXXALIASWARN (unlink);
2320# undef unlinkat 2397# undef unlinkat
2321# define unlinkat rpl_unlinkat 2398# define unlinkat rpl_unlinkat
2322# endif 2399# endif
2323_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),
2324 _GL_ARG_NONNULL ((2))); 2401 _GL_ARG_NONNULL ((2)));
2325_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));
2326# else 2403# else
2327# if !@HAVE_UNLINKAT@ 2404# if !@HAVE_UNLINKAT@
2328_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),
2329 _GL_ARG_NONNULL ((2))); 2406 _GL_ARG_NONNULL ((2)));
2330# endif 2407# endif
2331_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));
@@ -2343,18 +2420,18 @@ _GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - "
2343#if @GNULIB_USLEEP@ 2420#if @GNULIB_USLEEP@
2344/* Pause the execution of the current thread for N microseconds. 2421/* Pause the execution of the current thread for N microseconds.
2345 Returns 0 on completion, or -1 on range error. 2422 Returns 0 on completion, or -1 on range error.
2346 See the POSIX:2001 specification 2423 See the POSIX.1-2004 specification
2347 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */ 2424 <https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
2348# if @REPLACE_USLEEP@ 2425# if @REPLACE_USLEEP@
2349# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2426# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2350# undef usleep 2427# undef usleep
2351# define usleep rpl_usleep 2428# define usleep rpl_usleep
2352# endif 2429# endif
2353_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); 2430_GL_FUNCDECL_RPL (usleep, int, (useconds_t n), );
2354_GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); 2431_GL_CXXALIAS_RPL (usleep, int, (useconds_t n));
2355# else 2432# else
2356# if !@HAVE_USLEEP@ 2433# if !@HAVE_USLEEP@
2357_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); 2434_GL_FUNCDECL_SYS (usleep, int, (useconds_t n), );
2358# endif 2435# endif
2359/* Need to cast, because on Haiku, the first parameter is 2436/* Need to cast, because on Haiku, the first parameter is
2360 unsigned int n. */ 2437 unsigned int n. */
@@ -2379,17 +2456,21 @@ _GL_WARN_ON_USE (usleep, "usleep is unportable - "
2379# undef write 2456# undef write
2380# define write rpl_write 2457# define write rpl_write
2381# endif 2458# endif
2382_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) 2459_GL_FUNCDECL_RPL (write, ssize_t,
2383 _GL_ARG_NONNULL ((2))); 2460 (int fd, const void *buf, size_t count),
2384_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));
2385# elif defined _WIN32 && !defined __CYGWIN__ 2464# elif defined _WIN32 && !defined __CYGWIN__
2386# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 2465# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
2387# undef write 2466# undef write
2388# define write _write 2467# define write _write
2389# endif 2468# endif
2390_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));
2391# else 2471# else
2392_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));
2393# endif 2474# endif
2394_GL_CXXALIASWARN (write); 2475_GL_CXXALIASWARN (write);
2395#elif @GNULIB_MDA_WRITE@ 2476#elif @GNULIB_MDA_WRITE@
@@ -2401,13 +2482,11 @@ _GL_CXXALIASWARN (write);
2401# undef write 2482# undef write
2402# define write _write 2483# define write _write
2403# endif 2484# endif
2404# ifdef __MINGW32__ 2485_GL_CXXALIAS_MDA_CAST (write, ssize_t,
2405_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count)); 2486 (int fd, const void *buf, unsigned int count));
2406# else
2407_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count));
2408# endif
2409# else 2487# else
2410_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));
2411# endif 2490# endif
2412_GL_CXXALIASWARN (write); 2491_GL_CXXALIASWARN (write);
2413#endif 2492#endif