summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/mm/userfaultfd.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /vendor/rustix/src/mm/userfaultfd.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/mm/userfaultfd.rs')
-rw-r--r--vendor/rustix/src/mm/userfaultfd.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/rustix/src/mm/userfaultfd.rs b/vendor/rustix/src/mm/userfaultfd.rs
new file mode 100644
index 000000000..65b4a0dd8
--- /dev/null
+++ b/vendor/rustix/src/mm/userfaultfd.rs
@@ -0,0 +1,30 @@
+//! The Linux `userfaultfd` API.
+//!
+//! # Safety
+//!
+//! Calling `userfaultfd` is safe, but the returned file descriptor lets users
+//! observe and manipulate process memory in magical ways.
+#![allow(unsafe_code)]
+
+use crate::imp;
+use crate::io::{self, OwnedFd};
+
+pub use imp::mm::types::UserfaultfdFlags;
+
+/// `userfaultfd(flags)`
+///
+/// # Safety
+///
+/// The call itself is safe, but the returned file descriptor lets users
+/// observe and manipulate process memory in magical ways.
+///
+/// # References
+/// - [Linux]
+/// - [Linux userfaultfd]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/userfaultfd.2.html
+/// [Linux userfaultfd]: https://www.kernel.org/doc/Documentation/vm/userfaultfd.txt
+#[inline]
+pub unsafe fn userfaultfd(flags: UserfaultfdFlags) -> io::Result<OwnedFd> {
+ imp::mm::syscalls::userfaultfd(flags)
+}