DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

plock(S)


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.

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(S), exit(S), fork(S), memcntl(S)

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.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005