From e914f4b068ea9778b163b0c98b72162f17ef1cd0 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Wed, 30 Mar 2022 12:00:00 -0500 Subject: [PATCH] ps: restore thread display when using a pidlist option This commit will once again display threads when using the -L option along with any of those pidlist options. Reference(s): https://gitlab.com/procps-ng/procps/-/issues/234 Signed-off-by: Jim Warner --- ps/display.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ps/display.c b/ps/display.c index 75c7d926..2e1cc665 100644 --- a/ps/display.c +++ b/ps/display.c @@ -289,9 +289,12 @@ static void simple_spew(void){ // -q option (only single SEL_PID_QUICK typecode entry expected in the list, if present) if (selection_list && selection_list->typecode == SEL_PID_QUICK) { unsigned *pidlist = xcalloc(selection_list->n, sizeof(unsigned)); + enum pids_select_type which; for (i = 0; i < selection_list->n; i++) pidlist[i] = selection_list->u[selection_list->n-i-1].pid; - pidread = procps_pids_select(Pids_info, pidlist, selection_list->n, PIDS_SELECT_PID); + which = (thread_flags & (TF_loose_tasks|TF_show_task)) + ? PIDS_SELECT_PID_THREADS : PIDS_SELECT_PID; + pidread = procps_pids_select(Pids_info, pidlist, selection_list->n, which); free(pidlist); } else { enum pids_fetch_type which; -- 2.49.0