Rename the kthread_xxx (e.g. kthread_create()) calls

to kproc_xxx as they actually make whole processes.
Thos makes way for us to add REAL kthread_create() and friends
that actually make theads. it turns out that most of these
calls actually end up being moved back to the thread version
when it's added. but we need to make this cosmetic change first.

I'd LOVE to do this rename in 7.0  so that we can eventually MFC the
new kthread_xxx() calls.
This commit is contained in:
Julian Elischer 2007-10-20 23:23:23 +00:00
parent 2b3e7485f6
commit 3745c395ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172836
76 changed files with 176 additions and 176 deletions

View File

@ -1562,7 +1562,7 @@ xpt_init(void *dummy)
} }
/* fire up rescan thread */ /* fire up rescan thread */
if (kthread_create(xpt_scanner_thread, NULL, NULL, 0, 0, "xpt_thrd")) { if (kproc_create(xpt_scanner_thread, NULL, NULL, 0, 0, "xpt_thrd")) {
printf("xpt_init: failed to create rescan thread\n"); printf("xpt_init: failed to create rescan thread\n");
} }
/* Install our software interrupt handlers */ /* Install our software interrupt handlers */

View File

@ -77,12 +77,12 @@ thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
ASSERT(len == 0); ASSERT(len == 0);
ASSERT(state == TS_RUN); ASSERT(state == TS_RUN);
error = kthread_create(proc, arg, &p, 0, ZFS_KSTACK_PAGES, error = kproc_create(proc, arg, &p, 0, ZFS_KSTACK_PAGES,
"solthread %p", proc); "solthread %p", proc);
return (error == 0 ? FIRST_THREAD_IN_PROC(p) : NULL); return (error == 0 ? FIRST_THREAD_IN_PROC(p) : NULL);
} }
#define thread_exit() kthread_exit(0) #define thread_exit() kproc_exit(0)
#endif /* _KERNEL */ #endif /* _KERNEL */

View File

@ -207,7 +207,7 @@ vdev_geom_worker(void *arg)
ctx->gc_state = 2; ctx->gc_state = 2;
wakeup_one(&ctx->gc_state); wakeup_one(&ctx->gc_state);
mtx_unlock(&ctx->gc_queue_mtx); mtx_unlock(&ctx->gc_queue_mtx);
kthread_exit(0); kproc_exit(0);
} }
msleep(&ctx->gc_queue, &ctx->gc_queue_mtx, msleep(&ctx->gc_queue, &ctx->gc_queue_mtx,
PRIBIO | PDROP, "vgeom:io", 0); PRIBIO | PDROP, "vgeom:io", 0);
@ -440,7 +440,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift)
vd->vdev_tsd = ctx; vd->vdev_tsd = ctx;
kthread_create(vdev_geom_worker, ctx, NULL, 0, 0, "vdev:worker %s", kproc_create(vdev_geom_worker, ctx, NULL, 0, 0, "vdev:worker %s",
pp->name); pp->name);
return (0); return (0);

View File

@ -359,7 +359,7 @@ zvol_worker(void *arg)
zv->zv_state = 2; zv->zv_state = 2;
wakeup(&zv->zv_state); wakeup(&zv->zv_state);
mtx_unlock(&zv->zv_queue_mtx); mtx_unlock(&zv->zv_queue_mtx);
kthread_exit(0); kproc_exit(0);
} }
msleep(&zv->zv_queue, &zv->zv_queue_mtx, PRIBIO | PDROP, msleep(&zv->zv_queue, &zv->zv_queue_mtx, PRIBIO | PDROP,
"zvol:io", 0); "zvol:io", 0);
@ -543,7 +543,7 @@ zvol_create_minor(const char *name, dev_t dev)
bioq_init(&zv->zv_queue); bioq_init(&zv->zv_queue);
mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF); mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF);
zv->zv_state = 0; zv->zv_state = 0;
kthread_create(zvol_worker, zv, NULL, 0, 0, "zvol:worker %s", pp->name); kproc_create(zvol_worker, zv, NULL, 0, 0, "zvol:worker %s", pp->name);
zvol_minors++; zvol_minors++;
end: end:

View File

@ -316,7 +316,7 @@ ntoskrnl_libinit()
kq = kq_queues + i; kq = kq_queues + i;
kq->kq_cpu = i; kq->kq_cpu = i;
sprintf(name, "Windows DPC %d", i); sprintf(name, "Windows DPC %d", i);
error = kthread_create(ntoskrnl_dpc_thread, kq, &p, error = kproc_create(ntoskrnl_dpc_thread, kq, &p,
RFHIGHPID, NDIS_KSTACK_PAGES, name); RFHIGHPID, NDIS_KSTACK_PAGES, name);
if (error) if (error)
panic("failed to launch DPC thread"); panic("failed to launch DPC thread");
@ -329,7 +329,7 @@ ntoskrnl_libinit()
for (i = 0; i < WORKITEM_THREADS; i++) { for (i = 0; i < WORKITEM_THREADS; i++) {
kq = wq_queues + i; kq = wq_queues + i;
sprintf(name, "Windows Workitem %d", i); sprintf(name, "Windows Workitem %d", i);
error = kthread_create(ntoskrnl_workitem_thread, kq, &p, error = kproc_create(ntoskrnl_workitem_thread, kq, &p,
RFHIGHPID, NDIS_KSTACK_PAGES, name); RFHIGHPID, NDIS_KSTACK_PAGES, name);
if (error) if (error)
panic("failed to launch workitem thread"); panic("failed to launch workitem thread");
@ -2801,7 +2801,7 @@ ntoskrnl_workitem_thread(arg)
#if __FreeBSD_version < 502113 #if __FreeBSD_version < 502113
mtx_lock(&Giant); mtx_lock(&Giant);
#endif #endif
kthread_exit(0); kproc_exit(0);
return; /* notreached */ return; /* notreached */
} }
@ -3519,7 +3519,7 @@ PsCreateSystemThread(handle, reqaccess, objattrs, phandle,
tc->tc_thrfunc = thrfunc; tc->tc_thrfunc = thrfunc;
sprintf(tname, "windows kthread %d", ntoskrnl_kth); sprintf(tname, "windows kthread %d", ntoskrnl_kth);
error = kthread_create(ntoskrnl_thrfunc, tc, &p, error = kproc_create(ntoskrnl_thrfunc, tc, &p,
RFHIGHPID, NDIS_KSTACK_PAGES, tname); RFHIGHPID, NDIS_KSTACK_PAGES, tname);
if (error) { if (error) {
@ -3562,7 +3562,7 @@ PsTerminateSystemThread(status)
#if __FreeBSD_version < 502113 #if __FreeBSD_version < 502113
mtx_lock(&Giant); mtx_lock(&Giant);
#endif #endif
kthread_exit(0); kproc_exit(0);
return(0); /* notreached */ return(0); /* notreached */
} }
@ -3871,7 +3871,7 @@ ntoskrnl_dpc_thread(arg)
#if __FreeBSD_version < 502113 #if __FreeBSD_version < 502113
mtx_lock(&Giant); mtx_lock(&Giant);
#endif #endif
kthread_exit(0); kproc_exit(0);
return; /* notreached */ return; /* notreached */
} }

View File

@ -77,12 +77,12 @@ thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg,
ASSERT(len == 0); ASSERT(len == 0);
ASSERT(state == TS_RUN); ASSERT(state == TS_RUN);
error = kthread_create(proc, arg, &p, 0, ZFS_KSTACK_PAGES, error = kproc_create(proc, arg, &p, 0, ZFS_KSTACK_PAGES,
"solthread %p", proc); "solthread %p", proc);
return (error == 0 ? FIRST_THREAD_IN_PROC(p) : NULL); return (error == 0 ? FIRST_THREAD_IN_PROC(p) : NULL);
} }
#define thread_exit() kthread_exit(0) #define thread_exit() kproc_exit(0)
#endif /* _KERNEL */ #endif /* _KERNEL */

View File

@ -207,7 +207,7 @@ vdev_geom_worker(void *arg)
ctx->gc_state = 2; ctx->gc_state = 2;
wakeup_one(&ctx->gc_state); wakeup_one(&ctx->gc_state);
mtx_unlock(&ctx->gc_queue_mtx); mtx_unlock(&ctx->gc_queue_mtx);
kthread_exit(0); kproc_exit(0);
} }
msleep(&ctx->gc_queue, &ctx->gc_queue_mtx, msleep(&ctx->gc_queue, &ctx->gc_queue_mtx,
PRIBIO | PDROP, "vgeom:io", 0); PRIBIO | PDROP, "vgeom:io", 0);
@ -440,7 +440,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *ashift)
vd->vdev_tsd = ctx; vd->vdev_tsd = ctx;
kthread_create(vdev_geom_worker, ctx, NULL, 0, 0, "vdev:worker %s", kproc_create(vdev_geom_worker, ctx, NULL, 0, 0, "vdev:worker %s",
pp->name); pp->name);
return (0); return (0);

View File

@ -359,7 +359,7 @@ zvol_worker(void *arg)
zv->zv_state = 2; zv->zv_state = 2;
wakeup(&zv->zv_state); wakeup(&zv->zv_state);
mtx_unlock(&zv->zv_queue_mtx); mtx_unlock(&zv->zv_queue_mtx);
kthread_exit(0); kproc_exit(0);
} }
msleep(&zv->zv_queue, &zv->zv_queue_mtx, PRIBIO | PDROP, msleep(&zv->zv_queue, &zv->zv_queue_mtx, PRIBIO | PDROP,
"zvol:io", 0); "zvol:io", 0);
@ -543,7 +543,7 @@ zvol_create_minor(const char *name, dev_t dev)
bioq_init(&zv->zv_queue); bioq_init(&zv->zv_queue);
mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF); mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF);
zv->zv_state = 0; zv->zv_state = 0;
kthread_create(zvol_worker, zv, NULL, 0, 0, "zvol:worker %s", pp->name); kproc_create(zvol_worker, zv, NULL, 0, 0, "zvol:worker %s", pp->name);
zvol_minors++; zvol_minors++;
end: end:

View File

@ -988,7 +988,7 @@ pf_purge_thread(void *v)
sx_sunlock(&pf_consistency_lock); sx_sunlock(&pf_consistency_lock);
PF_UNLOCK(); PF_UNLOCK();
wakeup(pf_purge_thread); wakeup(pf_purge_thread);
kthread_exit(0); kproc_exit(0);
} }
#endif #endif
s = splsoftnet(); s = splsoftnet();

View File

