'\" te .\" Copyright 1989 AT&T. .\" Portions Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. .TH mlockall 3C "7 Apr 2015" "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. .sp .LP \fBmlockall()\fR and \fBmunlockall()\fR have no effect when applied to shared memory segments created by \fBshmget_osm\fR(2). To \fBlock\fR and \fBunlock\fR these segments, the \fBMC_LOCK_GRANULE\fR and \fBMC_UNLOCK_GRANULE\fR interfaces of \fBmemcntl()\fR should be used instead. .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 StabilityCommitted _ MT-LevelMT-Safe _ StandardSee \fBstandards\fR(5). .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), \fBshmget_osm\fR(2), \fBattributes\fR(5), \fBstandards\fR(5)