From 8a6bb3fb10bef1a31088e845f6b4b2ae44959ef3 Mon Sep 17 00:00:00 2001 From: Thorsten Glaser Date: Mon, 7 Apr 2025 00:23:45 +0200 Subject: add getentropy(), fix return value of getrandom() Signed-off-by: Thorsten Glaser --- include/unistd.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/unistd.h b/include/unistd.h index d50e1e4d3..e45266f14 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1250,6 +1250,15 @@ extern void swab (const void *__restrict __from, void *__restrict __to, extern char *ctermid (char *__s) __THROW; #endif +/* OpenBSD-compatible access to random bytes. + May be a cancellation point here, unlike in glibc/musl. */ +#ifdef _DEFAULT_SOURCE +# ifndef __getentropy_defined +extern int getentropy(void *__buf, size_t __len) __nonnull ((1)) __wur; +# define __getentropy_defined +# endif +#endif + __END_DECLS -- cgit v1.2.3