@ -386,7 +386,7 @@ pfattach(void)
/* XXX do our best to avoid a conflict */ /* XXX do our best to avoid a conflict */
pf_status.hostid = arc4random(); pf_status.hostid = arc4random();
if (kthread_create(pf_purge_thread, NULL, NULL, 0, 0, "pfpurge")) if (kproc_create(pf_purge_thread, NULL, NULL, 0, 0, "pfpurge"))
return (ENXIO); return (ENXIO);
return (error); return (error);
@ -464,13 +464,13 @@ pfattach(int num)
pf_status.hostid = arc4random(); pf_status.hostid = arc4random();
/* require process context to purge states, so perform in a thread */ /* require process context to purge states, so perform in a thread */
kthread_create_deferred(pf_thread_create, NULL); kproc_create_deferred(pf_thread_create, NULL);
} }
void void
pf_thread_create(void *v) pf_thread_create(void *v)
{ {
if (kthread_create(pf_purge_thread, NULL, NULL, "pfpurge")) if (kproc_create(pf_purge_thread, NULL, NULL, "pfpurge"))
panic("pfpurge thread"); panic("pfpurge thread");
} }

View File

@ -354,7 +354,7 @@ aac_attach(struct aac_softc *sc)
sc->aac_dev_t->si_drv1 = sc; sc->aac_dev_t->si_drv1 = sc;
/* Create the AIF thread */ /* Create the AIF thread */
if (kthread_create((void(*)(void *))aac_command_thread, sc, if (kproc_create((void(*)(void *))aac_command_thread, sc,
&sc->aifthread, 0, 0, "aac%daif", unit)) &sc->aifthread, 0, 0, "aac%daif", unit))
panic("Could not create AIF thread\n"); panic("Could not create AIF thread\n");
@ -990,7 +990,7 @@ aac_command_thread(struct aac_softc *sc)
mtx_unlock(&sc->aac_io_lock); mtx_unlock(&sc->aac_io_lock);
wakeup(sc->aac_dev); wakeup(sc->aac_dev);
kthread_exit(0); kproc_exit(0);
} }
/* /*

View File

@ -301,7 +301,7 @@ acpi_tz_attach(device_t dev)
sc->tz_event = EVENTHANDLER_REGISTER(power_profile_change, sc->tz_event = EVENTHANDLER_REGISTER(power_profile_change,
acpi_tz_power_profile, sc, 0); acpi_tz_power_profile, sc, 0);
if (acpi_tz_proc == NULL) { if (acpi_tz_proc == NULL) {
error = kthread_create(acpi_tz_thread, NULL, &acpi_tz_proc, error = kproc_create(acpi_tz_thread, NULL, &acpi_tz_proc,
RFHIGHPID, 0, "acpi_thermal"); RFHIGHPID, 0, "acpi_thermal");
if (error != 0) { if (error != 0) {
device_printf(sc->tz_dev, "could not create thread - %d", error); device_printf(sc->tz_dev, "could not create thread - %d", error);
@ -1088,7 +1088,7 @@ acpi_tz_cooling_thread(void *arg)
ACPI_LOCK(thermal); ACPI_LOCK(thermal);
sc->tz_cooling_proc_running = FALSE; sc->tz_cooling_proc_running = FALSE;
ACPI_UNLOCK(thermal); ACPI_UNLOCK(thermal);
kthread_exit(0); kproc_exit(0);
} }
/* /*
@ -1121,7 +1121,7 @@ acpi_tz_cooling_thread_start(struct acpi_tz_softc *sc)
if (sc->tz_cooling_proc == NULL) { if (sc->tz_cooling_proc == NULL) {
snprintf(name, sizeof(name), "acpi_cooling%d", snprintf(name, sizeof(name), "acpi_cooling%d",
device_get_unit(sc->tz_dev)); device_get_unit(sc->tz_dev));
error = kthread_create(acpi_tz_cooling_thread, sc, error = kproc_create(acpi_tz_cooling_thread, sc,
&sc->tz_cooling_proc, RFHIGHPID, 0, name); &sc->tz_cooling_proc, RFHIGHPID, 0, name);
if (error != 0) { if (error != 0) {
device_printf(sc->tz_dev, "could not create thread - %d", error); device_printf(sc->tz_dev, "could not create thread - %d", error);

View File

@ -125,7 +125,7 @@ aic_recovery_thread(void *arg)
aic->platform_data->recovery_thread = NULL; aic->platform_data->recovery_thread = NULL;
wakeup(aic->platform_data); wakeup(aic->platform_data);
aic_unlock(aic); aic_unlock(aic);
kthread_exit(0); kproc_exit(0);
} }
void void

View File

@ -127,10 +127,10 @@ aic_wakeup_recovery_thread(struct aic_softc *aic)
/****************************** Kernel Threads ********************************/ /****************************** Kernel Threads ********************************/
#if __FreeBSD_version > 500005 #if __FreeBSD_version > 500005
#define aic_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ #define aic_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg)
#else #else
#define aic_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ #define aic_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
kthread_create(func, farg, proc_ptr, fmtstr, arg) kproc_create(func, farg, proc_ptr, fmtstr, arg)
#endif #endif
/******************************* Bus Space/DMA ********************************/ /******************************* Bus Space/DMA ********************************/

View File

@ -899,7 +899,7 @@ static void msp3400c_thread(void *data)
wakeup(&msp->kthread); wakeup(&msp->kthread);
mtx_unlock(&Giant); mtx_unlock(&Giant);
kthread_exit(0); kproc_exit(0);
} }
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
@ -1126,7 +1126,7 @@ static void msp3410d_thread(void *data)
wakeup(&msp->kthread); wakeup(&msp->kthread);
mtx_unlock(&Giant); mtx_unlock(&Giant);
kthread_exit(0); kproc_exit(0);
} }
int msp_attach(bktr_ptr_t bktr) int msp_attach(bktr_ptr_t bktr)
@ -1197,11 +1197,11 @@ int msp_attach(bktr_ptr_t bktr)
} }
/* startup control thread */ /* startup control thread */
err = kthread_create(msp->simple ? msp3410d_thread : msp3400c_thread, err = kproc_create(msp->simple ? msp3410d_thread : msp3400c_thread,
bktr, &msp->kthread, (RFFDG | RFPROC), 0, bktr, &msp->kthread, (RFFDG | RFPROC), 0,
msp->threaddesc); msp->threaddesc);
if (err) { if (err) {
printf("%s: Error returned by kthread_create: %d", bktr_name(bktr), err); printf("%s: Error returned by kproc_create: %d", bktr_name(bktr), err);
free(msp->threaddesc, M_DEVBUF); free(msp->threaddesc, M_DEVBUF);
free(msp, M_DEVBUF); free(msp, M_DEVBUF);
bktr->msp3400c_info = NULL; bktr->msp3400c_info = NULL;

View File

@ -3807,7 +3807,7 @@ ciss_notify_thread(void *arg)
#if __FreeBSD_version >= 500000 #if __FreeBSD_version >= 500000
mtx_unlock(&sc->ciss_mtx); mtx_unlock(&sc->ciss_mtx);
#endif #endif
kthread_exit(0); kproc_exit(0);
} }
/************************************************************************ /************************************************************************
@ -3818,11 +3818,11 @@ ciss_spawn_notify_thread(struct ciss_softc *sc)
{ {
#if __FreeBSD_version > 500005 #if __FreeBSD_version > 500005
if (kthread_create((void(*)(void *))ciss_notify_thread, sc, if (kproc_create((void(*)(void *))ciss_notify_thread, sc,
&sc->ciss_notify_thread, 0, 0, "ciss_notify%d", &sc->ciss_notify_thread, 0, 0, "ciss_notify%d",
device_get_unit(sc->ciss_dev))) device_get_unit(sc->ciss_dev)))
#else #else
if (kthread_create((void(*)(void *))ciss_notify_thread, sc, if (kproc_create((void(*)(void *))ciss_notify_thread, sc,
&sc->ciss_notify_thread, "ciss_notify%d", &sc->ciss_notify_thread, "ciss_notify%d",
device_get_unit(sc->ciss_dev))) device_get_unit(sc->ciss_dev)))
#endif #endif

View File

@ -1207,7 +1207,7 @@ fdc_thread(void *arg)
fdc->flags &= ~(FDC_KTHREAD_EXIT | FDC_KTHREAD_ALIVE); fdc->flags &= ~(FDC_KTHREAD_EXIT | FDC_KTHREAD_ALIVE);
mtx_unlock(&fdc->fdc_mtx); mtx_unlock(&fdc->fdc_mtx);
kthread_exit(0); kproc_exit(0);
} }
/* /*
@ -1795,7 +1795,7 @@ fdc_attach(device_t dev)
fdout_wr(fdc, fdc->fdout = 0); fdout_wr(fdc, fdc->fdout = 0);
bioq_init(&fdc->head); bioq_init(&fdc->head);
kthread_create(fdc_thread, fdc, &fdc->fdc_thread, 0, 0, kproc_create(fdc_thread, fdc, &fdc->fdc_thread, 0, 0,
"fdc%d", device_get_unit(dev)); "fdc%d", device_get_unit(dev));
settle = hz / 8; settle = hz / 8;

View File

@ -440,7 +440,7 @@ firewire_attach(device_t dev)
(void *)firewire_watchdog, (void *)sc->fc); (void *)firewire_watchdog, (void *)sc->fc);
/* create thread */ /* create thread */
kthread_create(fw_bus_probe_thread, (void *)fc, &fc->probe_thread, kproc_create(fw_bus_probe_thread, (void *)fc, &fc->probe_thread,
0, 0, "fw%d_probe", unit); 0, 0, "fw%d_probe", unit);
/* Locate our children */ /* Locate our children */
@ -1661,7 +1661,7 @@ fw_bus_probe_thread(void *arg)
msleep((void *)fc, &fc->wait_lock, PWAIT|PCATCH, "-", 0); msleep((void *)fc, &fc->wait_lock, PWAIT|PCATCH, "-", 0);
} }
mtx_unlock(&fc->wait_lock); mtx_unlock(&fc->wait_lock);
kthread_exit(0); kproc_exit(0);
} }
/* /*

View File

@ -181,7 +181,7 @@ at45d_delayed_attach(void *xsc)
sc->disk->d_unit = device_get_unit(sc->dev); sc->disk->d_unit = device_get_unit(sc->dev);
disk_create(sc->disk, DISK_VERSION); disk_create(sc->disk, DISK_VERSION);
bioq_init(&sc->bio_queue); bioq_init(&sc->bio_queue);
kthread_create(&at45d_task, sc, &sc->p, 0, 0, "task: at45d flash"); kproc_create(&at45d_task, sc, &sc->p, 0, 0, "task: at45d flash");
config_intrhook_disestablish(&sc->config_intrhook); config_intrhook_disestablish(&sc->config_intrhook);
} }

View File

@ -2396,7 +2396,7 @@ static void hpt_worker_thread(void)
#endif #endif
*/ */
#if (__FreeBSD_version >= 500043) #if (__FreeBSD_version >= 500043)
kthread_suspend_check(curproc); kproc_suspend_check(curproc);
#else #else
kproc_suspend_loop(curproc); kproc_suspend_loop(curproc);
#endif #endif

