plock(2) plock(2)
NAME
plock - lock into memory or unlock process, text, or data
SYNOPSIS
#include <sys/lock.h>
int plock(int op);
DESCRIPTION
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. plock also
allows these segments to be unlocked. The effective user id
of the calling process must have the P_PLOCK privilege to use
this 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.
Return Values
On success, plock returns 0. On failure, plock returns -1 and
sets errno to identify the error.
Errors
In the following conditions, plock fails and sets errno to:
EPERM The effective user id of the calling process
does not have the P_PLOCK privilege.
EFAULT The segment to be locked has been aborted (e.g.
by a file truncate operation), or pages
following the end of an object are not
allocated.
EIO An I/O error occurred when attempting to read
the page from a device or a network.
Copyright 1994 Novell, Inc. Page 1
plock(2) plock(2)
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.
EAGAIN Not enough memory, or there is insufficient
resources.
REFERENCES
exec(2), exit(2), fork(2), memcntl(2)
NOTICES
memcntl is the preferred interface to memory locking.
Considerations for Threads Programming
Sibling threads share (by definition) the same address space;
modifications to the address space by one can be perceived by
the others.
Copyright 1994 Novell, Inc. Page 2