Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/mlockall.html
2024-02-19 00:21:47 -05:00

183 lines
7.2 KiB
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 The Open Group, All Rights Reserved -->
<title>mlockall</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="mlockall"></a> <a name="tag_03_378"></a><!-- mlockall -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_378_01"></a>NAME</h4>
<blockquote>mlockall, munlockall - lock/unlock the address space of a process (<b>REALTIME</b>)</blockquote>
<h4><a name="tag_03_378_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<div class="box"><code><tt><sup>[<a href="javascript:open_code('ML')">ML</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 mlockall(int</tt> <i>flags</i><tt>);<br>
int munlockall(void); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
<tt><br>
</tt></blockquote>
<h4><a name="tag_03_378_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>mlockall</i>() function shall cause all of the pages mapped by the address space of a process to be memory-resident until
unlocked or until the process exits or <i><a href="../functions/exec.html">exec</a></i>s another process image. The <i>flags</i>
argument determines whether the pages to be locked are those currently mapped by the address space of the process, those that are
mapped in the future, or both. The <i>flags</i> argument is constructed from the bitwise-inclusive OR of one or more of the
following symbolic constants, defined in <a href="../basedefs/sys/mman.h.html"><i>&lt;sys/mman.h&gt;</i></a>:</p>
<dl compact>
<dt>MCL_CURRENT</dt>
<dd>Lock all of the pages currently mapped into the address space of the process.</dd>
<dt>MCL_FUTURE</dt>
<dd>Lock all of the pages that become mapped into the address space of the process in the future, when those mappings are
established.</dd>
</dl>
<p>If MCL_FUTURE is specified, and the automatic locking of future mappings eventually causes the amount of locked memory to exceed
the amount of available physical memory or any other implementation-defined limit, the behavior is implementation-defined. The
manner in which the implementation informs the application of these situations is also implementation-defined.</p>
<p>The <i>munlockall</i>() function shall unlock all currently mapped pages of the address space of the process. Any pages that
become mapped into the address space of the process after a call to <i>munlockall</i>() shall not be locked, unless there is an
intervening call to <i>mlockall</i>() specifying MCL_FUTURE or a subsequent call to <i>mlockall</i>() specifying MCL_CURRENT. If
pages mapped into the address space of the process are also mapped into the address spaces of other processes and are locked by
those processes, the locks established by the other processes shall be unaffected by a call by this process to
<i>munlockall</i>().</p>
<p>Upon successful return from the <i>mlockall</i>() function that specifies MCL_CURRENT, all currently mapped pages of the
process' address space shall be memory-resident and locked. Upon return from the <i>munlockall</i>() function, all currently mapped
pages of the process' address space shall be unlocked with respect to the process' address space. The memory residency of unlocked
pages is unspecified.</p>
<p>The appropriate privilege is required to lock process memory with <i>mlockall</i>().</p>
</blockquote>
<h4><a name="tag_03_378_04"></a>RETURN VALUE</h4>
<blockquote>
<p>Upon successful completion, the <i>mlockall</i>() function shall return a value of zero. Otherwise, no additional memory shall
be locked, and the function shall return a value of -1 and set <i>errno</i> to indicate the error. The effect of failure of
<i>mlockall</i>() on previously existing locks in the address space is unspecified.</p>
<p>If it is supported by the implementation, the <i>munlockall</i>() function shall always return a value of zero. Otherwise, the
function shall return a value of -1 and set <i>errno</i> to indicate the error.</p>
</blockquote>
<h4><a name="tag_03_378_05"></a>ERRORS</h4>
<blockquote>
<p>The <i>mlockall</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>
<dt>[EINVAL]</dt>
<dd>The <i>flags</i> argument is zero, or includes unimplemented flags.</dd>
</dl>
<p>The <i>mlockall</i>() function may fail if:</p>
<dl compact>
<dt>[ENOMEM]</dt>
<dd>Locking all of the pages currently mapped into the address space of the process would exceed an implementation-defined limit on
the amount of memory that the process 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_378_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_378_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_378_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_378_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_378_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="mlock.html"><i>mlock</i>()</a> , <a href="munmap.html"><i>munmap</i>()</a> , the Base
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_378_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_378_12"></a>Issue 6</h4>
<blockquote>
<p>The <i>mlockall</i>() and <i>munlockall</i>() functions are marked as part of the Process 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 Process
Memory 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>