diff options
author | Lorenzo Salvadore <salvadore@FreeBSD.org> | 2020-06-19 09:27:58 +0000 |
---|---|---|
committer | Lorenzo Salvadore <salvadore@FreeBSD.org> | 2020-06-19 09:27:58 +0000 |
commit | 50301bb0a1090bfdffc6b4322283bdefbe80b98f (patch) | |
tree | a1738ad5d6b6546c2adbb73e27bc221dd2504f91 /bin/ps | |
parent | 204fa3b0669788bbd054f3faf4ea6b7ea0ae4d5b (diff) |
bin/ps: Make the rtprio option actually show realtime priorities
Fix the rtprio option that for some reason was progessively becoming an
option showing the priority class of threads. In particular:
- use the constants defined in sys/sys/rtprio.h instead of those defined in
sys/sys/priority.h: this helps making clearer that the code actually is
about realtime priorities and not standard scheduler priorities;
- remove the PRI_ITHD case that has nothing to do with realtime priorities;
- convert the priority levels to realtime priority levels using the same
formulas used for pri_to_rtp function in sys/kern/kern_resource.c.
- remove outdated note "101 = not a realtime process" in the man page and
replace it with a more useful reference to man 1 rtprio.
Approved by: src (mckusick), manpages (bcr), gerald (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25266
Notes
Notes:
svn path=/head/; revision=362369
Diffstat (limited to 'bin/ps')
-rw-r--r-- | bin/ps/print.c | 18 | ||||
-rw-r--r-- | bin/ps/ps.1 | 3 |
2 files changed, 11 insertions, 10 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c index 3fdc6d9db938..98a0142031d4 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -704,17 +704,17 @@ priorityr(KINFO *k, VARENT *ve __unused) class = lpri->pri_class; level = lpri->pri_level; switch (class) { - case PRI_ITHD: - asprintf(&str, "intr:%u", level); + case RTP_PRIO_REALTIME: + /* alias for PRI_REALTIME */ + asprintf(&str, "real:%u", level - PRI_MIN_REALTIME); break; - case PRI_REALTIME: - asprintf(&str, "real:%u", level); + case RTP_PRIO_NORMAL: + /* alias for PRI_TIMESHARE */ + asprintf(&str, "normal:%u", level - PRI_MIN_TIMESHARE); break; - case PRI_TIMESHARE: - asprintf(&str, "normal"); - break; - case PRI_IDLE: - asprintf(&str, "idle:%u", level); + case RTP_PRIO_IDLE: + /* alias for PRI_IDLE */ + asprintf(&str, "idle:%u", level - PRI_MIN_IDLE); break; default: asprintf(&str, "%u:%u", class, level); diff --git a/bin/ps/ps.1 b/bin/ps/ps.1 index dc8eddfb93dc..d3d279d76d43 100644 --- a/bin/ps/ps.1 +++ b/bin/ps/ps.1 @@ -648,7 +648,8 @@ group name (from rgid) .It Cm rss resident set size .It Cm rtprio -realtime priority (101 = not a realtime process) +realtime priority (see +.Xr rtprio 1) .It Cm ruid real user ID .It Cm ruser |