mincore.2 (2010 09)
m
mincore(2) mincore(2)
NAME
mincore() - determine residency of memory pages
SYNOPSIS
#include <sys/mman.h>
int mincore(void *addr, size_t len, unsigned char *vec);
DESCRIPTION
The mincore() function determines the residency of the memory pages specified by the range [addr ,
addr +len ]. The status is returned as a character-per-page in the character array referenced by vec . The
least significant bit of each character is set to 1 to indicate the referenced page is in memory and to 0 to
indicate that it is not. The settings of other bits in each character are undefined and may contain other
information about a page in future implementations.
This system call returns the status of all memory pages within the range, addr to addr+len . The addr
parameter is automatically rounded down to the nearest page size as returned by
sysconf(_SC_PAGE_SIZE)
system call. If the len value is not a multiple of the page size as returned
by the
sysconf(_SC_PAGE_SIZE)
system call, the end of the range is rounded up to the next multiple
of the page size.
The vector vec must be large enough to contain one byte per memory page within the address range.
Warnings
Because the status of a page can change between the time
mincore() checks and returns the informa-
tion, returned information might be outdated. Only locked pages are guaranteed to remain in memory.
See mlock (2).
RETURN VALUE
Upon successful completion,
mincore() returns 0. Otherwise, it returns −1 and sets errno to indicate
the error.
ERRORS
The
mincore() function will fail if:
[EFAULT] The vec argument points to an illegal address or an address for which the caller
does not have write mode access.
[EINVAL] len argument has a value less than or equal to 0.
[EINVAL] Addresses in the range [addr , addr +len ] span beyond the address space of a 64-bit
process.
[ENOMEM] Addresses in the range [addr , addr +len ] are invalid or not mapped for the address
space of a process.
SEE ALSO
mmap(2), mlock(2), plock(2), sysconf(2), <sys/mman.h>.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1