55 lines
1.8 KiB
Diff
55 lines
1.8 KiB
Diff
From 35dc38cb7fcfb71b151a020abb16197b88370337 Mon Sep 17 00:00:00 2001
|
|
From: Jim Warner <james.warner@comcast.net>
|
|
Date: Wed, 24 May 2023 00:00:00 -0500
|
|
Subject: [PATCH 1/3] ps: address missing or corrupted fields with -m option
|
|
|
|
Coincidentally, a Debian bug report and a gitlab issue
|
|
were raised at nearly the same time and are referenced
|
|
below. They both dealt with that '-m' (thread) option.
|
|
|
|
That option forces tasks and their threads to be shown
|
|
on separate lines. Also, information may be suppressed
|
|
between that main process and any lightweight process.
|
|
|
|
The bottom line was sometimes a required pids_item may
|
|
not have been requested from the library before trying
|
|
to display a result. For the best case, some incorrect
|
|
results might be shown. However, in the worst case (as
|
|
with PIDS_WCHAN_NAME) a segmentation fault is created.
|
|
|
|
[ After addressing the '-m' option problems, another ]
|
|
[ issue was found with that '-F' (extra full format) ]
|
|
[ option. The PSR (processor) field was always zero. ]
|
|
[ It was addressed in a similar manner to the above. ]
|
|
|
|
Reference(s):
|
|
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1036631
|
|
https://gitlab.com/procps-ng/procps/-/issues/279
|
|
|
|
Signed-off-by: Jim Warner <james.warner@comcast.net>
|
|
---
|
|
src/ps/display.c | 7 +++++++
|
|
1 file changed, 7 insertions(+)
|
|
|
|
diff --git a/src/ps/display.c b/src/ps/display.c
|
|
index 4207cf87..46ac844f 100644
|
|
--- a/src/ps/display.c
|
|
+++ b/src/ps/display.c
|
|
@@ -600,6 +600,13 @@ static void finalize_stacks (void)
|
|
// special items with 'extra' used as former pcpu
|
|
chkREL(extra)
|
|
chkREL(noop)
|
|
+ // lastly, any remaining needs ...
|
|
+ if (format_flags & FF_Uf)
|
|
+ chkREL(PROCESSOR);
|
|
+ if (thread_flags & TF_U_m) {
|
|
+ chkREL(PRIORITY);
|
|
+ chkREL(WCHAN_NAME);
|
|
+ }
|
|
|
|
// now accommodate any results not yet satisfied
|
|
f_node = format_list;
|
|
--
|
|
2.33.0
|
|
|