*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> standard/munmap (2)              


munmap(2)							     munmap(2)

NAME    [Toc]    [Back]

     munmap - unmap pages of memory

SYNOPSIS    [Toc]    [Back]

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

     int munmap(void *addr, size_t len);

DESCRIPTION    [Toc]    [Back]

     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.

     If	the region being detached via munmap(2)	belongs	to a shared address
     space, and	I/O is being done to this range	by a process belonging to the
     same shared group,	munmap(2) would	fail returning EBUSY.  The specified
     virtual address range would not be	unmapped from the shared address space
     unless it spans multiple contiguous regions in which case part of the
     address range (before the region causing the error) may be	unmapped
     before EBUSY is returned.

     The function mmap often performs an implicit munmap.

     Note that when munmap is called by	a process which	is a member of a
     shared process group, the unmapping operation is relatively more
     expensive than it is for an independent process.  This is because the
     munmap system call	must synchronize the removal of	the address space with
     the other processes in the	share group.  Refer to the sproc(2) manual
     entry for more information	on shared process groups.

RETURN VALUE    [Toc]    [Back]

     On	success, munmap	returns	0; on failure, munmap returns -1 and sets
     errno to indicate an error.

ERRORS    [Toc]    [Back]

     Under the following conditions, the function munmap fails and sets	errno

     EINVAL addr 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	argument len has a value less than or equal to 0.

     EBUSY  The	address	range specified	has some active	I/O initiated by some
	    other process belonging to same share group.

									Page 1

munmap(2)							     munmap(2)

     mmap(2), signal(2), sysconf(3C).

									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
shmat OpenBSD map/unmap shared memory
shmat NetBSD map/unmap shared memory
shmdt OpenBSD map/unmap shared memory
shmdt NetBSD map/unmap shared memory
mmap Linux map or unmap files or devices into memory
mmap IRIX map pages of memory
mmap HP-UX map pages of memory
mpin IRIX lock pages in memory
mincore NetBSD determine residency of memory pages
pmap_copy FreeBSD copy physical memory pages
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service