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
|
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (c) 1992 Drew Eckhardt, March 28, 1992
.\"
.\" 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 Fri Jul 23 21:18:14 1993 by Rik Faith <faith@cs.unc.edu>
.\" Modified Jan 13, 1996 by Arnt Gulbrandsen <agulbra@troll.no>
.\" Modified Jan 22, 1996 by aeb, following a remark by
.\" Tigran Aivazian <tigran@sco.com>
.\" Modified Apr 14, 1996 by aeb, following a remark by
.\" Robert Bihlmeyer <robbe@orcus.ping.at>
.\" Modified Tue Oct 22 17:34:42 1996 by Eric S. Raymond <esr@thyrsus.com>
.\"
.\" 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>
.\"
.\"WORD: resource
.\"WORD: limit ³
.\"WORD: usage
.\"WORD: superuser ѡ桼
.\"
.TH GETRLIMIT 2 "23 July 1993" "Linux" "Linux Programmer's Manual"
.SH ̾
getrlimit, getrusage, setrlimit \- θ³̤/ꤹ
.SH
.B #include <sys/time.h>
.br
.B #include <sys/resource.h>
.br
.B #include <unistd.h>
.sp
.BI "int getrlimit (int " resource ", struct rlimit *" rlim );
.br
.BI "int getrusage (int " who ", struct rusage *" usage );
.br
.BI "int setrlimit (int " resource ", const struct rlimit *" rlim );
.SH
.B getrlimit
.B setrlimit
Ϥ줾(resource)θ³(limit)ȼԤʤ
.I resource
ϰʲΤɤ줫Ǥ:
.PP
\fBRLIMIT_CPU\fP /* CPU time in seconds */
.br
\fBRLIMIT_FSIZE\fP /* Maximum filesize */
.br
\fBRLIMIT_DATA\fP /* max data size */
.br
\fBRLIMIT_STACK\fP /* max stack size */
.br
\fBRLIMIT_CORE\fP /* max core file size */
.br
\fBRLIMIT_RSS\fP /* max resident set size */
.br
\fBRLIMIT_NPROC\fP /* max number of processes */
.br
\fBRLIMIT_NOFILE\fP /* max number of open files */
.br
\fBRLIMIT_MEMLOCK\fP /* max locked-in-memory address space*/
.br
\fBRLIMIT_AS\fP /* address space (virtual memory) limit */
.PP
ϸ³
.BR RLIM_INFINITY
ꤷϸ³̵(unlimited)ˤǤ롣
.BR RLIMIT_OFILE
.BR RLIMIT_NOFILE
BSD ˤ̾Ǥ롣
.PP
.B rlimit
ϰʲΤ褦빽¤ΤǤ:
.PP
.in +0.5i
.nf
struct rlimit
{
int rlim_cur;
int rlim_max;
};
.fi
.in -0.5i
.PP
.B getrusage
ϸߤλλ(usage)֤
\fIwho\fPˤ
.B RUSAGE_SELF
.B RUSAGE_CHILDREN
Τɤ餫ꤹ롣
.PP
.in +0.5i
.nf
struct rusage
{
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
long ru_maxrss; /* maximum resident set size */
long ru_ixrss; /* integral shared memory size */
long ru_idrss; /* integral unshared data size */
long ru_isrss; /* integral unshared stack size */
long ru_minflt; /* page reclaims */
long ru_majflt; /* page faults */
long ru_nswap; /* swaps */
long ru_inblock; /* block input operations */
long ru_oublock; /* block output operations */
long ru_msgsnd; /* messages sent */
long ru_msgrcv; /* messages received */
long ru_nsignals; /* signals received */
long ru_nvcsw; /* voluntary context switches */
long ru_nivcsw; /* involuntary context switches */
};
.fi
.in -0.5i
.SH ֤
ϥ֤롣顼ξ \-1 ֤졢
.I errno
Ŭڤͤꤵ롣
.SH 顼
.TP
.B EFAULT
.I rlim
ޤ
.I usage
ǽʥɥ쥹֤γؤƤ롣
.TP
.B EINVAL
.BR getrlimit " ޤ " setrlimit
\fIresource\fP ǸƤӽФ줿\fBgetrusage\fP
\fIwho\fP ǸƤӽФ줿
.TP
.B EPERM
ѡ桼ʳ \fBsetrlimit()\fP ѤƥեȤޤϥϡ
θ³ߤΥϡɤθ³ʾˤ褦Ȼߤޤϥѡ桼
RLIMIT_NOFILE ߤΥͥκͰʾä褦Ȥ
.SH
SVr4, BSD 4.3
.SH Ϣ
.BR ulimit (2),
.BR quotactl (2)
|