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 .\" Japanese Version Copyright (c) 2001-2005 Yuichi SATO
35 .\" all rights reserved.
36 .\" Translated Sun Jul 8 21:09:35 JST 2001
37 .\" by Yuichi SATO <ysato@h4.dion.ne.jp>
38 .\" Updated & Modified Sat Jul 26 13:54:03 JST 2003
39 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
40 .\" Updated & Modified Fri Dec 31 05:59:40 JST 2004 by Yuichi SATO
41 .\" Updated & Modified Fri Apr 22 02:35:03 JST 2005 by Yuichi SATO
42 .\" Updated 2007-05-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.44
44 .\"WORD: least significant bit ºÇ²¼°Ì¥Ó¥Ã¥È
46 .TH MINCORE 2 2008-04-22 "Linux" "Linux Programmer's Manual"
49 .\"O mincore \- determine whether pages are resident in memory
50 mincore \- ¥Ú¡¼¥¸¤¬¥á¥â¥êÆâ¤Ë¤¢¤ë¤«¤É¤¦¤«¤òȽÄꤹ¤ë
53 .B #include <unistd.h>
55 .B #include <sys/mman.h>
57 .BI "int mincore(void *" addr ", size_t " length ", unsigned char *" vec );
60 .\"O Feature Test Macro Requirements for glibc (see
61 .\"O .BR feature_test_macros (7)):
62 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
63 .RB ( feature_test_macros (7)
68 _BSD_SOURCE || _SVID_SOURCE
72 .\"O returns a vector that indicates whether pages
73 .\"O of the calling process's virtual memory are resident in core (RAM),
74 .\"O and so will not cause a disk access (page fault) if referenced.
75 .\"O The kernel returns residency information about the pages
76 .\"O starting at the address
78 .\"O and continuing for
82 ¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î²¾ÁÛ¥á¥â¥ê¤Î¥Ú¡¼¥¸¤¬¥³¥¢ (RAM) Æâ¤Ë¸ºß¤·¡¢
83 ¥Ú¡¼¥¸»²¾È»þ¤Ë¥Ç¥£¥¹¥¯¥¢¥¯¥»¥¹ (¥Ú¡¼¥¸¡¦¥Õ¥©¡¼¥ë¥È) ¤òµ¯¤³¤µ¤Ê¤¤¤«
84 ¤É¤¦¤«¤ò¼¨¤¹¥Ù¥¯¥È¥ë¤òÊÖ¤¹¡£¥«¡¼¥Í¥ë¤Ï¡¢¥¢¥É¥ì¥¹
88 ¥Ð¥¤¥È¤ÎÈϰϤΥڡ¼¥¸¤Ë´Ø¤¹¤ë¸ºß¾ðÊó¤òÊÖ¤¹¡£
92 .\"O argument must be a multiple of the system page size.
95 .\"O argument need not be a multiple of the page size,
96 .\"O but since residency information is returned for whole pages,
98 .\"O is effectively rounded up to the next multiple of the page size.
99 .\"O One may obtain the page size
100 .\"O .RB ( PAGE_SIZE )
102 .\"O .IR sysconf(_SC_PAGESIZE) .
104 °ú¤¿ô¤Ï¥·¥¹¥Æ¥à¤Î¥Ú¡¼¥¸¥µ¥¤¥º¤ÎÇÜ¿ô¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
106 °ú¤¿ô¤Ï¥Ú¡¼¥¸¥µ¥¤¥º¤ÎÇÜ¿ô¤Ç¤¢¤ëɬÍפϤʤ¤¤¬¡¢
107 ¥Ú¡¼¥¸Á´ÂΤ˴ؤ¹¤ë¸ºß¾ðÊó¤¬ÊÖ¤µ¤ì¤ë¤Î¤Ç¡¢»ö¼Â¾å
109 ¤Ï¥Ú¡¼¥¸¥µ¥¤¥º¤ÎÇÜ¿ô¤ËÀÚ¤ê¾å¤²¤é¤ì¤ë¤³¤È¤Ë¤Ê¤ë¡£
113 .I sysconf(_SC_PAGESIZE)
118 .\"O argument must point to an array containing at least
119 .\"O .I "(length+PAGE_SIZE\-1) / PAGE_SIZE"
122 .\"O the least significant bit of each byte will be set if
123 .\"O the corresponding page is currently resident in memory,
124 .\"O and be clear otherwise.
125 .\"O (The settings of the other bits in each byte are undefined;
126 .\"O these bits are reserved for possible later use.)
129 .I "(length+PAGE_SIZE\-1) / PAGE_SIZE"
130 ¥Ð¥¤¥È¤¬³ÊǼ¤Ç¤¤ëÇÛÎó¤ò»Ø¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
131 ¤³¤Î¸Æ¤Ó½Ð¤·¤¬ÊÖ¤ë¤È¤¡¢
132 ³Æ¥Ð¥¤¥È¤ÎºÇ²¼°Ì¥Ó¥Ã¥È¤Ï¡¢Âбþ¤¹¤ë¥Ú¡¼¥¸¤¬¥á¥â¥êÆâ¤Ë¤½¤Î¤È¤Â¸ºß¤¹¤ì¤Ð
133 ¥»¥Ã¥È¤µ¤ì¡¢¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤Ï¥¯¥ê¥¢¤µ¤ì¤ë
134 (³Æ¥Ð¥¤¥È¤Î¤½¤Î¾¤Î¥Ó¥Ã¥È¤Ï̤ÄêµÁ¤Ç¤¢¤ê¡¢¤³¤ì¤é¤Î¥Ó¥Ã¥È¤Ï¾Íè¤Î»ÈÍѤË
135 ¤½¤Ê¤¨¤ÆͽÌ󤵤ì¤Æ¤¤¤ë)¡£
136 .\"O Of course the information returned in
138 .\"O is only a snapshot: pages that are not
139 .\"O locked in memory can come and go at any moment, and the contents of
141 .\"O may already be stale by the time this call returns.
144 ¤ÇÊÖ¤µ¤ì¤¿¾ðÊó¤Ï¥¹¥Ê¥Ã¥×¥·¥ç¥Ã¥È¤Ç¤·¤«¤Ê¤¤¡£
145 ¥á¥â¥êÆâ¤Ë¥í¥Ã¥¯¤µ¤ì¤Æ¤¤¤Ê¤¤¥Ú¡¼¥¸¤Ï¡¢Ç¤°Õ¤Î»þÅÀ¤Ç¥á¥â¥êÆâ¤Ë
146 Æþ¤Ã¤¿¤ê½Ð¤¿¤ê¤Ç¤¡¢¤³¤Î¸Æ¤Ó½Ð¤·¤¬ÊÖ¤ë¤È¤¤Ë¤Ï
148 ¤ÎÆâÍƤϤ¹¤Ç¤Ë¸Å¤¯¤Ê¤Ã¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
149 .\"O .SH "RETURN VALUE"
157 .\"O On error, \-1 is returned, and
159 .\"O is set appropriately.
160 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¤Æ¡¢
162 ¤òŬÀÚ¤ÊÃͤËÀßÄꤹ¤ë¡£
166 .\"O kernel is temporarily out of resources.
167 ¥«¡¼¥Í¥ë¤¬°ì»þŪ¤Ë¥ê¥½¡¼¥¹¤ò»È¤¤²Ì¤¿¤·¤Æ¤¤¤ë¡£
171 .\"O points to an invalid address.
173 ¤¬Ìµ¸ú¤Ê¥¢¥É¥ì¥¹¤ò»Ø¤·¤Æ¤¤¤ë¡£
177 .\"O is not a multiple of the page size.
179 ¤¬¥Ú¡¼¥¸¥µ¥¤¥º¤ÎÇÜ¿ô¤Ç¤Ê¤¤¡£
184 .\"O .RI ( TASK_SIZE " \- " addr ).
187 .RI ( TASK_SIZE " \- " addr )
189 .\"O (This could occur if a negative value is specified for
191 .\"O since that value will be interpreted as a large
192 .\"O unsigned integer.)
194 ¤ËÉé¤ÎÃͤ¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢
195 ¤½¤ÎÃͤ¬Â礤ÊÉä¹æ¤Ê¤·À°¿ô¤È¤·¤Æ²ò¼á¤µ¤ì¤ë¤¿¤á¤Ëµ¯¤³¤ë¤³¤È¤¬¤¢¤ë¡£)
196 .\"O In Linux 2.6.11 and earlier, the error
198 .\"O was returned for this condition.
199 Linux 2.6.11 °ÊÁ°¤Ç¤Ï¡¢¤³¤Î¾ò·ï¤Î¾ì¹ç¤Ï¥¨¥é¡¼
209 .\"O contained unmapped memory.
215 ¤Î´Ö¤Ë¥Þ¥Ã¥×¤µ¤ì¤Æ¤¤¤Ê¤¤¥á¥â¥ê¤¬¤¢¤Ã¤¿¡£
217 .\"O Since Linux 2.3.99pre1 and glibc 2.2.
219 Linux 2.3.99pre1 ¤È glibc 2.2 ¤«¤éÍøÍѲÄǽ¤Ç¤¢¤ë¡£
220 .\"O .SH "CONFORMING TO"
223 .\"O is not specified in POSIX.1-2001,
224 .\"O and it is not available on all Unix implementations.
226 ¤Ï POSIX.1-2001 ¤Ëµ½Ò¤µ¤ì¤Æ¤ª¤é¤º¡¢
227 Á´¤Æ¤Î Unix ¼ÂÁõ¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£
228 .\" It is on at least NetBSD, FreeBSD, OpenBSD, Solaris 8,
229 .\" AIX 5.1, SunOS 4.1
233 .\"O .\" .BR mincore ()
234 .\"O .\" function first appeared in 4.4BSD.
236 .\" ´Ø¿ô¤Ï 4.4BSD ¤Ç½é¤á¤ÆÅо줷¤¿¡£
239 .\"O Before kernel 2.6.21,
241 .\"O did not return correct information for
243 .\"O mappings, or for nonlinear mappings (established using
244 .\"O .BR remap_file_pages (2)).
245 ¥«¡¼¥Í¥ë 2.6.21 ¤è¤êÁ°¤Ï¡¢
249 ¥Þ¥Ã¥Ô¥ó¥°¤äÈóÀþ·Á¥Þ¥Ã¥Ô¥ó¥°
250 .RB ( remap_file_pages (2)
251 ¤ò»È¤Ã¤ÆºîÀ®¤µ¤ì¤ë) ¤Ë¤Ä¤¤¤ÆÀµ¤·¤¤¾ðÊó¤òÊÖ¤µ¤Ê¤«¤Ã¤¿¡£
252 .\"O .\" Linux (up to now, 2.6.5),
254 .\"O .\" does not return correct information for MAP_PRIVATE mappings:
255 .\" Linux ¤Ç¤Ï (2.6.5 ¤Î¸½ºß¤Ë»ê¤ë¤Þ¤Ç)¡¢
257 .\" ¤Ï MAP_PRIVATE ¥Þ¥Ã¥Ô¥ó¥°¤Ë¤Ä¤¤¤Æ¤ÎÀµ¤·¤¤¾ðÊó¤òÊÖ¤µ¤Ê¤¤¡£
258 .\"O .\" for a MAP_PRIVATE file mapping,
260 .\"O .\" returns the residency of the file pages, rather than any
261 .\"O .\" modified process-private pages that have been copied on write;
262 .\" MAP_PRIVATE ¥Õ¥¡¥¤¥ë¥Þ¥Ã¥Ô¥ó¥°¤Ë¤Ä¤¤¤Æ¡¢
264 .\" ¤Ï½ñ¤¹þ¤ß»þ¥³¥Ô¡¼ (copy on write) ¤µ¤ì¤Æ¤¤¤Æ
265 .\" ½¤Àµ¤µ¤ì¤¿¥×¥í¥»¥¹¤Î¥×¥é¥¤¥Ù¡¼¥È¥Ú¡¼¥¸¤òÊÖ¤¹¤Î¤Ç¤Ï¤Ê¤¯¡¢
266 .\" ¥Õ¥¡¥¤¥ë¥Ú¡¼¥¸¤¬Â¸ºß¤¹¤ë¤«Èݤ«¤òÊÖ¤¹¡£
267 .\"O .\" for a MAP_PRIVATE mapping of
268 .\"O .\" .IR /dev/zero ,
270 .\"O .\" always reports pages as nonresident;
272 .\" ¤Î MAP_PRIVATE ¥Þ¥Ã¥Ô¥ó¥°¤Ë¤Ä¤¤¤Æ¡¢
274 .\" ¤Ï¾ï¤Ë¥Ú¡¼¥¸¤¬Â¸ºß¤·¤Ê¤¤¤È¤¤¤¦Åú¤¨¤òÊÖ¤¹¡£
275 .\"O .\" and for a MAP_PRIVATE, MAP_ANONYMOUS mapping,
277 .\"O .\" always fails with the error
278 .\"O .\" .BR ENOMEM .
279 .\" MAP_PRIVATE, MAP_ANONYMOUS ¥Þ¥Ã¥Ô¥ó¥°¤Ë¤Ä¤¤¤Æ¡¢