From b0b07bbbc9867b3e8115948bd88fdf87a30e51f2 Mon Sep 17 00:00:00 2001 From: Alex Hornung Date: Thu, 28 Jun 2012 12:11:09 +0100 Subject: [PATCH] top - Display threads when asked to --- usr.bin/top/m_dragonfly.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/usr.bin/top/m_dragonfly.c b/usr.bin/top/m_dragonfly.c index b004e4caf8..2a883d2afd 100644 --- a/usr.bin/top/m_dragonfly.c +++ b/usr.bin/top/m_dragonfly.c @@ -64,11 +64,6 @@ static int show_fullcmd; int n_cpus = 0; -/* - * needs to be a global symbol, so wrapper can be modified accordingly. - */ -static int show_threads = 0; - /* get_process_info passes back a handle. This is what it looks like: */ struct handle { @@ -464,9 +459,13 @@ get_process_info(struct system_info *si, struct process_select *sel, int show_idle; int show_system; int show_uid; + int show_threads; + + show_threads = sel->threads; - pbase = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc); + pbase = kvm_getprocs(kd, + KERN_PROC_ALL | (show_threads ? KERN_PROC_FLAG_LWP : 0), 0, &nproc); if (nproc > onproc) pref = (struct kinfo_proc **)realloc(pref, sizeof(struct kinfo_proc *) * (onproc = nproc)); -- 2.41.0