Skip to main content

SYS_MMAP

Constant SYS_MMAP 

Source
pub const SYS_MMAP: usize = 100;
Expand description

Map a memory region into the process address space.

  • addr: desired virtual address (0 = kernel chooses)
  • len: length in bytes (rounded up to page boundary)
  • prot: protection flags (PROT_READ | PROT_WRITE | PROT_EXEC)
  • flags: mapping flags (MAP_SHARED, MAP_PRIVATE, MAP_ANONYMOUS, etc.)
  • fd: file descriptor for file-backed mappings (-1 for anonymous)
  • offset: offset into the file (must be page-aligned)

Returns the mapped virtual address on success, or a negative errno.