From 039a88b329122f3f4d5e29f2bf59e77d80a04426 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 24 Jun 1996 21:35:48 +0000 Subject: (main): Fix heuristic to decide whether native booted. --- utils/ps.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'utils') 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) -- cgit v1.2.3