Skip to main content

lock_region

Function lock_region 

Source
pub fn lock_region(ptr: *const u8, len: usize) -> Result<()>
Expand description

Lock a memory region to reduce the chance of page-out.

§Example

let bytes = [1_u8, 2, 3, 4];
kernelkit::mlock::lock_region(bytes.as_ptr(), bytes.len())?;
kernelkit::mlock::unlock_region(bytes.as_ptr(), bytes.len())?;

§Errors

Returns an error if the kernel rejects the mlock request.