Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ plock(2) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

exit(2)

fork(2)

shmctl(2)

mlock(3P4)

mlockall(3P4)

plock(2)  —  AT&T SYSTEM V

NAME

plock − lock process, text, or data in memory

SYNOPSIS

#include <sys/lock.h>

int plock (op)
int op;

DESCRIPTION

plock allows the calling process to lock its text region (text lock), its data and stack regions (data lock), or all three regions (process lock) into memory.  Locked regions are immune to all routine swapping.  Pages of the regions not currently resident are faulted into memory and locked.  If a locked region is extended, the newly allocated pages are faulted into memory immediately.  plock also allows these regions to be unlocked. 

Process locks, text locks, and data locks are not inherited by the child process after a fork(2). 

The caller must either have an effective user ID equal to that of the super-user’s or must have the ACC_PLOCK privilege to use this service. 

plock cannot be used to lock or unlock shared memory regions.  This functionality is provided by the shmctl(2) service. 

Op specifies the following:

PROCLOCK − lock text, data and stack regions into memory (process lock).  Also, prevent the process from being swapped. 

TXTLOCK − lock text region into memory (text lock)

DATLOCK − lock data and stack regions into memory (data lock)

UNLOCK − remove locks

WARNING

Fork(2) generally uses copy-on-write techniques to reduce the amount of data that must be copied from the parent process to the child process.  Real copies however are made of locked pages in order to avoid the copy-on-write protection faults.  For the highest performance, applications are advised to avoid fork(2) when large portions of their address spaces are locked. 

RETURN VALUE

Upon successful completion, a value of 0 is returned to the calling process.  Otherwise, a value of −1 is returned and errno is set to indicate the error. 

ERRORS

plock will fail and not perform the requested operation if one or more of the following are true:

­[EPERM] The effective user ID of the calling process is not super-user or the user does not have the ACC_PLOCK access vector.  (If access vectors are configured)

­[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 a 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. 

­[EAGAIN] Not enough memory. 

SEE ALSO

exec(2), exit(2), fork(2), shmctl(2), mlock(3P4), mlockall(3P4). 

CX/UX Programmer’s Reference Manual

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026