rustix::mm

Function mremap

source
pub unsafe fn mremap(
    old_address: *mut c_void,
    old_size: usize,
    new_size: usize,
    flags: MremapFlags,
) -> Result<*mut c_void>
Expand description

mremap(old_address, old_size, new_size, flags)—Resize, modify, and/or move a memory mapping.

For moving a mapping to a fixed address (MREMAP_FIXED), see mremap_fixed.

§Safety

old_address must be aligned to the applicable page size, and the range of memory starting at old_address and extending for old_size bytes, rounded up to the applicable page size, must be valid to mutate with old_address’s provenance. If MremapFlags::MAY_MOVE is set in flags, there must be no Rust references referring to that the memory.

If new_size is less than old_size, than there must be no Rust references referring to the memory starting at offset new_size and ending at old_size.

§References