Locks the process, text, or data in memory.
#include <sys/lock.h>
int plock (Operation) int Operation;
The plock subroutine allows the calling process to lock or unlock its text region (text lock), its data region (data lock), or both its text and data regions (process lock) into memory. The plock subroutine does not lock the shared text segment or any shared data segments. Locked segments are pinned in memory and are immune to all routine paging. Memory locked by a parent process is not inherited by the children after a fork subroutine call. Likewise, locked memory is unlocked if a process executes one of the exec subroutines. The calling process must have the root user authority to use this subroutine.
A real-time process can use this subroutine to ensure that its code, data, and stack are always resident in memory.
Note: Before calling the plock subroutine, the user application must lower the maximum stack limit value using the ulimit subroutine.
Operation | Specifies one of the following: |
Upon successful completion, a value of 0 is returned to the calling process. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.
The plock subroutine is unsuccessful if one or more of the following is true:
This subroutine is part of Base Operating System (BOS) Runtime.
The exec subroutines, _exit, exit, or atexit subroutine, fork subroutine, ulimit subroutine.