RCTL_ADD_RULE(2) | System Calls Manual | RCTL_ADD_RULE(2) |
rctl_add_rule
,
rctl_get_limits
,
rctl_get_racct
,
rctl_get_rules
,
rctl_remove_rule
—
manipulate and query the resource limits
database
Standard C Library (libc, -lc)
#include
<sys/rctl.h>
int
rctl_add_rule
(const char
*inbufp, size_t inbuflen, char
*outbufp, size_t outbuflen);
int
rctl_get_limits
(const char
*inbufp, size_t inbuflen, char
*outbufp, size_t outbuflen);
int
rctl_get_racct
(const char
*inbufp, size_t inbuflen, char
*outbufp, size_t outbuflen);
int
rctl_get_rules
(const char
*inbufp, size_t inbuflen, char
*outbufp, size_t outbuflen);
int
rctl_remove_rule
(const char
*inbufp, size_t inbuflen, char
*outbufp, size_t outbuflen);
These system calls are used to manipulate and query the resource limits database. For all functions, inbuflen refers to the length of the buffer pointed to by inbufp and outbuflen refers to the length of the buffer pointed to by outbufp.
The
rctl_add_rule
()
function adds the rule pointed to by inbufp to the
resource limits database. The outbufp and
outbuflen arguments are unused. Rule format is as
described in rctl(8), with exceptions noted in the
RULES AND FILTERS section.
The
rctl_get_limits
()
function returns in outbufp a comma-separated list of
rules that apply to the process that matches the filter specified in
inbufp. This includes rules with a subject of the
process itself as well as rules with a different subject (such as user or
loginclass) that apply to the process.
The
rctl_get_racct
()
function returns resource usage information for a given subject. The subject
is specified by passing a filter in inbufp. Filter
syntax is as described in rctl(8), with exceptions noted
in the RULES AND FILTERS
section. A comma-separated list of resources and the amount used of each by
the specified subject is returned in outbufp. The
resource and amount is formatted as "resource=amount".
The
rctl_get_rules
()
function returns in outbufp a comma-separated list of
rules from the resource limits database that match the filter passed in
inbufp. Filter syntax is as described in
rctl(8), with exceptions noted in the
RULES AND FILTERS section. A
filter of :: may be passed to return all rules.
The
rctl_remove_rule
()
function removes all rules matching the filter passed in
inbufp from the resource limits database. Filter
syntax is as described in rctl(8), with exceptions noted
in the RULES AND FILTERS
section. outbufp and outbuflen
are unused.
This section explains how the rule and filter format described in rctl(8) differs from the format passed to the system calls themselves. The rctl tool provides several conveniences that the system calls do not. When using the system call:
user
’ to
‘u
’ is not acceptable.root
’ must be expressed as
‘0
’.1024
’ and not
‘1k
’.Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
The rctl system calls may fail if:
ENOSYS
]EINVAL
]EPERM
]E2BIG
]ESRCH
]ENAMETOOLONG
]ERANGE
]EOPNOTSUPP
]EFAULT
]The rctl family of system calls appeared in FreeBSD 9.0.
The rctl system calls were developed by Edward Tomasz Napierala <trasz@FreeBSD.org> under sponsorship from the FreeBSD Foundation. This manual page was written by Eric Badger <badger@FreeBSD.org>.
September 14, 2016 | Debian |