munmap(2)
NAME
munmap − unmap a mapped region
SYNOPSIS
#include <sys/mman.h>
int munmap(caddr_t addr, size_t len);
DESCRIPTION
munmap() unmaps a mapped file or anonymous memory region.
munmap() unmaps pages in the address range starting at addr and continuing for len bytes rounded up to the next multiple of the page size. Further references to these pages result in the delivery of a SIGSEGV signal to the process.
If the address range specified by addr and len was not created by a successful call to mmap(), munmap() returns an error.
If the specified address range was created by multiple calls to mmap(), munmap() succeeds in unmapping all of the specified regions, provided they form a contiguous address range.
If the region was created with the MAP_PRIVATE option, any modifications made to the region are discarded.
RETURN VALUE
munmap() returns 0 upon success; otherwise, it returns −1 and sets errno to indicate the error.
ERRORS
munmap() fails if any of the following conditions are encountered:
[EINVAL] addr is not a multiple of the page size as returned by sysconf(_SC_PAGE_SIZE).
[EINVAL] The address range specified by addr and len was not created by a successful call to mmap().
AUTHOR
munmap() was developed by HP, AT&T, and OSF.
SEE ALSO
STANDARDS CONFORMANCE
munmap(): AES
Hewlett-Packard Company — HP-UX Release 9.0: August 1992