procps/ps
Jim Warner 584028dbe5 ps: exploit those new <pids> task/threads capabilities
This commit represents the ps transition to the <pids>
'stacks' interface. While an effort to minimize impact
on existing code was made (as with a disguised proc_t)
the changes were still extensive. Along the way, a few
modifications beyond simply conversion were also made.

------------------------------------------------------
Here's a brief overview the design of this conversion:

. The need to satisfy relative enum requirements could
not easily have been made table driven since any entry
in the format_array might require several <pids> items
in support. So I decided to allow every print function
to contribute its own relative enums once the decision
as to exactly what will be printed had been finalized.

. A similar approach was taken for sorting, since it's
possible to have sort keys that will not be displayed.
Here, I relied on the existing print extensions above.

. In summary, just prior to printing ps walks thru two
lists one time (the format_list & sort_list) and calls
each print function. That function does not print, but
sets its required enum if necessary. Later, when those
same functions are called repeatedly for every printed
line, the only overhead will be an if test and branch.

------------------------------------------------------
Below is a summary of major changes beyond conversion:

. Sorts are now the responsibility of the library. And
therefore the total # of sortable fields substantially
increased without effort. Additionally, several quirky
fields remain as sortable, even though they can't ever
be printed(?). Surely that must make sense to someone.

[ while on this subject of sort, please do *not* try ]
[ to sort old ps on 'args'. or better yet, if you do ]
[ try that sort, see if you can determine his order, ]
[ without peeking at the source. that one hurts yet! ]

. All logic dealing with the old openproc flags and ps
struct members known as 'need' have been whacked since
that entire area was solely the new library's concern.

. Remaining malloc/calloc calls to stdlib were changed
to xmalloc/xcalloc from our own include/xalloc.h file.
None of the replaced calls ever checked return values.

[ be aware that 2 minor potential memory leaks exist ]
[ depending on command line arguments. no attempt is ]
[ made to free dynamically acquired format/sort node ]
[ structures upon return; a conscious design choice. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
2015-10-05 21:52:08 +11:00
..
common.h ps: exploit those new <pids> task/threads capabilities 2015-10-05 21:52:08 +11:00
COPYING license: update FSF addresses 2012-03-04 08:04:24 +11:00
display.c ps: exploit those new <pids> task/threads capabilities 2015-10-05 21:52:08 +11:00
global.c ps: exploit those new <pids> task/threads capabilities 2015-10-05 21:52:08 +11:00
HACKING docs: remove old information from HACKING 2012-01-13 22:42:38 +01:00
help.c ps: add -q/q/--quick-pid option 2014-07-10 21:24:19 +02:00
output.c ps: exploit those new <pids> task/threads capabilities 2015-10-05 21:52:08 +11:00
parser.c ps: exploit those new <pids> task/threads capabilities 2015-10-05 21:52:08 +11:00
ps.1 documentation: fix man pages due to refactor for wchan 2015-06-19 19:09:21 +10:00
regression procps 010114 2002-02-01 22:47:29 +00:00
select.c ps: exploit those new <pids> task/threads capabilities 2015-10-05 21:52:08 +11:00
sortformat.c ps: exploit those new <pids> task/threads capabilities 2015-10-05 21:52:08 +11:00
stacktrace.c ps: cut out code unused code 2012-11-06 22:30:02 +11:00