munmap(2)


munmap -- unmap pages of memory

Synopsis

   #include <sys/types.h>
   #include <sys/mman.h>
   

int munmap(void *addr, size_t len);

Description

The function munmap removes the mappings for pages in the range (addr, addr + len). Further references to these pages will result in the delivery of a SIGSEGV signal to the process.

The function mmap often performs an implicit munmap.

Return values

On success, munmap returns 0. On failure, munmap returns -1 and sets errno to identify the error.

Errors

In the following conditions, munmap fails and sets errno to:

EINVAL
addr is not a multiple of the page size as returned by sysconf.

EINVAL
Addresses in the range (addr, addr + len) are outside the valid range for the address space of a process.

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

References

mmap(2), sysconf(3C)

Notices

Considerations for threads programming

Sibling threads share (by definition) the same address space; modifications to the address space by one can be perceived by the others.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004