⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 munlock.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>mlock</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="mlock"></a> <a name="tag_03_377"></a><!-- mlock --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright &copy; 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_377_01"></a>NAME</h4><blockquote>mlock, munlock - lock or unlock a range of process address space (<b>REALTIME</b>)</blockquote><h4><a name="tag_03_377_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('MR')">MR</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> #include &lt;<a href="../basedefs/sys/mman.h.html">sys/mman.h</a>&gt;<br><br> int mlock(const void *</tt><i>addr</i><tt>, size_t</tt> <i>len</i><tt>);<br> int munlock(const void *</tt><i>addr</i><tt>, size_t</tt> <i>len</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]"border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_03_377_03"></a>DESCRIPTION</h4><blockquote><p>The <i>mlock</i>() function shall cause those whole pages containing any part of the address space of the process starting ataddress <i>addr</i> and continuing for <i>len</i> bytes to be memory-resident until unlocked or until the process exits or <i><ahref="../functions/exec.html">exec</a></i>s another process image. The implementation may require that <i>addr</i> be a multiple of{PAGESIZE}.</p><p>The <i>munlock</i>() function shall unlock those whole pages containing any part of the address space of the process starting ataddress <i>addr</i> and continuing for <i>len</i> bytes, regardless of how many times <i>mlock</i>() has been called by the processfor any of the pages in the specified range. The implementation may require that <i>addr</i> be a multiple of {PAGESIZE}.</p><p>If any of the pages in the range specified to a call to <i>munlock</i>() are also mapped into the address spaces of otherprocesses, any locks established on those pages by another process are unaffected by the call of this process to <i>munlock</i>().If any of the pages in the range specified by a call to <i>munlock</i>() are also mapped into other portions of the address spaceof the calling process outside the range specified, any locks established on those pages via the other mappings are also unaffectedby this call.</p><p>Upon successful return from <i>mlock</i>(), pages in the specified range shall be locked and memory-resident. Upon successfulreturn from <i>munlock</i>(), pages in the specified range shall be unlocked with respect to the address space of the process.Memory residency of unlocked pages is unspecified.</p><p>The appropriate privilege is required to lock process memory with <i>mlock</i>().</p></blockquote><h4><a name="tag_03_377_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, the <i>mlock</i>() and <i>munlock</i>() functions shall return a value of zero. Otherwise, no changeis made to any locks in the address space of the process, and the function shall return a value of -1 and set <i>errno</i> toindicate the error.</p></blockquote><h4><a name="tag_03_377_05"></a>ERRORS</h4><blockquote><p>The <i>mlock</i>() and <i>munlock</i>() functions shall fail if:</p><dl compact><dt>[ENOMEM]</dt><dd>Some or all of the address range specified by the <i>addr</i> and <i>len</i> arguments does not correspond to valid mappedpages in the address space of the process.</dd></dl><p>The <i>mlock</i>() function shall fail if:</p><dl compact><dt>[EAGAIN]</dt><dd>Some or all of the memory identified by the operation could not be locked when the call was made.</dd></dl><p>The <i>mlock</i>() and <i>munlock</i>() functions may fail if:</p><dl compact><dt>[EINVAL]</dt><dd>The <i>addr</i> argument is not a multiple of {PAGESIZE}.</dd></dl><p>The <i>mlock</i>() function may fail if:</p><dl compact><dt>[ENOMEM]</dt><dd>Locking the pages mapped by the specified range would exceed an implementation-defined limit on the amount of memory that theprocess may lock.</dd><dt>[EPERM]</dt><dd>The calling process does not have the appropriate privilege to perform the requested operation.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_377_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_377_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_377_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_377_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_377_10"></a>SEE ALSO</h4><blockquote><p><a href="exec.html"><i><a href="../functions/exec.html">exec</a></i>()</a> , <a href="exit.html"><i>exit</i>()</a> , <a href="fork.html"><i>fork</i>()</a> , <a href="mlockall.html"><i>mlockall</i>()</a> , <a href="munmap.html"><i>munmap</i>()</a> , theBase Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/sys/mman.h.html"><i>&lt;sys/mman.h&gt;</i></a></p></blockquote><h4><a name="tag_03_377_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 5. Included for alignment with the POSIX Realtime Extension.</p></blockquote><h4><a name="tag_03_377_12"></a>Issue 6</h4><blockquote><p>The <i>mlock</i>() and <i>munlock</i>() functions are marked as part of the Range Memory Locking option.</p><p>The [ENOSYS] error condition has been removed as stubs need not be provided if an implementation does not support the RangeMemory Locking option.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -