munmap(2) munmap(2)
NAME
munmap - terminate mapping of memory pages
SYNOPSIS
#include <sys/mman.h>
int munmap(void *addr, sizet len);
DESCRIPTION
The munmap() function removes the mappings for pages in the range
[addr, addr + len) and in the process rounds up the len argument to
the next multiple of the page length, as returned by sysconf(). The
resulting behavior is indeterminate if addr is not the address of a
mapping created by a previous mmap() call. When munmap() has been
called successfully and before any remaining unmapped pages are
mapped, further references to these pages results in a SIGBUS or
SIGSEGV signal being output to the process.
The function mmap() often performs an implicit munmap().
ERRORS
The following error code descriptions are function-specific. You will
find a general description in introprm2(2) or in errno(5).
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 if the argument len has a value less than or equal to 0.
RESULT
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.
SEE ALSO
mmap(2), sysconf(3C), mman(5).
Page 1 Reliant UNIX 5.44 Printed 11/98