Module Name: src Committed By: riastradh Date: Thu Aug 15 23:44:50 UTC 2024
Modified Files: src/include: limits.h unistd.h src/lib/libc/gen: getentropy.3 Log Message: 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.44 src/include/limits.h cvs rdiff -u -r1.166 -r1.167 src/include/unistd.h cvs rdiff -u -r1.6 -r1.7 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.44 --- src/include/limits.h:1.43 Tue May 31 13:42:59 2022 +++ src/include/limits.h Thu Aug 15 23:44:49 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: limits.h,v 1.43 2022/05/31 13:42:59 riastradh Exp $ */ +/* $NetBSD: limits.h,v 1.44 2024/08/15 23:44:49 riastradh 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.166 src/include/unistd.h:1.167 --- src/include/unistd.h:1.166 Mon May 20 01:30:33 2024 +++ src/include/unistd.h Thu Aug 15 23:44:49 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: unistd.h,v 1.166 2024/05/20 01:30:33 christos Exp $ */ +/* $NetBSD: unistd.h,v 1.167 2024/08/15 23:44:49 riastradh 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 @@ -340,7 +348,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.6 src/lib/libc/gen/getentropy.3:1.7 --- src/lib/libc/gen/getentropy.3:1.6 Fri Jun 30 22:15:14 2023 +++ src/lib/libc/gen/getentropy.3 Thu Aug 15 23:44:49 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: getentropy.3,v 1.6 2023/06/30 22:15:14 uwe Exp $ $ +.\" $NetBSD: getentropy.3,v 1.7 2024/08/15 23:44:49 riastradh 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