View File

@ -362,7 +362,7 @@ pmclog_loop(void *arg)
crfree(ownercred); crfree(ownercred);
kthread_exit(0); kproc_exit(0);
} }
/* /*
@ -566,7 +566,7 @@ pmclog_configure_log(struct pmc_owner *po, int logfd)
/* mark process as owning a log file */ /* mark process as owning a log file */
po->po_flags |= PMC_PO_OWNS_LOGFILE; po->po_flags |= PMC_PO_OWNS_LOGFILE;
error = kthread_create(pmclog_loop, po, &po->po_kthread, error = kproc_create(pmclog_loop, po, &po->po_kthread,
RFHIGHPID, 0, "hwpmc: proc(%d)", p->p_pid); RFHIGHPID, 0, "hwpmc: proc(%d)", p->p_pid);
if (error) if (error)
goto error; goto error;

View File

@ -741,7 +741,7 @@ ndis_attach(dev)
#else #else
sc->ndis_tq = taskqueue_create("ndis_taskq", M_NOWAIT | M_ZERO, sc->ndis_tq = taskqueue_create("ndis_taskq", M_NOWAIT | M_ZERO,
taskqueue_thread_enqueue, &sc->ndis_tq, &sc->sc_tqproc); taskqueue_thread_enqueue, &sc->ndis_tq, &sc->sc_tqproc);
kthread_create(taskqueue_thread_loop, &sc->ndis_tq, &sc->sc_tqproc, kproc_create(taskqueue_thread_loop, &sc->ndis_tq, &sc->sc_tqproc,
0, 0, "%s taskq", device_get_nameunit(dev)); 0, 0, "%s taskq", device_get_nameunit(dev));
#endif #endif
TASK_INIT(&sc->ndis_scantask, 0, ndis_scan, sc); TASK_INIT(&sc->ndis_scantask, 0, ndis_scan, sc);

View File

@ -466,14 +466,14 @@ kcs_loop(void *arg)
ipmi_complete_request(sc, req); ipmi_complete_request(sc, req);
} }
IPMI_UNLOCK(sc); IPMI_UNLOCK(sc);
kthread_exit(0); kproc_exit(0);
} }
static int static int
kcs_startup(struct ipmi_softc *sc) kcs_startup(struct ipmi_softc *sc)
{ {
return (kthread_create(kcs_loop, sc, &sc->ipmi_kthread, 0, 0, "%s: kcs", return (kproc_create(kcs_loop, sc, &sc->ipmi_kthread, 0, 0, "%s: kcs",
device_get_nameunit(sc->ipmi_dev))); device_get_nameunit(sc->ipmi_dev)));
} }

View File

@ -372,14 +372,14 @@ smic_loop(void *arg)
ipmi_complete_request(sc, req); ipmi_complete_request(sc, req);
} }
IPMI_UNLOCK(sc); IPMI_UNLOCK(sc);
kthread_exit(0); kproc_exit(0);
} }
static int static int
smic_startup(struct ipmi_softc *sc) smic_startup(struct ipmi_softc *sc)
{ {
return (kthread_create(smic_loop, sc, &sc->ipmi_kthread, 0, 0, return (kproc_create(smic_loop, sc, &sc->ipmi_kthread, 0, 0,
"%s: smic", device_get_nameunit(sc->ipmi_dev))); "%s: smic", device_get_nameunit(sc->ipmi_dev)));
} }

View File

@ -348,14 +348,14 @@ ssif_loop(void *arg)
IPMI_LOCK(sc); IPMI_LOCK(sc);
} }
IPMI_UNLOCK(sc); IPMI_UNLOCK(sc);
kthread_exit(0); kproc_exit(0);
} }
static int static int
ssif_startup(struct ipmi_softc *sc) ssif_startup(struct ipmi_softc *sc)
{ {
return (kthread_create(ssif_loop, sc, &sc->ipmi_kthread, 0, 0, return (kproc_create(ssif_loop, sc, &sc->ipmi_kthread, 0, 0,
"%s: ssif", device_get_nameunit(sc->ipmi_dev))); "%s: ssif", device_get_nameunit(sc->ipmi_dev)));
} }

View File

@ -587,7 +587,7 @@ ism_proc(void *vp)
sdebug(3, "terminated"); sdebug(3, "terminated");
wakeup(sp); wakeup(sp);
kthread_exit(0); kproc_exit(0);
} }
#if 0 #if 0
@ -782,5 +782,5 @@ ism_start(isc_session_t *sp)
sp->flags |= ISC_SM_RUN; sp->flags |= ISC_SM_RUN;
return kthread_create(ism_proc, sp, &sp->stp, 0, 0, "ism_%d", sp->sid); return kproc_create(ism_proc, sp, &sp->stp, 0, 0, "ism_%d", sp->sid);
} }

View File

@ -539,7 +539,7 @@ isc_soc(void *vp)
mtx_unlock(&sp->io_mtx); mtx_unlock(&sp->io_mtx);
kthread_exit(0); kproc_exit(0);
} }
void void
@ -572,5 +572,5 @@ isc_start_receiver(isc_session_t *sp)
debug_called(8); debug_called(8);
sp->flags |= ISC_CON_RUN; sp->flags |= ISC_CON_RUN;
kthread_create(isc_soc, sp, &sp->soc_proc, 0, 0, "iscsi%d", sp->sid); kproc_create(isc_soc, sp, &sp->soc_proc, 0, 0, "iscsi%d", sp->sid);
} }

View File

@ -251,11 +251,11 @@ isp_attach(ispsoftc_t *isp)
isp_callout_init(&isp->isp_osinfo.gdt); isp_callout_init(&isp->isp_osinfo.gdt);
ISP_UNLOCK(isp); ISP_UNLOCK(isp);
#if __FreeBSD_version >= 500000 #if __FreeBSD_version >= 500000
if (kthread_create(isp_kthread, isp, &isp->isp_osinfo.kproc, if (kproc_create(isp_kthread, isp, &isp->isp_osinfo.kproc,
RFHIGHPID, 0, "%s: fc_thrd", RFHIGHPID, 0, "%s: fc_thrd",
device_get_nameunit(isp->isp_dev))) device_get_nameunit(isp->isp_dev)))
#else #else
if (kthread_create(isp_kthread, isp, &isp->isp_osinfo.kproc, if (kproc_create(isp_kthread, isp, &isp->isp_osinfo.kproc,
"%s: fc_thrd", device_get_nameunit(isp->isp_dev))) "%s: fc_thrd", device_get_nameunit(isp->isp_dev)))
#endif #endif
{ {

View File

@ -279,11 +279,11 @@ iwi_attach(device_t dev)
#else #else
sc->sc_tq = taskqueue_create("iwi_taskq", M_NOWAIT | M_ZERO, sc->sc_tq = taskqueue_create("iwi_taskq", M_NOWAIT | M_ZERO,
taskqueue_thread_enqueue, &sc->sc_tq, &sc->sc_tqproc); taskqueue_thread_enqueue, &sc->sc_tq, &sc->sc_tqproc);
kthread_create(taskqueue_thread_loop, &sc->sc_tq, &sc->sc_tqproc, kproc_create(taskqueue_thread_loop, &sc->sc_tq, &sc->sc_tqproc,
0, 0, "%s taskq", device_get_nameunit(dev)); 0, 0, "%s taskq", device_get_nameunit(dev));
sc->sc_tq2 = taskqueue_create("iwi_taskq2", M_NOWAIT | M_ZERO, sc->sc_tq2 = taskqueue_create("iwi_taskq2", M_NOWAIT | M_ZERO,
taskqueue_thread_enqueue, &sc->sc_tq2, &sc->sc_tqproc); taskqueue_thread_enqueue, &sc->sc_tq2, &sc->sc_tqproc);
kthread_create(taskqueue_thread_loop, &sc->sc_tq2, &sc->sc_tqproc, kproc_create(taskqueue_thread_loop, &sc->sc_tq2, &sc->sc_tqproc,
0, 0, "%s taskq2", device_get_nameunit(dev)); 0, 0, "%s taskq2", device_get_nameunit(dev));
#endif #endif
TASK_INIT(&sc->sc_radiontask, 0, iwi_radio_on, sc); TASK_INIT(&sc->sc_radiontask, 0, iwi_radio_on, sc);

View File

@ -701,7 +701,7 @@ md_kthread(void *arg)
if (sc->flags & MD_SHUTDOWN) { if (sc->flags & MD_SHUTDOWN) {
sc->flags |= MD_EXITING; sc->flags |= MD_EXITING;
mtx_unlock(&sc->queue_mtx); mtx_unlock(&sc->queue_mtx);
kthread_exit(0); kproc_exit(0);
} }
bp = bioq_takefirst(&sc->bio_queue); bp = bioq_takefirst(&sc->bio_queue);
if (!bp) { if (!bp) {
@ -765,7 +765,7 @@ mdnew(int unit, int *errp, enum md_types type)
sc->unit = unit; sc->unit = unit;
sprintf(sc->name, "md%d", unit); sprintf(sc->name, "md%d", unit);
LIST_INSERT_HEAD(&md_softc_list, sc, list); LIST_INSERT_HEAD(&md_softc_list, sc, list);
error = kthread_create(md_kthread, sc, &sc->procp, 0, 0,"%s", sc->name); error = kproc_create(md_kthread, sc, &sc->procp, 0, 0,"%s", sc->name);
if (error == 0) if (error == 0)
return (sc); return (sc);
LIST_REMOVE(sc, list); LIST_REMOVE(sc, list);

View File

@ -134,7 +134,7 @@ mmcsd_attach(device_t dev)
bioq_init(&sc->bio_queue); bioq_init(&sc->bio_queue);
sc->running = 1; sc->running = 1;
kthread_create(&mmcsd_task, sc, &sc->p, 0, 0, "task: mmc/sd card"); kproc_create(&mmcsd_task, sc, &sc->p, 0, 0, "task: mmc/sd card");
return (0); return (0);
} }
@ -284,7 +284,7 @@ mmcsd_task(void *arg)
wakeup(sc); wakeup(sc);
MMCSD_UNLOCK(sc); MMCSD_UNLOCK(sc);
kthread_exit(0); kproc_exit(0);
} }
static device_method_t mmcsd_methods[] = { static device_method_t mmcsd_methods[] = {

View File

@ -273,10 +273,10 @@ void mpt_map_rquest(void *, bus_dma_segment_t *, int, int);
/**************************** Kernel Thread Support ***************************/ /**************************** Kernel Thread Support ***************************/
#if __FreeBSD_version > 500005 #if __FreeBSD_version > 500005
#define mpt_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ #define mpt_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg)
#else #else
#define mpt_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ #define mpt_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \
kthread_create(func, farg, proc_ptr, fmtstr, arg) kproc_create(func, farg, proc_ptr, fmtstr, arg)
#endif #endif
/****************************** Timer Facilities ******************************/ /****************************** Timer Facilities ******************************/

View File

@ -3988,7 +3988,7 @@ mpt_recovery_thread(void *arg)
mpt->recovery_thread = NULL; mpt->recovery_thread = NULL;
wakeup(&mpt->recovery_thread); wakeup(&mpt->recovery_thread);
MPT_UNLOCK(mpt); MPT_UNLOCK(mpt);
kthread_exit(0); kproc_exit(0);
} }
static int static int

