OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[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)