mirror of
git://sourceware.org/git/glibc.git
synced 2025-04-06 14:10:30 +08:00
hurd: Fix local PLT
* include/sys/random.h (__getrandom): Add hidden prototype. * stdlib/getrandom.c (getrandom): Rename to hidden definition __getrandom. Add weak alias. * sysdeps/mach/hurd/getrandom.c (getrandom): Likewise. * sysdeps/unix/sysv/linux/getrandom.c (getrandom): Likewise. * sysdeps/mach/hurd/getentropy.c (getentropy): Use __getrandom instead of getrandom.
This commit is contained in:
parent
f7649d5780
commit
8eaf34eda2
@ -1 +1,11 @@
|
||||
#ifndef _SYS_RANDOM_H
|
||||
#include <stdlib/sys/random.h>
|
||||
|
||||
# ifndef _ISOMAC
|
||||
|
||||
extern ssize_t __getrandom (void *__buffer, size_t __length,
|
||||
unsigned int __flags) __wur;
|
||||
libc_hidden_proto (__getrandom)
|
||||
|
||||
# endif /* !_ISOMAC */
|
||||
#endif
|
||||
|
@ -22,10 +22,12 @@
|
||||
/* Write up to LENGTH bytes of randomness starting at BUFFER.
|
||||
Return the number of bytes written, or -1 on error. */
|
||||
ssize_t
|
||||
getrandom (void *buffer, size_t length, unsigned int flags)
|
||||
__getrandom (void *buffer, size_t length, unsigned int flags)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
stub_warning (getrandom)
|
||||
|
||||
libc_hidden_def (__getrandom)
|
||||
weak_alias (__getrandom, getrandom)
|
||||
|
@ -41,7 +41,7 @@ getentropy (void *buffer, size_t length)
|
||||
while (buffer < end)
|
||||
{
|
||||
/* NB: No cancellation point. */
|
||||
ssize_t bytes = getrandom (buffer, end - buffer, 0);
|
||||
ssize_t bytes = __getrandom (buffer, end - buffer, 0);
|
||||
if (bytes < 0)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
|
@ -24,7 +24,7 @@
|
||||
/* Write up to LENGTH bytes of randomness starting at BUFFER.
|
||||
Return the number of bytes written, or -1 on error. */
|
||||
ssize_t
|
||||
getrandom (void *buffer, size_t length, unsigned int flags)
|
||||
__getrandom (void *buffer, size_t length, unsigned int flags)
|
||||
{
|
||||
const char *random_source = "/dev/urandom";
|
||||
size_t amount_read;
|
||||
@ -41,3 +41,6 @@ getrandom (void *buffer, size_t length, unsigned int flags)
|
||||
__close_nocancel_nostatus(fd);
|
||||
return amount_read;
|
||||
}
|
||||
|
||||
libc_hidden_def (__getrandom)
|
||||
weak_alias (__getrandom, getrandom)
|
||||
|
@ -25,7 +25,7 @@
|
||||
/* Write up to LENGTH bytes of randomness starting at BUFFER.
|
||||
Return the number of bytes written, or -1 on error. */
|
||||
ssize_t
|
||||
getrandom (void *buffer, size_t length, unsigned int flags)
|
||||
__getrandom (void *buffer, size_t length, unsigned int flags)
|
||||
{
|
||||
return SYSCALL_CANCEL (getrandom, buffer, length, flags);
|
||||
}
|
||||
@ -33,7 +33,7 @@ getrandom (void *buffer, size_t length, unsigned int flags)
|
||||
/* 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)
|
||||
__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. */
|
||||
@ -41,3 +41,5 @@ getrandom (void *buffer, size_t length, unsigned int flags)
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
libc_hidden_def (__getrandom)
|
||||
weak_alias (__getrandom, getrandom)
|
||||
|
Loading…
x
Reference in New Issue
Block a user