Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX 11i Version 1.5 Reference Volume 3, Section 2: System Calls > m

munmap(2)

» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

munmap — unmap pages of memory

SYNOPSIS

#include <sys/mman.h>

int munmap(void *addr, size_t len);

DESCRIPTION

The munmap() function removes the mappings for pages in the range [addr, addr+len], rounding the len argument up to the next multiple of the page size as returned by sysconf(). If addr is not the address of a mapping established by a prior call to mmap(), the behaviour is undefined. After a successful call to munmap() and before any subsequent mapping of the unmapped pages, further references to these pages will result in the delivery of a SIGBUS or SIGSEGV signal to the process.

RETURN VALUE

Upon successful completion, munmap() returns 0. Otherwise, it returns -1 and sets errno to indicate the error.

ERRORS

The munmap() function will fails if:

[EINVAL]

The addr argument 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 len argument is 0.

SEE ALSO

mmap(2), sysconf(2), <signal.h>, <sys/mman.h>.

CHANGE HISTORY

First released in Issue 4, Version 2.

munmap HP-UX EXTENSIONS

SYNOPSIS (HP-UX)

int munmap(caddr_t addr, size_t len);

DESCRIPTION

munmap() unmaps a mapped file or anonymous memory region.

If the address range specified by addr and len was not created by a successful call to mmap(), munmap() returns an error.

If the specified address range was created by multiple calls to mmap(), munmap() succeeds in unmapping all of the specified regions, provided they form a contiguous address range.

If the region was created with the MAP_PRIVATE option, any modifications made to the region are discarded.

ERRORS

[EINVAL]

addr is not a multiple of the page size as returned by sysconf(_SC_PAGE_SIZE).

[EINVAL]

The address range specified by addr and len was not created by a successful call to mmap().

AUTHOR

munmap() was developed by HP, AT&T, and OSF.

STANDARDS CONFORMANCE

munmap(): AES, SVID3

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2001 Hewlett-Packard Development Company, L.P.