90 lines
2.5 KiB
Groff
90 lines
2.5 KiB
Groff
'\"macro stdmacro
|
|
.if n .pH g2.munmap @(#)munmap 41.3 of 4/10/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
'\" ident "@(#)svid_rt:rt_os/munmap 1.2"
|
|
.\" @(#)munmap 1.4 88/09/26 SMI;
|
|
'\" macro stdmacro
|
|
.\" Sun's munmap.2
|
|
.nr X
|
|
.if \nX=0 .ds x} munmap 2 "" "\&"
|
|
.if \nX=1 .ds x} munmap 2 ""
|
|
.if \nX=2 .ds x} munmap 2 "" "\&"
|
|
.if \nX=3 .ds x} munmap "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4munmap\f1 \- unmap pages of memory
|
|
.SH SYNOPSIS
|
|
.ft 4
|
|
.nf
|
|
#include <sys/types.h>
|
|
#include <sys/mman.h>
|
|
.sp0.5
|
|
int munmap(void \(**addr, size_t len);
|
|
.ft 1
|
|
.fi
|
|
.SH DESCRIPTION
|
|
The function \f4munmap\f1
|
|
removes the mappings for pages in the range
|
|
[\f2addr, addr + len\f1\^).
|
|
Further references to these pages will result
|
|
in the delivery of a
|
|
\f4\%SIGSEGV\f1
|
|
signal to the process.
|
|
.P
|
|
If the region being detached via \f4\%munmap\f1(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, \f4\%munmap\f1(2)
|
|
would fail returning \f4\%EBUSY\f1.
|
|
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 \f4\%EBUSY\f1 is returned.
|
|
.P
|
|
The function \f4mmap\f1
|
|
often performs an implicit
|
|
\f4munmap\f1.
|
|
.P
|
|
Note that when
|
|
\f4munmap\f1 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 \f4munmap\f1 system call must synchronize
|
|
the removal of the address space with the other processes
|
|
in the share group.
|
|
Refer to the \f4sproc\f1(2) manual entry for more information
|
|
on shared process groups.
|
|
.SH RETURN VALUE
|
|
On success, \f4munmap\f1 returns \f40\f1;
|
|
on failure, \f4munmap\f1 returns \f4\-1\f1 and
|
|
sets \f4errno\f1 to indicate an error.
|
|
.SH ERRORS
|
|
Under the following conditions, the function \f4munmap\f1
|
|
fails and sets \f4errno\f1 to:
|
|
.TP .75i
|
|
\f4EINVAL\f1
|
|
\f2addr\f1
|
|
is not a multiple of the page size as returned by
|
|
\f4\%sysconf\f1.
|
|
.TP
|
|
\f4EINVAL\f1
|
|
Addresses in the range
|
|
[\f2addr, addr + len\f1\^)
|
|
are outside the valid range for
|
|
the address space of a process.
|
|
.TP
|
|
\f4EINVAL\f1
|
|
The argument
|
|
\f2len\f1
|
|
has a value less than or equal to \f40\f1.
|
|
.TP
|
|
\f4EBUSY\f1
|
|
The address range specified has some active \f4I/O\f1 initiated by
|
|
some other process belonging to same share group.
|
|
.SH SEE ALSO
|
|
.na
|
|
\f4mmap\fP(2),
|
|
\f4signal\fP(2),
|
|
\f4sysconf\fP(3C).
|
|
.ad
|