Penguin
Blame: setrlimit(2)
EditPageHistoryDiffInfoLikePages
Annotated edit history of setrlimit(2) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 GETRLIMIT
2 !!!GETRLIMIT
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 RETURN VALUE
7 ERRORS
8 CONFORMING TO
9 NOTE
10 SEE ALSO
11 ----
12 !!NAME
13
14
15 getrlimit, getrusage, setrlimit - get/set resource limits and usage
16 !!SYNOPSIS
17
18
19 __#include __
20 #include __
21 #include __
22
23
24 __int getrlimit (int__ ''resource''__, struct rlimit
25 *__''rlim''__);
26 int getrusage (int__ ''who''__, struct rusage
27 *__''usage''__);
28 int setrlimit (int__ ''resource''__, const struct
29 rlimit *__''rlim''__);__
30 !!DESCRIPTION
31
32
33 __getrlimit__ and __setrlimit__ get and set resource
34 limits respectively. ''resource'' should be one
35 of:
36
37
38 __RLIMIT_CPU__ /* CPU time in seconds */__
39 RLIMIT_FSIZE__ /* Maximum filesize */__
40 RLIMIT_DATA__ /* max data size */__
41 RLIMIT_STACK__ /* max stack size */__
42 RLIMIT_CORE__ /* max core file size */__
43 RLIMIT_RSS__ /* max resident set size */__
44 RLIMIT_NPROC__ /* max number of processes */__
45 RLIMIT_NOFILE__ /* max number of open files */__
46 RLIMIT_MEMLOCK__ /* max locked-in-memory address
47 space*/__
48 RLIMIT_AS__ /* address space (virtual memory) limit
49 */
50
51
52 A resource may unlimited if you set the limit to
53 __RLIM_INFINITY__. __RLIMIT_OFILE__ is the BSD name
54 for __RLIMIT_NOFILE__.
55
56
57 The __rlimit__ structure is defined as follows
58 :
59
60
61 struct rlimit {
62 rlim_t rlim_cur;
63 rlim_t rlim_max;
64 };
65
66
67 __getrusage__ returns the current resource usages, for a
68 ''who'' of either __RUSAGE_SELF__ or
69 __RUSAGE_CHILDREN.__
70
71
72 struct rusage {
73 struct timeval ru_utime; /* user time used */
74 struct timeval ru_stime; /* system time used */
75 long ru_maxrss; /* maximum resident set size */
76 long ru_ixrss; /* integral shared memory size */
77 long ru_idrss; /* integral unshared data size */
78 long ru_isrss; /* integral unshared stack size */
79 long ru_minflt; /* page reclaims */
80 long ru_majflt; /* page faults */
81 long ru_nswap; /* swaps */
82 long ru_inblock; /* block input operations */
83 long ru_oublock; /* block output operations */
84 long ru_msgsnd; /* messages sent */
85 long ru_msgrcv; /* messages received */
86 long ru_nsignals; /* signals received */
87 long ru_nvcsw; /* voluntary context switches */
88 long ru_nivcsw; /* involuntary context switches */
89 };
90 !!RETURN VALUE
91
92
93 On success, zero is returned. On error, -1 is returned, and
94 ''errno'' is set appropriately.
95 !!ERRORS
96
97
98 __EFAULT__
99
100
101 ''rlim'' or ''usage'' points outside the accessible
102 address space.
103
104
105 __EINVAL__
106
107
108 __getrlimit__ or __setrlimit__ is called with a bad
109 ''resource'', or __getrusage__ is called with a bad
110 ''who''.
111
112
113 __EPERM__
114
115
116 A non-superuser tries to use __setrlimit()__ to increase
117 the soft or hard limit above the current hard limit, or a
118 superuser tries to increase RLIMIT_NOFILE above the current
119 kernel maximum.
120 !!CONFORMING TO
121
122
123 SVr4, BSD 4.3
124 !!NOTE
125
126
127 Including '''' is not required these
128 days, but increases portability. (Indeed, ''struct
129 timeval'' is defined in
130 ''''.)
131
132
133 The above struct was taken from BSD 4.3 Reno. Not all fields
134 are meaningful under Linux. Right now (Linux 2.4) only the
135 fields __ru_utime__, __ru_stime__, __ru_minflt__,
136 __ru_majflt__, and __ru_nswap__ are
137 maintained.
138 !!SEE ALSO
139
140
141 quotactl(2), ulimit(3)
142 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.