mlockall(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 effect of mlockall(flags) is equivalent to:
memcntl(0, 0, MCLOCKAS, flags, 0, 0)
The value of flags determines whether the pages to be locked are those
currently mapped by the address space, those that will be mapped at
some later point in time, or both:
MCLCURRENT Lock current mappings
MCLFUTURE Lock future mappings
The function munlockall() removes address space locks and locks on
mappings in the address space. The effect of munlockall() is
equivalent to:
memcntl(0, 0, MCUNLOCKAS, 0, 0, 0)
Locks established with mlockall() are not inherited by a child process
after a fork() and are not nested.
RESULT
Upon successful completion, the functions mlockall() and munlockall()
return 0; otherwise, they return -1 and set errno to indicate the
error.
NOTES
To be able to use mlock() and munlock(), the user must have appropri-
ate privileges.
SEE ALSO
fork(2), memcntl(2), mmap(2), plock(2), mlock(3C), sysconf(3C).
Page 1 Reliant UNIX 5.44 Printed 11/98