![]()  | 
![]()  | 
![]()  | 
![]()  | 
Lock a range of process address space in physical memory
#include <sys/mman.h>
int mlock(const void * addr, 
          size_t len);
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The mlock() function locks a range of process address space starting at address addr and continuing for length len. The addr must be a multiple of PAGESIZE, which depends on the target platform.
![]()  | 
The full POSIX implementation for this function was added in the QNX Neutrino Core OS 6.3.2.
 The calling process needs superuser capabilities to call mlock().  | 
The successful call to mlock() function ensures that the pages are memory-resident (i.e. the addresses always reside in physical memory). For more information, see “Locking memory” in the Process Manager chapter of the System Architecture guide.
| Safety: | |
|---|---|
| Cancellation point | No | 
| Interrupt handler | No | 
| Signal handler | Yes | 
| Thread | Yes | 
mlockall(), mmap(), munlock(), munlockall()
“Locking memory” in the Process Manager chapter of the System Architecture guide
![]()  | 
![]()  | 
![]()  | 
![]()  |