memcntl.2 (2010 09)
m
memcntl(2) memcntl(2)
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
MAP_PRIVATE 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
0 (zero) for
future compatibility.
MC_LOCKAS Lock in memory all pages mapped by the address space with attributes defined by
attr . This operation is currently not supported.
MC_SYNC 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 (
MAP_SHARED), the backing storage
is the file to which the page is mapped. For modified pages that are mapped as
private (
MAP_PRIVATE), the backing storage is its swap area.
The arg parameter is a bit pattern built from the following flags:
MS_ASYNC Performs asynchronous write operations and returns once all write operations are
scheduled.
MS_SYNC Performs synchronous write operations and returns after all write operations are
complete.
MS_INVALIDATE 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.
MC_UNLOCK Unlocks all pages in the range that have the attributes specified by attr .
The arg parameter is unused, but it must be
0.
MC_UNLOCKAS 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
mmap(). The page mapping
selection attributes
SHARED and PRIVATE are currently not supported.
RETURN VALUES
The
memcntl function returns
0 Success.
-1 Failure. errno is set to indicate the error.
ERRORS
If
memcntl() fails, errno may be set to one of the following values.
[EAGAIN] There is not enough lockable memory in the system to satisfy the locking request.
[EINVAL] The addr parameter does not specify a multiple of the page size as returned by the
sys-
conf() routine.
[EINVAL] The len parameter was specified as zero.
[EINVAL] The address range specified by addr and len was not created by a successful call to
mmap().
[ENOMEM] 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.
[ENOSYS] An invalid or unsupported cmd parameter was specified.
2 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: September 2010