summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/backend/libc/rand
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/rustix/src/backend/libc/rand
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/backend/libc/rand')
-rw-r--r--vendor/rustix/src/backend/libc/rand/syscalls.rs6
-rw-r--r--vendor/rustix/src/backend/libc/rand/types.rs10
2 files changed, 9 insertions, 7 deletions
diff --git a/vendor/rustix/src/backend/libc/rand/syscalls.rs b/vendor/rustix/src/backend/libc/rand/syscalls.rs
index 2dcff139e..8a995f2e6 100644
--- a/vendor/rustix/src/backend/libc/rand/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/rand/syscalls.rs
@@ -1,9 +1,9 @@
//! libc syscalls supporting `rustix::rand`.
-#[cfg(any(target_os = "android", target_os = "linux"))]
-use {super::super::c, super::super::conv::ret_usize, crate::io, crate::rand::GetRandomFlags};
+#[cfg(linux_kernel)]
+use {crate::backend::c, crate::backend::conv::ret_usize, crate::io, crate::rand::GetRandomFlags};
-#[cfg(any(target_os = "android", target_os = "linux"))]
+#[cfg(linux_kernel)]
pub(crate) fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usize> {
// `getrandom` wasn't supported in glibc until 2.25.
weak_or_syscall! {
diff --git a/vendor/rustix/src/backend/libc/rand/types.rs b/vendor/rustix/src/backend/libc/rand/types.rs
index e12bd9cbd..730cf3a34 100644
--- a/vendor/rustix/src/backend/libc/rand/types.rs
+++ b/vendor/rustix/src/backend/libc/rand/types.rs
@@ -1,13 +1,15 @@
-#[cfg(any(target_os = "android", target_os = "linux"))]
-use super::super::c;
-#[cfg(any(target_os = "android", target_os = "linux"))]
+#[cfg(linux_kernel)]
+use crate::backend::c;
+#[cfg(linux_kernel)]
use bitflags::bitflags;
-#[cfg(any(target_os = "android", target_os = "linux"))]
+#[cfg(linux_kernel)]
bitflags! {
/// `GRND_*` flags for use with [`getrandom`].
///
/// [`getrandom`]: crate::rand::getrandom
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct GetRandomFlags: u32 {
/// `GRND_RANDOM`
const RANDOM = c::GRND_RANDOM;