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

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 "MLOCK" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" mlock 
.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
mlock, munlock \- lock or unlock a range of process address space (\fBREALTIME\fP)
.SH SYNOPSIS
.LP
\fB#include <sys/mman.h>
.br
.sp
int mlock(const void *\fP\fIaddr\fP\fB, size_t\fP \fIlen\fP\fB);
.br
int munlock(const void *\fP\fIaddr\fP\fB, size_t\fP \fIlen\fP\fB);
\fP
\fB
.br
\fP
.SH DESCRIPTION
.LP
The \fImlock\fP() function shall cause those whole pages containing
any part of the address space of the process starting at
address \fIaddr\fP and continuing for \fIlen\fP bytes to be memory-resident
until unlocked or until the process exits or \fIexec\fPs another process
image. The implementation may require that \fIaddr\fP be a multiple
of
{PAGESIZE}.
.LP
The \fImunlock\fP() function shall unlock those whole pages containing
any part of the address space of the process starting at
address \fIaddr\fP and continuing for \fIlen\fP bytes, regardless
of how many times \fImlock\fP() has been called by the process
for any of the pages in the specified range. The implementation may
require that \fIaddr\fP be a multiple of {PAGESIZE}.
.LP
If any of the pages in the range specified to a call to \fImunlock\fP()
are also mapped into the address spaces of other
processes, any locks established on those pages by another process
are unaffected by the call of this process to \fImunlock\fP().
If any of the pages in the range specified by a call to \fImunlock\fP()
are also mapped into other portions of the address space
of the calling process outside the range specified, any locks established
on those pages via the other mappings are also unaffected
by this call.
.LP
Upon successful return from \fImlock\fP(), pages in the specified
range shall be locked and memory-resident. Upon successful
return from \fImunlock\fP(), pages in the specified range shall be
unlocked with respect to the address space of the process.
Memory residency of unlocked pages is unspecified.
.LP
The appropriate privilege is required to lock process memory with
\fImlock\fP().
.SH RETURN VALUE
.LP
Upon successful completion, the \fImlock\fP() and \fImunlock\fP()
functions shall return a value of zero. Otherwise, no change
is made to any locks in the address space of the process, and the
function shall return a value of -1 and set \fIerrno\fP to
indicate the error.
.SH ERRORS
.LP
The \fImlock\fP() and \fImunlock\fP() functions shall fail if:
.TP 7
.B ENOMEM
Some or all of the address range specified by the \fIaddr\fP and \fIlen\fP
arguments does not correspond to valid mapped
pages in the address space of the process.
.sp
.LP
The \fImlock\fP() function shall fail if:
.TP 7
.B EAGAIN
Some or all of the memory identified by the operation could not be
locked when the call was made.
.sp
.LP
The \fImlock\fP() and \fImunlock\fP() functions may fail if:
.TP 7
.B EINVAL
The \fIaddr\fP argument is not a multiple of {PAGESIZE}.
.sp
.LP
The \fImlock\fP() function may fail if:
.TP 7
.B ENOMEM
Locking the pages mapped by the specified range would exceed an implementation-defined
limit on the amount of memory that the
process may lock.
.TP 7
.B EPERM
The calling process does not have the appropriate privilege to perform
the requested operation.
.sp
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.LP
None.
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIexec\fP(), \fIexit\fP(), \fIfork\fP(), \fImlockall\fP(), \fImunmap\fP(),
the
Base Definitions volume of IEEE\ Std\ 1003.1-2001, \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 webmaster@9p.io.