OSDN Git Service

(split) Convert contrib and obsolete pages to UTF-8.
[linuxjm/LDP_man-pages.git] / obsolete / man2 / mlockall.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) Markus Kuhn, 1996
4 .\"
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
9 .\"
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
14 .\"
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 .\" GNU General Public License for more details.
19 .\"
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, write to the Free
22 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" USA.
24 .\"
25 .\" 1995-11-26  Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
26 .\"      First version written
27 .\"
28 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
29 .\"         all rights reserved.
30 .\" Translated Sun Feb 23 16:33:31 JST 1997
31 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
32 .\" Updated & Modified Fri May 21 03:32:57 JST 2004
33 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
34 .\"
35 .\"WORD:        lock                    ロック
36 .\"WORD:        process                 プロセス
37 .\"WORD:        paging                  ページング
38 .\"WORD:        code                    コード
39 .\"WORD:        data                    データ
40 .\"WORD:        stack                   スタック
41 .\"WORD:        segment                 セグメント
42 .\"WORD:        kernel                  カーネル
43 .\"WORD:        shared memory           共有メモリ
44 .\"WORD:        unlock                  アンロック
45 .\"WORD:        real-time               リアル・タイム
46 .\"WORD:        algorithm               アルゴリズム
47 .\"WORD:        security                セキュリティ
48 .\"WORD:        scheduling              スケジューリング
49 .\"WORD:        password                パスワード
50 .\"WORD:        secret key              秘密鍵
51 .\"WORD:        heap                    ヒープ(heap)
52 .\"WORD:        automatic variable      自動変数
53 .\"WORD:        copy-on-write           書き込み時コピー
54 .\"WORD:        flag                    フラグ
55 .\"WORD:        root                    スーパー・ユーザー
56 .\"
57 .TH MLOCKALL 2 1995-11-26 "Linux 1.3.43" "Linux Programmer's Manual"
58 .\"O .SH NAME
59 .SH 名前
60 .\"O mlockall \- disable paging for calling process
61 mlockall \- 呼び出したプロセスのページングを禁止する
62 .\"O .SH SYNOPSIS
63 .SH 書式
64 .nf
65 .B #include <sys/mman.h>
66 .sp
67 \fBint mlockall(int \fIflags\fB);
68 .fi
69 .\"O .SH DESCRIPTION
70 .SH 説明
71 .\"O .B mlockall
72 .\"O disables paging for all pages mapped into the address space of the
73 .\"O calling process. This includes the pages of the code, data and stack
74 .\"O segment, as well as shared libraries, user space kernel data, shared
75 .\"O memory and memory mapped files. All mapped pages are guaranteed to be
76 .\"O resident in RAM when the
77 .\"O .B mlockall
78 .\"O system call returns successfully and they are guaranteed to stay in RAM
79 .\"O until the pages are unlocked again by
80 .\"O .B munlock
81 .\"O or
82 .\"O .B munlockall
83 .\"O or until the process terminates or starts another program with
84 .\"O .BR exec .
85 .B mlockall
86 呼び出したプロセスのアドレス空間にマップされている全てのページの
87 ページング (paging) を禁止する。これにはコード、データ、スタックの
88 各セグメント、共有ライブラリ、カーネルのユーザー空間データ、
89 共有メモリ、メモリ・マップされたファイルを含んでいる。
90 .B mlockall
91 システム・コールが成功した場合には全てのマップされたページは RAM に
92 残り続けることを保証される、そして
93 .B munlock
94
95 .B munlockall
96 によってページがアンロックされたり、プロセスが終了したり、
97 .BR exec 
98 によって他のプログラムを開始したりするまでは RAM に残ることが
99 保証される。
100 .\"O Child processes do not inherit page locks across a
101 .\"O .BR fork .
102 .BR fork 
103 を行なった場合に子プロセスはページのロックを継承しない。
104
105 .\"O Memory locking has two main applications: real-time algorithms and
106 .\"O high-security data processing. Real-time applications require
107 .\"O deterministic timing, and, like scheduling, paging is one major cause
108 .\"O of unexpected program execution delays. Real-time applications will
109 .\"O usually also switch to a real-time scheduler with
110 .\"O .BR sched_setscheduler .
111 メモリのロックには主に二つの使い道がある。リアル・タイム (real-time)
112 アルゴリズムと高いセキュリティのデータ処理である。リアル・タイムの
113 アプリケーションは決定的なタイミングやスケジューリングを要求し、
114 ページングは予期しないプログラムの実行遅れをもたらす重要な要因である。
115 リアル・タイムのアプリケーションはたいていは
116 .BR sched_setscheduler 
117 でリアル・タイム・スケジュラーに変更される。
118 .\"O Cryptographic security software often handles critical bytes like
119 .\"O passwords or secret keys as data structures. As a result of paging,
120 .\"O these secrets could be transfered onto a persistent swap store medium,
121 .\"O where they might be accessible to the enemy long after the security
122 .\"O software has erased the secrets in RAM and terminated. For security
123 .\"O applications, only small parts of memory have to be locked, for which
124 .\"O .B mlock
125 .\"O is available.
126 暗号やセキュリティのソフトウェアはしばしばパスワードや秘密鍵のデータの
127 ような重要なバイトを扱う。ページングの結果、これらの秘密が
128 スワップ用の固定媒体に転送されるかもしれない。そしてそれはセキュリティ
129 ・ソフトウェアが RAM 上の秘密を削除して終了したずっと後にでも敵によって
130 アクセスが可能になるかもしれない。セキュリティ・アプリケーションでは
131 メモリのほんの小さな部分のみがロックされなければならない。そのために
132 .B mlock
133 が使用できる。
134
135 .\"O The 
136 .\"O .I flags
137 .\"O parameter can be constructed from the bitwise OR of the following
138 .\"O constants:
139 .I flags
140 パラメーターは以下の内容のビット OR からなる:
141 .TP 1.2i
142 .B MCL_CURRENT
143 .\"O Lock all pages which are currently mapped into the address space of
144 .\"O the process.
145 現在、プロセスのアドレス空間にマップされている全てのページをロックする。
146 .TP
147 .B MCL_FUTURE
148 .\"O Lock all pages which will become mapped into the address space of the
149 .\"O process in the future. These could be for instance new pages required
150 .\"O by a growing heap and stack as well as new memory mapped files or
151 .\"O shared memory regions.
152 将来、プロセスのアドレス空間にマップされる全てのページをロックする。
153 これは例えば、成長するヒープ (heap) やスタックの他に
154 新しいメモリ・マップされたファイルや共有メモリ領域などに必要となる。
155 .PP
156 .\"O If
157 .\"O .B MCL_FUTURE
158 .\"O has been specified and the number of locked pages exceeds the upper
159 .\"O limit of allowed locked pages, then the system call which caused the
160 .\"O new mapping will fail with
161 .\"O .BR ENOMEM .
162 .B MCL_FUTURE
163 が指定されており、ロックされたページの数がロックすることができるページ数の
164 上限を超えた場合には、新しくページをマップするシステム・コールは
165 .BR ENOMEM 
166 となって失敗する。
167 .\"O If these new pages have been mapped by the the growing stack, then the
168 .\"O kernel will deny stack expansion and send a 
169 .\"O .BR SIGSEGV .
170 成長するスタックによって新しいページがマップされる場合は、カーネルは
171 スタックの拡張を拒否し、
172 .BR SIGSEGV
173 を送る。
174
175 .\"O Real-time processes should reserve enough locked stack pages before
176 .\"O entering the time-critical section, so that no page fault can be
177 .\"O caused by function calls. This can be achieved by calling a function
178 .\"O which has a sufficiently large automatic variable and which writes to
179 .\"O the memory occupied by this large array in order to touch these stack
180 .\"O pages. This way, enough pages will be mapped for the stack and can be
181 .\"O locked into RAM. The dummy writes ensure that not even copy-on-write
182 .\"O page faults can occur in the critical section.
183 リアル・タイム・プロセスは関数呼び出しでページ・フォールトが発生しない
184 ように時間が致命的な部分に入る前に十分なロックされたスタックを確保して
185 おく必要がある。これは十分に大きな自動変数を確保する関数を呼び出し、
186 これらのスタック用のページがメモリに確保されるようにこの大きな配列に
187 書き込みを行なうことによって達成できる。この方法によって十分なページが
188 スタックにマップされ、RAM にロックされる。ダミーの書き込みは致命的な
189 部分で書き込み時コピー (copy-on-write) によるページ・フォールトさえ
190 起きないことを保証する。
191
192 .\"O Memory locks do not stack, i.e., pages which have been locked several times
193 .\"O by calls to
194 .\"O .B mlockall
195 .\"O or
196 .\"O .B mlock
197 .\"O will be unlocked by a single call to
198 .\"O .BR munlockall .
199 メモリのロック (lock) は累積しない。例えば複数回
200 .B mlock
201
202 .B mlockall
203 を呼び出してロックされたページも一回の
204 .BR munlockall
205 によってアンロック (unlock) される。
206 .\"O Pages which are mapped to several locations or by several processes stay
207 .\"O locked into RAM as long as they are locked at least at one location or by
208 .\"O at least one process.
209 複数の場所や複数のプロセスにマップされているページは、少なくとも一つの場所、
210 一つのプロセスでロックされている限りは RAM に残り続ける。
211 .\"O .SH "RETURN VALUE"
212 .SH 返り値
213 .\"O On success,
214 .\"O .B mlockall
215 .\"O returns zero.  On error, \-1 is returned, and
216 .\"O .I errno
217 .\"O is set appropriately.
218 成功した場合は、
219 .B mlockall
220 はゼロを返す。エラーの場合は、\-1 が返され、
221 .I errno
222 が適切に設定される。
223 .\"O .SH ERRORS
224 .SH エラー
225 .TP
226 .B ENOMEM
227 .\"O The process tried to exceed the maximum number of allowed locked
228 .\"O pages.
229 許される上限を超える数のページをロックしようとした。
230 .TP
231 .B EPERM
232 .\"O The calling process does not have appropriate privileges. Only root
233 .\"O processes are allowed to lock pages.
234 呼び出したプロセスが適切な特権を所有していない。
235 スーパー・ユーザーのプロセスのみがページをロックすることができる。
236 .TP
237 .B EINVAL
238 .\"O Unknown flags were specified.
239 未知のフラグが指定された。
240 .\"O .SH AVAILABILITY
241 .SH 有効性
242 .\"O On POSIX systems on which
243 .\"O .B mlockall
244 .\"O and
245 .\"O .B munlockall
246 .\"O are available,
247 .\"O .B _POSIX_MEMLOCK
248 .\"O is defined in <unistd.h> to a value greater than 0. (See also
249 .\"O .BR sysconf (3).)
250 .B mlockall
251
252 .B munlockall
253 が利用可能な POSIX システムでは、
254 <unistd.h> において
255 .B _POSIX_MEMLOCK
256 が 0 より大きい値に定義されている
257 .RB ( sysconf (3)
258 を参照すること)。
259 .\"O .\" POSIX 1003.1-2001: It shall be defined to -1 or 0 or 200112L.
260 .\"O .\" -1: unavailable, 0: ask using sysconf().
261 .\"O .\" glibc defines it to 1.
262 .\" POSIX 1003.1-2001 では、この値を -1, 0, 200112L の
263 .\" どれかに定義すべきとしている。
264 .\" -1 は使用不可、0 は sysconf() を使って尋ねるという意味である。
265 .\" glibc では、この値を 1 としている。
266 .\"O .SH "CONFORMING TO"
267 .SH 準拠
268 .\"O POSIX.1b, SVr4.   SVr4 documents an additional EAGAIN error code.
269 POSIX.1b, SVR4.  SVr4 には他に EAGAIN エラーについての記述がある。
270 .\"O .SH "SEE ALSO"
271 .SH 関連項目
272 .BR munlockall (2),
273 .BR mlock (2),
274 .BR munlock (2),
275 .BR sysconf (3)