freebsd-dev/bin
Piotr Pawel Stefaniak ca8c0d5e81 ps: extend the non-standard option -d (tree view) to work with -p
Initially it seemed that there were multiple possible ways to do it.

Processing option -p could conditionally add selected processes and
their descendants to the list for further work, but it is not guaranteed
to know whether the -d option has been used or not, and it also doesn't
have access to the process list just yet.

There is also descendant_sort() which has access to all possibly needed
information, but serves the purely post-processing purpose of sorting
output.

Then there is the loop that uses invocation information and full process
list to create a list of processes for final display. It seems the most
natural place to implement this, but indeterminate state of the process
list and volatility of the final list that is being created obstruct
adding an elegant search for all elements of process descendancy trees.

So I opted for adding another loop, just before the one I mentioned
above. For all selected processes it conditionally adds direct
descendants to the end of this list of selected processes.

Possible usage:
* ps -auxd -p $$
* ps -auxd -p 1
* while x=$(pgrep svnlite); do clear; ps auxd -p $x; sleep 2; done
* ps -auxd -p `pgrep make`

Reviewed by:	kevans, kaktus (earlier version)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24380
2020-05-07 16:56:18 +00:00
..
cat Allow building bin/cat on non-FreeBSD systems 2020-01-16 14:15:00 +00:00
chflags
chio
chmod
cp
csh Fix .depend files to work for build tools. 2019-06-15 17:08:13 +00:00
date
dd Add iflag=fullblock to dd 2019-09-30 22:00:48 +00:00
df
domainname
echo
ed
expr
freebsd-version
getfacl
hostname
kenv
kill
ln
ls ls(1): Fix trivial SEGV due to NULL deref in OOM path 2020-05-05 18:06:32 +00:00
mkdir
mv
pax
pkill
ps ps: extend the non-standard option -d (tree view) to work with -p 2020-05-07 16:56:18 +00:00
pwait Remove unused include. 2020-02-02 20:51:28 +00:00
pwd
realpath
rm Remove include of stdint.h. It was added in r241014 for uintmax_t, 2020-04-23 03:46:41 +00:00
rmail
rmdir
setfacl
sh sh: Assert INTOFF rather than applying it in ck* 2020-04-28 20:34:27 +00:00
sleep
stty Some devices take undesired actions when RTS and DTR are 2019-06-12 18:07:04 +00:00
sync
test
tests
uuidgen pkgbase: Create a FreeBSD-utilities package and make it the default one 2019-09-05 14:15:47 +00:00
Makefile
Makefile.inc