1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372
|
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (c) 2002 Michael Kerrisk
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified by Michael Haardt <michael@moria.de>
.\" Modified 1993-07-23 by Rik Faith <faith@cs.unc.edu>
.\" Modified 1996-01-13 by Arnt Gulbrandsen <agulbra@troll.no>
.\" Modified 1996-01-22 by aeb, following a remark by
.\" Tigran Aivazian <tigran@sco.com>
.\" Modified 1996-04-14 by aeb, following a remark by
.\" Robert Bihlmeyer <robbe@orcus.ping.at>
.\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified 2001-05-04 by aeb, following a remark by
.\" Havard Lygre <hklygre@online.no>
.\" Modified 2001-04-17 by Michael Kerrisk <mtk-manpages@gmx.net>
.\" Modified 2002-06-13 by Michael Kerrisk <mtk-manpages@gmx.net>
.\" Added note on non-standard behaviour when SIGCHLD is ignored.
.\" Modified 2002-07-09 by Michael Kerrisk <mtk-manpages@gmx.net>
.\" Enhanced descriptions of 'resource' values for [gs]etrlimit()
.\" Modified 2003-11-28 by aeb, added RLIMIT_CORE
.\" Modified 2004-03-26 by aeb, added RLIMIT_AS
.\" Modified 2004-06-16 by Michael Kerrisk <mtk-manpages@gmx.net>
.\" Added notes on CAP_SYS_RESOURCE
.\"
.\" 2004-11-16 -- mtk: the gerlimit.2 page, which formally included
.\" coverage of getrusage(2), has been split, so that the latter
.\" is now covered in its own getrusage.2.
.\"
.\" Modified 2004-11-16, mtk: A few other minor changes
.\" Modified 2004-11-23, mtk
.\" Added notes on RLIMIT_MEMLOCK, RLIMIT_NPROC, and RLIMIT_RSS
.\" to "CONFORMING TO"
.\" Modified 2004-11-25, mtk
.\" Rewrote discussion on RLIMIT_MEMLOCK to incorporate kernel
.\" 2.6.9 changes.
.\" Added note on RLIMIT_CPU error in older kernels
.\" 2004-11-03, mtk
.\" Added RLIMIT_SIGPENDING
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Sat Feb 22 20:38:26 JST 1997
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated and Modified Sat Jun 2 12:20:37 JST 2001
.\" by Yuichi SATO <ysato444@yahoo.co.jp>
.\" Updated and Modified Sat Aug 18 09:41:44 JST 2001 by Yuichi SATO
.\" Updated and Modified Sun Aug 25 03:16:48 JST 2002 by Yuichi SATO
.\" Updated and Modified Sat Jan 17 00:58:38 JST 2004 by Yuichi SATO
.\" Updated and Modified Thu Dec 30 13:27:51 JST 2004 by Yuichi SATO
.\"
.\"WORD: resource
.\"WORD: limit
.\"WORD: superuser ѡ桼
.\"
.TH GETRLIMIT 2 2004-06-16 "Linux" "Linux Programmer's Manual"
.SH ̾
getrlimit, setrlimit \- ¤/ꤹ
.SH
.B #include <sys/time.h>
.br
.B #include <sys/resource.h>
.sp
.BI "int getrlimit(int " resource ", struct rlimit *" rlim );
.br
.BI "int setrlimit(int " resource ", const struct rlimit *" rlim );
.SH
.BR getrlimit ()
.BR setrlimit ()
Ϥ줾 (resource) (limit) ȼԤ
ƥˤϡ˴ϢŤ줿եȡߥåȤȥϡɡߥåȤ롣
ߥåȤ
.RB ( getrlimit "() " setrlimit ()
.I rlim
ˤƤ) ¤Τ
.PP
.in +0.5i
.nf
struct rlimit {
rlim_t rlim_cur; /* եȡߥå */
rlim_t rlim_max; /* ϡɡߥå (rlim_cur 꾮ʤ) */
};
.fi
.in -0.5i
եȡߥåȤϡͥ뤬Ф¤ԤͤǤ롣
ϡɡߥåȤϥեȡߥåȤξ¤ȤƯ
øʤץϡեȡߥåȤͤ
0 ϡɡߥåȤϰϤꤹ뤳Ȥȡ
ϡɡߥåȤ뤳ȤΤߤǤ
(ٲϡɥߥåȤϾ夲ʤ)
øץ (Linux Ǥ
.B CAP_SYS_RESOURCE
ѥӥƥ (capability) ĥץ)
եȡߥåȤȥϡɡߥåȤͳѹǤ롣
.PP
.B RLIM_INFINITY
ϥ¤ʤȤɽ
(ͤ
.BR getrlimit ()
֤빽¤Τ
.BR setrlimit ()
Ϥ빽¤Τꤵ)
.PP
.I resource
ϼΤ줫 1 ĤǤ롣
.TP
.B RLIMIT_AS
ץβۥ (ɥ쥹) κ祵 (Хñ)
.\" 2.0.27 / 2.1.12 ʹߡ
¤
.BR brk (2),
.BR mmap (2),
.BR mremap (2)
θƤӽФ˱ƶ¤Ķ
顼
.B ENOMEM
ǼԤ롣
ޤưŪʥåĥˤ⼺Ԥ
(
.BR sigaltstack (2)
ȤäإåѲǽˤƤʤäˤϡ
.B SIGSEGV
ƤΥץ kill )
ͤ long ʤΤǡ32 ӥåȤ long ĥޥǤϡ
¤Ϻ 2 GiB ˤʤ뤫λ̵¤ˤʤ롣
.TP
.B RLIMIT_CORE
.I core
եκ祵
0 ξ硢core եʤ
0 ʳξ硢Υ礭פڤͤ롣
.TP
.B RLIMIT_CPU
CPU ֤ξ (ÿ)
ץեȡߥåȤãˡ
.B SIGXCPU
ʥ롣
ΥʥФǥեȤưϡץνλǤ롣
ʥåơϥɥ餬ᥤץ
֤ȤǤ롣
ץ CPU ֤Ȥ³ϡ
ϡɥߥåȤãޤ 1 ˥ץ
.B SIGXCPU
ꡢ
ϡɥߥåȤã
.B SIGKILL
롣
ǽҤ٤ (եȡߥåȤĶ) ʬϡLinux 2.2 2.4 ưǤ롣
եȡߥåȤĶ CPU ֤Ȥ³ץ
ˤĤƤμѲƤƤ롣
ΥʥåɬפΤ
ܿͤץꥱǤϡ
ǽ
.B SIGXCPU
äλ٤Ǥ롣
.TP
.B RLIMIT_DATA
ץΥǡ
(줿ǡƤʤǡҡ) κ͡
ΥߥåȤ
.BR brk ()
.BR sbrk ()
θƤӽФ˱ƶ롣
δؿϡΥΥեȡߥåȤãȡ
顼
.B ENOMEM
ǼԤ롣
.TP
.B RLIMIT_FSIZE
ץǤե륵κ͡
ΥĶƥեĥȡ
.B SIGXFSZ
ʥ롣
ǥեȤǤϡΥʥϥץλ롣
ץå뤳ȤǤ뤬
Ϣ륷ƥॳ
.RB ( write (),
.BR truncate ()
ʤ) ϥ顼
.B EFBIG
ǼԤ롣
.TP
.B RLIMIT_LOCKS
Υץ¹ԤǤ
.BR flock ()
å
.BR fcntl()
ιפ¤
( Linux 2.4 ǤΤѤǤ)
.\" Τˤ Linux 2.4.0-test9 Τߡ2.4.25 / 2.5.65 ǤϤʤʤäƤ롣
.TP
.B RLIMIT_MEMLOCK
RAM ˥åκХȿ
ºݤˤϡ¤ϥƥڡκǤᤤܿ
ڤΤƤƴݤ롣
¤
.BR mlock (2),
.BR mlockall (2),
.BR mmap (2)
.B MAP_LOCKED
˱ƶ롣
Linux 2.6.9 ʹߤǤ
.BR shmctl (2)
.B SHM_LOCK
ˤƶ롣
ϸƤӽФץμ (real) 桼 ID ˥å
ͭꥻ
.RB ( shmget (2)
) ιץХȿκͤꤹ롣
.BR shmctl (2)
.B SHM_LOCK
åϡ
.BR mlock (2),
.BR mlockall (2),
.BR mmap (2)
.B MAP_LOCKED
ˤäƳΩץΥåȤʬƿ롣
1 ĤΥץϤ¤ޤǤΥХȤåǤ롣
¤ˤ 2 Ĥμब롣
2.6.9 Linux ͥ Ǥϡ
¤øץˤäƥåιפ椷Ƥ
Linux 2.6.9 ʹߤǤϡøץåιפ¤Ϥʤ
ˤ¤øץåιפ
ŬѤ褦ˤʤä
.\" ְ㤨Ƥ: Linux 2.6.8 Ǥ RLIMIT_MSGQUEUE ɲä줿
.TP
.B RLIMIT_NOFILE
ΥץץǤեǥץκͤ
1 礭ͤꤹ롣
.RB ( open (),
.BR pipe (),
.BR dup ()
ʤɤˤ) ξ¤Ķ褦Ȥ硢顼
.B EMFILE
ȯ롣
.TP
.B RLIMIT_NPROC
ƤӽФץμ¥桼 ID ǺǤץ
ξ¤ãȡ
.BR fork ()
ϥ顼
.B EAGAIN
ǼԤ롣
.TP
.B RLIMIT_RSS
ץ resident set (RAM ¸ߤ벾ۥڡο)
¤ (ڡ) ꤹ롣
¤ Linux 2.4 ʹߤǤƶʤ
.BR madvise ()
.B MADVISE_WILLNEED
ꤷؿˤƶʤ
.\" ͥ 2.6.9 λǤϡ
.\" ¤ϥͥ 2.6 ǤϤޤԤʤ
.\" 뤫ˤĤ LKML ǵ³Ƥ -- MTK, Nov 04
.TP
.B RLIMIT_SIGPENDING
ƤӽФץμ¥桼 ID Ф
塼륷ʥο¤ꤹ롣
¤å뤿ᡢ
ɸॷʥȼ»֥ʥξȤ롣
¤
.BR sigqueue (2)
ФƤ줺
.BR kill (2)
ȤȤǡΥץФƤޤ塼Ƥʤ
ʥΥ塼ˤ뤳ȤǤ
(Linux 2.6.8 ʹ)
.\" ϥͥ 2.6.7 ¸ߤ륷ƥΤ
.\" /proc/sys/kernel/rtsig-max ֤롣MTK Dec 04
.TP
.B RLIMIT_STACK
ץåκ祵Хñ̤ǻꤹ롣
ξ¤ãȡ
.B SIGSEGV
ʥ뤬롣
Υʥˤϡ
ץΥʥ륹å
.RB ( sigaltstack (2))
ѤʤФʤʤ
.PP
.B RLIMIT_OFILE
.B RLIMIT_NOFILE
BSD Ǥ̾Ǥ롣
.PP
.SH ֤
0 ֤롣顼ξ \-1 ֤졢
.I errno
Ŭڤͤꤵ롣
.SH 顼
.TP
.B EFAULT
.I rlim
ǽʥɥ쥹֤γؤƤ롣
.TP
.B EINVAL
.I resource
ͭǤʤ
.TP
.B EPERM
øΤʤץ \fBsetrlimit()\fP Ѥ
եȡߥåȤޤϥϡɡߥåȤ
ߤΥϡɡߥåȰʾˤ褦Ȼߤ
Ԥˤ
.B CAP_SYS_RESOURCE
ѥӥƥɬפǤ롣
ޤøΤʤץ \fBsetrlimit()\fP Ѥ
եȤޤϥϡ RLIMIT_NOFILE ߥåȤ
ߤΥͥκ (NR_OPEN) ʾä褦Ȥ
.SH Х
ץեȤޤϥϡ
.B RLIMIT_CPU
ߥåȤã
.B SIGXCPU
.B SIGKILL
ʥ뤬٤ 1 (CPU) øƤޤ
ϥͥ 2.6.8 ǽ줿
.SH
SVr4, BSD 4.3.
.B RLIMIT_MEMLOCK
.B RLIMIT_NPROC
BSD POSIX.1-2001 ˤϻꤵƤʤ
BSD Ϥ Linux ¸ߤ뤬¾μϾʤ
.R RLIMIT_RSS
BSD POSIX.1-2001 ˤϻꤵƤʤ
ˤؤ餺¿μ¸ߤ롣
.B RLIMIT_SIGPENDING
Linux ͭΤΤǤ롣
.\" ְ㤨Ƥ: RLIMIT_MSGQUEUE Linux ͭΤΤǤ롣
.SH Ϣ
.BR dup (2),
.BR fcntl (2),
.BR fork (2),
.BR getrusage (2),
.BR mlock (2),
.BR mmap (2),
.BR open (2),
.BR quotactl (2),
.BR sbrk (2),
.BR shmctl (2),
.BR sigqueue (2),
.BR malloc (3),
.BR ulimit (3),
.BR capabilities (7),
.BR signal (7)
|