Locks the process, text, or data in memory.
Standard C Library (libc.a)
#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.
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:
The exec (exec: execl, execle, execlp, execv, execve, execvp, or exect Subroutine) subroutines, _exit, exit, or atexit (exit, atexit, _exit, or _Exit Subroutine)subroutine, fork (fork, f_fork, or vfork Subroutine) subroutine, ulimit subroutine.