plock(2)
NAME
plock − lock process, text, or data in memory
SYNOPSIS
#include <sys/lock.h>
int plock(int op);
DESCRIPTION
plock() allows the calling process to lock the text segment of the process (text lock), its data segment (data lock), or both its text and data segment (process lock) into memory. Locked segments are immune to all routine swapping. plock() also allows these segments to be unlocked. To use this call, the calling process must be a member of a privilege group allowing plock() (see setprivgrp() on getprivgrp(2)) or the effective user ID of the calling process must be a user having appropriate privileges. op specifies the following:
PROCLOCK lock text and data segments into memory (process lock)
TXTLOCK lock text segment into memory (text lock)
DATLOCK lock data segment into memory (data lock)
UNLOCK remove locks
EXAMPLES
The following call to plock() locks the calling process in memory:
plock (PROCLOCK);
RETURN VALUE
Upon successful completion, plock() returns 0 to the calling process. Otherwise, it returns −1 and sets errno to indicate the error.
ERRORS
plock() fails and does not perform the requested operation if any of the following conditions are encountered:
[EPERM] The effective user ID of the calling process is not super-user and the user does not have the PRIV_MLOCK privilege.
[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 process lock already exists on the calling process.
[EINVAL] op is equal to DATLOCK and a data lock, or process lock already exists on the calling process.
[EINVAL] op is equal to UNLOCK and no type of lock exists on the calling process.
[EINVAL] op is not equal to either PROCLOCK, TXTLOCK, DATLOCK, or UNLOCK.
[EINVAL] plock() not allowed in [vfork, exec] window (see vfork(2)).
[ENOMEM] There is not sufficient lockable memory in the system to satisfy the locking request.
SEE ALSO
STANDARDS CONFORMANCE
plock(): SVID2, XPG2
Hewlett-Packard Company — HP-UX Release 9.0: August 1992