[  Previous | Next  |  Table of Contents  |  Index  | Library Home | 
Legal | 
Search ] 
 
Technical Reference: Base Operating System and Extensions, Volume 1
Unmaps a mapped region.
Standard C Library
(libc.a)
#include <sys/types.h>
#include <sys/mman.h>
int munmap ( addr,  len)
void *addr;
size_t len;
The munmap subroutine
unmaps a mapped file region or anonymous memory region. The
munmap subroutine unmaps regions created from calls to the
mmap subroutine only.
If an address lies in a region
that is unmapped by the munmap subroutine and that region is not
subsequently mapped again, any reference to that address will result in the
delivery of a SIGSEGV signal to the process.
| addr
 | Specifies the address of the region to be unmapped. Must be a
multiple of the page size returned by the sysconf subroutine using
the _SC_PAGE_SIZE value for the Name parameter.
 | 
| len
 | Specifies the length, in bytes, of the region to be unmapped. If
the len parameter is not a multiple of the page size returned by
the sysconf subroutine using the _SC_PAGE_SIZE value for
the Name parameter, the length of the region is rounded up to the
next multiple of the page size.
 | 
When successful, the
munmap subroutine returns 0. Otherwise, it returns -1 and
sets the errno global variable to indicate the error.
If the munmap
subroutine is unsuccessful, the errno global variable is set to the
following value:
| EINVAL
 | The addr parameter is not a multiple of the page size as
returned by the sysconf subroutine using the
_SC_PAGE_SIZE value for the Name parameter.
 | 
| EINVAL
 | The application has requested X/Open UNIX95 Specification compliant
behavior and the len arguement is 0.
 | 
  [  Previous | Next  |  Table of Contents  |  Index  |
 
Library Home | 
Legal | 
Search  ]