diff options
Diffstat (limited to 'src/libstd/sys/unix/rand.rs')
| -rw-r--r-- | src/libstd/sys/unix/rand.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs index 71c62461ee9..c5be1763302 100644 --- a/src/libstd/sys/unix/rand.rs +++ b/src/libstd/sys/unix/rand.rs @@ -15,7 +15,8 @@ pub fn hashmap_random_keys() -> (u64, u64) { not(target_os = "ios"), not(target_os = "openbsd"), not(target_os = "freebsd"), - not(target_os = "fuchsia")))] + not(target_os = "fuchsia"), + not(target_os = "redox")))] mod imp { use crate::fs::File; use crate::io::Read; @@ -174,3 +175,15 @@ mod imp { unsafe { zx_cprng_draw(v.as_mut_ptr(), v.len()) } } } + +#[cfg(target_os = "redox")] +mod imp { + use crate::fs::File; + use crate::io::Read; + + pub fn fill_bytes(v: &mut [u8]) { + // Open rand:, read from it, and close it again. + let mut file = File::open("rand:").expect("failed to open rand:"); + file.read_exact(v).expect("failed to read rand:") + } +} |
