Linux: getrandom syscall number is always available

Due to the built-in tables, __NR_getrandom is always defined.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
Florian Weimer 2020-03-03 12:15:38 +01:00
parent d241dee4dd
commit 658b5848a8
2 changed files with 0 additions and 22 deletions

View File

@ -21,7 +21,6 @@
#include <errno.h>
#include <unistd.h>
#ifdef __NR_getrandom
/* Write LENGTH bytes of randomness starting at BUFFER. Return 0 on
success and -1 on failure. */
int
@ -63,11 +62,3 @@ getentropy (void *buffer, size_t length)
}
return 0;
}
#else
int
getentropy (void *buffer, size_t length)
{
__set_errno (ENOSYS);
return -1;
}
#endif

View File

@ -21,7 +21,6 @@
#include <unistd.h>
#include <sysdep-cancel.h>
#ifdef __NR_getrandom
/* Write up to LENGTH bytes of randomness starting at BUFFER.
Return the number of bytes written, or -1 on error. */
ssize_t
@ -29,17 +28,5 @@ __getrandom (void *buffer, size_t length, unsigned int flags)
{
return SYSCALL_CANCEL (getrandom, buffer, length, flags);
}
#else
/* Always provide a definition, even if the kernel headers lack the
system call number. */
ssize_t
__getrandom (void *buffer, size_t length, unsigned int flags)
{
/* Ideally, we would add a cancellation point here, but we currently
cannot do so inside libc. */
__set_errno (ENOSYS);
return -1;
}
#endif
libc_hidden_def (__getrandom)
weak_alias (__getrandom, getrandom)