MLOCKALL(3) Library Functions Manual MLOCKALL(3)
mlockall, munlockall - lock (or unlock) address space
mlockall() locks all pages mapped by an address space in memory. The
value of flags determines whether the pages to be locked are simply
those currently mapped by the address space, those that will be mapped
in the future, or both. flags is built from the options defined in
#define MCL_CURRENT 0x1 /* lock current mappings */
#define MCL_FUTURE 0x2 /* lock future mappings */
If MCL_FUTURE is specified to mlockall() , then as mappings are added
to the address space (or existing mappings are replaced) they will also
be locked, provided sufficient memory is available.
Mappings locked via mlockall() with any option may be explicitly
unlocked with a munlock() call.
munlockall() removes address space locks and locks on mappings in the
All conditions and constraints on the use of locked memory as exist for
mlock() apply to mlockall() .
mlockall() and munlockall() return:
0 on success.
-1 on failure and set errno to indicate the error.
EAGAIN (mlockall() only.) Some or all of the memory in the
address space could not be locked due to sufficient
EINVAL flags contains values other than MCL_CURRENT and
EPERM The process's effective user ID is not super-user.
mctl(2), mlock(3), mmap(2)
21 January 1990 MLOCKALL(3)