diff options
author | julian <julian@FreeBSD.org> | 2007-10-26 08:00:41 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2007-10-26 08:00:41 +0000 |
commit | 11e1aa0d189878b719971121400f0678e7ccb2aa (patch) | |
tree | e047e33390a9aae820357c54ff8602bc8faad475 /lib/libkvm/kvm_proc.c | |
parent | 050649d6404e24b1beaba91f04f9008ad5acd6a5 (diff) | |
download | FreeBSD-src-11e1aa0d189878b719971121400f0678e7ccb2aa.zip FreeBSD-src-11e1aa0d189878b719971121400f0678e7ccb2aa.tar.gz |
Introduce a way to make pure kernal threads.
kthread_add() takes the same parameters as the old kthread_create()
plus a pointer to a process structure, and adds a kernel thread
to that process.
kproc_kthread_add() takes the parameters for kthread_add,
plus a process name and a pointer to a pointer to a process instead of just
a pointer, and if the proc * is NULL, it creates the process to the
specifications required, before adding the thread to it.
All other old kthread_xxx() calls return, but act on (struct thread *)
instead of (struct proc *). One reason to change the name is so that
any old kernel modules that are lying around and expect kthread_create()
to make a process will not just accidentally link.
fix top to show kernel threads by their thread name in -SH mode
add a tdnam formatting option to ps to show thread names.
make all idle threads actual kthreads and put them into their own idled process.
make all interrupt threads kthreads and put them in an interd process
(mainly for aesthetic and accounting reasons)
rename proc 0 to be 'kernel' and it's swapper thread is now 'swapper'
man page fixes to follow.
Diffstat (limited to 'lib/libkvm/kvm_proc.c')
-rw-r--r-- | lib/libkvm/kvm_proc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c index f945bb3..511003f 100644 --- a/lib/libkvm/kvm_proc.c +++ b/lib/libkvm/kvm_proc.c @@ -120,6 +120,10 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt) kp = &kinfo_proc; kp->ki_structsize = sizeof(kinfo_proc); + /* + * Loop on the processes. this is completely broken because we need to be + * able to loop on the threads and merge the ones that are the same process some how. + */ for (; cnt < maxcnt && p != NULL; p = LIST_NEXT(&proc, p_list)) { memset(kp, 0, sizeof *kp); if (KREAD(kd, (u_long)p, &proc)) { @@ -402,8 +406,11 @@ nopgrp: kp->ki_pri.pri_native = mtd.td_base_pri; kp->ki_lastcpu = mtd.td_lastcpu; kp->ki_wchan = mtd.td_wchan; + if (mtd.td_name[0] != 0) + strlcpy(kp->ki_ocomm, mtd.td_name, MAXOCOMLEN); kp->ki_oncpu = mtd.td_oncpu; - + if (mtd.td_name[0] != '\0') + strlcpy(kp->ki_ocomm, mtd.td_name, sizeof(kp->ki_ocomm)); if (!(proc.p_flag & P_SA)) { kp->ki_pctcpu = 0; kp->ki_rqindex = 0; |