[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

mincore Subroutine

Purpose

Determines residency of memory pages.

Library

Standard C Library (libc.a).

Syntax


int mincore ( addr len, * vec)
caddr_t addr;
size_t len;
char *vec;

Description

The mincore subroutine returns the primary-memory residency status for regions created from calls made to the mmap (mmap or mmap64 Subroutine) subroutine. The status is returned as a character for each memory page in the range specified by the addr and len parameters. The least significant bit of each character returned is set to 1 if the referenced page is in primary memory. Otherwise, the bit is set to 0. The settings of the other bits in each character are undefined.

Parameters

addr Specifies the starting address of the memory pages whose residency is to be determined. Must be a multiple of the page size returned by the sysconf subroutine using the _SC_PAGE_SIZE value for the Name parameter.
len Specifies the length, in bytes, of the memory region whose residency is to be determined. If the len value is not a multiple of the page size as returned by the sysconf subroutine using the _SC_PAGE_SIZE value for the Name parameter, the length of the region is rounded up to the next multiple of the page size.
vec Specifies the character array where the residency status is returned. The system assumes that the character array specified by the vec parameter is large enough to encompass a returned character for each page specified.

Return Values

When successful, the mincore subroutine returns 0. Otherwise, it returns -1 and sets the errno global variable to indicate the error.

Error Codes

If the mincore subroutine is unsuccessful, the errno global variable is set to one of the following values:

EFAULT A part of the buffer pointed to by the vec parameter is out of range or otherwise inaccessible.
EINVAL The addr parameter is not a multiple of the page size as returned by the sysconf subroutine using the _SC_PAGE_SIZE value for the Name parameter.
ENOMEM Addresses in the (addr, addr + len) range are invalid for the address space of the process, or specify one or more pages that are not mapped.

Related Information

The mmap (mmap or mmap64 Subroutine) subroutine, sysconf subroutine.

List of Memory Manipulation Services in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]