munmap - unmap pages of memory
int munmap(void *addr, size_t len);
The function munmap removes the mappings for pages in the range [addr,
addr + len). Further references to these pages will result in the
delivery of a SIGSEGV signal to the process.
If the region being detached via munmap(2) belongs to a shared address
space, and I/O is being done to this range by a process belonging to the
same shared group, munmap(2) would fail returning EBUSY. The specified
virtual address range would not be unmapped from the shared address space
unless it spans multiple contiguous regions in which case part of the
address range (before the region causing the error) may be unmapped
before EBUSY is returned.
The function mmap often performs an implicit munmap.
Note that when munmap is called by a process which is a member of a
shared process group, the unmapping operation is relatively more
expensive than it is for an independent process. This is because the
munmap system call must synchronize the removal of the address space with
the other processes in the share group. Refer to the sproc(2) manual
entry for more information on shared process groups.
On success, munmap returns 0; on failure, munmap returns -1 and sets
errno to indicate an error.
Under the following conditions, the function munmap fails and sets errno
EINVAL addr is not a multiple of the page size as returned by sysconf.
EINVAL Addresses in the range [addr, addr + len) are outside the valid
range for the address space of a process.
EINVAL The argument len has a value less than or equal to 0.
EBUSY The address range specified has some active I/O initiated by some
other process belonging to same share group.
mmap(2), signal(2), sysconf(3C).
PPPPaaaaggggeeee 2222 [ Back ]