mlockall(3C)
mlockall, munlockall - lock or unlock address space
As shipped in IRIX 6.5. First release of IRIX 6.5.
NAME mlockall, munlockall - lock or unlock address space SYNOPSIS #include <sys/mman.h> int mlockall(int flags); int munlockall(void); DESCRIPTION mlockall locks all pages mapped in the address space of the calling process into memory, including: text, data, stack and mmaped regions. Locked pages are immune to all routine swapping. The value of flags determines whether the pages to be locked are those currently mapped by the address space, those that will be mapped in the future, or both: MCL_CURRENT Lock current mappings MCL_FUTURE Lock future mappings munlockall unlocks all memory mapped pages in the address space of the calling process, regardless of the number of times the pages were locked. Automatic memory locking of future memory mappings is disabled for the process. Locks established with mlockall are not inherited by a child process after a fork. If the address space contains autogrow regions [see mmap(2)], mlockall will only cause the pages through the current end of file to be locked down. In the event automatic memory locking of future mappings is enabled for a process (MCL_FUTURE), and the locked memory of that process exceeds either the system's physical memory or the per process limit {PLOCK_MAX}, the process will receive a SIGSEGV with a signal code of ENOMEM [see sigaction(2) and signal(5)]. mlockall or munlockall will fail if one or more of the following are true: [EAGAIN] There was insufficient lockable memory to lock the entire address space. This may occur even though the amount requested was less than the system-imposed maximum number of locked pages. [EBUSY] munlockall will fail with this error if a region of the address space has some active I/O initiated by some other process belonging to same share group. [EINVAL] The flags argument is zero or contains invalid flags. [ENOMEM] The caller was not super-user and the number of pages to be locked exceeded the per process limit {PLOCK_MAX} [see intro(2)]. [ENOMEM] The total number of pages locked by the caller would exceed the maximum resident size for the process [see setrlimit(2)]. [ENOSPC] The address space of the calling process contains a memory- mapped file, and there is insufficient space on the device to allocate the entire file. SEE ALSO exec(2), exit(2), fork(2), mmap(2), mlock(3C), munlock(3C), mpin(2), munpin(2), plock(2), sigaction(2), sysconf(3C) DIAGNOSTICS Upon successful completion, the functions mlockall and munlockall return 0, otherwise, they return -1 and set errno to indicate the error. WARNING The mlockall/munlockall pair and the plock function provide similar functionality. Developers should choose the set that best suites their application and stick with it, as mixing the interfaces may result in unexpected behavior.