procps/proc
Jim Warner 88489be542 library: allow duplicated results for <pids> interface
Ok, here is that rather major internal redesign hinted
at in the three previous commits. Its need was quickly
revealed after adapting top then attempting to display
newly added 'CGNAME' fields and an existing 'CGROUPS'.

That very quickly generated a SEGV. And the reason was
just as quickly recognized. Both fields relied on that
proc_t.cgroup member yet whichever result structure is
first in a stack is the one which assumes ownership of
of the vectored sting by resetting its cgroup to NULL.

So this commit introduces reference counting for a few
of the fields in the proc_t. Specifically there are 17
entries in the Item_table dealing with strings/vectors
where ownership is transferred to newlib. Now whenever
such fields are represented more than once in a stack,
the strings will be duplicated instead of transferred.
In this way we can generally remain optimized avoiding
string copies, yet still accommodate them when needed.

There's an exception to this scheme: those true string
vectors (CGROUP_V, CMDLINE_V and ENVIRON_V). When such
fields are duplicated in a stack the result structures
beyond the first will be set to NULL, which the caller
will (should) already be equipped to deal with anyway.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-10-14 21:50:31 +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: rename the 'procps_pids_stacks_sort' function 2015-10-14 21:47:04 +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: allow duplicated results for <pids> interface 2015-10-14 21:50:31 +11:00
pids.h library: added PROCPS_PIDS_CGNAME for <pids> interface 2015-10-14 21:48:41 +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