Module Name: src Committed By: martin Date: Wed Oct 9 13:12:40 UTC 2024
Modified Files: src/include [netbsd-10]: limits.h unistd.h src/lib/libc/gen [netbsd-10]: getentropy.3 Log Message: Pull up following revision(s) (requested by riastradh in ticket #938): lib/libc/gen/getentropy.3: revision 1.7 include/limits.h: revision 1.44 include/unistd.h: revision 1.167 getentropy(3): Make this visible to POSIX.1-2024 applications. Likewise GETENTROPY_MAX. It is now part of POSIX: https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/getentropy.html Cite standard in man page too. While here, use `.Nm' rather than `.Fn getentropy' for self-reference in the man page, for consistency with other usage. PR standards/58603: getentropy(3): update visibility and documentation for POSIX.1-2024 To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.43.2.1 src/include/limits.h cvs rdiff -u -r1.163 -r1.163.2.1 src/include/unistd.h cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/lib/libc/gen/getentropy.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/include/limits.h diff -u src/include/limits.h:1.43 src/include/limits.h:1.43.2.1 --- src/include/limits.h:1.43 Tue May 31 13:42:59 2022 +++ src/include/limits.h Wed Oct 9 13:12:40 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: limits.h,v 1.43 2022/05/31 13:42:59 riastradh Exp $ */ +/* $NetBSD: limits.h,v 1.43.2.1 2024/10/09 13:12:40 martin Exp $ */ /* * Copyright (c) 1988, 1993 @@ -140,14 +140,18 @@ #endif #endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */ +/* + * IEEE Std 1003.1-2024 (POSIX.1-2024) + */ +#if (_POSIX_C_SOURCE - 0) >= 202405L || (_XOPEN_SOURCE - 0) >= 800 || \ + defined(_NETBSD_SOURCE) +#define GETENTROPY_MAX 256 +#endif + #endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */ #define MB_LEN_MAX 32 /* Allow ISO/IEC 2022 */ -#ifdef _NETBSD_SOURCE -#define GETENTROPY_MAX 256 -#endif - #include <machine/limits.h> #ifdef __CHAR_UNSIGNED__ Index: src/include/unistd.h diff -u src/include/unistd.h:1.163 src/include/unistd.h:1.163.2.1 --- src/include/unistd.h:1.163 Tue May 31 13:42:59 2022 +++ src/include/unistd.h Wed Oct 9 13:12:40 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: unistd.h,v 1.163 2022/05/31 13:42:59 riastradh Exp $ */ +/* $NetBSD: unistd.h,v 1.163.2.1 2024/10/09 13:12:40 martin Exp $ */ /*- * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc. @@ -320,6 +320,14 @@ int unlinkat(int, const char *, int); int fexecve(int, char * const *, char * const *); #endif +/* + * IEEE Std 1003.1-2024 (POSIX.1-2024) + */ +#if (_POSIX_C_SOURCE - 0) >= 202405L || (_XOPEN_SOURCE - 0 >= 800) || \ + defined(_NETBSD_SOURCE) +int getentropy(void *, size_t); +#endif + /* * Implementation-defined extensions @@ -338,7 +346,6 @@ int fchroot(int); int fdiscard(int, off_t, off_t); int fsync_range(int, int, off_t, off_t); int getdomainname(char *, size_t); -int getentropy(void *, size_t); int getgrouplist(const char *, gid_t, gid_t *, int *); int getgroupmembership(const char *, gid_t, gid_t *, int, int *); mode_t getmode(const void *, mode_t); Index: src/lib/libc/gen/getentropy.3 diff -u src/lib/libc/gen/getentropy.3:1.4.2.1 src/lib/libc/gen/getentropy.3:1.4.2.2 --- src/lib/libc/gen/getentropy.3:1.4.2.1 Fri Aug 11 14:35:24 2023 +++ src/lib/libc/gen/getentropy.3 Wed Oct 9 13:12:40 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: getentropy.3,v 1.4.2.1 2023/08/11 14:35:24 martin Exp $ $ +.\" $NetBSD: getentropy.3,v 1.4.2.2 2024/10/09 13:12:40 martin Exp $ $ .\" .\" Copyright (c) 2020 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -71,7 +71,7 @@ must be at most 256. .Sh RETURN VALUES .Rv -std getentropy .Sh ERRORS -.Fn getentropy +.Nm will succeed unless: .Bl -tag -width Er .It Bq Er EFAULT @@ -105,12 +105,12 @@ secret seed material from such hardware .Xr entropy 7 .Sh STANDARDS The -.Fn getentropy -function is nonstandard. -However, it is likely to be included in the next revision of POSIX. +.Nm +function conforms to +.St -p1003.1-2024 . .Sh HISTORY The -.Fn getentropy +.Nm function first appeared in .Ox 5.6 , then in