summaryrefslogtreecommitdiffstats
path: root/vendor/rustix-0.36.5/src/rand
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /vendor/rustix-0.36.5/src/rand
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix-0.36.5/src/rand')
-rw-r--r--vendor/rustix-0.36.5/src/rand/getrandom.rs21
-rw-r--r--vendor/rustix-0.36.5/src/rand/mod.rs7
2 files changed, 28 insertions, 0 deletions
diff --git a/vendor/rustix-0.36.5/src/rand/getrandom.rs b/vendor/rustix-0.36.5/src/rand/getrandom.rs
new file mode 100644
index 000000000..83043800d
--- /dev/null
+++ b/vendor/rustix-0.36.5/src/rand/getrandom.rs
@@ -0,0 +1,21 @@
+use crate::{backend, io};
+
+/// `GRND_*`
+pub use backend::rand::types::GetRandomFlags;
+
+/// `getrandom(buf, flags)`—Reads a sequence of random bytes.
+///
+/// This is a very low-level API which may be difficult to use correctly. Most
+/// users should prefer to use [`getrandom`] or [`rand`] APIs instead.
+///
+/// [`getrandom`]: https://crates.io/crates/getrandom
+/// [`rand`]: https://crates.io/crates/rand
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/getrandom.2.html
+#[inline]
+pub fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usize> {
+ backend::rand::syscalls::getrandom(buf, flags)
+}
diff --git a/vendor/rustix-0.36.5/src/rand/mod.rs b/vendor/rustix-0.36.5/src/rand/mod.rs
new file mode 100644
index 000000000..b8a1320a8
--- /dev/null
+++ b/vendor/rustix-0.36.5/src/rand/mod.rs
@@ -0,0 +1,7 @@
+//! Random-related operations.
+
+#[cfg(any(linux_raw, all(libc, target_os = "linux")))]
+mod getrandom;
+
+#[cfg(any(linux_raw, all(libc, target_os = "linux")))]
+pub use getrandom::{getrandom, GetRandomFlags};