1
0
Files
irix-657m-src/eoe/man/man2/plock.2
2022-09-29 17:59:04 +03:00

115 lines
2.9 KiB
Groff

'\"macro stdmacro
.if n .pH g2.plock @(#)plock 41.5 of 5/26/91
.\" Copyright 1991 UNIX System Laboratories, Inc.
.\" Copyright 1989, 1990 AT&T
.nr X
.if \nX=0 .ds x} plock 2 "" "\&"
.if \nX=1 .ds x} plock 2 ""
.if \nX=2 .ds x} plock 2 "" "\&"
.if \nX=3 .ds x} plock "" "" "\&"
.TH \*(x}
.SH NAME
\f4plock\f1 \- lock into memory or unlock process, text, or data
.Op c p a
.SH C SYNOPSIS
\f4#include <sys/lock.h>\f1
.PP
\f4int plock(int op);\f1
.Op
.Op f
.SH FORTRAN SYNOPSIS
\f4integer \(**4 function plock (op)\f1
.br
\f4integer \(**4 op\f1
.Op
.SH DESCRIPTION
\f4plock\fP
allows the calling process to lock into memory or unlock its text segment (text lock),
its data segment (data lock), or both its text and data segments (process lock).
Locked segments are immune to all routine swapping.
The calling process must have the super-user privilege to use this
call.
.P
\f4plock\fP does not lock down memory which has been mapped into the address
space of a process via the \f4mmap\fP(2) system call (e.g., IRIX Arenas).
These mmaped memory regions may be locked down using one of the following
system calls: \f4mpin\fP(2), \f4mlock\fP(3C), \f4mlockall\fP(3C).
.P
\f4plock\fP does not lock down the stack of the calling process. The stack of
a process can only be locked into memory with the \f4mlockall\fP(3C) system call.
.P
\f4plock\fP performs the function specified by
.IR op :
.RS
.TP 12
\f4PROCLOCK \f1
Lock text and data segments into memory (process lock).
.TP
\f4TXTLOCK \f1
Lock text segment into memory (text lock).
.TP
\f4DATLOCK \f1
Lock data segment into memory (data lock).
.TP
\f4UNLOCK \f1
Remove locks.
.RE
.PP
\f4plock\fP
fails and does not perform the requested operation if one or more of
the following are true:
.TP 15
\f4EPERM\fP
The calling process does not have the super-user privilege.
.TP
\f4EINVAL\fP
.I op
is equal to
\f4PROCLOCK\f1
and a process lock, a text lock, or a data lock already exists on the calling
process.
.TP
\f4EINVAL\fP
.I op
is equal to
\f4TXTLOCK\f1
and a text lock, or a process lock already exists on the calling process.
.TP
\f4EINVAL\fP
.I op
is equal to
\f4DATLOCK\f1
and a data lock, or a process lock already exists on the calling
process.
.TP
\f4EINVAL\fP
.I op
is equal to
\f4UNLOCK\f1
and no lock exists on the calling process.
.TP
\f4EAGAIN\fP
Not enough memory.
.SH SEE ALSO
\f4intro\fP(2),
\f4exec\fP(2),
\f4exit\fP(2),
\f4fork\fP(2),
\f4getrlimit\fP(2),
\f4mlock\fP(3C),
\f4mlockall\fP(3C),
\f4mpin\fP(2),
\f4memcntl\fP(2),
\f4shmctl\fP(2),
\f4ulimit\fP(2).
.SH DIAGNOSTICS
Upon successful completion, a value of 0 is returned to the calling process.
Otherwise, a value of \-1 is returned and
\f4errno\fP
is set to indicate the error.
.SH WARNING
The \f4plock\fP function and \f4mlockall/munlockall\fP pair provide similar
functionality. Developers should choose the set that best suites their
application and stick with it, as mixing the interfaces may result in
unexpected behavior.