summaryrefslogtreecommitdiff
path: root/utils/ps.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-06-24 21:35:48 +0000
committerMiles Bader <miles@gnu.org>1996-06-24 21:35:48 +0000
commit039a88b329122f3f4d5e29f2bf59e77d80a04426 (patch)
treec284a04942f3f71fd5a9d4c4176ad85d3c3c4fb7 /utils/ps.c
parentf74b90d7e3174cca883b072903adaa7dc77c2724 (diff)
(main): Fix heuristic to decide whether native booted.
Diffstat (limited to 'utils/ps.c')
-rw-r--r--utils/ps.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/utils/ps.c b/utils/ps.c
index 99eb6dbf..f70a59e3 100644
--- a/utils/ps.c
+++ b/utils/ps.c
@@ -569,9 +569,17 @@ main(int argc, char *argv[])
simple heuristic: Is the 5th process a hurd process (1-4 are
typically: proc server, init, kernel, boot default pager (maybe); the
last two are know not to be hurd processes)? */
- show_non_hurd_procs =
- (procset->num_procs > 4
- && !(procset->proc_stats[4]->flags & PSTAT_STATE_P_NOPARENT));
+ if (procset->num_procs > 4)
+ {
+ struct proc_stat *ps = procset->proc_stats[4];
+ if (proc_stat_set_flags (ps, PSTAT_STATE) == 0
+ && (ps->flags & PSTAT_STATE))
+ show_non_hurd_procs = !(ps->state & PSTAT_STATE_P_NOPARENT);
+ else
+ /* Something is fucked, we can't get the state bits for PS.
+ Default to showing everything. */
+ show_non_hurd_procs = 1;
+ }
}
if (no_msg_port)