The MMAP System Call in Linux - Return values and error codes (
Page 3 of 4 )
On success, a call to mmap() returns the location of the mapping. On failure, the call returns MAP_FAILED
, and sets
errno
appropriately. A call to
mmap()
never returns
0.
Possible
errno
values include:
EACCES
S
The given file descriptor is not a regular file, or the
mode with which it was opened conflicts with
prot
or
flags
.
EAGAIN
The file has been locked via a file lock.
EBADF
The given file descriptor is not valid.
EINVAL
One or more of the parameters
addr
,
len
, or
off
are invalid.
ENFILE
The system-wide limit on open files has been
reached.
ENODEV
The filesystem on which the file to map resides does
not support memory mapping.
ENOMEM
The process does not have enough memory.
EOVERFLOW
The result of
addr+len
exceeds the size of the
address space.
EPERM
PROT_EXEC
was given, but the filesystem is mounted
noexec
.