diff -r 3a6b7da09b4f sys/cddl/compat/opensolaris/sys/proc.h --- a/sys/cddl/compat/opensolaris/sys/proc.h Mon Jan 25 11:52:47 2010 -0500 +++ b/sys/cddl/compat/opensolaris/sys/proc.h Thu Jan 28 05:25:20 2010 -0500 @@ -58,8 +58,6 @@ typedef struct thread *kthread_id_t; typedef struct thread *kthread_id_t; typedef struct proc proc_t; -extern struct proc *zfsproc; - static __inline kthread_t * thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, size_t len, proc_t *pp, int state, pri_t pri) @@ -75,8 +73,8 @@ thread_create(caddr_t stk, size_t stksiz ASSERT(state == TS_RUN); ASSERT(pp == &p0); - error = kproc_kthread_add(proc, arg, &zfsproc, &td, RFSTOPPED, - stksize / PAGE_SIZE, "zfskern", "solthread %p", proc); + error = kthread_add(proc, arg, NULL, &td, RFSTOPPED, + stksize / PAGE_SIZE, "zfskern: solthread %p", proc); if (error == 0) { thread_lock(td); sched_prio(td, pri); diff -r 3a6b7da09b4f sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Jan 25 11:52:47 2010 -0500 +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Thu Jan 28 05:25:20 2010 -0500 @@ -538,8 +538,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_tsd = ctx; pp = cp->provider; - kproc_kthread_add(vdev_geom_worker, ctx, &zfsproc, NULL, 0, 0, - "zfskern", "vdev %s", pp->name); + kthread_add(vdev_geom_worker, ctx, NULL, NULL, 0, 0, + "zfskern: vdev %s", pp->name); /* * Determine the actual size of the device. diff -r 3a6b7da09b4f sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Jan 25 11:52:47 2010 -0500 +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Jan 28 05:25:20 2010 -0500 @@ -3067,7 +3067,6 @@ zfsdev_fini(void) } static struct root_hold_token *zfs_root_token; -struct proc *zfsproc; uint_t zfs_fsyncer_key; extern uint_t rrw_tsd_key; diff -r 3a6b7da09b4f sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Mon Jan 25 11:52:47 2010 -0500 +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Jan 28 05:25:20 2010 -0500 @@ -847,8 +847,8 @@ zvol_create_minor(const char *name, majo bioq_init(&zv->zv_queue); mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF); zv->zv_state = 0; - kproc_kthread_add(zvol_worker, zv, &zfsproc, NULL, 0, 0, "zfskern", - "zvol %s", pp->name + strlen(ZVOL_DEV_DIR) + 1); + kthread_add(zvol_worker, zv, NULL, NULL, 0, 0, + "zfskern zvol %s", pp->name + strlen(ZVOL_DEV_DIR) + 1); zvol_minors++; end: diff -r 3a6b7da09b4f sys/dev/usb/usb_process.c --- a/sys/dev/usb/usb_process.c Mon Jan 25 11:52:47 2010 -0500 +++ b/sys/dev/usb/usb_process.c Thu Jan 28 05:25:20 2010 -0500 @@ -63,11 +63,9 @@ #endif #if (__FreeBSD_version >= 800000) -static struct proc *usbproc; -static int usb_pcount; #define USB_THREAD_CREATE(f, s, p, ...) \ - kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ - 0, "usb", __VA_ARGS__) + 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 @@ -186,11 +184,6 @@ usb_process(void *arg) up->up_ptr = NULL; cv_signal(&up->up_cv); mtx_unlock(up->up_mtx); -#if (__FreeBSD_version >= 800000) - /* Clear the proc pointer if this is the last thread. */ - if (--usb_pcount == 0) - usbproc = NULL; -#endif USB_THREAD_EXIT(0); } @@ -226,9 +219,6 @@ usb_proc_create(struct usb_process *up, up->up_ptr = NULL; goto error; } -#if (__FreeBSD_version >= 800000) - usb_pcount++; -#endif return (0); error: diff -r 3a6b7da09b4f sys/kern/kern_idle.c --- a/sys/kern/kern_idle.c Mon Jan 25 11:52:47 2010 -0500 +++ b/sys/kern/kern_idle.c Thu Jan 28 05:25:20 2010 -0500 @@ -54,25 +54,23 @@ idle_setup(void *dummy) #ifdef SMP struct pcpu *pc; #endif - struct proc *p; struct thread *td; int error; - p = NULL; /* start with no idle process */ #ifdef SMP SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { #endif #ifdef SMP - error = kproc_kthread_add(sched_idletd, NULL, &p, &td, - RFSTOPPED | RFHIGHPID, 0, "idle", "idle: cpu%d", pc->pc_cpuid); + error = kthread_add(sched_idletd, NULL, NULL, &td, + RFSTOPPED, 0, "idle: cpu%d", pc->pc_cpuid); pc->pc_idlethread = td; #else - error = kproc_kthread_add(sched_idletd, NULL, &p, &td, - RFSTOPPED | RFHIGHPID, 0, "idle", "idle"); + error = kthread_add(sched_idletd, NULL, NULL, &td, + RFSTOPPED, 0, "idle"); PCPU_SET(idlethread, td); #endif if (error) - panic("idle_setup: kproc_create error %d\n", error); + panic("idle_setup: kthread_add error %d\n", error); thread_lock(td); TD_SET_CAN_RUN(td); diff -r 3a6b7da09b4f sys/kern/kern_intr.c --- a/sys/kern/kern_intr.c Mon Jan 25 11:52:47 2010 -0500 +++ b/sys/kern/kern_intr.c Thu Jan 28 05:25:20 2010 -0500 @@ -83,7 +83,6 @@ struct intr_event *clk_intr_event; struct intr_event *clk_intr_event; struct intr_event *tty_intr_event; void *vm_ih; -struct proc *intrproc; static MALLOC_DEFINE(M_ITHREAD, "ithread", "Interrupt Threads"); @@ -451,9 +450,8 @@ ithread_create(const char *name) ithd = malloc(sizeof(struct intr_thread), M_ITHREAD, M_WAITOK | M_ZERO); - error = kproc_kthread_add(ithread_loop, ithd, &intrproc, - &td, RFSTOPPED | RFHIGHPID, - 0, "intr", "%s", name); + error = kthread_add(ithread_loop, ithd, NULL, + &td, RFSTOPPED, 0, "intr: %s", name); if (error) panic("kproc_create() failed with %d", error); thread_lock(td); @@ -475,11 +473,10 @@ ithread_create(const char *name, struct ithd = malloc(sizeof(struct intr_thread), M_ITHREAD, M_WAITOK | M_ZERO); - error = kproc_kthread_add(ithread_loop, ih, &intrproc, - &td, RFSTOPPED | RFHIGHPID, - 0, "intr", "%s", name); + error = kthread_add(ithread_loop, ih, NULL, + &td, RFSTOPPED, 0, "intr: %s", name); if (error) - panic("kproc_create() failed with %d", error); + panic("kthread_add() failed with %d", error); thread_lock(td); sched_class(td, PRI_ITHD); TD_SET_IWAIT(td); diff -r 3a6b7da09b4f sys/kern/kern_kthread.c --- a/sys/kern/kern_kthread.c Mon Jan 25 11:52:47 2010 -0500 +++ b/sys/kern/kern_kthread.c Thu Jan 28 05:25:20 2010 -0500 @@ -315,13 +315,6 @@ kthread_exit(void) /* A module may be waiting for us to exit. */ wakeup(curthread); - /* - * We could rely on thread_exit to call exit1() but - * there is extra work that needs to be done - */ - if (curthread->td_proc->p_numthreads == 1) - kproc_exit(0); /* never returns */ - p = curthread->td_proc; PROC_LOCK(p); PROC_SLOCK(p); @@ -416,33 +409,3 @@ kthread_suspend_check() PROC_UNLOCK(p); } -int -kproc_kthread_add(void (*func)(void *), void *arg, - struct proc **procptr, struct thread **tdptr, - int flags, int pages, char * procname, const char *fmt, ...) -{ - int error; - va_list ap; - char buf[100]; - struct thread *td; - - if (*procptr == 0) { - error = kproc_create(func, arg, - procptr, flags, pages, "%s", procname); - if (error) - return (error); - td = FIRST_THREAD_IN_PROC(*procptr); - if (tdptr) - *tdptr = td; - va_start(ap, fmt); - vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap); - va_end(ap); - return (0); - } - va_start(ap, fmt); - vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - error = kthread_add(func, arg, *procptr, - tdptr, flags, pages, "%s", buf); - return (error); -} diff -r 3a6b7da09b4f sys/netgraph/ng_base.c --- a/sys/netgraph/ng_base.c Mon Jan 25 11:52:47 2010 -0500 +++ b/sys/netgraph/ng_base.c Thu Jan 28 05:25:20 2010 -0500 @@ -3099,7 +3099,6 @@ static int static int ngb_mod_event(module_t mod, int event, void *data) { - struct proc *p; struct thread *td; int i, error = 0; @@ -3131,10 +3130,9 @@ ngb_mod_event(module_t mod, int event, v if (numthreads <= 0) numthreads = mp_ncpus; /* Create threads. */ - p = NULL; /* start with no process */ for (i = 0; i < numthreads; i++) { - if (kproc_kthread_add(ngthread, NULL, &p, &td, - RFHIGHPID, 0, "ng_queue", "ng_queue%d", i)) { + if (kthread_add(ngthread, NULL, NULL, &td, + 0, 0, "ng_queue%d", i)) { numthreads = i; break; } diff -r 3a6b7da09b4f sys/sys/kthread.h --- a/sys/sys/kthread.h Mon Jan 25 11:52:47 2010 -0500 +++ b/sys/sys/kthread.h Thu Jan 28 05:25:20 2010 -0500 @@ -58,13 +58,6 @@ int kproc_suspend(struct proc *, int); int kproc_suspend(struct proc *, int); void kproc_suspend_check(struct proc *); -/* create a thread inthe given process. create the process if needed */ -int kproc_kthread_add(void (*)(void *), void *, - struct proc **, - struct thread **, - int flags, int pages, - char * procname, const char *, ...) __printflike(8, 9); - int kthread_add(void (*)(void *), void *, struct proc *, struct thread **, int flags, int pages, const char *, ...) __printflike(7, 8);