From 812b8c776264e1fd7df297f7ad8de0fcfe6aa309 Mon Sep 17 00:00:00 2001 From: julian Date: Sun, 30 Jun 2002 17:06:46 +0000 Subject: grow a brain and do this right. --- lib/libkvm/kvm_proc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/libkvm/kvm_proc.c') diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c index 5bc1867..91e5216 100644 --- a/lib/libkvm/kvm_proc.c +++ b/lib/libkvm/kvm_proc.c @@ -268,7 +268,7 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt) nopgrp: kp->ki_tdev = NODEV; } - if (mainthread && mainthread.td_wmesg) /* XXXKSE */ + if ((proc.p_state != PRS_ZOMBIE) && mainthread.td_wmesg) /* XXXKSE */ (void)kvm_read(kd, (u_long)mainthread.td_wmesg, kp->ki_wmesg, WMESGLEN); @@ -307,10 +307,12 @@ nopgrp: strncpy(kp->ki_comm, proc.p_comm, MAXCOMLEN); kp->ki_comm[MAXCOMLEN] = 0; } - if (mainthread && mainthread.td_blocked != 0) { /* XXXKSE */ + if ((proc.p_state != PRS_ZOMBIE) && + mainthread.td_blocked != 0) { kp->ki_kiflag |= KI_MTXBLOCK; - if (mainthread.td_mtxname) /* XXXKSE */ - (void)kvm_read(kd, (u_long)mainthread.td_mtxname, + if (mainthread.td_mtxname) + (void)kvm_read(kd, + (u_long)mainthread.td_mtxname, kp->ki_mtxname, MTXNAMELEN); kp->ki_mtxname[MTXNAMELEN] = 0; } @@ -321,7 +323,7 @@ nopgrp: kp->ki_sigmask = proc.p_sigmask; kp->ki_xstat = proc.p_xstat; kp->ki_acflag = proc.p_acflag; - if (mainthread) { + if (proc.p_state != PRS_ZOMBIE) { kp->ki_pctcpu = proc.p_kse.ke_pctcpu; kp->ki_estcpu = proc.p_ksegrp.kg_estcpu; kp->ki_slptime = proc.p_kse.ke_slptime; -- cgit v1.1