OSDN Git Service

16fab208a3abac7968cc343631d983c377d4de3d
[linuxjm/LDP_man-pages.git] / release / man2 / mincore.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) 2001 Bert Hubert <ahu@ds9a.nl>
4 .\" and Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
5 .\"
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.
9 .\"
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.
14 .\"
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
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
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
33 .\"
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
43 .\"
44 .\"WORD:        least significant bit   最下位ビット
45 .\"
46 .TH MINCORE 2 2008-04-22 "Linux" "Linux Programmer's Manual"
47 .SH 名前
48 mincore \- ページがメモリ内にあるかどうかを判定する
49 .SH 書式
50 .B #include <unistd.h>
51 .br
52 .B #include <sys/mman.h>
53 .sp
54 .BI "int mincore(void *" addr ", size_t " length ", unsigned char *" vec );
55 .sp
56 .in -4n
57 glibc 向けの機能検査マクロの要件
58 .RB ( feature_test_macros (7)
59 参照):
60 .in
61 .sp
62 .BR mincore ():
63 _BSD_SOURCE || _SVID_SOURCE
64 .SH 説明
65 .BR mincore ()
66 は、呼び出し元プロセスの仮想メモリのページがコア (RAM) 内に存在し、
67 ページ参照時にディスクアクセス (ページ・フォールト) を起こさないか
68 どうかを示すベクトルを返す。カーネルは、アドレス
69 .I addr
70 から始まる
71 .I length
72 バイトの範囲のページに関する存在情報を返す。
73
74 .I addr
75 引き数はシステムのページサイズの倍数でなければならない。
76 .I length
77 引き数はページサイズの倍数である必要はないが、
78 ページ全体に関する存在情報が返されるので、事実上
79 .I length
80 はページサイズの倍数に切り上げられることになる。
81 ページサイズ
82 .RB ( PAGE_SIZE )
83
84 .I sysconf(_SC_PAGESIZE)
85 を使って入手できる。
86
87 .I vec
88 引き数は、少なくとも
89 .I "(length+PAGE_SIZE\-1) / PAGE_SIZE"
90 バイトが格納できる配列を指していなければならない。
91 この呼び出しが返るとき、
92 各バイトの最下位ビットは、対応するページがメモリ内にそのとき存在すれば
93 セットされ、そうでない場合はクリアされる
94 (各バイトのその他のビットは未定義であり、これらのビットは将来の使用に
95 そなえて予約されている)。
96 もちろん、
97 .I vec
98 で返された情報はスナップショットでしかない。
99 メモリ内にロックされていないページは、任意の時点でメモリ内に
100 入ったり出たりでき、この呼び出しが返るときには
101 .I vec
102 の内容はすでに古くなっているかもしれない。
103 .SH 返り値
104 成功した場合、
105 .BR mincore ()
106 は 0 を返す。
107 エラーの場合は \-1 を返して、
108 .I errno
109 を適切な値に設定する。
110 .SH エラー
111 .B EAGAIN
112 カーネルが一時的にリソースを使い果たしている。
113 .TP
114 .B EFAULT
115 .I vec
116 が無効なアドレスを指している。
117 .TP
118 .B EINVAL
119 .I addr
120 がページサイズの倍数でない。
121 .TP
122 .B ENOMEM
123 .I length
124
125 .RI ( TASK_SIZE " \- " addr )
126 より大きい。
127 .RI ( length
128 に負の値が指定された場合、
129 その値が大きな符号なし整数として解釈されるために起こることがある。)
130 Linux 2.6.11 以前では、この条件の場合はエラー
131 .B EINVAL
132 が返されていた。
133 .TP
134 .B ENOMEM
135 .I addr
136 から
137 .I addr
138 +
139 .I length
140 の間にマップされていないメモリがあった。
141 .SH バージョン
142 Linux 2.3.99pre1 と glibc 2.2 から利用可能である。
143 .SH 準拠
144 .BR mincore ()
145 は POSIX.1-2001 に記述されておらず、
146 全ての UNIX 実装で利用可能であるわけではない。
147 .\" It is on at least NetBSD, FreeBSD, OpenBSD, Solaris 8,
148 .\" AIX 5.1, SunOS 4.1
149 .\" .SH 歴史
150 .\" .BR mincore ()
151 .\" 関数は 4.4BSD で初めて登場した。
152 .SH バグ
153 カーネル 2.6.21 より前は、
154 .BR mincore ()
155 は、
156 .B MAP_PRIVATE
157 マッピングや非線形マッピング
158 .RB ( remap_file_pages (2)
159 を使って作成される) について正しい情報を返さなかった。
160 .\" Linux では (2.6.5 の現在に至るまで)、
161 .\" .B mincore
162 .\" は MAP_PRIVATE マッピングについての正しい情報を返さない。
163 .\" MAP_PRIVATE ファイルマッピングについて、
164 .\" .B mincore
165 .\" は書き込み時コピー (copy on write) されていて
166 .\" 修正されたプロセスのプライベートページを返すのではなく、
167 .\" ファイルページが存在するか否かを返す。
168 .\" .I /dev/zero
169 .\" の MAP_PRIVATE マッピングについて、
170 .\" .B mincore
171 .\" は常にページが存在しないという答えを返す。
172 .\" MAP_PRIVATE, MAP_ANONYMOUS マッピングについて、
173 .\" .B mincore
174 .\" は常に
175 .\" .B ENOMEM
176 .\" で失敗する。
177 .SH 関連項目
178 .BR mlock (2),
179 .BR mmap (2)