plock(2) plock(2)
plock - lock into memory or unlock process, text, or data
#include <sys/lock.h>
int plock(int op);
plock 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.
plock does not lock down memory which has been mapped into the address
space of a process via the mmap(2) system call (e.g., IRIX Arenas).
These mmaped memory regions may be locked down using one of the following
system calls: mpin(2), mlock(3C), mlockall(3C).
plock does not lock down the stack of the calling process. The stack of
a process can only be locked into memory with the mlockall(3C) system
call.
plock performs the function specified by op:
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.
plock fails and does not perform the requested operation if one or more
of the following are true:
EPERM The calling process does not have the super-user
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 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 lock exists on the calling
process.
Page 1
plock(2) plock(2)
EAGAIN Not enough memory.
intro(2), exec(2), exit(2), fork(2), getrlimit(2), mlock(3C),
mlockall(3C), mpin(2), memcntl(2), shmctl(2), ulimit(2).
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.
The plock function and mlockall/munlockall 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.
PPPPaaaaggggeeee 2222 [ Back ]
|