aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-03-03 12:15:38 +0100
committerFlorian Weimer <fweimer@redhat.com>2020-03-03 12:15:38 +0100
commit658b5848a827876cc8a5e518749f78429a9970d7 (patch)
tree1806a65c5756fc6b76c61d126e4399a9fb561ee6
parentLinux: Clean up preadv, pwritev system call names (diff)
downloadglibc-658b5848a827876cc8a5e518749f78429a9970d7.tar.gz
glibc-658b5848a827876cc8a5e518749f78429a9970d7.tar.bz2
glibc-658b5848a827876cc8a5e518749f78429a9970d7.zip
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>
-rw-r--r--sysdeps/unix/sysv/linux/getentropy.c9
-rw-r--r--sysdeps/unix/sysv/linux/getrandom.c13
2 files changed, 0 insertions, 22 deletions
diff --git a/sysdeps/unix/sysv/linux/getentropy.c b/sysdeps/unix/sysv/linux/getentropy.c
index 5d0b8d10c1..2f3a4e4692 100644
--- a/sysdeps/unix/sysv/linux/getentropy.c
+++ b/sysdeps/unix/sysv/linux/getentropy.c
@@ -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
diff --git a/sysdeps/unix/sysv/linux/getrandom.c b/sysdeps/unix/sysv/linux/getrandom.c
index 309beadf72..63b8d36bf4 100644
--- a/sysdeps/unix/sysv/linux/getrandom.c
+++ b/sysdeps/unix/sysv/linux/getrandom.c
@@ -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)