View File

@ -722,7 +722,7 @@ mpt_raid_thread(void *arg)
mpt->raid_thread = NULL; mpt->raid_thread = NULL;
wakeup(&mpt->raid_thread); wakeup(&mpt->raid_thread);
MPT_UNLOCK(mpt); MPT_UNLOCK(mpt);
kthread_exit(0); kproc_exit(0);
} }
#if 0 #if 0

View File

@ -169,7 +169,7 @@ g_ofwd_init(struct g_class *mp __unused)
sc->ofwd_sectorsize = OFWD_BLOCKSIZE; sc->ofwd_sectorsize = OFWD_BLOCKSIZE;
sc->ofwd_fwsectors = 0; sc->ofwd_fwsectors = 0;
sc->ofwd_fwheads = 0; sc->ofwd_fwheads = 0;
error = kthread_create(ofwd_kthread, sc, &sc->ofwd_procp, 0, 0, error = kproc_create(ofwd_kthread, sc, &sc->ofwd_procp, 0, 0,
"ofwd0"); "ofwd0");
if (error != 0) { if (error != 0) {
free(sc, M_DEVBUF); free(sc, M_DEVBUF);

View File

@ -332,11 +332,11 @@ cbb_detach(device_t brdev)
cbb_set(sc, CBB_SOCKET_EVENT, 0xffffffff); cbb_set(sc, CBB_SOCKET_EVENT, 0xffffffff);
/* /*
* Wait for the thread to die. kthread_exit will do a wakeup * Wait for the thread to die. kproc_exit will do a wakeup
* on the event thread's struct thread * so that we know it is * on the event thread's struct thread * so that we know it is
* safe to proceed. IF the thread is running, set the please * safe to proceed. IF the thread is running, set the please
* die flag and wait for it to comply. Since the wakeup on * die flag and wait for it to comply. Since the wakeup on
* the event thread happens only in kthread_exit, we don't * the event thread happens only in kproc_exit, we don't
* need to loop here. * need to loop here.
*/ */
bus_teardown_intr(brdev, sc->irq_res, sc->intrhand); bus_teardown_intr(brdev, sc->irq_res, sc->intrhand);
@ -529,7 +529,7 @@ cbb_event_thread(void *arg)
DEVPRINTF((sc->dev, "Thread terminating\n")); DEVPRINTF((sc->dev, "Thread terminating\n"));
sc->flags &= ~CBB_KTHREAD_RUNNING; sc->flags &= ~CBB_KTHREAD_RUNNING;
mtx_unlock(&sc->mtx); mtx_unlock(&sc->mtx);
kthread_exit(0); kproc_exit(0);
} }
/************************************************************************/ /************************************************************************/

View File

@ -434,7 +434,7 @@ cbb_pci_attach(device_t brdev)
cbb_print_config(brdev); cbb_print_config(brdev);
/* Start the thread */ /* Start the thread */
if (kthread_create(cbb_event_thread, sc, &sc->event_thread, 0, 0, if (kproc_create(cbb_event_thread, sc, &sc->event_thread, 0, 0,
"%s event thread", device_get_nameunit(brdev))) { "%s event thread", device_get_nameunit(brdev))) {
device_printf(brdev, "unable to create event thread.\n"); device_printf(brdev, "unable to create event thread.\n");
panic("cbb_create_event_thread"); panic("cbb_create_event_thread");

View File

@ -120,7 +120,7 @@ read_random_phony(void *buf, int count)
return (count); return (count);
} }
/* Helper routine to enable kthread_exit() to work while the module is /* Helper routine to enable kproc_exit() to work while the module is
* being (or has been) unloaded. * being (or has been) unloaded.
* This routine is in this file because it is always linked into the kernel, * This routine is in this file because it is always linked into the kernel,
* and will thus never be unloaded. This is critical for unloadable modules * and will thus never be unloaded. This is critical for unloadable modules
@ -130,6 +130,6 @@ void
random_set_wakeup_exit(void *control) random_set_wakeup_exit(void *control)
{ {
wakeup(control); wakeup(control);
kthread_exit(0); kproc_exit(0);
/* NOTREACHED */ /* NOTREACHED */
} }

View File

@ -181,7 +181,7 @@ random_yarrow_init(void)
mtx_init(&harvest_mtx, "entropy harvest mutex", NULL, MTX_SPIN); mtx_init(&harvest_mtx, "entropy harvest mutex", NULL, MTX_SPIN);
/* Start the hash/reseed thread */ /* Start the hash/reseed thread */
error = kthread_create(random_kthread, NULL, error = kproc_create(random_kthread, NULL,
&random_kthread_proc, RFHIGHPID, 0, "yarrow"); &random_kthread_proc, RFHIGHPID, 0, "yarrow");
if (error != 0) if (error != 0)
panic("Cannot create entropy maintenance thread."); panic("Cannot create entropy maintenance thread.");

View File

@ -461,7 +461,7 @@ seq_eventthread(void *arg)
mtx_unlock(&scp->seq_lock); mtx_unlock(&scp->seq_lock);
mtx_lock(&Giant); mtx_lock(&Giant);
SEQ_DEBUG(2, printf("seq_eventthread finished\n")); SEQ_DEBUG(2, printf("seq_eventthread finished\n"));
kthread_exit(0); kproc_exit(0);
} }
/* /*
@ -576,7 +576,7 @@ seq_addunit(void)
* TODO: Add to list of sequencers this module provides * TODO: Add to list of sequencers this module provides
*/ */
ret = kthread_create(seq_eventthread, scp, NULL, RFHIGHPID, 0, ret = kproc_create(seq_eventthread, scp, NULL, RFHIGHPID, 0,
"sequencer %02d", scp->unit); "sequencer %02d", scp->unit);
if (ret) if (ret)

View File

@ -338,7 +338,7 @@ usb_create_event_thread(void *arg)
struct usb_taskq *taskq; struct usb_taskq *taskq;
int i; int i;
if (kthread_create(usb_event_thread, sc, &sc->sc_event_thread, if (kproc_create(usb_event_thread, sc, &sc->sc_event_thread,
RFHIGHPID, 0, device_get_nameunit(sc->sc_dev))) { RFHIGHPID, 0, device_get_nameunit(sc->sc_dev))) {
printf("%s: unable to create event thread for\n", printf("%s: unable to create event thread for\n",
device_get_nameunit(sc->sc_dev)); device_get_nameunit(sc->sc_dev));
@ -351,7 +351,7 @@ usb_create_event_thread(void *arg)
taskq->taskcreated = 1; taskq->taskcreated = 1;
taskq->name = taskq_names[i]; taskq->name = taskq_names[i];
TAILQ_INIT(&taskq->tasks); TAILQ_INIT(&taskq->tasks);
if (kthread_create(usb_task_thread, taskq, if (kproc_create(usb_task_thread, taskq,
&taskq->task_thread_proc, RFHIGHPID, 0, &taskq->task_thread_proc, RFHIGHPID, 0,
taskq->name)) { taskq->name)) {
printf("unable to create task thread\n"); printf("unable to create task thread\n");
@ -453,7 +453,7 @@ usb_event_thread(void *arg)
wakeup(sc); wakeup(sc);
DPRINTF(("usb_event_thread: exit\n")); DPRINTF(("usb_event_thread: exit\n"));
kthread_exit(0); kproc_exit(0);
} }
void void
@ -490,7 +490,7 @@ usb_task_thread(void *arg)
wakeup(&taskq->taskcreated); wakeup(&taskq->taskcreated);
DPRINTF(("usb_event_thread: exit\n")); DPRINTF(("usb_event_thread: exit\n"));
kthread_exit(0); kproc_exit(0);
} }
int int

View File

@ -83,10 +83,10 @@ typedef struct thread *usb_proc_ptr;
#define uio_procp uio_td #define uio_procp uio_td
#define usb_kthread_create1(f, s, p, a0, a1) \ #define usb_kthread_create1(f, s, p, a0, a1) \
kthread_create((f), (s), (p), RFHIGHPID, 0, (a0), (a1)) kproc_create((f), (s), (p), RFHIGHPID, 0, (a0), (a1))
#define usb_kthread_create2(f, s, p, a0) \ #define usb_kthread_create2(f, s, p, a0) \
kthread_create((f), (s), (p), RFHIGHPID, 0, (a0)) kproc_create((f), (s), (p), RFHIGHPID, 0, (a0))
#define usb_kthread_create kthread_create #define usb_kthread_create kproc_create
#define config_pending_incr() #define config_pending_incr()
#define config_pending_decr() #define config_pending_decr()

View File

