memcntl.2 (2010 09)
m
memcntl(2) memcntl(2)
NAME
memcntl() - memory management control
SYNOPSIS
#include <sys/types.h>
#include <sys/mman.h>
int memcntl(
caddr_t addr,
size_t len,
int cmd,
caddr_t arg,
int attr ,
int mask
);
Parameters
addr A multiple of page size as returned by the
sysconf() routine where implemented; otherwise,
addr must contain the value NULL. Where used, control operations can be further defined
with the bit pattern contained in attr .
len Must be
0 for the MC_LOCKALL and MC_UNLOCKALL operations.
cmd The operation to be performed. See the Operations subsection in DESCRIPTION for a list of
the symbolic names used for the operations, as they are defined in
<sys/mman.h>.
arg A bit pattern built from the flags used to control the behavior of the operation, where imple-
mented; otherwise, arg must be
0.
attr The page attributes. If an operation is not to be controlled by these attributes, the attr argu-
ment must be
0.
mask Must be
0. Reserved for future use.
DESCRIPTION
The
memcntl() function enables the calling process to exercise various control operations over the
address space, which is identified by the mappings set for the address range (addr , addr +len ).
Selection Criteria
The scope of the control operations can be further specified with additional selection criteria (in the form
of attributes) according to the bits contained in the attr parameter.
To specify the selection criteria for page protection, use the following attributes:
PROT_READ Page is readable. When used, it provides mapped segments with read and execute per-
mission.
PROT_WRITE Page is writable. When used, it provides mapped segments with read, write and execute
permission.
PROT_EXEC Page is executable. When used, it provides mapped segments with read and execute per-
mission.
Additional criteria include the following:
PROC_TEXT Process Text. When used, it provides all privately mapped segments with read and exe-
cute permission. This criterion is applicable for Itanium(R)-based systems only.
PROC_DATA Process Data. When used, it provides all privately mapped segments with read and write
permissions.
The selection criteria are constructed by an OR of the attribute bits and must match exactly. The selec-
tion criteria can be used to describe many abstract memory objects with the address space on which to
operate.
Operations
The following are the symbolic names for operations as defined in <sys/mman.h>:
MC_LOCK Lock in memory all pages in the range with attributes defined by the attr parameter.
Although a specified page may be locked multiple times through different mappings,
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1