rustix::mm

Function mlock_with

source
pub unsafe fn mlock_with(
    ptr: *mut c_void,
    len: usize,
    flags: MlockFlags,
) -> Result<()>
Expand description

mlock2(ptr, len, flags)—Lock memory into RAM, with flags.

mlock_with is the same as mlock but adds an additional flags operand.

Some implementations implicitly round the memory region out to the nearest page boundaries, so this function may lock more memory than explicitly requested if the memory isn’t page-aligned.

§Safety

The range of memory starting at ptr, rounded down to the applicable page boundary, and extending for len bytes, rounded up to the applicable page size, must be valid to read with ptr’s provenance.

§References