From 8237391c0a9536ee00d800067a7ba33b07f2b744 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 24 May 2007 05:45:45 +0000 Subject: [PATCH] Fix the kinfo run/sleep state for pure kernel threads. This effects /bin/ps and so forth. A pure kernel thread can deschedule itself without having to set td_wchan[], so use its presence on the LWKT run queue to determine whether it is running or not. --- sys/kern/kern_kinfo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_kinfo.c b/sys/kern/kern_kinfo.c index f9bd3d85bf..731872627f 100644 --- a/sys/kern/kern_kinfo.c +++ b/sys/kern/kern_kinfo.c @@ -32,7 +32,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sys/kern/kern_kinfo.c,v 1.11 2007/05/09 00:53:34 dillon Exp $ + * $DragonFly: src/sys/kern/kern_kinfo.c,v 1.12 2007/05/24 05:45:45 dillon Exp $ */ /* @@ -222,10 +222,10 @@ fill_kinfo_proc_kthread(struct thread *td, struct kinfo_proc *kp) kp->kp_lwp.kl_cpuid = td->td_gd->gd_cpuid; kp->kp_lwp.kl_wchan = (uintptr_t)td->td_wchan; - if (td->td_wchan) - kp->kp_lwp.kl_stat = LSSLEEP; - else + if (td->td_flags & TDF_RUNQ) kp->kp_lwp.kl_stat = LSRUN; + else + kp->kp_lwp.kl_stat = LSSLEEP; if (td->td_wmesg) { strncpy(kp->kp_lwp.kl_wmesg, td->td_wmesg, WMESGLEN); kp->kp_lwp.kl_wmesg[WMESGLEN] = 0; -- 2.11.4.GIT