summaryrefslogtreecommitdiffstats
path: root/bin/ps/print.c
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2011-03-05 14:41:49 +0000
committertrasz <trasz@FreeBSD.org>2011-03-05 14:41:49 +0000
commit1618438630910db9238a8bf1808fd696eba7c86f (patch)
tree24572b457547ac678a031b594014ab4d5aa60b4a /bin/ps/print.c
parent1a2c2ccf00d839e96bbb9cb391027b14ec4e0d05 (diff)
downloadFreeBSD-src-1618438630910db9238a8bf1808fd696eba7c86f.zip
FreeBSD-src-1618438630910db9238a8bf1808fd696eba7c86f.tar.gz
Export login class information via kinfo and make it possible to view
it using "ps -o class".
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r--bin/ps/print.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 5aa27c0..46b979b 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -862,6 +862,26 @@ out:
return;
}
+void
+loginclass(KINFO *k, VARENT *ve)
+{
+ VAR *v;
+ char *s;
+
+ v = ve->var;
+ /*
+ * Don't display login class for system processes;
+ * login classes are used for resource limits,
+ * and limits don't apply to system processes.
+ */
+ if (k->ki_p->ki_flag & P_SYSTEM) {
+ (void)printf("%-*s", v->width, " -");
+ return;
+ }
+ s = k->ki_p->ki_loginclass;
+ (void)printf("%-*s", v->width, *s ? s : "-");
+}
+
int
s_comm(KINFO *k)
{
OpenPOWER on IntegriCloud