1*8269e767SBrooks Davis.\" Copyright (c) 2016 Eric Badger 2*8269e767SBrooks Davis.\" All rights reserved. 3*8269e767SBrooks Davis.\" 4*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without 5*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions 6*8269e767SBrooks Davis.\" are met: 7*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 8*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer. 9*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 10*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 11*8269e767SBrooks Davis.\" documentation and/or other materials provided with the distribution. 12*8269e767SBrooks Davis.\" 13*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14*8269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15*8269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16*8269e767SBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17*8269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18*8269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19*8269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20*8269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21*8269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22*8269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23*8269e767SBrooks Davis.\" SUCH DAMAGE. 24*8269e767SBrooks Davis.\" 25*8269e767SBrooks Davis.Dd September 14, 2016 26*8269e767SBrooks Davis.Dt RCTL_ADD_RULE 2 27*8269e767SBrooks Davis.Os 28*8269e767SBrooks Davis.Sh NAME 29*8269e767SBrooks Davis.Nm rctl_add_rule , 30*8269e767SBrooks Davis.Nm rctl_get_limits , 31*8269e767SBrooks Davis.Nm rctl_get_racct , 32*8269e767SBrooks Davis.Nm rctl_get_rules , 33*8269e767SBrooks Davis.Nm rctl_remove_rule 34*8269e767SBrooks Davis.Nd manipulate and query the resource limits database 35*8269e767SBrooks Davis.Sh LIBRARY 36*8269e767SBrooks Davis.Lb libc 37*8269e767SBrooks Davis.Sh SYNOPSIS 38*8269e767SBrooks Davis.In sys/rctl.h 39*8269e767SBrooks Davis.Ft int 40*8269e767SBrooks Davis.Fo rctl_add_rule 41*8269e767SBrooks Davis.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen" 42*8269e767SBrooks Davis.Fc 43*8269e767SBrooks Davis.Ft int 44*8269e767SBrooks Davis.Fo rctl_get_limits 45*8269e767SBrooks Davis.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen" 46*8269e767SBrooks Davis.Fc 47*8269e767SBrooks Davis.Ft int 48*8269e767SBrooks Davis.Fo rctl_get_racct 49*8269e767SBrooks Davis.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen" 50*8269e767SBrooks Davis.Fc 51*8269e767SBrooks Davis.Ft int 52*8269e767SBrooks Davis.Fo rctl_get_rules 53*8269e767SBrooks Davis.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen" 54*8269e767SBrooks Davis.Fc 55*8269e767SBrooks Davis.Ft int 56*8269e767SBrooks Davis.Fo rctl_remove_rule 57*8269e767SBrooks Davis.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen" 58*8269e767SBrooks Davis.Fc 59*8269e767SBrooks Davis.Sh DESCRIPTION 60*8269e767SBrooks DavisThese system calls are used to manipulate and query the resource limits 61*8269e767SBrooks Davisdatabase. 62*8269e767SBrooks DavisFor all functions, 63*8269e767SBrooks Davis.Fa inbuflen 64*8269e767SBrooks Davisrefers to the length of the buffer pointed to by 65*8269e767SBrooks Davis.Fa inbufp 66*8269e767SBrooks Davisand 67*8269e767SBrooks Davis.Fa outbuflen 68*8269e767SBrooks Davisrefers to the length of the buffer pointed to by 69*8269e767SBrooks Davis.Fa outbufp . 70*8269e767SBrooks Davis.Pp 71*8269e767SBrooks DavisThe 72*8269e767SBrooks Davis.Fn rctl_add_rule 73*8269e767SBrooks Davisfunction adds the rule pointed to by 74*8269e767SBrooks Davis.Fa inbufp 75*8269e767SBrooks Davisto the resource limits database. 76*8269e767SBrooks DavisThe 77*8269e767SBrooks Davis.Fa outbufp 78*8269e767SBrooks Davisand 79*8269e767SBrooks Davis.Fa outbuflen 80*8269e767SBrooks Davisarguments are unused. 81*8269e767SBrooks DavisRule format is as described in 82*8269e767SBrooks Davis.Xr rctl 8 , 83*8269e767SBrooks Daviswith exceptions noted in the 84*8269e767SBrooks Davis.Sx RULES AND FILTERS 85*8269e767SBrooks Davissection. 86*8269e767SBrooks Davis.Pp 87*8269e767SBrooks DavisThe 88*8269e767SBrooks Davis.Fn rctl_get_limits 89*8269e767SBrooks Davisfunction returns in 90*8269e767SBrooks Davis.Fa outbufp 91*8269e767SBrooks Davisa comma-separated list of rules that apply to the process that 92*8269e767SBrooks Davismatches the filter specified in 93*8269e767SBrooks Davis.Fa inbufp . 94*8269e767SBrooks DavisThis includes rules with a subject of the process itself as well as rules 95*8269e767SBrooks Daviswith a different subject (such as user or loginclass) that apply to the 96*8269e767SBrooks Davisprocess. 97*8269e767SBrooks Davis.Pp 98*8269e767SBrooks DavisThe 99*8269e767SBrooks Davis.Fn rctl_get_racct 100*8269e767SBrooks Davisfunction returns resource usage information for a given subject. 101*8269e767SBrooks DavisThe subject is specified by passing a filter in 102*8269e767SBrooks Davis.Fa inbufp . 103*8269e767SBrooks DavisFilter syntax is as described in 104*8269e767SBrooks Davis.Xr rctl 8 , 105*8269e767SBrooks Daviswith exceptions noted in the 106*8269e767SBrooks Davis.Sx RULES AND FILTERS 107*8269e767SBrooks Davissection. 108*8269e767SBrooks DavisA comma-separated list of resources and the amount used of each by the 109*8269e767SBrooks Davisspecified subject is returned in 110*8269e767SBrooks Davis.Fa outbufp . 111*8269e767SBrooks DavisThe resource and amount is formatted as 112*8269e767SBrooks Davis.Qq resource=amount . 113*8269e767SBrooks Davis.Pp 114*8269e767SBrooks DavisThe 115*8269e767SBrooks Davis.Fn rctl_get_rules 116*8269e767SBrooks Davisfunction returns in 117*8269e767SBrooks Davis.Fa outbufp 118*8269e767SBrooks Davisa comma-separated list of rules from the resource limits database that 119*8269e767SBrooks Davismatch the filter passed in 120*8269e767SBrooks Davis.Fa inbufp . 121*8269e767SBrooks DavisFilter syntax is as described in 122*8269e767SBrooks Davis.Xr rctl 8 , 123*8269e767SBrooks Daviswith exceptions noted in the 124*8269e767SBrooks Davis.Sx RULES AND FILTERS 125*8269e767SBrooks Davissection. 126*8269e767SBrooks DavisA filter of 127*8269e767SBrooks Davis.Va :: 128*8269e767SBrooks Davismay be passed to return all rules. 129*8269e767SBrooks Davis.Pp 130*8269e767SBrooks DavisThe 131*8269e767SBrooks Davis.Fn rctl_remove_rule 132*8269e767SBrooks Davisfunction removes all rules matching the filter passed in 133*8269e767SBrooks Davis.Fa inbufp 134*8269e767SBrooks Davisfrom the resource limits database. 135*8269e767SBrooks DavisFilter syntax is as described in 136*8269e767SBrooks Davis.Xr rctl 8 , 137*8269e767SBrooks Daviswith exceptions noted in the 138*8269e767SBrooks Davis.Sx RULES AND FILTERS 139*8269e767SBrooks Davissection. 140*8269e767SBrooks Davis.Fa outbufp 141*8269e767SBrooks Davisand 142*8269e767SBrooks Davis.Fa outbuflen 143*8269e767SBrooks Davisare unused. 144*8269e767SBrooks Davis.Sh RULES AND FILTERS 145*8269e767SBrooks DavisThis section explains how the rule and filter format described in 146*8269e767SBrooks Davis.Xr rctl 8 147*8269e767SBrooks Davisdiffers from the format passed to the system calls themselves. 148*8269e767SBrooks DavisThe rctl tool provides several conveniences that the system calls do not. 149*8269e767SBrooks DavisWhen using the system call: 150*8269e767SBrooks Davis.Bl -dash -offset indent 151*8269e767SBrooks Davis.It 152*8269e767SBrooks DavisThe subject must be fully specified. 153*8269e767SBrooks DavisFor example, abbreviating 154*8269e767SBrooks Davis.Ql user 155*8269e767SBrooks Davisto 156*8269e767SBrooks Davis.Ql u 157*8269e767SBrooks Davisis not acceptable. 158*8269e767SBrooks Davis.It 159*8269e767SBrooks DavisUser and group IDs must be numeric. 160*8269e767SBrooks DavisFor example, 161*8269e767SBrooks Davis.Ql root 162*8269e767SBrooks Davismust be expressed as 163*8269e767SBrooks Davis.Ql 0 . 164*8269e767SBrooks Davis.It 165*8269e767SBrooks DavisUnits are not permitted on resource amounts. 166*8269e767SBrooks DavisFor example, a quantity of 1024 bytes must be expressed as 167*8269e767SBrooks Davis.Ql 1024 168*8269e767SBrooks Davisand not 169*8269e767SBrooks Davis.Ql 1k . 170*8269e767SBrooks Davis.El 171*8269e767SBrooks Davis.Sh RETURN VALUES 172*8269e767SBrooks Davis.Rv -std 173*8269e767SBrooks Davis.Sh ERRORS 174*8269e767SBrooks DavisThe rctl system calls may fail if: 175*8269e767SBrooks Davis.Bl -tag -width Er 176*8269e767SBrooks Davis.It Bq Er ENOSYS 177*8269e767SBrooks DavisRACCT/RCTL support is not present in the kernel or the 178*8269e767SBrooks Davis.Va kern.racct.enable 179*8269e767SBrooks Davissysctl is 0. 180*8269e767SBrooks Davis.It Bq Er EINVAL 181*8269e767SBrooks DavisThe rule or filter passed in 182*8269e767SBrooks Davis.Fa inbufp 183*8269e767SBrooks Davisis invalid. 184*8269e767SBrooks Davis.It Bq Er EPERM 185*8269e767SBrooks DavisUser has insufficient privileges to carry out the requested operation. 186*8269e767SBrooks Davis.It Bq Er E2BIG 187*8269e767SBrooks Davis.Fa inbufp 188*8269e767SBrooks Davisor 189*8269e767SBrooks Davis.Fa outbufp 190*8269e767SBrooks Davisare too large. 191*8269e767SBrooks Davis.It Bq Er ESRCH 192*8269e767SBrooks DavisNo process matched the provided rule or filter. 193*8269e767SBrooks Davis.It Bq Er ENAMETOOLONG 194*8269e767SBrooks DavisThe loginclass or jail name specified is too long. 195*8269e767SBrooks Davis.It Bq Er ERANGE 196*8269e767SBrooks DavisThe rule amount is outside of the allowable range or 197*8269e767SBrooks Davis.Fa outbufp 198*8269e767SBrooks Davisis too small. 199*8269e767SBrooks Davis.It Bq Er EOPNOTSUPP 200*8269e767SBrooks DavisThe requested operation is not supported for the given rule or filter. 201*8269e767SBrooks Davis.It Bq Er EFAULT 202*8269e767SBrooks Davis.Fa inbufp 203*8269e767SBrooks Davisor 204*8269e767SBrooks Davis.Fa outbufp 205*8269e767SBrooks Davisrefer to invalid addresses. 206*8269e767SBrooks Davis.El 207*8269e767SBrooks Davis.Sh SEE ALSO 208*8269e767SBrooks Davis.Xr rctl 8 209*8269e767SBrooks Davis.Sh HISTORY 210*8269e767SBrooks DavisThe rctl family of system calls appeared in 211*8269e767SBrooks Davis.Fx 9.0 . 212*8269e767SBrooks Davis.Sh AUTHORS 213*8269e767SBrooks Davis.An -nosplit 214*8269e767SBrooks DavisThe rctl system calls were developed by 215*8269e767SBrooks Davis.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org 216*8269e767SBrooks Davisunder sponsorship from the FreeBSD Foundation. 217*8269e767SBrooks DavisThis manual page was written by 218*8269e767SBrooks Davis.An Eric Badger Aq Mt badger@FreeBSD.org . 219