16ec54a57SEdward Tomasz Napierala.\"- 26ec54a57SEdward Tomasz Napierala.\" Copyright (c) 2009 Edward Tomasz Napierala 36ec54a57SEdward Tomasz Napierala.\" All rights reserved. 46ec54a57SEdward Tomasz Napierala.\" 56ec54a57SEdward Tomasz Napierala.\" Redistribution and use in source and binary forms, with or without 66ec54a57SEdward Tomasz Napierala.\" modification, are permitted provided that the following conditions 76ec54a57SEdward Tomasz Napierala.\" are met: 86ec54a57SEdward Tomasz Napierala.\" 1. Redistributions of source code must retain the above copyright 96ec54a57SEdward Tomasz Napierala.\" notice, this list of conditions and the following disclaimer. 106ec54a57SEdward Tomasz Napierala.\" 2. Redistributions in binary form must reproduce the above copyright 116ec54a57SEdward Tomasz Napierala.\" notice, this list of conditions and the following disclaimer in the 126ec54a57SEdward Tomasz Napierala.\" documentation and/or other materials provided with the distribution. 136ec54a57SEdward Tomasz Napierala.\" 146ec54a57SEdward Tomasz Napierala.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 156ec54a57SEdward Tomasz Napierala.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 166ec54a57SEdward Tomasz Napierala.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 176ec54a57SEdward Tomasz Napierala.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE 186ec54a57SEdward Tomasz Napierala.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 196ec54a57SEdward Tomasz Napierala.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 206ec54a57SEdward Tomasz Napierala.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 216ec54a57SEdward Tomasz Napierala.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 226ec54a57SEdward Tomasz Napierala.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 236ec54a57SEdward Tomasz Napierala.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 246ec54a57SEdward Tomasz Napierala.\" POSSIBILITY OF SUCH DAMAGE. 256ec54a57SEdward Tomasz Napierala.\" 266ec54a57SEdward Tomasz Napierala.\" $FreeBSD$ 276ec54a57SEdward Tomasz Napierala.\" 28*d8c4c833SEdward Tomasz Napierala.Dd September 16, 2012 296ec54a57SEdward Tomasz Napierala.Dt RCTL 8 306ec54a57SEdward Tomasz Napierala.Os 316ec54a57SEdward Tomasz Napierala.Sh NAME 326ec54a57SEdward Tomasz Napierala.Nm rctl 336ec54a57SEdward Tomasz Napierala.Nd display and update resource limits database 346ec54a57SEdward Tomasz Napierala.Sh SYNOPSIS 356ec54a57SEdward Tomasz Napierala.Nm 366ec54a57SEdward Tomasz Napierala.Op Fl h 376ec54a57SEdward Tomasz Napierala.Op Fl n 386ec54a57SEdward Tomasz Napierala.Op Ar filter 396ec54a57SEdward Tomasz Napierala.Nm 406ec54a57SEdward Tomasz Napierala.Fl a 416ec54a57SEdward Tomasz Napierala.Op Ar rule 426ec54a57SEdward Tomasz Napierala.Nm 436ec54a57SEdward Tomasz Napierala.Op Fl h 446ec54a57SEdward Tomasz Napierala.Op Fl n 456ec54a57SEdward Tomasz Napierala.Fl l 466ec54a57SEdward Tomasz Napierala.Op Ar filter 476ec54a57SEdward Tomasz Napierala.Nm 486ec54a57SEdward Tomasz Napierala.Fl r 496ec54a57SEdward Tomasz Napierala.Op Ar filter 506ec54a57SEdward Tomasz Napierala.Nm 516ec54a57SEdward Tomasz Napierala.Op Fl h 526ec54a57SEdward Tomasz Napierala.Fl u 536ec54a57SEdward Tomasz Napierala.Op Ar filter 546ec54a57SEdward Tomasz Napierala.Sh DESCRIPTION 556ec54a57SEdward Tomasz NapieralaWhen called without options, the 566ec54a57SEdward Tomasz Napierala.Nm 576ec54a57SEdward Tomasz Napieralacommand writes currently defined RCTL rules to standard output. 586ec54a57SEdward Tomasz Napierala.Pp 596ec54a57SEdward Tomasz NapieralaIf a 606ec54a57SEdward Tomasz Napierala.Ar filter 616ec54a57SEdward Tomasz Napieralaargument is specified, only rules matching the filter are displayed. 626ec54a57SEdward Tomasz NapieralaThe options are as follows: 636ec54a57SEdward Tomasz Napierala.Bl -tag -width indent 646ec54a57SEdward Tomasz Napierala.It Fl a Ar rule 656ec54a57SEdward Tomasz NapieralaAdd 666ec54a57SEdward Tomasz Napierala.Ar rule 676ec54a57SEdward Tomasz Napieralato the RCTL database. 686ec54a57SEdward Tomasz Napierala.It Fl l Ar filter 696ec54a57SEdward Tomasz NapieralaDisplay rules applicable to the process defined by 706ec54a57SEdward Tomasz Napierala.Ar filter . 71aeb99b56SEdward Tomasz NapieralaNote that this is different from showing the rules when called without 72aeb99b56SEdward Tomasz Napieralaany options, as it shows not just the rules with subject equal to that 73aeb99b56SEdward Tomasz Napieralaof process, but also rules for the user, jail, and login class applicable 74aeb99b56SEdward Tomasz Napieralato the process. 756ec54a57SEdward Tomasz Napierala.It Fl r Ar filter 766ec54a57SEdward Tomasz NapieralaRemove rules matching 776ec54a57SEdward Tomasz Napierala.Ar filter 786ec54a57SEdward Tomasz Napieralafrom the RCTL database. 796ec54a57SEdward Tomasz Napierala.It Fl u Ar filter 806ec54a57SEdward Tomasz NapieralaDisplay resource usage for a subject (process, user, login class 816ec54a57SEdward Tomasz Napieralaor jail) matching the 826ec54a57SEdward Tomasz Napierala.Ar filter . 836ec54a57SEdward Tomasz Napierala.It Fl h 846ec54a57SEdward Tomasz Napierala"Human-readable" output. 856ec54a57SEdward Tomasz NapieralaUse unit suffixes: Byte, Kilobyte, Megabyte, 866ec54a57SEdward Tomasz NapieralaGigabyte, Terabyte and Petabyte. 876ec54a57SEdward Tomasz Napierala.It Fl n 886ec54a57SEdward Tomasz NapieralaDisplay user IDs numerically rather than converting them to a user name. 89b2e52cedSUlrich Spörlein.El 906ec54a57SEdward Tomasz Napierala.Sh RULE SYNTAX 916ec54a57SEdward Tomasz NapieralaSyntax for a rule is subject:subject-id:resource:action=amount/per. 926ec54a57SEdward Tomasz Napierala.Pp 936ec54a57SEdward Tomasz NapieralaSubject defines the kind of entity the rule applies to. 946ec54a57SEdward Tomasz NapieralaIt can be either process, user, login class, or jail. 956ec54a57SEdward Tomasz Napierala.Pp 96dce762ddSGlen BarberSubject ID identifies the subject. 97aeb99b56SEdward Tomasz NapieralaIt can be a process ID, user name, numerical user ID, login class name, 98aeb99b56SEdward Tomasz Napieralaor jail name. 996ec54a57SEdward Tomasz Napierala.Pp 1006ec54a57SEdward Tomasz NapieralaResource identifies the resource the rule controls. 1016ec54a57SEdward Tomasz Napierala.Pp 1026ec54a57SEdward Tomasz NapieralaAction defines what will happen when a process exceeds the allowed amount. 1036ec54a57SEdward Tomasz Napierala.Pp 1046ec54a57SEdward Tomasz NapieralaAmount defines how much of the resource a process can use before 1056ec54a57SEdward Tomasz Napieralathe defined action triggers. 1066ec54a57SEdward Tomasz Napierala.Pp 1076ec54a57SEdward Tomasz NapieralaThe per field defines what entity the amount gets accounted for. 1086ec54a57SEdward Tomasz NapieralaFor example, rule "loginclass:users:vmem:deny=100M/process" means 1096ec54a57SEdward Tomasz Napieralathat each process of any user belonging to login class "users" may allocate 1106ec54a57SEdward Tomasz Napieralaup to 100MB of virtual memory. 1116ec54a57SEdward Tomasz NapieralaRule "loginclass:users:vmem:deny=100M/user" would mean that for each 1126ec54a57SEdward Tomasz Napieralauser belonging to the login class "users", the sum of virtual memory allocated 11320d3bac0SEdward Tomasz Napieralaby all the processes of that user will not exceed 100MB. 1146ec54a57SEdward Tomasz NapieralaRule "loginclass:users:vmem:deny=100M/loginclass" would mean that the sum of 1156ec54a57SEdward Tomasz Napieralavirtual memory allocated by all processes of all users belonging to that login 1166ec54a57SEdward Tomasz Napieralaclass will not exceed 100MB. 1176ec54a57SEdward Tomasz Napierala.Pp 1186ec54a57SEdward Tomasz NapieralaValid rule has all those fields specified, except for the per, which defaults 1196ec54a57SEdward Tomasz Napieralato the value of subject. 1206ec54a57SEdward Tomasz Napierala.Pp 1216ec54a57SEdward Tomasz NapieralaA filter is a rule for which one of more fields other than per is left empty. 1226ec54a57SEdward Tomasz NapieralaFor example, a filter that matches every rule could be written as ":::=/", 1236ec54a57SEdward Tomasz Napieralaor, in short, ":". 1246ec54a57SEdward Tomasz NapieralaA filter that matches all the login classes would be "loginclass:". 125a29460e0SEdward Tomasz NapieralaA filter that matches all defined rules for maxproc resource would be 126a29460e0SEdward Tomasz Napierala"::maxproc". 1276ec54a57SEdward Tomasz Napierala.Sh RESOURCES 12885a2f1b4SEdward Tomasz Napierala.Bl -column -offset 3n "pseudoterminals" 129288eac5aSJoel Dahl.It cputime Ta "CPU time, in seconds" 130288eac5aSJoel Dahl.It datasize Ta "data size, in bytes" 131288eac5aSJoel Dahl.It stacksize Ta "stack size, in bytes" 132288eac5aSJoel Dahl.It coredumpsize Ta "core dump size, in bytes" 133288eac5aSJoel Dahl.It memoryuse Ta "resident set size, in bytes" 134288eac5aSJoel Dahl.It memorylocked Ta "locked memory, in bytes" 135288eac5aSJoel Dahl.It maxproc Ta "number of processes" 136288eac5aSJoel Dahl.It openfiles Ta "file descriptor table size" 137288eac5aSJoel Dahl.It vmemoryuse Ta "address space limit, in bytes" 138288eac5aSJoel Dahl.It pseudoterminals Ta "number of PTYs" 139288eac5aSJoel Dahl.It swapuse Ta "swap usage, in bytes" 140288eac5aSJoel Dahl.It nthr Ta "number of threads" 141288eac5aSJoel Dahl.It msgqqueued Ta "number of queued SysV messages" 142288eac5aSJoel Dahl.It msgqsize Ta "SysV message queue size, in bytes" 143288eac5aSJoel Dahl.It nmsgq Ta "number of SysV message queues" 144288eac5aSJoel Dahl.It nsem Ta "number of SysV semaphores" 145288eac5aSJoel Dahl.It nsemop Ta "number of SysV semaphores modified in a single semop(2) call" 146288eac5aSJoel Dahl.It nshm Ta "number of SysV shared memory segments" 147288eac5aSJoel Dahl.It shmsize Ta "SysV shared memory size, in bytes" 148288eac5aSJoel Dahl.It wallclock Ta "wallclock time, in seconds" 1496ec54a57SEdward Tomasz Napierala.El 1506ec54a57SEdward Tomasz Napierala.Sh ACTIONS 15185a2f1b4SEdward Tomasz Napierala.Bl -column -offset 3n "pseudoterminals" 152288eac5aSJoel Dahl.It deny Ta "deny the allocation; not supported for cpu and wallclock" 153288eac5aSJoel Dahl.It log Ta "log a warning to the console" 154288eac5aSJoel Dahl.It devctl Ta "send notification to" 1556ec54a57SEdward Tomasz Napierala.Xr devd 8 156dce762ddSGlen Barber.It "sig* e.g. sigterm; send a signal to the offending process" 1576ec54a57SEdward Tomasz Napierala.El 1586ec54a57SEdward Tomasz Napierala.Pp 1596ec54a57SEdward Tomasz NapieralaSee 1606ec54a57SEdward Tomasz Napierala.Xr signal 3 1616ec54a57SEdward Tomasz Napieralafor a list of supported signals. 1626ec54a57SEdward Tomasz Napierala.Pp 1636ec54a57SEdward Tomasz NapieralaNot all actions are supported for all resources. 1646ec54a57SEdward Tomasz NapieralaAttempt to add rule with action not supported by a given resouce will result 1656ec54a57SEdward Tomasz Napieralain error. 1666ec54a57SEdward Tomasz Napierala.Pp 1676ec54a57SEdward Tomasz NapieralaNote that limiting RSS may kill the machine due to thrashing. 1686ec54a57SEdward Tomasz Napierala.Sh EXIT STATUS 1696ec54a57SEdward Tomasz Napierala.Ex -std 1706ec54a57SEdward Tomasz Napierala.Sh EXAMPLES 17185a2f1b4SEdward Tomasz Napierala.Dl rctl -a user:joe:vmemoryuse:deny=1g 1726ec54a57SEdward Tomasz Napierala.Pp 1736ec54a57SEdward Tomasz NapieralaPrevent user "joe" from allocating more than 1GB of virtual memory. 1746ec54a57SEdward Tomasz Napierala.Pp 1756ec54a57SEdward Tomasz Napierala.Dl rctl -r : 1766ec54a57SEdward Tomasz Napierala.Pp 1776ec54a57SEdward Tomasz NapieralaRemove all RCTL rules. 1786ec54a57SEdward Tomasz Napierala.Pp 179a7ad07bfSEdward Tomasz Napierala.Dl rctl -hu jail:www 1806ec54a57SEdward Tomasz Napierala.Pp 181a7ad07bfSEdward Tomasz NapieralaDisplay resource usage information for jail named "www". 1826ec54a57SEdward Tomasz Napierala.Pp 1836ec54a57SEdward Tomasz Napierala.Dl rctl -l process:512 1846ec54a57SEdward Tomasz Napierala.Pp 1856ec54a57SEdward Tomasz NapieralaDisplay all the rules applicable to process with PID 512. 1866ec54a57SEdward Tomasz Napierala.Sh SEE ALSO 187*d8c4c833SEdward Tomasz Napierala.Xr rctl.conf 5 1886ec54a57SEdward Tomasz Napierala.Sh HISTORY 1896ec54a57SEdward Tomasz NapieralaThe 1906ec54a57SEdward Tomasz Napierala.Nm 1916ec54a57SEdward Tomasz Napieralacommand appeared in 1926ec54a57SEdward Tomasz Napierala.Fx 9.0 . 1936ec54a57SEdward Tomasz Napierala.Sh AUTHORS 1946ec54a57SEdward Tomasz Napierala.An -nosplit 1956ec54a57SEdward Tomasz NapieralaThe 1966ec54a57SEdward Tomasz Napierala.Nm 1976ec54a57SEdward Tomasz Napieralacommand was written by 1986ec54a57SEdward Tomasz Napierala.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . 199