opnsense-src/bin/ps
Jamie Landeg-Jones e7eef56c69 /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 <jamie@catflap.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/2064
(cherry picked from commit 9006a731bc951c5b62efc4bf75a0c5b42586d279)
2026-04-30 13:05:11 +08:00
..
extern.h ps(1): Remove not-explicitly-requested columns with duplicate data 2025-04-28 13:57:52 +02:00
fmt.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
keyword.c /bin/ps: Fix display of negative nice values on ARMv7/aarch64 2026-04-30 13:05:11 +08:00
Makefile ps(1): Aliases: Resolve once, merge specifications 2025-04-28 13:57:01 +02:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
nlist.c bin: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
print.c /bin/ps: Fix display of negative nice values on ARMv7/aarch64 2026-04-30 13:05:11 +08:00
ps.1 manpages: prefer linking to xo_options.7 over xo_parse_args.3 2025-07-16 12:02:24 -06:00
ps.c ps(1): Sort headers 2026-02-19 13:28:49 +01:00
ps.h /bin/ps: Fix display of negative nice values on ARMv7/aarch64 2026-04-30 13:05:11 +08:00