mmap(2)

DESCRIPTION

Maps anonymous or file-backed memory into the process.

SYNOPSIS

long mmap(void *addr, long length, uint32_t prot, uint32_t flags, int fd, long offset);

RETURN VALUE

  • Returns a non-negative result on success. Negative values are ABI errno codes.

ERRORS

  • -EBADF
    • The file descriptor is invalid for a file mapping.
  • -EINVAL
    • The length, offset, protection, flags, or anonymous sentinel is invalid.
  • -ENOMEM
    • The address space or physical backing cannot be allocated.
  • -ENOSYS
    • The requested fixed or shared mapping mode is not implemented.

ABI

Arguments enter through the direct syscall ABI; validation is performed before entering the process subsystem.