From 1d8f8f3e36fafdb50613d042f5fa75d8cbcf2b8f Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Mon, 9 Sep 2024 21:35:16 +0200 Subject: [PATCH] ps(1), top(1): Priority: Let 0 be the first timesharing level Change the origin from PZERO to PUSER. Doing so allows users to immediately detect if some thread is running under a high priority (kernel or realtime) or under a low one (timesharing or idle). MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation --- bin/ps/print.c | 2 +- usr.bin/top/machine.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ps/print.c b/bin/ps/print.c index 2f17abdfdde..f59e843effc 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -277,7 +277,7 @@ state(KINFO *k, VARENT *ve __unused) return (buf); } -#define scalepri(x) ((x) - PZERO) +#define scalepri(x) ((x) - PUSER) char * pri(KINFO *k, VARENT *ve __unused) diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index 07a7119ad0c..8c035b5df38 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -1134,7 +1134,7 @@ format_next_process(struct handle * xhandle, char *(*get_userid)(int), int flags sbuf_printf(procbuf, " "); } - sbuf_printf(procbuf, "%3d ", pp->ki_pri.pri_level - PZERO); + sbuf_printf(procbuf, "%3d ", pp->ki_pri.pri_level - PUSER); sbuf_printf(procbuf, "%4s", format_nice(pp)); sbuf_printf(procbuf, "%7s ", format_k(PROCSIZE(pp))); sbuf_printf(procbuf, "%6s ", format_k(pagetok(pp->ki_rssize)));