📄 munmap.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>munmap</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_007_850"> </a>NAME</h4><blockquote>munmap - unmap pages of memory</blockquote><h4><a name = "tag_000_007_851"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="sysmman.h.html">sys/mman.h</a>>int munmap(void *<i>addr</i>, size_t <i>len</i>);</code></pre></blockquote><h4><a name = "tag_000_007_852"> </a>DESCRIPTION</h4><blockquote>The function<i>munmap()</i>removes any mappings forthose entire pages containing any part of theaddress spaceof the process starting at<i>addr</i>and continuing for<i>len</i>bytes.Further references to these pages result in thegeneration of a SIGSEGV signal to the process.If there are no mappings in the specified address range,then<i>munmap()</i>has no effect.<p>The implementation willrequire that<i>addr</i>be a multiple of the page size {PAGESIZE}.<p>If a mapping to be removed was private,any modifications made in this address range will be discarded.<p>Any memory locks (see<i><a href="mlock.html">mlock()</a></i>and<i><a href="mlockall.html">mlockall()</a></i>)associated with this address range will be removed,as if by an appropriate call to<i><a href="munlock.html">munlock()</a></i>.<p>The behaviour of this function is unspecifiedif the mapping was not established by a call to<i><a href="mmap.html">mmap()</a></i>.</blockquote><h4><a name = "tag_000_007_853"> </a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>munmap()</i>returns 0. Otherwise, it returns -1 and sets<i>errno</i> to indicate the error.</blockquote><h4><a name = "tag_000_007_854"> </a>ERRORS</h4><blockquote>The<i>munmap()</i>function will fail if:<dl compact><dt>[EINVAL]<dd>Addresses in the range [<i>addr, addr + len</i>) are outside the validrange for the address space of a process.<dt>[EINVAL]<dd>The <i>len</i> argument is 0.<dt>[EINVAL]<dd>The <i>addr</i> argument is not a multiple of the page size as returned by<i><a href="sysconf.html">sysconf()</a></i>.</dl></blockquote><h4><a name = "tag_000_007_855"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_856"> </a>APPLICATION USAGE</h4><blockquote>The third form of EINVAL above is marked EX because it is defined as anoptional error in the POSIX Realtime Extension.</blockquote><h4><a name = "tag_000_007_857"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_858"> </a>SEE ALSO</h4><blockquote><i><a href="mmap.html">mmap()</a></i>,<i><a href="sysconf.html">sysconf()</a></i>,<i><a href="signal.h.html"><signal.h></a></i>,<i><a href="sysmman.h.html"><sys/mman.h></a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -