[Previous]
[Contents]
[Next]

munmap()

unmap previously mapped addresses

Synopsis:

#include <sys/mman.h>
int munmap( void *addr, size_t len );

Description:

The munmap() function removes any mappings for pages in the address range starting at addr and continuing for len bytes, rounded up to the next multiple of the page size. Subsequent references to these pages cause a SIGSEGV signal to be set on the process.

If there are no mappings in the specified address range, then munmap() has no effect.

Returns:

0
Success
-1
An error occurred. errno is set to indicate the error.

Errors:

EINVAL
The value of addr isn't a multiple of the page size as returned by the sysconf() function for _SC_PAGESIZE.

The addresses in the specified range are outside the range allowed for the address space of a process.

ENOSYS
The function munmap() isn't supported by this implementation.

Classification:

POSIX 1003.4

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

errno, mmap(), mprotect(), shm_open(), shm_unlink()


[Previous]
[Contents]
[Next]