Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fork(2)

memcntl(3)

mmap(2)

plock(2)

mlock(3C)

sysconf(3C)

mlockall(3C)

NAME

mlockall, munlockall − lock or unlock address space

SYNOPSIS

#include <sys/mman.h>

int mlockall(int flags);

int munlockall(void);

DESCRIPTION

The function mlockall() causes all pages mapped by an address space to be locked in memory. 

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_CURRENTLock current mappings
MCL_FUTURELock 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. 

The function munlockall() removes address space locks and locks on mappings in the address space. 

All conditions and constraints on the use of locked memory as exist for mlock() apply to mlockall(). 

Locks established with mlockall() are not inherited by a child process after a fork() and are not nested. 

RETURN VALUES

Upon successful completion, the functions mlockall() and munlockall() return 0; otherwise, they return −1 and set errno to indicate the error. 

ERRORS

EAGAIN mlockall() only.  Some or all of the memory in the address space could not be locked due to sufficient resources. 

EINVAL flags contains values other than MCL_CURRENT and MCL_FUTURE. 

EPERM The process’s effective user ID is not super-user. 

SEE ALSO

fork(2), memcntl(3), mmap(2), plock(2), mlock(3C), sysconf(3C)

NOTES

mlockall() and munlockall() require super-user privileges. 

SunOS 5.1/SPARC  —  Last change: 12 Aug 1990

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026