@ -623,7 +623,7 @@ utopia_daemon(void *arg __unused)
} }
wakeup_one(&utopia_list); wakeup_one(&utopia_list);
UTP_RUNLOCK_LIST(); UTP_RUNLOCK_LIST();
kthread_exit(0); kproc_exit(0);
} }
/* /*
@ -639,7 +639,7 @@ utopia_mod_init(module_t mod, int what, void *arg)
case MOD_LOAD: case MOD_LOAD:
mtx_init(&utopia_list_mtx, "utopia list mutex", NULL, MTX_DEF); mtx_init(&utopia_list_mtx, "utopia list mutex", NULL, MTX_DEF);
err = kthread_create(utopia_daemon, NULL, &utopia_kproc, err = kproc_create(utopia_daemon, NULL, &utopia_kproc,
RFHIGHPID, 0, "utopia"); RFHIGHPID, 0, "utopia");
if (err != 0) { if (err != 0) {
printf("cannot created utopia thread %d\n", err); printf("cannot created utopia thread %d\n", err);

View File

@ -183,7 +183,7 @@ g_bde_create_geom(struct gctl_req *req, struct g_class *mp, struct g_provider *p
TAILQ_INIT(&sc->worklist); TAILQ_INIT(&sc->worklist);
mtx_init(&sc->worklist_mutex, "g_bde_worklist", NULL, MTX_DEF); mtx_init(&sc->worklist_mutex, "g_bde_worklist", NULL, MTX_DEF);
/* XXX: error check */ /* XXX: error check */
kthread_create(g_bde_worker, gp, &sc->thread, 0, 0, kproc_create(g_bde_worker, gp, &sc->thread, 0, 0,
"g_bde %s", gp->name); "g_bde %s", gp->name);
pp = g_new_providerf(gp, gp->name); pp = g_new_providerf(gp, gp->name);
#if 0 #if 0

View File

@ -664,7 +664,7 @@ g_bde_worker(void *arg)
mtx_unlock(&sc->worklist_mutex); mtx_unlock(&sc->worklist_mutex);
sc->dead = 2; sc->dead = 2;
wakeup(sc); wakeup(sc);
kthread_exit(0); kproc_exit(0);
} }
/* /*

View File

@ -352,7 +352,7 @@ g_eli_worker(void *arg)
curthread->td_proc->p_comm); curthread->td_proc->p_comm);
wakeup(&sc->sc_workers); wakeup(&sc->sc_workers);
mtx_unlock(&sc->sc_queue_mtx); mtx_unlock(&sc->sc_queue_mtx);
kthread_exit(0); kproc_exit(0);
} }
msleep(sc, &sc->sc_queue_mtx, PRIBIO | PDROP, msleep(sc, &sc->sc_queue_mtx, PRIBIO | PDROP,
"geli:w", 0); "geli:w", 0);
@ -682,7 +682,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp,
goto failed; goto failed;
} }
error = kthread_create(g_eli_worker, wr, &wr->w_proc, 0, 0, error = kproc_create(g_eli_worker, wr, &wr->w_proc, 0, 0,
"g_eli[%u] %s", i, bpp->name); "g_eli[%u] %s", i, bpp->name);
if (error != 0) { if (error != 0) {
crypto_freesession(wr->w_sid); crypto_freesession(wr->w_sid);

View File

@ -2146,7 +2146,7 @@ g_journal_worker(void *arg)
sc->sc_worker = NULL; sc->sc_worker = NULL;
wakeup(&sc->sc_worker); wakeup(&sc->sc_worker);
mtx_unlock(&sc->sc_mtx); mtx_unlock(&sc->sc_mtx);
kthread_exit(0); kproc_exit(0);
} }
sleep: sleep:
g_journal_wait(sc, last_write); g_journal_wait(sc, last_write);
@ -2381,7 +2381,7 @@ g_journal_create(struct g_class *mp, struct g_provider *pp,
callout_drain(&sc->sc_callout); callout_drain(&sc->sc_callout);
} }
error = kthread_create(g_journal_worker, sc, &sc->sc_worker, 0, 0, error = kproc_create(g_journal_worker, sc, &sc->sc_worker, 0, 0,
"g_journal %s", sc->sc_name); "g_journal %s", sc->sc_name);
if (error != 0) { if (error != 0) {
GJ_DEBUG(0, "Cannot create worker thread for %s.journal.", GJ_DEBUG(0, "Cannot create worker thread for %s.journal.",
@ -2766,7 +2766,7 @@ g_journal_init(struct g_class *mp)
g_journal_lowmem, mp, EVENTHANDLER_PRI_FIRST); g_journal_lowmem, mp, EVENTHANDLER_PRI_FIRST);
if (g_journal_event_lowmem == NULL) if (g_journal_event_lowmem == NULL)
GJ_DEBUG(0, "Warning! Cannot register lowmem event."); GJ_DEBUG(0, "Warning! Cannot register lowmem event.");
error = kthread_create(g_journal_switcher, mp, NULL, 0, 0, error = kproc_create(g_journal_switcher, mp, NULL, 0, 0,
"g_journal switcher"); "g_journal switcher");
KASSERT(error == 0, ("Cannot create switcher thread.")); KASSERT(error == 0, ("Cannot create switcher thread."));
} }
@ -3025,7 +3025,7 @@ g_journal_switcher(void *arg)
g_journal_switcher_state = GJ_SWITCHER_DIED; g_journal_switcher_state = GJ_SWITCHER_DIED;
GJ_DEBUG(1, "Switcher exiting."); GJ_DEBUG(1, "Switcher exiting.");
wakeup(&g_journal_switcher_state); wakeup(&g_journal_switcher_state);
kthread_exit(0); kproc_exit(0);
} }
if (error == 0 && g_journal_sync_requested == 0) { if (error == 0 && g_journal_sync_requested == 0) {
GJ_DEBUG(1, "Out of cache, force switch (used=%u " GJ_DEBUG(1, "Out of cache, force switch (used=%u "

View File

@ -1815,7 +1815,7 @@ g_mirror_worker(void *arg)
if (g_mirror_try_destroy(sc)) { if (g_mirror_try_destroy(sc)) {
curthread->td_pflags &= ~TDP_GEOM; curthread->td_pflags &= ~TDP_GEOM;
G_MIRROR_DEBUG(1, "Thread exiting."); G_MIRROR_DEBUG(1, "Thread exiting.");
kthread_exit(0); kproc_exit(0);
} }
} }
G_MIRROR_DEBUG(5, "%s: I'm here 1.", __func__); G_MIRROR_DEBUG(5, "%s: I'm here 1.", __func__);
@ -1839,7 +1839,7 @@ g_mirror_worker(void *arg)
if (g_mirror_try_destroy(sc)) { if (g_mirror_try_destroy(sc)) {
curthread->td_pflags &= ~TDP_GEOM; curthread->td_pflags &= ~TDP_GEOM;
G_MIRROR_DEBUG(1, "Thread exiting."); G_MIRROR_DEBUG(1, "Thread exiting.");
kthread_exit(0); kproc_exit(0);
} }
mtx_lock(&sc->sc_queue_mtx); mtx_lock(&sc->sc_queue_mtx);
} }
@ -2890,7 +2890,7 @@ g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md)
gp->orphan = g_mirror_orphan; gp->orphan = g_mirror_orphan;
sc->sc_sync.ds_geom = gp; sc->sc_sync.ds_geom = gp;
sc->sc_sync.ds_ndisks = 0; sc->sc_sync.ds_ndisks = 0;
error = kthread_create(g_mirror_worker, sc, &sc->sc_worker, 0, 0, error = kproc_create(g_mirror_worker, sc, &sc->sc_worker, 0, 0,
"g_mirror %s", md->md_name); "g_mirror %s", md->md_name);
if (error != 0) { if (error != 0) {
G_MIRROR_DEBUG(1, "Cannot create kernel thread for %s.", G_MIRROR_DEBUG(1, "Cannot create kernel thread for %s.",

View File

@ -239,7 +239,7 @@ g_multipath_kt(void *arg)
} }
mtx_unlock(&gmtbq_mtx); mtx_unlock(&gmtbq_mtx);
wakeup(&g_multipath_kt_state); wakeup(&g_multipath_kt_state);
kthread_exit(0); kproc_exit(0);
} }
@ -421,7 +421,7 @@ g_multipath_init(struct g_class *mp)
{ {
bioq_init(&gmtbq); bioq_init(&gmtbq);
mtx_init(&gmtbq_mtx, "gmtbq", NULL, MTX_DEF); mtx_init(&gmtbq_mtx, "gmtbq", NULL, MTX_DEF);
if (kthread_create(g_multipath_kt, mp, NULL, 0, 0, "g_mp_kt") == 0) { if (kproc_create(g_multipath_kt, mp, NULL, 0, 0, "g_mp_kt") == 0) {
g_multipath_kt_state = GKT_RUN; g_multipath_kt_state = GKT_RUN;
} }
} }

View File

@ -2064,7 +2064,7 @@ g_raid3_worker(void *arg)
if (g_raid3_try_destroy(sc)) { if (g_raid3_try_destroy(sc)) {
curthread->td_pflags &= ~TDP_GEOM; curthread->td_pflags &= ~TDP_GEOM;
G_RAID3_DEBUG(1, "Thread exiting."); G_RAID3_DEBUG(1, "Thread exiting.");
kthread_exit(0); kproc_exit(0);
} }
} }
G_RAID3_DEBUG(5, "%s: I'm here 1.", __func__); G_RAID3_DEBUG(5, "%s: I'm here 1.", __func__);
@ -2088,7 +2088,7 @@ g_raid3_worker(void *arg)
if (g_raid3_try_destroy(sc)) { if (g_raid3_try_destroy(sc)) {
curthread->td_pflags &= ~TDP_GEOM; curthread->td_pflags &= ~TDP_GEOM;
G_RAID3_DEBUG(1, "Thread exiting."); G_RAID3_DEBUG(1, "Thread exiting.");
kthread_exit(0); kproc_exit(0);
} }
mtx_lock(&sc->sc_queue_mtx); mtx_lock(&sc->sc_queue_mtx);
} }
@ -3170,7 +3170,7 @@ g_raid3_create(struct g_class *mp, const struct g_raid3_metadata *md)
sc->sc_zones[G_RAID3_ZONE_4K].sz_failed = 0; sc->sc_zones[G_RAID3_ZONE_4K].sz_failed = 0;
} }
error = kthread_create(g_raid3_worker, sc, &sc->sc_worker, 0, 0, error = kproc_create(g_raid3_worker, sc, &sc->sc_worker, 0, 0,
"g_raid3 %s", md->md_name); "g_raid3 %s", md->md_name);
if (error != 0) { if (error != 0) {
G_RAID3_DEBUG(1, "Cannot create kernel thread for %s.", G_RAID3_DEBUG(1, "Cannot create kernel thread for %s.",

View File

@ -80,7 +80,7 @@ gv_config_new_drive(struct gv_drive *d)
d->bqueue = g_malloc(sizeof(struct bio_queue_head), M_WAITOK | M_ZERO); d->bqueue = g_malloc(sizeof(struct bio_queue_head), M_WAITOK | M_ZERO);
bioq_init(d->bqueue); bioq_init(d->bqueue);
mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF); mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF);
kthread_create(gv_drive_worker, d, NULL, 0, 0, "gv_d %s", d->name); kproc_create(gv_drive_worker, d, NULL, 0, 0, "gv_d %s", d->name);
d->flags |= GV_DRIVE_THREAD_ACTIVE; d->flags |= GV_DRIVE_THREAD_ACTIVE;
} }
@ -373,7 +373,7 @@ gv_drive_worker(void *arg)
mtx_unlock(&d->bqueue_mtx); mtx_unlock(&d->bqueue_mtx);
d->flags |= GV_DRIVE_THREAD_DEAD; d->flags |= GV_DRIVE_THREAD_DEAD;
kthread_exit(ENXIO); kproc_exit(ENXIO);
} }
@ -509,7 +509,7 @@ gv_drive_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF); mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF);
if (!(d->flags & GV_DRIVE_THREAD_ACTIVE)) { if (!(d->flags & GV_DRIVE_THREAD_ACTIVE)) {
kthread_create(gv_drive_worker, d, NULL, 0, 0, kproc_create(gv_drive_worker, d, NULL, 0, 0,
"gv_d %s", d->name); "gv_d %s", d->name);
d->flags |= GV_DRIVE_THREAD_ACTIVE; d->flags |= GV_DRIVE_THREAD_ACTIVE;
} }

View File

@ -348,7 +348,7 @@ gv_sync(struct gv_volume *v)
sync->from = up; sync->from = up;
sync->to = p; sync->to = p;
sync->syncsize = GV_DFLT_SYNCSIZE; sync->syncsize = GV_DFLT_SYNCSIZE;
kthread_create(gv_sync_td, sync, NULL, 0, 0, "gv_sync '%s'", kproc_create(gv_sync_td, sync, NULL, 0, 0, "gv_sync '%s'",
p->name); p->name);
} }
@ -371,7 +371,7 @@ gv_rebuild_plex(struct gv_plex *p)
sync->to = p; sync->to = p;
sync->syncsize = GV_DFLT_SYNCSIZE; sync->syncsize = GV_DFLT_SYNCSIZE;
kthread_create(gv_rebuild_td, sync, NULL, 0, 0, "gv_rebuild %s", kproc_create(gv_rebuild_td, sync, NULL, 0, 0, "gv_rebuild %s",
p->name); p->name);
return (0); return (0);
@ -389,7 +389,7 @@ gv_init_plex(struct gv_plex *p)
return (EINPROGRESS); return (EINPROGRESS);
gv_set_sd_state(s, GV_SD_INITIALIZING, GV_SETSTATE_FORCE); gv_set_sd_state(s, GV_SD_INITIALIZING, GV_SETSTATE_FORCE);
s->init_size = GV_DFLT_SYNCSIZE; s->init_size = GV_DFLT_SYNCSIZE;
kthread_create(gv_init_td, s, NULL, 0, 0, "gv_init %s", kproc_create(gv_init_td, s, NULL, 0, 0, "gv_init %s",
s->name); s->name);
} }
@ -422,7 +422,7 @@ gv_rebuild_td(void *arg)
g_topology_unlock(); g_topology_unlock();
printf("GEOM_VINUM: rebuild of %s failed to access consumer: " printf("GEOM_VINUM: rebuild of %s failed to access consumer: "
"%d\n", p->name, error); "%d\n", p->name, error);
kthread_exit(error); kproc_exit(error);
} }
g_topology_unlock(); g_topology_unlock();
@ -480,7 +480,7 @@ gv_rebuild_td(void *arg)
printf("GEOM_VINUM: rebuild of %s finished\n", p->name); printf("GEOM_VINUM: rebuild of %s finished\n", p->name);
g_free(sync); g_free(sync);
kthread_exit(error); kproc_exit(error);
} }
void void
@ -511,7 +511,7 @@ gv_sync_td(void *arg)
printf("GEOM_VINUM: sync from '%s' failed to access " printf("GEOM_VINUM: sync from '%s' failed to access "
"consumer: %d\n", sync->from->name, error); "consumer: %d\n", sync->from->name, error);
g_free(sync); g_free(sync);
kthread_exit(error); kproc_exit(error);
} }
error = g_access(to, 0, 1, 0); error = g_access(to, 0, 1, 0);
if (error) { if (error) {
@ -520,7 +520,7 @@ gv_sync_td(void *arg)
printf("GEOM_VINUM: sync to '%s' failed to access " printf("GEOM_VINUM: sync to '%s' failed to access "
"consumer: %d\n", p->name, error); "consumer: %d\n", p->name, error);
g_free(sync); g_free(sync);
kthread_exit(error); kproc_exit(error);
} }
g_topology_unlock(); g_topology_unlock();
@ -593,7 +593,7 @@ gv_sync_td(void *arg)
p->synced = 0; p->synced = 0;
g_free(sync); g_free(sync);
kthread_exit(error); kproc_exit(error);
} }
void void
@ -632,7 +632,7 @@ gv_init_td(void *arg)
g_topology_unlock(); g_topology_unlock();
printf("GEOM_VINUM: subdisk '%s' init: failed to access " printf("GEOM_VINUM: subdisk '%s' init: failed to access "
"consumer; error: %d\n", s->name, error); "consumer; error: %d\n", s->name, error);
kthread_exit(error); kproc_exit(error);
} }
g_topology_unlock(); g_topology_unlock();
@ -667,5 +667,5 @@ gv_init_td(void *arg)
printf("GEOM_VINUM: subdisk '%s' init: finished successfully\n", printf("GEOM_VINUM: subdisk '%s' init: finished successfully\n",
s->name); s->name);
} }
kthread_exit(error); kproc_exit(error);
} }

View File

@ -332,7 +332,7 @@ gv_plex_worker(void *arg)
p->flags |= GV_PLEX_THREAD_DEAD; p->flags |= GV_PLEX_THREAD_DEAD;
wakeup(p); wakeup(p);
kthread_exit(ENXIO); kproc_exit(ENXIO);
} }
static int static int
@ -783,7 +783,7 @@ gv_plex_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
if (mtx_initialized(&p->bqueue_mtx) == 0) if (mtx_initialized(&p->bqueue_mtx) == 0)
mtx_init(&p->bqueue_mtx, "gv_plex", NULL, MTX_DEF); mtx_init(&p->bqueue_mtx, "gv_plex", NULL, MTX_DEF);
if (!(p->flags & GV_PLEX_THREAD_ACTIVE)) { if (!(p->flags & GV_PLEX_THREAD_ACTIVE)) {
kthread_create(gv_plex_worker, p, NULL, 0, 0, "gv_p %s", kproc_create(gv_plex_worker, p, NULL, 0, 0, "gv_p %s",
p->name); p->name);
p->flags |= GV_PLEX_THREAD_ACTIVE; p->flags |= GV_PLEX_THREAD_ACTIVE;
} }
@ -807,7 +807,7 @@ gv_plex_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
M_WAITOK | M_ZERO); M_WAITOK | M_ZERO);
bioq_init(p->wqueue); bioq_init(p->wqueue);
mtx_init(&p->bqueue_mtx, "gv_plex", NULL, MTX_DEF); mtx_init(&p->bqueue_mtx, "gv_plex", NULL, MTX_DEF);
kthread_create(gv_plex_worker, p, NULL, 0, 0, "gv_p %s", kproc_create(gv_plex_worker, p, NULL, 0, 0, "gv_p %s",
p->name); p->name);
p->flags |= GV_PLEX_THREAD_ACTIVE; p->flags |= GV_PLEX_THREAD_ACTIVE;

View File

@ -149,7 +149,7 @@ gv_vol_worker(void *arg)
v->flags |= GV_VOL_THREAD_DEAD; v->flags |= GV_VOL_THREAD_DEAD;
wakeup(v); wakeup(v);
kthread_exit(ENXIO); kproc_exit(ENXIO);
} }
static void static void
@ -369,7 +369,7 @@ gv_volume_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
mtx_init(&v->bqueue_mtx, "gv_plex", NULL, MTX_DEF); mtx_init(&v->bqueue_mtx, "gv_plex", NULL, MTX_DEF);
if (!(v->flags & GV_VOL_THREAD_ACTIVE)) { if (!(v->flags & GV_VOL_THREAD_ACTIVE)) {
kthread_create(gv_vol_worker, v, NULL, 0, 0, "gv_v %s", kproc_create(gv_vol_worker, v, NULL, 0, 0, "gv_v %s",
v->name); v->name);
v->flags |= GV_VOL_THREAD_ACTIVE; v->flags |= GV_VOL_THREAD_ACTIVE;
} }

View File

@ -754,7 +754,7 @@ apm_event_thread(void *arg)
mtx_unlock(&sc->mtx); mtx_unlock(&sc->mtx);
} }
sc->running = 0; sc->running = 0;
kthread_exit(0); kproc_exit(0);
} }
/* enable APM BIOS */ /* enable APM BIOS */
@ -770,7 +770,7 @@ apm_event_enable(void)
/* Start the thread */ /* Start the thread */
sc->active = 1; sc->active = 1;
if (kthread_create(apm_event_thread, sc, &sc->event_thread, 0, 0, if (kproc_create(apm_event_thread, sc, &sc->event_thread, 0, 0,
"apm worker")) "apm worker"))
panic("Cannot create apm worker thread"); panic("Cannot create apm worker thread");

