pub unsafe fn mlock(ptr: *mut c_void, len: usize) -> Result<()>
Available on crate feature
mm
only.Expand description
mlock(ptr, len)
—Lock memory into RAM.
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. Other implementations fail if the memory isn’t page-aligned.
See mlock_with
to pass additional flags.
§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.