Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

_exit(2)

fork(2)

mlock(3)

munmap(3)

mlockall(3)  —  Subroutines

Digital

NAME

mlockall, munlockall − lock or unlock all of a specified process’s pages into memory (P1003.4/D10)

SYNOPSIS

#include <mlock.h>

int mlockall (
int flags) ; int munlockall () ;

PARAMETERS

flags The flags argument determines whether the pages to be locked are those currently mapped by the process’s address space, those that will be mapped in the future, or both. The flags argument is specified as one or more of the constants: MCL_CURRENT or MCL_FUTURE. 

DESCRIPTION

The mlockall function causes all of the pages mapped by the process’s address space to be locked into memory until unlocked by a call to the munlockall function, until the process exits, or until the process calls exec.  The constant, MCL_CURRENT, locks all of the pages currently mapped into the process’s address space. The constant, MCL_FUTURE, locks all of the pages that become mapped into the process’s address space in the future, when those mappings are established. You can specify MCL_CURRENT and then subsequently specify MCL_FUTURE to lock both current and future address space. 

The munlockall function unlocks all currently mapped pages of the process’s address space.  Any pages that become mapped into a process’s address space after a call to munlockall are not locked unless otherwise specified by a subsequent call to mlockall. 

A lock is not inherited across a fork or an exec. 

All memory locks are removed if an address range associated with the lock is unmapped. 

You must have superuser privileges to call the mlockall or munlockall functions. 

RETURN VALUES

On a successful call to the mlockall function, a value of 0 is returned and memory is locked.  On an unsuccessful call, a value of −1 is returned, no memory is locked and errno is set to indicate that an error occurred. 

The munlockall function returns a value of 0, if it is supported by the implementation. Otherwise, a value of −1 is returned and errno is set to indicate that an error occurred. 

ERRORS

The mlockall and munlockall functions fail under the following conditions:

[EAGAIN] Some or all of the memory identified by the operation could not be locked when the call was made. 

[EINVAL] The flags argument is invalid. 

[ENOMEM] The calling process has exceeded an implementation-defined limit on the amount of memory that the process may lock. 

[EPERM] The calling process does not have the appropriate privileges to perform the requested operation. 

[ENOSYS] P1003.4/D10 memory locking is not configured in this implementation.  Refer to the DEC OSF/1 Realtime Installation Guide for information on how to install the realtime software. 

RELATED INFORMATION

exec(2), _exit(2), fork(2), mlock(3), munmap(3)
 

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