RCTL(8)
π rctl(8) β display and update resource limits database
okay so you found the resource limits page, bestie. this is rctl from the System Manager's Manual, section 8, and it's literally the tool that controls how much of everything a process is allowed to eat. she's giving system admin main character energy and honestly? iconic. let's get into it π
β¨ NAME β¨
rctl β display and update resource limits database
π¦ SYNOPSIS π¦
rctl [-h] [-n] [filter ...]
rctl -a rule ...
rctl -l [-h] [-n] filter ...
rctl -r filter ...
rctl -u [-h] filter ...
πΈ DESCRIPTION πΈ
so when you just run rctl with zero options, she writes all the currently defined RCTL rules to standard output. that's it. that's the vibe check. π
and if you throw a filter argument in there, you only see the rules that match that filter. slay.
the options are as follows, no cap:
-arule β add rule to the RCTL database. new rule, who dis β¨-lfilter β display the rules applicable to the process defined by filter. and listen, this is not the same as just showing rules with no options β this one shows you not just the rules whose subject equals that of the process, but ALSO the rules for the user, jail, and login class that apply to the process. she's thorough, we love that π«Ά-rfilter β remove rules matching filter from the RCTL database. bye bestie π-ufilter β display resource utilization for a subject (process, user, loginclass or jail) matching the filter. we're nosy and we're checking the stats π-hβ "human-readable" output. use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte. no more squinting at giant numbers, we're being nice to ourselves π-nβ display user IDs numerically rather than converting them to a user name. numbers only, no names, she's mysterious π
modifications to rules affect all currently running and future processes matching the rule. like, all of them. not just the new ones. periodt π₯
β RULE SYNTAX β
here's the shape of a rule, memorize it iykyk:
subject:subject-id:resource:action=amount/per
- subject β defines the kind of entity the rule applies to. it can be either
process,user,loginclass, orjail. - subject-id β identifies the subject. it can be a process ID, user name, numerical user ID, login class name from
login.conf(5), or jail name. - resource β identifies the resource the rule controls. see the "RESOURCES" section below for details.
- action β defines what will happen when a process exceeds the allowed amount. see the "ACTIONS" section below for details.
- amount β defines how much of the resource a process can use before the defined action triggers. resources which limit bytes may use prefixes from
expand_number(3). - per β defines what entity the amount gets accounted for.
okay so the per field needs examples because it's lowkey the whole personality of this tool:
- rule
"loginclass:users:vmemoryuse:deny=100M/process"means that each process of any user belonging to login class"users"may allocate up to 100MB of virtual memory. - rule
"loginclass:users:vmemoryuse:deny=100M/user"would mean that for each user belonging to the login class"users", the sum of virtual memory allocated by all the processes of that user will not exceed 100MB. - rule
"loginclass:users:vmemoryuse:deny=100M/loginclass"would mean that the sum of virtual memory allocated by all processes of all users belonging to that login class will not exceed 100MB.
see the difference? same rule, different accounting vibes. she contains multitudes π
a valid rule has all those fields specified, except for per, which defaults to the value of subject.
a filter is a rule for which one or more fields other than per is left empty. for example:
- a filter that matches every rule could be written as
":::=/", or, in short,":". - a filter that matches all the login classes would be
"loginclass:". - a filter that matches all defined rules for
maxprocresource would be"::maxproc".
filters are literally the wildcards of this whole situation, obsessed π¦
π§ SUBJECTS π§
processβ numerical Process IDuserβ user name or numerical User IDloginclassβ login class fromlogin.conf(5)jailβ jail name
π RESOURCES π
cputimeβ CPU time, in secondsdatasizeβ data size, in bytesstacksizeβ stack size, in bytescoredumpsizeβ core dump size, in bytesmemoryuseβ resident set size, in bytesmemorylockedβ locked memory, in bytesmaxprocβ number of processesopenfilesβ file descriptor table sizevmemoryuseβ address space limit, in bytespseudoterminalsβ number of PTYsswapuseβ swap space that may be reserved or used, in bytesnthrβ number of threadsmsgqqueuedβ number of queued SysV messagesmsgqsizeβ SysV message queue size, in bytesnmsgqβ number of SysV message queuesnsemβ number of SysV semaphoresnsemopβ number of SysV semaphores modified in a singlesemop(2)callnshmβ number of SysV shared memory segmentsshmsizeβ SysV shared memory size, in byteswallclockβ wallclock time, in secondspcpuβ %CPU, in percents of a single CPU corereadbpsβ filesystem reads, in bytes per secondwritebpsβ filesystem writes, in bytes per secondreadiopsβ filesystem reads, in operations per secondwriteiopsβ filesystem writes, in operations per second
π₯ ACTIONS π₯
denyβ deny the allocation; not supported forcputime,wallclock,readbps,writebps,readiops, andwriteiopslogβ log a warning to the consoledevctlβ send notification todevd(8)usingsystem = "RCTL",subsystem = "rule",type = "matched"sig*β e.g.sigterm; send a signal to the offending process. seesignal(3)for a list of supported signalsthrottleβ slow down process execution; only supported forreadbps,writebps,readiops, andwriteiops
β οΈ not all actions are supported for all resources. attempting to add a rule with an action not supported by a given resource will result in error. she will simply refuse, and honestly? valid π
π EXIT STATUS π
the rctl utility exits 0 on success, and >0 if an error occurs. clean and simple, no drama β¨
π EXAMPLES π
prevent user "joe" from allocating more than 1GB of virtual memory:
rctl -a user:joe:vmemoryuse:deny=1g
remove all RCTL rules:
rctl -r :
display resource utilization information for jail named "www":
rctl -hu jail:www
display all the rules applicable to process with PID 512:
rctl -l process:512
display all rules:
rctl
display all rules matching user "joe":
rctl user:joe
display all rules matching login classes:
rctl loginclass:
π SEE ALSO π
cpuset(1), rctl(4), rctl.conf(5)
π HISTORY π
the rctl command appeared in FreeBSD 9.0. vintage but make it functional π
π«Ά AUTHORS π«Ά
the rctl was developed by Edward Tomasz Napierala <trasz@FreeBSD.org> under sponsorship from the FreeBSD Foundation. king behavior, we stan π
π BUGS π
okay bestie, read this part carefully because it's giving cautionary tale:
- limiting
memoryusemay kill the machine due to thrashing. like, the whole machine. not a drill π - the
readiopsandwriteiopscounters are only approximations. likereadbpsandwritebps, they are calculated in the filesystem layer, where it is difficult or even impossible to observe actual disk device operations. she's doing her best with what she's got π - the
writebpsandwriteiopsresources generally account for writes to the filesystem cache, not to actual devices. just so you know. no cap.
and that's the page, bestie!! π¦ this one was brought to you by the Debian build, dated February 26, 2018 β go forth and allocate responsibly, mwah πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2009 Edward Tomasz Napierala
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms