summaryrefslogtreecommitdiffstats
path: root/bin/ps
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2004-06-23 11:56:57 +0000
committergad <gad@FreeBSD.org>2004-06-23 11:56:57 +0000
commit124619453d9830687c7c3ea9546afc1d026ad6db (patch)
treed9f09cce579e6e640c53fd88d01c1705b3a5f9e3 /bin/ps
parenteb9807848c2e4258f5d8291faf1b0bfc00e57d34 (diff)
downloadFreeBSD-src-124619453d9830687c7c3ea9546afc1d026ad6db.zip
FreeBSD-src-124619453d9830687c7c3ea9546afc1d026ad6db.tar.gz
Make sure the value of "upr" (scheduling priority on return from system call)
is scaled in the same way that "pri" (scheduling priority) is scaled. Submitted by: Cyrille Lefevre
Diffstat (limited to 'bin/ps')
-rw-r--r--bin/ps/extern.h1
-rw-r--r--bin/ps/keyword.c3
-rw-r--r--bin/ps/print.c14
3 files changed, 15 insertions, 3 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h
index 3642fc9..7e877f4 100644
--- a/bin/ps/extern.h
+++ b/bin/ps/extern.h
@@ -82,6 +82,7 @@ void tdev(KINFO *, VARENT *);
void tname(KINFO *, VARENT *);
void ucomm(KINFO *, VARENT *);
void uname(KINFO *, VARENT *);
+void upr(KINFO *, VARENT *);
void vsize(KINFO *, VARENT *);
void wchan(KINFO *, VARENT *);
__END_DECLS
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 6764b90..8a1726a 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -197,8 +197,7 @@ static VAR var[] = {
0},
{"uid", "UID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_uid), UINT,
UIDFMT, 0},
- {"upr", "UPR", NULL, 0, kvar, NULL, 3, KOFF(ki_pri.pri_user), UCHAR,
- "d", 0},
+ {"upr", "UPR", NULL, 0, upr, NULL, 3, 0, CHAR, NULL, 0},
{"uprocp", "UPROCP", NULL, 0, kvar, NULL, 8, KOFF(ki_paddr), KPTR,
"lx", 0},
{"user", "USER", NULL, LJUST|DSIZ, uname, s_uname, USERLEN, 0, CHAR,
diff --git a/bin/ps/print.c b/bin/ps/print.c
index de5c69b..0f2b14a 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -265,14 +265,26 @@ state(KINFO *k, VARENT *ve)
(void)printf("%-*s", v->width, buf);
}
+#define scalepri(x) ((x) - PZERO)
+
void
pri(KINFO *k, VARENT *ve)
{
VAR *v;
v = ve->var;
- (void)printf("%*d", v->width, k->ki_p->ki_pri.pri_level - PZERO);
+ (void)printf("%*d", v->width, scalepri(k->ki_p->ki_pri.pri_level));
+}
+
+void
+upr(KINFO *k, VARENT *ve)
+{
+ VAR *v;
+
+ v = ve->var;
+ (void)printf("%*d", v->width, scalepri(k->ki_p->ki_pri.pri_user));
}
+#undef scalepri
void
uname(KINFO *k, VARENT *ve)
OpenPOWER on IntegriCloud