diff options
author | Piotr Pawel Stefaniak <pstef@FreeBSD.org> | 2023-07-29 16:16:35 +0000 |
---|---|---|
committer | Piotr Pawel Stefaniak <pstef@FreeBSD.org> | 2023-08-24 16:35:50 +0000 |
commit | f06e32e9b9e4eef24df12db1b2d659893b02d4cd (patch) | |
tree | 85580ef6a47174baba9d50e5f1c23765d856ba6e /bin/ps/ps.c | |
parent | 847fa61fad5ef118dc0591d876bf9449200aa818 (diff) | |
download | src-f06e32e9b9e4eef24df12db1b2d659893b02d4cd.tar.gz src-f06e32e9b9e4eef24df12db1b2d659893b02d4cd.zip |
Revert "ps: extend the non-standard option -d (tree view) to work with -p"
This reverts commit ca8c0d5e811048ad67d0955642c5b486e9c0f3d2.
By commiting ca8c0d5e8110 I was hoping that the existing option -d
could just be extended to work with -p to implement a feature that was
and I think is still needed, that is to show all descendant processes
of a given process id or a set of process ids.
After a complaint from -current which may represent a wider
dissatisfaction with this change in the program's behavior, I think it
will be better to revert ca8c0d5e8110 and reintroduce this feature
using a separate option -D.
Diffstat (limited to 'bin/ps/ps.c')
-rw-r--r-- | bin/ps/ps.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c index e7781d1d9310..8554a2eaa0a2 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -502,7 +502,7 @@ main(int argc, char *argv[]) what = KERN_PROC_PGRP | showthreads; flag = *pgrplist.l.pids; nselectors = 0; - } else if (pidlist.count == 1 && !descendancy) { + } else if (pidlist.count == 1) { what = KERN_PROC_PID | showthreads; flag = *pidlist.l.pids; nselectors = 0; @@ -537,14 +537,6 @@ main(int argc, char *argv[]) if ((kp == NULL && errno != ESRCH) || (kp != NULL && nentries < 0)) xo_errx(1, "%s", kvm_geterr(kd)); nkept = 0; - if (descendancy) - for (elem = 0; elem < pidlist.count; elem++) - for (i = 0; i < nentries; i++) - if (kp[i].ki_ppid == pidlist.l.pids[elem]) { - if (pidlist.count >= pidlist.maxcount) - expand_list(&pidlist); - pidlist.l.pids[pidlist.count++] = kp[i].ki_pid; - } if (nentries > 0) { if ((kinfo = malloc(nentries * sizeof(*kinfo))) == NULL) xo_errx(1, "malloc failed"); |