Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/lib/ape/man/3/munmap

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "MUNMAP" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" munmap 
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.SH NAME
munmap \- unmap pages of memory
.SH SYNOPSIS
.LP
\fB#include <sys/mman.h>
.br
.sp
int munmap(void *\fP\fIaddr\fP\fB, size_t\fP \fIlen\fP\fB); \fP
\fB
.br
\fP
.SH DESCRIPTION
.LP
The \fImunmap\fP() function shall remove any mappings for those entire
pages containing any part of the address space of the
process starting at \fIaddr\fP and continuing for \fIlen\fP bytes.
Further references to these pages shall result in the
generation of a SIGSEGV signal to the process. If there are no mappings
in the specified address range, then \fImunmap\fP() has no
effect.
.LP
The implementation shall require that \fIaddr\fP be a multiple of
the page size {PAGESIZE}.
.LP
If a mapping to be removed was private, any modifications made in
this address range shall be discarded.
.LP
Any memory locks (see \fImlock\fP() and \fImlockall\fP()) associated
with
this address range shall be removed, as if by an appropriate call
to \fImunlock\fP(). 
.LP
If a mapping removed from a typed memory object causes the corresponding
address range of the memory pool to be inaccessible by any
process in the system except through allocatable mappings (that is,
mappings of typed memory objects opened with the
POSIX_TYPED_MEM_MAP_ALLOCATABLE flag), then that range of the memory
pool shall become deallocated and may become available to
satisfy future typed memory allocation requests.
.LP
A mapping removed from a typed memory object opened with the POSIX_TYPED_MEM_MAP_ALLOCATABLE
flag shall not affect in any way
the availability of that typed memory for allocation. 
.LP
The behavior of this function is unspecified if the mapping was not
established by a call to \fImmap\fP().
.SH RETURN VALUE
.LP
Upon successful completion, \fImunmap\fP() shall return 0; otherwise,
it shall return -1 and set \fIerrno\fP to indicate the
error.
.SH ERRORS
.LP
The \fImunmap\fP() function shall fail if:
.TP 7
.B EINVAL
Addresses in the range [\fIaddr\fP,\fIaddr\fP+\fIlen\fP) are outside
the valid range for the address space of a
process.
.TP 7
.B EINVAL
The \fIlen\fP argument is 0.
.TP 7
.B EINVAL
The \fIaddr\fP argument is not a multiple of the page size as returned
by \fIsysconf\fP().
.sp
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.LP
None.
.SH APPLICATION USAGE
.LP
The \fImunmap\fP() function is only supported if the Memory Mapped
Files option or the Shared Memory Objects option is
supported.
.SH RATIONALE
.LP
The \fImunmap\fP() function corresponds to SVR4, just as the \fImmap\fP()
function
does.
.LP
It is possible that an application has applied process memory locking
to a region that contains shared memory. If this has
occurred, the \fImunmap\fP() call ignores those locks and, if necessary,
causes those locks to be removed.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fImlock\fP(), \fImlockall\fP(), \fImmap\fP(),
\fIposix_typed_mem_open\fP(), \fIsysconf\fP(), the Base
Definitions volume of IEEE\ Std\ 1003.1-2001, \fI<signal.h>\fP, \fI<sys/mman.h>\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].