1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (C) 2001 Bert Hubert <ahu@ds9a.nl>
4 .\" and Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" Created Sun Jun 3 17:23:32 2001 by bert hubert <ahu@ds9a.nl>
27 .\" Slightly adapted, following comments by Hugh Dickins, aeb, 2001-06-04.
28 .\" Modified, 20 May 2003, Michael Kerrisk <mtk.manpages@gmail.com>
29 .\" Modified, 30 Apr 2004, Michael Kerrisk <mtk.manpages@gmail.com>
30 .\" 2005-04-05 mtk, Fixed error descriptions
31 .\" after message from <gordon.jin@intel.com>
32 .\" 2007-01-08 mtk, rewrote various parts
34 .TH MINCORE 2 2007-07-26 "Linux" "Linux Programmer's Manual"
36 mincore \- determine whether pages are resident in memory
38 .B #include <unistd.h>
40 .B #include <sys/mman.h>
42 .BI "int mincore(void *" start ", size_t " length ", unsigned char *" vec );
45 Feature Test Macro Requirements for glibc (see
46 .BR feature_test_macros (7)):
50 _BSD_SOURCE || _SVID_SOURCE
53 returns a vector that indicates whether pages
54 of the calling process's virtual memory are resident in core (RAM),
55 and so will not cause a disk access (page fault) if referenced.
56 The kernel returns residency information about the pages
57 starting at the address
65 argument must be a multiple of the system page size.
68 argument need not be a multiple of the page size,
69 but since residency information is returned for whole pages,
71 is effectively rounded up to the next multiple of the page size.
72 One may obtain the page size (PAGE_SIZE) using
73 .IR sysconf(_SC_PAGESIZE) .
77 argument must point to an array containing at least
78 (length+PAGE_SIZE-1) / PAGE_SIZE bytes.
80 the least significant bit of each byte will be set if
81 the corresponding page is currently resident in memory,
82 and be clear otherwise.
83 (The settings of the other bits in each byte are undefined;
84 these bits are reserved for possible later use.)
85 Of course the information returned in
87 is only a snapshot: pages that are not
88 locked in memory can come and go at any moment, and the contents of
90 may already be stale by the time this call returns.
95 On error, \-1 is returned, and
100 kernel is temporarily out of resources.
104 points to an invalid address.
108 is not a multiple of the page size.
113 .RI ( TASK_SIZE " \- " start ).
114 (This could occur if a negative value is specified for
116 since that value will be interpreted as a large
118 In Linux 2.6.11 and earlier, the error
120 was returned for this condition.
128 contained unmapped memory.
130 Available since Linux 2.3.99pre1 and glibc 2.2.
133 is not specified in POSIX.1-2001,
134 and it is not available on all Unix implementations.
135 .\" It is on at least NetBSD, FreeBSD, OpenBSD, Solaris 8,
136 .\" AIX 5.1, SunOS 4.1
140 .\" function first appeared in 4.4BSD.
142 Before kernel 2.6.21,
144 did not return correct information for
146 mappings, or for non-linear mappings (established using
147 .BR remap_file_pages (2)).
148 .\" Linux (up to now, 2.6.5),
150 .\" does not return correct information for MAP_PRIVATE mappings:
151 .\" for a MAP_PRIVATE file mapping,
153 .\" returns the residency of the file pages, rather than any
154 .\" modified process-private pages that have been copied on write;
155 .\" for a MAP_PRIVATE mapping of
158 .\" always reports pages as non-resident;
159 .\" and for a MAP_PRIVATE, MAP_ANONYMOUS mapping,
161 .\" always fails with the error