Chapter Contents

Previous

Next
munmap

munmap



Cancel Mapping of a Memory Area to a File

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
USAGE NOTES
EXAMPLE
RELATED FUNCTIONS


SYNOPSIS

#include <mman.h>
int munmap(void *addr, unsigned int len);


DESCRIPTION

The munmap function is used to terminate mapping of part or all of a memory area previously mapped to a file by the mmap function.

The addr argument is the address of the first page of mapped memory to be unmapped. The address must be on a page boundary, but need not be the first byte of the entire area mapped to a file.

The len argument specifies the number of bytes of memory to be unmapped. If the length does not specify an integral number of pages, it is rounded up to do so. The length need not specify the entire area of mapped memory.

If an area of memory is mapped and then partially unmapped, any reference to an unmapped portion will cause a segmentation violation.

If the memory area was created by a call to mmap specifying the MAP_SHARED symbolic flag, all changed areas of memory are written back to the file before munmap completes. If the mmap call specified MAP_PRIVATE , all changes are discarded.

See the IBM UNIX System Services Assembler Callable Services manual for additional information about the behavior of munmap and the conditions under which it can be used.


RETURN VALUE

munmap returns 0 if successful, or -1 if unsuccessful.


USAGE NOTES

The munmap function can only be used with MVS 5.2.2 or a later release.


EXAMPLE

Refer to mmap for an example.


RELATED FUNCTIONS

mmap , mprotect , msync


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.