usb kthreads
Andrew Thompson
thompsa at FreeBSD.org
Thu Aug 13 07:49:28 UTC 2009
Hi,
Here is an aesthetic patch to change the usb kernel processes to threads,
this hides them from the usual 'ps' output. Please test and review.
1290 ?? DL 0:00.00 [usbus0]
[lots and lots more...]
1309 ?? DL 0:00.00 [usbus4]
After the patch they can be seen as kernel threads.
PID TID COMM TDNAME CPU PRI STATE WCHAN
0 100000 kernel swapper 0 68 sleep sched
0 100009 kernel firmware taskq 0 92 sleep -
0 100020 kernel kqueue taskq 0 92 sleep -
0 100021 kernel acpi_task_0 0 92 sleep -
0 100022 kernel acpi_task_1 0 92 sleep -
0 100023 kernel acpi_task_2 0 92 sleep -
0 100027 kernel thread taskq 0 92 sleep -
0 100031 kernel bwi0 taskq 0 16 sleep -
0 100032 kernel bwi0 taskq 0 16 sleep -
0 100106 kernel usbus0 0 20 sleep wmsg
0 100107 kernel usbus0 0 16 sleep wmsg
0 100108 kernel usbus0 0 20 sleep wmsg
0 100109 kernel usbus0 0 20 sleep wmsg
[ ... ]
0 100127 kernel usbus4 0 20 sleep wmsg
Andrew
Index: dev/usb/usb_process.c
===================================================================
--- dev/usb/usb_process.c (revision 196086)
+++ dev/usb/usb_process.c (working copy)
@@ -64,9 +64,9 @@
#if (__FreeBSD_version >= 800000)
#define USB_THREAD_CREATE(f, s, p, ...) \
- kproc_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__)
-#define USB_THREAD_SUSPEND(p) kproc_suspend(p,0)
-#define USB_THREAD_EXIT(err) kproc_exit(err)
+ kthread_add((f), (s), NULL, (p), 0, 0, __VA_ARGS__)
+#define USB_THREAD_SUSPEND(p) kthread_suspend(p,0)
+#define USB_THREAD_EXIT(err) kthread_exit()
#else
#define USB_THREAD_CREATE(f, s, p, ...) \
kthread_create((f), (s), (p), RFHIGHPID, 0, __VA_ARGS__)
Index: dev/usb/usb_process.h
===================================================================
--- dev/usb/usb_process.h (revision 196086)
+++ dev/usb/usb_process.h (working copy)
@@ -49,7 +49,7 @@ struct usb_process {
struct cv up_cv;
struct cv up_drain;
- struct proc *up_ptr;
+ struct thread *up_ptr;
struct thread *up_curtd;
struct mtx *up_mtx;
More information about the freebsd-current
mailing list