[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    munmap(2) manual page Table of Contents

Name

munmap - unmap pages of memory

Synopsis


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

int munmap(caddr_t 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

Upon successful completion, the function munmap() returns a value of 0; otherwise, it returns a value of -1 and sets errno to indicate an error.

Errors

Under the following conditions, the function munmap() fails and sets errno to:
EINVAL
if addr is not a multiple of the page size as returned by sysconf.
EINVAL
if 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.

See Also

mmap(2) , sysconf(3C)


Table of Contents