-
Notifications
You must be signed in to change notification settings - Fork 219
Description
Hi,
I was porting HVM to run on Cosmopolitan Libc, and I noticed a small difference between how getrandom
is handled by this crate when compared to the Rust standard library.
The Rust standard library has a syscall
macro which creates a weak symbol for getrandom
, so if the underlying libc provides getrandom
, that function is called instead of making a syscall. The standard library uses getrandom
for HashMap keys here.
The getrandom
crate makes the Linux syscall directly without first checking for getrandom
in the libc.
The pattern used in the Rust standard library is flexible to which libc is used, be it glibc, musl, or Cosmopolitan.
Could you change https://github.com/rust-random/getrandom/blob/master/src/linux_android.rs to check if getrandom
is provided by the libc first, before using the syscall?