Copyright 1989 AT&T Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
#include <sys/types.h> int mincore(caddr_t addr, size_t len, char *vec);
The mincore() function 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, and to 0 to indicate that 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 between the time mincore() checks and returns the information, returned information might be outdated. Only locked pages are guaranteed to remain in memory; see mlock(3C).
Upon successful completion, mincore() returns 0. Otherwise, -1 is returned and errno is set to indicate the error.
The mincore() function will fail if: EFAULT
The vec argument points to an illegal address.
The addr argument is not a multiple of the page size as returned by sysconf(3C), or the len argument has a value less than or equal to 0.
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.
mmap(2), mlock(3C), sysconf(3C)