Locks the process, text, or data in memory.
Standard C Library (libc.a)
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:
|EPERM||The effective user ID of the calling process does not have the root user authority.|
|EINVAL||The Operation parameter has a value other than PROCLOCK, TXTLOCK, DATLOCK, or UNLOCK.|
|EINVAL||The Operation parameter is equal to PROCLOCK, and a process lock, text lock, or data lock already exists on the calling process.|
|EINVAL||The Operation parameter is equal to TXTLOCK, and a text lock or process lock already exists on the calling process.|
|EINVAL||The Operation parameter is equal to DATLOCK, and a data lock or process lock already exists on the calling process.|
|EINVAL||The Operation parameter is equal to UNLOCK, and no type of lock exists on the calling process.|
This subroutine is part of Base Operating System (BOS) Runtime.
The exec subroutines, _exit, exit, or atexit subroutine, fork subroutine, ulimit subroutine.