Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jun 2025 02:13:40 GMT
From:      Olivier Certner <olce@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1d8f8f3e36fa - main - ps(1), top(1): Priority: Let 0 be the first timesharing level
Message-ID:  <202506180213.55I2DeDL024942@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=1d8f8f3e36fafdb50613d042f5fa75d8cbcf2b8f

commit 1d8f8f3e36fafdb50613d042f5fa75d8cbcf2b8f
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-09-09 19:35:16 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-06-18 02:09:39 +0000

    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 2f17abdfdde2..f59e843effc1 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 07a7119ad0c2..8c035b5df383 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)));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202506180213.55I2DeDL024942>