From nobody Thu Apr 30 05:06:53 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4g5hwz2qvKz6ZTQt for ; Thu, 30 Apr 2026 05:06:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g5hwz002qz3Y3h for ; Thu, 30 Apr 2026 05:06:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777525619; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NzZgLukYRiK9dWcqeZULrWixouyFBZW+16B7ZqsiQS0=; b=pedt2WCpSyuvpcKD58ejvAeXrWBXAO4NcCxxqZCC8i0YneNP+PDRSeSWi9Npww6kPAiIbb EQQ3OS1TdCTCWU0hhXfh6N5wkyLhBgRnfMpoCKbvSBhFV1mIABu+duzN6G8hkK0A1y7UxA UBm9t24qb8qGxGmoqfTbse+qf1Y3RP0Q7/zYKQRLRvQbvHyhm/+uSsKaIqztPhWRuAftYP 7qwLYBel+ZJdkk6wU/SYdp8sgvwiQ/XlQ0KB5pADi+RuQRzHsT6CEhgTrQTglIvgEgF4q1 3dzRyKVjQNCTq3QJnhgytQ+GkJTtjH/dDUOFSyd9IvZ5tLN8N5dv0potaaf8TA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777525619; a=rsa-sha256; cv=none; b=ORzBndgWEQ1kHGu7GtLAoj14N84W4rwS+IFzjGdddHWhs7qlPDI5z3YtovqQBeeteREMp7 l14a+pgSvWPgbfS2h5RkN/GbI0ac15Ay1FIJ1mQHswmaSh9Q3HMULqsrVgDG704nhGeQFS 5Fx+0jxl6kdGGbAwLrh/e/HXLZ7/K4ze0Pm8BcmG3mMS08o86eohvaLABKTCiw3K5jRPkA ZyLHH2khNqKYrZJuANdm4El+hzfhRyjXR5C5FHQ/VrAlOR2zo4RUBgb5fW5rMBuH2c02x3 hg01hOyjTGx39RwlTlT4ESdvepB2fyl2DXWEhqrFH5JCc4Zz7EZAohwMhgD6UA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777525619; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NzZgLukYRiK9dWcqeZULrWixouyFBZW+16B7ZqsiQS0=; b=o6YJyIL/NhvoeKN36Ahs+Cqxjr2U8SyLK5m4hNIfUNySTMQnBIPr7DwFbO2x3rk4A0AQP5 hZKTozMcJ9oSCDanuUGXVDMNEdP3ah8gGEHtPoO2S/i2ZnVOITSdTLXErrPLvmgmF94LQa LGeO55+j3MMUywuvM7PpxXT01Wh4DRX/341Oqx/Bs+W3ucqZKJlRleCDfKowhfTPks7Zf8 ve5DUXeCU0olKMXGQ7FQbjQ4xEw/ONPPrWkH7O3+A5sbk09MY9ETXsNDwULY3gy+oF4jzQ l9gHC86EFlsbkf/rR0iNH1MHcAaDyupvKbSA2lclD3lie59bpU+Hq/mzhbyS0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g5hwy63CMz1Bs3 for ; Thu, 30 Apr 2026 05:06:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 20819 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 30 Apr 2026 05:06:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Jamie Landeg-Jones From: Zhenlei Huang Subject: git: e7eef56c6982 - stable/15 - /bin/ps: Fix display of negative nice values on ARMv7/aarch64 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: e7eef56c6982f0f67789365b5e337e5cafb7fe91 Auto-Submitted: auto-generated Date: Thu, 30 Apr 2026 05:06:53 +0000 Message-Id: <69f2e36d.20819.5ff48dd5@gitrepo.freebsd.org> The branch stable/15 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=e7eef56c6982f0f67789365b5e337e5cafb7fe91 commit e7eef56c6982f0f67789365b5e337e5cafb7fe91 Author: Jamie Landeg-Jones AuthorDate: 2026-03-07 01:18:20 +0000 Commit: Zhenlei Huang CommitDate: 2026-04-30 05:05:11 +0000 /bin/ps: Fix display of negative nice values on ARMv7/aarch64 On Arm-based systems (and maybe others), 'char' defaults to unsigned, causing negative nice values to be displayed incorrectly (e.g., 246 instead of -10). Explicitly using 'signed char' ensures consistent behaviour across architectures. [ tested on RPI2 and generic aarch64 qemu install ] Before: # /usr/bin/nice --10 ps -l | awk '(NR == 1 || $(NF-1) == "ps")' UID PID PPID C PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND 0 23606 22800 2 -32 246 5400 2544 - R<+ 0 0:00.06 ps -l After: # /usr/bin/nice --10 ps -l | awk '(NR == 1 || $(NF-1) == "ps")' UID PID PPID C PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND 0 23614 22800 3 -32 -10 5400 2544 - R<+ 0 0:00.05 ps -l Signed-off-by: Jamie Landeg-Jones Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/2064 (cherry picked from commit 9006a731bc951c5b62efc4bf75a0c5b42586d279) --- bin/ps/keyword.c | 2 +- bin/ps/print.c | 3 +++ bin/ps/ps.h | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 0562fd2e4f9d..d7790f9f8c48 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -133,7 +133,7 @@ static VAR keywords[] = { {"mwchan", {NULL}, "MWCHAN", "wait-channel", LJUST, mwchan, 0, UNSPEC, NULL}, {"ni", {"nice"}, NULL, NULL, 0, NULL, 0, UNSPEC, NULL}, - {"nice", {NULL}, "NI", "nice", 0, kvar, KOFF(ki_nice), CHAR, "d"}, + {"nice", {NULL}, "NI", "nice", 0, kvar, KOFF(ki_nice), SCHAR, "d"}, {"nivcsw", {NULL}, "NIVCSW", "involuntary-context-switches", USER, rvar, ROFF(ru_nivcsw), LONG, "ld"}, {"nlwp", {NULL}, "NLWP", "threads", 0, kvar, KOFF(ki_numthreads), diff --git a/bin/ps/print.c b/bin/ps/print.c index f59e843effc1..9705d0c07419 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -754,6 +754,9 @@ printval(void *bp, const VAR *v) case CHAR: (void)asprintf(&str, ofmt, *(char *)bp); break; + case SCHAR: + (void)asprintf(&str, ofmt, *(signed char *)bp); + break; case UCHAR: (void)asprintf(&str, ofmt, *(u_char *)bp); break; diff --git a/bin/ps/ps.h b/bin/ps/ps.h index 065a4c1f1c54..8352f3450f93 100644 --- a/bin/ps/ps.h +++ b/bin/ps/ps.h @@ -33,7 +33,7 @@ #define UNLIMITED 0 /* unlimited terminal width */ enum type { UNSPEC, /* For output routines that don't care and aliases. */ - CHAR, UCHAR, SHORT, USHORT, INT, UINT, LONG, ULONG, KPTR, PGTOK }; + CHAR, SCHAR, UCHAR, SHORT, USHORT, INT, UINT, LONG, ULONG, KPTR, PGTOK }; typedef struct kinfo_str { STAILQ_ENTRY(kinfo_str) ks_next;