1MINCORE(2)                 Linux Programmer's Manual                MINCORE(2)
2
3
4

NAME

6       mincore - determine whether pages are resident in memory
7

SYNOPSIS

9       #include <unistd.h>
10       #include <sys/mman.h>
11
12       int mincore(void *start, size_t length, unsigned char *vec);
13

DESCRIPTION

15       mincore()  returns a vector that indicates whether pages of the calling
16       process's virtual memory are resident in core (RAM), and  so  will  not
17       cause  a  disk  access  (page fault) if referenced.  The kernel returns
18       residency information about the pages starting at  the  address  start,
19       and continuing for length bytes.
20
21       The  start  argument  must  be a multiple of the system page size.  The
22       length argument need not be a multiple of the page size, but since res‐
23       idency  information  is returned for whole pages, length is effectively
24       rounded up to the next multiple of the page size.  One may  obtain  the
25       page size (PAGE_SIZE) using sysconf(_SC_PAGESIZE).
26
27       The   vec   argument  must  point  to  an  array  containing  at  least
28       (length+PAGE_SIZE-1) / PAGE_SIZE bytes.  On return, the least  signifi‐
29       cant  bit  of  each  byte will be set if the corresponding page is cur‐
30       rently resident in memory, and be clear otherwise.   (The  settings  of
31       the  other bits in each byte are undefined; these bits are reserved for
32       possible later use.)  Of course the information returned in vec is only
33       a  snapshot: pages that are not locked in memory can come and go at any
34       moment, and the contents of vec may already be stale by the  time  this
35       call returns.
36

RETURN VALUE

38       On  success,  mincore()  returns  zero.   On error, -1 is returned, and
39       errno is set appropriately.
40

ERRORS

42       EAGAIN kernel is temporarily out of resources.
43
44       EFAULT vec points to an invalid address.
45
46       EINVAL start is not a multiple of the page size.
47
48       ENOMEM len is greater than (TASK_SIZE - start).  (This could occur if a
49              negative  value  is  specified for len, since that value will be
50              interpreted as a large unsigned integer.)  In Linux  2.6.11  and
51              earlier, the error EINVAL was returned for this condition.
52
53       ENOMEM address to address + length contained unmapped memory.
54

BUGS

56       Before  kernel 2.6.21, mincore() did not return correct information for
57       MAP_PRIVATE mappings, or for  non-linear  mappings  (established  using
58       remap_file_pages(2)).
59

CONFORMING TO

61       mincore()  is not specified in POSIX.1-2001, and it is not available on
62       all Unix implementations.
63

HISTORY

65       The mincore() function first appeared in 4.4BSD.
66

AVAILABILITY

68       Since Linux 2.3.99pre1 and glibc 2.2.
69

SEE ALSO

71       mlock(2), mmap(2)
72
73
74
75Linux 2.6.5                       2007-01-08                        MINCORE(2)
Impressum