MEMLCK(2) — HP-UX
Series 500 Only
NAME
memlck, memulck − lock/unlock process address space or segment
SYNOPSIS
#include <sys/ems.h>
#include <sys/types.h>
intmemlck (addr, len, adrtype);
caddr_taddr;
intlen;
enummemtype {mem_code, mem_data} adrtype;
intmemulck (addr, len, adrtype);
caddr_taddr;
intlen;
enummemtype {mem_code, mem_data} adrtype;
DESCRIPTION
Memlck is used to lock a section of process address space into physical memory. This call may take a substantial amount of time to complete, but the address space in question is guaranteed to be in memory and locked upon successful completion of the call. The locked address space will not migrate to backing store regardless of process state and will, furthermore, remain at the same physical address space for the duration of the lock. Locks are not inherited across fork(2). Multiple locks on any address range can occur (unlocking requires that as many unlocks as locks occur). The locks will be segment local, and unlocking may be done by a process unrelated to the one which did the locking. A locked segment will be released when there are no processes with references to the locked segment. (This may occur either via memfree on memallc(2) or process death.)
Addr is the starting address of the area in question and len is the length in bytes. Addr may be any legal address in the process’s address space. Since some implementations use different (and indistinguishable) addressing formats for code and data space, adrtype is used to indicate whether addr is a code or data address. On systems with a uniform addressing format for code and data, adrtype will have no effect.
The boundaries of the locked address space may be rounded up (on the upper end of the address range) and down (on the lower end of the address range) to appropriate system dependent values (e.g. pages, segments, blocks, etc). Locking will not cross segment boundaries. For example, one memlck call cannot lock part of a text segment and part of a data segment.
Memulck undoes the effects of a memlck.
The use of this call is restricted to the super-user.
This call may be reduced to a no-op.
RETURN VALUE
Upon successful completion, memlck and memulck return a value of 0. Otherwise, a value of -1 is returned and errno is set to indicate the error.
AUTHOR
Memlck was developed by HP.
SEE ALSO
ems(2), memallc(2), plock(2), shmctl(2).
Hewlett-Packard Company — Version B.1, April 12, 1993