OSDN Git Service

(split) LDP: Translation snapshots for ja.po.
[linuxjm/LDP_man-pages.git] / draft / man2 / getrlimit.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 1992 Drew Eckhardt, March 28, 1992
4 .\" and Copyright (c) 2002, 2004, 2005, 2008 Michael Kerrisk
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 .\" Modified by Michael Haardt <michael@moria.de>
27 .\" Modified 1993-07-23 by Rik Faith <faith@cs.unc.edu>
28 .\" Modified 1996-01-13 by Arnt Gulbrandsen <agulbra@troll.no>
29 .\" Modified 1996-01-22 by aeb, following a remark by
30 .\"          Tigran Aivazian <tigran@sco.com>
31 .\" Modified 1996-04-14 by aeb, following a remark by
32 .\"          Robert Bihlmeyer <robbe@orcus.ping.at>
33 .\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
34 .\" Modified 2001-05-04 by aeb, following a remark by
35 .\"          Havard Lygre <hklygre@online.no>
36 .\" Modified 2001-04-17 by Michael Kerrisk <mtk.manpages@gmail.com>
37 .\" Modified 2002-06-13 by Michael Kerrisk <mtk.manpages@gmail.com>
38 .\"     Added note on nonstandard behavior when SIGCHLD is ignored.
39 .\" Modified 2002-07-09 by Michael Kerrisk <mtk.manpages@gmail.com>
40 .\"     Enhanced descriptions of 'resource' values for [gs]etrlimit()
41 .\" Modified 2003-11-28 by aeb, added RLIMIT_CORE
42 .\" Modified 2004-03-26 by aeb, added RLIMIT_AS
43 .\" Modified 2004-06-16 by Michael Kerrisk <mtk.manpages@gmail.com>
44 .\"     Added notes on CAP_SYS_RESOURCE
45 .\"
46 .\" 2004-11-16 -- mtk: the getrlimit.2 page, which formally included
47 .\" coverage of getrusage(2), has been split, so that the latter
48 .\" is now covered in its own getrusage.2.
49 .\"
50 .\" Modified 2004-11-16, mtk: A few other minor changes
51 .\" Modified 2004-11-23, mtk
52 .\"     Added notes on RLIMIT_MEMLOCK, RLIMIT_NPROC, and RLIMIT_RSS
53 .\"             to "CONFORMING TO"
54 .\" Modified 2004-11-25, mtk
55 .\"     Rewrote discussion on RLIMIT_MEMLOCK to incorporate kernel
56 .\"             2.6.9 changes.
57 .\"     Added note on RLIMIT_CPU error in older kernels
58 .\" 2004-11-03, mtk, Added RLIMIT_SIGPENDING
59 .\" 2005-07-13, mtk, documented RLIMIT_MSGQUEUE limit.
60 .\" 2005-07-28, mtk, Added descriptions of RLIMIT_NICE and RLIMIT_RTPRIO
61 .\" 2008-05-07, mtk / Peter Zijlstra, Added description of RLIMIT_RTTIME
62 .\"
63 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
64 .\"         all rights reserved.
65 .\" Translated 1997-02-22, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
66 .\" Updated and Modified 2001-06-02, Yuichi SATO <ysato444@yahoo.co.jp>
67 .\" Updated and Modified 2001-08-18, Yuichi SATO
68 .\" Updated and Modified 2002-08-25, Yuichi SATO
69 .\" Updated and Modified 2004-01-17, Yuichi SATO
70 .\" Updated and Modified 2004-12-30, Yuichi SATO
71 .\" Updated and Modified 2005-09-10, Yuichi SATO
72 .\" Updated and Modified 2005-10-11, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
73 .\" Updated and Modified 2005-10-27, Akihiro MOTOKI
74 .\" Updated and Modified 2006-04-15, Akihiro MOTOKI, Catch up to LDP v2.29
75 .\" Updated 2008-08-08, Akihiro MOTOKI, LDP v3.05
76 .\" Updated 2008-10-13, Akihiro MOTOKI, LDP v3.11
77 .\"
78 .\"WORD:        resource                資源
79 .\"WORD:        limit                   制限
80 .\"
81 .TH GETRLIMIT 2 2010-09-26 "Linux" "Linux Programmer's Manual"
82 .\"O .SH NAME
83 .SH 名前
84 .\"O getrlimit, setrlimit \- get/set resource limits
85 getrlimit, setrlimit \- 資源の制限を取得/設定する
86 .\"O .SH SYNOPSIS
87 .SH 書式
88 .B #include <sys/time.h>
89 .br
90 .B #include <sys/resource.h>
91 .sp
92 .BI "int getrlimit(int " resource ", struct rlimit *" rlim );
93 .br
94 .BI "int setrlimit(int " resource ", const struct rlimit *" rlim );
95 .\"O .SH DESCRIPTION
96 .SH 説明
97 .\"O .BR getrlimit ()
98 .\"O and
99 .\"O .BR setrlimit ()
100 .\"O get and set resource limits respectively.
101 .BR getrlimit ()
102
103 .BR setrlimit ()
104 はそれぞれ資源 (resource) の制限 (limit) の設定と取得を行う。
105 .\"O Each resource has an associated soft and hard limit, as defined by the
106 .\"O .I rlimit
107 .\"O structure (the
108 .\"O .I rlim
109 .\"O argument to both
110 .\"O .BR getrlimit ()
111 .\"O and
112 .\"O .BR setrlimit ()):
113 各リソースには、それに対応するソフト・リミットとハード・リミットがある。
114 リミットは
115 .RB ( getrlimit ()
116
117 .BR setrlimit ()
118
119 .I rlim
120 引き数である)
121 .I rlimit
122 構造体で定義される:
123 .PP
124 .in +4n
125 .nf
126 struct rlimit {
127 .\"O     rlim_t rlim_cur;  /* Soft limit */
128 .\"O     rlim_t rlim_max;  /* Hard limit (ceiling for rlim_cur) */
129     rlim_t rlim_cur;  /* ソフト・リミット */
130     rlim_t rlim_max;  /* ハード・リミット
131                          (rlim_cur より小さくない) */
132 };
133
134 .fi
135 .in
136 .\"O The soft limit is the value that the kernel enforces for the
137 .\"O corresponding resource.
138 ソフト・リミットは、カーネルが対応するリソースに対して課す制限値である。
139 .\"O The hard limit acts as a ceiling for the soft limit:
140 ハード・リミットはソフト・リミットの上限として働く。
141 .\"O an unprivileged process may only set its soft limit to a value in the
142 .\"O range from 0 up to the hard limit, and (irreversibly) lower its hard limit.
143 特権を持たないプロセスは、ソフト・リミットの値を
144 0 からハード・リミットの範囲に設定することと、
145 ハード・リミットを下げることのみができる
146 (一度下げたハードリミットは上げられない)。
147 .\"O A privileged process (under Linux: one with the
148 .\"O .B CAP_SYS_RESOURCE
149 .\"O capability) may make arbitrary changes to either limit value.
150 特権プロセス (Linux では
151 .B CAP_SYS_RESOURCE
152 ケーパビリティ (capability) を持つプロセス) は
153 ソフト・リミットとハード・リミットを自由に変更できる。
154 .PP
155 .\"O The value
156 .\"O .B RLIM_INFINITY
157 .\"O denotes no limit on a resource (both in the structure returned by
158 .\"O .BR getrlimit ()
159 .\"O and in the structure passed to
160 .\"O .BR setrlimit ()).
161
162 .B RLIM_INFINITY
163 はリソースに制限がないことを表す
164 (この値は
165 .BR getrlimit ()
166 が返す構造体と
167 .BR setrlimit ()
168 に渡す構造体の両方で使用される)。
169 .PP
170 .\"O .I resource
171 .\"O must be one of:
172 .I resource
173 は次のいずれか 1 つである。
174 .TP
175 .B RLIMIT_AS
176 .\"O The maximum size of the process's virtual memory (address space) in bytes.
177 プロセスの仮想メモリ (アドレス空間) の最大サイズ (バイト単位)。
178 .\"O .\" since 2.0.27 / 2.1.12
179 .\" 2.0.27 / 2.1.12 以降。
180 .\"O This limit affects calls to
181 .\"O .BR brk (2),
182 .\"O .BR mmap (2)
183 .\"O and
184 .\"O .BR mremap (2),
185 .\"O which fail with the error
186 .\"O .B ENOMEM
187 .\"O upon exceeding this limit.
188 .\"O Also automatic stack expansion will fail
189 .\"O (and generate a
190 .\"O .B SIGSEGV
191 .\"O that kills the process if no alternate stack
192 .\"O has been made available via
193 .\"O .BR sigaltstack (2)).
194 この制限は
195 .BR brk (2),
196 .BR mmap (2),
197 .BR mremap (2)
198 の呼び出しに影響し、この制限を超えた場合は
199 エラー
200 .B ENOMEM
201 で失敗する。
202 また自動的なスタック拡張にも失敗する
203 (さらに
204 .BR sigaltstack (2)
205 を使った代替スタックを利用可能にしていなかった場合には、
206 .B SIGSEGV
207 を生成してそのプロセスを kill する)。
208 .\"O Since the value is a \fIlong\fP, on machines with a 32-bit \fIlong\fP
209 .\"O either this limit is at most 2 GiB, or this resource is unlimited.
210 この値は \fIlong\fP 型なので、32 ビットの \fIlong\fP 型を持つマシンでは、
211 この制限は最大で 2 GiB になるか、この資源が無制限になる。
212 .TP
213 .B RLIMIT_CORE
214 .\"O Maximum size of
215 .\"O .I core
216 .\"O file.
217 .\"O When 0 no core dump files are created.
218 .I core
219 ファイルの最大サイズ。
220 0 の場合、core ファイルは生成されない。
221 .\"O When nonzero, larger dumps are truncated to this size.
222 0 以外の場合、このサイズより大きいダンプは切り詰められる。
223 .TP
224 .B RLIMIT_CPU
225 .\"O CPU time limit in seconds.
226 CPU 時間の上限 (秒数)。
227 .\"O When the process reaches the soft limit, it is sent a
228 .\"O .B SIGXCPU
229 .\"O signal.
230 プロセスがソフト・リミットに達した場合に、
231 .B SIGXCPU
232 シグナルを送る。
233 .\"O The default action for this signal is to terminate the process.
234 このシグナルに対するデフォルトの動作は、プロセスの終了である。
235 .\"O However, the signal can be caught, and the handler can return control to
236 .\"O the main program.
237 ただしシグナルをキャッチして、ハンドラがメインプログラムに
238 制御を返すこともできる。
239 .\"O If the process continues to consume CPU time, it will be sent
240 .\"O .B SIGXCPU
241 .\"O once per second until the hard limit is reached, at which time
242 .\"O it is sent
243 .\"O .BR SIGKILL .
244 プロセスが CPU 時間を使い続けた場合は、
245 ハードリミットに達するまで 1 秒毎にプロセスに
246 .B SIGXCPU
247 を送り、
248 ハードリミットに達すると
249 .B SIGKILL
250 を送る。
251 .\"O (This latter point describes Linux 2.2 through 2.6 behavior.
252 ソフト・リミットを超過したときの動作は、
253 Linux 2.2 から 2.6 のものである。
254 .\"O Implementations vary in how they treat processes which continue to
255 .\"O consume CPU time after reaching the soft limit.
256 ソフト・リミットを超えて CPU 時間を使い続けるプロセスの
257 扱い方についての実装は変化してきている。
258 .\"O Portable applications that need to catch this signal should
259 .\"O perform an orderly termination upon first receipt of
260 .\"O .BR SIGXCPU .)
261 このシグナルをキャッチする必要のある
262 移植性を考えたアプリケーションでは、
263 最初に
264 .B SIGXCPU
265 を受け取った時点で正しく終了すべきである。
266 .TP
267 .B RLIMIT_DATA
268 .\"O The maximum size of the process's data segment (initialized data,
269 .\"O uninitialized data, and heap).
270 プロセスのデータセグメント
271 (初期化されたデータ・初期化されていないデータ・ヒープ) の最大値。
272 .\"O This limit affects calls to
273 .\"O .BR brk (2)
274 .\"O and
275 .\"O .BR sbrk (2),
276 .\"O which fail with the error
277 .\"O .B ENOMEM
278 .\"O upon encountering the soft limit of this resource.
279 このリミットは
280 .BR brk (2)
281
282 .BR sbrk (2)
283 の呼び出しに影響する。
284 これらの関数は、このリソースのソフト・リミットに達すると、
285 エラー
286 .B ENOMEM
287 で失敗する。
288 .TP
289 .B RLIMIT_FSIZE
290 .\"O The maximum size of files that the process may create.
291 プロセスが作成できるファイルサイズの最大値。
292 .\"O Attempts to extend a file beyond this limit result in delivery of a
293 .\"O .B SIGXFSZ
294 .\"O signal.
295 このサイズを超えてファイルを拡張すると、
296 .B SIGXFSZ
297 シグナルを送る。
298 .\"O By default, this signal terminates a process, but a process can
299 .\"O catch this signal instead, in which case the relevant system call (e.g.,
300 .\"O .BR write (2),
301 .\"O .BR truncate (2))
302 .\"O fails with the error
303 .\"O .BR EFBIG .
304 デフォルトでは、このシグナルはプロセスを終了する。
305 プロセスをキャッチすることもできるが、
306 関連するシステムコール
307 .RB ( write (2),
308 .BR truncate (2)
309 など) はエラー
310 .B EFBIG
311 で失敗する。
312 .TP
313 .\"O .BR RLIMIT_LOCKS " (Early Linux 2.4 only)"
314 .BR RLIMIT_LOCKS " (初期の Linux 2.4 のみ)"
315 .\"O .\" to be precise: Linux 2.4.0-test9; no longer in 2.4.25 / 2.5.65
316 .\" 正確には Linux 2.4.0-test9 のみ。2.4.25 / 2.5.65 ではなくなっている。
317 .\"O A limit on the combined number of
318 .\"O .BR flock (2)
319 .\"O locks and
320 .\"O .BR fcntl (2)
321 .\"O leases that this process may establish.
322 このプロセスが実行できる
323 .BR flock (2)
324 ロック数と
325 .BR fcntl (2)
326 リース数の合計値を制限する。
327 .TP
328 .B RLIMIT_MEMLOCK
329 .\"O The maximum number of bytes of memory that may be locked
330 .\"O into RAM.
331 RAM 内にロックできるメモリの最大バイト数。
332 .\"O In effect this limit is rounded down to the nearest multiple
333 .\"O of the system page size.
334 実際には、この制限はシステムページサイズの最も近い倍数に
335 切り捨てて丸められる。
336 .\"O This limit affects
337 .\"O .BR mlock (2)
338 .\"O and
339 .\"O .BR mlockall (2)
340 .\"O and the
341 .\"O .BR mmap (2)
342 .\"O .B MAP_LOCKED
343 .\"O operation.
344 この制限は
345 .BR mlock (2),
346 .BR mlockall (2),
347 .BR mmap (2)
348
349 .B MAP_LOCKED
350 操作に影響する。
351 .\"O Since Linux 2.6.9 it also affects the
352 .\"O .BR shmctl (2)
353 .\"O .B SHM_LOCK
354 .\"O operation, where it sets a maximum on the total bytes in
355 .\"O shared memory segments (see
356 .\"O .BR shmget (2))
357 .\"O that may be locked by the real user ID of the calling process.
358 Linux 2.6.9 以降では
359 .BR shmctl (2)
360 .B SHM_LOCK
361 操作にも影響する。
362 この操作は呼び出し元プロセスの実 (real) ユーザー ID にロックされる
363 共有メモリセグメント
364 .RB ( shmget (2)
365 を参照) の合計バイト数の最大値を設定する。
366 .\"O The
367 .\"O .BR shmctl (2)
368 .\"O .B SHM_LOCK
369 .\"O locks are accounted for separately from the per-process memory
370 .\"O locks established by
371 .\"O .BR mlock (2),
372 .\"O .BR mlockall (2),
373 .\"O and
374 .\"O .BR mmap (2)
375 .\"O .BR MAP_LOCKED ;
376 .\"O a process can lock bytes up to this limit in each of these
377 .\"O two categories.
378 .BR shmctl (2)
379 .B SHM_LOCK
380 によるロックは、
381 .BR mlock (2),
382 .BR mlockall (2),
383 .BR mmap (2)
384
385 .B MAP_LOCKED
386 によって確立されるプロセス毎のメモリロックとは分けて数える。
387 1 つのプロセスはこの制限までのバイトをロックできる。
388 この制限には 2 つの種類がある。
389 .\"O In Linux kernels before 2.6.9, this limit controlled the amount of
390 .\"O memory that could be locked by a privileged process.
391 2.6.9 より前の Linux カーネル では、
392 この制限は特権プロセスによってロックされるメモリの合計を制御していた。
393 .\"O Since Linux 2.6.9, no limits are placed on the amount of memory
394 .\"O that a privileged process may lock, and this limit instead governs
395 .\"O the amount of memory that an unprivileged process may lock.
396 Linux 2.6.9 以降では、特権プロセスがロックするメモリの合計に制限はなく、
397 代わりにこの制限は非特権プロセスがロックするメモリの合計に
398 適用されるようになった。
399 .TP
400 .\"O .BR RLIMIT_MSGQUEUE " (Since Linux 2.6.8)"
401 .BR RLIMIT_MSGQUEUE " (Linux 2.6.8 以降)"
402 .\"O Specifies the limit on the number of bytes that can be allocated
403 .\"O for POSIX message queues for the real user ID of the calling process.
404 .\"O This limit is enforced for
405 .\"O .BR mq_open (3).
406 呼び出し元プロセスの実ユーザー ID に対して、
407 POSIX メッセージキューのために確保できるバイト数の制限を指定する。
408 この制限は
409 .BR mq_open (3)
410 に対して適用される。
411 .\"O Each message queue that the user creates counts (until it is removed)
412 .\"O against this limit according to the formula:
413 ユーザが作成した各々のメッセージキューのバイト数は
414 以下の式により計算され、(そのキューが削除されるまでの間)
415 この制限の計算対象に含められる。
416 .nf
417
418     bytes = attr.mq_maxmsg * sizeof(struct msg_msg *) +
419             attr.mq_maxmsg * attr.mq_msgsize
420
421 .fi
422 .\"O where
423 .\"O .I attr
424 .\"O is the
425 .\"O .I mq_attr
426 .\"O structure specified as the fourth argument to
427 .\"O .BR mq_open (3).
428 ここで
429 .I attr
430
431 .I mq_attr
432 構造体であり、
433 .BR mq_open (3)
434 の第 4 引き数として指定される。
435
436 .\"O The first addend in the formula, which includes
437 .\"O .I "sizeof(struct msg_msg *)"
438 .\"O (4 bytes on Linux/i386), ensures that the user cannot
439 .\"O create an unlimited number of zero-length messages (such messages
440 .\"O nevertheless each consume some system memory for bookkeeping overhead).
441 .I "sizeof(struct msg_msg *)"
442 (Linux/i386 では 4 バイト) を含む最初の加数は、
443 ユーザーが長さ 0 のメッセージを無制限に作れないこと保証している
444 (このようなメッセージであっても、
445 記録のためのオーバーヘッドでシステムメモリを消費する)。
446 .TP
447 .\"O .BR RLIMIT_NICE " (since Linux 2.6.12, but see BUGS below)"
448 .BR RLIMIT_NICE " (Linux 2.6.12 以降, 下記の「バグ」の節も参照)"
449 .\"O Specifies a ceiling to which the process's nice value can be raised using
450 .\"O .BR setpriority (2)
451 .\"O or
452 .\"O .BR nice (2).
453 .\"O The actual ceiling for the nice value is calculated as
454 .\"O .IR "20\ \-\ rlim_cur" .
455 .\"O (This strangeness occurs because negative numbers cannot be specified
456 .\"O as resource limit values, since they typically have special meanings.
457 .\"O For example,
458 .\"O .B RLIM_INFINITY
459 .\"O typically is the same as \-1.)
460 .BR setpriority (2)
461
462 .BR nice (2)
463 を使って引き上げられるプロセスの nice 値の上限を指定する。
464 nice 値の実際の上限は
465 .I "20\ \-\ rlim_cur"
466 で計算される
467 (このような変な状況は、リソース制限値として負の数を指定できないため
468 発生する。通常、負の値は特別な意味を持っているからである。
469 例えば、通常は
470 .B RLIM_INFINITY
471 の値は \-1 である)。
472 .TP
473 .B RLIMIT_NOFILE
474 .\"O Specifies a value one greater than the maximum file descriptor number
475 .\"O that can be opened by this process.
476 このプロセスがオープンできるファイルディスクリプタ数の最大値より
477 1 大きい値を指定する。
478 .\"O Attempts
479 .\"O .RB ( open (2),
480 .\"O .BR pipe (2),
481 .\"O .BR dup (2),
482 .\"O etc.)
483 .\"O to exceed this limit yield the error
484 .\"O .BR EMFILE .
485 .\"O (Historically, this limit was named
486 .\"O .B RLIMIT_OFILE
487 .\"O on BSD.)
488 .RB ( open (2),
489 .BR pipe (2),
490 .BR dup (2)
491 などにより) この上限を超えようとした場合、エラー
492 .B EMFILE
493 が発生する
494 (歴史的に、BSD ではこの上限は
495 .B RLIMIT_OFILE
496 という名前となっている)。
497 .TP
498 .B RLIMIT_NPROC
499 .\"O The maximum number of processes (or, more precisely on Linux, threads)
500 .\"O that can be created for the real user ID of the calling process.
501 .\"O Upon encountering this limit,
502 .\"O .BR fork (2)
503 .\"O fails with the error
504 .\"O .BR EAGAIN .
505 呼び出したプロセスの実ユーザー ID で作成できる最大プロセス数
506 (より正確には Linux ではスレッド数)。
507 この上限に達すると、
508 .BR fork (2)
509 はエラー
510 .B EAGAIN
511 で失敗する。
512 .TP
513 .B RLIMIT_RSS
514 .\"O Specifies the limit (in pages) of the process's resident set
515 .\"O (the number of virtual pages resident in RAM).
516 プロセスの resident set (RAM 上に存在する仮想ページの数) の
517 上限を (ページ数で) 指定する。
518 .\"O This limit only has effect in Linux 2.4.x, x < 30, and there only
519 .\"O affects calls to
520 .\"O .BR madvise (2)
521 .\"O specifying
522 .\"O .BR MADV_WILLNEED .
523 この制限は 2.4.30 より前でしか影響がなく、
524 .BR madvise (2)
525
526 .B MADV_WILLNEED
527 を指定した関数コールにしか影響しない。
528 .\"O .\" As at kernel 2.6.12, this limit still does nothing in 2.6 though
529 .\"O .\" talk of making it do something has surfaced from time to time in LKML
530 .\" カーネル 2.6.12 の時点では、
531 .\" この制限はカーネル 2.6 ではまだ何も行わない。
532 .\" しかし、何をさせるかについては LKML で時々話題になっている。
533 .\"       -- MTK, Jul 05
534 .TP
535 .\"O .BR RLIMIT_RTPRIO " (Since Linux 2.6.12, but see BUGS)"
536 .BR RLIMIT_RTPRIO " (Linux 2.6.12 以降, バグの節も参照)"
537 .\"O Specifies a ceiling on the real-time priority that may be set for
538 .\"O this process using
539 .\"O .BR sched_setscheduler (2)
540 .\"O and
541 .\"O .BR sched_setparam (2).
542 .BR sched_setscheduler (2)
543
544 .BR sched_setparam (2)
545 を使って設定できる、そのプロセスのリアルタイム優先度の上限を指定する。
546 .TP
547 .\"O .BR RLIMIT_RTTIME " (Since Linux 2.6.25)"
548 .BR RLIMIT_RTTIME " (Linux 2.6.25 以降)"
549 .\"O Specifies a limit (in microseconds)
550 .\"O on the amount of CPU time that a process scheduled
551 .\"O under a real-time scheduling policy may consume without making a blocking
552 .\"O system call.
553 .\"O For the purpose of this limit,
554 .\"O each time a process makes a blocking system call,
555 .\"O the count of its consumed CPU time is reset to zero.
556 .\"O The CPU time count is not reset if the process continues trying to
557 .\"O use the CPU but is preempted, its time slice expires, or it calls
558 .\"O .BR sched_yield (2).
559 リアルタイム・スケジューリング方針でスケジューリングされるプロセスが
560 ブロッキング型のシステムコールを呼び出さずに消費することのできる
561 CPU 時間の合計についての上限を (マイクロ秒単位で) 指定する。
562 この上限の目的のため、プロセスがブロッキング型のシステムコールを
563 呼び出す度に、消費された CPU 時間のカウントは 0 にリセットされる。
564 プロセスが CPU を使い続けようとしたが他のプロセスに置き換えられた
565 (preempted) 場合や、そのプロセスのタイムスライスが満了した場合、
566 そのプロセスが
567 .BR sched_yield (2)
568 を呼び出した場合は、CPU 時間のカウントはリセットされない。
569
570 .\"O Upon reaching the soft limit, the process is sent a
571 .\"O .B SIGXCPU
572 .\"O signal.
573 .\"O If the process catches or ignores this signal and
574 .\"O continues consuming CPU time, then
575 .\"O .B SIGXCPU
576 .\"O will be generated once each second until the hard limit is reached,
577 .\"O at which point the process is sent a
578 .\"O .B SIGKILL
579 .\"O signal.
580 ソフト・リミットに達すると、そのプロセスに
581 .B SIGXCPU
582 シグナルが送られる。そのプロセスがこのシグナルを捕捉するか
583 無視して、CPU 時間を消費し続けた場合には、
584 ハード・リミットに達するまで 1 秒に 1 回
585 .B SIGXCPU
586 が生成され続けることになる。
587 ハード・リミットに達した時点で、そのプロセスには
588 .B SIGKILL
589 シグナルが送られる。
590
591 .\"O The intended use of this limit is to stop a runaway
592 .\"O real-time process from locking up the system.
593 この上限を意図的に使用するのは、暴走したリアルタイム・プロセスを
594 停止して、システムが動かなくなるのを避ける場合である。
595 .TP
596 .\"O .BR RLIMIT_SIGPENDING " (Since Linux 2.6.8)"
597 .BR RLIMIT_SIGPENDING " (Linux 2.6.8 以降)"
598 .\"O Specifies the limit on the number of signals
599 .\"O that may be queued for the real user ID of the calling process.
600 呼び出し元プロセスの実ユーザー ID に対して
601 キューに入れられるシグナルの数の制限を指定する。
602 .\"O Both standard and real-time signals are counted for the purpose of
603 .\"O checking this limit.
604 この制限をチェックするため、
605 標準シグナルとリアルタイム・シグナルの両方がカウントされる。
606 .\"O However, the limit is only enforced for
607 .\"O .BR sigqueue (2);
608 .\"O it is always possible to use
609 .\"O .BR kill (2)
610 .\"O to queue one instance of any of the signals that are not already
611 .\"O queued to the process.
612 しかし、この制限は
613 .BR sigqueue (2)
614 に対してしか強制されず、
615 .BR kill (2)
616 使うことで、そのプロセスに対してまだキューに入れられていない
617 シグナルのインスタンスをキューに入れることができる。
618 .\"O .\" This replaces the /proc/sys/kernel/rtsig-max system-wide limit
619 .\"O .\" that was present in kernels <= 2.6.7.  MTK Dec 04
620 .\" これはカーネル 2.6.7 以前に存在するシステム全体の制限
621 .\" /proc/sys/kernel/rtsig-max を置き換える。MTK Dec 04
622 .TP
623 .B RLIMIT_STACK
624 .\"O The maximum size of the process stack, in bytes.
625 プロセス・スタックの最大サイズをバイト単位で指定する。
626 .\"O Upon reaching this limit, a
627 .\"O .B SIGSEGV
628 .\"O signal is generated.
629 この上限に達すると、
630 .B SIGSEGV
631 シグナルが生成される。
632 .\"O To handle this signal, a process must employ an alternate signal stack
633 .\"O .RB ( sigaltstack (2)).
634 このシグナルを扱うためには、
635 プロセスは代りのシグナルスタック
636 .RB ( sigaltstack (2))
637 を使用しなければならない。
638
639 .\"O Since Linux 2.6.23,
640 .\"O this limit also determines the amount of space used for the process's
641 .\"O command-line arguments and environment variables; for details, see
642 .\"O .BR execve (2).
643 Linux 2.6.23 以降では、この制限はプロセスのコマンドライン引き数と環境変数
644 に使用される空間の合計サイズの上限の決定にも使用される。詳細については
645 .BR execve (2)
646 を参照。
647 .\"O .SH "RETURN VALUE"
648 .SH 返り値
649 .\"O On success, zero is returned.
650 .\"O On error, \-1 is returned, and
651 .\"O .I errno
652 .\"O is set appropriately.
653 成功した場合は 0 が返される。エラーの場合は \-1 が返され、
654 .I errno
655 に適切な値が設定される。
656 .\"O .SH ERRORS
657 .SH エラー
658 .TP
659 .B EFAULT
660 .\"O .I rlim
661 .\"O points outside the accessible address space.
662 .I rlim
663 がアクセス可能なアドレス空間の外を指している。
664 .TP
665 .B EINVAL
666 .\"O .I resource
667 .\"O is not valid;
668 .\"O or, for
669 .\"O .BR setrlimit ():
670 .\"O .I rlim\->rlim_cur
671 .\"O was greater than
672 .\"O .IR rlim\->rlim_max .
673 .I resource
674 が有効でない。
675 または、
676 .BR setrlimit ()
677 で、
678 .I rlim\->rlim_cur
679
680 .I rlim\->rlim_max
681 よりも大きかった。
682 .TP
683 .B EPERM
684 .\"O An unprivileged process tried to use
685 .\"O .BR setrlimit ()
686 .\"O to
687 .\"O increase a soft or hard limit above the current hard limit; the
688 .\"O .B CAP_SYS_RESOURCE
689 .\"O capability is required to do this.
690 特権のないプロセスが
691 .BR setrlimit ()
692 を使用して
693 ソフト・リミットまたはハード・リミットを
694 現在のハード・リミットより大きくしようと試みた。
695 これを行うためには
696 .B CAP_SYS_RESOURCE
697 ケーパビリティが必要である。
698 .\"O Or, the process tried to use
699 .\"O .BR setrlimit ()
700 .\"O to increase
701 .\"O the soft or hard
702 .\"O .B RLIMIT_NOFILE
703 .\"O limit above the current kernel
704 .\"O maximum
705 .\"O .RB ( NR_OPEN ).
706 または特権のないプロセスが
707 .BR setrlimit ()
708 を使用して
709 ソフトまたはハード
710 .B RLIMIT_NOFILE
711 リミットを現在のカーネルの最大値
712 .RB ( NR_OPEN )
713 以上に増加させようとした。
714 .\"O .SH CONFORMING TO
715 .SH 準拠
716 SVr4, 4.3BSD, POSIX.1-2001.
717 .\"O .B RLIMIT_MEMLOCK
718 .\"O and
719 .\"O .B RLIMIT_NPROC
720 .\"O derive from BSD and are not specified in POSIX.1-2001;
721 .\"O they are present on the BSDs and Linux, but on few other implementations.
722 .B RLIMIT_MEMLOCK
723
724 .B RLIMIT_NPROC
725 は BSD から派生し、POSIX.1-2001 には指定されていない。
726 これらは BSD 系と Linux に存在するが、他の実装は少ない。
727 .\"O .B RLIMIT_RSS
728 .\"O derives from BSD and is not specified in POSIX.1-2001;
729 .\"O it is nevertheless present on most implementations.
730 .R RLIMIT_RSS
731 は BSD から派生し、POSIX.1-2001 には指定されていない。
732 それにも関わらず多くの実装で存在する。
733 .\"O .BR RLIMIT_MSGQUEUE ,
734 .\"O .BR RLIMIT_NICE ,
735 .\"O .BR RLIMIT_RTPRIO ,
736 .\"O .BR RLIMIT_RTTIME ,
737 .\"O and
738 .\"O .B RLIMIT_SIGPENDING
739 .\"O are Linux-specific.
740 .BR RLIMIT_MSGQUEUE ,
741 .BR RLIMIT_NICE ,
742 .BR RLIMIT_RTPRIO ,
743 .BR RLIMIT_RTTIME ,
744 .B RLIMIT_SIGPENDING
745 は Linux 固有のものである。
746 .\"O .SH NOTES
747 .SH 注意
748 .\"O A child process created via
749 .\"O .BR fork (2)
750 .\"O inherits its parent's resource limits.
751 .\"O Resource limits are preserved across
752 .\"O .BR execve (2).
753 .BR fork (2)
754 で作成された作成された子プロセスは、
755 親プロセスのリソース制限を継承する。
756 .BR execve (2)
757 の前後でリソース制限は保存される。
758
759 .\"O One can set the resource limits of the shell using the built-in
760 .\"O .IR ulimit
761 .\"O command
762 .\"O .RI ( limit
763 .\"O in
764 .\"O .BR csh (1)).
765 .\"O The shell's resource limits are inherited by the processes that
766 .\"O it creates to execute commands.
767 シェルのリソース制限は、シェルの組み込みコマンドである
768 .I ulimit
769 .RB ( csh (1)
770 では
771 .I limit )
772 を使って設定することができる。
773 このシェルのリソース制限は、コマンドを実行してシェルが生成するプロセス
774 に引き継がれる。
775
776 .\"O Ancient systems provided a
777 .\"O .BR vlimit ()
778 .\"O function with a similar purpose to
779 .\"O .BR setrlimit ().
780 .\"O For backward compatibility, glibc also provides
781 .\"O .BR vlimit ().
782 .\"O All new applications should be written using
783 .\"O .BR setrlimit ().
784 古いシステムでは、
785 .BR setrlimit ()
786 と同様の目的を持つ関数
787 .BR vlimit ()
788 が提供されていた。
789 後方互換性のため、glibc でも
790 .BR vlimit ()
791 を提供している。
792 全ての新しいアプリケーションでは、
793 .BR setrlimit ()
794 を使用すべきである。
795 .\"O .SH BUGS
796 .SH バグ
797 .\"O In older Linux kernels, the
798 .\"O .B SIGXCPU
799 .\"O and
800 .\"O .B SIGKILL
801 .\"O signals delivered when a process encountered the soft and hard
802 .\"O .B RLIMIT_CPU
803 .\"O limits were delivered one (CPU) second later than they should have been.
804 以前の Linux カーネルでは、プロセスがソフトまたはハード
805 .B RLIMIT_CPU
806 リミットに達した場合に送られる
807 .B SIGXCPU
808
809 .B SIGKILL
810 シグナルが、本来送られるべき時点の 1 (CPU) 秒後に送られてしまう。
811 .\"O This was fixed in kernel 2.6.8.
812 これはカーネル 2.6.8 で修正された。
813
814 .\"O In 2.6.x kernels before 2.6.17, a
815 .\"O .B RLIMIT_CPU
816 .\"O limit of 0 is wrongly treated as "no limit" (like
817 .\"O .BR RLIM_INFINITY ).
818 .\"O Since Linux 2.6.17, setting a limit of 0 does have an effect,
819 .\"O but is actually treated as a limit of 1 second.
820 2.6.17 より前の 2.6.x カーネルでは、
821 .B RLIMIT_CPU
822 リミットが 0 の場合、
823 .RB ( RLIM_INFINITY
824 と同じように) 「制限なし」と間違って解釈されていた。
825 Linux 2.6.17 以降では、リミットを 0 に設定した場合にも
826 効果を持つようになっているが、実際にはリミットの値は 1 秒となる。
827 .\" see http://marc.theaimsgroup.com/?l=linux-kernel&m=114008066530167&w=2
828
829 .\"O A kernel bug means that
830 .\"O .B RLIMIT_RTPRIO
831 .\"O does not work in kernel 2.6.12; the problem is fixed in kernel 2.6.13.
832 カーネル 2.6.12 には、
833 .B RLIMIT_RTPRIO
834 が動作しないというバグがある。この問題はカーネル 2.6.13 で修正されている。
835
836 .\"O In kernel 2.6.12, there was an off-by-one mismatch
837 .\"O between the priority ranges returned by
838 .\"O .BR getpriority (2)
839 .\"O and
840 .\"O .BR RLIMIT_NICE .
841 .\"O This had the effect that actual ceiling for the nice value
842 .\"O was calculated as
843 .\"O .IR "19\ \-\ rlim_cur" .
844 .\"O This was fixed in kernel 2.6.13.
845 .\"O .\" see http://marc.theaimsgroup.com/?l=linux-kernel&m=112256338703880&w=2
846 カーネル 2.6.12 では、
847 .BR getpriority (2)
848
849 .B RLIMIT_NICE
850 が返す優先度の範囲が一つずれていた。このため、nice 値の実際の上限が
851 .I "19\ \-\ rlim_cur"
852 になってしまうという影響があった。これはカーネル 2.6.13 で修正された。
853 .\" 参考: http://marc.theaimsgroup.com/?l=linux-kernel&m=112256338703880&w=2
854
855 .\"O Kernels before 2.4.22 did not diagnose the error
856 .\"O .B EINVAL
857 .\"O for
858 .\"O .BR setrlimit ()
859 .\"O when
860 .\"O .I rlim\->rlim_cur
861 .\"O was greater than
862 .\"O .IR rlim\->rlim_max .
863 2.4.22 より前のカーネルでは、
864 .I rlim\->rlim_cur
865
866 .I rlim\->rlim_max
867 より大きかった場合、
868 .BR setrlimit ()
869 での
870 .B EINVAL
871 エラーを検出できない。
872 .\"O .SH "SEE ALSO"
873 .SH 関連項目
874 .BR dup (2),
875 .BR fcntl (2),
876 .BR fork (2),
877 .BR getrusage (2),
878 .BR mlock (2),
879 .BR mmap (2),
880 .BR open (2),
881 .BR quotactl (2),
882 .BR sbrk (2),
883 .BR shmctl (2),
884 .BR sigqueue (2),
885 .BR malloc (3),
886 .BR ulimit (3),
887 .BR core (5),
888 .BR capabilities (7),
889 .BR signal (7)