xref: /titanic_44/usr/src/man/man3c/mlockall.3c (revision 56b2bdd1f04d465cfe4a95b88ae5cba5884154e4)
te
Copyright 1989 AT&T. Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
MLOCKALL 3C "Mar 22, 2004"
NAME
mlockall, munlockall - lock or unlock address space
SYNOPSIS

#include <sys/mman.h>

int mlockall(int flags);

int munlockall(void);
DESCRIPTION

The mlockall() function locks in memory all pages mapped by an address space.

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

If MCL_FUTURE is specified for mlockall(), mappings are locked as they are added to the address space (or replace existing mappings), provided sufficient memory is available. Locking in this manner is not persistent across the exec family of functions (see exec(2)).

Mappings locked using mlockall() with any option may be explicitly unlocked with a munlock() call (see mlock(3C)).

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

All conditions and constraints on the use of locked memory that apply to mlock(3C) also apply to mlockall().

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

RETURN VALUES

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

ERRORS

The mlockall() and munlockall() functions will fail if: EAGAIN

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

EINVAL

The flags argument contains values other than MCL_CURRENT and MCL_FUTURE.

EPERM

The {PRIV_PROC_LOCK_MEMORY} privilege is not asserted in the effective set of the calling process.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Standard
MT-Level MT-Safe
SEE ALSO

exec(2), fork(2), memcntl(2), mmap(2), plock(3C), mlock(3C), sysconf(3C), attributes(5), standards(5)