diff options
Diffstat (limited to 'sys/dev')
102 files changed, 595 insertions, 582 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 5f0ef28..4eef4e7 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -2058,7 +2058,7 @@ aac_describe_code(struct aac_code_lookup *table, u_int32_t code) */ static int -aac_open(dev_t dev, int flags, int fmt, struct proc *p) +aac_open(dev_t dev, int flags, int fmt, struct thread *td) { struct aac_softc *sc; @@ -2076,7 +2076,7 @@ aac_open(dev_t dev, int flags, int fmt, struct proc *p) } static int -aac_close(dev_t dev, int flags, int fmt, struct proc *p) +aac_close(dev_t dev, int flags, int fmt, struct thread *td) { struct aac_softc *sc; @@ -2091,7 +2091,7 @@ aac_close(dev_t dev, int flags, int fmt, struct proc *p) } static int -aac_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) +aac_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) { union aac_statrequest *as; struct aac_softc *sc; @@ -2427,20 +2427,20 @@ SYSUNINIT(aac_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE, MODULE_DEPEND(aac, linux, 1, 1, 1); static int -aac_linux_ioctl(struct proc *p, struct linux_ioctl_args *args) +aac_linux_ioctl(struct thread *td, struct linux_ioctl_args *args) { struct file *fp; u_long cmd; debug_called(2); - fp = p->p_fd->fd_ofiles[args->fd]; + fp = td->td_proc->p_fd->fd_ofiles[args->fd]; cmd = args->cmd; /* * Pass the ioctl off to our standard handler. */ - return(fo_ioctl(fp, cmd, (caddr_t)args->arg, p)); + return(fo_ioctl(fp, cmd, (caddr_t)args->arg, td)); } #endif diff --git a/sys/dev/aac/aac_disk.c b/sys/dev/aac/aac_disk.c index 3917fa1..77f8469 100644 --- a/sys/dev/aac/aac_disk.c +++ b/sys/dev/aac/aac_disk.c @@ -127,7 +127,7 @@ SYSCTL_UINT(_hw_aac, OID_AUTO, iosize_max, CTLFLAG_RD, &aac_iosize_max, 0, * basic device geometry paramters. */ static int -aac_disk_open(dev_t dev, int flags, int fmt, struct proc *p) +aac_disk_open(dev_t dev, int flags, int fmt, struct thread *td) { struct aac_disk *sc; struct disklabel *label; @@ -162,7 +162,7 @@ aac_disk_open(dev_t dev, int flags, int fmt, struct proc *p) * Handle last close of the disk device. */ static int -aac_disk_close(dev_t dev, int flags, int fmt, struct proc *p) +aac_disk_close(dev_t dev, int flags, int fmt, struct thread *td) { struct aac_disk *sc; diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 49c6266..3edd3f8 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1590,19 +1590,19 @@ acpi_deregister_ioctl(u_long cmd, int (* fn)(u_long cmd, caddr_t addr, void *arg } static int -acpiopen(dev_t dev, int flag, int fmt, struct proc *p) +acpiopen(dev_t dev, int flag, int fmt, struct thread *td) { return(0); } static int -acpiclose(dev_t dev, int flag, int fmt, struct proc *p) +acpiclose(dev_t dev, int flag, int fmt, struct thread *td) { return(0); } static int -acpiioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +acpiioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct acpi_softc *sc; struct acpi_ioctl_hook *hp; diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index 333c4c8..138fe45 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -270,7 +270,7 @@ agp_generic_detach(device_t dev) { struct agp_softc *sc = device_get_softc(dev); bus_release_resource(dev, SYS_RES_MEMORY, AGP_APBASE, sc->as_aperture); - lockmgr(&sc->as_lock, LK_DRAIN, 0, curproc); + lockmgr(&sc->as_lock, LK_DRAIN, 0, curthread); lockdestroy(&sc->as_lock); destroy_dev(sc->as_devnode); agp_flush_cache(); @@ -389,7 +389,7 @@ agp_generic_bind_memory(device_t dev, struct agp_memory *mem, vm_page_t m; int error; - lockmgr(&sc->as_lock, LK_EXCLUSIVE, 0, curproc); + lockmgr(&sc->as_lock, LK_EXCLUSIVE, 0, curthread); if (mem->am_is_bound) { device_printf(dev, "memory already bound\n"); @@ -450,7 +450,7 @@ agp_generic_bind_memory(device_t dev, struct agp_memory *mem, OFF_TO_IDX(k)); vm_page_unwire(m, 0); } - lockmgr(&sc->as_lock, LK_RELEASE, 0, curproc); + lockmgr(&sc->as_lock, LK_RELEASE, 0, curthread); return error; } } @@ -471,7 +471,7 @@ agp_generic_bind_memory(device_t dev, struct agp_memory *mem, mem->am_offset = offset; mem->am_is_bound = 1; - lockmgr(&sc->as_lock, LK_RELEASE, 0, curproc); + lockmgr(&sc->as_lock, LK_RELEASE, 0, curthread); return 0; } @@ -483,7 +483,7 @@ agp_generic_unbind_memory(device_t dev, struct agp_memory *mem) vm_page_t m; int i; - lockmgr(&sc->as_lock, LK_EXCLUSIVE, 0, curproc); + lockmgr(&sc->as_lock, LK_EXCLUSIVE, 0, curthread); if (!mem->am_is_bound) { device_printf(dev, "memory is not bound\n"); @@ -508,7 +508,7 @@ agp_generic_unbind_memory(device_t dev, struct agp_memory *mem) mem->am_offset = 0; mem->am_is_bound = 0; - lockmgr(&sc->as_lock, LK_RELEASE, 0, curproc); + lockmgr(&sc->as_lock, LK_RELEASE, 0, curthread); return 0; } @@ -645,7 +645,7 @@ agp_unbind_user(device_t dev, agp_unbind *unbind) } static int -agp_open(dev_t kdev, int oflags, int devtype, struct proc *p) +agp_open(dev_t kdev, int oflags, int devtype, struct thread *td) { device_t dev = KDEV2DEV(kdev); struct agp_softc *sc = device_get_softc(dev); @@ -659,7 +659,7 @@ agp_open(dev_t kdev, int oflags, int devtype, struct proc *p) } static int -agp_close(dev_t kdev, int fflag, int devtype, struct proc *p) +agp_close(dev_t kdev, int fflag, int devtype, struct thread *td) { device_t dev = KDEV2DEV(kdev); struct agp_softc *sc = device_get_softc(dev); @@ -676,7 +676,7 @@ agp_close(dev_t kdev, int fflag, int devtype, struct proc *p) } static int -agp_ioctl(dev_t kdev, u_long cmd, caddr_t data, int fflag, struct proc *p) +agp_ioctl(dev_t kdev, u_long cmd, caddr_t data, int fflag, struct thread *td) { device_t dev = KDEV2DEV(kdev); diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index a8be136..2b5eca1 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -340,7 +340,7 @@ amr_submit_bio(struct amr_softc *sc, struct bio *bio) * Accept an open operation on the control device. */ int -amr_open(dev_t dev, int flags, int fmt, struct proc *p) +amr_open(dev_t dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct amr_softc *sc = devclass_get_softc(amr_devclass, unit); @@ -355,7 +355,7 @@ amr_open(dev_t dev, int flags, int fmt, struct proc *p) * Accept the last close on the control device. */ int -amr_close(dev_t dev, int flags, int fmt, struct proc *p) +amr_close(dev_t dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct amr_softc *sc = devclass_get_softc(amr_devclass, unit); @@ -370,7 +370,7 @@ amr_close(dev_t dev, int flags, int fmt, struct proc *p) * Handle controller-specific control operations. */ int -amr_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) +amr_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) { struct amr_softc *sc = (struct amr_softc *)dev->si_drv1; int *arg = (int *)addr; diff --git a/sys/dev/amr/amr_disk.c b/sys/dev/amr/amr_disk.c index e6f016a..38784d3 100644 --- a/sys/dev/amr/amr_disk.c +++ b/sys/dev/amr/amr_disk.c @@ -100,7 +100,7 @@ static driver_t amrd_driver = { DRIVER_MODULE(amrd, amr, amrd_driver, amrd_devclass, 0, 0); static int -amrd_open(dev_t dev, int flags, int fmt, struct proc *p) +amrd_open(dev_t dev, int flags, int fmt, struct thread *td) { struct amrd_softc *sc = (struct amrd_softc *)dev->si_drv1; struct disklabel *label; @@ -129,7 +129,7 @@ amrd_open(dev_t dev, int flags, int fmt, struct proc *p) } static int -amrd_close(dev_t dev, int flags, int fmt, struct proc *p) +amrd_close(dev_t dev, int flags, int fmt, struct thread *td) { struct amrd_softc *sc = (struct amrd_softc *)dev->si_drv1; @@ -142,7 +142,7 @@ amrd_close(dev_t dev, int flags, int fmt, struct proc *p) } static int -amrd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) +amrd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) { return (ENOTTY); diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c index 87ad7b1..ed34c4a 100644 --- a/sys/dev/an/if_an.c +++ b/sys/dev/an/if_an.c @@ -94,6 +94,7 @@ #include <sys/systm.h> #include <sys/sockio.h> #include <sys/mbuf.h> +#include <sys/proc.h> #include <sys/kernel.h> #include <sys/socket.h> #ifdef ANCACHE diff --git a/sys/dev/asr/asr.c b/sys/dev/asr/asr.c index f755c54..32062a0 100644 --- a/sys/dev/asr/asr.c +++ b/sys/dev/asr/asr.c @@ -216,6 +216,7 @@ static dpt_sig_S ASR_sig = { #include <sys/malloc.h> #include <sys/conf.h> #include <sys/disklabel.h> +#include <sys/proc.h> #include <sys/bus.h> #include <machine/resource.h> #include <machine/bus.h> @@ -457,17 +458,17 @@ STATIC int asr_ioctl __P(( IN u_long cmd, INOUT caddr_t data, int flag, - struct proc * proc)); + struct thread * td)); STATIC int asr_open __P(( IN dev_t dev, int32_t flags, int32_t ifmt, - IN struct proc * proc)); + IN struct thread * td)); STATIC int asr_close __P(( dev_t dev, int flags, int ifmt, - struct proc * proc)); + struct thread * td)); STATIC int asr_intr __P(( IN Asr_softc_t * sc)); STATIC void asr_timeout __P(( @@ -3863,7 +3864,7 @@ asr_open( IN dev_t dev, int32_t flags, int32_t ifmt, - IN struct proc * proc) + IN struct thread * td) { int s; OUT int error; @@ -3876,7 +3877,7 @@ asr_open( s = splcam (); if (ASR_ctlr_held) { error = EBUSY; - } else if ((error = suser(proc)) == 0) { + } else if ((error = suser(td->td_proc)) == 0) { ++ASR_ctlr_held; } splx(s); @@ -3888,12 +3889,12 @@ asr_close( dev_t dev, int flags, int ifmt, - struct proc * proc) + struct thread * td) { UNREFERENCED_PARAMETER(dev); UNREFERENCED_PARAMETER(flags); UNREFERENCED_PARAMETER(ifmt); - UNREFERENCED_PARAMETER(proc); + UNREFERENCED_PARAMETER(td); ASR_ctlr_held = 0; return (0); @@ -4387,13 +4388,13 @@ asr_ioctl( IN u_long cmd, INOUT caddr_t data, int flag, - struct proc * proc) + struct thread * td) { int i, j; OUT int error = 0; Asr_softc_t * sc = ASR_get_sc (dev); UNREFERENCED_PARAMETER(flag); - UNREFERENCED_PARAMETER(proc); + UNREFERENCED_PARAMETER(td); if (sc != (Asr_softc_t *)NULL) switch(cmd) { diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index b6544d8..50a59c3 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -285,7 +285,7 @@ ata_resume(device_t dev) } static int -ataioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) +ataioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) { struct ata_cmd *iocmd = (struct ata_cmd *)addr; device_t device; diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 59aa250..7e5470a 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -252,7 +252,7 @@ ad_detach(struct ad_softc *adp, int flush) } static int -adopen(dev_t dev, int flags, int fmt, struct proc *p) +adopen(dev_t dev, int flags, int fmt, struct thread *td) { struct ad_softc *adp = dev->si_drv1; @@ -262,7 +262,7 @@ adopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -adclose(dev_t dev, int flags, int fmt, struct proc *p) +adclose(dev_t dev, int flags, int fmt, struct thread *td) { struct ad_softc *adp = dev->si_drv1; diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c index 161d6b8..121110f 100644 --- a/sys/dev/ata/ata-raid.c +++ b/sys/dev/ata/ata-raid.c @@ -137,7 +137,7 @@ ar_attach(struct ar_softc *raid) } static int -aropen(dev_t dev, int flags, int fmt, struct proc *p) +aropen(dev_t dev, int flags, int fmt, struct thread *td) { struct ar_softc *rdp = dev->si_drv1; struct disklabel *dl; diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 31d86e9..f69e7e7 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -33,6 +33,7 @@ #include <sys/ata.h> #include <sys/kernel.h> #include <sys/malloc.h> +#include <sys/proc.h> #include <sys/bio.h> #include <sys/bus.h> #include <sys/disklabel.h> @@ -499,7 +500,7 @@ msf2lba(u_int8_t m, u_int8_t s, u_int8_t f) } static int -acdopen(dev_t dev, int flags, int fmt, struct proc *p) +acdopen(dev_t dev, int flags, int fmt, struct thread *td) { struct acd_softc *cdp = dev->si_drv1; @@ -523,7 +524,7 @@ acdopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -acdclose(dev_t dev, int flags, int fmt, struct proc *p) +acdclose(dev_t dev, int flags, int fmt, struct thread *td) { struct acd_softc *cdp = dev->si_drv1; @@ -542,7 +543,7 @@ acdclose(dev_t dev, int flags, int fmt, struct proc *p) } static int -acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) +acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { struct acd_softc *cdp = dev->si_drv1; int error = 0; @@ -595,7 +596,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) break; case CDIOCRESET: - error = suser(p); + error = suser(td->td_proc); if (error) break; error = atapi_test_ready(cdp->atp); diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index a419d2b..ba47781 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -239,7 +239,7 @@ afd_describe(struct afd_softc *fdp) } static int -afdopen(dev_t dev, int flags, int fmt, struct proc *p) +afdopen(dev_t dev, int flags, int fmt, struct thread *td) { struct afd_softc *fdp = dev->si_drv1; struct disklabel *label = &fdp->disk.d_label; @@ -266,7 +266,7 @@ afdopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -afdclose(dev_t dev, int flags, int fmt, struct proc *p) +afdclose(dev_t dev, int flags, int fmt, struct thread *td) { struct afd_softc *fdp = dev->si_drv1; @@ -276,7 +276,7 @@ afdclose(dev_t dev, int flags, int fmt, struct proc *p) } static int -afdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +afdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct afd_softc *fdp = dev->si_drv1; diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index 98114c3..cb8b893 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -255,7 +255,7 @@ ast_describe(struct ast_softc *stp) } static int -astopen(dev_t dev, int flags, int fmt, struct proc *p) +astopen(dev_t dev, int flags, int fmt, struct thread *td) { struct ast_softc *stp = dev->si_drv1; @@ -281,7 +281,7 @@ astopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -astclose(dev_t dev, int flags, int fmt, struct proc *p) +astclose(dev_t dev, int flags, int fmt, struct thread *td) { struct ast_softc *stp = dev->si_drv1; @@ -310,7 +310,7 @@ astclose(dev_t dev, int flags, int fmt, struct proc *p) } static int -astioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +astioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct ast_softc *stp = dev->si_drv1; int error = 0; diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 1bb5b71..1fb37ea 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -1164,7 +1164,7 @@ psmdetach(device_t dev) } static int -psmopen(dev_t dev, int flag, int fmt, struct proc *p) +psmopen(dev_t dev, int flag, int fmt, struct thread *td) { int unit = PSM_UNIT(dev); struct psm_softc *sc; @@ -1248,7 +1248,7 @@ psmopen(dev_t dev, int flag, int fmt, struct proc *p) } static int -psmclose(dev_t dev, int flag, int fmt, struct proc *p) +psmclose(dev_t dev, int flag, int fmt, struct thread *td) { int unit = PSM_UNIT(dev); struct psm_softc *sc = PSM_SOFTC(unit); @@ -1516,7 +1516,7 @@ unblock_mouse_data(struct psm_softc *sc, int c) } static int -psmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +psmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); mousemode_t mode; @@ -2237,7 +2237,7 @@ psmintr(void *arg) } static int -psmpoll(dev_t dev, int events, struct proc *p) +psmpoll(dev_t dev, int events, struct thread *td) { struct psm_softc *sc = PSM_SOFTC(PSM_UNIT(dev)); int s; @@ -2249,7 +2249,7 @@ psmpoll(dev_t dev, int events, struct proc *p) if (sc->queue.count > 0) revents |= events & (POLLIN | POLLRDNORM); else - selrecord(p, &sc->rsel); + selrecord(td, &sc->rsel); } splx(s); diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c index 17c58ba..ab76ea0 100644 --- a/sys/dev/awi/awi.c +++ b/sys/dev/awi/awi.c @@ -99,6 +99,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/mbuf.h> +#include <sys/proc.h> #include <sys/malloc.h> #include <sys/socket.h> #include <sys/sockio.h> diff --git a/sys/dev/awi/awi_wep.c b/sys/dev/awi/awi_wep.c index d826d32..f9347c5 100644 --- a/sys/dev/awi/awi_wep.c +++ b/sys/dev/awi/awi_wep.c @@ -54,6 +54,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/mbuf.h> +#include <sys/proc.h> #include <sys/malloc.h> #include <sys/socket.h> #include <sys/errno.h> diff --git a/sys/dev/awi/awi_wicfg.c b/sys/dev/awi/awi_wicfg.c index e0554d7..97f9fce 100644 --- a/sys/dev/awi/awi_wicfg.c +++ b/sys/dev/awi/awi_wicfg.c @@ -45,6 +45,7 @@ #include <sys/systm.h> #include <sys/kernel.h> #include <sys/mbuf.h> +#include <sys/proc.h> #include <sys/malloc.h> #include <sys/socket.h> #include <sys/errno.h> diff --git a/sys/dev/bktr/bktr_core.c b/sys/dev/bktr/bktr_core.c index 50e8511..528f09a 100644 --- a/sys/dev/bktr/bktr_core.c +++ b/sys/dev/bktr/bktr_core.c @@ -1277,7 +1277,7 @@ vbi_read(bktr_ptr_t bktr, struct uio *uio, int ioflag) * video ioctls */ int -video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct proc* pr ) +video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct thread* td ) { volatile u_char c_temp; unsigned int temp; @@ -1565,7 +1565,7 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct pro break; } bktr->signal = *(int *) arg; - bktr->proc = pr; + bktr->proc = td->td_proc; break; case METEORGSIGNAL: @@ -1886,7 +1886,7 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct pro * tuner ioctls */ int -tuner_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct proc* pr ) +tuner_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct thread* td ) { int tmp_int; unsigned int temp, temp1; diff --git a/sys/dev/bktr/bktr_core.h b/sys/dev/bktr/bktr_core.h index bf41a99..5948ab6 100644 --- a/sys/dev/bktr/bktr_core.h +++ b/sys/dev/bktr/bktr_core.h @@ -82,13 +82,13 @@ int video_open( bktr_ptr_t bktr ); int video_close( bktr_ptr_t bktr ); int video_read( bktr_ptr_t bktr, int unit, dev_t dev, struct uio *uio ); int video_ioctl( bktr_ptr_t bktr, int unit, - ioctl_cmd_t cmd, caddr_t arg, struct proc* pr ); + ioctl_cmd_t cmd, caddr_t arg, struct thread* pr ); int tuner_open( bktr_ptr_t bktr ); int tuner_close( bktr_ptr_t bktr ); int tuner_ioctl( bktr_ptr_t bktr, int unit, - ioctl_cmd_t cmd, caddr_t arg, struct proc* pr ); + ioctl_cmd_t cmd, caddr_t arg, struct thread* pr ); int vbi_open( bktr_ptr_t bktr ); int vbi_close( bktr_ptr_t bktr ); diff --git a/sys/dev/bktr/bktr_os.c b/sys/dev/bktr/bktr_os.c index f916864..cc79745 100644 --- a/sys/dev/bktr/bktr_os.c +++ b/sys/dev/bktr/bktr_os.c @@ -559,7 +559,7 @@ get_bktr_mem( int unit, unsigned size ) * */ int -bktr_open( dev_t dev, int flags, int fmt, struct proc *p ) +bktr_open( dev_t dev, int flags, int fmt, struct thread *td ) { bktr_ptr_t bktr; int unit; @@ -639,7 +639,7 @@ bktr_open( dev_t dev, int flags, int fmt, struct proc *p ) * */ int -bktr_close( dev_t dev, int flags, int fmt, struct proc *p ) +bktr_close( dev_t dev, int flags, int fmt, struct thread *td ) { bktr_ptr_t bktr; int unit; @@ -716,7 +716,7 @@ bktr_write( dev_t dev, struct uio *uio, int ioflag ) * */ int -bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct proc* pr ) +bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct thread *td ) { bktr_ptr_t bktr; int unit; @@ -735,9 +735,9 @@ bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct proc* pr ) switch ( FUNCTION( minor(dev) ) ) { case VIDEO_DEV: - return( video_ioctl( bktr, unit, cmd, arg, pr ) ); + return( video_ioctl( bktr, unit, cmd, arg, td ) ); case TUNER_DEV: - return( tuner_ioctl( bktr, unit, cmd, arg, pr ) ); + return( tuner_ioctl( bktr, unit, cmd, arg, td ) ); } return( ENXIO ); @@ -777,7 +777,7 @@ bktr_mmap( dev_t dev, vm_offset_t offset, int nprot ) return( atop(vtophys(bktr->bigbuf) + offset) ); } -int bktr_poll( dev_t dev, int events, struct proc *p) +int bktr_poll( dev_t dev, int events, struct thread *td) { int unit; bktr_ptr_t bktr; @@ -800,7 +800,7 @@ int bktr_poll( dev_t dev, int events, struct proc *p) switch ( FUNCTION( minor(dev) ) ) { case VBI_DEV: if(bktr->vbisize == 0) - selrecord(p, &bktr->vbi_select); + selrecord(td, &bktr->vbi_select); else revents |= events & (POLLIN | POLLRDNORM); break; @@ -1064,7 +1064,7 @@ get_bktr_mem( int unit, unsigned size ) * */ int -bktr_open( dev_t dev, int flags, int fmt, struct proc *p ) +bktr_open( dev_t dev, int flags, int fmt, struct thread *td ) { bktr_ptr_t bktr; int unit; @@ -1127,7 +1127,7 @@ bktr_open( dev_t dev, int flags, int fmt, struct proc *p ) * */ int -bktr_close( dev_t dev, int flags, int fmt, struct proc *p ) +bktr_close( dev_t dev, int flags, int fmt, struct thread *td ) { bktr_ptr_t bktr; int unit; @@ -1188,7 +1188,7 @@ bktr_write( dev_t dev, struct uio *uio, int ioflag ) * */ int -bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct proc* pr ) +bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct thread *td ) { bktr_ptr_t bktr; int unit; @@ -1204,9 +1204,9 @@ bktr_ioctl( dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct proc* pr ) switch ( FUNCTION( minor(dev) ) ) { case VIDEO_DEV: - return( video_ioctl( bktr, unit, cmd, arg, pr ) ); + return( video_ioctl( bktr, unit, cmd, arg, td ) ); case TUNER_DEV: - return( tuner_ioctl( bktr, unit, cmd, arg, pr ) ); + return( tuner_ioctl( bktr, unit, cmd, arg, td ) ); } return( ENXIO ); @@ -1242,7 +1242,7 @@ int bktr_mmap( dev_t dev, vm_offset_t offset, int nprot ) return( i386_btop(vtophys(bktr->bigbuf) + offset) ); } -int bktr_poll( dev_t dev, int events, struct proc *p) +int bktr_poll( dev_t dev, int events, struct thread *td) { int unit; bktr_ptr_t bktr; @@ -1605,7 +1605,7 @@ free_bktr_mem(bktr, dmap, kva) * */ int -bktr_open(dev_t dev, int flags, int fmt, struct proc *p) +bktr_open(dev_t dev, int flags, int fmt, struct thread *td) { bktr_ptr_t bktr; int unit; @@ -1638,7 +1638,7 @@ bktr_open(dev_t dev, int flags, int fmt, struct proc *p) * */ int -bktr_close(dev_t dev, int flags, int fmt, struct proc *p) +bktr_close(dev_t dev, int flags, int fmt, struct thread *td) { bktr_ptr_t bktr; int unit; @@ -1697,7 +1697,7 @@ bktr_write(dev_t dev, struct uio *uio, int ioflag) * */ int -bktr_ioctl(dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct proc* pr) +bktr_ioctl(dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct thread *td) { bktr_ptr_t bktr; int unit; diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index 68df08e..090087b 100644 --- a/sys/dev/ccd/ccd.c +++ b/sys/dev/ccd/ccd.c @@ -202,8 +202,8 @@ static void ccdiodone(struct bio *bp); static void ccdstart(struct ccd_s *, struct bio *); static void ccdinterleave(struct ccd_s *, int); static void ccdintr(struct ccd_s *, struct bio *); -static int ccdinit(struct ccd_s *, char **, struct proc *); -static int ccdlookup(char *, struct proc *p, struct vnode **); +static int ccdinit(struct ccd_s *, char **, struct thread *); +static int ccdlookup(char *, struct thread *p, struct vnode **); static void ccdbuffer(struct ccdbuf **ret, struct ccd_s *, struct bio *, daddr_t, caddr_t, long); static void ccdgetdisklabel(dev_t); @@ -381,7 +381,7 @@ ccd_modevent(module_t mod, int type, void *data) DEV_MODULE(ccd, ccd_modevent, NULL); static int -ccdinit(struct ccd_s *cs, char **cpaths, struct proc *p) +ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) { struct ccdcinfo *ci = NULL; /* XXX */ size_t size; @@ -438,7 +438,7 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct proc *p) * Get partition information for the component. */ if ((error = VOP_IOCTL(vp, DIOCGPART, (caddr_t)&dpart, - FREAD, p->p_ucred, p)) != 0) { + FREAD, td->td_proc->p_ucred, td)) != 0) { #ifdef DEBUG if (ccddebug & (CCDB_FOLLOW|CCDB_INIT)) printf("ccd%d: %s: ioctl failed, error = %d\n", @@ -701,7 +701,7 @@ ccdinterleave(struct ccd_s *cs, int unit) /* ARGSUSED */ static int -ccdopen(dev_t dev, int flags, int fmt, struct proc *p) +ccdopen(dev_t dev, int flags, int fmt, struct thread *td) { int unit = ccdunit(dev); struct ccd_s *cs; @@ -746,7 +746,7 @@ ccdopen(dev_t dev, int flags, int fmt, struct proc *p) /* ARGSUSED */ static int -ccdclose(dev_t dev, int flags, int fmt, struct proc *p) +ccdclose(dev_t dev, int flags, int fmt, struct thread *td) { int unit = ccdunit(dev); struct ccd_s *cs; @@ -770,7 +770,7 @@ ccdclose(dev_t dev, int flags, int fmt, struct proc *p) cs->sc_openmask &= ~(1 << part); /* collect "garbage" if possible */ if (!IS_INITED(cs) && (cs->sc_flags & CCDF_WANTED) == 0) - ccddestroy(cs, p); + ccddestroy(cs, td->td_proc); else ccdunlock(cs); return (0); @@ -1238,7 +1238,7 @@ ccdiodone(struct bio *ibp) } static int -ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int unit = ccdunit(dev); int i, j, lookedup = 0, error = 0; @@ -1317,10 +1317,10 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) if (ccddebug & CCDB_INIT) printf("ccdioctl: lookedup = %d\n", lookedup); #endif - if ((error = ccdlookup(cpp[i], p, &vpp[i])) != 0) { + if ((error = ccdlookup(cpp[i], td, &vpp[i])) != 0) { for (j = 0; j < lookedup; ++j) (void)vn_close(vpp[j], FREAD|FWRITE, - p->p_ucred, p); + td->td_proc->p_ucred, td); free(vpp, M_DEVBUF); free(cpp, M_DEVBUF); ccdunlock(cs); @@ -1334,10 +1334,10 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) /* * Initialize the ccd. Fills in the softc for us. */ - if ((error = ccdinit(cs, cpp, p)) != 0) { + if ((error = ccdinit(cs, cpp, td)) != 0) { for (j = 0; j < lookedup; ++j) (void)vn_close(vpp[j], FREAD|FWRITE, - p->p_ucred, p); + td->td_proc->p_ucred, td); /* * We can't ccddestroy() cs just yet, because nothing * prevents user-level app to do another ioctl() @@ -1398,7 +1398,7 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) cs->sc_cinfo[i].ci_vp); #endif (void)vn_close(cs->sc_cinfo[i].ci_vp, FREAD|FWRITE, - p->p_ucred, p); + td->td_proc->p_ucred, td); free(cs->sc_cinfo[i].ci_path, M_DEVBUF); } @@ -1557,7 +1557,7 @@ ccdsize(dev_t dev) struct ccd_s *cs; int part, size; - if (ccdopen(dev, 0, S_IFCHR, curproc)) + if (ccdopen(dev, 0, S_IFCHR, curthread)) return (-1); cs = ccdfind(ccdunit(dev)); @@ -1571,7 +1571,7 @@ ccdsize(dev_t dev) else size = cs->sc_label.d_partitions[part].p_size; - if (ccdclose(dev, 0, S_IFCHR, curproc)) + if (ccdclose(dev, 0, S_IFCHR, curthread)) return (-1); return (size); @@ -1591,13 +1591,13 @@ ccddump(dev_t dev) * set *vpp to the file's vnode. */ static int -ccdlookup(char *path, struct proc *p, struct vnode **vpp) +ccdlookup(char *path, struct thread *td, struct vnode **vpp) { struct nameidata nd; struct vnode *vp; int error, flags; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, path, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, path, td); flags = FREAD | FWRITE; if ((error = vn_open(&nd, &flags, 0)) != 0) { #ifdef DEBUG @@ -1621,15 +1621,15 @@ ccdlookup(char *path, struct proc *p, struct vnode **vpp) vprint("ccdlookup: vnode info", vp); #endif - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); NDFREE(&nd, NDF_ONLY_PNBUF); *vpp = vp; return (0); bad: - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); NDFREE(&nd, NDF_ONLY_PNBUF); /* vn_close does vrele() for vp */ - (void)vn_close(vp, FREAD|FWRITE, p->p_ucred, p); + (void)vn_close(vp, FREAD|FWRITE, td->td_proc->p_ucred, td); return (error); } diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 9d6f2bb..728ea0a 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -662,11 +662,11 @@ cyattach_common(cy_iobase, cy_align) } static int -sioopen(dev, flag, mode, p) +sioopen(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct com_s *com; int error; @@ -718,7 +718,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser(p)) { + suser_td(td)) { error = EBUSY; goto out; } @@ -847,11 +847,11 @@ out: } static int -sioclose(dev, flag, mode, p) +sioclose(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct com_s *com; int mynor; @@ -1605,12 +1605,12 @@ siointr1(com) #endif static int -sioioctl(dev, cmd, data, flag, p) +sioioctl(dev, cmd, data, flag, td) dev_t dev; u_long cmd; caddr_t data; int flag; - struct proc *p; + struct thread *td; { struct com_s *com; int error; @@ -1639,7 +1639,7 @@ sioioctl(dev, cmd, data, flag, p) } switch (cmd) { case TIOCSETA: - error = suser(p); + error = suser_td(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -1689,7 +1689,7 @@ sioioctl(dev, cmd, data, flag, p) if (lt->c_ospeed != 0) dt->c_ospeed = tp->t_ospeed; } - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if (error != ENOIOCTL) return (error); s = spltty(); @@ -1738,7 +1738,7 @@ sioioctl(dev, cmd, data, flag, p) break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser(p); + error = suser_td(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index 9d6f2bb..728ea0a 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -662,11 +662,11 @@ cyattach_common(cy_iobase, cy_align) } static int -sioopen(dev, flag, mode, p) +sioopen(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct com_s *com; int error; @@ -718,7 +718,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser(p)) { + suser_td(td)) { error = EBUSY; goto out; } @@ -847,11 +847,11 @@ out: } static int -sioclose(dev, flag, mode, p) +sioclose(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct com_s *com; int mynor; @@ -1605,12 +1605,12 @@ siointr1(com) #endif static int -sioioctl(dev, cmd, data, flag, p) +sioioctl(dev, cmd, data, flag, td) dev_t dev; u_long cmd; caddr_t data; int flag; - struct proc *p; + struct thread *td; { struct com_s *com; int error; @@ -1639,7 +1639,7 @@ sioioctl(dev, cmd, data, flag, p) } switch (cmd) { case TIOCSETA: - error = suser(p); + error = suser_td(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -1689,7 +1689,7 @@ sioioctl(dev, cmd, data, flag, p) if (lt->c_ospeed != 0) dt->c_ospeed = tp->t_ospeed; } - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if (error != ENOIOCTL) return (error); s = spltty(); @@ -1738,7 +1738,7 @@ sioioctl(dev, cmd, data, flag, p) break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser(p); + error = suser_td(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c index c675485..fa27d31 100644 --- a/sys/dev/dgb/dgb.c +++ b/sys/dev/dgb/dgb.c @@ -959,11 +959,11 @@ load_fep: /* ARGSUSED */ static int -dgbopen(dev, flag, mode, p) +dgbopen(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct dgb_softc *sc; struct tty *tp; @@ -1049,7 +1049,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser(p)) { + suser_td(td)) { error = EBUSY; goto out; } @@ -1139,11 +1139,11 @@ out: /*ARGSUSED*/ static int -dgbclose(dev, flag, mode, p) +dgbclose(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { int mynor; struct tty *tp; @@ -1499,12 +1499,12 @@ dgbpoll(unit_c) } static int -dgbioctl(dev, cmd, data, flag, p) +dgbioctl(dev, cmd, data, flag, td) dev_t dev; u_long cmd; caddr_t data; int flag; - struct proc *p; + struct thread *td; { struct dgb_softc *sc; int unit, pnum; @@ -1547,7 +1547,7 @@ dgbioctl(dev, cmd, data, flag, p) } switch (cmd) { case TIOCSETA: - error = suser(p); + error = suser_td(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -1622,7 +1622,7 @@ dgbioctl(dev, cmd, data, flag, p) if(cmd==TIOCSETAW || cmd==TIOCSETAF) port->mustdrain=1; - error = linesw[tp->t_line].l_ioctl(tp, cmd, data, flag, p); + error = linesw[tp->t_line].l_ioctl(tp, cmd, data, flag, td); if (error != ENOIOCTL) return error; s = spltty(); @@ -1769,7 +1769,7 @@ dgbioctl(dev, cmd, data, flag, p) break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser(p); + error = suser_td(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/digi/digi.c b/sys/dev/digi/digi.c index 6b29a5a..cab0a17 100644 --- a/sys/dev/digi/digi.c +++ b/sys/dev/digi/digi.c @@ -723,7 +723,7 @@ digi_disc_optim(struct tty *tp, struct termios *t, struct digi_p *port) } int -digiopen(dev_t dev, int flag, int mode, struct proc *p) +digiopen(dev_t dev, int flag, int mode, struct thread *td) { struct digi_softc *sc; struct tty *tp; @@ -801,7 +801,7 @@ open_top: } goto open_top; } - if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { + if (tp->t_state & TS_XCLUDE && td->td_proc->p_ucred->cr_uid != 0) { error = EBUSY; goto out; } @@ -888,7 +888,7 @@ out: } int -digiclose(dev_t dev, int flag, int mode, struct proc *p) +digiclose(dev_t dev, int flag, int mode, struct thread *td) { int mynor; struct tty *tp; @@ -1090,7 +1090,7 @@ digi_loadmoduledata(struct digi_softc *sc) } static int -digiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +digiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int unit, pnum, mynor, error, s; struct digi_softc *sc; @@ -1164,7 +1164,7 @@ digiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) switch (cmd) { case TIOCSETA: - error = suser(p); + error = suser_td(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -1285,7 +1285,7 @@ digiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) if (lt->c_ospeed != 0) dt->c_ospeed = tp->t_ospeed; } - error = linesw[tp->t_line].l_ioctl(tp, cmd, data, flag, p); + error = linesw[tp->t_line].l_ioctl(tp, cmd, data, flag, td); if (error == 0 && cmd == TIOCGETA) ((struct termios *)data)->c_iflag |= port->c_iflag; @@ -1335,7 +1335,7 @@ digiioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) *(int *)data = digimctl(port, 0, DMGET); break; case TIOCMSDTRWAIT: - error = suser(p); + error = suser_td(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 75d9b44..5bfd303 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -439,7 +439,7 @@ fb_detach(dev_t dev, video_adapter_t *adp, struct cdevsw *cdevsw) } static int -fbopen(dev_t dev, int flag, int mode, struct proc *p) +fbopen(dev_t dev, int flag, int mode, struct thread *td) { int unit; @@ -449,11 +449,11 @@ fbopen(dev_t dev, int flag, int mode, struct proc *p) if (vidcdevsw[unit] == NULL) return ENXIO; return (*vidcdevsw[unit]->d_open)(makedev(0, adapter[unit]->va_minor), - flag, mode, p); + flag, mode, td); } static int -fbclose(dev_t dev, int flag, int mode, struct proc *p) +fbclose(dev_t dev, int flag, int mode, struct thread *td) { int unit; @@ -461,7 +461,7 @@ fbclose(dev_t dev, int flag, int mode, struct proc *p) if (vidcdevsw[unit] == NULL) return ENXIO; return (*vidcdevsw[unit]->d_close)(makedev(0, adapter[unit]->va_minor), - flag, mode, p); + flag, mode, td); } static int @@ -489,7 +489,7 @@ fbwrite(dev_t dev, struct uio *uio, int flag) } static int -fbioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) +fbioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) { int unit; @@ -497,7 +497,7 @@ fbioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) if (vidcdevsw[unit] == NULL) return ENXIO; return (*vidcdevsw[unit]->d_ioctl)(makedev(0, adapter[unit]->va_minor), - cmd, arg, flag, p); + cmd, arg, flag, td); } static int @@ -523,7 +523,7 @@ DEV_DRIVER_MODULE(fb, ???, fb_driver, fb_devclass, fb_cdevsw, 0, 0); */ int genfbopen(genfb_softc_t *sc, video_adapter_t *adp, int flag, int mode, - struct proc *p) + struct thread *td) { int s; @@ -535,7 +535,7 @@ int genfbopen(genfb_softc_t *sc, video_adapter_t *adp, int flag, int mode, } int genfbclose(genfb_softc_t *sc, video_adapter_t *adp, int flag, int mode, - struct proc *p) + struct thread *td) { int s; @@ -578,7 +578,7 @@ int genfbwrite(genfb_softc_t *sc, video_adapter_t *adp, struct uio *uio, } int genfbioctl(genfb_softc_t *sc, video_adapter_t *adp, u_long cmd, - caddr_t arg, int flag, struct proc *p) + caddr_t arg, int flag, struct thread *td) { int error; diff --git a/sys/dev/fb/fbreg.h b/sys/dev/fb/fbreg.h index e8a8513..1fcaf13 100644 --- a/sys/dev/fb/fbreg.h +++ b/sys/dev/fb/fbreg.h @@ -184,15 +184,15 @@ typedef struct genfb_softc { } genfb_softc_t; int genfbopen(genfb_softc_t *sc, video_adapter_t *adp, - int flag, int mode, struct proc *p); + int flag, int mode, struct thread *td); int genfbclose(genfb_softc_t *sc, video_adapter_t *adp, - int flag, int mode, struct proc *p); + int flag, int mode, struct thread *td); int genfbread(genfb_softc_t *sc, video_adapter_t *adp, struct uio *uio, int flag); int genfbwrite(genfb_softc_t *sc, video_adapter_t *adp, struct uio *uio, int flag); int genfbioctl(genfb_softc_t *sc, video_adapter_t *adp, - u_long cmd, caddr_t arg, int flag, struct proc *p); + u_long cmd, caddr_t arg, int flag, struct thread *td); int genfbmmap(genfb_softc_t *sc, video_adapter_t *adp, vm_offset_t offset, int prot); diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c index 838228b..19d6f1f 100644 --- a/sys/dev/fb/vga.c +++ b/sys/dev/fb/vga.c @@ -96,20 +96,20 @@ vga_attach_unit(int unit, vga_softc_t *sc, int flags) #ifdef FB_INSTALL_CDEV int -vga_open(dev_t dev, vga_softc_t *sc, int flag, int mode, struct proc *p) +vga_open(dev_t dev, vga_softc_t *sc, int flag, int mode, struct thread *td) { if (sc == NULL) return ENXIO; if (mode & (O_CREAT | O_APPEND | O_TRUNC)) return ENODEV; - return genfbopen(&sc->gensc, sc->adp, flag, mode, p); + return genfbopen(&sc->gensc, sc->adp, flag, mode, td); } int -vga_close(dev_t dev, vga_softc_t *sc, int flag, int mode, struct proc *p) +vga_close(dev_t dev, vga_softc_t *sc, int flag, int mode, struct thread *td) { - return genfbclose(&sc->gensc, sc->adp, flag, mode, p); + return genfbclose(&sc->gensc, sc->adp, flag, mode, td); } int @@ -126,9 +126,9 @@ vga_write(dev_t dev, vga_softc_t *sc, struct uio *uio, int flag) int vga_ioctl(dev_t dev, vga_softc_t *sc, u_long cmd, caddr_t arg, int flag, - struct proc *p) + struct thread *td) { - return genfbioctl(&sc->gensc, sc->adp, cmd, arg, flag, p); + return genfbioctl(&sc->gensc, sc->adp, cmd, arg, flag, td); } int diff --git a/sys/dev/fb/vgareg.h b/sys/dev/fb/vgareg.h index d50e5f2..f59c7ee 100644 --- a/sys/dev/fb/vgareg.h +++ b/sys/dev/fb/vgareg.h @@ -79,13 +79,13 @@ int vga_attach_unit(int unit, vga_softc_t *sc, int flags); #ifdef FB_INSTALL_CDEV int vga_open(dev_t dev, vga_softc_t *sc, int flag, int mode, - struct proc *p); + struct thread *td); int vga_close(dev_t dev, vga_softc_t *sc, int flag, int mode, - struct proc *p); + struct thread *td); int vga_read(dev_t dev, vga_softc_t *sc, struct uio *uio, int flag); int vga_write(dev_t dev, vga_softc_t *sc, struct uio *uio, int flag); int vga_ioctl(dev_t dev, vga_softc_t *sc, u_long cmd, caddr_t arg, - int flag, struct proc *p); + int flag, struct thread *td); int vga_mmap(dev_t dev, vga_softc_t *sc, vm_offset_t offset, int prot); #endif diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index f896b33..845f520 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -1519,7 +1519,7 @@ out_fdc(struct fdc_data *fdc, int x) * auxiliary functions). */ int -Fdopen(dev_t dev, int flags, int mode, struct proc *p) +Fdopen(dev_t dev, int flags, int mode, struct thread *td) { fdu_t fdu = FDUNIT(minor(dev)); int type = FDTYPE(minor(dev)); @@ -1614,7 +1614,7 @@ Fdopen(dev_t dev, int flags, int mode, struct proc *p) } int -fdclose(dev_t dev, int flags, int mode, struct proc *p) +fdclose(dev_t dev, int flags, int mode, struct thread *td) { fdu_t fdu = FDUNIT(minor(dev)); struct fd_data *fd; @@ -2473,7 +2473,7 @@ fdmisccmd(dev_t dev, u_int cmd, void *data) } static int -fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { fdu_t fdu; fd_p fd; @@ -2545,7 +2545,7 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) case FD_STYPE: /* set drive type */ /* this is considered harmful; only allow for superuser */ - if (suser(p) != 0) + if (suser_td(td) != 0) return (EPERM); *fd->ft = *(struct fd_type *)addr; break; @@ -2569,7 +2569,7 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) #endif case FD_CLRERR: - if (suser(p) != 0) + if (suser_td(td) != 0) return (EPERM); fd->fdc->fdc_errs = 0; break; diff --git a/sys/dev/ida/ida_disk.c b/sys/dev/ida/ida_disk.c index 5358e5d..a545cf2 100644 --- a/sys/dev/ida/ida_disk.c +++ b/sys/dev/ida/ida_disk.c @@ -110,7 +110,7 @@ idad_getsoftc(dev_t dev) } static int -idad_open(dev_t dev, int flags, int fmt, struct proc *p) +idad_open(dev_t dev, int flags, int fmt, struct thread *td) { struct idad_softc *drv; struct disklabel *label; @@ -133,7 +133,7 @@ idad_open(dev_t dev, int flags, int fmt, struct proc *p) } static int -idad_close(dev_t dev, int flags, int fmt, struct proc *p) +idad_close(dev_t dev, int flags, int fmt, struct thread *td) { struct idad_softc *drv; diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c index 1f07f25..42c3ee0 100644 --- a/sys/dev/iicbus/iic.c +++ b/sys/dev/iicbus/iic.c @@ -133,7 +133,7 @@ iic_attach(device_t dev) } static int -iicopen (dev_t dev, int flags, int fmt, struct proc *p) +iicopen (dev_t dev, int flags, int fmt, struct thread *td) { struct iic_softc *sc = IIC_SOFTC(minor(dev)); @@ -149,7 +149,7 @@ iicopen (dev_t dev, int flags, int fmt, struct proc *p) } static int -iicclose(dev_t dev, int flags, int fmt, struct proc *p) +iicclose(dev_t dev, int flags, int fmt, struct thread *td) { struct iic_softc *sc = IIC_SOFTC(minor(dev)); @@ -227,7 +227,7 @@ iicread(dev_t dev, struct uio * uio, int ioflag) } static int -iicioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) +iicioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { device_t iicdev = IIC_DEVICE(minor(dev)); struct iic_softc *sc = IIC_SOFTC(minor(dev)); diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index 4a92a01..32e0151 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -233,7 +233,7 @@ isp_attach(struct ispsoftc *isp) } static int -ispioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) +ispioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { struct ispsoftc *isp; int retval = ENOTTY; diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c index beda4de..0f3f11d 100644 --- a/sys/dev/joy/joy.c +++ b/sys/dev/joy/joy.c @@ -159,7 +159,7 @@ DRIVER_MODULE(joy, isa, joy_isa_driver, joy_devclass, 0, 0); DRIVER_MODULE(joy, acpi, joy_isa_driver, joy_devclass, 0, 0); static int -joyopen(dev_t dev, int flags, int fmt, struct proc *p) +joyopen(dev_t dev, int flags, int fmt, struct thread *td) { int i = joypart (dev); struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); @@ -172,7 +172,7 @@ joyopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -joyclose(dev_t dev, int flags, int fmt, struct proc *p) +joyclose(dev_t dev, int flags, int fmt, struct thread *td) { int i = joypart (dev); struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); @@ -240,7 +240,7 @@ joyread(dev_t dev, struct uio *uio, int flag) } static int -joyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +joyioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); int i = joypart (dev); diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index e53015b..1a1c132 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -491,7 +491,7 @@ kbd_detach(keyboard_t *kbd) static kbd_callback_func_t genkbd_event; static int -genkbdopen(dev_t dev, int mode, int flag, struct proc *p) +genkbdopen(dev_t dev, int mode, int flag, struct thread *td) { keyboard_t *kbd; genkbd_softc_t *sc; @@ -531,7 +531,7 @@ genkbdopen(dev_t dev, int mode, int flag, struct proc *p) } static int -genkbdclose(dev_t dev, int mode, int flag, struct proc *p) +genkbdclose(dev_t dev, int mode, int flag, struct thread *td) { keyboard_t *kbd; genkbd_softc_t *sc; @@ -621,7 +621,7 @@ genkbdwrite(dev_t dev, struct uio *uio, int flag) } static int -genkbdioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) +genkbdioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) { keyboard_t *kbd; int error; @@ -636,7 +636,7 @@ genkbdioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) } static int -genkbdpoll(dev_t dev, int events, struct proc *p) +genkbdpoll(dev_t dev, int events, struct thread *td) { keyboard_t *kbd; genkbd_softc_t *sc; @@ -653,7 +653,7 @@ genkbdpoll(dev_t dev, int events, struct proc *p) if (sc->gkb_q.c_cc > 0) revents = events & (POLLIN | POLLRDNORM); else - selrecord(p, &sc->gkb_rsel); + selrecord(td, &sc->gkb_rsel); } splx(s); return revents; diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index 6f8c0f7..f295a43 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -270,7 +270,7 @@ int mcd_attach(struct isa_device *dev) return 1; } -int mcdopen(dev_t dev, int flags, int fmt, struct proc *p) +int mcdopen(dev_t dev, int flags, int fmt, struct thread *td) { int unit,part,phys,r,retry; struct mcd_data *cd; @@ -362,7 +362,7 @@ MCD_TRACE("open: partition=%d, disksize = %ld, blksize=%d\n", return ENXIO; } -int mcdclose(dev_t dev, int flags, int fmt, struct proc *p) +int mcdclose(dev_t dev, int flags, int fmt, struct thread *td) { int unit,part; struct mcd_data *cd; @@ -504,7 +504,7 @@ static void mcd_start(int unit) return; } -int mcdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) +int mcdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { struct mcd_data *cd; int unit,part,retry,r; diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 3f16777..9666ef3 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -180,14 +180,14 @@ struct md_s { }; static int -mdopen(dev_t dev, int flag, int fmt, struct proc *p) +mdopen(dev_t dev, int flag, int fmt, struct thread *td) { struct md_s *sc; struct disklabel *dl; if (md_debug) printf("mdopen(%s %x %x %p)\n", - devtoname(dev), flag, fmt, p); + devtoname(dev), flag, fmt, td->td_proc); sc = dev->si_drv1; @@ -204,7 +204,7 @@ mdopen(dev_t dev, int flag, int fmt, struct proc *p) } static int -mdclose(dev_t dev, int flags, int fmt, struct proc *p) +mdclose(dev_t dev, int flags, int fmt, struct thread *td) { struct md_s *sc = dev->si_drv1; @@ -213,12 +213,12 @@ mdclose(dev_t dev, int flags, int fmt, struct proc *p) } static int -mdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) +mdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { if (md_debug) printf("mdioctl(%s %lx %p %x %p)\n", - devtoname(dev), cmd, addr, flags, p); + devtoname(dev), cmd, addr, flags, td); return (ENOIOCTL); } @@ -385,19 +385,19 @@ mdstart_vnode(struct md_s *sc) else auio.uio_rw = UIO_WRITE; auio.uio_resid = bp->bio_bcount; - auio.uio_procp = curproc; + auio.uio_td = curthread; if (VOP_ISLOCKED(sc->vnode, NULL)) vprint("unexpected md driver lock", sc->vnode); if (bp->bio_cmd == BIO_READ) { - vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY, curproc); + vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY, curthread); error = VOP_READ(sc->vnode, &auio, 0, sc->cred); } else { (void) vn_start_write(sc->vnode, &mp, V_WAIT); - vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY, curproc); + vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY, curthread); error = VOP_WRITE(sc->vnode, &auio, 0, sc->cred); vn_finished_write(mp); } - VOP_UNLOCK(sc->vnode, 0, curproc); + VOP_UNLOCK(sc->vnode, 0, curthread); bp->bio_resid = auio.uio_resid; biofinish(bp, &sc->stats, error); } @@ -633,17 +633,18 @@ mdsetcred(struct md_s *sc, struct ucred *cred) auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_SYSSPACE; auio.uio_resid = aiov.iov_len; - vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY, curproc); + vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY, curthread); error = VOP_READ(sc->vnode, &auio, 0, sc->cred); - VOP_UNLOCK(sc->vnode, 0, curproc); + VOP_UNLOCK(sc->vnode, 0, curthread); free(tmpbuf, M_TEMP); } return (error); } static int -mdcreate_vnode(struct md_ioctl *mdio, struct proc *p) +mdcreate_vnode(struct md_ioctl *mdio, struct thread *td) { + struct proc *p = td->td_proc; struct md_s *sc; struct vattr vattr; struct nameidata nd; @@ -662,26 +663,26 @@ mdcreate_vnode(struct md_ioctl *mdio, struct proc *p) sc->flags = mdio->md_options & MD_FORCE; flags = FREAD|FWRITE; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, mdio->md_file, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, mdio->md_file, td); error = vn_open(&nd, &flags, 0); if (error) { if (error != EACCES && error != EPERM && error != EROFS) return (error); flags &= ~FWRITE; sc->flags |= MD_READONLY; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, mdio->md_file, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, mdio->md_file, td); error = vn_open(&nd, &flags, 0); if (error) return (error); } NDFREE(&nd, NDF_ONLY_PNBUF); if (nd.ni_vp->v_type != VREG || - (error = VOP_GETATTR(nd.ni_vp, &vattr, p->p_ucred, p))) { - VOP_UNLOCK(nd.ni_vp, 0, p); - (void) vn_close(nd.ni_vp, flags, p->p_ucred, p); + (error = VOP_GETATTR(nd.ni_vp, &vattr, p->p_ucred, td))) { + VOP_UNLOCK(nd.ni_vp, 0, td); + (void) vn_close(nd.ni_vp, flags, p->p_ucred, td); return (error ? error : EINVAL); } - VOP_UNLOCK(nd.ni_vp, 0, p); + VOP_UNLOCK(nd.ni_vp, 0, td); sc->secsize = DEV_BSIZE; sc->vnode = nd.ni_vp; @@ -693,12 +694,12 @@ mdcreate_vnode(struct md_ioctl *mdio, struct proc *p) else sc->nsect = vattr.va_size / sc->secsize; /* XXX: round up ? */ if (sc->nsect == 0) { - (void) vn_close(nd.ni_vp, flags, p->p_ucred, p); + (void) vn_close(nd.ni_vp, flags, p->p_ucred, td); return (EINVAL); } error = mdsetcred(sc, p->p_ucred); if (error) { - (void) vn_close(nd.ni_vp, flags, p->p_ucred, p); + (void) vn_close(nd.ni_vp, flags, p->p_ucred, td); return (error); } mdinit(sc); @@ -706,7 +707,7 @@ mdcreate_vnode(struct md_ioctl *mdio, struct proc *p) } static int -mddestroy(struct md_s *sc, struct proc *p) +mddestroy(struct md_s *sc, struct thread *td) { unsigned u; @@ -718,7 +719,7 @@ mddestroy(struct md_s *sc, struct proc *p) } if (sc->vnode != NULL) (void)vn_close(sc->vnode, sc->flags & MD_READONLY ? - FREAD : (FREAD|FWRITE), sc->cred, p); + FREAD : (FREAD|FWRITE), sc->cred, td); if (sc->cred != NULL) crfree(sc->cred); if (sc->object != NULL) { @@ -739,7 +740,7 @@ mddestroy(struct md_s *sc, struct proc *p) } static int -mdcreate_swap(struct md_ioctl *mdio, struct proc *p) +mdcreate_swap(struct md_ioctl *mdio, struct thread *td) { int error; struct md_s *sc; @@ -763,7 +764,7 @@ mdcreate_swap(struct md_ioctl *mdio, struct proc *p) */ if (mdio->md_size == 0) { - mddestroy(sc, p); + mddestroy(sc, td); return (EDOM); } @@ -784,20 +785,20 @@ mdcreate_swap(struct md_ioctl *mdio, struct proc *p) if (swap_pager_reserve(sc->object, 0, sc->nsect) < 0) { vm_pager_deallocate(sc->object); sc->object = NULL; - mddestroy(sc, p); + mddestroy(sc, td); return (EDOM); } } - error = mdsetcred(sc, p->p_ucred); + error = mdsetcred(sc, td->td_proc->p_ucred); if (error) - mddestroy(sc, p); + mddestroy(sc, td); else mdinit(sc); return (error); } static int -mddetach(int unit, struct proc *p) +mddetach(int unit, struct thread *td) { struct md_s *sc; @@ -811,21 +812,21 @@ mddetach(int unit, struct proc *p) case MD_SWAP: case MD_MALLOC: case MD_PRELOAD: - return (mddestroy(sc, p)); + return (mddestroy(sc, td)); default: return (EOPNOTSUPP); } } static int -mdctlioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) +mdctlioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { struct md_ioctl *mdio; struct md_s *sc; if (md_debug) printf("mdctlioctl(%s %lx %p %x %p)\n", - devtoname(dev), cmd, addr, flags, p); + devtoname(dev), cmd, addr, flags, td); mdio = (struct md_ioctl *)addr; switch (cmd) { @@ -836,9 +837,9 @@ mdctlioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) case MD_PRELOAD: return (mdcreate_preload(mdio)); case MD_VNODE: - return (mdcreate_vnode(mdio, p)); + return (mdcreate_vnode(mdio, td)); case MD_SWAP: - return (mdcreate_swap(mdio, p)); + return (mdcreate_swap(mdio, td)); default: return (EINVAL); } @@ -846,7 +847,7 @@ mdctlioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) if (mdio->md_file != NULL || mdio->md_size != 0 || mdio->md_options != 0) return (EINVAL); - return (mddetach(mdio->md_unit, p)); + return (mddetach(mdio->md_unit, td)); case MDIOCQUERY: sc = mdfind(mdio->md_unit); if (sc == NULL) @@ -941,7 +942,7 @@ md_modevent(module_t mod, int type, void *data) break; case MOD_UNLOAD: LIST_FOREACH(sc, &md_softc_list, list) { - error = mddetach(sc->unit, curproc); + error = mddetach(sc->unit, curthread); if (error != 0) return (error); } diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index b6ff7ea..c5c2392 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -714,7 +714,7 @@ mlx_submit_buf(struct mlx_softc *sc, mlx_bio *bp) * Accept an open operation on the control device. */ int -mlx_open(dev_t dev, int flags, int fmt, struct proc *p) +mlx_open(dev_t dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit); @@ -727,7 +727,7 @@ mlx_open(dev_t dev, int flags, int fmt, struct proc *p) * Accept the last close on the control device. */ int -mlx_close(dev_t dev, int flags, int fmt, struct proc *p) +mlx_close(dev_t dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit); @@ -740,7 +740,7 @@ mlx_close(dev_t dev, int flags, int fmt, struct proc *p) * Handle controller-specific control operations. */ int -mlx_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) +mlx_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) { int unit = minor(dev); struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit); @@ -927,7 +927,7 @@ mlx_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) */ int mlx_submit_ioctl(struct mlx_softc *sc, struct mlx_sysdrive *drive, u_long cmd, - caddr_t addr, int32_t flag, struct proc *p) + caddr_t addr, int32_t flag, struct thread *td) { int *arg = (int *)addr; int error, result; diff --git a/sys/dev/mlx/mlx_disk.c b/sys/dev/mlx/mlx_disk.c index 40c7263..49005b1 100644 --- a/sys/dev/mlx/mlx_disk.c +++ b/sys/dev/mlx/mlx_disk.c @@ -95,7 +95,7 @@ static driver_t mlxd_driver = { DRIVER_MODULE(mlxd, mlx, mlxd_driver, mlxd_devclass, 0, 0); static int -mlxd_open(dev_t dev, int flags, int fmt, struct proc *p) +mlxd_open(dev_t dev, int flags, int fmt, struct thread *td) { struct mlxd_softc *sc = (struct mlxd_softc *)dev->si_drv1; struct disklabel *label; @@ -124,7 +124,7 @@ mlxd_open(dev_t dev, int flags, int fmt, struct proc *p) } static int -mlxd_close(dev_t dev, int flags, int fmt, struct proc *p) +mlxd_close(dev_t dev, int flags, int fmt, struct thread *td) { struct mlxd_softc *sc = (struct mlxd_softc *)dev->si_drv1; @@ -137,7 +137,7 @@ mlxd_close(dev_t dev, int flags, int fmt, struct proc *p) } static int -mlxd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) +mlxd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) { struct mlxd_softc *sc = (struct mlxd_softc *)dev->si_drv1; int error; @@ -147,7 +147,7 @@ mlxd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) if (sc == NULL) return (ENXIO); - if ((error = mlx_submit_ioctl(sc->mlxd_controller, sc->mlxd_drive, cmd, addr, flag, p)) != ENOIOCTL) { + if ((error = mlx_submit_ioctl(sc->mlxd_controller, sc->mlxd_drive, cmd, addr, flag, td)) != ENOIOCTL) { debug(0, "mlx_submit_ioctl returned %d\n", error); return(error); } diff --git a/sys/dev/mlx/mlxvar.h b/sys/dev/mlx/mlxvar.h index a4de085..58c7a4b 100644 --- a/sys/dev/mlx/mlxvar.h +++ b/sys/dev/mlx/mlxvar.h @@ -240,8 +240,9 @@ struct mlxd_softc * Interface between driver core and disk driver (should be using a bus?) */ extern int mlx_submit_buf(struct mlx_softc *sc, mlx_bio *bp); -extern int mlx_submit_ioctl(struct mlx_softc *sc, struct mlx_sysdrive *drive, u_long cmd, - caddr_t addr, int32_t flag, struct proc *p); +extern int mlx_submit_ioctl(struct mlx_softc *sc, + struct mlx_sysdrive *drive, u_long cmd, + caddr_t addr, int32_t flag, struct thread *td); extern void mlxd_intr(void *data); diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c index 78e41e3..9063cce 100644 --- a/sys/dev/mly/mly.c +++ b/sys/dev/mly/mly.c @@ -2790,7 +2790,7 @@ mly_print_controller(int controller) * Accept an open operation on the control device. */ static int -mly_user_open(dev_t dev, int flags, int fmt, struct proc *p) +mly_user_open(dev_t dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct mly_softc *sc = devclass_get_softc(devclass_find("mly"), unit); @@ -2803,7 +2803,7 @@ mly_user_open(dev_t dev, int flags, int fmt, struct proc *p) * Accept the last close on the control device. */ static int -mly_user_close(dev_t dev, int flags, int fmt, struct proc *p) +mly_user_close(dev_t dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct mly_softc *sc = devclass_get_softc(devclass_find("mly"), unit); @@ -2816,7 +2816,8 @@ mly_user_close(dev_t dev, int flags, int fmt, struct proc *p) * Handle controller-specific control operations. */ static int -mly_user_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) +mly_user_ioctl(dev_t dev, u_long cmd, caddr_t addr, + int32_t flag, struct thread *td) { struct mly_softc *sc = (struct mly_softc *)dev->si_drv1; struct mly_user_command *uc = (struct mly_user_command *)addr; diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index 073ea7a..915bc3f 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -394,11 +394,11 @@ mse_detach(dev) * Exclusive open the mouse, initialize it and enable interrupts. */ static int -mseopen(dev, flags, fmt, p) +mseopen(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { mse_softc_t *sc; int s; @@ -434,11 +434,11 @@ mseopen(dev, flags, fmt, p) * mseclose: just turn off mouse innterrupts. */ static int -mseclose(dev, flags, fmt, p) +mseclose(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); int s; @@ -525,12 +525,12 @@ mseread(dev, uio, ioflag) * mseioctl: process ioctl commands. */ static int -mseioctl(dev, cmd, addr, flag, p) +mseioctl(dev, cmd, addr, flag, td) dev_t dev; u_long cmd; caddr_t addr; int flag; - struct proc *p; + struct thread *td; { mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); mousestatus_t status; @@ -642,10 +642,10 @@ mseioctl(dev, cmd, addr, flag, p) * msepoll: check for mouse input to be processed. */ static int -msepoll(dev, events, p) +msepoll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { mse_softc_t *sc = devclass_get_softc(mse_devclass, MSE_UNIT(dev)); int s; @@ -662,7 +662,7 @@ msepoll(dev, events, p) * Since this is an exclusive open device, any previous * proc pointer is trash now, so we can just assign it. */ - selrecord(p, &sc->sc_selp); + selrecord(td, &sc->sc_selp); } } splx(s); diff --git a/sys/dev/nmdm/nmdm.c b/sys/dev/nmdm/nmdm.c index c705e06..743a9dd 100644 --- a/sys/dev/nmdm/nmdm.c +++ b/sys/dev/nmdm/nmdm.c @@ -152,10 +152,10 @@ nmdminit(n) /*ARGSUSED*/ static int -nmdmopen(dev, flag, devtype, p) +nmdmopen(dev, flag, devtype, td) dev_t dev; int flag, devtype; - struct proc *p; + struct thread *td; { register struct tty *tp, *tp2; int error; @@ -203,9 +203,9 @@ nmdmopen(dev, flag, devtype, p) tp->t_lflag = TTYDEF_LFLAG; tp->t_cflag = TTYDEF_CFLAG; tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; - } else if (tp->t_state & TS_XCLUDE && suser(p)) { + } else if (tp->t_state & TS_XCLUDE && suser_td(td)) { return (EBUSY); - } else if (pti->pt_prison != p->p_ucred->cr_prison) { + } else if (pti->pt_prison != td->td_proc->p_ucred->cr_prison) { return (EBUSY); } @@ -255,10 +255,10 @@ nmdmopen(dev, flag, devtype, p) } static int -nmdmclose(dev, flag, mode, p) +nmdmclose(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { register struct tty *tp, *tp2; int err; @@ -485,12 +485,12 @@ nmdmstop(tp, flush) /*ARGSUSED*/ static int -nmdmioctl(dev, cmd, data, flag, p) +nmdmioctl(dev, cmd, data, flag, td) dev_t dev; u_long cmd; caddr_t data; int flag; - struct proc *p; + struct thread *td; { register struct tty *tp = dev->si_tty; struct nm_softc *pti = dev->si_drv1; @@ -502,7 +502,7 @@ nmdmioctl(dev, cmd, data, flag, p) GETPARTS(tp, ourpart, otherpart); tp2 = &otherpart->nm_tty; - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if (error == ENOIOCTL) error = ttioctl(tp, cmd, data, flag); if (error == ENOIOCTL) { diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c index ff5bd3f..282a442 100644 --- a/sys/dev/ofw/ofw_console.c +++ b/sys/dev/ofw/ofw_console.c @@ -86,7 +86,7 @@ static int stdin; static int stdout; static int -ofw_dev_open(dev_t dev, int flag, int mode, struct proc *p) +ofw_dev_open(dev_t dev, int flag, int mode, struct thread *td) { struct tty *tp; int unit; @@ -114,7 +114,7 @@ ofw_dev_open(dev_t dev, int flag, int mode, struct proc *p) ttsetwater(tp); setuptimeout = 1; - } else if ((tp->t_state & TS_XCLUDE) && suser(p)) { + } else if ((tp->t_state & TS_XCLUDE) && suser_td(td)) { return (EBUSY); } @@ -133,7 +133,7 @@ ofw_dev_open(dev_t dev, int flag, int mode, struct proc *p) } static int -ofw_dev_close(dev_t dev, int flag, int mode, struct proc *p) +ofw_dev_close(dev_t dev, int flag, int mode, struct thread *td) { int unit; struct tty *tp; @@ -152,7 +152,7 @@ ofw_dev_close(dev_t dev, int flag, int mode, struct proc *p) } static int -ofw_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +ofw_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int unit; struct tty *tp; @@ -165,7 +165,7 @@ ofw_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return (ENXIO); } - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if (error != ENOIOCTL) { return (error); } diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index d8debc3..6968241 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -60,11 +60,11 @@ * This is the user interface to PCI configuration space. */ -static int pci_open(dev_t dev, int oflags, int devtype, struct proc *p); -static int pci_close(dev_t dev, int flag, int devtype, struct proc *p); +static d_open_t pci_open; +static d_close_t pci_close; static int pci_conf_match(struct pci_match_conf *matches, int num_matches, struct pci_conf *match_buf); -static int pci_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p); +static d_ioctl_t pci_ioctl; #define PCI_CDEV 78 @@ -85,7 +85,7 @@ struct cdevsw pcicdev = { }; static int -pci_open(dev_t dev, int oflags, int devtype, struct proc *p) +pci_open(dev_t dev, int oflags, int devtype, struct thread *td) { if ((oflags & FWRITE) && securelevel > 0) { return EPERM; @@ -94,7 +94,7 @@ pci_open(dev_t dev, int oflags, int devtype, struct proc *p) } static int -pci_close(dev_t dev, int flag, int devtype, struct proc *p) +pci_close(dev_t dev, int flag, int devtype, struct thread *td) { return 0; } @@ -167,7 +167,7 @@ pci_conf_match(struct pci_match_conf *matches, int num_matches, } static int -pci_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +pci_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { device_t pci, pcib; struct pci_io *io; diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index 20fc816..ef0fe1e 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -455,7 +455,7 @@ lptout(void *arg) */ static int -lptopen(dev_t dev, int flags, int fmt, struct proc *p) +lptopen(dev_t dev, int flags, int fmt, struct thread *td) { int s; int trys, err; @@ -575,7 +575,7 @@ lptopen(dev_t dev, int flags, int fmt, struct proc *p) */ static int -lptclose(dev_t dev, int flags, int fmt, struct proc *p) +lptclose(dev_t dev, int flags, int fmt, struct thread *td) { u_int unit = LPTUNIT(minor(dev)); struct lpt_data *sc = UNITOSOFTC(unit); @@ -897,7 +897,7 @@ lptintr(device_t dev) } static int -lptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) +lptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { int error = 0; u_int unit = LPTUNIT(minor(dev)); diff --git a/sys/dev/ppbus/pcfclock.c b/sys/dev/ppbus/pcfclock.c index c0e6275..d7af2ae 100644 --- a/sys/dev/ppbus/pcfclock.c +++ b/sys/dev/ppbus/pcfclock.c @@ -153,7 +153,7 @@ pcfclock_attach(device_t dev) } static int -pcfclock_open(dev_t dev, int flag, int fms, struct proc *p) +pcfclock_open(dev_t dev, int flag, int fms, struct thread *td) { u_int unit = minor(dev); struct pcfclock_data *sc = UNITOSOFTC(unit); @@ -174,7 +174,7 @@ pcfclock_open(dev_t dev, int flag, int fms, struct proc *p) } static int -pcfclock_close(dev_t dev, int flags, int fmt, struct proc *p) +pcfclock_close(dev_t dev, int flags, int fmt, struct thread *td) { u_int unit = minor(dev); struct pcfclock_data *sc = UNITOSOFTC(unit); diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c index 5e851f0..d4e4968 100644 --- a/sys/dev/ppbus/ppi.c +++ b/sys/dev/ppbus/ppi.c @@ -255,7 +255,7 @@ ppiintr(void *arg) #endif /* PERIPH_1284 */ static int -ppiopen(dev_t dev, int flags, int fmt, struct proc *p) +ppiopen(dev_t dev, int flags, int fmt, struct thread *td) { u_int unit = minor(dev); struct ppi_data *ppi = UNITOSOFTC(unit); @@ -288,7 +288,7 @@ ppiopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -ppiclose(dev_t dev, int flags, int fmt, struct proc *p) +ppiclose(dev_t dev, int flags, int fmt, struct thread *td) { u_int unit = minor(dev); struct ppi_data *ppi = UNITOSOFTC(unit); @@ -501,7 +501,7 @@ error: } static int -ppiioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) +ppiioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { u_int unit = minor(dev); device_t ppidev = UNITODEVICE(unit); diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c index c79d965..3b69097 100644 --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -125,7 +125,7 @@ ppsattach(device_t dev) } static int -ppsopen(dev_t dev, int flags, int fmt, struct proc *p) +ppsopen(dev_t dev, int flags, int fmt, struct thread *td) { u_int unit = minor(dev); struct pps_data *sc = UNITOSOFTC(unit); @@ -154,7 +154,7 @@ ppsopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -ppsclose(dev_t dev, int flags, int fmt, struct proc *p) +ppsclose(dev_t dev, int flags, int fmt, struct thread *td) { u_int unit = minor(dev); struct pps_data *sc = UNITOSOFTC(unit); @@ -193,7 +193,7 @@ ppsintr(void *arg) } static int -ppsioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) +ppsioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { u_int unit = minor(dev); struct pps_data *sc = UNITOSOFTC(unit); diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index a99fe6d..868d72f 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -39,6 +39,7 @@ #include <sys/module.h> #include <sys/mutex.h> #include <sys/poll.h> +#include <sys/proc.h> #include <sys/queue.h> #include <sys/random.h> #include <sys/selinfo.h> @@ -138,18 +139,18 @@ SYSCTL_PROC(_kern_random_sys_harvest, OID_AUTO, interrupt, random_check_boolean, "I", "Harvest IRQ entropy"); static int -random_open(dev_t dev, int flags, int fmt, struct proc *p) +random_open(dev_t dev, int flags, int fmt, struct thread *td) { - if ((flags & FWRITE) && (securelevel > 0 || suser(p))) + if ((flags & FWRITE) && (securelevel > 0 || suser(td->td_proc))) return EPERM; else return 0; } static int -random_close(dev_t dev, int flags, int fmt, struct proc *p) +random_close(dev_t dev, int flags, int fmt, struct thread *td) { - if ((flags & FWRITE) && !(securelevel > 0 || suser(p))) + if ((flags & FWRITE) && !(securelevel > 0 || suser(td->td_proc))) random_reseed(); return 0; } @@ -201,7 +202,7 @@ random_write(dev_t dev, struct uio *uio, int flag) } static int -random_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) +random_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { switch (cmd) { /* Really handled in upper layer */ @@ -214,7 +215,7 @@ random_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) } static int -random_poll(dev_t dev, int events, struct proc *p) +random_poll(dev_t dev, int events, struct thread *td) { int revents; @@ -223,7 +224,7 @@ random_poll(dev_t dev, int events, struct proc *p) if (random_systat.seeded) revents = events & (POLLIN | POLLRDNORM); else - selrecord(p, &random_systat.rsel); + selrecord(curthread, &random_systat.rsel); } return revents; } diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index e4252e0..59e8dff 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -715,10 +715,10 @@ rc_stop(tp, rw) } static int -rcopen(dev, flag, mode, p) +rcopen(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { register struct rc_chans *rc; register struct tty *tp; @@ -764,7 +764,7 @@ again: } } if (tp->t_state & TS_XCLUDE && - suser(p)) { + suser_td(td)) { error = EBUSY; goto out; } @@ -810,10 +810,10 @@ out: } static int -rcclose(dev, flag, mode, p) +rcclose(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { register struct rc_chans *rc; register struct tty *tp; @@ -1064,18 +1064,18 @@ struct rc_softc *rcb; } static int -rcioctl(dev, cmd, data, flag, p) +rcioctl(dev, cmd, data, flag, td) dev_t dev; u_long cmd; int flag; caddr_t data; -struct proc *p; +struct thread *td; { register struct rc_chans *rc = &rc_chans[GET_UNIT(dev)]; register int s, error; struct tty *tp = rc->rc_tp; - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if (error != ENOIOCTL) return (error); error = ttioctl(tp, cmd, data, flag); @@ -1118,7 +1118,7 @@ struct proc *p; break; case TIOCMSDTRWAIT: - error = suser(p); + error = suser_td(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c index f9391f3..9c49f20 100644 --- a/sys/dev/rp/rp.c +++ b/sys/dev/rp/rp.c @@ -954,10 +954,10 @@ rp_releaseresource(CONTROLLER_t *ctlp) } int -rpopen(dev, flag, mode, p) +rpopen(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { struct rp_port *rp; int unit, port, mynor, umynor, flags; /* SG */ @@ -1008,7 +1008,7 @@ open_top: goto open_top; } } - if(tp->t_state & TS_XCLUDE && suser(p) != 0) { + if(tp->t_state & TS_XCLUDE && suser_td(td) != 0) { splx(oldspl); error = EBUSY; goto out2; @@ -1113,10 +1113,10 @@ out2: } int -rpclose(dev, flag, mode, p) +rpclose(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { int oldspl, unit, mynor, umynor, port; /* SG */ struct rp_port *rp; @@ -1228,12 +1228,12 @@ rpdtrwakeup(void *chan) } int -rpioctl(dev, cmd, data, flag, p) +rpioctl(dev, cmd, data, flag, td) dev_t dev; u_long cmd; caddr_t data; int flag; - struct proc *p; + struct thread *td; { struct rp_port *rp; CHANNEL_t *cp; @@ -1265,7 +1265,7 @@ rpioctl(dev, cmd, data, flag, p) } switch (cmd) { case TIOCSETA: - error = suser(p); + error = suser_td(td); if(error != 0) return(error); *ct = *(struct termios *)data; @@ -1322,7 +1322,7 @@ rpioctl(dev, cmd, data, flag, p) t = &tp->t_termios; - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if(error != ENOIOCTL) { return(error); } @@ -1410,7 +1410,7 @@ rpioctl(dev, cmd, data, flag, p) *(int *)data = result; break; case TIOCMSDTRWAIT: - error = suser(p); + error = suser_td(td); if(error != 0) { splx(oldspl); return(error); diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c index 1ab5afa..4561d90 100644 --- a/sys/dev/scd/scd.c +++ b/sys/dev/scd/scd.c @@ -232,7 +232,7 @@ scd_attach(struct isa_device *dev) } static int -scdopen(dev_t dev, int flags, int fmt, struct proc *p) +scdopen(dev_t dev, int flags, int fmt, struct thread *td) { int unit,part,phys; int rc; @@ -286,7 +286,7 @@ scdopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -scdclose(dev_t dev, int flags, int fmt, struct proc *p) +scdclose(dev_t dev, int flags, int fmt, struct thread *td) { int unit,part,phys; struct scd_data *cd; @@ -418,7 +418,7 @@ scd_start(int unit) } static int -scdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) +scdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { struct scd_data *cd; int unit,part; diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index 0f42692..dc1858f 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -93,7 +93,7 @@ enum si_mctl { GET, SET, BIS, BIC }; static void si_command(struct si_port *, int, int); static int si_modem(struct si_port *, enum si_mctl, int); static void si_write_enable(struct si_port *, int); -static int si_Sioctl(dev_t, u_long, caddr_t, int, struct proc *); +static int si_Sioctl(dev_t, u_long, caddr_t, int, struct thread *); static void si_start(struct tty *); static void si_stop(struct tty *, int); static timeout_t si_lstart; @@ -595,7 +595,7 @@ try_next2: } static int -siopen(dev_t dev, int flag, int mode, struct proc *p) +siopen(dev_t dev, int flag, int mode, struct thread *td) { int oldspl, error; int card, port; @@ -607,7 +607,7 @@ siopen(dev_t dev, int flag, int mode, struct proc *p) /* quickly let in /dev/si_control */ if (IS_CONTROLDEV(mynor)) { - if ((error = suser(p))) + if ((error = suser_td(td))) return(error); return(0); } @@ -650,7 +650,7 @@ siopen(dev_t dev, int flag, int mode, struct proc *p) dev->si_tty = tp; ccbp = pp->sp_ccb; /* Find control block */ DPRINT((pp, DBG_ENTRY|DBG_OPEN, "siopen(%s,%x,%x,%x)\n", - devtoname(dev), flag, mode, p)); + devtoname(dev), flag, mode, td)); oldspl = spltty(); /* Keep others out */ error = 0; @@ -686,7 +686,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser(p)) { + suser_td(td)) { DPRINT((pp, DBG_OPEN|DBG_FAIL, "already open and EXCLUSIVE set\n")); error = EBUSY; @@ -764,7 +764,7 @@ out: } static int -siclose(dev_t dev, int flag, int mode, struct proc *p) +siclose(dev_t dev, int flag, int mode, struct thread *td) { struct si_port *pp; struct tty *tp; @@ -781,7 +781,7 @@ siclose(dev_t dev, int flag, int mode, struct proc *p) tp = pp->sp_tty; DPRINT((pp, DBG_ENTRY|DBG_CLOSE, "siclose(%s,%x,%x,%x) sp_state:%x\n", - devtoname(dev), flag, mode, p, pp->sp_state)); + devtoname(dev), flag, mode, td, pp->sp_state)); /* did we sleep and loose a race? */ if (pp->sp_state & SS_CLOSING) { @@ -915,7 +915,7 @@ out: static int -siioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +siioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct si_port *pp; struct tty *tp; @@ -929,7 +929,7 @@ siioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) #endif if (IS_SI_IOCTL(cmd)) - return(si_Sioctl(dev, cmd, data, flag, p)); + return(si_Sioctl(dev, cmd, data, flag, td)); pp = MINOR2PP(mynor); tp = pp->sp_tty; @@ -951,7 +951,7 @@ siioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) } switch (cmd) { case TIOCSETA: - error = suser(p); + error = suser_td(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -1023,7 +1023,7 @@ siioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) si_write_enable(pp, 0); } - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if (error != ENOIOCTL) goto out; @@ -1064,7 +1064,7 @@ siioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser(p); + error = suser_td(td); if (error == 0) pp->sp_dtr_wait = *(int *)data * hz / 100; break; @@ -1087,7 +1087,7 @@ out: * Handle the Specialix ioctls. All MUST be called via the CONTROL device */ static int -si_Sioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +si_Sioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct si_softc *xsc; struct si_port *xpp; @@ -1117,7 +1117,7 @@ si_Sioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) ip = (int *)data; -#define SUCHECK if ((error = suser(p))) goto out +#define SUCHECK if ((error = suser_td(td))) goto out switch (cmd) { case TCSIPORTS: diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 3c68d7c..05d8f35 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -1378,11 +1378,11 @@ determined_type: ; } static int -sioopen(dev, flag, mode, p) +sioopen(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct com_s *com; int error; @@ -1440,7 +1440,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser(p)) { + suser_td(td)) { error = EBUSY; goto out; } @@ -1560,11 +1560,11 @@ out: } static int -sioclose(dev, flag, mode, p) +sioclose(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct com_s *com; int mynor; @@ -2114,12 +2114,12 @@ cont: } static int -sioioctl(dev, cmd, data, flag, p) +sioioctl(dev, cmd, data, flag, td) dev_t dev; u_long cmd; caddr_t data; int flag; - struct proc *p; + struct thread *td; { struct com_s *com; int error; @@ -2150,7 +2150,7 @@ sioioctl(dev, cmd, data, flag, p) } switch (cmd) { case TIOCSETA: - error = suser(p); + error = suser_td(td); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -2200,7 +2200,7 @@ sioioctl(dev, cmd, data, flag, p) if (lt->c_ospeed != 0) dt->c_ospeed = tp->t_ospeed; } - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if (error != ENOIOCTL) return (error); s = spltty(); @@ -2241,7 +2241,7 @@ sioioctl(dev, cmd, data, flag, p) break; case TIOCMSDTRWAIT: /* must be root since the wait applies to following logins */ - error = suser(p); + error = suser_td(td); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c index 7eac3cc..beb3c4a 100644 --- a/sys/dev/smbus/smb.c +++ b/sys/dev/smbus/smb.c @@ -134,7 +134,7 @@ smb_attach(device_t dev) } static int -smbopen (dev_t dev, int flags, int fmt, struct proc *p) +smbopen (dev_t dev, int flags, int fmt, struct thread *td) { struct smb_softc *sc = IIC_SOFTC(minor(dev)); @@ -150,7 +150,7 @@ smbopen (dev_t dev, int flags, int fmt, struct proc *p) } static int -smbclose(dev_t dev, int flags, int fmt, struct proc *p) +smbclose(dev_t dev, int flags, int fmt, struct thread *td) { struct smb_softc *sc = IIC_SOFTC(minor(dev)); @@ -182,7 +182,7 @@ smbread(dev_t dev, struct uio * uio, int ioflag) } static int -smbioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) +smbioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { device_t smbdev = IIC_DEVICE(minor(dev)); struct smb_softc *sc = IIC_SOFTC(minor(dev)); diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 08eae23..93c1947 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -162,7 +162,7 @@ snplwrite(tp, uio, flag) uio2.uio_resid = ilen; uio2.uio_segflg = UIO_SYSSPACE; uio2.uio_rw = UIO_WRITE; - uio2.uio_procp = uio->uio_procp; + uio2.uio_td = uio->uio_td; error = ttwrite(tp, &uio2, flag); if (error != 0) break; @@ -375,15 +375,15 @@ snp_in(snp, buf, n) } static int -snpopen(dev, flag, mode, p) +snpopen(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { struct snoop *snp; int error; - if ((error = suser(p)) != 0) + if ((error = suser_td(td)) != 0) return (error); if (dev->si_drv1 == NULL) { @@ -455,11 +455,11 @@ detach_notty: } static int -snpclose(dev, flags, fmt, p) +snpclose(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { struct snoop *snp; @@ -490,12 +490,12 @@ snp_down(snp) } static int -snpioctl(dev, cmd, data, flags, p) +snpioctl(dev, cmd, data, flags, td) dev_t dev; u_long cmd; caddr_t data; int flags; - struct proc *p; + struct thread *td; { struct snoop *snp; struct tty *tp, *tpo; @@ -579,10 +579,10 @@ snpioctl(dev, cmd, data, flags, p) } static int -snppoll(dev, events, p) +snppoll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { struct snoop *snp; int revents; @@ -598,7 +598,7 @@ snppoll(dev, events, p) if (snp->snp_flags & SNOOP_DOWN || snp->snp_len > 0) revents |= events & (POLLIN | POLLRDNORM); else - selrecord(p, &snp->snp_sel); + selrecord(td, &snp->snp_sel); } return (revents); } diff --git a/sys/dev/sound/isa/emu8000.c b/sys/dev/sound/isa/emu8000.c index 7067a8f..ea434e6 100644 --- a/sys/dev/sound/isa/emu8000.c +++ b/sys/dev/sound/isa/emu8000.c @@ -743,19 +743,19 @@ emupnp_attach(device_t dev) } static int -emu_open(dev_t i_dev, int flags, int mode, struct proc *p) +emu_open(dev_t i_dev, int flags, int mode, struct thread *td) { return (0); } static int -emu_close(dev_t i_dev, int flags, int mode, struct proc *p) +emu_close(dev_t i_dev, int flags, int mode, struct thread *td) { return (0); } static int -emu_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) +emu_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { sc_p scp; mididev_info *devinfo; diff --git a/sys/dev/sound/isa/gusmidi.c b/sys/dev/sound/isa/gusmidi.c index 88193bf..797d168 100644 --- a/sys/dev/sound/isa/gusmidi.c +++ b/sys/dev/sound/isa/gusmidi.c @@ -214,7 +214,7 @@ gusmidi_init(device_t dev) } static int -gusmidi_open(dev_t i_dev, int flags, int mode, struct proc *p) +gusmidi_open(dev_t i_dev, int flags, int mode, struct thread *td) { sc_p scp; mididev_info *devinfo; @@ -242,7 +242,7 @@ gusmidi_open(dev_t i_dev, int flags, int mode, struct proc *p) } static int -gusmidi_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) +gusmidi_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { sc_p scp; mididev_info *devinfo; diff --git a/sys/dev/sound/isa/mpu.c b/sys/dev/sound/isa/mpu.c index a8cf490..14d1653 100644 --- a/sys/dev/sound/isa/mpu.c +++ b/sys/dev/sound/isa/mpu.c @@ -408,7 +408,7 @@ mpusbc_attach(device_t dev) } static int -mpu_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) +mpu_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { sc_p scp; mididev_info *devinfo; diff --git a/sys/dev/sound/isa/opl.c b/sys/dev/sound/isa/opl.c index a4a0e66..5ebf974 100644 --- a/sys/dev/sound/isa/opl.c +++ b/sys/dev/sound/isa/opl.c @@ -764,7 +764,7 @@ oplsbc_attach(device_t dev) } static int -opl_open(dev_t i_dev, int flags, int mode, struct proc *p) +opl_open(dev_t i_dev, int flags, int mode, struct thread *td) { sc_p scp; mididev_info *devinfo; @@ -805,7 +805,7 @@ opl_open(dev_t i_dev, int flags, int mode, struct proc *p) } static int -opl_close(dev_t i_dev, int flags, int mode, struct proc *p) +opl_close(dev_t i_dev, int flags, int mode, struct thread *td) { sc_p scp; mididev_info *devinfo; @@ -838,7 +838,7 @@ opl_close(dev_t i_dev, int flags, int mode, struct proc *p) } static int -opl_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) +opl_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { sc_p scp; mididev_info *devinfo; diff --git a/sys/dev/sound/isa/sb16.c b/sys/dev/sound/isa/sb16.c index cfc2363..53c4242 100644 --- a/sys/dev/sound/isa/sb16.c +++ b/sys/dev/sound/isa/sb16.c @@ -150,7 +150,7 @@ sb_dspwr(struct sb_info *sb, u_char val) } } #if __FreeBSD_version > 500000 - if (curproc->p_intr_nesting_level == 0) + if (curthread->td_intr_nesting_level == 0) printf("sb_dspwr(0x%02x) timed out.\n", val); #endif return 0; diff --git a/sys/dev/sound/isa/uartsio.c b/sys/dev/sound/isa/uartsio.c index 297e986..3577ce5 100644 --- a/sys/dev/sound/isa/uartsio.c +++ b/sys/dev/sound/isa/uartsio.c @@ -261,7 +261,7 @@ uartsio_attach(device_t dev) } static int -uartsio_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) +uartsio_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { sc_p scp; mididev_info *devinfo; diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c index ad62804..e577398 100644 --- a/sys/dev/sound/midi/midi.c +++ b/sys/dev/sound/midi/midi.c @@ -268,16 +268,16 @@ mididev_info_number(void) */ static int -midiopen(dev_t i_dev, int flags, int mode, struct proc * p) +midiopen(dev_t i_dev, int flags, int mode, struct thread *td) { int ret; switch (MIDIDEV(i_dev)) { case MIDI_DEV_MIDIN: - ret = midi_open(i_dev, flags, mode, p); + ret = midi_open(i_dev, flags, mode, td); break; case MIDI_DEV_STATUS: - ret = midistat_open(i_dev, flags, mode, p); + ret = midistat_open(i_dev, flags, mode, td); break; default: ret = ENXIO; @@ -288,16 +288,16 @@ midiopen(dev_t i_dev, int flags, int mode, struct proc * p) } static int -midiclose(dev_t i_dev, int flags, int mode, struct proc * p) +midiclose(dev_t i_dev, int flags, int mode, struct thread *td) { int ret; switch (MIDIDEV(i_dev)) { case MIDI_DEV_MIDIN: - ret = midi_close(i_dev, flags, mode, p); + ret = midi_close(i_dev, flags, mode, td); break; case MIDI_DEV_STATUS: - ret = midistat_close(i_dev, flags, mode, p); + ret = midistat_close(i_dev, flags, mode, td); break; default: ret = ENXIO; @@ -345,13 +345,13 @@ midiwrite(dev_t i_dev, struct uio * buf, int flag) } static int -midiioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p) +midiioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { int ret; switch (MIDIDEV(i_dev)) { case MIDI_DEV_MIDIN: - ret = midi_ioctl(i_dev, cmd, arg, mode, p); + ret = midi_ioctl(i_dev, cmd, arg, mode, td); break; default: ret = ENXIO; @@ -362,13 +362,13 @@ midiioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p) } static int -midipoll(dev_t i_dev, int events, struct proc * p) +midipoll(dev_t i_dev, int events, struct thread *td) { int ret; switch (MIDIDEV(i_dev)) { case MIDI_DEV_MIDIN: - ret = midi_poll(i_dev, events, p); + ret = midi_poll(i_dev, events, td); break; default: ret = ENXIO; @@ -383,7 +383,7 @@ midipoll(dev_t i_dev, int events, struct proc * p) */ int -midi_open(dev_t i_dev, int flags, int mode, struct proc * p) +midi_open(dev_t i_dev, int flags, int mode, struct thread *td) { int dev, unit, ret; mididev_info *d; @@ -422,13 +422,13 @@ midi_open(dev_t i_dev, int flags, int mode, struct proc * p) if (d->open == NULL) ret = 0; else - ret = d->open(i_dev, flags, mode, p); + ret = d->open(i_dev, flags, mode, td); return (ret); } int -midi_close(dev_t i_dev, int flags, int mode, struct proc * p) +midi_close(dev_t i_dev, int flags, int mode, struct thread *td) { int dev, unit, ret; mididev_info *d; @@ -468,7 +468,7 @@ midi_close(dev_t i_dev, int flags, int mode, struct proc * p) if (d->close == NULL) ret = 0; else - ret = d->close(i_dev, flags, mode, p); + ret = d->close(i_dev, flags, mode, td); return (ret); } @@ -570,7 +570,7 @@ midi_write(dev_t i_dev, struct uio * buf, int flag) */ int -midi_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p) +midi_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { int ret = ENOSYS, dev, unit; mididev_info *d; @@ -583,7 +583,7 @@ midi_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p) return (ENXIO); if (d->ioctl) - ret = d->ioctl(i_dev, cmd, arg, mode, p); + ret = d->ioctl(i_dev, cmd, arg, mode, td); if (ret != ENOSYS) return ret; @@ -715,7 +715,7 @@ midi_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p) } int -midi_poll(dev_t i_dev, int events, struct proc * p) +midi_poll(dev_t i_dev, int events, struct thread *td) { int unit, dev, ret, lim; mididev_info *d; @@ -742,7 +742,7 @@ midi_poll(dev_t i_dev, int events, struct proc * p) lim = d->midi_dbuf_out.unit_size; if (d->midi_dbuf_out.fl < lim) /* No enough space, record select. */ - selrecord(p, &d->midi_dbuf_out.sel); + selrecord(td, &d->midi_dbuf_out.sel); else /* We can write now. */ ret |= events & (POLLOUT | POLLWRNORM); @@ -758,7 +758,7 @@ midi_poll(dev_t i_dev, int events, struct proc * p) lim = d->midi_dbuf_in.unit_size; if (d->midi_dbuf_in.rl < lim) /* No data ready, record select. */ - selrecord(p, &d->midi_dbuf_in.sel); + selrecord(td, &d->midi_dbuf_in.sel); else /* We can write now. */ ret |= events & (POLLIN | POLLRDNORM); @@ -811,7 +811,7 @@ midi_sync(mididev_info *d) */ int -midistat_open(dev_t i_dev, int flags, int mode, struct proc * p) +midistat_open(dev_t i_dev, int flags, int mode, struct thread *td) { if (midistatbusy) return (EBUSY); @@ -827,7 +827,7 @@ midistat_open(dev_t i_dev, int flags, int mode, struct proc * p) } int -midistat_close(dev_t i_dev, int flags, int mode, struct proc * p) +midistat_close(dev_t i_dev, int flags, int mode, struct thread *td) { midistatbusy = 0; diff --git a/sys/dev/sound/midi/sequencer.c b/sys/dev/sound/midi/sequencer.c index d8beba2..ab35f81 100644 --- a/sys/dev/sound/midi/sequencer.c +++ b/sys/dev/sound/midi/sequencer.c @@ -131,7 +131,7 @@ struct seq_softc { */ int output_threshould; /* Sequence output threshould */ snd_sync_parm sync_parm; /* AIOSYNC parameter set */ - struct proc *sync_proc; /* AIOSYNCing process */ + struct thread *sync_thread; /* AIOSYNCing thread */ }; typedef struct seq_softc *sc_p; @@ -187,8 +187,8 @@ static int seq_local(sc_p scp, u_char *event); static int seq_sysex(sc_p scp, u_char *event); static void seq_timer(void *arg); static int seq_reset(sc_p scp); -static int seq_openmidi(sc_p scp, mididev_info *md, int flags, int mode, struct proc *p); -static int seq_closemidi(sc_p scp, mididev_info *md, int flags, int mode, struct proc *p); +static int seq_openmidi(sc_p scp, mididev_info *md, int flags, int mode, struct thread *p); +static int seq_closemidi(sc_p scp, mididev_info *md, int flags, int mode, struct thread *p); static void seq_panic(sc_p scp); static int seq_sync(sc_p scp); @@ -268,7 +268,7 @@ seq_initunit(int unit) } int -seq_open(dev_t i_dev, int flags, int mode, struct proc *p) +seq_open(dev_t i_dev, int flags, int mode, struct thread *td) { int unit; sc_p scp; @@ -319,7 +319,7 @@ seq_open(dev_t i_dev, int flags, int mode, struct proc *p) } int -seq_close(dev_t i_dev, int flags, int mode, struct proc *p) +seq_close(dev_t i_dev, int flags, int mode, struct thread *td) { int unit; sc_p scp; @@ -551,7 +551,7 @@ seq_write(dev_t i_dev, struct uio *buf, int flag) } int -seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) +seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { int unit, midiunit, ret, tmp, arg2; sc_p scp; @@ -644,7 +644,7 @@ seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) TAILQ_FOREACH(md, &scp->midi_open, md_linkseq) { if ((md->flags & MIDI_F_WRITING) != 0) { arg2 = *(int *)arg; - midi_ioctl(MIDIMKDEV(major(i_dev), md->unit, SND_DEV_MIDIN), cmd, (caddr_t)&arg2, mode, p); + midi_ioctl(MIDIMKDEV(major(i_dev), md->unit, SND_DEV_MIDIN), cmd, (caddr_t)&arg2, mode, td); } } @@ -661,7 +661,7 @@ seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) TAILQ_FOREACH(md, &scp->midi_open, md_linkseq) { if ((md->flags & MIDI_F_WRITING) != 0) { arg2 = *(int *)arg; - midi_ioctl(MIDIMKDEV(major(i_dev), md->unit, SND_DEV_MIDIN), cmd, (caddr_t)&arg2, mode, p); + midi_ioctl(MIDIMKDEV(major(i_dev), md->unit, SND_DEV_MIDIN), cmd, (caddr_t)&arg2, mode, td); } } @@ -773,7 +773,7 @@ seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) mtx_unlock(&sd->flagqueue_mtx); if (ret != 0) break; - ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, p); + ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, td); break; case SNDCTL_SEQ_NRSYNTHS: *(int *)arg = mididev_info_number(); @@ -790,7 +790,7 @@ seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) mtx_unlock(&sd->flagqueue_mtx); if (ret != 0) break; - ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, p); + ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, td); break; case SNDCTL_FM_4OP_ENABLE: midiunit = *(int *)arg; @@ -799,7 +799,7 @@ seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) mtx_unlock(&sd->flagqueue_mtx); if (ret != 0) break; - ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, p); + ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, td); break; case SNDCTL_SYNTH_INFO: synthinfo = (struct synth_info *)arg; @@ -809,7 +809,7 @@ seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) mtx_unlock(&sd->flagqueue_mtx); if (ret != 0) break; - ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, p); + ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, td); break; case SNDCTL_SEQ_OUTOFBAND: event = (struct seq_event_rec *)arg; @@ -825,7 +825,7 @@ seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) mtx_unlock(&sd->flagqueue_mtx); if (ret != 0) break; - ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, p); + ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, td); break; case SNDCTL_PMGR_IFACE: patinfo = (struct patmgr_info *)arg; @@ -835,7 +835,7 @@ seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) mtx_unlock(&sd->flagqueue_mtx); if (ret != 0) break; - ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, p); + ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, td); break; case SNDCTL_PMGR_ACCESS: patinfo = (struct patmgr_info *)arg; @@ -845,7 +845,7 @@ seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) mtx_unlock(&sd->flagqueue_mtx); if (ret != 0) break; - ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, p); + ret = midi_ioctl(MIDIMKDEV(major(i_dev), midiunit, SND_DEV_MIDIN), cmd, arg, mode, td); break; case SNDCTL_SEQ_THRESHOLD: tmp = *(int *)arg; @@ -871,7 +871,7 @@ seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) mtx_unlock(&sd->flagqueue_mtx); if (ret != 0) break; - ret = midi_ioctl(MIDIMKDEV(major(i_dev), 0, SND_DEV_MIDIN), cmd, arg, mode, p); + ret = midi_ioctl(MIDIMKDEV(major(i_dev), 0, SND_DEV_MIDIN), cmd, arg, mode, td); break; } @@ -879,7 +879,7 @@ seq_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) } int -seq_poll(dev_t i_dev, int events, struct proc *p) +seq_poll(dev_t i_dev, int events, struct thread *td) { int unit, ret, lim; sc_p scp; @@ -916,7 +916,7 @@ seq_poll(dev_t i_dev, int events, struct proc *p) lim = sd->midi_dbuf_out.unit_size; if (sd->midi_dbuf_out.fl < lim) /* No enough space, record select. */ - selrecord(p, &sd->midi_dbuf_out.sel); + selrecord(td, &sd->midi_dbuf_out.sel); else /* We can write now. */ ret |= events & (POLLOUT | POLLWRNORM); @@ -932,7 +932,7 @@ seq_poll(dev_t i_dev, int events, struct proc *p) lim = sd->midi_dbuf_in.unit_size; if (sd->midi_dbuf_in.rl < lim) /* No data ready, record select. */ - selrecord(p, &sd->midi_dbuf_in.sel); + selrecord(td, &sd->midi_dbuf_in.sel); else /* We can write now. */ ret |= events & (POLLIN | POLLRDNORM); @@ -1849,7 +1849,7 @@ seq_timer(void *arg) } static int -seq_openmidi(sc_p scp, mididev_info *md, int flags, int mode, struct proc *p) +seq_openmidi(sc_p scp, mididev_info *md, int flags, int mode, struct thread *td) { int midiunit, err, insync; @@ -1859,7 +1859,7 @@ seq_openmidi(sc_p scp, mididev_info *md, int flags, int mode, struct proc *p) DEB(printf("seq_openmidi: opening midi unit %d.\n", midiunit)); - err = midi_open(MIDIMKDEV(MIDI_CDEV_MAJOR, midiunit, SND_DEV_MIDIN), flags, mode, p); + err = midi_open(MIDIMKDEV(MIDI_CDEV_MAJOR, midiunit, SND_DEV_MIDIN), flags, mode, td); if (err != 0) { printf("seq_openmidi: failed to open midi device %d.\n", midiunit); return (err); @@ -1887,7 +1887,7 @@ seq_openmidi(sc_p scp, mididev_info *md, int flags, int mode, struct proc *p) } static int -seq_closemidi(sc_p scp, mididev_info *md, int flags, int mode, struct proc *p) +seq_closemidi(sc_p scp, mididev_info *md, int flags, int mode, struct thread *td) { int midiunit, insync; @@ -1901,7 +1901,7 @@ seq_closemidi(sc_p scp, mididev_info *md, int flags, int mode, struct proc *p) DEB(printf("seq_closemidi: closing midi unit %d.\n", midiunit)); - midi_close(MIDIMKDEV(MIDI_CDEV_MAJOR, midiunit, SND_DEV_MIDIN), flags, mode, p); + midi_close(MIDIMKDEV(MIDI_CDEV_MAJOR, midiunit, SND_DEV_MIDIN), flags, mode, td); mtx_lock(&md->flagqueue_mtx); md->intr = NULL; md->intrarg = NULL; @@ -2152,7 +2152,7 @@ lookup_mididev(sc_p scp, int unit, int mode, mididev_info **mdp) if (md->unit == unit) { *mdp = md; if (mode == LOOKUP_CLOSE) - return seq_closemidi(scp, md, scp->fflags, MIDIDEV_MODE, curproc); + return seq_closemidi(scp, md, scp->fflags, MIDIDEV_MODE, curthread); return (md != NULL && MIDICONFED(md)) ? 0 : ENXIO; } @@ -2162,7 +2162,7 @@ lookup_mididev(sc_p scp, int unit, int mode, mididev_info **mdp) md = get_mididev_info_unit(unit); if (md != NULL) { *mdp = md; - ret = seq_openmidi(scp, md, scp->fflags, MIDIDEV_MODE, curproc); + ret = seq_openmidi(scp, md, scp->fflags, MIDIDEV_MODE, curthread); return ret; } } @@ -2172,22 +2172,22 @@ lookup_mididev(sc_p scp, int unit, int mode, mididev_info **mdp) /* XXX These functions are actually redundant. */ static int -seqopen(dev_t i_dev, int flags, int mode, struct proc * p) +seqopen(dev_t i_dev, int flags, int mode, struct thread *td) { switch (MIDIDEV(i_dev)) { case MIDI_DEV_SEQ: - return seq_open(i_dev, flags, mode, p); + return seq_open(i_dev, flags, mode, td); } return (ENXIO); } static int -seqclose(dev_t i_dev, int flags, int mode, struct proc * p) +seqclose(dev_t i_dev, int flags, int mode, struct thread *td) { switch (MIDIDEV(i_dev)) { case MIDI_DEV_SEQ: - return seq_close(i_dev, flags, mode, p); + return seq_close(i_dev, flags, mode, td); } return (ENXIO); @@ -2216,22 +2216,22 @@ seqwrite(dev_t i_dev, struct uio * buf, int flag) } static int -seqioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc * p) +seqioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { switch (MIDIDEV(i_dev)) { case MIDI_DEV_SEQ: - return seq_ioctl(i_dev, cmd, arg, mode, p); + return seq_ioctl(i_dev, cmd, arg, mode, td); } return (ENXIO); } static int -seqpoll(dev_t i_dev, int events, struct proc * p) +seqpoll(dev_t i_dev, int events, struct thread *td) { switch (MIDIDEV(i_dev)) { case MIDI_DEV_SEQ: - return seq_poll(i_dev, events, p); + return seq_poll(i_dev, events, td); } return (ENXIO); diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 8cf2d88..dc843ee 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -498,7 +498,7 @@ chn_sync(struct pcm_channel *c, int threshold) /* called externally, handle locking */ int -chn_poll(struct pcm_channel *c, int ev, struct proc *p) +chn_poll(struct pcm_channel *c, int ev, struct thread *td) { struct snd_dbuf *bs = c->bufsoft; int ret; @@ -510,7 +510,7 @@ chn_poll(struct pcm_channel *c, int ev, struct proc *p) if (chn_polltrigger(c) && chn_pollreset(c)) ret = ev; else - selrecord(p, sndbuf_getsel(bs)); + selrecord(curthread, sndbuf_getsel(bs)); return ret; } diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index 6743f4a..118cf5d 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -73,7 +73,7 @@ int chn_read(struct pcm_channel *c, struct uio *buf); u_int32_t chn_start(struct pcm_channel *c, int force); int chn_sync(struct pcm_channel *c, int threshold); int chn_flush(struct pcm_channel *c); -int chn_poll(struct pcm_channel *c, int ev, struct proc *p); +int chn_poll(struct pcm_channel *c, int ev, struct thread *td); int chn_init(struct pcm_channel *c, void *devinfo, int dir); int chn_kill(struct pcm_channel *c); diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 6a4bfc6..4ae4e67 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -169,7 +169,7 @@ relchns(dev_t dev, struct pcm_channel *rdch, struct pcm_channel *wrch, u_int32_t } static int -dsp_open(dev_t i_dev, int flags, int mode, struct proc *p) +dsp_open(dev_t i_dev, int flags, int mode, struct thread *td) { struct pcm_channel *rdch, *wrch; struct snddev_info *d; @@ -229,9 +229,9 @@ dsp_open(dev_t i_dev, int flags, int mode, struct proc *p) if (rdch == NULL) { /* not already open, try to get a channel */ if (devtype == SND_DEV_DSPREC) - rdch = pcm_chnalloc(d, PCMDIR_REC, p->p_pid, PCMCHAN(i_dev)); + rdch = pcm_chnalloc(d, PCMDIR_REC, td->td_proc->p_pid, PCMCHAN(i_dev)); else - rdch = pcm_chnalloc(d, PCMDIR_REC, p->p_pid, -1); + rdch = pcm_chnalloc(d, PCMDIR_REC, td->td_proc->p_pid, -1); if (!rdch) { /* no channel available, exit */ pcm_unlock(d); @@ -251,7 +251,7 @@ dsp_open(dev_t i_dev, int flags, int mode, struct proc *p) /* open for write */ if (wrch == NULL) { /* not already open, try to get a channel */ - wrch = pcm_chnalloc(d, PCMDIR_PLAY, p->p_pid, -1); + wrch = pcm_chnalloc(d, PCMDIR_PLAY, td->td_proc->p_pid, -1); if (!wrch) { /* no channel available */ if (rdch && (flags & FREAD)) { @@ -310,7 +310,7 @@ dsp_open(dev_t i_dev, int flags, int mode, struct proc *p) } static int -dsp_close(dev_t i_dev, int flags, int mode, struct proc *p) +dsp_close(dev_t i_dev, int flags, int mode, struct thread *td) { struct pcm_channel *rdch, *wrch; struct snddev_info *d; @@ -429,7 +429,7 @@ dsp_write(dev_t i_dev, struct uio *buf, int flag) } static int -dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) +dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { struct pcm_channel *wrch, *rdch; struct snddev_info *d; @@ -446,7 +446,7 @@ dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) dev_t pdev; pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(PCMUNIT(i_dev), SND_DEV_CTL, 0)); - return mixer_ioctl(pdev, cmd, arg, mode, p); + return mixer_ioctl(pdev, cmd, arg, mode, td); } s = spltty(); @@ -961,7 +961,7 @@ dsp_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) } static int -dsp_poll(dev_t i_dev, int events, struct proc *p) +dsp_poll(dev_t i_dev, int events, struct thread *td) { struct pcm_channel *wrch = NULL, *rdch = NULL; intrmask_t s; @@ -974,12 +974,12 @@ dsp_poll(dev_t i_dev, int events, struct proc *p) if (wrch) { e = (events & (POLLOUT | POLLWRNORM)); if (e) - ret |= chn_poll(wrch, e, p); + ret |= chn_poll(wrch, e, td); } if (rdch) { e = (events & (POLLIN | POLLRDNORM)); if (e) - ret |= chn_poll(rdch, e, p); + ret |= chn_poll(rdch, e, td); } relchns(i_dev, rdch, wrch, SD_F_PRIO_RD | SD_F_PRIO_WR); diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index cddb515..d4894a5 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -392,7 +392,7 @@ mixer_hwvol_step(device_t dev, int left_step, int right_step) /* ----------------------------------------------------------------------- */ static int -mixer_open(dev_t i_dev, int flags, int mode, struct proc *p) +mixer_open(dev_t i_dev, int flags, int mode, struct thread *td) { struct snd_mixer *m; intrmask_t s; @@ -409,7 +409,7 @@ mixer_open(dev_t i_dev, int flags, int mode, struct proc *p) } static int -mixer_close(dev_t i_dev, int flags, int mode, struct proc *p) +mixer_close(dev_t i_dev, int flags, int mode, struct thread *td) { struct snd_mixer *m; intrmask_t s; @@ -431,7 +431,7 @@ mixer_close(dev_t i_dev, int flags, int mode, struct proc *p) } int -mixer_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p) +mixer_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) { struct snd_mixer *m; intrmask_t s; diff --git a/sys/dev/sound/pcm/mixer.h b/sys/dev/sound/pcm/mixer.h index 054d79d..4f51bf2 100644 --- a/sys/dev/sound/pcm/mixer.h +++ b/sys/dev/sound/pcm/mixer.h @@ -29,7 +29,7 @@ int mixer_init(device_t dev, kobj_class_t cls, void *devinfo); int mixer_uninit(device_t dev); int mixer_reinit(device_t dev); -int mixer_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct proc *p); +int mixer_ioctl(dev_t i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td); int mixer_hwvol_init(device_t dev); void mixer_hwvol_mute(device_t dev); diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index dd786e9..b3b0999 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -109,7 +109,7 @@ SYSCTL_PROC(_hw_snd, OID_AUTO, verbose, CTLTYPE_INT | CTLFLAG_RW, 0, sizeof(int), sysctl_hw_sndverbose, "I", ""); static int -sndstat_open(dev_t i_dev, int flags, int mode, struct proc *p) +sndstat_open(dev_t i_dev, int flags, int mode, struct thread *td) { intrmask_t s; int err; @@ -137,7 +137,7 @@ sndstat_open(dev_t i_dev, int flags, int mode, struct proc *p) } static int -sndstat_close(dev_t i_dev, int flags, int mode, struct proc *p) +sndstat_close(dev_t i_dev, int flags, int mode, struct thread *td) { intrmask_t s; diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index 0fadea8..e0986de 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -460,11 +460,11 @@ static int spkr_active = FALSE; /* exclusion flag */ static char *spkr_inbuf; /* incoming buf */ int -spkropen(dev, flags, fmt, p) +spkropen(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { #ifdef DEBUG (void) printf("spkropen: entering with dev = %s\n", devtoname(dev)); @@ -519,11 +519,11 @@ spkrwrite(dev, uio, ioflag) } int -spkrclose(dev, flags, fmt, p) +spkrclose(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { #ifdef DEBUG (void) printf("spkrclose: entering with dev = %s\n", devtoname(dev)); @@ -542,12 +542,12 @@ spkrclose(dev, flags, fmt, p) } int -spkrioctl(dev, cmd, cmdarg, flags, p) +spkrioctl(dev, cmd, cmdarg, flags, td) dev_t dev; unsigned long cmd; caddr_t cmdarg; int flags; - struct proc *p; + struct thread *td; { #ifdef DEBUG (void) printf("spkrioctl: entering with dev = %s, cmd = %lx\n", diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index b1ccc35..8d02576 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -61,8 +61,8 @@ #include <compat/svr4/svr4_stropts.h> #include <compat/svr4/svr4_socket.h> -static int svr4_soo_close __P((struct file *, struct proc *)); -static int svr4_ptm_alloc __P((struct proc *)); +static int svr4_soo_close __P((struct file *, struct thread *)); +static int svr4_ptm_alloc __P((struct thread *)); static d_open_t streamsopen; struct svr4_sockcache_entry { @@ -198,7 +198,7 @@ MODULE_VERSION(streams, 1); * routine. */ static int -streamsopen(dev_t dev, int oflags, int devtype, struct proc *p) +streamsopen(dev_t dev, int oflags, int devtype, struct thread *td) { int type, protocol; int fd; @@ -206,9 +206,10 @@ streamsopen(dev_t dev, int oflags, int devtype, struct proc *p) struct socket *so; int error; int family; + struct proc *p = td->td_proc; PROC_LOCK(p); - if (p->p_dupfd >= 0) { + if (td->td_dupfd >= 0) { PROC_UNLOCK(p); return ENODEV; } @@ -254,16 +255,16 @@ streamsopen(dev_t dev, int oflags, int devtype, struct proc *p) break; case dev_ptm: - return svr4_ptm_alloc(p); + return svr4_ptm_alloc(td); default: return EOPNOTSUPP; } - if ((error = falloc(p, &fp, &fd)) != 0) + if ((error = falloc(td, &fp, &fd)) != 0) return error; - if ((error = socreate(family, &so, type, protocol, p)) != 0) { + if ((error = socreate(family, &so, type, protocol, td)) != 0) { p->p_fd->fd_ofiles[fd] = 0; ffree(fp); return error; @@ -276,15 +277,16 @@ streamsopen(dev_t dev, int oflags, int devtype, struct proc *p) (void)svr4_stream_get(fp); PROC_LOCK(p); - p->p_dupfd = fd; + td->td_dupfd = fd; PROC_UNLOCK(p); return ENXIO; } static int -svr4_ptm_alloc(p) - struct proc *p; +svr4_ptm_alloc(td) + struct thread *td; { + struct proc *p = td->td_proc; /* * XXX this is very, very ugly. But I can't find a better * way that won't duplicate a big amount of code from @@ -319,13 +321,13 @@ svr4_ptm_alloc(p) if ((error = copyout(ptyname, path, sizeof(ptyname))) != 0) return error; - switch (error = open(p, &oa)) { + switch (error = open(td, &oa)) { case ENOENT: case ENXIO: return error; case 0: PROC_LOCK(p); - p->p_dupfd = p->p_retval[0]; + td->td_dupfd = td->td_retval[0]; PROC_UNLOCK(p); return ENXIO; default: @@ -394,14 +396,14 @@ svr4_delete_socket(p, fp) } static int -svr4_soo_close(struct file *fp, struct proc *p) +svr4_soo_close(struct file *fp, struct thread *td) { struct socket *so = (struct socket *)fp->f_data; /* CHECKUNIT_DIAG(ENXIO);*/ - svr4_delete_socket(p, fp); + svr4_delete_socket(td->td_proc, fp); free(so->so_emuldata, M_TEMP); - return soo_close(fp, p); + return soo_close(fp, td); return (0); } diff --git a/sys/dev/syscons/schistory.c b/sys/dev/syscons/schistory.c index bd9b1d2..3df7682 100644 --- a/sys/dev/syscons/schistory.c +++ b/sys/dev/syscons/schistory.c @@ -278,7 +278,7 @@ sc_hist_down_line(scr_stat *scp) int sc_hist_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, - struct proc *p) + struct thread *td) { scr_stat *scp; int error; diff --git a/sys/dev/syscons/scmouse.c b/sys/dev/syscons/scmouse.c index b8bb5d1..92ced7d 100644 --- a/sys/dev/syscons/scmouse.c +++ b/sys/dev/syscons/scmouse.c @@ -600,7 +600,7 @@ sc_mouse_paste(scr_stat *scp) int sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, - struct proc *p) + struct thread *td) { mouse_info_t *mouse; mouse_info_t buf; @@ -658,8 +658,8 @@ sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, case MOUSE_MODE: if (ISSIGVALID(mouse->u.mode.signal)) { scp->mouse_signal = mouse->u.mode.signal; - scp->mouse_proc = p; - scp->mouse_pid = p->p_pid; + scp->mouse_proc = td->td_proc; + scp->mouse_pid = td->td_proc->p_pid; } else { scp->mouse_signal = 0; diff --git a/sys/dev/syscons/scterm-sc.c b/sys/dev/syscons/scterm-sc.c index fb02b92..1b9b979 100644 --- a/sys/dev/syscons/scterm-sc.c +++ b/sys/dev/syscons/scterm-sc.c @@ -711,7 +711,7 @@ outloop: static int scterm_ioctl(scr_stat *scp, struct tty *tp, u_long cmd, caddr_t data, - int flag, struct proc *p) + int flag, struct thread *td) { term_stat *tcp = scp->ts; vid_info_t *vi; diff --git a/sys/dev/syscons/scvesactl.c b/sys/dev/syscons/scvesactl.c index a9ff4ad..7a92d33f 100644 --- a/sys/dev/syscons/scvesactl.c +++ b/sys/dev/syscons/scvesactl.c @@ -46,7 +46,7 @@ static d_ioctl_t *prev_user_ioctl; static int -vesa_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +vesa_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { scr_stat *scp; struct tty *tp; @@ -106,7 +106,7 @@ vesa_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) } if (prev_user_ioctl) - return (*prev_user_ioctl)(dev, cmd, data, flag, p); + return (*prev_user_ioctl)(dev, cmd, data, flag, td); else return ENOIOCTL; } diff --git a/sys/dev/syscons/scvidctl.c b/sys/dev/syscons/scvidctl.c index b75e545..b28752b 100644 --- a/sys/dev/syscons/scvidctl.c +++ b/sys/dev/syscons/scvidctl.c @@ -435,7 +435,7 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize, (*vidsw[(a)->va_index]->ioctl)((a), (c), (caddr_t)(d))) int -sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p) +sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct thread *td) { scr_stat *scp; video_adapter_t *adp; diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index fe5176f..644864e 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -442,7 +442,7 @@ scdevtounit(dev_t dev) } int -scopen(dev_t dev, int flag, int mode, struct proc *p) +scopen(dev_t dev, int flag, int mode, struct thread *td) { int unit = scdevtounit(dev); sc_softc_t *sc; @@ -481,7 +481,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p) (*linesw[tp->t_line].l_modem)(tp, 1); } else - if (tp->t_state & TS_XCLUDE && suser(p)) + if (tp->t_state & TS_XCLUDE && suser_td(td)) return(EBUSY); error = (*linesw[tp->t_line].l_open)(dev, tp); @@ -501,7 +501,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p) } int -scclose(dev_t dev, int flag, int mode, struct proc *p) +scclose(dev_t dev, int flag, int mode, struct thread *td) { struct tty *tp = dev->si_tty; scr_stat *scp; @@ -634,7 +634,7 @@ scparam(struct tty *tp, struct termios *t) } int -scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int error; int i; @@ -647,23 +647,23 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) /* If there is a user_ioctl function call that first */ if (sc_user_ioctl) { - error = (*sc_user_ioctl)(dev, cmd, data, flag, p); + error = (*sc_user_ioctl)(dev, cmd, data, flag, td); if (error != ENOIOCTL) return error; } - error = sc_vid_ioctl(tp, cmd, data, flag, p); + error = sc_vid_ioctl(tp, cmd, data, flag, td); if (error != ENOIOCTL) return error; #ifndef SC_NO_HISTORY - error = sc_hist_ioctl(tp, cmd, data, flag, p); + error = sc_hist_ioctl(tp, cmd, data, flag, td); if (error != ENOIOCTL) return error; #endif #ifndef SC_NO_SYSMOUSE - error = sc_mouse_ioctl(tp, cmd, data, flag, p); + error = sc_mouse_ioctl(tp, cmd, data, flag, td); if (error != ENOIOCTL) return error; #endif @@ -674,7 +674,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) sc = scp->sc; if (scp->tsw) { - error = (*scp->tsw->te_ioctl)(scp, tp, cmd, data, flag, p); + error = (*scp->tsw->te_ioctl)(scp, tp, cmd, data, flag, td); if (error != ENOIOCTL) return error; } @@ -855,7 +855,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) DPRINTF(5, ("sc%d: VT_SETMODE ", sc->unit)); if (scp->smode.mode == VT_PROCESS) { p1 = pfind(scp->pid); - if (scp->proc == p1 && scp->proc != p) { + if (scp->proc == p1 && scp->proc != td->td_proc) { if (p1) PROC_UNLOCK(p1); DPRINTF(5, ("error EPERM\n")); @@ -884,9 +884,9 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) DPRINTF(5, ("error EINVAL\n")); return EINVAL; } - DPRINTF(5, ("VT_PROCESS %d, ", p->p_pid)); + DPRINTF(5, ("VT_PROCESS %d, ", td->td_proc->p_pid)); bcopy(data, &scp->smode, sizeof(struct vt_mode)); - scp->proc = p; + scp->proc = td->td_proc; scp->pid = scp->proc->p_pid; if ((scp == sc->cur_scp) && (sc->unit == sc_console_unit)) cons_unavail = TRUE; @@ -911,7 +911,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return EINVAL; } /* ...and this process is controlling it. */ - if (scp->proc != p) { + if (scp->proc != td->td_proc) { splx(s); return EPERM; } @@ -977,19 +977,19 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return 0; case KDENABIO: /* allow io operations */ - error = suser(p); + error = suser_td(td); if (error != 0) return error; if (securelevel > 0) return EPERM; #ifdef __i386__ - p->p_frame->tf_eflags |= PSL_IOPL; + td->td_frame->tf_eflags |= PSL_IOPL; #endif return 0; case KDDISABIO: /* disallow io operations (default) */ #ifdef __i386__ - p->p_frame->tf_eflags &= ~PSL_IOPL; + td->td_frame->tf_eflags &= ~PSL_IOPL; #endif return 0; @@ -1270,7 +1270,7 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) break; } - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if (error != ENOIOCTL) return(error); error = ttioctl(tp, cmd, data, flag); diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h index 7a353f8..b5e206a 100644 --- a/sys/dev/syscons/syscons.h +++ b/sys/dev/syscons/syscons.h @@ -338,7 +338,7 @@ typedef int sc_term_init_t(scr_stat *scp, void **tcp, int code); typedef int sc_term_term_t(scr_stat *scp, void **tcp); typedef void sc_term_puts_t(scr_stat *scp, u_char *buf, int len); typedef int sc_term_ioctl_t(scr_stat *scp, struct tty *tp, u_long cmd, - caddr_t data, int flag, struct proc *p); + caddr_t data, int flag, struct thread *td); typedef int sc_term_reset_t(scr_stat *scp, int code); #define SC_TE_HARD_RESET 0 #define SC_TE_SOFT_RESET 1 @@ -508,7 +508,7 @@ typedef struct { /* syscons.c */ extern int (*sc_user_ioctl)(dev_t dev, u_long cmd, caddr_t data, - int flag, struct proc *p); + int flag, struct thread *td); int sc_probe_unit(int unit, int flags); int sc_attach_unit(int unit, int flags); @@ -550,7 +550,7 @@ void sc_hist_end(scr_stat *scp); int sc_hist_up_line(scr_stat *scp); int sc_hist_down_line(scr_stat *scp); int sc_hist_ioctl(struct tty *tp, u_long cmd, caddr_t data, - int flag, struct proc *p); + int flag, struct thread *td); #endif /* SC_NO_HISTORY */ /* scmouse.c */ @@ -575,7 +575,7 @@ void sc_mouse_paste(scr_stat *scp); #ifndef SC_NO_SYSMOUSE void sc_mouse_move(scr_stat *scp, int x, int y); int sc_mouse_ioctl(struct tty *tp, u_long cmd, caddr_t data, - int flag, struct proc *p); + int flag, struct thread *td); #endif /* SC_NO_SYSMOUSE */ /* scvidctl.c */ @@ -585,7 +585,7 @@ int sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode); int sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize, int fontsize); int sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, - struct proc *p); + struct thread *td); int sc_render_add(sc_renderer_t *rndr); int sc_render_remove(sc_renderer_t *rndr); diff --git a/sys/dev/syscons/sysmouse.c b/sys/dev/syscons/sysmouse.c index bb38cfe..80eac8e 100644 --- a/sys/dev/syscons/sysmouse.c +++ b/sys/dev/syscons/sysmouse.c @@ -72,7 +72,7 @@ static void smstart(struct tty *tp); static int smparam(struct tty *tp, struct termios *t); static int -smopen(dev_t dev, int flag, int mode, struct proc *p) +smopen(dev_t dev, int flag, int mode, struct thread *td) { struct tty *tp; @@ -99,7 +99,7 @@ smopen(dev_t dev, int flag, int mode, struct proc *p) tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; smparam(tp, &tp->t_termios); (*linesw[tp->t_line].l_modem)(tp, 1); - } else if (tp->t_state & TS_XCLUDE && suser(p)) { + } else if (tp->t_state & TS_XCLUDE && suser_td(td)) { return EBUSY; } @@ -107,7 +107,7 @@ smopen(dev_t dev, int flag, int mode, struct proc *p) } static int -smclose(dev_t dev, int flag, int mode, struct proc *p) +smclose(dev_t dev, int flag, int mode, struct thread *td) { struct tty *tp; int s; @@ -151,7 +151,7 @@ smparam(struct tty *tp, struct termios *t) } static int -smioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +smioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct tty *tp; mousehw_t *hw; @@ -239,7 +239,7 @@ smioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return ENODEV; } - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if (error != ENOIOCTL) return error; error = ttioctl(tp, cmd, data, flag); diff --git a/sys/dev/tdfx/tdfx_pci.c b/sys/dev/tdfx/tdfx_pci.c index 7ffee6f..5594a13 100644 --- a/sys/dev/tdfx/tdfx_pci.c +++ b/sys/dev/tdfx/tdfx_pci.c @@ -407,7 +407,7 @@ tdfx_setmtrr(device_t dev) { } static int -tdfx_open(dev_t dev, int flags, int fmt, struct proc *p) +tdfx_open(dev_t dev, int flags, int fmt, struct thread *td) { /* * The open cdev method handles open(2) calls to /dev/3dfx[n] @@ -417,7 +417,7 @@ tdfx_open(dev_t dev, int flags, int fmt, struct proc *p) UNIT(minor(dev))); if(tdfx_info->busy != 0) return EBUSY; #ifdef DEBUG - printf("3dfx: Opened by #%d\n", p->p_pid); + printf("3dfx: Opened by #%d\n", td->td_proc->p_pid); #endif /* Set the driver as busy */ tdfx_info->busy++; @@ -425,7 +425,7 @@ tdfx_open(dev_t dev, int flags, int fmt, struct proc *p) } static int -tdfx_close(dev_t dev, int fflag, int devtype, struct proc* p) +tdfx_close(dev_t dev, int fflag, int devtype, struct thread *td) { /* * The close cdev method handles close(2) calls to /dev/3dfx[n] @@ -436,7 +436,7 @@ tdfx_close(dev_t dev, int fflag, int devtype, struct proc* p) if(tdfx_info->busy == 0) return EBADF; tdfx_info->busy = 0; #ifdef DEBUG - printf("Closed by #%d\n", p->p_pid); + printf("Closed by #%d\n", td->td_proc->p_pid); #endif return 0; } @@ -790,37 +790,37 @@ tdfx_do_pio(u_int cmd, struct tdfx_pio_data *piod) * want to distinguish errors from useful data, and maintain compatibility. * * There is this portion of the proc struct called p_retval[], we can store a - * return value in p->p_retval[0] and place the return value if it is positive + * return value in td->td_retval[0] and place the return value if it is positive * in there, then we can return 0 (good). If the return value is negative, we * can return -retval and the error should be properly handled. */ static int -tdfx_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc * p) +tdfx_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int retval = 0; struct tdfx_pio_data *piod = (struct tdfx_pio_data*)data; #ifdef DEBUG - printf("IOCTL'd by #%d, cmd: 0x%x, data: 0x%x\n", p->p_pid, (u_int32_t)cmd, + printf("IOCTL'd by #%d, cmd: 0x%x, data: 0x%x\n", td->td_proc->p_pid, (u_int32_t)cmd, (unsigned int)piod); #endif switch(_IOC_TYPE(cmd)) { /* Return the real error if negative, or simply stick the valid return - * in p->p_retval */ + * in td->td_retval */ case 0x33: /* The '3'(0x33) type IOCTL is for querying the installed cards */ - if((retval = tdfx_do_query(cmd, piod)) > 0) p->p_retval[0] = retval; + if((retval = tdfx_do_query(cmd, piod)) > 0) td->td_retval[0] = retval; else return -retval; break; case 0: /* The 0 type IOCTL is for programmed I/O methods */ - if((tdfx_do_pio(cmd, piod)) > 0) p->p_retval[0] = retval; + if((tdfx_do_pio(cmd, piod)) > 0) td->td_retval[0] = retval; else return -retval; break; default: /* Technically, we won't reach this from linux emu, but when glide * finally gets ported, watch out! */ #ifdef DEBUG - printf("Bad IOCTL from #%d\n", p->p_pid); + printf("Bad IOCTL from #%d\n", td->td_proc->p_pid); #endif return ENXIO; } @@ -833,7 +833,7 @@ tdfx_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc * p) * Linux emulation IOCTL for /dev/tdfx */ static int -linux_ioctl_tdfx(struct proc* p, struct linux_ioctl_args* args) +linux_ioctl_tdfx(struct thread *td, struct linux_ioctl_args* args) { int error = 0; u_long cmd = args->cmd & 0xffff; @@ -842,11 +842,11 @@ linux_ioctl_tdfx(struct proc* p, struct linux_ioctl_args* args) and one void*. */ char d_pio[2*sizeof(short) + sizeof(int) + sizeof(void*)]; - struct file *fp = p->p_fd->fd_ofiles[args->fd]; + struct file *fp = td->td_proc->p_fd->fd_ofiles[args->fd]; /* We simply copy the data and send it right to ioctl */ copyin((caddr_t)args->arg, &d_pio, sizeof(d_pio)); - error = fo_ioctl(fp, cmd, (caddr_t)&d_pio, p); + error = fo_ioctl(fp, cmd, (caddr_t)&d_pio, td); return error; } #endif /* TDFX_LINUX */ diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c index e77e11f..3543913 100644 --- a/sys/dev/twe/twe_freebsd.c +++ b/sys/dev/twe/twe_freebsd.c @@ -90,7 +90,7 @@ static struct cdevsw twe_cdevsw = { * Accept an open operation on the control device. */ static int -twe_open(dev_t dev, int flags, int fmt, struct proc *p) +twe_open(dev_t dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct twe_softc *sc = devclass_get_softc(twe_devclass, unit); @@ -103,7 +103,7 @@ twe_open(dev_t dev, int flags, int fmt, struct proc *p) * Accept the last close on the control device. */ static int -twe_close(dev_t dev, int flags, int fmt, struct proc *p) +twe_close(dev_t dev, int flags, int fmt, struct thread *td) { int unit = minor(dev); struct twe_softc *sc = devclass_get_softc(twe_devclass, unit); @@ -116,7 +116,7 @@ twe_close(dev_t dev, int flags, int fmt, struct proc *p) * Handle controller-specific control operations. */ static int -twe_ioctl_wrapper(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) +twe_ioctl_wrapper(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct thread *td) { struct twe_softc *sc = (struct twe_softc *)dev->si_drv1; @@ -599,7 +599,7 @@ static int disks_registered = 0; * for opens on subdevices (eg. slices, partitions). */ static int -twed_open(dev_t dev, int flags, int fmt, struct proc *p) +twed_open(dev_t dev, int flags, int fmt, struct thread *td) { struct twed_softc *sc = (struct twed_softc *)dev->si_drv1; struct disklabel *label; @@ -632,7 +632,7 @@ twed_open(dev_t dev, int flags, int fmt, struct proc *p) * Handle last close of the disk device. */ static int -twed_close(dev_t dev, int flags, int fmt, struct proc *p) +twed_close(dev_t dev, int flags, int fmt, struct thread *td) { struct twed_softc *sc = (struct twed_softc *)dev->si_drv1; diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 38dab89..14d8f3a 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1887,7 +1887,7 @@ ohci_abort_xfer(xfer, status) timeout(ohci_abort_xfer_end, xfer, hz / USB_FRAMES_PER_SECOND); } else { #if defined(DIAGNOSTIC) && defined(__i386__) && defined(__FreeBSD__) - KASSERT(curproc->p_intr_nesting_level == 0, + KASSERT(curthread->td_intr_nesting_level == 0, ("ohci_abort_req in interrupt context")); #endif usb_delay_ms(opipe->pipe.device->bus, 1); diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 637c7a0..2f65a8a 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -157,7 +157,7 @@ Static void ugen_isoc_rintr(usbd_xfer_handle xfer, usbd_private_handle addr, Static int ugen_do_read(struct ugen_softc *, int, struct uio *, int); Static int ugen_do_write(struct ugen_softc *, int, struct uio *, int); Static int ugen_do_ioctl(struct ugen_softc *, int, u_long, - caddr_t, int, struct proc *); + caddr_t, int, struct thread *); #if defined(__FreeBSD__) Static void ugen_make_devnodes(struct ugen_softc *sc); Static void ugen_destroy_devnodes(struct ugen_softc *sc); @@ -358,7 +358,7 @@ ugen_set_config(struct ugen_softc *sc, int configno) } int -ugenopen(dev_t dev, int flag, int mode, struct proc *p) +ugenopen(dev_t dev, int flag, int mode, struct thread *td) { struct ugen_softc *sc; int unit = UGENUNIT(dev); @@ -490,7 +490,7 @@ ugenopen(dev_t dev, int flag, int mode, struct proc *p) } int -ugenclose(dev_t dev, int flag, int mode, struct proc *p) +ugenclose(dev_t dev, int flag, int mode, struct thread *td) { int endpt = UGENENDPOINT(dev); struct ugen_softc *sc; @@ -1034,7 +1034,7 @@ ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx) Static int ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, - caddr_t addr, int flag, struct proc *p) + caddr_t addr, int flag, struct thread *td) { struct ugen_endpoint *sce; usbd_status err; @@ -1223,7 +1223,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, uio.uio_offset = 0; uio.uio_segflg = UIO_USERSPACE; uio.uio_rw = UIO_READ; - uio.uio_procp = p; + uio.uio_td = td; #if defined(__NetBSD__) || defined(__OpenBSD__) error = uiomove((caddr_t)cdesc, len, &uio); #elif defined(__FreeBSD__) @@ -1273,7 +1273,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, uio.uio_rw = ur->request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; - uio.uio_procp = p; + uio.uio_td = td; ptr = malloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); @@ -1310,7 +1310,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, } int -ugenioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +ugenioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { int endpt = UGENENDPOINT(dev); struct ugen_softc *sc; @@ -1319,14 +1319,14 @@ ugenioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) USB_GET_SC(ugen, UGENUNIT(dev), sc); sc->sc_refcnt++; - error = ugen_do_ioctl(sc, endpt, cmd, addr, flag, p); + error = ugen_do_ioctl(sc, endpt, cmd, addr, flag, td); if (--sc->sc_refcnt < 0) usb_detach_wakeup(USBDEV(sc->sc_dev)); return (error); } int -ugenpoll(dev_t dev, int events, struct proc *p) +ugenpoll(dev_t dev, int events, struct thread *td) { struct ugen_softc *sc; struct ugen_endpoint *sce; @@ -1350,7 +1350,7 @@ ugenpoll(dev_t dev, int events, struct proc *p) if (sce->q.c_cc > 0) revents |= events & (POLLIN | POLLRDNORM); else - selrecord(p, &sce->rsel); + selrecord(td, &sce->rsel); } break; case UE_ISOCHRONOUS: @@ -1358,7 +1358,7 @@ ugenpoll(dev_t dev, int events, struct proc *p) if (sce->cur != sce->fill) revents |= events & (POLLIN | POLLRDNORM); else - selrecord(p, &sce->rsel); + selrecord(td, &sce->rsel); } break; case UE_BULK: diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index 5ae6070..7358fe1 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1613,7 +1613,7 @@ uhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status) timeout(uhci_abort_xfer_end, xfer, hz / USB_FRAMES_PER_SECOND); } else { #if defined(DIAGNOSTIC) && defined(__i386__) && defined(__FreeBSD__) - KASSERT(curproc->p_intr_nesting_level == 0, + KASSERT(curthread->td_intr_nesting_level == 0, ("ohci_abort_req in interrupt context")); #endif usb_delay_ms(xfer->pipe->device->bus, 1); diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index cffc5e5..7914cb3 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -163,7 +163,7 @@ Static void uhid_intr(usbd_xfer_handle, usbd_private_handle, Static int uhid_do_read(struct uhid_softc *, struct uio *uio, int); Static int uhid_do_write(struct uhid_softc *, struct uio *uio, int); Static int uhid_do_ioctl(struct uhid_softc *, u_long, caddr_t, int, - struct proc *); + struct thread *); USB_DECLARE_DRIVER(uhid); @@ -373,11 +373,11 @@ uhid_intr(xfer, addr, status) } int -uhidopen(dev, flag, mode, p) +uhidopen(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct uhid_softc *sc; usbd_status err; @@ -422,11 +422,11 @@ uhidopen(dev, flag, mode, p) } int -uhidclose(dev, flag, mode, p) +uhidclose(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct uhid_softc *sc; @@ -588,12 +588,12 @@ uhidwrite(dev, uio, flag) } int -uhid_do_ioctl(sc, cmd, addr, flag, p) +uhid_do_ioctl(sc, cmd, addr, flag, td) struct uhid_softc *sc; u_long cmd; caddr_t addr; int flag; - struct proc *p; + struct thread *td; { struct usb_ctl_report_desc *rd; struct usb_ctl_report *re; @@ -614,8 +614,8 @@ uhid_do_ioctl(sc, cmd, addr, flag, p) if (*(int *)addr) { if (sc->sc_async != NULL) return (EBUSY); - sc->sc_async = p; - DPRINTF(("uhid_do_ioctl: FIOASYNC %p\n", p)); + sc->sc_async = td->td_proc; /* XXXKSE */ + DPRINTF(("uhid_do_ioctl: FIOASYNC %p\n", td->td_proc)); } else sc->sc_async = NULL; break; @@ -703,12 +703,12 @@ uhid_do_ioctl(sc, cmd, addr, flag, p) } int -uhidioctl(dev, cmd, addr, flag, p) +uhidioctl(dev, cmd, addr, flag, td) dev_t dev; u_long cmd; caddr_t addr; int flag; - struct proc *p; + struct thread *td; { struct uhid_softc *sc; int error; @@ -716,17 +716,17 @@ uhidioctl(dev, cmd, addr, flag, p) USB_GET_SC(uhid, UHIDUNIT(dev), sc); sc->sc_refcnt++; - error = uhid_do_ioctl(sc, cmd, addr, flag, p); + error = uhid_do_ioctl(sc, cmd, addr, flag, td); if (--sc->sc_refcnt < 0) usb_detach_wakeup(USBDEV(sc->sc_dev)); return (error); } int -uhidpoll(dev, events, p) +uhidpoll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { struct uhid_softc *sc; int revents = 0; @@ -744,7 +744,7 @@ uhidpoll(dev, events, p) if (sc->sc_q.c_cc > 0) revents |= events & (POLLIN | POLLRDNORM); else - selrecord(p, &sc->sc_rsel); + selrecord(td, &sc->sc_rsel); } splx(s); diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index 524bc83..052583b 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -467,7 +467,7 @@ int ulptusein = 1; * Reset the printer, then wait until it's selected and not busy. */ int -ulptopen(dev_t dev, int flag, int mode, struct proc *p) +ulptopen(dev_t dev, int flag, int mode, struct thread *td) { u_char flags = ULPTFLAGS(dev); struct ulpt_softc *sc; @@ -586,7 +586,7 @@ ulpt_statusmsg(u_char status, struct ulpt_softc *sc) } int -ulptclose(dev_t dev, int flag, int mode, struct proc *p) +ulptclose(dev_t dev, int flag, int mode, struct thread *td) { struct ulpt_softc *sc; @@ -676,7 +676,7 @@ ulptwrite(dev_t dev, struct uio *uio, int flags) } int -ulptioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +ulptioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int error = 0; diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c index 05c9a47..ad24d94 100644 --- a/sys/dev/usb/umodem.c +++ b/sys/dev/usb/umodem.c @@ -571,10 +571,10 @@ umodemparam(tp, t) } int -umodemopen(dev, flag, mode, p) +umodemopen(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { int unit = UMODEMUNIT(dev); struct umodem_softc *sc; @@ -599,7 +599,7 @@ umodemopen(dev, flag, mode, p) if (ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_XCLUDE) && - suser(p)) + suser_td(td)) return (EBUSY); /* @@ -781,10 +781,10 @@ umodemreadcb(xfer, p, status) } int -umodemclose(dev, flag, mode, p) +umodemclose(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { struct umodem_softc *sc; struct tty *tp; @@ -924,12 +924,12 @@ umodemtty(dev) } int -umodemioctl(dev, cmd, data, flag, p) +umodemioctl(dev, cmd, data, flag, td) dev_t dev; u_long cmd; caddr_t data; int flag; - struct proc *p; + struct thread *td; { struct umodem_softc *sc; struct tty *tp; @@ -946,12 +946,12 @@ umodemioctl(dev, cmd, data, flag, p) DPRINTF(("umodemioctl: cmd=0x%08lx\n", cmd)); - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, td); if (error >= 0) return (error); #if defined(__NetBSD__) || defined(__OpenBSD__) - error = ttioctl(tp, cmd, data, flag, p); + error = ttioctl(tp, cmd, data, flag, td); #elif defined(__FreeBSD__) error = ttioctl(tp, cmd, data, flag); #endif diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index ffabb7b..2a72120 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -586,7 +586,7 @@ ums_disable(priv) } Static int -ums_open(dev_t dev, int flag, int fmt, struct proc *p) +ums_open(dev_t dev, int flag, int fmt, struct thread *td) { struct ums_softc *sc; @@ -596,7 +596,7 @@ ums_open(dev_t dev, int flag, int fmt, struct proc *p) } Static int -ums_close(dev_t dev, int flag, int fmt, struct proc *p) +ums_close(dev_t dev, int flag, int fmt, struct thread *td) { struct ums_softc *sc; @@ -682,7 +682,7 @@ ums_read(dev_t dev, struct uio *uio, int flag) } Static int -ums_poll(dev_t dev, int events, struct proc *p) +ums_poll(dev_t dev, int events, struct thread *td) { struct ums_softc *sc; int revents = 0; @@ -699,7 +699,7 @@ ums_poll(dev_t dev, int events, struct proc *p) revents = events & (POLLIN | POLLRDNORM); } else { sc->state |= UMS_SELECT; - selrecord(p, &sc->rsel); + selrecord(td, &sc->rsel); } } splx(s); @@ -708,7 +708,7 @@ ums_poll(dev_t dev, int events, struct proc *p) } int -ums_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +ums_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct ums_softc *sc; int error = 0; diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c index 1e86195..e1ad11b 100644 --- a/sys/dev/usb/urio.c +++ b/sys/dev/usb/urio.c @@ -291,11 +291,11 @@ USB_ATTACH(urio) int -urioopen(dev, flag, mode, p) +urioopen(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { #if (USBDI >= 1) struct urio_softc * sc; @@ -335,11 +335,11 @@ urioopen(dev, flag, mode, p) } int -urioclose(dev, flag, mode, p) +urioclose(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { #if (USBDI >= 1) struct urio_softc * sc; @@ -509,12 +509,12 @@ uriowrite(dev, uio, flag) int -urioioctl(dev, cmd, addr, flag, p) +urioioctl(dev, cmd, addr, flag, td) dev_t dev; u_long cmd; caddr_t addr; int flag; - struct proc *p; + struct thread *td; { #if (USBDI >= 1) struct urio_softc * sc; @@ -584,7 +584,7 @@ urioioctl(dev, cmd, addr, flag, p) uio.uio_rw = req.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; - uio.uio_procp = p; + uio.uio_td = td; ptr = malloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 2b4ad42..9457ef2 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -129,7 +129,7 @@ d_open_t usbopen; d_close_t usbclose; d_read_t usbread; d_ioctl_t usbioctl; -int usbpoll(dev_t, int, struct proc *); +d_poll_t usbpoll; struct cdevsw usb_cdevsw = { /* open */ usbopen, @@ -336,10 +336,10 @@ usbctlprint(aux, pnp) #endif /* defined(__NetBSD__) || defined(__OpenBSD__) */ int -usbopen(dev, flag, mode, p) +usbopen(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { int unit = USBUNIT(dev); struct usb_softc *sc; @@ -398,10 +398,10 @@ usbread(dev, uio, flag) } int -usbclose(dev, flag, mode, p) +usbclose(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { int unit = USBUNIT(dev); @@ -414,12 +414,12 @@ usbclose(dev, flag, mode, p) } int -usbioctl(devt, cmd, data, flag, p) +usbioctl(devt, cmd, data, flag, td) dev_t devt; u_long cmd; caddr_t data; int flag; - struct proc *p; + struct thread *td; { struct usb_softc *sc; int unit = USBUNIT(devt); @@ -432,7 +432,7 @@ usbioctl(devt, cmd, data, flag, p) case FIOASYNC: if (*(int *)data) - usb_async_proc = p; + usb_async_proc = td->td_proc; else usb_async_proc = 0; return (0); @@ -492,7 +492,7 @@ usbioctl(devt, cmd, data, flag, p) uio.uio_rw = ur->request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; - uio.uio_procp = p; + uio.uio_td = td; ptr = malloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); @@ -545,10 +545,10 @@ usbioctl(devt, cmd, data, flag, p) } int -usbpoll(dev, events, p) +usbpoll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { int revents, mask, s; int unit = USBUNIT(dev); @@ -562,7 +562,7 @@ usbpoll(dev, events, p) revents |= events & mask; if (revents == 0 && (events & mask)) { DPRINTFN(2,("usb: sleeping on %p\n", &usb_selevent)); - selrecord(p, &usb_selevent); + selrecord(curthread, &usb_selevent); } splx(s); diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index 9acffce..20d6a03 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -931,7 +931,7 @@ usbd_do_request_flags(dev, req, data, flags, actlen) #ifdef DIAGNOSTIC #if defined(__i386__) && defined(__FreeBSD__) - KASSERT(curproc->p_intr_nesting_level == 0, + KASSERT(curthread->td_intr_nesting_level == 0, ("usbd_do_request: in interrupt context")); #endif if (dev->bus->intr_context) { diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c index 46728bc..bd33a20 100644 --- a/sys/dev/usb/uscanner.c +++ b/sys/dev/usb/uscanner.c @@ -325,11 +325,11 @@ USB_ATTACH(uscanner) } int -uscanneropen(dev, flag, mode, p) +uscanneropen(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct uscanner_softc *sc; int unit = USCANNERUNIT(dev); @@ -388,11 +388,11 @@ uscanneropen(dev, flag, mode, p) } int -uscannerclose(dev, flag, mode, p) +uscannerclose(dev, flag, mode, td) dev_t dev; int flag; int mode; - struct proc *p; + struct thread *td; { struct uscanner_softc *sc; @@ -639,10 +639,10 @@ USB_DETACH(uscanner) } int -uscannerpoll(dev, events, p) +uscannerpoll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { struct uscanner_softc *sc; int revents = 0; diff --git a/sys/dev/vinum/vinum.c b/sys/dev/vinum/vinum.c index 5824d84..8ac6afa 100644 --- a/sys/dev/vinum/vinum.c +++ b/sys/dev/vinum/vinum.c @@ -238,7 +238,7 @@ vinum_modevent(module_t mod, modeventtype_t type, void *unused) if (!vinum_inactive(1)) /* is anything open? */ return EBUSY; /* yes, we can't do it */ vinum_conf.flags |= VF_STOPPING; /* note that we want to stop */ - sync(curproc, &dummyarg); /* write out buffers */ + sync(curthread, &dummyarg); /* write out buffers */ free_vinum(0); /* clean up */ #ifdef VINUMDEBUG if (total_malloced) { @@ -293,7 +293,7 @@ int vinumopen(dev_t dev, int flags, int fmt, - struct proc *p) + struct thread *td) { int error; unsigned int index; @@ -378,7 +378,7 @@ vinumopen(dev_t dev, } case VINUM_SUPERDEV_TYPE: - error = suser(p); /* are we root? */ + error = suser_td(td); /* are we root? */ if (error == 0) { /* yes, can do */ if (devminor == VINUM_DAEMON_DEV) /* daemon device */ vinum_conf.flags |= VF_DAEMONOPEN; /* we're open */ @@ -402,7 +402,7 @@ int vinumclose(dev_t dev, int flags, int fmt, - struct proc *p) + struct thread *td) { unsigned int index; struct volume *vol; diff --git a/sys/dev/vinum/vinumext.h b/sys/dev/vinum/vinumext.h index 9b96df8..9d98ee8 100644 --- a/sys/dev/vinum/vinumext.h +++ b/sys/dev/vinum/vinumext.h @@ -62,7 +62,7 @@ extern int debug; /* debug flags */ } #ifndef _KERNEL struct vnode; -struct proc; +struct thread; #endif #ifdef _KERNEL @@ -117,7 +117,7 @@ void remove_plex_entry(int plexno, int force, int recurse); void remove_volume_entry(int volno, int force, int recurse); void checkdiskconfig(char *); -int open_drive(struct drive *, struct proc *, int); +int open_drive(struct drive *, struct thread *, int); void close_drive(struct drive *drive); void close_locked_drive(struct drive *drive); int driveio(struct drive *, char *, size_t, off_t, int); @@ -245,7 +245,7 @@ void FFree(void *mem, char *, int); #define LOCKDRIVE(d) lockdrive (d, __FILE__, __LINE__) #else #define Malloc(x) malloc((x), M_DEVBUF, \ - curproc->p_intr_nesting_level == 0? M_WAITOK: M_NOWAIT) + curthread->td_proc->p_intr_nesting_level == 0? M_WAITOK: M_NOWAIT) #define Free(x) free((x), M_DEVBUF) #define LOCKDRIVE(d) lockdrive (d) #endif diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c index 564d21c..f329137 100644 --- a/sys/dev/vinum/vinumio.c +++ b/sys/dev/vinum/vinumio.c @@ -49,7 +49,7 @@ static int drivecmp(const void *va, const void *vb); * Return an error number */ int -open_drive(struct drive *drive, struct proc *p, int verbose) +open_drive(struct drive *drive, struct thread *td, int verbose) { int devmajor; /* major devs for disk device */ int devminor; /* minor devs for disk device */ @@ -216,7 +216,7 @@ init_drive(struct drive *drive, int verbose) log(LOG_ERR, "vinum: Can't open drive without drive name\n"); return EINVAL; } - drive->lasterror = open_drive(drive, curproc, verbose); /* open the drive */ + drive->lasterror = open_drive(drive, curthread, verbose); /* open the drive */ if (drive->lasterror) return drive->lasterror; @@ -224,7 +224,7 @@ init_drive(struct drive *drive, int verbose) DIOCGPART, (caddr_t) & drive->partinfo, FREAD, - curproc); + curthread); if (drive->lasterror) { if (verbose) log(LOG_WARNING, @@ -669,7 +669,7 @@ daemon_save_config(void) DIOCWLABEL, (caddr_t) & wlabel_on, FWRITE, - curproc); + curthread); if (error == 0) error = write_drive(drive, (char *) vhdr, VINUMHEADERLEN, VINUM_LABEL_OFFSET); if (error == 0) @@ -682,7 +682,7 @@ daemon_save_config(void) DIOCWLABEL, (caddr_t) & wlabel_on, FWRITE, - curproc); + curthread); unlockdrive(drive); if (error) { log(LOG_ERR, diff --git a/sys/dev/vinum/vinumioctl.c b/sys/dev/vinum/vinumioctl.c index bef310b..aeafdd2 100644 --- a/sys/dev/vinum/vinumioctl.c +++ b/sys/dev/vinum/vinumioctl.c @@ -66,7 +66,7 @@ vinumioctl(dev_t dev, u_long cmd, caddr_t data, int flag, - struct proc *p) + struct thread *td) { unsigned int objno; int error = 0; @@ -319,8 +319,8 @@ vinumioctl(dev_t dev, default: log(LOG_WARNING, "vinumioctl: invalid ioctl from process %d (%s): %lx\n", - curproc->p_pid, - curproc->p_comm, + curthread->td_proc->p_pid, + curthread->td_proc->p_comm, cmd); return EINVAL; diff --git a/sys/dev/vinum/vinummemory.c b/sys/dev/vinum/vinummemory.c index 5a2093b..6936e48 100644 --- a/sys/dev/vinum/vinummemory.c +++ b/sys/dev/vinum/vinummemory.c @@ -152,7 +152,7 @@ MMalloc(int size, char *file, int line) /* Wait for malloc if we can */ result = malloc(size, M_DEVBUF, - curproc->p_intr_nesting_level == 0 ? M_WAITOK : M_NOWAIT); + curthread->td_intr_nesting_level == 0 ? M_WAITOK : M_NOWAIT); if (result == NULL) log(LOG_ERR, "vinum: can't allocate %d bytes from %s:%d\n", size, file, line); else { diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 9c7230f..19394c8 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -72,6 +72,7 @@ #include <sys/systm.h> #include <sys/sockio.h> #include <sys/mbuf.h> +#include <sys/proc.h> #include <sys/kernel.h> #include <sys/socket.h> #include <sys/module.h> diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c index 0267d93..5ce3dc2 100644 --- a/sys/dev/wl/if_wl.c +++ b/sys/dev/wl/if_wl.c @@ -1145,7 +1145,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data) short base = sc->base; short mode = 0; int opri, error = 0; - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ int irq, irqval, i, isroot; caddr_t up; #ifdef WLCACHE @@ -1254,7 +1254,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* pointer to buffer in user space */ up = (void *)ifr->ifr_data; /* work out if they're root */ - isroot = (suser(p) == 0); + isroot = (suser_td(td) == 0); for (i = 0; i < 0x40; i++) { /* don't hand the DES key out to non-root users */ @@ -1269,7 +1269,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* copy the PSA in from the caller; we only copy _some_ values */ case SIOCSWLPSA: /* root only */ - if ((error = suser(p))) + if ((error = suser_td(td))) break; error = EINVAL; /* assume the worst */ /* pointer to buffer in user space containing data */ @@ -1323,7 +1323,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data) */ case SIOCSWLCNWID: /* root only */ - if ((error = suser(p))) + if ((error = suser_td(td))) break; if (!(ifp->if_flags & IFF_UP)) { error = EIO; /* only allowed while up */ @@ -1341,7 +1341,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* copy the EEPROM in 2.4 Gz WaveMODEM out to the caller */ case SIOCGWLEEPROM: /* root only */ - if ((error = suser(p))) + if ((error = suser_td(td))) break; /* pointer to buffer in user space */ up = (void *)ifr->ifr_data; @@ -1364,7 +1364,7 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* zero (Delete) the wl cache */ case SIOCDWLCACHE: /* root only */ - if ((error = suser(p))) + if ((error = suser_td(td))) break; wl_cache_zero(unit); break; |