2 .\" Copyright (c) 2009 Edward Tomasz Napierala
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE
18 .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 .\" POSSIBILITY OF SUCH DAMAGE.
33 .Nd display and update resource limits database
55 When called without options, the
57 command writes currently defined RCTL rules to standard output.
61 argument is specified, only rules matching the filter are displayed.
62 The options are as follows:
63 .Bl -tag -width indent
69 Display rules applicable to the process defined by
74 from the RCTL database.
76 Display resource usage for a subject (process, user, login class
80 "Human-readable" output.
81 Use unit suffixes: Byte, Kilobyte, Megabyte,
82 Gigabyte, Terabyte and Petabyte.
84 Display user IDs numerically rather than converting them to a user name.
87 Syntax for a rule is subject:subject-id:resource:action=amount/per.
89 Subject defines the kind of entity the rule applies to.
90 It can be either process, user, login class, or jail.
92 Subject ID identifies the subject. It can be user name,
93 numerical user ID, login class name, or jail name.
95 Resource identifies the resource the rule controls.
97 Action defines what will happen when a process exceeds the allowed amount.
99 Amount defines how much of the resource a process can use before
100 the defined action triggers.
102 The per field defines what entity the amount gets accounted for.
103 For example, rule "loginclass:users:vmem:deny=100M/process" means
104 that each process of any user belonging to login class "users" may allocate
105 up to 100MB of virtual memory.
106 Rule "loginclass:users:vmem:deny=100M/user" would mean that for each
107 user belonging to the login class "users", the sum of virtual memory allocated
108 by all the processes of that user will not exceed 100MB.
109 Rule "loginclass:users:vmem:deny=100M/loginclass" would mean that the sum of
110 virtual memory allocated by all processes of all users belonging to that login
111 class will not exceed 100MB.
113 Valid rule has all those fields specified, except for the per, which defaults
114 to the value of subject.
116 A filter is a rule for which one of more fields other than per is left empty.
117 For example, a filter that matches every rule could be written as ":::=/",
119 A filter that matches all the login classes would be "loginclass:".
120 A filter that matches all defined rules for nproc resource would be
124 .Bl -column -offset 3n "pseudoterminals"
125 .It cputime CPU time, in seconds
126 .It datasize data size, in bytes
127 .It stacksize stack size, in bytes
128 .It coredumpsize core dump size, in bytes
129 .It memoryuse resident set size, in bytes
130 .It memorylocked locked memory, in bytes
131 .It maxproc number of processes
132 .It openfiles file descriptor table size
133 .It vmemoryuse address space limit, in bytes
134 .It pseudoterminals number of PTYs
135 .It swapuse swap usage, in bytes
136 .It nthr number of threads
137 .It msgqqueued number of queued SysV messages
138 .It msgqsize SysV message queue size, in bytes
139 .It nmsgq number of SysV message queues
140 .It nsem number of SysV semaphores
141 .It nsemop number of SysV semaphores modified in a single semop(2) call
142 .It nshm number of SysV shared memory segments
143 .It shmsize SysV shared memory size, in bytes
144 .It wallclock wallclock time, in seconds
148 .Bl -column -offset 3n "pseudoterminals"
149 .It deny deny the allocation; not supported for cpu and wallclock
150 .It log log a warning to the console
151 .It devctl send notification to
153 .It sig* e.g. sigterm; send a signal to the offending process
158 for a list of supported signals.
160 Not all actions are supported for all resources.
161 Attempt to add rule with action not supported by a given resouce will result
164 Note that limiting RSS may kill the machine due to thrashing.
169 .Dl rctl -a user:joe:vmemoryuse:deny=1g
171 Prevent user "joe" from allocating more than 1GB of virtual memory.
175 Remove all RCTL rules.
177 .Dl rctl -hu jail:www
179 Display resource usage information for jail named "www".
181 .Dl rctl -l process:512
183 Display all the rules applicable to process with PID 512.
197 command was written by
198 .An Edward Tomasz Napierala Aq trasz@FreeBSD.org .