MMAP(2) — SYSTEM CALLS
NAME
mmap − map pages of memory
SYNOPSIS
#include <sys/mman.h>
#include <sys/types.h>
mmap(addr, len, prot, share, fd, off)
caddr_t addr; int len, prot, share, fd; off_t off;
DESCRIPTION
N.B.: This call is not completely implemented in 4.2.
Mmap maps the pages starting at addr and continuing for len bytes from the object represented by the descriptor fd, at the current file position of offset off. The parameter share specifies whether modifications made to this mapped copy of the page are to be kept private or are to be shared with other references. The parameter prot specifies the accessibility of the mapped pages. The addr and len parameters and the sum of the current position in fd and the off parameters must be multiples of the page size (found using the getpagesize(2) call).
Pages are automatically unmapped at close.
RETURN VALUE
The call returns 0 on success, −1 on failure.
ERRORS
The mmap call will fail if:
[EINVAL] The argument address or length is not a multiple of the page size as returned by getpagesize(2),or the length is negative.
[EINVAL] The entire range of pages specified in the call is not part of data space.
[EINVAL] The specified fd does not refer to a character special device which supports mapping (e.g. a frame buffer).
[EINVAL] The specified fd is not open for reading and read access is requested, or not open for writing when write access is requested.
[EINVAL] The sharing mode was not specified as MAP_SHARED.
SEE ALSO
getpagesize(2), munmap(2), close(2)
Sun Release 1.1 — Last change: 20 March 1984