[PATCH] [V2] add options to ps(1) to display lwp data
Simon 'corecode' Schubert
corecode at fs.ei.tum.de
Tue Aug 14 14:16:11 PDT 2007
Nicolas Thery wrote:
Changed sysctl(KERN_PROC, ...) behaviour for kernel threads not associated
with lwps. kinfo_lwp.kl_tid is set to -1 in this case instead of thread
structure address. This is consistent with kinfo_proc.kp_pid, avoid
garbage values in ps -axH output and should not break anything as kl_tid
is not used anywhere in the source tree.
Index: dfly/src/sys/kern/kern_kinfo.c
===================================================================
--- dfly.orig/src/sys/kern/kern_kinfo.c 2007-08-14 21:35:18.000000000 +0200
+++ dfly/src/sys/kern/kern_kinfo.c 2007-08-14 21:36:39.000000000 +0200
@@ -218,7 +218,7 @@
kp->kp_stat = SACTIVE;
kp->kp_lwp.kl_pid = -1;
- kp->kp_lwp.kl_tid = (uintptr_t)td;
+ kp->kp_lwp.kl_tid = -1;
kp->kp_lwp.kl_tdflags = td->td_flags;
#ifdef SMP
kp->kp_lwp.kl_mpcount = td->td_mpcount;
I don't think this is good. td is the "thread id", and nothing else. Now you've removed the only possible identifier for a kernel thread.
This needs to be reverted, and ps extended to use %#x or so
cheers
simon
--
Serve - BSD +++ RENT this banner advert +++ ASCII Ribbon /"\
Work - Mac +++ space for low â¬â¬â¬ NOW!1 +++ Campaign \ /
Party Enjoy Relax | http://dragonflybsd.org Against HTML \
Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \
More information about the Submit
mailing list