summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2011-07-14 19:18:17 +0000
committertrasz <trasz@FreeBSD.org>2011-07-14 19:18:17 +0000
commit13232d13fa339d313d811ac67798ce58ae73cc33 (patch)
tree58d02ef7888894f8eff47c14c682af6fdc0584dc
parent4055dcbe1cacf8618218d189236613d83963d5ee (diff)
downloadFreeBSD-src-13232d13fa339d313d811ac67798ce58ae73cc33.zip
FreeBSD-src-13232d13fa339d313d811ac67798ce58ae73cc33.tar.gz
Rename resource names to match these in login.conf.
-rw-r--r--sys/kern/kern_racct.c4
-rw-r--r--sys/kern/kern_rctl.c30
-rw-r--r--sys/sys/racct.h6
-rw-r--r--usr.bin/rctl/rctl.849
4 files changed, 44 insertions, 45 deletions
diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c
index d905339..401ce1d 100644
--- a/sys/kern/kern_racct.c
+++ b/sys/kern/kern_racct.c
@@ -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)
diff --git a/sys/kern/kern_rctl.c b/sys/kern/kern_rctl.c
index 5fddbbb..a939758 100644
--- a/sys/kern/kern_rctl.c
+++ b/sys/kern/kern_rctl.c
@@ -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);
}
diff --git a/sys/sys/racct.h b/sys/sys/racct.h
index 9e6907d..119b333 100644
--- a/sys/sys/racct.h
+++ b/sys/sys/racct.h
@@ -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.
diff --git a/usr.bin/rctl/rctl.8 b/usr.bin/rctl/rctl.8
index 98c9d4e..f8f8ddb 100644
--- a/usr.bin/rctl/rctl.8
+++ b/usr.bin/rctl/rctl.8
@@ -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
OpenPOWER on IntegriCloud