mlock(3C) COMPATIBILITY FUNCTIONS mlock(3C)
NAME
mlock, munlock - lock (or unlock) pages in memory
SYNOPSIS
#include <sys/types.h>
int mlock(caddr_t addr, size_t len);
int munlock(caddr_t addr, size_t len);
DESCRIPTION
The function mlock uses the mappings established for the
address range [addr, addr + len) to identify pages to be
locked in memory. The effect of mlock(addr, len) is
equivalent to memcntl(addr, len, MC_LOCK, 0, 0, 0). munlock
removes locks established with mlock. The effect of
munlock(addr, len) is equivalent to memcntl(addr, len,
MC_UNLOCK, 0, 0, 0). Locks established with mlock are not
inherited by a child process after a fork and are not
nested.
SEE ALSO
fork(2), memcntl(2), mmap(2), mlockall(3C), plock(2),
sysconf(3C).
DIAGNOSTICS
Upon successful completion, the functions mlock and munlock
return 0; otherwise, they return -1 and set errno to indi-
cate the error.
NOTES
Use of mlock and munlock requires that the user have
appropriate privileges.
Last change: 1