plock(2)
NAME
plock − lock 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 in memory 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 plock call also allows these segments to be unlocked. The op specifies the following:
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.
RESTRICTIONS
The effective user ID of the calling process must be superuser to use this call.
RETURN VALUE
If unsuccessful, returns a −1, and the global variable errno indicates the error code.
DIAGNOSTICS
The plock call will fail if:
[EPERM] The effective user ID of the calling process is not superuser.
[EINVAL] The specified op is equal to PROCLOCK, and either a process lock, a text lock, or a data lock already exists on the calling process.
[EINVAL] The specified op is equal to TXTLOCK, and either a text lock or a process lock already exists on the calling process.
[EINVAL] The specified op is equal to DATLOCK, and either a data lock or a process lock already exists on the calling process.
[EINVAL] The specified op is equal to UNLOCK, and no type of lock exists on the calling process.