memcntl(2) System Calls Manual memcntl(2)
NAME
memcntl() - memory management control
SYNOPSIS
Parameters
addr A multiple of page size as returned by the 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 for the and operations.
cmd The operation to be performed. See the subsection in for a list of the symbolic names used for the operations, as they are
defined in
arg A bit pattern built from the flags used to control the behavior of the operation, where implemented; otherwise, arg must be
attr The page attributes. If an operation is not to be controlled by these attributes, the attr argument must be
mask Must be Reserved for future use.
DESCRIPTION
The 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:
Page is readable.
When used, it provides mapped segments with read and execute permission.
Page is writable.
When used, it provides mapped segments with read, write and execute permission.
Page is executable.
When used, it provides mapped segments with read and execute permission.
Additional criteria include the following:
Process Text. When used, it provides all privately mapped segments with read and execute permission. This criterion is applicable for
Itanium(R)-based systems only.
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 selection 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
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, page locks do not nest within a specified mapping.
A single unlock operation removes multiple lock operations that occur on a page with the same address in the same process. If a
page is locked in one process, but mapped in another, or visible through a different mapping in the locking process, the lock
remains in memory until the locking process completes an either implicit or explicit unlock operation.
Removing a locked mapping or deleting a page through file removal or truncation causes an implicit unlock operation. However, if a
writable page in the address range is changed, the lock is transferred to the private page.
The arg parameter is currently unused; however, it must be specified as (zero) for future compatibility.
Lock in memory all pages mapped by the address space
with attributes defined by attr. This operation is currently not supported.
Write all modified pages with the attributes defined by
attr to their backing storage, and if specified, invalidate the cache copies.
For modified pages that are mapped as shared the backing storage is the file to which the page is mapped. For modified pages that
are mapped as private the backing storage is its swap area.
The arg parameter is a bit pattern built from the following flags:
Performs asynchronous write operations
and returns once all write operations are scheduled.
Performs synchronous write operations
and returns after all write operations are complete.
Invalidates the mappings of cache copies in memory,
forcing all future references of the pages to be obtained from the backing storage location by the system. Use this operation for
applications that require a memory object to be in a known state.
Unlocks all pages in the range that have the attributes specified by
attr.
The arg parameter is unused, but it must be
Removes address space memory locks
and locks on all pages in the address space that have the attributes specified by the attr parameter. This operation is currently
not supported.
Notes
The address range specified by addr must be created by a successful call to The page mapping selection attributes and are currently not
supported.
RETURN VALUES
The function returns
Success.
Failure.
is set to indicate the error.
ERRORS
If fails, may be set to one of the following values.
There is not enough lockable memory in the system to satisfy
the locking request.
The addr parameter does not specify a multiple of the page size as returned by the routine.
The len parameter was specified as zero.
The address range specified by
addr and len was not created by a successful call to
Indicates that part or all of the addresses in the range
(addr, addr+len) are invalid as the address space of the process or pages not mapped are specified.
An invalid or unsupported
cmd parameter was specified.
The effective user ID of the process is not superuser and
or was specified.
AUTHOR
was developed by HP.
SEE ALSO
mlock(2), mlockall(2), mmap(2), mprotect(2), msync(2), plock(2), sysconf(2).
memcntl(2)