View File

@ -691,7 +691,7 @@ start_init(void *dummy)
} }
/* /*
* Like kthread_create(), but runs in it's own address space. * Like kproc_create(), but runs in it's own address space.
* We do this early to reserve pid 1. * We do this early to reserve pid 1.
* *
* Note special case - do not make it runnable yet. Other work * Note special case - do not make it runnable yet. Other work

View File

@ -283,7 +283,7 @@ acct(struct thread *td, struct acct_args *uap)
* than one, but if so the extras will commit suicide as * than one, but if so the extras will commit suicide as
* soon as they start up. * soon as they start up.
*/ */
error = kthread_create(acct_thread, NULL, NULL, 0, 0, error = kproc_create(acct_thread, NULL, NULL, 0, 0,
"accounting"); "accounting");
if (error) { if (error) {
vfslocked = VFS_LOCK_GIANT(acct_vp->v_mount); vfslocked = VFS_LOCK_GIANT(acct_vp->v_mount);
@ -625,7 +625,7 @@ acct_thread(void *dummy)
sx_xlock(&acct_sx); sx_xlock(&acct_sx);
if (acct_state & ACCT_RUNNING) { if (acct_state & ACCT_RUNNING) {
sx_xunlock(&acct_sx); sx_xunlock(&acct_sx);
kthread_exit(0); kproc_exit(0);
} }
acct_state |= ACCT_RUNNING; acct_state |= ACCT_RUNNING;
@ -652,5 +652,5 @@ acct_thread(void *dummy)
*/ */
acct_state = 0; acct_state = 0;
sx_xunlock(&acct_sx); sx_xunlock(&acct_sx);
kthread_exit(0); kproc_exit(0);
} }

