Unmaps a mapped region. This function is reentrant. Format #include <mman.h> int munmap (void *addr, size_t len);
1 – Arguments
addr The address of the region that you want to unmap. len The length, in bytes, of that region the you want to unmap.
2 – Description
The munmap function unmaps a mapped file or shared memory region. The addr and len arguments specify the address and length, in bytes, respectively, of the region to be unmapped. The len argument must be a multiple of the page size as returned by sysconf(_SC_PAGE_SIZE); otherwise, the length of the region is rounded up to the next multiple of the page size. The result of using an address that lies in an unmapped region and not in any subsequently mapped region is undefined. See also sysconf.
3 – Return Values
0 Indicates success. -1 Indicates an error; errno is set to one of the following values: o ENIVAL - The addr argument is not a multiple of the page size as returned by sysconf(_SC_PAGE_SIZE). o EFAULT - The range [addr, addr + len] includes an invalid address.