plock
Purpose
Locks the process, text, or data in memory.
Syntax
#include <sys/lock.h>
int plock (op)
int op;
Description
The plock system call allows the calling process to lock
or unlock its text segment (text lock), its data segment
(data lock), or both its text and data segments (process
lock) into memory. Locked segments are pinned in memory
and are immune to all routine paging. The effective user
ID of the calling process must be superuser to use this
call.
The op parameter specifies one of the following oper-
ations:
PROCLOCK Locks text and data segments into memory
(process lock).
TXTLOCK Locks text segment into memory (text lock).
DATLOCK Locks data segment into memory (data lock).
UNLOCK Removes locks.
Return Value
Upon successful completion, a value of 0 is returned to
the calling process. If plock fails, a value of -1 is
returned and errno is set to indicate the error.
Diagnostics
The plock system call fails if one or more of the fol-
lowing are true:
EPERM The effective user ID of the calling process
is not superuser.
EINVAL The op parameter has a value other than PRO-
CLOCK, TXTLOCK, DATLOCK, or UNLOCK.
EINVAL op is equal to PROCLOCK and a process lock, a
text lock, or a data lock already exists on
the calling process.
EINVAL op is equal to TXTLOCK and a text lock, or a
process lock already exists on the calling
process.
EINVAL op is equal to DATLOCK and data lock, or a
process lock already exists on the calling
process.
EINVAL op is equal to UNLOCK and no type of lock
exists on the calling process.
Related Information
In this book: "exec: execl, execv, execle, execve,
execlp, execvp," "exit, _exit," and "fork."