View File

@ -802,7 +802,7 @@ fork_exit(callout, arg, frame)
if (p->p_flag & P_KTHREAD) { if (p->p_flag & P_KTHREAD) {
printf("Kernel thread \"%s\" (pid %d) exited prematurely.\n", printf("Kernel thread \"%s\" (pid %d) exited prematurely.\n",
p->p_comm, p->p_pid); p->p_comm, p->p_pid);
kthread_exit(0); kproc_exit(0);
} }
mtx_assert(&Giant, MA_NOTOWNED); mtx_assert(&Giant, MA_NOTOWNED);

View File

@ -60,16 +60,16 @@ idle_setup(void *dummy)
#ifdef SMP #ifdef SMP
SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { SLIST_FOREACH(pc, &cpuhead, pc_allcpu) {
error = kthread_create(sched_idletd, NULL, &p, error = kproc_create(sched_idletd, NULL, &p,
RFSTOPPED | RFHIGHPID, 0, "idle: cpu%d", pc->pc_cpuid); RFSTOPPED | RFHIGHPID, 0, "idle: cpu%d", pc->pc_cpuid);
pc->pc_idlethread = FIRST_THREAD_IN_PROC(p); pc->pc_idlethread = FIRST_THREAD_IN_PROC(p);
#else #else
error = kthread_create(sched_idletd, NULL, &p, error = kproc_create(sched_idletd, NULL, &p,
RFSTOPPED | RFHIGHPID, 0, "idle"); RFSTOPPED | RFHIGHPID, 0, "idle");
PCPU_SET(idlethread, FIRST_THREAD_IN_PROC(p)); PCPU_SET(idlethread, FIRST_THREAD_IN_PROC(p));
#endif #endif
if (error) if (error)
panic("idle_setup: kthread_create error %d\n", error); panic("idle_setup: kproc_create error %d\n", error);
PROC_LOCK(p); PROC_LOCK(p);
p->p_flag |= P_NOLOAD; p->p_flag |= P_NOLOAD;

View File

@ -337,10 +337,10 @@ ithread_create(const char *name)
ithd = malloc(sizeof(struct intr_thread), M_ITHREAD, M_WAITOK | M_ZERO); ithd = malloc(sizeof(struct intr_thread), M_ITHREAD, M_WAITOK | M_ZERO);
error = kthread_create(ithread_loop, ithd, &p, RFSTOPPED | RFHIGHPID, error = kproc_create(ithread_loop, ithd, &p, RFSTOPPED | RFHIGHPID,
0, "%s", name); 0, "%s", name);
if (error) if (error)
panic("kthread_create() failed with %d", error); panic("kproc_create() failed with %d", error);
td = FIRST_THREAD_IN_PROC(p); /* XXXKSE */ td = FIRST_THREAD_IN_PROC(p); /* XXXKSE */
thread_lock(td); thread_lock(td);
sched_class(td, PRI_ITHD); sched_class(td, PRI_ITHD);
@ -362,10 +362,10 @@ ithread_create(const char *name, struct intr_handler *ih)
ithd = malloc(sizeof(struct intr_thread), M_ITHREAD, M_WAITOK | M_ZERO); ithd = malloc(sizeof(struct intr_thread), M_ITHREAD, M_WAITOK | M_ZERO);
error = kthread_create(ithread_loop, ih, &p, RFSTOPPED | RFHIGHPID, error = kproc_create(ithread_loop, ih, &p, RFSTOPPED | RFHIGHPID,
0, "%s", name); 0, "%s", name);
if (error) if (error)
panic("kthread_create() failed with %d", error); panic("kproc_create() failed with %d", error);
td = FIRST_THREAD_IN_PROC(p); /* XXXKSE */ td = FIRST_THREAD_IN_PROC(p); /* XXXKSE */
thread_lock(td); thread_lock(td);
sched_class(td, PRI_ITHD); sched_class(td, PRI_ITHD);
@ -1102,7 +1102,7 @@ ithread_loop(void *arg)
CTR3(KTR_INTR, "%s: pid %d (%s) exiting", __func__, CTR3(KTR_INTR, "%s: pid %d (%s) exiting", __func__,
p->p_pid, p->p_comm); p->p_pid, p->p_comm);
free(ithd, M_ITHREAD); free(ithd, M_ITHREAD);
kthread_exit(0); kproc_exit(0);
} }
/* /*
@ -1173,7 +1173,7 @@ ithread_loop(void *arg)
CTR3(KTR_INTR, "%s: pid %d (%s) exiting", __func__, CTR3(KTR_INTR, "%s: pid %d (%s) exiting", __func__,
p->p_pid, p->p_comm); p->p_pid, p->p_comm);
free(ithd, M_ITHREAD); free(ithd, M_ITHREAD);
kthread_exit(0); kproc_exit(0);
} }
/* /*

View File

@ -56,7 +56,7 @@ kproc_start(udata)
const struct kproc_desc *kp = udata; const struct kproc_desc *kp = udata;
int error; int error;
error = kthread_create((void (*)(void *))kp->func, NULL, error = kproc_create((void (*)(void *))kp->func, NULL,
kp->global_procpp, 0, 0, "%s", kp->arg0); kp->global_procpp, 0, 0, "%s", kp->arg0);
if (error) if (error)
panic("kproc_start: %s: error %d", kp->arg0, error); panic("kproc_start: %s: error %d", kp->arg0, error);
@ -73,7 +73,7 @@ kproc_start(udata)
* fmt and following will be *printf'd into (*newpp)->p_comm (for ps, etc.). * fmt and following will be *printf'd into (*newpp)->p_comm (for ps, etc.).
*/ */
int int
kthread_create(void (*func)(void *), void *arg, kproc_create(void (*func)(void *), void *arg,
struct proc **newpp, int flags, int pages, const char *fmt, ...) struct proc **newpp, int flags, int pages, const char *fmt, ...)
{ {
int error; int error;
@ -82,7 +82,7 @@ kthread_create(void (*func)(void *), void *arg,
struct proc *p2; struct proc *p2;
if (!proc0.p_stats) if (!proc0.p_stats)
panic("kthread_create called too soon"); panic("kproc_create called too soon");
error = fork1(&thread0, RFMEM | RFFDG | RFPROC | RFSTOPPED | flags, error = fork1(&thread0, RFMEM | RFFDG | RFPROC | RFSTOPPED | flags,
pages, &p2); pages, &p2);
@ -122,7 +122,7 @@ kthread_create(void (*func)(void *), void *arg,
} }
void void
kthread_exit(int ecode) kproc_exit(int ecode)
{ {
struct thread *td; struct thread *td;
struct proc *p; struct proc *p;
@ -154,7 +154,7 @@ kthread_exit(int ecode)
* Participation is voluntary. * Participation is voluntary.
*/ */
int int
kthread_suspend(struct proc *p, int timo) kproc_suspend(struct proc *p, int timo)
{ {
/* /*
* Make sure this is indeed a system process and we can safely * Make sure this is indeed a system process and we can safely
@ -171,7 +171,7 @@ kthread_suspend(struct proc *p, int timo)
} }
int int
kthread_resume(struct proc *p) kproc_resume(struct proc *p)
{ {
/* /*
* Make sure this is indeed a system process and we can safely * Make sure this is indeed a system process and we can safely
@ -189,7 +189,7 @@ kthread_resume(struct proc *p)
} }
void void
kthread_suspend_check(struct proc *p) kproc_suspend_check(struct proc *p)
{ {
PROC_LOCK(p); PROC_LOCK(p);
while (SIGISMEMBER(p->p_siglist, SIGSTOP)) { while (SIGISMEMBER(p->p_siglist, SIGSTOP)) {

View File

@ -608,7 +608,7 @@ kproc_shutdown(void *arg, int howto)
strlcpy(procname, p->p_comm, sizeof(procname)); strlcpy(procname, p->p_comm, sizeof(procname));
printf("Waiting (max %d seconds) for system process `%s' to stop...", printf("Waiting (max %d seconds) for system process `%s' to stop...",
kproc_shutdown_wait, procname); kproc_shutdown_wait, procname);
error = kthread_suspend(p, kproc_shutdown_wait * hz); error = kproc_suspend(p, kproc_shutdown_wait * hz);
if (error == EWOULDBLOCK) if (error == EWOULDBLOCK)
printf("timed out\n"); printf("timed out\n");

View File

@ -336,14 +336,14 @@ taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (count == 1) if (count == 1)
error = kthread_create(taskqueue_thread_loop, tqp, error = kproc_create(taskqueue_thread_loop, tqp,
&tq->tq_pproc[i], RFSTOPPED, 0, ktname); &tq->tq_pproc[i], RFSTOPPED, 0, ktname);
else else
error = kthread_create(taskqueue_thread_loop, tqp, error = kproc_create(taskqueue_thread_loop, tqp,
&tq->tq_pproc[i], RFSTOPPED, 0, "%s_%d", ktname, i); &tq->tq_pproc[i], RFSTOPPED, 0, "%s_%d", ktname, i);
if (error) { if (error) {
/* should be ok to continue, taskqueue_free will dtrt */ /* should be ok to continue, taskqueue_free will dtrt */
printf("%s: kthread_create(%s): error %d", printf("%s: kproc_create(%s): error %d",
__func__, ktname, error); __func__, ktname, error);
tq->tq_pproc[i] = NULL; /* paranoid */ tq->tq_pproc[i] = NULL; /* paranoid */
} else } else
@ -379,7 +379,7 @@ taskqueue_thread_loop(void *arg)
tq->tq_pcount--; tq->tq_pcount--;
wakeup_one(tq->tq_pproc); wakeup_one(tq->tq_pproc);
TQ_UNLOCK(tq); TQ_UNLOCK(tq);
kthread_exit(0); kproc_exit(0);
} }
void void

View File

@ -1122,7 +1122,7 @@ aio_daemon(void *_id)
mycp->p_vmspace->vm_refcnt); mycp->p_vmspace->vm_refcnt);
} }
#endif #endif
kthread_exit(0); kproc_exit(0);
} }
} }
} }
@ -1143,7 +1143,7 @@ aio_newproc(int *start)
int id; int id;
id = alloc_unr(aiod_unr); id = alloc_unr(aiod_unr);
error = kthread_create(aio_daemon, (void *)(intptr_t)id, &p, error = kproc_create(aio_daemon, (void *)(intptr_t)id, &p,
RFNOWAIT, 0, "aiod%d", id); RFNOWAIT, 0, "aiod%d", id);
if (error == 0) { if (error == 0) {
/* /*

View File

@ -2058,7 +2058,7 @@ buf_daemon()
bd_request = 0; bd_request = 0;
mtx_unlock(&bdlock); mtx_unlock(&bdlock);
kthread_suspend_check(bufdaemonproc); kproc_suspend_check(bufdaemonproc);
/* /*
* Do the flush. Limit the amount of in-transit I/O we * Do the flush. Limit the amount of in-transit I/O we

View File

@ -726,7 +726,7 @@ vnlru_proc(void)
SHUTDOWN_PRI_FIRST); SHUTDOWN_PRI_FIRST);
for (;;) { for (;;) {
kthread_suspend_check(p); kproc_suspend_check(p);
mtx_lock(&vnode_free_list_mtx); mtx_lock(&vnode_free_list_mtx);
if (freevnodes > wantfreevnodes) if (freevnodes > wantfreevnodes)
vnlru_free(freevnodes - wantfreevnodes); vnlru_free(freevnodes - wantfreevnodes);
@ -1688,7 +1688,7 @@ sched_sync(void)
if (syncer_state == SYNCER_FINAL_DELAY && if (syncer_state == SYNCER_FINAL_DELAY &&
syncer_final_iter == 0) { syncer_final_iter == 0) {
mtx_unlock(&sync_mtx); mtx_unlock(&sync_mtx);
kthread_suspend_check(td->td_proc); kproc_suspend_check(td->td_proc);
mtx_lock(&sync_mtx); mtx_lock(&sync_mtx);
} }
net_worklist_len = syncer_worklist_len - sync_vnode_count; net_worklist_len = syncer_worklist_len - sync_vnode_count;

View File

@ -106,7 +106,7 @@ sctp_startup_iterator(void)
{ {
int ret; int ret;
ret = kthread_create(sctp_iterator_thread, ret = kproc_create(sctp_iterator_thread,
(void *)NULL, (void *)NULL,
&sctppcbinfo.thread_proc, &sctppcbinfo.thread_proc,
RFPROC, RFPROC,

View File

@ -668,7 +668,7 @@ smb_iod_thread(void *arg)
tsleep(&iod->iod_flags, PWAIT, "90idle", iod->iod_sleeptimo); tsleep(&iod->iod_flags, PWAIT, "90idle", iod->iod_sleeptimo);
} }
/* mtx_lock(&Giant, MTX_DEF);*/ /* mtx_lock(&Giant, MTX_DEF);*/
kthread_exit(0); kproc_exit(0);
} }
int int
@ -689,7 +689,7 @@ smb_iod_create(struct smb_vc *vcp)
TAILQ_INIT(&iod->iod_rqlist); TAILQ_INIT(&iod->iod_rqlist);
smb_sl_init(&iod->iod_evlock, "90evl"); smb_sl_init(&iod->iod_evlock, "90evl");
STAILQ_INIT(&iod->iod_evlist); STAILQ_INIT(&iod->iod_evlist);
error = kthread_create(smb_iod_thread, iod, &iod->iod_p, error = kproc_create(smb_iod_thread, iod, &iod->iod_p,
RFNOWAIT, 0, "smbiod%d", iod->iod_id); RFNOWAIT, 0, "smbiod%d", iod->iod_id);
if (error) { if (error) {
SMBERROR("can't start smbiod: %d", error); SMBERROR("can't start smbiod: %d", error);

View File

@ -526,7 +526,7 @@ nfs4_daemon(void *arg)
nfs4_daemonproc = NULL; nfs4_daemonproc = NULL;
mtx_unlock(&Giant); mtx_unlock(&Giant);
/*printf("nfsv4 renewd exiting\n");*/ /*printf("nfsv4 renewd exiting\n");*/
kthread_exit(0); kproc_exit(0);
} }
tsleep(&nfs4_daemonproc, PVFS, "nfs4", 2 * hz); tsleep(&nfs4_daemonproc, PVFS, "nfs4", 2 * hz);
} }
@ -644,7 +644,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
/* Start renewd if it isn't already running */ /* Start renewd if it isn't already running */
if (nfs4_daemonproc == NULL) if (nfs4_daemonproc == NULL)
kthread_create(nfs4_daemon, crdup(cred), &nfs4_daemonproc, kproc_create(nfs4_daemon, crdup(cred), &nfs4_daemonproc,
(RFPROC|RFMEM), 0, "nfs4rd"); (RFPROC|RFMEM), 0, "nfs4rd");
return (0); return (0);

