munmap()

NAME

munmap() - remove mappings for files in memory

SYNOPSIS

#include <sys/mman.h>

int munmap (void *addr, size_t len)

DESCRIPTION

The munmap(2) function removes a mapping for a file from the range [addr addr + len).

Addr should be a multiple of the page size as given by sysconf(2). The len argument is rounded up to the next multiple of the page size.

Mapped files are automatically unmapped when the process terminates.

RETURN VALUE

On success, munmap(2) returns 0. On failure, it returns -1 and sets errno to indicate the error.

ERRORS

The munmap(2) function can fail if:

[EINVAL]
The addr is not a multiple of the page size.

Addresses in the range [addr addr + len) are not in the valid range for a process' address space.

Len is 0.

SEE ALSO

exec(2)

fcntl(2)

fork(2)

mmap(2)

shmat(2)

sysconf(2)