From 3745c395ecae17ef47be82433463d561629220b0 Mon Sep 17 00:00:00 2001 From: Julian Elischer Date: Sat, 20 Oct 2007 23:23:23 +0000 Subject: [PATCH] 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. --- sys/cam/cam_xpt.c | 2 +- sys/cddl/compat/opensolaris/sys/proc.h | 4 ++-- .../opensolaris/uts/common/fs/zfs/vdev_geom.c | 4 ++-- .../opensolaris/uts/common/fs/zfs/zvol.c | 4 ++-- sys/compat/ndis/subr_ntoskrnl.c | 12 +++++------ sys/compat/opensolaris/sys/proc.h | 4 ++-- .../opensolaris/uts/common/fs/zfs/vdev_geom.c | 4 ++-- .../opensolaris/uts/common/fs/zfs/zvol.c | 4 ++-- sys/contrib/pf/net/pf.c | 2 +- sys/contrib/pf/net/pf_ioctl.c | 6 +++--- sys/dev/aac/aac.c | 4 ++-- sys/dev/acpica/acpi_thermal.c | 6 +++--- sys/dev/aic7xxx/aic_osm_lib.c | 2 +- sys/dev/aic7xxx/aic_osm_lib.h | 4 ++-- sys/dev/bktr/msp34xx.c | 8 ++++---- sys/dev/ciss/ciss.c | 6 +++--- sys/dev/fdc/fdc.c | 4 ++-- sys/dev/firewire/firewire.c | 4 ++-- sys/dev/flash/at45d.c | 2 +- sys/dev/hptmv/entry.c | 2 +- sys/dev/hwpmc/hwpmc_logging.c | 4 ++-- sys/dev/if_ndis/if_ndis.c | 2 +- sys/dev/ipmi/ipmi_kcs.c | 4 ++-- sys/dev/ipmi/ipmi_smic.c | 4 ++-- sys/dev/ipmi/ipmi_ssif.c | 4 ++-- sys/dev/iscsi/initiator/isc_sm.c | 4 ++-- sys/dev/iscsi/initiator/isc_soc.c | 4 ++-- sys/dev/isp/isp_freebsd.c | 4 ++-- sys/dev/iwi/if_iwi.c | 4 ++-- sys/dev/md/md.c | 4 ++-- sys/dev/mmc/mmcsd.c | 4 ++-- sys/dev/mpt/mpt.h | 4 ++-- sys/dev/mpt/mpt_cam.c | 2 +- sys/dev/mpt/mpt_raid.c | 2 +- sys/dev/ofw/ofw_disk.c | 2 +- sys/dev/pccbb/pccbb.c | 6 +++--- sys/dev/pccbb/pccbb_pci.c | 2 +- sys/dev/random/harvest.c | 4 ++-- sys/dev/random/randomdev_soft.c | 2 +- sys/dev/sound/midi/sequencer.c | 4 ++-- sys/dev/usb/usb.c | 8 ++++---- sys/dev/usb/usb_port.h | 6 +++--- sys/dev/utopia/utopia.c | 4 ++-- sys/geom/bde/g_bde.c | 2 +- sys/geom/bde/g_bde_work.c | 2 +- sys/geom/eli/g_eli.c | 4 ++-- sys/geom/journal/g_journal.c | 8 ++++---- sys/geom/mirror/g_mirror.c | 6 +++--- sys/geom/multipath/g_multipath.c | 4 ++-- sys/geom/raid3/g_raid3.c | 6 +++--- sys/geom/vinum/geom_vinum_drive.c | 6 +++--- sys/geom/vinum/geom_vinum_init.c | 20 +++++++++---------- sys/geom/vinum/geom_vinum_plex.c | 6 +++--- sys/geom/vinum/geom_vinum_volume.c | 4 ++-- sys/i386/bios/apm.c | 4 ++-- sys/kern/init_main.c | 2 +- sys/kern/kern_acct.c | 6 +++--- sys/kern/kern_fork.c | 2 +- sys/kern/kern_idle.c | 6 +++--- sys/kern/kern_intr.c | 12 +++++------ sys/kern/kern_kthread.c | 14 ++++++------- sys/kern/kern_shutdown.c | 2 +- sys/kern/subr_taskqueue.c | 8 ++++---- sys/kern/vfs_aio.c | 4 ++-- sys/kern/vfs_bio.c | 2 +- sys/kern/vfs_subr.c | 4 ++-- sys/netinet/sctp_bsd_addr.c | 2 +- sys/netsmb/smb_iod.c | 4 ++-- sys/nfs4client/nfs4_vfsops.c | 4 ++-- sys/nfsclient/nfs_nfsiod.c | 6 +++--- sys/opencrypto/crypto.c | 6 +++--- sys/security/audit/audit_worker.c | 4 ++-- sys/sun4v/sun4v/simdisk.c | 2 +- sys/sys/kthread.h | 10 +++++----- sys/ufs/ffs/ffs_softdep.c | 2 +- sys/vm/vm_zeroidle.c | 2 +- 76 files changed, 176 insertions(+), 176 deletions(-) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 707f328269fe..c86fe1265dc8 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -1562,7 +1562,7 @@ xpt_init(void *dummy) } /* 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"); } /* Install our software interrupt handlers */ diff --git a/sys/cddl/compat/opensolaris/sys/proc.h b/sys/cddl/compat/opensolaris/sys/proc.h index 2532c5760704..0ae48b5ccf67 100644 --- a/sys/cddl/compat/opensolaris/sys/proc.h +++ b/sys/cddl/compat/opensolaris/sys/proc.h @@ -77,12 +77,12 @@ thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, ASSERT(len == 0); 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); return (error == 0 ? FIRST_THREAD_IN_PROC(p) : NULL); } -#define thread_exit() kthread_exit(0) +#define thread_exit() kproc_exit(0) #endif /* _KERNEL */ diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c index 7c8796345953..eebc911edc4b 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c @@ -207,7 +207,7 @@ vdev_geom_worker(void *arg) ctx->gc_state = 2; wakeup_one(&ctx->gc_state); mtx_unlock(&ctx->gc_queue_mtx); - kthread_exit(0); + kproc_exit(0); } msleep(&ctx->gc_queue, &ctx->gc_queue_mtx, 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; - 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); return (0); diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c index c6aa07b217a4..38d164ec21f6 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c @@ -359,7 +359,7 @@ zvol_worker(void *arg) zv->zv_state = 2; wakeup(&zv->zv_state); mtx_unlock(&zv->zv_queue_mtx); - kthread_exit(0); + kproc_exit(0); } msleep(&zv->zv_queue, &zv->zv_queue_mtx, PRIBIO | PDROP, "zvol:io", 0); @@ -543,7 +543,7 @@ zvol_create_minor(const char *name, dev_t dev) bioq_init(&zv->zv_queue); mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF); 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++; end: diff --git a/sys/compat/ndis/subr_ntoskrnl.c b/sys/compat/ndis/subr_ntoskrnl.c index 86d537b33ae4..b0fda80d5671 100644 --- a/sys/compat/ndis/subr_ntoskrnl.c +++ b/sys/compat/ndis/subr_ntoskrnl.c @@ -316,7 +316,7 @@ ntoskrnl_libinit() kq = kq_queues + i; kq->kq_cpu = 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); if (error) panic("failed to launch DPC thread"); @@ -329,7 +329,7 @@ ntoskrnl_libinit() for (i = 0; i < WORKITEM_THREADS; i++) { kq = wq_queues + 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); if (error) panic("failed to launch workitem thread"); @@ -2801,7 +2801,7 @@ ntoskrnl_workitem_thread(arg) #if __FreeBSD_version < 502113 mtx_lock(&Giant); #endif - kthread_exit(0); + kproc_exit(0); return; /* notreached */ } @@ -3519,7 +3519,7 @@ PsCreateSystemThread(handle, reqaccess, objattrs, phandle, tc->tc_thrfunc = thrfunc; 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); if (error) { @@ -3562,7 +3562,7 @@ PsTerminateSystemThread(status) #if __FreeBSD_version < 502113 mtx_lock(&Giant); #endif - kthread_exit(0); + kproc_exit(0); return(0); /* notreached */ } @@ -3871,7 +3871,7 @@ ntoskrnl_dpc_thread(arg) #if __FreeBSD_version < 502113 mtx_lock(&Giant); #endif - kthread_exit(0); + kproc_exit(0); return; /* notreached */ } diff --git a/sys/compat/opensolaris/sys/proc.h b/sys/compat/opensolaris/sys/proc.h index 2532c5760704..0ae48b5ccf67 100644 --- a/sys/compat/opensolaris/sys/proc.h +++ b/sys/compat/opensolaris/sys/proc.h @@ -77,12 +77,12 @@ thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, ASSERT(len == 0); 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); return (error == 0 ? FIRST_THREAD_IN_PROC(p) : NULL); } -#define thread_exit() kthread_exit(0) +#define thread_exit() kproc_exit(0) #endif /* _KERNEL */ diff --git a/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c b/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c index 7c8796345953..eebc911edc4b 100644 --- a/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c +++ b/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c @@ -207,7 +207,7 @@ vdev_geom_worker(void *arg) ctx->gc_state = 2; wakeup_one(&ctx->gc_state); mtx_unlock(&ctx->gc_queue_mtx); - kthread_exit(0); + kproc_exit(0); } msleep(&ctx->gc_queue, &ctx->gc_queue_mtx, 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; - 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); return (0); diff --git a/sys/contrib/opensolaris/uts/common/fs/zfs/zvol.c b/sys/contrib/opensolaris/uts/common/fs/zfs/zvol.c index c6aa07b217a4..38d164ec21f6 100644 --- a/sys/contrib/opensolaris/uts/common/fs/zfs/zvol.c +++ b/sys/contrib/opensolaris/uts/common/fs/zfs/zvol.c @@ -359,7 +359,7 @@ zvol_worker(void *arg) zv->zv_state = 2; wakeup(&zv->zv_state); mtx_unlock(&zv->zv_queue_mtx); - kthread_exit(0); + kproc_exit(0); } msleep(&zv->zv_queue, &zv->zv_queue_mtx, PRIBIO | PDROP, "zvol:io", 0); @@ -543,7 +543,7 @@ zvol_create_minor(const char *name, dev_t dev) bioq_init(&zv->zv_queue); mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF); 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++; end: diff --git a/sys/contrib/pf/net/pf.c b/sys/contrib/pf/net/pf.c index 4d1cd35ab2e4..0c996ab11be6 100644 --- a/sys/contrib/pf/net/pf.c +++ b/sys/contrib/pf/net/pf.c @@ -988,7 +988,7 @@ pf_purge_thread(void *v) sx_sunlock(&pf_consistency_lock); PF_UNLOCK(); wakeup(pf_purge_thread); - kthread_exit(0); + kproc_exit(0); } #endif s = splsoftnet(); diff --git a/sys/contrib/pf/net/pf_ioctl.c b/sys/contrib/pf/net/pf_ioctl.c index 6c5d2a109b23..b87b45be1bc5 100644 --- a/sys/contrib/pf/net/pf_ioctl.c +++ b/sys/contrib/pf/net/pf_ioctl.c @@ -386,7 +386,7 @@ pfattach(void) /* XXX do our best to avoid a conflict */ 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 (error); @@ -464,13 +464,13 @@ pfattach(int num) pf_status.hostid = arc4random(); /* 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 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"); } diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 54c7c1cf5274..01212eb18929 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -354,7 +354,7 @@ aac_attach(struct aac_softc *sc) sc->aac_dev_t->si_drv1 = sc; /* 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)) panic("Could not create AIF thread\n"); @@ -990,7 +990,7 @@ aac_command_thread(struct aac_softc *sc) mtx_unlock(&sc->aac_io_lock); wakeup(sc->aac_dev); - kthread_exit(0); + kproc_exit(0); } /* diff --git a/sys/dev/acpica/acpi_thermal.c b/sys/dev/acpica/acpi_thermal.c index 5f50468804da..9c560c87b421 100644 --- a/sys/dev/acpica/acpi_thermal.c +++ b/sys/dev/acpica/acpi_thermal.c @@ -301,7 +301,7 @@ acpi_tz_attach(device_t dev) sc->tz_event = EVENTHANDLER_REGISTER(power_profile_change, acpi_tz_power_profile, sc, 0); 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"); if (error != 0) { device_printf(sc->tz_dev, "could not create thread - %d", error); @@ -1088,7 +1088,7 @@ acpi_tz_cooling_thread(void *arg) ACPI_LOCK(thermal); sc->tz_cooling_proc_running = FALSE; 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) { snprintf(name, sizeof(name), "acpi_cooling%d", 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); if (error != 0) { device_printf(sc->tz_dev, "could not create thread - %d", error); diff --git a/sys/dev/aic7xxx/aic_osm_lib.c b/sys/dev/aic7xxx/aic_osm_lib.c index 78a7d5693558..b79f18aa0cba 100644 --- a/sys/dev/aic7xxx/aic_osm_lib.c +++ b/sys/dev/aic7xxx/aic_osm_lib.c @@ -125,7 +125,7 @@ aic_recovery_thread(void *arg) aic->platform_data->recovery_thread = NULL; wakeup(aic->platform_data); aic_unlock(aic); - kthread_exit(0); + kproc_exit(0); } void diff --git a/sys/dev/aic7xxx/aic_osm_lib.h b/sys/dev/aic7xxx/aic_osm_lib.h index 434acf3e4bad..b2e591c9c7a8 100644 --- a/sys/dev/aic7xxx/aic_osm_lib.h +++ b/sys/dev/aic7xxx/aic_osm_lib.h @@ -127,10 +127,10 @@ aic_wakeup_recovery_thread(struct aic_softc *aic) /****************************** Kernel Threads ********************************/ #if __FreeBSD_version > 500005 #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 #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 /******************************* Bus Space/DMA ********************************/ diff --git a/sys/dev/bktr/msp34xx.c b/sys/dev/bktr/msp34xx.c index 940205ac4af8..d86f71459049 100644 --- a/sys/dev/bktr/msp34xx.c +++ b/sys/dev/bktr/msp34xx.c @@ -899,7 +899,7 @@ static void msp3400c_thread(void *data) wakeup(&msp->kthread); mtx_unlock(&Giant); - kthread_exit(0); + kproc_exit(0); } /* ----------------------------------------------------------------------- */ @@ -1126,7 +1126,7 @@ static void msp3410d_thread(void *data) wakeup(&msp->kthread); mtx_unlock(&Giant); - kthread_exit(0); + kproc_exit(0); } int msp_attach(bktr_ptr_t bktr) @@ -1197,11 +1197,11 @@ int msp_attach(bktr_ptr_t bktr) } /* 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, msp->threaddesc); 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, M_DEVBUF); bktr->msp3400c_info = NULL; diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 91c004dff48e..15954fe4cb3b 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -3807,7 +3807,7 @@ ciss_notify_thread(void *arg) #if __FreeBSD_version >= 500000 mtx_unlock(&sc->ciss_mtx); #endif - kthread_exit(0); + kproc_exit(0); } /************************************************************************ @@ -3818,11 +3818,11 @@ ciss_spawn_notify_thread(struct ciss_softc *sc) { #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", device_get_unit(sc->ciss_dev))) #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", device_get_unit(sc->ciss_dev))) #endif diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 22e810b30c1a..50ba331602e7 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -1207,7 +1207,7 @@ fdc_thread(void *arg) fdc->flags &= ~(FDC_KTHREAD_EXIT | FDC_KTHREAD_ALIVE); 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); 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)); settle = hz / 8; diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c index c3c09abc4f46..c7767dae39be 100644 --- a/sys/dev/firewire/firewire.c +++ b/sys/dev/firewire/firewire.c @@ -440,7 +440,7 @@ firewire_attach(device_t dev) (void *)firewire_watchdog, (void *)sc->fc); /* 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); /* Locate our children */ @@ -1661,7 +1661,7 @@ fw_bus_probe_thread(void *arg) msleep((void *)fc, &fc->wait_lock, PWAIT|PCATCH, "-", 0); } mtx_unlock(&fc->wait_lock); - kthread_exit(0); + kproc_exit(0); } /* diff --git a/sys/dev/flash/at45d.c b/sys/dev/flash/at45d.c index e9536e3a68b4..13e26bcac5ac 100644 --- a/sys/dev/flash/at45d.c +++ b/sys/dev/flash/at45d.c @@ -181,7 +181,7 @@ at45d_delayed_attach(void *xsc) sc->disk->d_unit = device_get_unit(sc->dev); disk_create(sc->disk, DISK_VERSION); 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); } diff --git a/sys/dev/hptmv/entry.c b/sys/dev/hptmv/entry.c index aa67e947ea59..33c3066505aa 100644 --- a/sys/dev/hptmv/entry.c +++ b/sys/dev/hptmv/entry.c @@ -2396,7 +2396,7 @@ static void hpt_worker_thread(void) #endif */ #if (__FreeBSD_version >= 500043) - kthread_suspend_check(curproc); + kproc_suspend_check(curproc); #else kproc_suspend_loop(curproc); #endif diff --git a/sys/dev/hwpmc/hwpmc_logging.c b/sys/dev/hwpmc/hwpmc_logging.c index 5af555c46df8..7be4776fcac7 100644 --- a/sys/dev/hwpmc/hwpmc_logging.c +++ b/sys/dev/hwpmc/hwpmc_logging.c @@ -362,7 +362,7 @@ pmclog_loop(void *arg) 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 */ 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); if (error) goto error; diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index 0ab0c426fe33..0977806da9b7 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -741,7 +741,7 @@ ndis_attach(dev) #else sc->ndis_tq = taskqueue_create("ndis_taskq", M_NOWAIT | M_ZERO, 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)); #endif TASK_INIT(&sc->ndis_scantask, 0, ndis_scan, sc); diff --git a/sys/dev/ipmi/ipmi_kcs.c b/sys/dev/ipmi/ipmi_kcs.c index 8ad606e9b5ae..4eda654548b9 100644 --- a/sys/dev/ipmi/ipmi_kcs.c +++ b/sys/dev/ipmi/ipmi_kcs.c @@ -466,14 +466,14 @@ kcs_loop(void *arg) ipmi_complete_request(sc, req); } IPMI_UNLOCK(sc); - kthread_exit(0); + kproc_exit(0); } static int 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))); } diff --git a/sys/dev/ipmi/ipmi_smic.c b/sys/dev/ipmi/ipmi_smic.c index c1c69b3923cd..f9fe62e9d1f7 100644 --- a/sys/dev/ipmi/ipmi_smic.c +++ b/sys/dev/ipmi/ipmi_smic.c @@ -372,14 +372,14 @@ smic_loop(void *arg) ipmi_complete_request(sc, req); } IPMI_UNLOCK(sc); - kthread_exit(0); + kproc_exit(0); } static int 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))); } diff --git a/sys/dev/ipmi/ipmi_ssif.c b/sys/dev/ipmi/ipmi_ssif.c index 78ad64394d39..2256de16e7ef 100644 --- a/sys/dev/ipmi/ipmi_ssif.c +++ b/sys/dev/ipmi/ipmi_ssif.c @@ -348,14 +348,14 @@ ssif_loop(void *arg) IPMI_LOCK(sc); } IPMI_UNLOCK(sc); - kthread_exit(0); + kproc_exit(0); } static int 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))); } diff --git a/sys/dev/iscsi/initiator/isc_sm.c b/sys/dev/iscsi/initiator/isc_sm.c index c767477fe639..f024aef64917 100644 --- a/sys/dev/iscsi/initiator/isc_sm.c +++ b/sys/dev/iscsi/initiator/isc_sm.c @@ -587,7 +587,7 @@ ism_proc(void *vp) sdebug(3, "terminated"); wakeup(sp); - kthread_exit(0); + kproc_exit(0); } #if 0 @@ -782,5 +782,5 @@ ism_start(isc_session_t *sp) 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); } diff --git a/sys/dev/iscsi/initiator/isc_soc.c b/sys/dev/iscsi/initiator/isc_soc.c index 49d530df89be..f5a83444f1c5 100644 --- a/sys/dev/iscsi/initiator/isc_soc.c +++ b/sys/dev/iscsi/initiator/isc_soc.c @@ -539,7 +539,7 @@ isc_soc(void *vp) mtx_unlock(&sp->io_mtx); - kthread_exit(0); + kproc_exit(0); } void @@ -572,5 +572,5 @@ isc_start_receiver(isc_session_t *sp) debug_called(8); 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); } diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index 4ff2f5f34352..cc7017a08c2f 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -251,11 +251,11 @@ isp_attach(ispsoftc_t *isp) isp_callout_init(&isp->isp_osinfo.gdt); ISP_UNLOCK(isp); #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", device_get_nameunit(isp->isp_dev))) #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))) #endif { diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c index aaf7d1b5bba9..f4572d3b5540 100644 --- a/sys/dev/iwi/if_iwi.c +++ b/sys/dev/iwi/if_iwi.c @@ -279,11 +279,11 @@ iwi_attach(device_t dev) #else sc->sc_tq = taskqueue_create("iwi_taskq", M_NOWAIT | M_ZERO, 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)); sc->sc_tq2 = taskqueue_create("iwi_taskq2", M_NOWAIT | M_ZERO, 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)); #endif TASK_INIT(&sc->sc_radiontask, 0, iwi_radio_on, sc); diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 48cd0595bd16..2d63fed9394a 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -701,7 +701,7 @@ md_kthread(void *arg) if (sc->flags & MD_SHUTDOWN) { sc->flags |= MD_EXITING; mtx_unlock(&sc->queue_mtx); - kthread_exit(0); + kproc_exit(0); } bp = bioq_takefirst(&sc->bio_queue); if (!bp) { @@ -765,7 +765,7 @@ mdnew(int unit, int *errp, enum md_types type) sc->unit = unit; sprintf(sc->name, "md%d", unit); 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) return (sc); LIST_REMOVE(sc, list); diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index a9bf17f34e67..5c498fa19793 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -134,7 +134,7 @@ mmcsd_attach(device_t dev) bioq_init(&sc->bio_queue); 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); } @@ -284,7 +284,7 @@ mmcsd_task(void *arg) wakeup(sc); MMCSD_UNLOCK(sc); - kthread_exit(0); + kproc_exit(0); } static device_method_t mmcsd_methods[] = { diff --git a/sys/dev/mpt/mpt.h b/sys/dev/mpt/mpt.h index c8fb76c4cd6d..a3676141278b 100644 --- a/sys/dev/mpt/mpt.h +++ b/sys/dev/mpt/mpt.h @@ -273,10 +273,10 @@ void mpt_map_rquest(void *, bus_dma_segment_t *, int, int); /**************************** Kernel Thread Support ***************************/ #if __FreeBSD_version > 500005 #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 #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 /****************************** Timer Facilities ******************************/ diff --git a/sys/dev/mpt/mpt_cam.c b/sys/dev/mpt/mpt_cam.c index 7a67fbc34ea4..1e72afbd6ade 100644 --- a/sys/dev/mpt/mpt_cam.c +++ b/sys/dev/mpt/mpt_cam.c @@ -3988,7 +3988,7 @@ mpt_recovery_thread(void *arg) mpt->recovery_thread = NULL; wakeup(&mpt->recovery_thread); MPT_UNLOCK(mpt); - kthread_exit(0); + kproc_exit(0); } static int diff --git a/sys/dev/mpt/mpt_raid.c b/sys/dev/mpt/mpt_raid.c index 192c9d411595..ab8512261ecd 100644 --- a/sys/dev/mpt/mpt_raid.c +++ b/sys/dev/mpt/mpt_raid.c @@ -722,7 +722,7 @@ mpt_raid_thread(void *arg) mpt->raid_thread = NULL; wakeup(&mpt->raid_thread); MPT_UNLOCK(mpt); - kthread_exit(0); + kproc_exit(0); } #if 0 diff --git a/sys/dev/ofw/ofw_disk.c b/sys/dev/ofw/ofw_disk.c index 130c869fe46d..d20cbc3211a6 100644 --- a/sys/dev/ofw/ofw_disk.c +++ b/sys/dev/ofw/ofw_disk.c @@ -169,7 +169,7 @@ g_ofwd_init(struct g_class *mp __unused) sc->ofwd_sectorsize = OFWD_BLOCKSIZE; sc->ofwd_fwsectors = 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"); if (error != 0) { free(sc, M_DEVBUF); diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index 7b8fb62f4174..1af74a0a6c80 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -332,11 +332,11 @@ cbb_detach(device_t brdev) 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 * safe to proceed. IF the thread is running, set the please * 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. */ bus_teardown_intr(brdev, sc->irq_res, sc->intrhand); @@ -529,7 +529,7 @@ cbb_event_thread(void *arg) DEVPRINTF((sc->dev, "Thread terminating\n")); sc->flags &= ~CBB_KTHREAD_RUNNING; mtx_unlock(&sc->mtx); - kthread_exit(0); + kproc_exit(0); } /************************************************************************/ diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c index 73a52b0d82cd..149bfacf1795 100644 --- a/sys/dev/pccbb/pccbb_pci.c +++ b/sys/dev/pccbb/pccbb_pci.c @@ -434,7 +434,7 @@ cbb_pci_attach(device_t brdev) cbb_print_config(brdev); /* 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))) { device_printf(brdev, "unable to create event thread.\n"); panic("cbb_create_event_thread"); diff --git a/sys/dev/random/harvest.c b/sys/dev/random/harvest.c index d78306524ff9..aacba329437a 100644 --- a/sys/dev/random/harvest.c +++ b/sys/dev/random/harvest.c @@ -120,7 +120,7 @@ read_random_phony(void *buf, int 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. * 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 @@ -130,6 +130,6 @@ void random_set_wakeup_exit(void *control) { wakeup(control); - kthread_exit(0); + kproc_exit(0); /* NOTREACHED */ } diff --git a/sys/dev/random/randomdev_soft.c b/sys/dev/random/randomdev_soft.c index 365f3eacc4fe..c03673a59081 100644 --- a/sys/dev/random/randomdev_soft.c +++ b/sys/dev/random/randomdev_soft.c @@ -181,7 +181,7 @@ random_yarrow_init(void) mtx_init(&harvest_mtx, "entropy harvest mutex", NULL, MTX_SPIN); /* Start the hash/reseed thread */ - error = kthread_create(random_kthread, NULL, + error = kproc_create(random_kthread, NULL, &random_kthread_proc, RFHIGHPID, 0, "yarrow"); if (error != 0) panic("Cannot create entropy maintenance thread."); diff --git a/sys/dev/sound/midi/sequencer.c b/sys/dev/sound/midi/sequencer.c index d9bf387a4c8d..f30c5b1b3801 100644 --- a/sys/dev/sound/midi/sequencer.c +++ b/sys/dev/sound/midi/sequencer.c @@ -461,7 +461,7 @@ seq_eventthread(void *arg) mtx_unlock(&scp->seq_lock); mtx_lock(&Giant); 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 */ - ret = kthread_create(seq_eventthread, scp, NULL, RFHIGHPID, 0, + ret = kproc_create(seq_eventthread, scp, NULL, RFHIGHPID, 0, "sequencer %02d", scp->unit); if (ret) diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 6c2da4a5fd85..6f92c77c77ec 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -338,7 +338,7 @@ usb_create_event_thread(void *arg) struct usb_taskq *taskq; 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))) { printf("%s: unable to create event thread for\n", device_get_nameunit(sc->sc_dev)); @@ -351,7 +351,7 @@ usb_create_event_thread(void *arg) taskq->taskcreated = 1; taskq->name = taskq_names[i]; 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->name)) { printf("unable to create task thread\n"); @@ -453,7 +453,7 @@ usb_event_thread(void *arg) wakeup(sc); DPRINTF(("usb_event_thread: exit\n")); - kthread_exit(0); + kproc_exit(0); } void @@ -490,7 +490,7 @@ usb_task_thread(void *arg) wakeup(&taskq->taskcreated); DPRINTF(("usb_event_thread: exit\n")); - kthread_exit(0); + kproc_exit(0); } int diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 6a0417f67d50..fd92d7b49839 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -83,10 +83,10 @@ typedef struct thread *usb_proc_ptr; #define uio_procp uio_td #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) \ - kthread_create((f), (s), (p), RFHIGHPID, 0, (a0)) -#define usb_kthread_create kthread_create + kproc_create((f), (s), (p), RFHIGHPID, 0, (a0)) +#define usb_kthread_create kproc_create #define config_pending_incr() #define config_pending_decr() diff --git a/sys/dev/utopia/utopia.c b/sys/dev/utopia/utopia.c index 7480efc3da6f..caac02e0e83c 100644 --- a/sys/dev/utopia/utopia.c +++ b/sys/dev/utopia/utopia.c @@ -623,7 +623,7 @@ utopia_daemon(void *arg __unused) } wakeup_one(&utopia_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: 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"); if (err != 0) { printf("cannot created utopia thread %d\n", err); diff --git a/sys/geom/bde/g_bde.c b/sys/geom/bde/g_bde.c index 90aaf7a44b83..696c70fdc267 100644 --- a/sys/geom/bde/g_bde.c +++ b/sys/geom/bde/g_bde.c @@ -183,7 +183,7 @@ g_bde_create_geom(struct gctl_req *req, struct g_class *mp, struct g_provider *p TAILQ_INIT(&sc->worklist); mtx_init(&sc->worklist_mutex, "g_bde_worklist", NULL, MTX_DEF); /* 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); pp = g_new_providerf(gp, gp->name); #if 0 diff --git a/sys/geom/bde/g_bde_work.c b/sys/geom/bde/g_bde_work.c index 9a653e379eb2..fceb865876c1 100644 --- a/sys/geom/bde/g_bde_work.c +++ b/sys/geom/bde/g_bde_work.c @@ -664,7 +664,7 @@ g_bde_worker(void *arg) mtx_unlock(&sc->worklist_mutex); sc->dead = 2; wakeup(sc); - kthread_exit(0); + kproc_exit(0); } /* diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c index d9f74d200ccb..e2b51ee00d3c 100644 --- a/sys/geom/eli/g_eli.c +++ b/sys/geom/eli/g_eli.c @@ -352,7 +352,7 @@ g_eli_worker(void *arg) curthread->td_proc->p_comm); wakeup(&sc->sc_workers); mtx_unlock(&sc->sc_queue_mtx); - kthread_exit(0); + kproc_exit(0); } msleep(sc, &sc->sc_queue_mtx, PRIBIO | PDROP, "geli:w", 0); @@ -682,7 +682,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp, 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); if (error != 0) { crypto_freesession(wr->w_sid); diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c index eff82935f2fa..71ddf8cc695f 100644 --- a/sys/geom/journal/g_journal.c +++ b/sys/geom/journal/g_journal.c @@ -2146,7 +2146,7 @@ g_journal_worker(void *arg) sc->sc_worker = NULL; wakeup(&sc->sc_worker); mtx_unlock(&sc->sc_mtx); - kthread_exit(0); + kproc_exit(0); } sleep: 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); } - 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); if (error != 0) { 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); if (g_journal_event_lowmem == NULL) 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"); KASSERT(error == 0, ("Cannot create switcher thread.")); } @@ -3025,7 +3025,7 @@ g_journal_switcher(void *arg) g_journal_switcher_state = GJ_SWITCHER_DIED; GJ_DEBUG(1, "Switcher exiting."); wakeup(&g_journal_switcher_state); - kthread_exit(0); + kproc_exit(0); } if (error == 0 && g_journal_sync_requested == 0) { GJ_DEBUG(1, "Out of cache, force switch (used=%u " diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 24a2fad8f5c0..13ff6eaabb60 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -1815,7 +1815,7 @@ g_mirror_worker(void *arg) if (g_mirror_try_destroy(sc)) { curthread->td_pflags &= ~TDP_GEOM; G_MIRROR_DEBUG(1, "Thread exiting."); - kthread_exit(0); + kproc_exit(0); } } 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)) { curthread->td_pflags &= ~TDP_GEOM; G_MIRROR_DEBUG(1, "Thread exiting."); - kthread_exit(0); + kproc_exit(0); } 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; sc->sc_sync.ds_geom = gp; 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); if (error != 0) { G_MIRROR_DEBUG(1, "Cannot create kernel thread for %s.", diff --git a/sys/geom/multipath/g_multipath.c b/sys/geom/multipath/g_multipath.c index 0398628e03d7..ca442bdc6a4c 100644 --- a/sys/geom/multipath/g_multipath.c +++ b/sys/geom/multipath/g_multipath.c @@ -239,7 +239,7 @@ g_multipath_kt(void *arg) } mtx_unlock(&gmtbq_mtx); 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); 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; } } diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c index 98747eadd7b5..1cbce257b59f 100644 --- a/sys/geom/raid3/g_raid3.c +++ b/sys/geom/raid3/g_raid3.c @@ -2064,7 +2064,7 @@ g_raid3_worker(void *arg) if (g_raid3_try_destroy(sc)) { curthread->td_pflags &= ~TDP_GEOM; G_RAID3_DEBUG(1, "Thread exiting."); - kthread_exit(0); + kproc_exit(0); } } 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)) { curthread->td_pflags &= ~TDP_GEOM; G_RAID3_DEBUG(1, "Thread exiting."); - kthread_exit(0); + kproc_exit(0); } 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; } - 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); if (error != 0) { G_RAID3_DEBUG(1, "Cannot create kernel thread for %s.", diff --git a/sys/geom/vinum/geom_vinum_drive.c b/sys/geom/vinum/geom_vinum_drive.c index 98b7c574cf6e..60583daa3476 100644 --- a/sys/geom/vinum/geom_vinum_drive.c +++ b/sys/geom/vinum/geom_vinum_drive.c @@ -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); bioq_init(d->bqueue); 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; } @@ -373,7 +373,7 @@ gv_drive_worker(void *arg) mtx_unlock(&d->bqueue_mtx); 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); 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); d->flags |= GV_DRIVE_THREAD_ACTIVE; } diff --git a/sys/geom/vinum/geom_vinum_init.c b/sys/geom/vinum/geom_vinum_init.c index b3d744e3b00f..8ff215f80f2e 100644 --- a/sys/geom/vinum/geom_vinum_init.c +++ b/sys/geom/vinum/geom_vinum_init.c @@ -348,7 +348,7 @@ gv_sync(struct gv_volume *v) sync->from = up; sync->to = p; 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); } @@ -371,7 +371,7 @@ gv_rebuild_plex(struct gv_plex *p) sync->to = p; 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); return (0); @@ -389,7 +389,7 @@ gv_init_plex(struct gv_plex *p) return (EINPROGRESS); gv_set_sd_state(s, GV_SD_INITIALIZING, GV_SETSTATE_FORCE); 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); } @@ -422,7 +422,7 @@ gv_rebuild_td(void *arg) g_topology_unlock(); printf("GEOM_VINUM: rebuild of %s failed to access consumer: " "%d\n", p->name, error); - kthread_exit(error); + kproc_exit(error); } g_topology_unlock(); @@ -480,7 +480,7 @@ gv_rebuild_td(void *arg) printf("GEOM_VINUM: rebuild of %s finished\n", p->name); g_free(sync); - kthread_exit(error); + kproc_exit(error); } void @@ -511,7 +511,7 @@ gv_sync_td(void *arg) printf("GEOM_VINUM: sync from '%s' failed to access " "consumer: %d\n", sync->from->name, error); g_free(sync); - kthread_exit(error); + kproc_exit(error); } error = g_access(to, 0, 1, 0); if (error) { @@ -520,7 +520,7 @@ gv_sync_td(void *arg) printf("GEOM_VINUM: sync to '%s' failed to access " "consumer: %d\n", p->name, error); g_free(sync); - kthread_exit(error); + kproc_exit(error); } g_topology_unlock(); @@ -593,7 +593,7 @@ gv_sync_td(void *arg) p->synced = 0; g_free(sync); - kthread_exit(error); + kproc_exit(error); } void @@ -632,7 +632,7 @@ gv_init_td(void *arg) g_topology_unlock(); printf("GEOM_VINUM: subdisk '%s' init: failed to access " "consumer; error: %d\n", s->name, error); - kthread_exit(error); + kproc_exit(error); } g_topology_unlock(); @@ -667,5 +667,5 @@ gv_init_td(void *arg) printf("GEOM_VINUM: subdisk '%s' init: finished successfully\n", s->name); } - kthread_exit(error); + kproc_exit(error); } diff --git a/sys/geom/vinum/geom_vinum_plex.c b/sys/geom/vinum/geom_vinum_plex.c index bdcce213f7fb..31a64abb9c4a 100644 --- a/sys/geom/vinum/geom_vinum_plex.c +++ b/sys/geom/vinum/geom_vinum_plex.c @@ -332,7 +332,7 @@ gv_plex_worker(void *arg) p->flags |= GV_PLEX_THREAD_DEAD; wakeup(p); - kthread_exit(ENXIO); + kproc_exit(ENXIO); } 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) mtx_init(&p->bqueue_mtx, "gv_plex", NULL, MTX_DEF); 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->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); bioq_init(p->wqueue); 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->flags |= GV_PLEX_THREAD_ACTIVE; diff --git a/sys/geom/vinum/geom_vinum_volume.c b/sys/geom/vinum/geom_vinum_volume.c index afc1f2a33b56..eed495b46bab 100644 --- a/sys/geom/vinum/geom_vinum_volume.c +++ b/sys/geom/vinum/geom_vinum_volume.c @@ -149,7 +149,7 @@ gv_vol_worker(void *arg) v->flags |= GV_VOL_THREAD_DEAD; wakeup(v); - kthread_exit(ENXIO); + kproc_exit(ENXIO); } 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); 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->flags |= GV_VOL_THREAD_ACTIVE; } diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index f23099fbc801..30a24b5362af 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -754,7 +754,7 @@ apm_event_thread(void *arg) mtx_unlock(&sc->mtx); } sc->running = 0; - kthread_exit(0); + kproc_exit(0); } /* enable APM BIOS */ @@ -770,7 +770,7 @@ apm_event_enable(void) /* Start the thread */ 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")) panic("Cannot create apm worker thread"); diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 0eb26ecdad72..ef404b32554a 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -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. * * Note special case - do not make it runnable yet. Other work diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 1c3fba0ebf33..17a74c4368c0 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -283,7 +283,7 @@ acct(struct thread *td, struct acct_args *uap) * than one, but if so the extras will commit suicide as * soon as they start up. */ - error = kthread_create(acct_thread, NULL, NULL, 0, 0, + error = kproc_create(acct_thread, NULL, NULL, 0, 0, "accounting"); if (error) { vfslocked = VFS_LOCK_GIANT(acct_vp->v_mount); @@ -625,7 +625,7 @@ acct_thread(void *dummy) sx_xlock(&acct_sx); if (acct_state & ACCT_RUNNING) { sx_xunlock(&acct_sx); - kthread_exit(0); + kproc_exit(0); } acct_state |= ACCT_RUNNING; @@ -652,5 +652,5 @@ acct_thread(void *dummy) */ acct_state = 0; sx_xunlock(&acct_sx); - kthread_exit(0); + kproc_exit(0); } diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index e6f4d1510be3..eeb02efd02b1 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -802,7 +802,7 @@ fork_exit(callout, arg, frame) if (p->p_flag & P_KTHREAD) { printf("Kernel thread \"%s\" (pid %d) exited prematurely.\n", p->p_comm, p->p_pid); - kthread_exit(0); + kproc_exit(0); } mtx_assert(&Giant, MA_NOTOWNED); diff --git a/sys/kern/kern_idle.c b/sys/kern/kern_idle.c index 7d0925ee9579..43ce37a2faee 100644 --- a/sys/kern/kern_idle.c +++ b/sys/kern/kern_idle.c @@ -60,16 +60,16 @@ idle_setup(void *dummy) #ifdef SMP 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); pc->pc_idlethread = FIRST_THREAD_IN_PROC(p); #else - error = kthread_create(sched_idletd, NULL, &p, + error = kproc_create(sched_idletd, NULL, &p, RFSTOPPED | RFHIGHPID, 0, "idle"); PCPU_SET(idlethread, FIRST_THREAD_IN_PROC(p)); #endif if (error) - panic("idle_setup: kthread_create error %d\n", error); + panic("idle_setup: kproc_create error %d\n", error); PROC_LOCK(p); p->p_flag |= P_NOLOAD; diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index d754440c3c15..ae749766561f 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -337,10 +337,10 @@ ithread_create(const char *name) 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); if (error) - panic("kthread_create() failed with %d", error); + panic("kproc_create() failed with %d", error); td = FIRST_THREAD_IN_PROC(p); /* XXXKSE */ thread_lock(td); 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); - error = kthread_create(ithread_loop, ih, &p, RFSTOPPED | RFHIGHPID, + error = kproc_create(ithread_loop, ih, &p, RFSTOPPED | RFHIGHPID, 0, "%s", name); if (error) - panic("kthread_create() failed with %d", error); + panic("kproc_create() failed with %d", error); td = FIRST_THREAD_IN_PROC(p); /* XXXKSE */ thread_lock(td); sched_class(td, PRI_ITHD); @@ -1102,7 +1102,7 @@ ithread_loop(void *arg) CTR3(KTR_INTR, "%s: pid %d (%s) exiting", __func__, p->p_pid, p->p_comm); 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__, p->p_pid, p->p_comm); free(ithd, M_ITHREAD); - kthread_exit(0); + kproc_exit(0); } /* diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index 03f7f47020b3..a9359359dabd 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -56,7 +56,7 @@ kproc_start(udata) const struct kproc_desc *kp = udata; 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); if (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.). */ 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, ...) { int error; @@ -82,7 +82,7 @@ kthread_create(void (*func)(void *), void *arg, struct proc *p2; if (!proc0.p_stats) - panic("kthread_create called too soon"); + panic("kproc_create called too soon"); error = fork1(&thread0, RFMEM | RFFDG | RFPROC | RFSTOPPED | flags, pages, &p2); @@ -122,7 +122,7 @@ kthread_create(void (*func)(void *), void *arg, } void -kthread_exit(int ecode) +kproc_exit(int ecode) { struct thread *td; struct proc *p; @@ -154,7 +154,7 @@ kthread_exit(int ecode) * Participation is voluntary. */ 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 @@ -171,7 +171,7 @@ kthread_suspend(struct proc *p, int timo) } int -kthread_resume(struct proc *p) +kproc_resume(struct proc *p) { /* * Make sure this is indeed a system process and we can safely @@ -189,7 +189,7 @@ kthread_resume(struct proc *p) } void -kthread_suspend_check(struct proc *p) +kproc_suspend_check(struct proc *p) { PROC_LOCK(p); while (SIGISMEMBER(p->p_siglist, SIGSTOP)) { diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index bb54faa732d3..bd1aeaf35915 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -608,7 +608,7 @@ kproc_shutdown(void *arg, int howto) strlcpy(procname, p->p_comm, sizeof(procname)); printf("Waiting (max %d seconds) for system process `%s' to stop...", kproc_shutdown_wait, procname); - error = kthread_suspend(p, kproc_shutdown_wait * hz); + error = kproc_suspend(p, kproc_shutdown_wait * hz); if (error == EWOULDBLOCK) printf("timed out\n"); diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c index 3e210ccbf23f..c3ddb5f38765 100644 --- a/sys/kern/subr_taskqueue.c +++ b/sys/kern/subr_taskqueue.c @@ -336,14 +336,14 @@ taskqueue_start_threads(struct taskqueue **tqp, int count, int pri, for (i = 0; i < count; i++) { if (count == 1) - error = kthread_create(taskqueue_thread_loop, tqp, + error = kproc_create(taskqueue_thread_loop, tqp, &tq->tq_pproc[i], RFSTOPPED, 0, ktname); 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); if (error) { /* 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); tq->tq_pproc[i] = NULL; /* paranoid */ } else @@ -379,7 +379,7 @@ taskqueue_thread_loop(void *arg) tq->tq_pcount--; wakeup_one(tq->tq_pproc); TQ_UNLOCK(tq); - kthread_exit(0); + kproc_exit(0); } void diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 842b43570412..264f291c040a 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -1122,7 +1122,7 @@ aio_daemon(void *_id) mycp->p_vmspace->vm_refcnt); } #endif - kthread_exit(0); + kproc_exit(0); } } } @@ -1143,7 +1143,7 @@ aio_newproc(int *start) int id; 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); if (error == 0) { /* diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index d3344597f418..ce59df65b259 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -2058,7 +2058,7 @@ buf_daemon() bd_request = 0; mtx_unlock(&bdlock); - kthread_suspend_check(bufdaemonproc); + kproc_suspend_check(bufdaemonproc); /* * Do the flush. Limit the amount of in-transit I/O we diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 9c168d72d143..fce5beb4a721 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -726,7 +726,7 @@ vnlru_proc(void) SHUTDOWN_PRI_FIRST); for (;;) { - kthread_suspend_check(p); + kproc_suspend_check(p); mtx_lock(&vnode_free_list_mtx); if (freevnodes > wantfreevnodes) vnlru_free(freevnodes - wantfreevnodes); @@ -1688,7 +1688,7 @@ sched_sync(void) if (syncer_state == SYNCER_FINAL_DELAY && syncer_final_iter == 0) { mtx_unlock(&sync_mtx); - kthread_suspend_check(td->td_proc); + kproc_suspend_check(td->td_proc); mtx_lock(&sync_mtx); } net_worklist_len = syncer_worklist_len - sync_vnode_count; diff --git a/sys/netinet/sctp_bsd_addr.c b/sys/netinet/sctp_bsd_addr.c index e0aa30483078..fcb607cc4f93 100644 --- a/sys/netinet/sctp_bsd_addr.c +++ b/sys/netinet/sctp_bsd_addr.c @@ -106,7 +106,7 @@ sctp_startup_iterator(void) { int ret; - ret = kthread_create(sctp_iterator_thread, + ret = kproc_create(sctp_iterator_thread, (void *)NULL, &sctppcbinfo.thread_proc, RFPROC, diff --git a/sys/netsmb/smb_iod.c b/sys/netsmb/smb_iod.c index 8a687c260e79..30ab73eb4fa4 100644 --- a/sys/netsmb/smb_iod.c +++ b/sys/netsmb/smb_iod.c @@ -668,7 +668,7 @@ smb_iod_thread(void *arg) tsleep(&iod->iod_flags, PWAIT, "90idle", iod->iod_sleeptimo); } /* mtx_lock(&Giant, MTX_DEF);*/ - kthread_exit(0); + kproc_exit(0); } int @@ -689,7 +689,7 @@ smb_iod_create(struct smb_vc *vcp) TAILQ_INIT(&iod->iod_rqlist); smb_sl_init(&iod->iod_evlock, "90evl"); 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); if (error) { SMBERROR("can't start smbiod: %d", error); diff --git a/sys/nfs4client/nfs4_vfsops.c b/sys/nfs4client/nfs4_vfsops.c index 8f81b112ff0f..fb61220b8fc6 100644 --- a/sys/nfs4client/nfs4_vfsops.c +++ b/sys/nfs4client/nfs4_vfsops.c @@ -526,7 +526,7 @@ nfs4_daemon(void *arg) nfs4_daemonproc = NULL; mtx_unlock(&Giant); /*printf("nfsv4 renewd exiting\n");*/ - kthread_exit(0); + kproc_exit(0); } 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 */ if (nfs4_daemonproc == NULL) - kthread_create(nfs4_daemon, crdup(cred), &nfs4_daemonproc, + kproc_create(nfs4_daemon, crdup(cred), &nfs4_daemonproc, (RFPROC|RFMEM), 0, "nfs4rd"); return (0); diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c index ac98732c76b5..8e5112389d7d 100644 --- a/sys/nfsclient/nfs_nfsiod.c +++ b/sys/nfsclient/nfs_nfsiod.c @@ -177,7 +177,7 @@ nfs_nfsiodnew(void) if (newiod == -1) return (-1); 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); mtx_lock(&nfs_iod_mtx); if (error) @@ -309,7 +309,7 @@ nfssvc_iod(void *instance) wakeup(&nfs_numasync); mtx_unlock(&nfs_iod_mtx); if ((error == 0) || (error == EWOULDBLOCK)) - kthread_exit(0); + kproc_exit(0); /* Abnormal termination */ - kthread_exit(1); + kproc_exit(1); } diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 738328cabca7..0637c86411ba 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -216,7 +216,7 @@ crypto_init(void) goto bad; } - error = kthread_create((void (*)(void *)) crypto_proc, NULL, + error = kproc_create((void (*)(void *)) crypto_proc, NULL, &cryptoproc, 0, 0, "crypto"); if (error) { printf("crypto_init: cannot start crypto thread; error %d", @@ -224,7 +224,7 @@ crypto_init(void) 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"); if (error) { printf("crypto_init: cannot start cryptoret thread; error %d", @@ -1222,7 +1222,7 @@ crypto_finis(void *chan) CRYPTO_DRIVER_LOCK(); wakeup_one(chan); CRYPTO_DRIVER_UNLOCK(); - kthread_exit(0); + kproc_exit(0); } /* diff --git a/sys/security/audit/audit_worker.c b/sys/security/audit/audit_worker.c index cdf1cf2683fb..2ced60af558f 100644 --- a/sys/security/audit/audit_worker.c +++ b/sys/security/audit/audit_worker.c @@ -544,8 +544,8 @@ audit_worker_init(void) int error; 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"); if (error) - panic("audit_worker_init: kthread_create returned %d", error); + panic("audit_worker_init: kproc_create returned %d", error); } diff --git a/sys/sun4v/sun4v/simdisk.c b/sys/sun4v/sun4v/simdisk.c index 1320927c0cad..3c77e41d2d40 100644 --- a/sys/sun4v/sun4v/simdisk.c +++ b/sys/sun4v/sun4v/simdisk.c @@ -173,7 +173,7 @@ g_hvd_init(struct g_class *mp __unused) sc->hvd_sectorsize = HVD_BLOCKSIZE; sc->hvd_fwsectors = 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"); if (error != 0) { free(sc, M_DEVBUF); diff --git a/sys/sys/kthread.h b/sys/sys/kthread.h index 5f41cfc3c008..d8e37d5a3e08 100644 --- a/sys/sys/kthread.h +++ b/sys/sys/kthread.h @@ -44,11 +44,11 @@ struct kproc_desc { void kproc_shutdown(void *, int); 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); -void kthread_exit(int) __dead2; -int kthread_resume(struct proc *); /* XXXKSE */ -int kthread_suspend(struct proc *, int); /* XXXKSE */ -void kthread_suspend_check(struct proc *); /* XXXKSE */ +void kproc_exit(int) __dead2; +int kproc_resume(struct proc *); /* XXXKSE */ +int kproc_suspend(struct proc *, int); /* XXXKSE */ +void kproc_suspend_check(struct proc *); /* XXXKSE */ #endif /* !_SYS_KTHREAD_H_ */ diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 94368fd76a3c..c15f9250015a 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -728,7 +728,7 @@ softdep_flush(void) td->td_pflags |= TDP_NORUNNINGBUF; for (;;) { - kthread_suspend_check(softdepproc); + kproc_suspend_check(softdepproc); vfslocked = VFS_LOCK_GIANT((struct mount *)NULL); ACQUIRE_LOCK(&lk); /* diff --git a/sys/vm/vm_zeroidle.c b/sys/vm/vm_zeroidle.c index 06842139e9fa..c994695ab968 100644 --- a/sys/vm/vm_zeroidle.c +++ b/sys/vm/vm_zeroidle.c @@ -147,7 +147,7 @@ pagezero_start(void __unused *arg) int error; struct thread *td; - error = kthread_create(vm_pagezero, NULL, &pagezero_proc, RFSTOPPED, 0, + error = kproc_create(vm_pagezero, NULL, &pagezero_proc, RFSTOPPED, 0, "pagezero"); if (error) panic("pagezero_start: error %d\n", error);