summaryrefslogtreecommitdiffstats
path: root/bin/ps/print.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2007-10-26 08:00:41 +0000
committerjulian <julian@FreeBSD.org>2007-10-26 08:00:41 +0000
commit11e1aa0d189878b719971121400f0678e7ccb2aa (patch)
treee047e33390a9aae820357c54ff8602bc8faad475 /bin/ps/print.c
parent050649d6404e24b1beaba91f04f9008ad5acd6a5 (diff)
downloadFreeBSD-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 'bin/ps/print.c')
-rw-r--r--bin/ps/print.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 29dffb6..544ca0e 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -129,9 +129,11 @@ command(KINFO *k, VARENT *ve)
v = ve->var;
if (cflag) {
/* If it is the last field, then don't pad */
- if (STAILQ_NEXT(ve, next_ve) == NULL)
+ if (STAILQ_NEXT(ve, next_ve) == NULL) {
(void)printf("%s", k->ki_p->ki_comm);
- else
+ if (showthreads && k->ki_p->ki_numthreads > 1)
+ printf("/%s", k->ki_p->ki_ocomm);
+ } else
(void)printf("%-*s", v->width, k->ki_p->ki_comm);
return;
}
@@ -178,13 +180,28 @@ ucomm(KINFO *k, VARENT *ve)
VAR *v;
v = ve->var;
- if (STAILQ_NEXT(ve, next_ve) == NULL) /* last field, don't pad */
+ if (STAILQ_NEXT(ve, next_ve) == NULL) { /* last field, don't pad */
(void)printf("%s", k->ki_p->ki_comm);
- else
+ if (showthreads && k->ki_p->ki_numthreads > 1)
+ printf("/%s", k->ki_p->ki_ocomm);
+ } else
(void)printf("%-*s", v->width, k->ki_p->ki_comm);
}
void
+tdnam(KINFO *k, VARENT *ve)
+{
+ VAR *v;
+
+ v = ve->var;
+ if (showthreads && k->ki_p->ki_numthreads > 1)
+ (void)printf("%-*s", v->width, k->ki_p->ki_ocomm);
+ else
+ (void)printf("%-*s", v->width, " " );
+
+}
+
+void
logname(KINFO *k, VARENT *ve)
{
VAR *v;
OpenPOWER on IntegriCloud