mincore(2)
NAME
mincore − determine residency of memory pages
SYNOPSIS
#include <sys/types.h>
int mincore(caddr_t addr, size_t len, char ∗vec);
DESCRIPTION
mincore() determines the residency of the memory pages in the address space covered by mappings in the range [addr, addr + len]. The status is returned as a character-per-page in the character array referenced by ∗vec (which the system assumes to be large enough to encompass all the pages in the address range). The least significant bit of each character is set to 1 to indicate that the referenced page is in primary memory, 0 if it is not. The settings of other bits in each character are undefined and may contain other information in future implementations.
Because the status of a page can change after mincore() checks it, but before mincore() returns the information, returned information might be outdated. Only locked pages are guaranteed to remain in memory; see mlock(3C).
RETURN VALUES
mincore() returns 0 on success, −1 on failure and sets errno to indicate the error.
ERRORS
mincore() fails if:
EFAULT vec points to an illegal address.
EINVAL addr is not a multiple of the page size as returned by sysconf(3C).
EINVAL The argument len has a value less than or equal to 0.
ENOMEM Addresses in the range [addr, addr + len] are invalid for the address space of a process, or specify one or more pages which are not mapped.
SEE ALSO
mmap(2), mlock(3C), sysconf(3C)
SunOS 5.4 — Last change: 12 Aug 1990