MUNMAP(2)

NAME
munmap - unmap part of the process's address space

SYNOPSIS
munmap(addr, len)
caddr_t	addr;	/* starting virt-addr */
int	len;	/* length (bytes) to unmap */

DESCRIPTION
Munmap removes a mapping created by mmap(2). The addr and len arguments must be integral multiples of the system page size, as defined by getpagesize(2).

After successful completion of munmap, the address space from addr through addr+len-1 does not exist and will result in a segmentation fault (SIGSEGV) if referenced.

RETURN VALUE
Munmap returns zero when successful. Otherwise it returns -1 and places the error number in the global variable errno.

ERRORS

[EINVAL]
    Addr or len is not a multiple of the system page size.

[EINVAL]
    The area defined by addr and len overlaps the text or stack segment or a non-existent part of the address space.

SEE ALSO
mmap(2), vm_ctl(2), getpagesize(2)

NOTES
The current implementation can unmap only data space.

Any address space holes created by munmap read as zeroes in a core file.