platform_bionic/libc/include/sys
David Benjamin 7110157e94 Make getentropy available from <unistd.h>
getentropy is originally an OpenBSD-ism, where it was in <unistd.h> from
day one:
https://man.openbsd.org/OpenBSD-5.6/getentropy

FreeBSD's and Linux's current man pages also document it this way:
https://man7.org/linux/man-pages/man3/getentropy.3.html
https://man.freebsd.org/cgi/man.cgi?query=getentropy&sektion=3&format=html

The man7.org URL is even cited by bionic itself in the comments, though
glibc originally put it in <sys/random.h> and added to <unistd.h> very
shortly afterwards:
https://sourceware.org/bugzilla/show_bug.cgi?id=17252#c9

The cited man page (maintained separately from glibc) originally
documented <sys/random.h>...
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man3/getentropy.3?id=b0265728162cdcafb8e7d7f1372e8de1a4c963ed

But similarly fixed it to <unistd.h> three months later:
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man3/getentropy.3?id=9cf011f94b56e8832c5a5d8cf66d4a115d34b9cc

musl matches the BSDs in putting it in <unistd.h>, but not
<sys/random.h>.
https://git.musl-libc.org/cgit/musl/tree/include/unistd.h?id=25e6fee27f4a293728dd15b659170e7b9c7db9bc#n183

POSIX will likely place it there too:
https://www.austingroupbugs.net/view.php?id=1134

macOS and Fuchsia place it in <sys/random.h> and not <unistd.h>, though
given the rest of this precedent, they're clearly outliers. (Note iOS
does *not* have getentropy, just macOS. The system has it, but it's not
exposed as public API. See https://dev.gnupg.org/T5375 and
https://github.com/openssl/openssl/pull/15924.)

Use the more standard location in bionic and put getentropy in
<unistd.h>. This will improve portability and avoid needing workarounds
in BoringSSL. For compatibility, keep it also available in
<sys/random.h> by using a <bits/getentropy.h> header.

BYPASS_INCLUSIVE_LANGUAGE_REASON=Above URLs are not hosted by Android and reference the name of a command-line utility, short for 'manual', as in instruction manual

Bug: 290898063
Test: treehugger
Change-Id: Id2d6b6ea09d814e5ba2cb117a7af2c74861148fb
2023-07-17 21:50:53 +00:00
..
_system_properties.h Nullability check for system_properties module. 2023-05-17 20:43:51 +00:00
auxv.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
cachectl.h Clean up mips references in the headers. 2020-02-13 18:00:16 -08:00
capability.h Nullability check for capability module. 2023-04-14 01:04:29 +00:00
cdefs.h Remove __RENAME_STAT64. 2023-06-09 15:59:23 -07:00
endian.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
epoll.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
errno.h Start documenting libc. 2018-08-23 11:03:17 -07:00
eventfd.h Nullability check for eventfd module 2023-02-07 20:47:11 +00:00
fcntl.h Start documenting libc. 2018-08-23 11:03:17 -07:00
file.h Another round of documentation. 2018-10-04 16:35:13 -07:00
fsuid.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
ifunc.h Adopt GNU calling convention for ifunc resolvers. 2019-10-28 20:20:29 -07:00
inotify.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
ioctl.h Another round of documentation. 2018-10-04 16:35:13 -07:00
ipc.h Nullability check for ipc module. 2023-04-14 01:05:54 +00:00
klog.h Nullability check for klog module 2023-02-03 21:56:56 +00:00
limits.h Start documenting libc. 2018-08-23 11:03:17 -07:00
mman.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
mount.h Nullability check for mount module. 2023-04-15 01:16:51 +00:00
msg.h Nullability check for msg module. 2023-04-15 01:13:26 +00:00
mtio.h
param.h param.h: whitespace cleanup 2019-03-27 10:56:16 -07:00
personality.h Remove __INTRODUCED_IN for obsolete API levels. 2019-10-03 16:09:04 -07:00
pidfd.h Nullability check for pidfd module 2023-03-08 21:06:57 +00:00
poll.h Start documenting libc. 2018-08-23 11:03:17 -07:00
prctl.h Update to android-mainline kernel headers v5.4. 2019-12-12 14:59:25 -08:00
procfs.h NGREG != ELF_NGREG. 2020-09-08 09:27:02 -07:00
ptrace.h
queue.h
quota.h Nullability check for quota module 2023-02-03 20:03:34 +00:00
random.h Make getentropy available from <unistd.h> 2023-07-17 21:50:53 +00:00
reboot.h Another round of documentation. 2018-10-04 16:35:13 -07:00
reg.h
resource.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
select.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
sem.h Nullability check for sem module. 2023-04-21 21:34:11 +00:00
sendfile.h Merge "Remove the always-true __INTRODUCED_IN() annotations." 2023-06-20 20:47:49 +00:00
shm.h Nullability check for shm module. 2023-05-23 19:15:25 +00:00
signal.h Start documenting libc. 2018-08-23 11:03:17 -07:00
signalfd.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
socket.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
stat.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
statfs.h
statvfs.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
swap.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
syscall.h
sysconf.h Start documenting libc. 2018-08-23 11:03:17 -07:00
sysinfo.h Nullability check for sysinfo module 2023-02-03 20:05:05 +00:00
syslog.h Start documenting libc. 2018-08-23 11:03:17 -07:00
sysmacros.h Another round of documentation. 2018-10-04 16:35:13 -07:00
system_properties.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
thread_properties.h Nullability check for thread_properties module. 2023-06-05 22:07:50 +00:00
time.h Nullability check for time module. 2023-05-16 00:17:36 +00:00
timerfd.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
times.h Nullability check for time module. 2023-05-16 00:17:36 +00:00
timex.h Nullability check for time module. 2023-05-16 00:17:36 +00:00
ttydefaults.h
types.h
ucontext.h Add an enum for the riscv64 <sys/ucontext.h> register constants. 2023-05-03 17:45:41 +00:00
uio.h Nullability check for uio module. 2023-05-04 17:13:15 +00:00
un.h Another round of documentation. 2018-10-04 16:35:13 -07:00
unistd.h Start documenting libc. 2018-08-23 11:03:17 -07:00
user.h riscv64 <sys/user.h>. 2022-10-07 20:49:07 +00:00
utsname.h Nullability check for utsname module 2023-03-08 21:05:19 +00:00
vfs.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
vt.h
wait.h Remove the always-true __INTRODUCED_IN() annotations. 2023-06-16 12:39:33 -07:00
xattr.h Nullability check for xattr module. 2023-05-22 18:31:16 +00:00