View File

@ -177,7 +177,7 @@ nfs_nfsiodnew(void)
if (newiod == -1) if (newiod == -1)
return (-1); return (-1);
mtx_unlock(&nfs_iod_mtx); mtx_unlock(&nfs_iod_mtx);
error = kthread_create(nfssvc_iod, nfs_asyncdaemon + i, NULL, RFHIGHPID, error = kproc_create(nfssvc_iod, nfs_asyncdaemon + i, NULL, RFHIGHPID,
0, "nfsiod %d", newiod); 0, "nfsiod %d", newiod);
mtx_lock(&nfs_iod_mtx); mtx_lock(&nfs_iod_mtx);
if (error) if (error)
@ -309,7 +309,7 @@ nfssvc_iod(void *instance)
wakeup(&nfs_numasync); wakeup(&nfs_numasync);
mtx_unlock(&nfs_iod_mtx); mtx_unlock(&nfs_iod_mtx);
if ((error == 0) || (error == EWOULDBLOCK)) if ((error == 0) || (error == EWOULDBLOCK))
kthread_exit(0); kproc_exit(0);
/* Abnormal termination */ /* Abnormal termination */
kthread_exit(1); kproc_exit(1);
} }

View File

@ -216,7 +216,7 @@ crypto_init(void)
goto bad; goto bad;
} }
error = kthread_create((void (*)(void *)) crypto_proc, NULL, error = kproc_create((void (*)(void *)) crypto_proc, NULL,
&cryptoproc, 0, 0, "crypto"); &cryptoproc, 0, 0, "crypto");
if (error) { if (error) {
printf("crypto_init: cannot start crypto thread; error %d", printf("crypto_init: cannot start crypto thread; error %d",
@ -224,7 +224,7 @@ crypto_init(void)
goto bad; goto bad;
} }
error = kthread_create((void (*)(void *)) crypto_ret_proc, NULL, error = kproc_create((void (*)(void *)) crypto_ret_proc, NULL,
&cryptoretproc, 0, 0, "crypto returns"); &cryptoretproc, 0, 0, "crypto returns");
if (error) { if (error) {
printf("crypto_init: cannot start cryptoret thread; error %d", printf("crypto_init: cannot start cryptoret thread; error %d",
@ -1222,7 +1222,7 @@ crypto_finis(void *chan)
CRYPTO_DRIVER_LOCK(); CRYPTO_DRIVER_LOCK();
wakeup_one(chan); wakeup_one(chan);
CRYPTO_DRIVER_UNLOCK(); CRYPTO_DRIVER_UNLOCK();
kthread_exit(0); kproc_exit(0);
} }
/* /*

View File

@ -544,8 +544,8 @@ audit_worker_init(void)
int error; int error;
cv_init(&audit_replacement_cv, "audit_replacement_cv"); cv_init(&audit_replacement_cv, "audit_replacement_cv");
error = kthread_create(audit_worker, NULL, &audit_thread, RFHIGHPID, error = kproc_create(audit_worker, NULL, &audit_thread, RFHIGHPID,
0, "audit"); 0, "audit");
if (error) if (error)
panic("audit_worker_init: kthread_create returned %d", error); panic("audit_worker_init: kproc_create returned %d", error);
} }

View File

@ -173,7 +173,7 @@ g_hvd_init(struct g_class *mp __unused)
sc->hvd_sectorsize = HVD_BLOCKSIZE; sc->hvd_sectorsize = HVD_BLOCKSIZE;
sc->hvd_fwsectors = 0; sc->hvd_fwsectors = 0;
sc->hvd_fwheads = 0; sc->hvd_fwheads = 0;
error = kthread_create(hvd_kthread, sc, &sc->hvd_procp, 0, 0, error = kproc_create(hvd_kthread, sc, &sc->hvd_procp, 0, 0,
"hvd0"); "hvd0");
if (error != 0) { if (error != 0) {
free(sc, M_DEVBUF); free(sc, M_DEVBUF);

View File

@ -44,11 +44,11 @@ struct kproc_desc {
void kproc_shutdown(void *, int); void kproc_shutdown(void *, int);
void kproc_start(const void *); void kproc_start(const void *);
int kthread_create(void (*)(void *), void *, struct proc **, int kproc_create(void (*)(void *), void *, struct proc **,
int flags, int pages, const char *, ...) __printflike(6, 7); int flags, int pages, const char *, ...) __printflike(6, 7);
void kthread_exit(int) __dead2; void kproc_exit(int) __dead2;
int kthread_resume(struct proc *); /* XXXKSE */ int kproc_resume(struct proc *); /* XXXKSE */
int kthread_suspend(struct proc *, int); /* XXXKSE */ int kproc_suspend(struct proc *, int); /* XXXKSE */
void kthread_suspend_check(struct proc *); /* XXXKSE */ void kproc_suspend_check(struct proc *); /* XXXKSE */
#endif /* !_SYS_KTHREAD_H_ */ #endif /* !_SYS_KTHREAD_H_ */

View File

@ -728,7 +728,7 @@ softdep_flush(void)
td->td_pflags |= TDP_NORUNNINGBUF; td->td_pflags |= TDP_NORUNNINGBUF;
for (;;) { for (;;) {
kthread_suspend_check(softdepproc); kproc_suspend_check(softdepproc);
vfslocked = VFS_LOCK_GIANT((struct mount *)NULL); vfslocked = VFS_LOCK_GIANT((struct mount *)NULL);
ACQUIRE_LOCK(&lk); ACQUIRE_LOCK(&lk);
/* /*

View File

@ -147,7 +147,7 @@ pagezero_start(void __unused *arg)
int error; int error;
struct thread *td; struct thread *td;
error = kthread_create(vm_pagezero, NULL, &pagezero_proc, RFSTOPPED, 0, error = kproc_create(vm_pagezero, NULL, &pagezero_proc, RFSTOPPED, 0,
"pagezero"); "pagezero");
if (error) if (error)
panic("pagezero_start: error %d\n", error); panic("pagezero_start: error %d\n", error);