mlock(S)
mlock --
lock pages in memory
Synopsis
#include <sys/types.h>
#include <sys/mman.h>
int mlock(void *addr, size_t len);
int munlock(void *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.
Return values
Upon successful completion, the functions mlock and
munlock return 0; otherwise, they return -1
and set errno to indicate the error.
References
fork(S),
memcntl(S),
mlockall(S),
mmap(S),
plock(S),
sysconf(S)
Notices
Use of mlock and munlock requires that the user have
appropriate privileges.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005