nix::sys::mman

Function mmap_anonymous

source
pub unsafe fn mmap_anonymous(
    addr: Option<NonZeroUsize>,
    length: NonZeroUsize,
    prot: ProtFlags,
    flags: MapFlags,
) -> Result<NonNull<c_void>>
Expand description

Create an anonymous memory mapping.

This function is a wrapper around mmap: mmap(ptr, len, prot, MAP_ANONYMOUS | flags, -1, 0).

ยงSafety

See the mmap(2) man page for detailed requirements.