procps/proc
Jim Warner bc616b3615 library: correct a flawed approach for PROCPS_FILL_UID
Gosh, just because nobody uses some newlib provision I
guess, since it is being offered, it ought to actually
be tested at some point. Well, that point just arrived
and guess what? A surprise: some bugs were discovered.

The procps_pids_select function established a for loop
wherein readproc is called until the passed 'maxthese'
limit. Unfortunately this was incorrect for 2 reasons:

1. For PROCPS_FILL_PID results are limited by what the
oldlib finds, having established the pid list at open.
Total found already cannot exceed a passed 'maxthese';

2. With PROCPS_FILL_UID, returned results could exceed
a 'maxthese' thus making the for loop incorrect again.

[ plus yours truly neglected to forward the required ]
[ UIDs total to our old library, another oops biggie ]

In summary: the loop should have been forever, exiting
only when all those identified procs had been located.

So, while addressing those bugs, I've consolidated all
the retrieval code (initialize, iterate, summarize) in
a single helper function which will now serve both the
procps_pids_reap and select functions. And as a result
those guys were reduced to quite trivial housekeeping.

This patch, hopefully, completes the normalization for
reap/select (fill), which began with references shown.

Reference(s):
commit 0c953eccc5
commit 747dfc5987

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-10-09 21:35:04 +11:00
..
.gitignore library: rework namespace calls 2015-09-03 22:32:19 +10:00
alloc.c pmap: use correct types for memory allocation 2012-11-06 22:22:11 +11:00
alloc.h library: sysstat and vmstat api changes 2015-06-26 22:37:28 +10:00
COPYING miscellaneous: clean up trailing whitespace once again 2013-04-07 18:05:01 +10:00
devname.c library: Remove tty_to_dev() 2015-09-01 20:41:25 +10:00
devname.h library: Remove tty_to_dev() 2015-09-01 20:41:25 +10:00
diskstat.c miscellaneous: silence a whole bunch of clang warnings 2015-09-21 22:34:27 +10:00
diskstat.h library: Update diskstat API 2015-07-07 22:42:06 +10:00
escape.c miscellaneous: clean up trailing whitespace once again 2013-04-07 18:05:01 +10:00
escape.h library: sysstat and vmstat api changes 2015-06-26 22:37:28 +10:00
libprocps.pc.in Renaming libprocfs to libprocps 2011-12-23 09:18:43 +11:00
libprocps.sym library: privatize two with <pids> select/fill changes 2015-10-05 21:48:45 +11:00
meminfo.c library: with valgrind help, fix faulty meminfo assign 2015-09-21 22:35:05 +10:00
meminfo.h library: meminfo redesigned to use 'stack' vs. 'chain' 2015-07-23 22:31:24 +10:00
namespace.c miscellaneous: silence a whole bunch of clang warnings 2015-09-21 22:34:27 +10:00
namespace.h library: rework namespace calls 2015-09-03 22:32:19 +10:00
openproc.3 documentation: fix man pages due to refactor for wchan 2015-06-19 19:09:21 +10:00
pids.c library: correct a flawed approach for PROCPS_FILL_UID 2015-10-09 21:35:04 +11:00
pids.h library: privatize two with <pids> select/fill changes 2015-10-05 21:48:45 +11:00
procps-private.h library: Change linux version 2015-06-19 21:00:46 +10:00
procps.h library: abandon long/long long distinction with KLONG 2015-09-21 22:37:02 +10:00
pwcache.c library: export pwcache functions correctly 2015-06-26 22:37:53 +10:00
pwcache.h library: export pwcache functions correctly 2015-06-26 22:37:53 +10:00
readproc.3 misc: result after checking all files for misspellings 2014-08-08 22:14:21 +02:00
readproc.c miscellaneous: silence a whole bunch of clang warnings 2015-09-21 22:34:27 +10:00
readproc.h library: ensure any 'flags' is consistently 'unsigned' 2015-09-07 18:11:48 +10:00
readproctab.3 misc: result after checking all files for misspellings 2014-08-08 22:14:21 +02:00
readstat.c library: minor tweaks of program logic and/or comments 2015-07-28 21:51:00 +10:00
readstat.h library: minor tweaks of program logic and/or comments 2015-07-28 21:51:00 +10:00
slab.c library: minor tweaks of program logic and/or comments 2015-07-28 21:51:00 +10:00
slab.h library: eliminate extra stack header space provisions 2015-07-23 22:31:50 +10:00
sysinfo.c miscellaneous: silence a whole bunch of clang warnings 2015-09-21 22:34:27 +10:00
sysinfo.h library: Update diskstat API 2015-07-07 22:42:06 +10:00
test_namespace.c miscellaneous: cleanup accumulated trailing whitespace 2015-09-21 22:33:50 +10:00
test_sysinfo.c library: tests for sysinfo 2015-07-20 22:23:21 +10:00
uptime.c miscellaneous: silence a whole bunch of clang warnings 2015-09-21 22:34:27 +10:00
uptime.h library: Update uptime calls to standard format 2015-06-29 22:09:59 +10:00
version.c miscellaneous: remove some trailing whitespace buildup 2015-06-20 07:46:23 +10:00
version.h library: sysstat and vmstat api changes 2015-06-26 22:37:28 +10:00
vmstat.c library: vmstat redesign now using 'stack' vs. 'chain' 2015-07-23 22:31:44 +10:00
vmstat.h library: vmstat redesign now using 'stack' vs. 'chain' 2015-07-23 22:31:44 +10:00
wchan.c library: refactor and rely on modern kernels for wchan 2015-06-19 19:09:20 +10:00
wchan.h library: sysstat and vmstat api changes 2015-06-26 22:37:28 +10:00