'\" 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] .TH mlockall 3C "22 Mar 2004" "SunOS 5.11" "Standard C Library Functions" .SH NAME mlockall, munlockall \- lock or unlock address space .SH SYNOPSIS .LP .nf #include \fBint\fR \fBmlockall\fR(\fBint\fR \fIflags\fR); .fi .LP .nf \fBint\fR \fBmunlockall\fR(\fBvoid\fR); .fi .SH DESCRIPTION .sp .LP The \fBmlockall()\fR function locks in memory all pages mapped by an address space. .sp .LP The value of \fIflags\fR 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: .sp .in +2 .nf \fBMCL_CURRENT\fR Lock current mappings \fBMCL_FUTURE\fR Lock future mappings .fi .in -2 .sp .LP If \fBMCL_FUTURE\fR is specified for \fBmlockall()\fR, 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 \fBexec\fR family of functions (see \fBexec\fR(2)). .sp .LP Mappings locked using \fBmlockall()\fR with any option may be explicitly unlocked with a \fBmunlock()\fR call (see \fBmlock\fR(3C)). .sp .LP The \fBmunlockall()\fR function removes address space locks and locks on mappings in the address space. .sp .LP All conditions and constraints on the use of locked memory that apply to \fBmlock\fR(3C) also apply to \fBmlockall()\fR. .sp .LP Locks established with \fBmlockall()\fR are not inherited by a child process after a \fBfork\fR(2) call, and are not nested. .SH RETURN VALUES .sp .LP Upon successful completion, the \fBmlockall()\fR and \fBmunlockall()\fR functions return \fB0\fR. Otherwise, they return \fB\(mi1\fR and set \fBerrno\fR to indicate the error. .SH ERRORS .sp .LP The \fBmlockall()\fR and \fBmunlockall()\fR functions will fail if: .sp .ne 2 .mk .na \fB\fBEAGAIN\fR\fR .ad .RS 10n .rt Some or all of the memory in the address space could not be locked due to sufficient resources. This error condition applies to \fBmlockall()\fR only. .RE .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt The \fIflags\fR argument contains values other than \fBMCL_CURRENT\fR and \fBMCL_FUTURE\fR. .RE .sp .ne 2 .mk .na \fB\fBEPERM\fR\fR .ad .RS 10n .rt The {\fBPRIV_PROC_LOCK_MEMORY\fR} privilege is not asserted in the effective set of the calling process. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityStandard _ MT-LevelMT-Safe .TE .SH SEE ALSO .sp .LP \fBexec\fR(2), \fBfork\fR(2), \fBmemcntl\fR(2), \fBmmap\fR(2), \fBplock\fR(3C), \fBmlock\fR(3C), \fBsysconf\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)