munmap()

remove mapping 

Function


SYNOPSIS

#include <sys/mman.h>

int munmap(void *addr, size_t len);


DESCRIPTION

The function munmap() removes any mappings for those entire pages containing any part of the address space of the process starting at addr and continuing for len bytes. Further references to these pages result in the generation of a SIGSEGV signal to the process.

addr must be a multiple of the page size as returned by sysconf().


PARAMETERS

addr 

Is the address from where the mapped region should be unmapped.

len  

Is the number of bytes to unmap.


RETURN VALUES

If successful, the munmap() function returns 0. Otherwise, it returns -1 and sets errno to one of the following values.

EINVAL 

The addr argument is not a multiple of page size as returned by sysconf().

EINVAL 

The len argument has a value less than or equal to 0.

EINVAL 

Addresses in the range [addr, addr + len] are outside the valid range for the address space of the process.

EINVAL 

The address and the length specified [addr, addr + len] partially unmaps the mapped region.


CONFORMANCE

UNIX 98 with exceptions.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

Partial unmapping of the mapped regions is not supported. The length and address specified must complete match one or more continuous memory mapped regions.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
mmap(), sysconf()


PTC MKS Toolkit 10.5 Documentation Build 40.