Coverage Report

Created: 2026-02-14 07:02

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-1.0.7/src/mm/userfaultfd.rs
Line
Count
Source
1
//! The Linux `userfaultfd` API.
2
//!
3
//! # Safety
4
//!
5
//! Calling `userfaultfd` is safe, but the returned file descriptor lets users
6
//! observe and manipulate process memory in magical ways.
7
#![allow(unsafe_code)]
8
9
use crate::fd::OwnedFd;
10
use crate::{backend, io};
11
12
pub use backend::mm::types::UserfaultfdFlags;
13
14
/// `userfaultfd(flags)`—Create userspace page-fault handler.
15
///
16
/// # Safety
17
///
18
/// The call itself is safe, but the returned file descriptor lets users
19
/// observe and manipulate process memory in magical ways.
20
///
21
/// # References
22
///  - [Linux]
23
///  - [Linux userfaultfd]
24
///
25
/// [Linux]: https://man7.org/linux/man-pages/man2/userfaultfd.2.html
26
/// [Linux userfaultfd]: https://www.kernel.org/doc/Documentation/vm/userfaultfd.txt
27
#[inline]
28
0
pub unsafe fn userfaultfd(flags: UserfaultfdFlags) -> io::Result<OwnedFd> {
29
0
    backend::mm::syscalls::userfaultfd(flags)
30
0
}