#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
}
return 0;
}
-#else
-int
-getentropy (void *buffer, size_t length)
-{
- __set_errno (ENOSYS);
- return -1;
-}
-#endif
#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
{
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)