The getrandom module produces a Continuous Integration failure, see https://gitlab.com/gnulib/gnulib-ci/-/jobs/574033012 . Namely:
In file included from getentropy.c:24:0: ./sys/random.h:8:9: error: conflicting types for 'getrandom' ssize_t getrandom (void *, size_t, unsigned int); ^~~~~~~~~ In file included from getentropy.c:21:0: ./unistd.h:1512:1: note: previous declaration of 'getrandom' was here _GL_FUNCDECL_SYS (getrandom, int, (void *buffer, size_t length, ^ Makefile:8195: recipe for target 'getentropy.o' failed make[4]: *** [getentropy.o] Error 1 Namely, there is a declaration in <sys/random.h> with return type 'ssize_t' and another declaration in <unistd.h> with return type 'int'. Since 1) The documentation of this function on glibc systems has return type 'ssize_t' https://www.gnu.org/software/libc/manual/html_node/Unpredictable-Bytes.html https://www.man7.org/linux/man-pages/man2/getrandom.2.html 2) No known system declares the function in <unistd.h> (Solaris 11 has it in <sys/random.h>). I conclude that gnulib does not need to offer this function in <unistd.h>. 2020-05-30 Bruno Haible <br...@clisp.org> unistd: Remove conflicting declaration of getrandom(). * lib/unistd.in.h (getrandom): Remove declaration. * m4/unistd_h.m4 (gl_UNISTD_H): Don't test whether getrandom is declared. (gl_UNISTD_H_DEFAULTS): Don't initialize GNULIB_GETRANDOM, HAVE_GETRANDOM. * modules/unistd (Makefile.am): Don't substitute GNULIB_GETRANDOM, HAVE_GETRANDOM. diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 4a0d665..906f806 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1030,24 +1030,6 @@ _GL_WARN_ON_USE (getpass, "getpass is unportable - " #endif -#if @GNULIB_GETRANDOM@ -/* Fill a buffer with random bytes. */ -# if !@HAVE_GETRANDOM@ -_GL_FUNCDECL_SYS (getrandom, int, (void *buffer, size_t length, - unsigned int flags)); -# endif -_GL_CXXALIAS_SYS (getrandom, int, (void *buffer, size_t length, - unsigned int flags)); -_GL_CXXALIASWARN (getrandom); -#elif defined GNULIB_POSIXCHECK -# undef getrandom -# if HAVE_RAW_DECL_GETRANDOM -_GL_WARN_ON_USE (getrandom, "getrandom is unportable - " - "use gnulib module getrandom for portability"); -# endif -#endif - - #if @GNULIB_GETUSERSHELL@ /* Return the next valid login shell on the system, or NULL when the end of the list has been reached. */ diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index 1f39d53..a3b4633 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 78 +# unistd_h.m4 serial 79 dnl Copyright (C) 2006-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -44,7 +44,7 @@ AC_DEFUN([gl_UNISTD_H], ]], [access chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize getentropy getgroups gethostname getlogin getlogin_r getpagesize getpass - getrandom getusershell setusershell endusershell + getusershell setusershell endusershell group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite readlink readlinkat rmdir sethostname sleep symlink symlinkat truncate ttyname_r unlink unlinkat usleep]) @@ -90,7 +90,6 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], GNULIB_GETOPT_POSIX=0; AC_SUBST([GNULIB_GETOPT_POSIX]) GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) GNULIB_GETPASS=0; AC_SUBST([GNULIB_GETPASS]) - GNULIB_GETRANDOM=0; AC_SUBST([GNULIB_GETRANDOM]) GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER]) GNULIB_ISATTY=0; AC_SUBST([GNULIB_ISATTY]) @@ -137,7 +136,6 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) HAVE_GETPASS=1; AC_SUBST([HAVE_GETPASS]) - HAVE_GETRANDOM=1; AC_SUBST([HAVE_GETRANDOM]) HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER]) HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) HAVE_LINK=1; AC_SUBST([HAVE_LINK]) diff --git a/modules/unistd b/modules/unistd index dc32ce0..f075b78 100644 --- a/modules/unistd +++ b/modules/unistd @@ -63,7 +63,6 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_GETOPT_POSIX''@/$(GNULIB_GETOPT_POSIX)/g' \ -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \ -e 's/@''GNULIB_GETPASS''@/$(GNULIB_GETPASS)/g' \ - -e 's/@''GNULIB_GETRANDOM''@/$(GNULIB_GETRANDOM)/g' \ -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \ -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \ -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \ @@ -110,7 +109,6 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ -e 's|@''HAVE_GETPASS''@|$(HAVE_GETPASS)|g' \ - -e 's|@''HAVE_GETRANDOM''@|$(HAVE_GETRANDOM)|g' \ -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \