library: repair <pids> api boo-boo in the 'select' i/f

The patch referenced below corrected some flaws in the
procps_pids_select implementation. But, there remained
one flaw which this commit will now hopefully address.

Rather than assume callers wished to select only tasks
and not threads meant a command like 'top -H -p 10329'
works differently under newlib than release 3.3.17. It
fails to honor the '-H' (threads) switch under newlib.

So, to fix that oops, we'll allow that select function
to get threads or tasks depending on its 'which' parm.

Reference(s):
. Oct 2015, some flaws corrected
commit bc616b3615

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2021-08-07 00:00:00 -05:00
committed by Craig Small
parent a375262609
commit af34cc964a
3 changed files with 26 additions and 7 deletions

View File

@@ -189,8 +189,10 @@ enum pids_fetch_type {
};
enum pids_select_type {
PIDS_SELECT_PID = 0x10000,
PIDS_SELECT_UID = 0x20000
PIDS_SELECT_PID = 0x10000,
PIDS_SELECT_PID_THREADS = 0x10001,
PIDS_SELECT_UID = 0x20000,
PIDS_SELECT_UID_THREADS = 0x20001
};
enum pids_sort_order {