Rename resource names to match these in login.conf.
This commit is contained in:
parent
0a7d45d349
commit
85a2f1b4f2
@ -103,7 +103,7 @@ SDT_PROBE_DEFINE2(racct, kernel, racct, leave, leave, "struct racct *",
|
||||
|
||||
int racct_types[] = {
|
||||
[RACCT_CPU] =
|
||||
RACCT_IN_THOUSANDS,
|
||||
RACCT_IN_MILLIONS,
|
||||
[RACCT_DATA] =
|
||||
RACCT_RECLAIMABLE | RACCT_INHERITABLE | RACCT_DENIABLE,
|
||||
[RACCT_STACK] =
|
||||
@ -141,7 +141,7 @@ int racct_types[] = {
|
||||
[RACCT_SHMSIZE] =
|
||||
RACCT_RECLAIMABLE | RACCT_DENIABLE | RACCT_SLOPPY,
|
||||
[RACCT_WALLCLOCK] =
|
||||
RACCT_IN_THOUSANDS };
|
||||
RACCT_IN_MILLIONS };
|
||||
|
||||
static void
|
||||
racct_add_racct(struct racct *dest, const struct racct *src)
|
||||
|
@ -99,17 +99,17 @@ static struct dict subjectnames[] = {
|
||||
{ NULL, -1 }};
|
||||
|
||||
static struct dict resourcenames[] = {
|
||||
{ "cpu", RACCT_CPU },
|
||||
{ "data", RACCT_DATA },
|
||||
{ "stack", RACCT_STACK },
|
||||
{ "core", RACCT_CORE },
|
||||
{ "rss", RACCT_RSS },
|
||||
{ "memlock", RACCT_MEMLOCK },
|
||||
{ "nproc", RACCT_NPROC },
|
||||
{ "nofile", RACCT_NOFILE },
|
||||
{ "vmem", RACCT_VMEM },
|
||||
{ "npts", RACCT_NPTS },
|
||||
{ "swap", RACCT_SWAP },
|
||||
{ "cputime", RACCT_CPU },
|
||||
{ "datasize", RACCT_DATA },
|
||||
{ "stacksize", RACCT_STACK },
|
||||
{ "coredumpsize", RACCT_CORE },
|
||||
{ "memoryuse", RACCT_RSS },
|
||||
{ "memorylocked", RACCT_MEMLOCK },
|
||||
{ "maxproc", RACCT_NPROC },
|
||||
{ "openfiles", RACCT_NOFILE },
|
||||
{ "vmemoryuse", RACCT_VMEM },
|
||||
{ "pseudoterminals", RACCT_NPTS },
|
||||
{ "swapuse", RACCT_SWAP },
|
||||
{ "nthr", RACCT_NTHR },
|
||||
{ "msgqqueued", RACCT_MSGQQUEUED },
|
||||
{ "msgqsize", RACCT_MSGQSIZE },
|
||||
@ -907,7 +907,7 @@ rctl_string_to_rule(char *rulestr, struct rctl_rule **rulep)
|
||||
error = str2int64(amountstr, &rule->rr_amount);
|
||||
if (error != 0)
|
||||
goto out;
|
||||
if (RACCT_IS_IN_THOUSANDS(rule->rr_resource))
|
||||
if (RACCT_IS_IN_MILLIONS(rule->rr_resource))
|
||||
rule->rr_amount *= 1000;
|
||||
}
|
||||
|
||||
@ -1152,8 +1152,8 @@ rctl_rule_to_sbuf(struct sbuf *sb, const struct rctl_rule *rule)
|
||||
|
||||
amount = rule->rr_amount;
|
||||
if (amount != RCTL_AMOUNT_UNDEFINED &&
|
||||
RACCT_IS_IN_THOUSANDS(rule->rr_resource))
|
||||
amount /= 1000;
|
||||
RACCT_IS_IN_MILLIONS(rule->rr_resource))
|
||||
amount /= 1000000;
|
||||
|
||||
sbuf_printf(sb, "%s:%s=%jd",
|
||||
rctl_resource_name(rule->rr_resource),
|
||||
@ -1222,7 +1222,7 @@ rctl_racct_to_sbuf(struct racct *racct, int sloppy)
|
||||
if (sloppy == 0 && RACCT_IS_SLOPPY(i))
|
||||
continue;
|
||||
amount = racct->r_resources[i];
|
||||
if (RACCT_IS_IN_THOUSANDS(i))
|
||||
if (RACCT_IS_IN_MILLIONS(i))
|
||||
amount /= 1000;
|
||||
sbuf_printf(sb, "%s=%jd,", rctl_resource_name(i), amount);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ struct ucred;
|
||||
/*
|
||||
* Resource properties.
|
||||
*/
|
||||
#define RACCT_IN_THOUSANDS 0x01
|
||||
#define RACCT_IN_MILLIONS 0x01
|
||||
#define RACCT_RECLAIMABLE 0x02
|
||||
#define RACCT_INHERITABLE 0x04
|
||||
#define RACCT_DENIABLE 0x08
|
||||
@ -82,11 +82,11 @@ struct ucred;
|
||||
extern int racct_types[];
|
||||
|
||||
/*
|
||||
* Amount stored in c_resources[] is thousand times bigger than what's
|
||||
* Amount stored in c_resources[] is 10**6 times bigger than what's
|
||||
* visible to the userland. It gets fixed up when retrieving resource
|
||||
* usage or adding rules.
|
||||
*/
|
||||
#define RACCT_IS_IN_THOUSANDS(X) (racct_types[X] & RACCT_IN_THOUSANDS)
|
||||
#define RACCT_IS_IN_MILLIONS(X) (racct_types[X] & RACCT_IN_MILLIONS)
|
||||
|
||||
/*
|
||||
* Resource usage can drop, as opposed to only grow.
|
||||
|
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 26, 2011
|
||||
.Dd July 14, 2011
|
||||
.Dt RCTL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -121,32 +121,31 @@ A filter that matches all defined rules for nproc resource would be
|
||||
"::nproc".
|
||||
.Pp
|
||||
.Sh RESOURCES
|
||||
.Bl -column -offset 3n "msgqqueued"
|
||||
.It cpu CPU time, in milliseconds
|
||||
.It data data size, in bytes
|
||||
.It stack stack size, in bytes
|
||||
.It core core dump size, in bytes
|
||||
.It rss resident set size, in bytes
|
||||
.It memlock locked memory, in bytes
|
||||
.It nproc number of processes
|
||||
.It nofile file descriptor table size
|
||||
.It vmem address space limit, in bytes
|
||||
.It npts number of PTYs
|
||||
.It swap swap usage, in bytes
|
||||
.It nthr number of threads
|
||||
.It msgqqueued number of queued SysV messages
|
||||
.It msgqsize SysV message queue size, in bytes
|
||||
.It nmsgq number of SysV message queues
|
||||
.It nsem number of SysV semaphores
|
||||
.It nsemop number of SysV semaphores modified in a single semop(2) call
|
||||
.It nshm number of SysV shared memory segments
|
||||
.It shmsize SysV shared memory size, in bytes
|
||||
.It wallclock wallclock time, in milliseconds
|
||||
.It pctcpu %cpu time
|
||||
.Bl -column -offset 3n "pseudoterminals"
|
||||
.It cputime CPU time, in seconds
|
||||
.It datasize data size, in bytes
|
||||
.It stacksize stack size, in bytes
|
||||
.It coredumpsize core dump size, in bytes
|
||||
.It memoryuse resident set size, in bytes
|
||||
.It memorylocked locked memory, in bytes
|
||||
.It maxproc number of processes
|
||||
.It openfiles file descriptor table size
|
||||
.It vmemoryuse address space limit, in bytes
|
||||
.It pseudoterminals number of PTYs
|
||||
.It swapuse swap usage, in bytes
|
||||
.It nthr number of threads
|
||||
.It msgqqueued number of queued SysV messages
|
||||
.It msgqsize SysV message queue size, in bytes
|
||||
.It nmsgq number of SysV message queues
|
||||
.It nsem number of SysV semaphores
|
||||
.It nsemop number of SysV semaphores modified in a single semop(2) call
|
||||
.It nshm number of SysV shared memory segments
|
||||
.It shmsize SysV shared memory size, in bytes
|
||||
.It wallclock wallclock time, in seconds
|
||||
.El
|
||||
.Pp
|
||||
.Sh ACTIONS
|
||||
.Bl -column -offset 3n "msgqqueued"
|
||||
.Bl -column -offset 3n "pseudoterminals"
|
||||
.It deny deny the allocation; not supported for cpu and wallclock
|
||||
.It log log a warning to the console
|
||||
.It devctl send notification to
|
||||
@ -167,7 +166,7 @@ Note that limiting RSS may kill the machine due to thrashing.
|
||||
.Sh EXIT STATUS
|
||||
.Ex -std
|
||||
.Sh EXAMPLES
|
||||
.Dl rctl -a user:joe:vmem:deny=1g
|
||||
.Dl rctl -a user:joe:vmemoryuse:deny=1g
|
||||
.Pp
|
||||
Prevent user "joe" from allocating more than 1GB of virtual memory.
|
||||
.Pp
|
||||
|
Loading…
Reference in New Issue
Block a user