From 41c20dac9ca2167a1e232a8098c4e809a29d75ce Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 23 Jun 2003 17:55:51 +0000 Subject: [PATCH] proc->thread stage 2: MAJOR revamping of system calls, ucred, jail API, and some work on the low level device interface (proc arg -> thread arg). As -current did, I have removed p_cred and incorporated its functions into p_ucred. p_prison has also been moved into p_ucred and adjusted accordingly. The jail interface tests now uses ucreds rather then processes. The syscall(p,uap) interface has been changed to just (uap). This is inclusive of the emulation code. It makes little sense to pass a proc pointer around which confuses the MP readability of the code, because most system call code will only work with the current process anyway. Note that eventually *ALL* syscall emulation code will be moved to a kernel-protected userland layer because it really makes no sense whatsoever to implement these emulations in the kernel. suser() now takes no arguments and only operates with the current process. The process argument has been removed from suser_xxx() so it now just takes a ucred and flags. The sysctl interface was adjusted somewhat. --- sys/bus/cam/cam_xpt.c | 8 +- sys/bus/cam/scsi/scsi_cd.c | 8 +- sys/bus/cam/scsi/scsi_ch.c | 8 +- sys/bus/cam/scsi/scsi_da.c | 8 +- sys/bus/cam/scsi/scsi_pass.c | 8 +- sys/bus/cam/scsi/scsi_sa.c | 8 +- sys/bus/firewire/firewirereg.h | 4 +- sys/bus/firewire/fwdev.c | 5 +- sys/bus/pccard/pccard.c | 13 +- sys/bus/pci/pci.c | 8 +- sys/bus/usb/usb.c | 16 +- sys/bus/usb/usb_port.h | 4 +- sys/contrib/ipfilter/netinet/ip_fil.c | 19 +- sys/contrib/ipfilter/netinet/ip_fil.h | 8 +- sys/ddb/db_ps.c | 4 +- sys/dev/agp/agp.c | 8 +- sys/dev/disk/ata/ata-all.c | 4 +- sys/dev/disk/ata/ata-disk.c | 6 +- sys/dev/disk/ata/ata-raid.c | 4 +- sys/dev/disk/ata/atapi-cd.c | 11 +- sys/dev/disk/ata/atapi-fd.c | 8 +- sys/dev/disk/ata/atapi-tape.c | 8 +- sys/dev/disk/ccd/ccd.c | 29 +- sys/dev/disk/fd/fd.c | 26 +- sys/dev/disk/isp/isp_freebsd.c | 12 +- sys/dev/disk/isp/isp_freebsd.h | 4 +- sys/dev/disk/md/md.c | 10 +- sys/dev/disk/vn/vn.c | 39 +- sys/dev/misc/joy/joy.c | 8 +- sys/dev/misc/kbd/kbd.c | 12 +- sys/dev/misc/lpt/lpt.c | 8 +- sys/dev/misc/nmdm/nmdm.c | 30 +- sys/dev/misc/ppi/ppi.c | 8 +- sys/dev/misc/psm/psm.c | 12 +- sys/dev/misc/snp/snp.c | 27 +- sys/dev/misc/streams/streams.c | 9 +- sys/dev/misc/syscons/schistory.c | 4 +- sys/dev/misc/syscons/scmouse.c | 8 +- sys/dev/misc/syscons/scterm-dumb.c | 4 +- sys/dev/misc/syscons/scterm-sc.c | 4 +- sys/dev/misc/syscons/scvesactl.c | 6 +- sys/dev/misc/syscons/scvidctl.c | 4 +- sys/dev/misc/syscons/syscons.c | 25 +- sys/dev/misc/syscons/syscons.h | 12 +- sys/dev/misc/syscons/sysmouse.c | 12 +- sys/dev/netif/an/if_an.c | 12 +- sys/dev/netif/awi/awi.c | 7 +- sys/dev/netif/awi/awi_wep.c | 5 +- sys/dev/netif/awi/awi_wicfg.c | 8 +- sys/dev/netif/sbni/if_sbni.c | 9 +- sys/dev/netif/sbsh/if_sbsh.c | 12 +- sys/dev/netif/wi/if_wi.c | 14 +- sys/dev/netif/wi/wi_hostap.c | 10 +- sys/dev/raid/aac/aacvar.h | 4 +- sys/dev/raid/asr/asr.c | 14 +- sys/dev/raid/ida/ida.c | 5 +- sys/dev/raid/ida/ida_disk.c | 6 +- sys/dev/raid/mlx/mlx.c | 10 +- sys/dev/raid/mlx/mlx_disk.c | 10 +- sys/dev/raid/mlx/mlxvar.h | 4 +- sys/dev/raid/mly/mly.c | 8 +- sys/dev/raid/vinum/vinum.c | 22 +- sys/dev/raid/vinum/vinumio.c | 8 +- sys/dev/raid/vinum/vinumioctl.c | 8 +- sys/dev/serial/rp/rp.c | 32 +- sys/dev/serial/sio/sio.c | 29 +- sys/dev/sound/isa/i386/spkr/spkr.c | 21 +- sys/dev/sound/pcm/channel.c | 6 +- sys/dev/sound/pcm/dsp.c | 21 +- sys/dev/sound/pcm/mixer.c | 10 +- sys/dev/sound/pcm/mixer.h | 4 +- sys/dev/sound/pcm/sndstat.c | 8 +- sys/dev/usbmisc/ucom/ucom.c | 9 +- sys/dev/usbmisc/ugen/ugen.c | 6 +- sys/dev/usbmisc/uhid/uhid.c | 4 +- sys/dev/usbmisc/umodem/umodem.c | 7 +- sys/dev/usbmisc/urio/urio.c | 5 +- sys/dev/video/bktr/bktr_core.c | 9 +- sys/dev/video/bktr/bktr_core.h | 6 +- sys/dev/video/bktr/bktr_os.c | 38 +- sys/emulation/ibcs2/i386/ibcs2_fcntl.c | 52 +- sys/emulation/ibcs2/i386/ibcs2_ioctl.c | 65 +- sys/emulation/ibcs2/i386/ibcs2_ipc.c | 50 +- sys/emulation/ibcs2/i386/ibcs2_isc.c | 7 +- sys/emulation/ibcs2/i386/ibcs2_isc_syscall.h | 5 +- sys/emulation/ibcs2/i386/ibcs2_isc_sysent.c | 5 +- sys/emulation/ibcs2/i386/ibcs2_misc.c | 289 ++--- sys/emulation/ibcs2/i386/ibcs2_msg.c | 17 +- sys/emulation/ibcs2/i386/ibcs2_other.c | 21 +- sys/emulation/ibcs2/i386/ibcs2_proto.h | 119 +- sys/emulation/ibcs2/i386/ibcs2_signal.c | 52 +- sys/emulation/ibcs2/i386/ibcs2_socksys.c | 66 +- sys/emulation/ibcs2/i386/ibcs2_socksys.h | 2 +- sys/emulation/ibcs2/i386/ibcs2_stat.c | 44 +- sys/emulation/ibcs2/i386/ibcs2_syscall.h | 5 +- sys/emulation/ibcs2/i386/ibcs2_sysent.c | 5 +- sys/emulation/ibcs2/i386/ibcs2_sysi86.c | 8 +- sys/emulation/ibcs2/i386/ibcs2_util.c | 6 +- sys/emulation/ibcs2/i386/ibcs2_util.h | 12 +- sys/emulation/ibcs2/i386/ibcs2_xenix.c | 47 +- sys/emulation/ibcs2/i386/ibcs2_xenix.h | 41 +- .../ibcs2/i386/ibcs2_xenix_syscall.h | 5 +- sys/emulation/ibcs2/i386/ibcs2_xenix_sysent.c | 5 +- .../linux/i386/linprocfs/linprocfs_misc.c | 19 +- .../linux/i386/linprocfs/linprocfs_vnops.c | 25 +- sys/emulation/linux/i386/linux_machdep.c | 102 +- sys/emulation/linux/i386/linux_proto.h | 313 +++-- sys/emulation/linux/i386/linux_ptrace.c | 7 +- sys/emulation/linux/i386/linux_syscall.h | 5 +- sys/emulation/linux/i386/linux_sysent.c | 5 +- sys/emulation/linux/i386/linux_sysvec.c | 30 +- sys/emulation/linux/linux_file.c | 196 ++- sys/emulation/linux/linux_getcwd.c | 7 +- sys/emulation/linux/linux_ioctl.c | 235 ++-- sys/emulation/linux/linux_ipc.c | 56 +- sys/emulation/linux/linux_ipc.h | 24 +- sys/emulation/linux/linux_mib.c | 14 +- sys/emulation/linux/linux_misc.c | 146 ++- sys/emulation/linux/linux_signal.c | 40 +- sys/emulation/linux/linux_signal.h | 5 +- sys/emulation/linux/linux_socket.c | 123 +- sys/emulation/linux/linux_stats.c | 39 +- sys/emulation/linux/linux_sysctl.c | 4 +- sys/emulation/linux/linux_uid16.c | 66 +- sys/emulation/linux/linux_util.c | 4 +- sys/emulation/linux/linux_util.h | 21 +- sys/emulation/posix4/p1003_1b.c | 107 +- sys/emulation/svr4/i386/svr4_machdep.c | 6 +- sys/emulation/svr4/svr4_fcntl.c | 92 +- sys/emulation/svr4/svr4_filio.c | 20 +- sys/emulation/svr4/svr4_ioctl.c | 7 +- sys/emulation/svr4/svr4_misc.c | 239 ++-- sys/emulation/svr4/svr4_proto.h | 161 ++- sys/emulation/svr4/svr4_resource.c | 26 +- sys/emulation/svr4/svr4_signal.c | 64 +- sys/emulation/svr4/svr4_socket.c | 8 +- sys/emulation/svr4/svr4_stat.c | 128 +- sys/emulation/svr4/svr4_stream.c | 92 +- sys/emulation/svr4/svr4_syscall.h | 5 +- sys/emulation/svr4/svr4_syscallnames.c | 5 +- sys/emulation/svr4/svr4_sysent.c | 5 +- sys/emulation/svr4/svr4_sysvec.c | 14 +- sys/emulation/svr4/svr4_util.h | 13 +- sys/i386/apm/apm.c | 12 +- sys/i386/i386/genassym.c | 4 +- sys/i386/i386/machdep.c | 29 +- sys/i386/i386/mem.c | 64 +- sys/i386/i386/perfmon.c | 8 +- sys/i386/i386/sys_machdep.c | 18 +- sys/i386/i386/trap.c | 13 +- sys/i386/i386/vm86.c | 4 +- sys/kern/init_main.c | 13 +- sys/kern/init_sysent.c | 4 +- sys/kern/kern_acct.c | 11 +- sys/kern/kern_acl.c | 66 +- sys/kern/kern_descrip.c | 156 +-- sys/kern/kern_event.c | 12 +- sys/kern/kern_exec.c | 26 +- sys/kern/kern_exit.c | 86 +- sys/kern/kern_fork.c | 37 +- sys/kern/kern_jail.c | 48 +- sys/kern/kern_kthread.c | 4 +- sys/kern/kern_ktrace.c | 34 +- sys/kern/kern_linker.c | 27 +- sys/kern/kern_memio.c | 64 +- sys/kern/kern_mib.c | 12 +- sys/kern/kern_module.c | 14 +- sys/kern/kern_ntptime.c | 10 +- sys/kern/kern_p1003_1b.c | 107 +- sys/kern/kern_proc.c | 20 +- sys/kern/kern_prot.c | 637 +++++----- sys/kern/kern_random.c | 6 +- sys/kern/kern_resource.c | 120 +- sys/kern/kern_shutdown.c | 15 +- sys/kern/kern_sig.c | 165 +-- sys/kern/kern_syscalls.c | 6 +- sys/kern/kern_sysctl.c | 52 +- sys/kern/kern_threads.c | 14 +- sys/kern/kern_time.c | 58 +- sys/kern/kern_xxx.c | 56 +- sys/kern/makesyscalls.sh | 7 +- sys/kern/subr_disk.c | 16 +- sys/kern/subr_diskslice.c | 7 +- sys/kern/subr_log.c | 15 +- sys/kern/subr_prof.c | 9 +- sys/kern/subr_xxx.c | 22 +- sys/kern/sys_generic.c | 144 +-- sys/kern/sys_pipe.c | 15 +- sys/kern/sys_process.c | 12 +- sys/kern/syscalls.c | 4 +- sys/kern/sysv_ipc.c | 11 +- sys/kern/sysv_msg.c | 54 +- sys/kern/sysv_sem.c | 41 +- sys/kern/sysv_shm.c | 52 +- sys/kern/tty.c | 24 +- sys/kern/tty_conf.c | 6 +- sys/kern/tty_cons.c | 33 +- sys/kern/tty_pty.c | 46 +- sys/kern/tty_tty.c | 43 +- sys/kern/uipc_socket.c | 8 +- sys/kern/uipc_syscalls.c | 345 ++--- sys/kern/uipc_usrreq.c | 10 +- sys/kern/vfs_aio.c | 40 +- sys/kern/vfs_cache.c | 8 +- sys/kern/vfs_subr.c | 4 +- sys/kern/vfs_syscalls.c | 1124 +++++------------ sys/kern/vfs_vnops.c | 4 +- sys/net/bpf.c | 39 +- sys/net/gre/if_gre.c | 19 +- sys/net/if.c | 42 +- sys/net/ppp/if_ppp.c | 16 +- sys/net/ppp_layer/ppp_tty.c | 30 +- sys/net/raw_usrreq.c | 4 +- sys/net/rtsock.c | 6 +- sys/net/sl/if_sl.c | 22 +- sys/net/tap/if_tap.c | 33 +- sys/net/tun/if_tun.c | 32 +- sys/netgraph/socket/ng_socket.c | 4 +- sys/netgraph/tty/ng_tty.c | 8 +- sys/netinet/in.c | 8 +- sys/netinet/in_gif.c | 4 +- sys/netinet/in_pcb.c | 16 +- sys/netinet/ip_divert.c | 6 +- sys/netinet/raw_ip.c | 4 +- sys/netinet/tcp_subr.c | 6 +- sys/netinet/udp_usrreq.c | 6 +- sys/netinet6/in6.c | 4 +- sys/netinet6/in6_pcb.c | 4 +- sys/netinet6/in6_src.c | 4 +- sys/netinet6/ip6_input.c | 4 +- sys/netinet6/ip6_output.c | 11 +- sys/netinet6/raw_ip6.c | 4 +- sys/netinet6/udp6_output.c | 4 +- sys/netinet6/udp6_usrreq.c | 4 +- sys/netproto/ncp/ncp_subr.h | 4 +- sys/netproto/smb/smb_dev.c | 17 +- sys/netproto/smb/smb_subr.c | 4 +- sys/netproto/smb/smb_subr.h | 4 +- sys/platform/pc32/apm/apm.c | 12 +- sys/platform/pc32/i386/genassym.c | 4 +- sys/platform/pc32/i386/machdep.c | 29 +- sys/platform/pc32/i386/mem.c | 64 +- sys/platform/pc32/i386/perfmon.c | 8 +- sys/platform/pc32/i386/sys_machdep.c | 18 +- sys/platform/pc32/i386/trap.c | 13 +- sys/platform/pc32/i386/vm86.c | 4 +- sys/platform/vkernel/i386/genassym.c | 4 +- sys/sys/conf.h | 16 +- sys/sys/filedesc.h | 4 +- sys/sys/proc.h | 40 +- sys/sys/random.h | 6 +- sys/sys/select.h | 6 +- sys/sys/signalvar.h | 4 +- sys/sys/syscall-hide.h | 4 +- sys/sys/syscall.h | 4 +- sys/sys/syscall.mk | 4 +- sys/sys/sysctl.h | 8 +- sys/sys/sysent.h | 4 +- sys/sys/sysproto.h | 544 ++++---- sys/sys/systm.h | 7 +- sys/sys/tty.h | 4 +- sys/sys/ucred.h | 15 +- sys/sys/user.h | 3 +- sys/vfs/coda/coda_psdev.c | 36 +- sys/vfs/coda/coda_psdev.h | 10 +- sys/vfs/coda/coda_vfsops.c | 4 +- sys/vfs/fdesc/fdesc_vnops.c | 4 +- sys/vfs/isofs/cd9660/cd9660_vfsops.c | 8 +- sys/vfs/mfs/mfs_vnops.c | 4 +- sys/vfs/msdosfs/msdosfs_vnops.c | 10 +- sys/vfs/nfs/nfs_serv.c | 6 +- sys/vfs/nfs/nfs_syscalls.c | 17 +- sys/vfs/nwfs/nwfs_vfsops.c | 4 +- sys/vfs/portal/portal_vnops.c | 4 +- sys/vfs/procfs/procfs.h | 10 +- sys/vfs/procfs/procfs_ctl.c | 4 +- sys/vfs/procfs/procfs_dbregs.c | 4 +- sys/vfs/procfs/procfs_fpregs.c | 4 +- sys/vfs/procfs/procfs_mem.c | 4 +- sys/vfs/procfs/procfs_regs.c | 4 +- sys/vfs/procfs/procfs_status.c | 16 +- sys/vfs/procfs/procfs_vnops.c | 22 +- sys/vfs/smbfs/smbfs_vnops.c | 4 +- sys/vfs/specfs/spec_vnops.c | 10 +- sys/vfs/ufs/ufs_vnops.c | 15 +- sys/vfs/umapfs/umap_vfsops.c | 4 +- sys/vm/vm_mmap.c | 228 ++-- sys/vm/vm_swap.c | 17 +- sys/vm/vm_unix.c | 32 +- 289 files changed, 4486 insertions(+), 5625 deletions(-) diff --git a/sys/bus/cam/cam_xpt.c b/sys/bus/cam/cam_xpt.c index ad720622a3..97d7dfd4d1 100644 --- a/sys/bus/cam/cam_xpt.c +++ b/sys/bus/cam/cam_xpt.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/cam_xpt.c,v 1.80.2.18 2002/12/09 17:31:55 gibbs Exp $ - * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.2 2003/06/17 04:28:18 dillon Exp $ + * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.3 2003/06/23 17:55:24 dillon Exp $ */ #include #include @@ -895,7 +895,7 @@ xptdone(struct cam_periph *periph, union ccb *done_ccb) } static int -xptopen(dev_t dev, int flags, int fmt, struct proc *p) +xptopen(dev_t dev, int flags, int fmt, struct thread *td) { int unit; @@ -932,7 +932,7 @@ xptopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -xptclose(dev_t dev, int flag, int fmt, struct proc *p) +xptclose(dev_t dev, int flag, int fmt, struct thread *td) { int unit; @@ -955,7 +955,7 @@ xptclose(dev_t dev, int flag, int fmt, struct proc *p) } static int -xptioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +xptioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { int unit, error; diff --git a/sys/bus/cam/scsi/scsi_cd.c b/sys/bus/cam/scsi/scsi_cd.c index 9f4823718a..2d0a40d76d 100644 --- a/sys/bus/cam/scsi/scsi_cd.c +++ b/sys/bus/cam/scsi/scsi_cd.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_cd.c,v 1.31.2.13 2002/11/25 05:30:31 njl Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_cd.c,v 1.3 2003/06/19 01:54:55 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_cd.c,v 1.4 2003/06/23 17:55:26 dillon Exp $ */ /* * Portions of this driver taken from the original FreeBSD cd driver. @@ -882,7 +882,7 @@ cdregisterexit: } static int -cdopen(dev_t dev, int flags, int fmt, struct proc *p) +cdopen(dev_t dev, int flags, int fmt, struct thread *td) { struct disklabel *label; struct cam_periph *periph; @@ -994,7 +994,7 @@ cdopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -cdclose(dev_t dev, int flag, int fmt, struct proc *p) +cdclose(dev_t dev, int flag, int fmt, struct thread *td) { struct cam_periph *periph; struct cd_softc *softc; @@ -1821,7 +1821,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) } static int -cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct cam_periph *periph; diff --git a/sys/bus/cam/scsi/scsi_ch.c b/sys/bus/cam/scsi/scsi_ch.c index c3c5fb1fdb..ac5c64343a 100644 --- a/sys/bus/cam/scsi/scsi_ch.c +++ b/sys/bus/cam/scsi/scsi_ch.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_ch.c,v 1.20.2.2 2000/10/31 08:09:49 dwmalone Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_ch.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_ch.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ /* * Derived from the NetBSD SCSI changer driver. @@ -427,7 +427,7 @@ chregister(struct cam_periph *periph, void *arg) } static int -chopen(dev_t dev, int flags, int fmt, struct proc *p) +chopen(dev_t dev, int flags, int fmt, struct thread *td) { struct cam_periph *periph; struct ch_softc *softc; @@ -477,7 +477,7 @@ chopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -chclose(dev_t dev, int flag, int fmt, struct proc *p) +chclose(dev_t dev, int flag, int fmt, struct thread *td) { struct cam_periph *periph; struct ch_softc *softc; @@ -727,7 +727,7 @@ cherror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags) } static int -chioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +chioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct cam_periph *periph; struct ch_softc *softc; diff --git a/sys/bus/cam/scsi/scsi_da.c b/sys/bus/cam/scsi/scsi_da.c index 40614bb7d4..e44181deb5 100644 --- a/sys/bus/cam/scsi/scsi_da.c +++ b/sys/bus/cam/scsi/scsi_da.c @@ -26,7 +26,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.42.2.36 2003/05/17 21:48:30 njl Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_da.c,v 1.3 2003/06/19 01:54:55 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_da.c,v 1.4 2003/06/23 17:55:26 dillon Exp $ */ #ifdef _KERNEL @@ -595,7 +595,7 @@ static SLIST_HEAD(,da_softc) softc_list; static struct extend_array *daperiphs; static int -daopen(dev_t dev, int flags, int fmt, struct proc *p) +daopen(dev_t dev, int flags, int fmt, struct thread *td) { struct cam_periph *periph; struct da_softc *softc; @@ -722,7 +722,7 @@ daopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -daclose(dev_t dev, int flag, int fmt, struct proc *p) +daclose(dev_t dev, int flag, int fmt, struct thread *td) { struct cam_periph *periph; struct da_softc *softc; @@ -881,7 +881,7 @@ bad: #endif static int -daioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +daioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct cam_periph *periph; struct da_softc *softc; diff --git a/sys/bus/cam/scsi/scsi_pass.c b/sys/bus/cam/scsi/scsi_pass.c index c5fbe275cc..333cae1336 100644 --- a/sys/bus/cam/scsi/scsi_pass.c +++ b/sys/bus/cam/scsi/scsi_pass.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/scsi/scsi_pass.c,v 1.19 2000/01/17 06:27:37 mjacob Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_pass.c,v 1.3 2003/06/19 01:54:55 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_pass.c,v 1.4 2003/06/23 17:55:26 dillon Exp $ */ #include @@ -358,7 +358,7 @@ passregister(struct cam_periph *periph, void *arg) } static int -passopen(dev_t dev, int flags, int fmt, struct proc *p) +passopen(dev_t dev, int flags, int fmt, struct thread *td) { struct cam_periph *periph; struct pass_softc *softc; @@ -429,7 +429,7 @@ passopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -passclose(dev_t dev, int flag, int fmt, struct proc *p) +passclose(dev_t dev, int flag, int fmt, struct thread *td) { struct cam_periph *periph; struct pass_softc *softc; @@ -644,7 +644,7 @@ passdone(struct cam_periph *periph, union ccb *done_ccb) } static int -passioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +passioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { struct cam_periph *periph; struct pass_softc *softc; diff --git a/sys/bus/cam/scsi/scsi_sa.c b/sys/bus/cam/scsi/scsi_sa.c index 804005019d..a773ecb27a 100644 --- a/sys/bus/cam/scsi/scsi_sa.c +++ b/sys/bus/cam/scsi/scsi_sa.c @@ -1,6 +1,6 @@ /* * $FreeBSD: src/sys/cam/scsi/scsi_sa.c,v 1.45.2.13 2002/12/17 17:08:50 trhodes Exp $ - * $DragonFly: src/sys/bus/cam/scsi/scsi_sa.c,v 1.3 2003/06/19 01:54:55 dillon Exp $ + * $DragonFly: src/sys/bus/cam/scsi/scsi_sa.c,v 1.4 2003/06/23 17:55:26 dillon Exp $ * * Implementation of SCSI Sequential Access Peripheral driver for CAM. * @@ -449,7 +449,7 @@ static struct cdevsw sa_cdevsw = { static struct extend_array *saperiphs; static int -saopen(dev_t dev, int flags, int fmt, struct proc *p) +saopen(dev_t dev, int flags, int fmt, struct thread *td) { struct cam_periph *periph; struct sa_softc *softc; @@ -513,7 +513,7 @@ saopen(dev_t dev, int flags, int fmt, struct proc *p) } static int -saclose(dev_t dev, int flag, int fmt, struct proc *p) +saclose(dev_t dev, int flag, int fmt, struct thread *td) { struct cam_periph *periph; struct sa_softc *softc; @@ -776,7 +776,7 @@ done: } static int -saioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) +saioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) { struct cam_periph *periph; struct sa_softc *softc; diff --git a/sys/bus/firewire/firewirereg.h b/sys/bus/firewire/firewirereg.h index 709d957bc1..75a722b796 100644 --- a/sys/bus/firewire/firewirereg.h +++ b/sys/bus/firewire/firewirereg.h @@ -32,7 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/firewire/firewirereg.h,v 1.1.2.14 2003/05/01 06:24:37 simokawa Exp $ - * $DragonFly: src/sys/bus/firewire/firewirereg.h,v 1.2 2003/06/17 04:28:25 dillon Exp $ + * $DragonFly: src/sys/bus/firewire/firewirereg.h,v 1.3 2003/06/23 17:55:30 dillon Exp $ * */ @@ -40,7 +40,7 @@ typedef struct thread fw_proc; #include #else -typedef struct proc fw_proc; +typedef struct thread fw_proc; #include #endif diff --git a/sys/bus/firewire/fwdev.c b/sys/bus/firewire/fwdev.c index d778abf456..9ac3d7395a 100644 --- a/sys/bus/firewire/fwdev.c +++ b/sys/bus/firewire/fwdev.c @@ -32,7 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/firewire/fwdev.c,v 1.2.4.11 2003/04/28 03:29:18 simokawa Exp $ - * $DragonFly: src/sys/bus/firewire/fwdev.c,v 1.2 2003/06/17 04:28:25 dillon Exp $ + * $DragonFly: src/sys/bus/firewire/fwdev.c,v 1.3 2003/06/23 17:55:30 dillon Exp $ * */ @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -670,7 +671,7 @@ fw_poll(dev_t dev, int events, fw_proc *td) if (STAILQ_FIRST(&sc->fc->ir[sub]->q) != NULL) revents |= tmp; else - selrecord(td, &sc->fc->ir[sub]->rsel); + selrecord(td, &sc->fc->ir[sub]->rsel); /* YYY */ } tmp = POLLOUT | POLLWRNORM; if (events & tmp) { diff --git a/sys/bus/pccard/pccard.c b/sys/bus/pccard/pccard.c index 2a05dd3723..c34a1da728 100644 --- a/sys/bus/pccard/pccard.c +++ b/sys/bus/pccard/pccard.c @@ -30,7 +30,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pccard/pccard.c,v 1.106.2.15 2003/02/26 18:42:00 imp Exp $ - * $DragonFly: src/sys/bus/pccard/pccard.c,v 1.2 2003/06/17 04:28:55 dillon Exp $ + * $DragonFly: src/sys/bus/pccard/pccard.c,v 1.3 2003/06/23 17:55:48 dillon Exp $ */ #include @@ -483,6 +483,9 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) if (slt == 0 && cmd != PIOCRWMEM) return (ENXIO); + + KKASSERT(td->td_proc != NULL); + switch(cmd) { default: if (slt->ctrl->ioctl) @@ -520,7 +523,7 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) * At the very least, we only allow root to set the context. */ case PIOCSMEM: - if (suser(td)) + if (suser_xxx(td->td_proc->p_ucred, 0)) return (EPERM); if (slt->state != filled) return (ENXIO); @@ -545,7 +548,7 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) * Set I/O port context. */ case PIOCSIO: - if (suser(td)) + if (suser_xxx(td->td_proc->p_ucred, 0)) return (EPERM); if (slt->state != filled) return (ENXIO); @@ -570,7 +573,7 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) *(unsigned long *)data = pccard_mem; break; } - if (suser(td)) + if (suser_xxx(td->td_proc->p_ucred, 0)) return (EPERM); /* * Validate the memory by checking it against the I/O @@ -602,7 +605,7 @@ crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) * Allocate a driver to this slot. */ case PIOCSDRV: - if (suser(td)) + if (suser_xxx(td->td_proc->p_ucred, 0)) return (EPERM); err = allocate_driver(slt, (struct dev_desc *)data); if (!err) diff --git a/sys/bus/pci/pci.c b/sys/bus/pci/pci.c index b5989c1dce..e59b979d0d 100644 --- a/sys/bus/pci/pci.c +++ b/sys/bus/pci/pci.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/pci/pci.c,v 1.141.2.15 2002/04/30 17:48:18 tmm Exp $ - * $DragonFly: src/sys/bus/pci/pci.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/bus/pci/pci.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ * */ @@ -655,7 +655,7 @@ pci_disable_io_method(device_t dev, device_t child, int space) */ 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; @@ -664,7 +664,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; } @@ -783,7 +783,7 @@ pci_devlist_get_parent(pcicfgregs *cfg) } 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) { struct pci_io *io; const char *name; diff --git a/sys/bus/usb/usb.c b/sys/bus/usb/usb.c index 05520385a4..b7bdfb960a 100644 --- a/sys/bus/usb/usb.c +++ b/sys/bus/usb/usb.c @@ -1,6 +1,6 @@ /* $NetBSD: usb.c,v 1.33 1999/11/22 21:57:09 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb.c,v 1.26.2.9 2002/11/13 15:15:22 joe Exp $ */ -/* $DragonFly: src/sys/bus/usb/usb.c,v 1.2 2003/06/17 04:28:32 dillon Exp $ */ +/* $DragonFly: src/sys/bus/usb/usb.c,v 1.3 2003/06/23 17:55:36 dillon Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -171,7 +171,7 @@ Static SIMPLEQ_HEAD(, usb_event_q) usb_events = SIMPLEQ_HEAD_INITIALIZER(usb_events); Static int usb_nevents = 0; Static struct selinfo usb_selevent; -Static struct proc *usb_async_proc; /* process who wants USB SIGIO */ +Static struct thread *usb_async_proc; /* process who wants USB SIGIO */ Static int usb_dev_open = 0; Static int usb_get_next_event(struct usb_event *); @@ -338,7 +338,7 @@ usbopen(dev_t dev, int flag, int mode, usb_proc_ptr p) if (usb_dev_open) return (EBUSY); usb_dev_open = 1; - usb_async_proc = 0; + usb_async_proc = NULL; return (0); } else { USB_GET_SC_OPEN(usb, unit, sc); @@ -390,7 +390,7 @@ usbclose(dev_t dev, int flag, int mode, usb_proc_ptr p) int unit = USBUNIT(dev); if (unit == USB_DEV_MINOR) { - usb_async_proc = 0; + usb_async_proc = NULL; usb_dev_open = 0; } @@ -413,7 +413,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) if (*(int *)data) usb_async_proc = p; else - usb_async_proc = 0; + usb_async_proc = NULL; return (0); default: @@ -468,7 +468,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) uio.uio_rw = ur->ucr_request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; - uio.uio_procp = p; + uio.uio_procp = p->td_proc; ptr = malloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); @@ -654,8 +654,8 @@ usbd_add_event(int type, usbd_device_handle dev) SIMPLEQ_INSERT_TAIL(&usb_events, ueq, next); wakeup(&usb_events); selwakeup(&usb_selevent); - if (usb_async_proc != NULL) - psignal(usb_async_proc, SIGIO); + if (usb_async_proc != NULL && usb_async_proc->td_proc) + psignal(usb_async_proc->td_proc, SIGIO); splx(s); } diff --git a/sys/bus/usb/usb_port.h b/sys/bus/usb/usb_port.h index b21475de3a..04d3b5f8d4 100644 --- a/sys/bus/usb/usb_port.h +++ b/sys/bus/usb/usb_port.h @@ -1,6 +1,6 @@ /* $NetBSD: usb_port.h,v 1.15 1999/11/16 12:04:28 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_port.h,v 1.25.2.7 2002/08/12 14:19:49 joe Exp $ */ -/* $DragonFly: src/sys/bus/usb/usb_port.h,v 1.2 2003/06/17 04:28:32 dillon Exp $ */ +/* $DragonFly: src/sys/bus/usb/usb_port.h,v 1.3 2003/06/23 17:55:36 dillon Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -272,7 +272,7 @@ __CONCAT(dname,_detach)(self, flags) \ #define DECLARE_USB_DMA_T typedef char * usb_dma_t -typedef struct proc *usb_proc_ptr; +typedef struct thread *usb_proc_ptr; /* XXX Change this when FreeBSD has memset */ #define memcpy(d, s, l) bcopy((s),(d),(l)) diff --git a/sys/contrib/ipfilter/netinet/ip_fil.c b/sys/contrib/ipfilter/netinet/ip_fil.c index a67d17fae3..60dec09429 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.c +++ b/sys/contrib/ipfilter/netinet/ip_fil.c @@ -6,7 +6,7 @@ * @(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed * @(#)$Id: ip_fil.c,v 2.42.2.60 2002/08/28 12:40:39 darrenr Exp $ * $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_fil.c,v 1.25.2.6 2003/03/01 03:55:54 darrenr Exp $ - * $DragonFly: src/sys/contrib/ipfilter/netinet/ip_fil.c,v 1.2 2003/06/17 04:28:20 dillon Exp $ + * $DragonFly: src/sys/contrib/ipfilter/netinet/ip_fil.c,v 1.3 2003/06/23 17:55:27 dillon Exp $ */ #ifndef SOLARIS #define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4))) @@ -629,7 +629,10 @@ int IPL_EXTERN(ioctl)(dev_t dev, int cmd, caddr_t data, int mode ) #else int IPL_EXTERN(ioctl)(dev, cmd, data, mode -# if (defined(_KERNEL) && ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || \ +#ifdef __FreeBSD__ +, td) +struct thread *td; +# elif (defined(_KERNEL) && ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || \ (NetBSD >= 199511) || (__FreeBSD_version >= 220000) || \ defined(__OpenBSD__))) , p) @@ -1099,7 +1102,11 @@ int IPL_EXTERN(open)(dev_t dev, int flags) # endif # else int IPL_EXTERN(open)(dev, flags -# if ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || (NetBSD >= 199511) || \ +#ifdef __FreeBSD__ +, devtype, td) +int devtype; +struct thread *td; +#elif ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || (NetBSD >= 199511) || \ (__FreeBSD_version >= 220000) || defined(__OpenBSD__)) && defined(_KERNEL) , devtype, p) int devtype; @@ -1129,7 +1136,11 @@ int flags; int IPL_EXTERN(close)(dev_t dev, int flags, int devtype, cred_t *cp) #else int IPL_EXTERN(close)(dev, flags -# if ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || (NetBSD >= 199511) || \ +#ifdef __FreeBSD__ +, devtype, td) +int devtype; +struct thread *td; +#elif ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || (NetBSD >= 199511) || \ (__FreeBSD_version >= 220000) || defined(__OpenBSD__)) && defined(_KERNEL) , devtype, p) int devtype; diff --git a/sys/contrib/ipfilter/netinet/ip_fil.h b/sys/contrib/ipfilter/netinet/ip_fil.h index 5f396cf186..7d72a98273 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil.h +++ b/sys/contrib/ipfilter/netinet/ip_fil.h @@ -6,7 +6,7 @@ * @(#)ip_fil.h 1.35 6/5/96 * $Id: ip_fil.h,v 2.29.2.33 2002/06/04 14:46:28 darrenr Exp $ * $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_fil.h,v 1.18.2.5 2003/03/01 03:55:54 darrenr Exp $ - * $DragonFly: src/sys/contrib/ipfilter/netinet/ip_fil.h,v 1.2 2003/06/17 04:28:20 dillon Exp $ + * $DragonFly: src/sys/contrib/ipfilter/netinet/ip_fil.h,v 1.3 2003/06/23 17:55:27 dillon Exp $ */ #ifndef __IP_FIL_H__ @@ -571,6 +571,11 @@ extern void ipfilter_sgi_intfsync __P((void)); # ifdef IPFILTER_LKM extern int iplidentify __P((char *)); # endif +#ifdef __FreeBSD__ +extern int iplioctl __P((dev_t, u_long, caddr_t, int, struct thread *)); +extern int iplopen __P((dev_t, int, int, struct thread *)); +extern int iplclose __P((dev_t, int, int, struct thread *)); +#else # if (_BSDI_VERSION >= 199510) || (__FreeBSD_version >= 220000) || \ (NetBSD >= 199511) || defined(__OpenBSD__) # if defined(__NetBSD__) || (_BSDI_VERSION >= 199701) || \ @@ -592,6 +597,7 @@ extern int iplopen __P((struct inode *, struct file *)); extern void iplclose __P((struct inode *, struct file *)); # endif /* !linux */ # endif /* (_BSDI_VERSION >= 199510) */ +#endif # if BSD >= 199306 extern int iplread __P((dev_t, struct uio *, int)); # else diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c index 3f990c2b0a..2efebbc444 100644 --- a/sys/ddb/db_ps.c +++ b/sys/ddb/db_ps.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ddb/db_ps.c,v 1.20 1999/08/28 00:41:09 peter Exp $ - * $DragonFly: src/sys/ddb/db_ps.c,v 1.3 2003/06/18 18:29:53 dillon Exp $ + * $DragonFly: src/sys/ddb/db_ps.c,v 1.4 2003/06/23 17:55:27 dillon Exp $ */ #include #include @@ -94,7 +94,7 @@ db_ps(dummy1, dummy2, dummy3, dummy4) db_printf("%5d %8p %8p %4d %5d %5d %06x %d", p->p_pid, (volatile void *)p, (void *)p->p_thread->td_pcb, - p->p_cred ? p->p_cred->p_ruid : 0, pp->p_pid, + p->p_ucred ? p->p_ucred->cr_ruid : 0, pp->p_pid, p->p_pgrp ? p->p_pgrp->pg_id : 0, p->p_flag, p->p_stat); if (p->p_wchan) { db_printf(" %6s %8p", p->p_wmesg, (void *)p->p_wchan); diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index 6a48305968..5ca1cc2a3d 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/pci/agp.c,v 1.3.2.4 2002/08/11 19:58:12 alc Exp $ - * $DragonFly: src/sys/dev/agp/agp.c,v 1.2 2003/06/17 04:28:56 dillon Exp $ + * $DragonFly: src/sys/dev/agp/agp.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ #include "opt_bus.h" @@ -637,7 +637,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); @@ -651,7 +651,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); @@ -674,7 +674,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/disk/ata/ata-all.c b/sys/dev/disk/ata/ata-all.c index 662a92e025..e959f606c3 100644 --- a/sys/dev/disk/ata/ata-all.c +++ b/sys/dev/disk/ata/ata-all.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-all.c,v 1.50.2.45 2003/03/12 14:47:12 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/ata-all.c,v 1.2 2003/06/17 04:28:22 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/ata-all.c,v 1.3 2003/06/23 17:55:29 dillon Exp $ */ #include "opt_ata.h" @@ -294,7 +294,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; struct ata_channel *ch; diff --git a/sys/dev/disk/ata/ata-disk.c b/sys/dev/disk/ata/ata-disk.c index 35f5838cf7..67507c7973 100644 --- a/sys/dev/disk/ata/ata-disk.c +++ b/sys/dev/disk/ata/ata-disk.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.60.2.24 2003/01/30 07:19:59 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/ata-disk.c,v 1.3 2003/06/19 01:54:59 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/ata-disk.c,v 1.4 2003/06/23 17:55:29 dillon Exp $ */ #include "opt_ata.h" @@ -270,7 +270,7 @@ ad_detach(struct ata_device *atadev, int flush) /* get rid of flush XXX SOS */ } 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; @@ -280,7 +280,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/disk/ata/ata-raid.c b/sys/dev/disk/ata/ata-raid.c index e0239201d9..10dc38e595 100644 --- a/sys/dev/disk/ata/ata-raid.c +++ b/sys/dev/disk/ata/ata-raid.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/ata-raid.c,v 1.3.2.19 2003/01/30 07:19:59 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/ata-raid.c,v 1.3 2003/06/19 01:54:59 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/ata-raid.c,v 1.4 2003/06/23 17:55:29 dillon Exp $ */ #include "opt_ata.h" @@ -470,7 +470,7 @@ ata_raid_rebuild(int array) } 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/disk/ata/atapi-cd.c b/sys/dev/disk/ata/atapi-cd.c index 8c808dfcdb..3da0b35008 100644 --- a/sys/dev/disk/ata/atapi-cd.c +++ b/sys/dev/disk/ata/atapi-cd.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-cd.c,v 1.48.2.20 2002/11/25 05:30:31 njl Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-cd.c,v 1.3 2003/06/19 01:54:59 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-cd.c,v 1.4 2003/06/23 17:55:29 dillon Exp $ */ #include "opt_ata.h" @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -490,7 +489,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; int timeout = 60; @@ -528,7 +527,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; @@ -547,7 +546,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; @@ -600,7 +599,7 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) break; case CDIOCRESET: - error = suser(p); + error = suser(); if (error) break; error = atapi_test_ready(cdp->device); diff --git a/sys/dev/disk/ata/atapi-fd.c b/sys/dev/disk/ata/atapi-fd.c index 5bea60b447..039e09b227 100644 --- a/sys/dev/disk/ata/atapi-fd.c +++ b/sys/dev/disk/ata/atapi-fd.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-fd.c,v 1.44.2.9 2002/07/31 11:19:26 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-fd.c,v 1.3 2003/06/19 01:54:59 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-fd.c,v 1.4 2003/06/23 17:55:29 dillon Exp $ */ #include @@ -230,7 +230,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; @@ -256,7 +256,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; @@ -266,7 +266,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/disk/ata/atapi-tape.c b/sys/dev/disk/ata/atapi-tape.c index c39e492721..0ae9469cd9 100644 --- a/sys/dev/disk/ata/atapi-tape.c +++ b/sys/dev/disk/ata/atapi-tape.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ata/atapi-tape.c,v 1.36.2.12 2002/07/31 11:19:26 sos Exp $ - * $DragonFly: src/sys/dev/disk/ata/atapi-tape.c,v 1.3 2003/06/19 01:54:59 dillon Exp $ + * $DragonFly: src/sys/dev/disk/ata/atapi-tape.c,v 1.4 2003/06/23 17:55:29 dillon Exp $ */ #include "opt_ata.h" @@ -248,7 +248,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; @@ -273,7 +273,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; @@ -301,7 +301,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/disk/ccd/ccd.c b/sys/dev/disk/ccd/ccd.c index 63a9132b45..b8ca9a1740 100644 --- a/sys/dev/disk/ccd/ccd.c +++ b/sys/dev/disk/ccd/ccd.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/ccd/ccd.c,v 1.73.2.1 2001/09/11 09:49:52 kris Exp $ */ -/* $DragonFly: src/sys/dev/disk/ccd/ccd.c,v 1.3 2003/06/19 01:55:03 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/ccd/ccd.c,v 1.4 2003/06/23 17:55:30 dillon Exp $ */ /* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ @@ -687,10 +687,7 @@ ccdinterleave(cs, unit) /* ARGSUSED */ static int -ccdopen(dev, flags, fmt, p) - dev_t dev; - int flags, fmt; - struct proc *p; +ccdopen(dev_t dev, int flags, int fmt, d_thread_t *td) { int unit = ccdunit(dev); struct ccd_softc *cs; @@ -736,10 +733,7 @@ ccdopen(dev, flags, fmt, p) /* ARGSUSED */ static int -ccdclose(dev, flags, fmt, p) - dev_t dev; - int flags, fmt; - struct proc *p; +ccdclose(dev_t dev, int flags, int fmt, d_thread_t *td) { int unit = ccdunit(dev); struct ccd_softc *cs; @@ -1249,12 +1243,7 @@ ccdiodone(cbp) } static int -ccdioctl(dev, cmd, data, flag, p) - 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, d_thread_t *td) { int unit = ccdunit(dev); int i, j, lookedup = 0, error = 0; @@ -1264,6 +1253,9 @@ ccdioctl(dev, cmd, data, flag, p) struct ccddevice ccd; char **cpp; struct vnode **vpp; + struct proc *p = td->td_proc; + + KKASSERT(p != NULL); if (unit >= numccd) return (ENXIO); @@ -1513,13 +1505,12 @@ ccdioctl(dev, cmd, data, flag, p) } static int -ccdsize(dev) - dev_t dev; +ccdsize(dev_t dev) { struct ccd_softc *cs; int part, size; - if (ccdopen(dev, 0, S_IFCHR, curproc)) + if (ccdopen(dev, 0, S_IFCHR, curthread)) return (-1); cs = &ccd_softc[ccdunit(dev)]; @@ -1533,7 +1524,7 @@ ccdsize(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); diff --git a/sys/dev/disk/fd/fd.c b/sys/dev/disk/fd/fd.c index 579f8bd8f3..9f642b372e 100644 --- a/sys/dev/disk/fd/fd.c +++ b/sys/dev/disk/fd/fd.c @@ -51,7 +51,7 @@ * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 * $FreeBSD: src/sys/isa/fd.c,v 1.176.2.8 2002/05/15 21:56:14 joerg Exp $ - * $DragonFly: src/sys/dev/disk/fd/fd.c,v 1.3 2003/06/19 01:55:05 dillon Exp $ + * $DragonFly: src/sys/dev/disk/fd/fd.c,v 1.4 2003/06/23 17:55:40 dillon Exp $ * */ @@ -233,7 +233,7 @@ static timeout_t fd_iotimeout; static timeout_t fd_pseudointr; static int fdstate(struct fdc_data *); static int retrier(struct fdc_data *); -static int fdformat(dev_t, struct fd_formb *, struct proc *); +static int fdformat(dev_t, struct fd_formb *, struct thread *); static int enable_fifo(fdc_p fdc); @@ -1374,7 +1374,7 @@ out_fdc(struct fdc_data *fdc, int x) /* fdopen/fdclose */ /****************************************************************************/ 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)); @@ -1469,7 +1469,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; @@ -2250,11 +2250,9 @@ retrier(struct fdc_data *fdc) } static int -fdformat(dev, finfo, p) - dev_t dev; - struct fd_formb *finfo; - struct proc *p; +fdformat(dev_t dev, struct fd_formb *finfo, struct thread *td) { + struct proc *p = td->td_proc; fdu_t fdu; fd_p fd; @@ -2325,13 +2323,9 @@ fdformat(dev, finfo, p) */ static int -fdioctl(dev, cmd, addr, flag, p) - 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) { + struct proc *p = td->td_proc; fdu_t fdu = FDUNIT(minor(dev)); fd_p fd = devclass_get_softc(fd_devclass, fdu); size_t fdblk; @@ -2393,7 +2387,7 @@ fdioctl(dev, cmd, addr, flag, p) FD_FORMAT_VERSION) error = EINVAL; /* wrong version of formatting prog */ else - error = fdformat(dev, (struct fd_formb *)addr, p); + error = fdformat(dev, (struct fd_formb *)addr, td); break; case FD_GTYPE: /* get drive type */ @@ -2402,7 +2396,7 @@ fdioctl(dev, cmd, addr, flag, p) case FD_STYPE: /* set drive type */ /* this is considered harmful; only allow for superuser */ - if (suser(p) != 0) + if (suser_xxx(p->p_ucred, 0) != 0) return EPERM; *fd->ft = *(struct fd_type *)addr; break; diff --git a/sys/dev/disk/isp/isp_freebsd.c b/sys/dev/disk/isp/isp_freebsd.c index 420933cc14..1fa3e8f3be 100644 --- a/sys/dev/disk/isp/isp_freebsd.c +++ b/sys/dev/disk/isp/isp_freebsd.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/isp/isp_freebsd.c,v 1.32.2.20 2002/10/11 18:49:25 mjacob Exp $ */ -/* $DragonFly: src/sys/dev/disk/isp/isp_freebsd.c,v 1.2 2003/06/17 04:28:27 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/isp/isp_freebsd.c,v 1.3 2003/06/23 17:55:31 dillon Exp $ */ /* * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. * @@ -141,7 +141,7 @@ isp_attach(struct ispsoftc *isp) */ if (IS_FC(isp)) { ISPLOCK_2_CAMLOCK(isp); - if (kthread_create(isp_kthread, isp, &isp->isp_osinfo.kproc, + if (kthread_create(isp_kthread, isp, &isp->isp_osinfo.kthread, "%s: fc_thrd", device_get_nameunit(isp->isp_dev))) { xpt_bus_deregister(cam_sim_path(sim)); cam_sim_free(sim, TRUE); @@ -235,7 +235,7 @@ isp_freeze_loopdown(struct ispsoftc *isp, char *msg) } 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, d_thread_t *td) { struct ispsoftc *isp; int retval = ENOTTY; @@ -1968,7 +1968,7 @@ isp_kthread(void *arg) xpt_release_simq(isp->isp_sim, 1); CAMLOCK_2_ISPLOCK(isp); } - tsleep(&isp->isp_osinfo.kproc, PRIBIO, "isp_fc_worker", 0); + tsleep(&isp->isp_osinfo.kthread, PRIBIO, "isp_fc_worker", 0); isp_prt(isp, ISP_LOGDEBUG0, "kthread: waiting until called"); } } @@ -2068,7 +2068,7 @@ isp_action(struct cam_sim *sim, union ccb *ccb) xpt_done(ccb); break; } - wakeup(&isp->isp_osinfo.kproc); + wakeup(&isp->isp_osinfo.kthread); isp_freeze_loopdown(isp, "isp_action(RQLATER)"); isp->isp_osinfo.simqfrozen |= SIMQFRZ_LOOPDOWN; XS_SETERR(ccb, CAM_REQUEUE_REQ); @@ -2653,7 +2653,7 @@ isp_async(struct ispsoftc *isp, ispasync_t cmd, void *arg) isp_prt(isp, ISP_LOGINFO, "Name Server Database Changed"); } - wakeup(&isp->isp_osinfo.kproc); + wakeup(&isp->isp_osinfo.kthread); break; case ISPASYNC_FABRIC_DEV: { diff --git a/sys/dev/disk/isp/isp_freebsd.h b/sys/dev/disk/isp/isp_freebsd.h index 286269f9b2..2fa8c6652f 100644 --- a/sys/dev/disk/isp/isp_freebsd.h +++ b/sys/dev/disk/isp/isp_freebsd.h @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/isp/isp_freebsd.h,v 1.26.2.17 2002/10/11 17:35:11 mjacob Exp $ */ -/* $DragonFly: src/sys/dev/disk/isp/isp_freebsd.h,v 1.2 2003/06/17 04:28:27 dillon Exp $ */ +/* $DragonFly: src/sys/dev/disk/isp/isp_freebsd.h,v 1.3 2003/06/23 17:55:31 dillon Exp $ */ /* * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002 by Matthew Jacob @@ -131,7 +131,7 @@ struct isposinfo { simqfrozen : 3; int islocked; int splsaved; - struct proc *kproc; + struct thread *kthread; bus_dma_tag_t cdmat; bus_dmamap_t cdmap; #define isp_cdmat isp_osinfo.cdmat diff --git a/sys/dev/disk/md/md.c b/sys/dev/disk/md/md.c index 031c92e40c..c8a2a268fa 100644 --- a/sys/dev/disk/md/md.c +++ b/sys/dev/disk/md/md.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/sys/dev/md/md.c,v 1.8.2.2 2002/08/19 17:43:34 jdp Exp $ - * $DragonFly: src/sys/dev/disk/md/md.c,v 1.3 2003/06/19 01:55:03 dillon Exp $ + * $DragonFly: src/sys/dev/disk/md/md.c,v 1.4 2003/06/23 17:55:32 dillon Exp $ * */ @@ -107,14 +107,14 @@ struct md_s { static int mdunits; 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); sc = dev->si_drv1; if (sc->unit + 1 == mdunits) @@ -132,12 +132,12 @@ mdopen(dev_t dev, int flag, 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); } diff --git a/sys/dev/disk/vn/vn.c b/sys/dev/disk/vn/vn.c index 30ae3b4e8e..56bc8be998 100644 --- a/sys/dev/disk/vn/vn.c +++ b/sys/dev/disk/vn/vn.c @@ -39,7 +39,7 @@ * * from: @(#)vn.c 8.6 (Berkeley) 4/1/94 * $FreeBSD: src/sys/dev/vn/vn.c,v 1.105.2.4 2001/11/18 07:11:00 dillon Exp $ - * $DragonFly: src/sys/dev/disk/vn/vn.c,v 1.2 2003/06/17 04:28:33 dillon Exp $ + * $DragonFly: src/sys/dev/disk/vn/vn.c,v 1.3 2003/06/23 17:55:36 dillon Exp $ */ /* @@ -158,11 +158,11 @@ static u_long vn_options; static int vnsetcred (struct vn_softc *vn, struct ucred *cred); static void vnclear (struct vn_softc *vn); static int vn_modevent (module_t, int, void *); -static int vniocattach_file (struct vn_softc *, struct vn_ioctl *, dev_t dev, int flag, struct proc *p); -static int vniocattach_swap (struct vn_softc *, struct vn_ioctl *, dev_t dev, int flag, struct proc *p); +static int vniocattach_file (struct vn_softc *, struct vn_ioctl *, dev_t dev, int flag, struct thread *p); +static int vniocattach_swap (struct vn_softc *, struct vn_ioctl *, dev_t dev, int flag, struct thread *p); static int -vnclose(dev_t dev, int flags, int mode, struct proc *p) +vnclose(dev_t dev, int flags, int mode, struct thread *td) { struct vn_softc *vn = dev->si_drv1; @@ -211,7 +211,7 @@ vnfindvn(dev_t dev) } static int -vnopen(dev_t dev, int flags, int mode, struct proc *p) +vnopen(dev_t dev, int flags, int mode, struct thread *td) { struct vn_softc *vn; @@ -240,7 +240,7 @@ vnopen(dev_t dev, int flags, int mode, struct proc *p) IFOPT(vn, VN_FOLLOW) printf("vnopen(%s, 0x%x, 0x%x, %p)\n", - devtoname(dev), flags, mode, (void *)p); + devtoname(dev), flags, mode, (void *)td); /* * Initialize label @@ -424,7 +424,7 @@ vnstrategy(struct buf *bp) /* ARGSUSED */ static int -vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct vn_softc *vn; struct vn_ioctl *vio; @@ -434,7 +434,7 @@ vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) vn = dev->si_drv1; IFOPT(vn,VN_FOLLOW) printf("vnioctl(%s, 0x%lx, %p, 0x%x, %p): unit %d\n", - devtoname(dev), cmd, (void *)data, flag, (void *)p, + devtoname(dev), cmd, (void *)data, flag, (void *)td, dkunit(dev)); switch (cmd) { @@ -460,7 +460,7 @@ vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) vn_specific: - error = suser(p); + error = suser(); if (error) return (error); @@ -473,9 +473,9 @@ vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) return(EBUSY); if (vio->vn_file == NULL) - error = vniocattach_swap(vn, vio, dev, flag, p); + error = vniocattach_swap(vn, vio, dev, flag, td); else - error = vniocattach_file(vn, vio, dev, flag, p); + error = vniocattach_file(vn, vio, dev, flag, td); break; case VNIOCDETACH: @@ -529,16 +529,19 @@ vnioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) */ static int -vniocattach_file(vn, vio, dev, flag, p) +vniocattach_file(vn, vio, dev, flag, td) struct vn_softc *vn; struct vn_ioctl *vio; dev_t dev; int flag; - struct proc *p; + struct thread *td; { struct vattr vattr; struct nameidata nd; int error, flags; + struct proc *p = td->td_proc; + + KKASSERT(p != NULL); flags = FREAD|FWRITE; NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, vio->vn_file, p); @@ -587,7 +590,7 @@ vniocattach_file(vn, vio, dev, flag, p) * no other slices or labels are open. Otherwise, * we rely on VNIOCCLR not being abused. */ - error = vnopen(dev, flag, S_IFCHR, p); + error = vnopen(dev, flag, S_IFCHR, td); if (error) vnclear(vn); } @@ -605,15 +608,17 @@ vniocattach_file(vn, vio, dev, flag, p) */ static int -vniocattach_swap(vn, vio, dev, flag, p) +vniocattach_swap(vn, vio, dev, flag, td) struct vn_softc *vn; struct vn_ioctl *vio; dev_t dev; int flag; - struct proc *p; + struct thread *td; { int error; + struct proc *p = td->td_proc; + KKASSERT(p != NULL); /* * Range check. Disallow negative sizes or any size less then the * size of a page. Then round to a page. @@ -655,7 +660,7 @@ vniocattach_swap(vn, vio, dev, flag, p) * no other slices or labels are open. Otherwise, * we rely on VNIOCCLR not being abused. */ - error = vnopen(dev, flag, S_IFCHR, p); + error = vnopen(dev, flag, S_IFCHR, td); } } if (error == 0) { diff --git a/sys/dev/misc/joy/joy.c b/sys/dev/misc/joy/joy.c index a96f9bd8d9..3fde2756a2 100644 --- a/sys/dev/misc/joy/joy.c +++ b/sys/dev/misc/joy/joy.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/isa/joy.c,v 1.38.2.1 2001/09/01 05:55:31 murray Exp $ - * $DragonFly: src/sys/dev/misc/joy/joy.c,v 1.2 2003/06/17 04:28:40 dillon Exp $ + * $DragonFly: src/sys/dev/misc/joy/joy.c,v 1.3 2003/06/23 17:55:40 dillon Exp $ */ #include @@ -160,7 +160,7 @@ static driver_t joy_isa_driver = { DRIVER_MODULE(joy, isa, 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, d_thread_t *td) { int i = joypart (dev); struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); @@ -173,7 +173,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, d_thread_t *td) { int i = joypart (dev); struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); @@ -241,7 +241,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, d_thread_t *td) { struct joy_softc *joy = JOY_SOFTC(UNIT(dev)); int i = joypart (dev); diff --git a/sys/dev/misc/kbd/kbd.c b/sys/dev/misc/kbd/kbd.c index 40facbf83b..34fc594db0 100644 --- a/sys/dev/misc/kbd/kbd.c +++ b/sys/dev/misc/kbd/kbd.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/kbd/kbd.c,v 1.17.2.2 2001/07/30 16:46:43 yokota Exp $ - * $DragonFly: src/sys/dev/misc/kbd/kbd.c,v 1.2 2003/06/17 04:28:28 dillon Exp $ + * $DragonFly: src/sys/dev/misc/kbd/kbd.c,v 1.3 2003/06/23 17:55:31 dillon Exp $ */ #include "opt_kbd.h" @@ -493,7 +493,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, d_thread_t *td) { keyboard_t *kbd; genkbd_softc_t *sc; @@ -533,7 +533,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, d_thread_t *td) { keyboard_t *kbd; genkbd_softc_t *sc; @@ -623,7 +623,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, d_thread_t *td) { keyboard_t *kbd; int error; @@ -638,7 +638,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, d_thread_t *td) { keyboard_t *kbd; genkbd_softc_t *sc; @@ -655,7 +655,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/misc/lpt/lpt.c b/sys/dev/misc/lpt/lpt.c index 3fbd276c90..ddc14199bd 100644 --- a/sys/dev/misc/lpt/lpt.c +++ b/sys/dev/misc/lpt/lpt.c @@ -49,7 +49,7 @@ * From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp * From Id: nlpt.c,v 1.14 1999/02/08 13:55:43 des Exp * $FreeBSD: src/sys/dev/ppbus/lpt.c,v 1.15.2.3 2000/07/07 00:30:40 obrien Exp $ - * $DragonFly: src/sys/dev/misc/lpt/lpt.c,v 1.2 2003/06/17 04:28:29 dillon Exp $ + * $DragonFly: src/sys/dev/misc/lpt/lpt.c,v 1.3 2003/06/23 17:55:33 dillon Exp $ */ /* @@ -460,7 +460,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 *p) { int s; int trys, err; @@ -580,7 +580,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 *p) { u_int unit = LPTUNIT(minor(dev)); struct lpt_data *sc = UNITOSOFTC(unit); @@ -902,7 +902,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 *p) { int error = 0; u_int unit = LPTUNIT(minor(dev)); diff --git a/sys/dev/misc/nmdm/nmdm.c b/sys/dev/misc/nmdm/nmdm.c index b6854f5240..a3b5e7addf 100644 --- a/sys/dev/misc/nmdm/nmdm.c +++ b/sys/dev/misc/nmdm/nmdm.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/nmdm/nmdm.c,v 1.5.2.1 2001/08/11 00:54:14 mp Exp $ - * $DragonFly: src/sys/dev/misc/nmdm/nmdm.c,v 1.2 2003/06/17 04:28:28 dillon Exp $ + * $DragonFly: src/sys/dev/misc/nmdm/nmdm.c,v 1.3 2003/06/23 17:55:33 dillon Exp $ */ /* @@ -154,12 +154,10 @@ nmdminit(n) /*ARGSUSED*/ static int -nmdmopen(dev, flag, devtype, p) - dev_t dev; - int flag, devtype; - struct proc *p; +nmdmopen(dev_t dev, int flag, int devtype, struct thread *td) { - register struct tty *tp, *tp2; + struct proc *p = td->td_proc; + struct tty *tp, *tp2; int error; int minr; dev_t nextdev; @@ -168,6 +166,8 @@ nmdmopen(dev, flag, devtype, p) int pair; struct softpart *ourpart, *otherpart; + KKASSERT(p != NULL); + /* * XXX: Gross hack for DEVFS: * If we openned this device, ensure we have the @@ -205,9 +205,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_xxx(p->p_ucred, 0)) { return (EBUSY); - } else if (pti->pt_prison != p->p_prison) { + } else if (pti->pt_prison != p->p_ucred->cr_prison) { return (EBUSY); } @@ -257,10 +257,7 @@ nmdmopen(dev, flag, devtype, p) } static int -nmdmclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +nmdmclose(dev_t dev, int flag, int mode, struct thread *td) { register struct tty *tp, *tp2; int err; @@ -487,12 +484,7 @@ nmdmstop(tp, flush) /*ARGSUSED*/ static int -nmdmioctl(dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +nmdmioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { register struct tty *tp = dev->si_tty; struct nm_softc *pti = dev->si_drv1; @@ -504,7 +496,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/misc/ppi/ppi.c b/sys/dev/misc/ppi/ppi.c index 3565a6b940..3939ea28c3 100644 --- a/sys/dev/misc/ppi/ppi.c +++ b/sys/dev/misc/ppi/ppi.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ppbus/ppi.c,v 1.21.2.3 2000/08/07 18:24:43 peter Exp $ - * $DragonFly: src/sys/dev/misc/ppi/ppi.c,v 1.2 2003/06/17 04:28:29 dillon Exp $ + * $DragonFly: src/sys/dev/misc/ppi/ppi.c,v 1.3 2003/06/23 17:55:33 dillon Exp $ * */ #include "opt_ppb_1284.h" @@ -258,7 +258,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, d_thread_t *td) { u_int unit = minor(dev); struct ppi_data *ppi = UNITOSOFTC(unit); @@ -291,7 +291,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, d_thread_t *td) { u_int unit = minor(dev); struct ppi_data *ppi = UNITOSOFTC(unit); @@ -504,7 +504,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, d_thread_t *td) { u_int unit = minor(dev); device_t ppidev = UNITODEVICE(unit); diff --git a/sys/dev/misc/psm/psm.c b/sys/dev/misc/psm/psm.c index dc88821708..96fc16d855 100644 --- a/sys/dev/misc/psm/psm.c +++ b/sys/dev/misc/psm/psm.c @@ -21,7 +21,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/isa/psm.c,v 1.23.2.6 2002/03/27 16:53:35 pb Exp $ - * $DragonFly: src/sys/dev/misc/psm/psm.c,v 1.2 2003/06/17 04:28:40 dillon Exp $ + * $DragonFly: src/sys/dev/misc/psm/psm.c,v 1.3 2003/06/23 17:55:40 dillon Exp $ */ /* @@ -1284,7 +1284,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; @@ -1369,7 +1369,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); @@ -1637,7 +1637,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; @@ -2375,7 +2375,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; @@ -2387,7 +2387,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/misc/snp/snp.c b/sys/dev/misc/snp/snp.c index e8b066c262..6f3ee7f695 100644 --- a/sys/dev/misc/snp/snp.c +++ b/sys/dev/misc/snp/snp.c @@ -13,7 +13,7 @@ * Snoop stuff. * * $FreeBSD: src/sys/dev/snp/snp.c,v 1.69.2.2 2002/05/06 07:30:02 dd Exp $ - * $DragonFly: src/sys/dev/misc/snp/snp.c,v 1.2 2003/06/17 04:28:30 dillon Exp $ + * $DragonFly: src/sys/dev/misc/snp/snp.c,v 1.3 2003/06/23 17:55:34 dillon Exp $ */ #include @@ -378,10 +378,7 @@ snp_in(snp, buf, n) } static int -snpopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +snpopen(dev_t dev, int flag, int mode, d_thread_t *td) { struct snoop *snp; @@ -453,11 +450,7 @@ detach_notty: } static int -snpclose(dev, flags, fmt, p) - dev_t dev; - int flags; - int fmt; - struct proc *p; +snpclose(dev_t dev, int flags, int fmt, d_thread_t *td) { struct snoop *snp; @@ -487,12 +480,7 @@ snp_down(snp) } static int -snpioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +snpioctl(dev_t dev, u_long cmd, caddr_t data, int flags, d_thread_t *td) { struct snoop *snp; struct tty *tp, *tpo; @@ -578,10 +566,7 @@ snpioctl(dev, cmd, data, flags, p) } static int -snppoll(dev, events, p) - dev_t dev; - int events; - struct proc *p; +snppoll(dev_t dev, int events, d_thread_t *td) { struct snoop *snp; int revents; @@ -597,7 +582,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/misc/streams/streams.c b/sys/dev/misc/streams/streams.c index 24e7f8bc10..c03e5682ef 100644 --- a/sys/dev/misc/streams/streams.c +++ b/sys/dev/misc/streams/streams.c @@ -31,7 +31,7 @@ * in 3.0-980524-SNAP then hacked a bit (but probably not enough :-). * * $FreeBSD: src/sys/dev/streams/streams.c,v 1.16.2.1 2001/02/26 04:23:07 jlemon Exp $ - * $DragonFly: src/sys/dev/misc/streams/Attic/streams.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/misc/streams/Attic/streams.c,v 1.3 2003/06/23 17:55:35 dillon Exp $ */ #include @@ -199,14 +199,17 @@ DECLARE_MODULE(streams, streams_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); * routine. */ static int -streamsopen(dev_t dev, int oflags, int devtype, struct proc *p) +streamsopen(dev_t dev, int oflags, int devtype, d_thread_t *td) { + struct proc *p = td->td_proc; int type, protocol; int fd; struct file *fp; struct socket *so; int error; int family; + + KKASSERT(p != NULL); if (p->p_dupfd >= 0) return ENODEV; @@ -314,7 +317,7 @@ svr4_ptm_alloc(p) if ((error = copyout(ptyname, path, sizeof(ptyname))) != 0) return error; - switch (error = open(p, &oa)) { + switch (error = open(&oa)) { case ENOENT: case ENXIO: return error; diff --git a/sys/dev/misc/syscons/schistory.c b/sys/dev/misc/syscons/schistory.c index 6163101fd4..860df433ea 100644 --- a/sys/dev/misc/syscons/schistory.c +++ b/sys/dev/misc/syscons/schistory.c @@ -27,7 +27,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/schistory.c,v 1.8.2.1 2001/07/19 06:38:53 dd Exp $ - * $DragonFly: src/sys/dev/misc/syscons/schistory.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/schistory.c,v 1.3 2003/06/23 17:55:35 dillon Exp $ */ #include "sc.h" @@ -279,7 +279,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/misc/syscons/scmouse.c b/sys/dev/misc/syscons/scmouse.c index 5b136db416..81b38e9086 100644 --- a/sys/dev/misc/syscons/scmouse.c +++ b/sys/dev/misc/syscons/scmouse.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/scmouse.c,v 1.12.2.3 2001/07/28 12:51:47 yokota Exp $ - * $DragonFly: src/sys/dev/misc/syscons/scmouse.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/scmouse.c,v 1.3 2003/06/23 17:55:35 dillon Exp $ */ #include "opt_syscons.h" @@ -600,7 +600,7 @@ 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; @@ -654,8 +654,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/misc/syscons/scterm-dumb.c b/sys/dev/misc/syscons/scterm-dumb.c index 977159333b..d6038a0799 100644 --- a/sys/dev/misc/syscons/scterm-dumb.c +++ b/sys/dev/misc/syscons/scterm-dumb.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/scterm-dumb.c,v 1.2 2000/01/29 15:08:45 peter Exp $ - * $DragonFly: src/sys/dev/misc/syscons/scterm-dumb.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/scterm-dumb.c,v 1.3 2003/06/23 17:55:35 dillon Exp $ */ #include "opt_syscons.h" @@ -105,7 +105,7 @@ dumb_puts(scr_stat *scp, u_char *buf, int len) static int dumb_ioctl(scr_stat *scp, struct tty *tp, u_long cmd, caddr_t data, - int flag, struct proc *p) + int flag, struct thread *td) { vid_info_t *vi; diff --git a/sys/dev/misc/syscons/scterm-sc.c b/sys/dev/misc/syscons/scterm-sc.c index 7b0d90dd6d..5d6553f2e6 100644 --- a/sys/dev/misc/syscons/scterm-sc.c +++ b/sys/dev/misc/syscons/scterm-sc.c @@ -25,7 +25,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/scterm-sc.c,v 1.4.2.10 2001/06/11 09:05:39 phk Exp $ - * $DragonFly: src/sys/dev/misc/syscons/scterm-sc.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/scterm-sc.c,v 1.3 2003/06/23 17:55:35 dillon Exp $ */ #include "opt_syscons.h" @@ -678,7 +678,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/misc/syscons/scvesactl.c b/sys/dev/misc/syscons/scvesactl.c index 514f614608..69a0e84488 100644 --- a/sys/dev/misc/syscons/scvesactl.c +++ b/sys/dev/misc/syscons/scvesactl.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/scvesactl.c,v 1.15 2000/01/29 15:08:47 peter Exp $ - * $DragonFly: src/sys/dev/misc/syscons/Attic/scvesactl.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/Attic/scvesactl.c,v 1.3 2003/06/23 17:55:35 dillon Exp $ */ #include "opt_vga.h" @@ -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/misc/syscons/scvidctl.c b/sys/dev/misc/syscons/scvidctl.c index 8d84bab7d3..0b840748dc 100644 --- a/sys/dev/misc/syscons/scvidctl.c +++ b/sys/dev/misc/syscons/scvidctl.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/scvidctl.c,v 1.19.2.2 2000/05/05 09:16:08 nyan Exp $ - * $DragonFly: src/sys/dev/misc/syscons/scvidctl.c,v 1.2 2003/06/17 04:28:32 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/scvidctl.c,v 1.3 2003/06/23 17:55:35 dillon Exp $ */ #include "opt_syscons.h" @@ -434,7 +434,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/misc/syscons/syscons.c b/sys/dev/misc/syscons/syscons.c index e88f61fe08..f597925394 100644 --- a/sys/dev/misc/syscons/syscons.c +++ b/sys/dev/misc/syscons/syscons.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/syscons.c,v 1.336.2.15 2002/10/24 00:35:31 kbyanc Exp $ - * $DragonFly: src/sys/dev/misc/syscons/syscons.c,v 1.2 2003/06/17 04:28:32 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/syscons.c,v 1.3 2003/06/23 17:55:35 dillon Exp $ */ #include "splash.h" @@ -440,7 +440,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; @@ -479,7 +479,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_xxx(td->td_proc->p_ucred, 0)) return(EBUSY); error = (*linesw[tp->t_line].l_open)(dev, tp); @@ -499,7 +499,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; @@ -632,7 +632,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; @@ -640,28 +640,29 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) sc_softc_t *sc; scr_stat *scp; int s; + struct proc *p = td->td_proc; tp = dev->si_tty; /* 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 @@ -672,7 +673,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; } @@ -974,7 +975,7 @@ 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_xxx(td->td_proc->p_ucred, 0); if (error != 0) return error; if (securelevel > 0) @@ -1267,7 +1268,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/misc/syscons/syscons.h b/sys/dev/misc/syscons/syscons.h index 6075a9868c..ff25b750e4 100644 --- a/sys/dev/misc/syscons/syscons.h +++ b/sys/dev/misc/syscons/syscons.h @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/syscons.h,v 1.60.2.6 2002/09/15 22:30:45 dd Exp $ - * $DragonFly: src/sys/dev/misc/syscons/syscons.h,v 1.2 2003/06/17 04:28:32 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/syscons.h,v 1.3 2003/06/23 17:55:35 dillon Exp $ */ #ifndef _DEV_SYSCONS_SYSCONS_H_ @@ -330,7 +330,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 @@ -506,7 +506,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); @@ -546,7 +546,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 */ @@ -569,7 +569,7 @@ void sc_remove_all_mouse(sc_softc_t *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 */ @@ -579,7 +579,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/misc/syscons/sysmouse.c b/sys/dev/misc/syscons/sysmouse.c index 1398736dfb..f57101edb8 100644 --- a/sys/dev/misc/syscons/sysmouse.c +++ b/sys/dev/misc/syscons/sysmouse.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/sysmouse.c,v 1.2.2.2 2001/07/16 05:21:24 yokota Exp $ - * $DragonFly: src/sys/dev/misc/syscons/sysmouse.c,v 1.2 2003/06/17 04:28:32 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/sysmouse.c,v 1.3 2003/06/23 17:55:35 dillon Exp $ */ #include "opt_syscons.h" @@ -76,7 +76,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; @@ -103,7 +103,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_xxx(td->td_proc->p_ucred, 0)) { return EBUSY; } @@ -111,7 +111,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; @@ -155,7 +155,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; @@ -243,7 +243,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/netif/an/if_an.c b/sys/dev/netif/an/if_an.c index f4264543a4..3418595df0 100644 --- a/sys/dev/netif/an/if_an.c +++ b/sys/dev/netif/an/if_an.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/an/if_an.c,v 1.2.2.13 2003/02/11 03:32:48 ambrisko Exp $ - * $DragonFly: src/sys/dev/netif/an/if_an.c,v 1.2 2003/06/17 04:28:22 dillon Exp $ + * $DragonFly: src/sys/dev/netif/an/if_an.c,v 1.3 2003/06/23 17:55:28 dillon Exp $ * * $FreeBSD: src/sys/dev/an/if_an.c,v 1.2.2.13 2003/02/11 03:32:48 ambrisko Exp $ */ @@ -1917,7 +1917,7 @@ an_ioctl(ifp, command, data) break; #ifdef ANCACHE if (sc->areq.an_type == AN_RID_ZERO_CACHE) { - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) break; sc->an_sigitems = sc->an_nextitem = 0; @@ -1941,7 +1941,7 @@ an_ioctl(ifp, command, data) error = copyout(&sc->areq, ifr->ifr_data, sizeof(sc->areq)); break; case SIOCSAIRONET: - if ((error = suser(p))) + if ((error = suser_xxx(p->p_ucred, 0))) goto out; error = copyin(ifr->ifr_data, &sc->areq, sizeof(sc->areq)); if (error != 0) @@ -1949,7 +1949,7 @@ an_ioctl(ifp, command, data) an_setdef(sc, &sc->areq); break; case SIOCGPRIVATE_0: /* used by Cisco client utility */ - if ((error = suser(p))) + if ((error = suser_xxx(p->p_ucred, 0))) goto out; copyin(ifr->ifr_data, &l_ioctl, sizeof(l_ioctl)); mode = l_ioctl.command; @@ -1969,7 +1969,7 @@ an_ioctl(ifp, command, data) break; case SIOCGPRIVATE_1: /* used by Cisco client utility */ - if ((error = suser(p))) + if ((error = suser_xxx(p->p_ucred, 0))) goto out; copyin(ifr->ifr_data, &l_ioctl, sizeof(l_ioctl)); l_ioctl.command = 0; @@ -2202,7 +2202,7 @@ an_ioctl(ifp, command, data) } break; case SIOCS80211: - if ((error = suser(p))) + if ((error = suser_xxx(p->p_ucred, 0))) goto out; sc->areq.an_len = sizeof(sc->areq); /* diff --git a/sys/dev/netif/awi/awi.c b/sys/dev/netif/awi/awi.c index 84d754e9f6..d82e02d191 100644 --- a/sys/dev/netif/awi/awi.c +++ b/sys/dev/netif/awi/awi.c @@ -1,6 +1,6 @@ /* $NetBSD: awi.c,v 1.26 2000/07/21 04:48:55 onoe Exp $ */ /* $FreeBSD: src/sys/dev/awi/awi.c,v 1.10.2.2 2003/01/23 21:06:42 sam Exp $ */ -/* $DragonFly: src/sys/dev/netif/awi/Attic/awi.c,v 1.2 2003/06/17 04:28:22 dillon Exp $ */ +/* $DragonFly: src/sys/dev/netif/awi/Attic/awi.c,v 1.3 2003/06/23 17:55:29 dillon Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -455,6 +455,7 @@ awi_ioctl(ifp, cmd, data) u_long cmd; caddr_t data; { + struct proc *cur = curproc; struct awi_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; @@ -520,7 +521,7 @@ awi_ioctl(ifp, cmd, data) break; case SIOCS80211NWID: #ifdef __FreeBSD__ - error = suser(curproc); + error = suser_xxx(cur->p_ucred, 0); if (error) break; #endif @@ -554,7 +555,7 @@ awi_ioctl(ifp, cmd, data) break; case SIOCS80211NWKEY: #ifdef __FreeBSD__ - error = suser(curproc); + error = suser_xxx(cur->p_ucred, 0); if (error) break; #endif diff --git a/sys/dev/netif/awi/awi_wep.c b/sys/dev/netif/awi/awi_wep.c index 266f7cfaee..773055e479 100644 --- a/sys/dev/netif/awi/awi_wep.c +++ b/sys/dev/netif/awi/awi_wep.c @@ -1,6 +1,6 @@ /* $NetBSD: awi_wep.c,v 1.4 2000/08/14 11:28:03 onoe Exp $ */ /* $FreeBSD: src/sys/dev/awi/awi_wep.c,v 1.3.2.2 2003/01/23 21:06:42 sam Exp $ */ -/* $DragonFly: src/sys/dev/netif/awi/Attic/awi_wep.c,v 1.2 2003/06/17 04:28:22 dillon Exp $ */ +/* $DragonFly: src/sys/dev/netif/awi/Attic/awi_wep.c,v 1.3 2003/06/23 17:55:29 dillon Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -184,6 +184,7 @@ awi_wep_getnwkey(sc, nwkey) struct awi_softc *sc; struct ieee80211_nwkey *nwkey; { + struct proc *cur = curproc; int i, len, error, suerr; u_int8_t keybuf[AWI_MAX_KEYLEN]; @@ -191,7 +192,7 @@ awi_wep_getnwkey(sc, nwkey) nwkey->i_defkid = sc->sc_wep_defkid + 1; /* do not show any keys to non-root user */ #ifdef __FreeBSD__ - suerr = suser(curproc); + suerr = suser_xxx(cur->p_ucred, 0); #else suerr = suser(curproc->p_ucred, &curproc->p_acflag); #endif diff --git a/sys/dev/netif/awi/awi_wicfg.c b/sys/dev/netif/awi/awi_wicfg.c index d89736d775..eac279d419 100644 --- a/sys/dev/netif/awi/awi_wicfg.c +++ b/sys/dev/netif/awi/awi_wicfg.c @@ -1,6 +1,6 @@ /* $NetBSD: awi_wicfg.c,v 1.3 2000/07/06 17:22:25 onoe Exp $ */ /* $FreeBSD: src/sys/dev/awi/awi_wicfg.c,v 1.3.2.2 2002/06/18 08:06:15 jhay Exp $ */ -/* $DragonFly: src/sys/dev/netif/awi/Attic/awi_wicfg.c,v 1.2 2003/06/17 04:28:22 dillon Exp $ */ +/* $DragonFly: src/sys/dev/netif/awi/Attic/awi_wicfg.c,v 1.3 2003/06/23 17:55:29 dillon Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -103,6 +103,7 @@ awi_wicfg(ifp, cmd, data) caddr_t data; { int error; + struct proc *cur = curproc; switch (cmd) { case SIOCGWAVELAN: @@ -110,7 +111,7 @@ awi_wicfg(ifp, cmd, data) break; case SIOCSWAVELAN: #ifdef __FreeBSD__ - error = suser(curproc); + error = suser_xxx(cur->p_ucred, 0); #else error = suser(curproc->p_ucred, &curproc->p_acflag); #endif @@ -142,6 +143,7 @@ awi_cfgget(ifp, cmd, data) struct wi_sigcache wsc; struct awi_bss *bp; #endif /* WICACHE */ + struct proc *cur = curproc; error = copyin(ifr->ifr_data, &wreq, sizeof(wreq)); if (error) @@ -274,7 +276,7 @@ awi_cfgget(ifp, cmd, data) keys = (struct wi_ltv_keys *)&wreq; /* do not show keys to non-root user */ #ifdef __FreeBSD__ - error = suser(curproc); + error = suser_xxx(cur->p_ucred, 0); #else error = suser(curproc->p_ucred, &curproc->p_acflag); #endif diff --git a/sys/dev/netif/sbni/if_sbni.c b/sys/dev/netif/sbni/if_sbni.c index 87532906d2..3890a9b546 100644 --- a/sys/dev/netif/sbni/if_sbni.c +++ b/sys/dev/netif/sbni/if_sbni.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sbni/if_sbni.c,v 1.1.2.4 2002/08/11 09:32:00 fjoe Exp $ - * $DragonFly: src/sys/dev/netif/sbni/if_sbni.c,v 1.2 2003/06/17 04:28:29 dillon Exp $ + * $DragonFly: src/sys/dev/netif/sbni/if_sbni.c,v 1.3 2003/06/23 17:55:34 dillon Exp $ */ /* @@ -1050,16 +1050,15 @@ timeout_change_level(struct sbni_softc *sc) static int sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { + struct proc *p = curproc; struct sbni_softc *sc; struct ifreq *ifr; - struct proc *p; struct sbni_in_stats *in_stats; struct sbni_flags flags; int error, s; sc = ifp->if_softc; ifr = (struct ifreq *)data; - p = curproc; error = 0; s = splimp(); @@ -1124,7 +1123,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t data) case SIOCSHWFLAGS: /* set flags */ /* root only */ - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) break; flags = *(struct sbni_flags*)&ifr->ifr_data; @@ -1146,7 +1145,7 @@ sbni_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; case SIOCRINSTATS: - if (!(error = suser(p))) /* root only */ + if (!(error = suser_xxx(p->p_ucred, 0))) /* root only */ bzero(&sc->in_stats, sizeof(struct sbni_in_stats)); break; diff --git a/sys/dev/netif/sbsh/if_sbsh.c b/sys/dev/netif/sbsh/if_sbsh.c index de5501d777..02edfe9e0c 100644 --- a/sys/dev/netif/sbsh/if_sbsh.c +++ b/sys/dev/netif/sbsh/if_sbsh.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sbsh/if_sbsh.c,v 1.3.2.1 2003/04/15 18:15:07 fjoe Exp $ - * $DragonFly: src/sys/dev/netif/sbsh/if_sbsh.c,v 1.2 2003/06/17 04:28:29 dillon Exp $ + * $DragonFly: src/sys/dev/netif/sbsh/if_sbsh.c,v 1.3 2003/06/23 17:55:34 dillon Exp $ */ #include @@ -404,15 +404,17 @@ sbsh_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct ifreq *ifr = (struct ifreq *) data; struct cx28975_cfg cfg; struct dsl_stats ds; - + struct proc *p = curproc; int s, error = 0; u_int8_t t; + KKASSERT(p != NULL); + s = splimp(); switch(cmd) { case SIOCLOADFIRMW: - if ((error = suser(curproc)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; if (ifp->if_flags & IFF_UP) error = EBUSY; @@ -432,7 +434,7 @@ sbsh_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCGETSTATS : - if ((error = suser(curproc)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; t = 0; @@ -466,7 +468,7 @@ sbsh_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCCLRSTATS : - if (!(error = suser(curproc))) { + if (!(error = suser_xxx(p->p_ucred, 0))) { bzero(&sc->in_stats, sizeof(struct sbni16_stats)); t = 2; if (issue_cx28975_cmd(sc, _DSL_CLEAR_ERROR_CTRS, &t, 1)) diff --git a/sys/dev/netif/wi/if_wi.c b/sys/dev/netif/wi/if_wi.c index 5d5aa39362..bab58ece7e 100644 --- a/sys/dev/netif/wi/if_wi.c +++ b/sys/dev/netif/wi/if_wi.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/wi/if_wi.c,v 1.103.2.2 2002/08/02 07:11:34 imp Exp $ - * $DragonFly: src/sys/dev/netif/wi/if_wi.c,v 1.2 2003/06/17 04:28:33 dillon Exp $ + * $DragonFly: src/sys/dev/netif/wi/if_wi.c,v 1.3 2003/06/23 17:55:37 dillon Exp $ */ /* @@ -1631,7 +1631,7 @@ wi_ioctl(ifp, command, data) #if __FreeBSD_version >= 500000 struct thread *td = curthread; #else - struct proc *td = curproc; /* Little white lie */ + struct proc *p = curproc; /* Little white lie */ #endif int s; @@ -1698,7 +1698,7 @@ wi_ioctl(ifp, command, data) break; } /* Don't show WEP keys to non-root users. */ - if (wreq.wi_type == WI_RID_DEFLT_CRYPT_KEYS && suser(td)) + if (wreq.wi_type == WI_RID_DEFLT_CRYPT_KEYS && suser_xxx(p->p_ucred, 0)) break; if (wreq.wi_type == WI_RID_IFACE_STATS) { bcopy((char *)&sc->wi_stats, (char *)&wreq.wi_val, @@ -1743,7 +1743,7 @@ wi_ioctl(ifp, command, data) error = copyout(&wreq, ifr->ifr_data, sizeof(wreq)); break; case SIOCSWAVELAN: - if ((error = suser(td))) + if ((error = suser_xxx(p->p_ucred, 0))) goto out; error = copyin(ifr->ifr_data, &wreq, sizeof(wreq)); if (error) @@ -1790,7 +1790,7 @@ wi_ioctl(ifp, command, data) error = copyout(&wreq, ifr->ifr_data, sizeof(wreq)); break; case SIOCSPRISM2DEBUG: - if ((error = suser(td))) + if ((error = suser_xxx(p->p_ucred, 0))) goto out; error = copyin(ifr->ifr_data, &wreq, sizeof(wreq)); if (error) @@ -1839,7 +1839,7 @@ wi_ioctl(ifp, command, data) break; } len = sc->wi_keys.wi_keys[ireq->i_val].wi_keylen; - if (suser(td)) + if (suser_xxx(p->p_ucred, 0)) bcopy(sc->wi_keys.wi_keys[ireq->i_val].wi_keydat, tmpkey, len); else @@ -1892,7 +1892,7 @@ wi_ioctl(ifp, command, data) } break; case SIOCS80211: - if ((error = suser(td))) + if ((error = suser_xxx(p->p_ucred, 0))) goto out; switch(ireq->i_type) { case IEEE80211_IOC_SSID: diff --git a/sys/dev/netif/wi/wi_hostap.c b/sys/dev/netif/wi/wi_hostap.c index 62999f7637..dcee68b1fb 100644 --- a/sys/dev/netif/wi/wi_hostap.c +++ b/sys/dev/netif/wi/wi_hostap.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/wi/wi_hostap.c,v 1.7.2.4 2002/08/02 07:11:34 imp Exp $ - * $DragonFly: src/sys/dev/netif/wi/Attic/wi_hostap.c,v 1.2 2003/06/17 04:28:33 dillon Exp $ + * $DragonFly: src/sys/dev/netif/wi/Attic/wi_hostap.c,v 1.3 2003/06/23 17:55:37 dillon Exp $ */ /* This is experimental Host AP software for Prism 2 802.11b interfaces. @@ -1138,7 +1138,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) #if __FreeBSD_version >= 500000 struct thread *td = curthread; #else - struct proc *td = curproc; /* Little white lie */ + struct proc *proc = curproc; /* Little white lie */ #endif if (!(sc->arpcom.ac_if.if_flags & IFF_RUNNING)) @@ -1146,7 +1146,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) switch (command) { case SIOCHOSTAP_DEL: - if ((error = suser(td))) + if ((error = suser_xxx(proc->p_ucred, 0))) break; if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta)))) break; @@ -1190,7 +1190,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) break; case SIOCHOSTAP_ADD: - if ((error = suser(td))) + if ((error = suser_xxx(proc->p_ucred, 0))) break; if ((error = copyin(ifr->ifr_data, &reqsta, sizeof(reqsta)))) break; @@ -1214,7 +1214,7 @@ wihap_ioctl(struct wi_softc *sc, u_long command, caddr_t data) break; case SIOCHOSTAP_SFLAGS: - if ((error = suser(td))) + if ((error = suser_xxx(proc->p_ucred, 0))) break; if ((error = copyin(ifr->ifr_data, &flag, sizeof(int)))) break; diff --git a/sys/dev/raid/aac/aacvar.h b/sys/dev/raid/aac/aacvar.h index 1e7bcdb75d..1a8afa1285 100644 --- a/sys/dev/raid/aac/aacvar.h +++ b/sys/dev/raid/aac/aacvar.h @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/aac/aacvar.h,v 1.4.2.7 2003/04/08 13:22:08 scottl Exp $ - * $DragonFly: src/sys/dev/raid/aac/aacvar.h,v 1.2 2003/06/17 04:28:21 dillon Exp $ + * $DragonFly: src/sys/dev/raid/aac/aacvar.h,v 1.3 2003/06/23 17:55:28 dillon Exp $ */ /* @@ -355,7 +355,7 @@ struct aac_softc int aac_aifq_head; int aac_aifq_tail; struct selinfo rcv_select; - struct proc *aifthread; + struct thread *aifthread; int aifflags; #define AAC_AIFFLAGS_RUNNING (1 << 0) #define AAC_AIFFLAGS_PENDING (1 << 1) diff --git a/sys/dev/raid/asr/asr.c b/sys/dev/raid/asr/asr.c index 2e53ced741..7ef23cecb5 100644 --- a/sys/dev/raid/asr/asr.c +++ b/sys/dev/raid/asr/asr.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/asr/asr.c,v 1.3.2.2 2001/08/23 05:21:29 scottl Exp $ */ -/* $DragonFly: src/sys/dev/raid/asr/asr.c,v 1.2 2003/06/17 04:28:22 dillon Exp $ */ +/* $DragonFly: src/sys/dev/raid/asr/asr.c,v 1.3 2003/06/23 17:55:28 dillon Exp $ */ /* * Copyright (c) 1996-2000 Distributed Processing Technology Corporation * Copyright (c) 2000-2001 Adaptec Corporation @@ -460,12 +460,12 @@ STATIC int asr_open __P(( IN dev_t dev, int32_t flags, int32_t ifmt, - IN struct proc * proc)); + IN d_thread_t * proc)); STATIC int asr_close __P(( dev_t dev, int flags, int ifmt, - struct proc * proc)); + d_thread_t * proc)); STATIC int asr_intr __P(( IN Asr_softc_t * sc)); STATIC void asr_timeout __P(( @@ -3872,7 +3872,7 @@ asr_open( IN dev_t dev, int32_t flags, int32_t ifmt, - IN struct proc * proc) + IN d_thread_t *td) { int s; OUT int error; @@ -3885,7 +3885,7 @@ asr_open( s = splcam (); if (ASR_ctlr_held) { error = EBUSY; - } else if ((error = suser(proc)) == 0) { + } else if ((error = suser_xxx(td->td_proc->p_ucred, 0)) == 0) { ++ASR_ctlr_held; } splx(s); @@ -3897,12 +3897,12 @@ asr_close( dev_t dev, int flags, int ifmt, - struct proc * proc) + d_thread_t *td) { UNREFERENCED_PARAMETER(dev); UNREFERENCED_PARAMETER(flags); UNREFERENCED_PARAMETER(ifmt); - UNREFERENCED_PARAMETER(proc); + UNREFERENCED_PARAMETER(td); ASR_ctlr_held = 0; return (0); diff --git a/sys/dev/raid/ida/ida.c b/sys/dev/raid/ida/ida.c index a39124e535..e1118686fa 100644 --- a/sys/dev/raid/ida/ida.c +++ b/sys/dev/raid/ida/ida.c @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ida/ida.c,v 1.7.2.3 2001/03/01 01:57:32 ps Exp $ - * $DragonFly: src/sys/dev/raid/ida/ida.c,v 1.2 2003/06/17 04:28:27 dillon Exp $ + * $DragonFly: src/sys/dev/raid/ida/ida.c,v 1.3 2003/06/23 17:55:31 dillon Exp $ */ /* @@ -46,7 +46,7 @@ #include #include #include - +#include #include #include #include @@ -59,6 +59,7 @@ #include #include #include +#include #include #include diff --git a/sys/dev/raid/ida/ida_disk.c b/sys/dev/raid/ida/ida_disk.c index d7269cfc4e..b95ee6a65a 100644 --- a/sys/dev/raid/ida/ida_disk.c +++ b/sys/dev/raid/ida/ida_disk.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ida/ida_disk.c,v 1.12.2.6 2001/11/27 20:21:02 ps Exp $ - * $DragonFly: src/sys/dev/raid/ida/ida_disk.c,v 1.2 2003/06/17 04:28:27 dillon Exp $ + * $DragonFly: src/sys/dev/raid/ida/ida_disk.c,v 1.3 2003/06/23 17:55:31 dillon Exp $ */ /* @@ -115,7 +115,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, d_thread_t *td) { struct idad_softc *drv; struct disklabel *label; @@ -138,7 +138,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, d_thread_t *td) { struct idad_softc *drv; diff --git a/sys/dev/raid/mlx/mlx.c b/sys/dev/raid/mlx/mlx.c index ffe7cacb4e..775cab0cdc 100644 --- a/sys/dev/raid/mlx/mlx.c +++ b/sys/dev/raid/mlx/mlx.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mlx/mlx.c,v 1.14.2.5 2001/09/11 09:49:53 kris Exp $ - * $DragonFly: src/sys/dev/raid/mlx/mlx.c,v 1.2 2003/06/17 04:28:28 dillon Exp $ + * $DragonFly: src/sys/dev/raid/mlx/mlx.c,v 1.3 2003/06/23 17:55:32 dillon Exp $ */ /* @@ -715,7 +715,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, d_thread_t *td) { int unit = minor(dev); struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit); @@ -728,7 +728,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, d_thread_t *td) { int unit = minor(dev); struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit); @@ -741,7 +741,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, d_thread_t *td) { int unit = minor(dev); struct mlx_softc *sc = devclass_get_softc(mlx_devclass, unit); @@ -928,7 +928,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, d_thread_t *td) { int *arg = (int *)addr; int error, result; diff --git a/sys/dev/raid/mlx/mlx_disk.c b/sys/dev/raid/mlx/mlx_disk.c index 39114d3e18..28b1ea423a 100644 --- a/sys/dev/raid/mlx/mlx_disk.c +++ b/sys/dev/raid/mlx/mlx_disk.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mlx/mlx_disk.c,v 1.8.2.4 2001/06/25 04:37:51 msmith Exp $ - * $DragonFly: src/sys/dev/raid/mlx/mlx_disk.c,v 1.2 2003/06/17 04:28:28 dillon Exp $ + * $DragonFly: src/sys/dev/raid/mlx/mlx_disk.c,v 1.3 2003/06/23 17:55:32 dillon Exp $ */ /* @@ -96,7 +96,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, d_thread_t *td) { struct mlxd_softc *sc = (struct mlxd_softc *)dev->si_drv1; struct disklabel *label; @@ -125,7 +125,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, d_thread_t *td) { struct mlxd_softc *sc = (struct mlxd_softc *)dev->si_drv1; @@ -138,7 +138,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, d_thread_t *td) { struct mlxd_softc *sc = (struct mlxd_softc *)dev->si_drv1; int error; @@ -148,7 +148,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/raid/mlx/mlxvar.h b/sys/dev/raid/mlx/mlxvar.h index 9e67df2e94..256967844e 100644 --- a/sys/dev/raid/mlx/mlxvar.h +++ b/sys/dev/raid/mlx/mlxvar.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mlx/mlxvar.h,v 1.5.2.3 2001/06/25 04:37:51 msmith Exp $ - * $DragonFly: src/sys/dev/raid/mlx/mlxvar.h,v 1.2 2003/06/17 04:28:28 dillon Exp $ + * $DragonFly: src/sys/dev/raid/mlx/mlxvar.h,v 1.3 2003/06/23 17:55:32 dillon Exp $ */ /* @@ -242,7 +242,7 @@ struct mlxd_softc */ 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); + caddr_t addr, int32_t flag, d_thread_t *td); extern void mlxd_intr(void *data); diff --git a/sys/dev/raid/mly/mly.c b/sys/dev/raid/mly/mly.c index 1a70a10714..16a1c67169 100644 --- a/sys/dev/raid/mly/mly.c +++ b/sys/dev/raid/mly/mly.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mly/mly.c,v 1.3.2.3 2001/03/05 20:17:24 msmith Exp $ - * $DragonFly: src/sys/dev/raid/mly/mly.c,v 1.2 2003/06/17 04:28:28 dillon Exp $ + * $DragonFly: src/sys/dev/raid/mly/mly.c,v 1.3 2003/06/23 17:55:32 dillon Exp $ */ #include @@ -1712,7 +1712,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, d_thread_t *td) { int unit = minor(dev); struct mly_softc *sc = devclass_get_softc(devclass_find("mly"), unit); @@ -1725,7 +1725,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, d_thread_t *td) { int unit = minor(dev); struct mly_softc *sc = devclass_get_softc(devclass_find("mly"), unit); @@ -1738,7 +1738,7 @@ 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, d_thread_t *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/raid/vinum/vinum.c b/sys/dev/raid/vinum/vinum.c index c178720925..b738856aeb 100644 --- a/sys/dev/raid/vinum/vinum.c +++ b/sys/dev/raid/vinum/vinum.c @@ -37,7 +37,7 @@ * * $Id: vinum.c,v 1.33 2001/01/09 06:19:15 grog Exp grog $ * $FreeBSD: src/sys/dev/vinum/vinum.c,v 1.38.2.3 2003/01/07 12:14:16 joerg Exp $ - * $DragonFly: src/sys/dev/raid/vinum/vinum.c,v 1.2 2003/06/17 04:28:33 dillon Exp $ + * $DragonFly: src/sys/dev/raid/vinum/vinum.c,v 1.3 2003/06/23 17:55:36 dillon Exp $ */ #define STATIC static /* nothing while we're testing XXX */ @@ -233,8 +233,7 @@ free_vinum(int cleardrive) STATIC int vinum_modevent(module_t mod, modeventtype_t type, void *unused) { - struct sync_args dummyarg = - {0}; + struct sync_args dummyarg = {0}; switch (type) { case MOD_LOAD: @@ -244,7 +243,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(&dummyarg); /* write out buffers */ free_vinum(0); /* clean up */ #ifdef VINUMDEBUG if (total_malloced) { @@ -294,10 +293,7 @@ DECLARE_MODULE(vinum, vinum_mod, SI_SUB_VINUM, SI_ORDER_MIDDLE); /* ARGSUSED */ /* Open a vinum object */ int -vinumopen(dev_t dev, - int flags, - int fmt, - struct proc *p) +vinumopen(dev_t dev, int flags, int fmt, d_thread_t *td) { int error; unsigned int index; @@ -305,6 +301,9 @@ vinumopen(dev_t dev, struct plex *plex; struct sd *sd; int devminor; /* minor number */ + struct proc *p = td->td_proc; + + KKASSERT(p != NULL); devminor = minor(dev); error = 0; @@ -382,7 +381,7 @@ vinumopen(dev_t dev, } case VINUM_SUPERDEV_TYPE: - error = suser(p); /* are we root? */ + error = suser_xxx(p->p_ucred, 0); /* are we root? */ if (error == 0) { /* yes, can do */ if (devminor == VINUM_DAEMON_DEV) /* daemon device */ vinum_conf.flags |= VF_DAEMONOPEN; /* we're open */ @@ -403,10 +402,7 @@ vinumopen(dev_t dev, /* ARGSUSED */ int -vinumclose(dev_t dev, - int flags, - int fmt, - struct proc *p) +vinumclose(dev_t dev, int flags, int fmt, d_thread_t *td) { unsigned int index; struct volume *vol; diff --git a/sys/dev/raid/vinum/vinumio.c b/sys/dev/raid/vinum/vinumio.c index 52047d9749..6b9b9e8bc1 100644 --- a/sys/dev/raid/vinum/vinumio.c +++ b/sys/dev/raid/vinum/vinumio.c @@ -35,7 +35,7 @@ * * $Id: vinumio.c,v 1.30 2000/05/10 23:23:30 grog Exp grog $ * $FreeBSD: src/sys/dev/vinum/vinumio.c,v 1.52.2.6 2002/05/02 08:43:44 grog Exp $ - * $DragonFly: src/sys/dev/raid/vinum/vinumio.c,v 1.2 2003/06/17 04:28:33 dillon Exp $ + * $DragonFly: src/sys/dev/raid/vinum/vinumio.c,v 1.3 2003/06/23 17:55:36 dillon Exp $ */ #include @@ -226,7 +226,7 @@ init_drive(struct drive *drive, int verbose) DIOCGPART, (caddr_t) & drive->partinfo, FREAD, - curproc); + curthread); if (drive->lasterror) { if (verbose) log(LOG_WARNING, @@ -670,7 +670,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) @@ -683,7 +683,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/raid/vinum/vinumioctl.c b/sys/dev/raid/vinum/vinumioctl.c index c03503b4d0..01144572f8 100644 --- a/sys/dev/raid/vinum/vinumioctl.c +++ b/sys/dev/raid/vinum/vinumioctl.c @@ -43,7 +43,7 @@ * * $Id: vinumioctl.c,v 1.14 2000/10/27 03:07:53 grog Exp grog $ * $FreeBSD: src/sys/dev/vinum/vinumioctl.c,v 1.25.2.4 2002/02/03 00:44:19 grog Exp $ - * $DragonFly: src/sys/dev/raid/vinum/vinumioctl.c,v 1.2 2003/06/17 04:28:33 dillon Exp $ + * $DragonFly: src/sys/dev/raid/vinum/vinumioctl.c,v 1.3 2003/06/23 17:55:36 dillon Exp $ */ #include @@ -63,11 +63,7 @@ jmp_buf command_fail; /* return on a failed command */ /* ioctl routine */ int -vinumioctl(dev_t dev, - u_long cmd, - caddr_t data, - int flag, - struct proc *p) +vinumioctl(dev_t dev, u_long cmd, caddr_t data, int flag, d_thread_t *td) { unsigned int objno; int error = 0; diff --git a/sys/dev/serial/rp/rp.c b/sys/dev/serial/rp/rp.c index 6e133a8de8..18681ec611 100644 --- a/sys/dev/serial/rp/rp.c +++ b/sys/dev/serial/rp/rp.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/rp/rp.c,v 1.45.2.2 2002/11/07 22:26:59 tegge Exp $ - * $DragonFly: src/sys/dev/serial/rp/rp.c,v 1.2 2003/06/17 04:28:29 dillon Exp $ + * $DragonFly: src/sys/dev/serial/rp/rp.c,v 1.3 2003/06/23 17:55:33 dillon Exp $ */ /* @@ -956,17 +956,16 @@ rp_releaseresource(CONTROLLER_t *ctlp) } int -rpopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +rpopen(dev_t dev, int flag, int mode, d_thread_t *td) { struct rp_port *rp; int unit, port, mynor, umynor, flags; /* SG */ struct tty *tp; int oldspl, error; unsigned int IntMask, ChanStatus; + struct proc *p = td->td_proc; + KKASSERT(p != NULL); umynor = (((minor(dev) >> 16) -1) * 32); /* SG */ port = (minor(dev) & 0x1f); /* SG */ @@ -1010,7 +1009,7 @@ open_top: goto open_top; } } - if(tp->t_state & TS_XCLUDE && suser(p) != 0) { + if(tp->t_state & TS_XCLUDE && suser_xxx(p->p_ucred, 0) != 0) { splx(oldspl); error = EBUSY; goto out2; @@ -1115,10 +1114,7 @@ out2: } int -rpclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +rpclose(dev_t dev, int flag, int mode, d_thread_t *td) { int oldspl, unit, mynor, umynor, port; /* SG */ struct rp_port *rp; @@ -1230,12 +1226,7 @@ rpdtrwakeup(void *chan) } int -rpioctl(dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +rpioctl(dev_t dev, u_long cmd, caddr_t data, int flag, d_thread_t *td) { struct rp_port *rp; CHANNEL_t *cp; @@ -1245,6 +1236,9 @@ rpioctl(dev, cmd, data, flag, p) int error = 0; int arg, flags, result, ChanStatus; struct termios *t; + struct proc *p = td->td_proc; + + KKASSERT(p != NULL); umynor = (((minor(dev) >> 16) -1) * 32); /* SG */ port = (minor(dev) & 0x1f); /* SG */ @@ -1267,7 +1261,7 @@ rpioctl(dev, cmd, data, flag, p) } switch (cmd) { case TIOCSETA: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if(error != 0) return(error); *ct = *(struct termios *)data; @@ -1324,7 +1318,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); } @@ -1412,7 +1406,7 @@ rpioctl(dev, cmd, data, flag, p) *(int *)data = result; break; case TIOCMSDTRWAIT: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if(error != 0) { splx(oldspl); return(error); diff --git a/sys/dev/serial/sio/sio.c b/sys/dev/serial/sio/sio.c index 12f5820726..ad9dc8b8a2 100644 --- a/sys/dev/serial/sio/sio.c +++ b/sys/dev/serial/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/isa/sio.c,v 1.291.2.35 2003/05/18 08:51:15 murray Exp $ - * $DragonFly: src/sys/dev/serial/sio/sio.c,v 1.2 2003/06/17 04:28:40 dillon Exp $ + * $DragonFly: src/sys/dev/serial/sio/sio.c,v 1.3 2003/06/23 17:55:40 dillon Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -1462,11 +1462,7 @@ determined_type: ; } static int -sioopen(dev, flag, mode, p) - dev_t dev; - int flag; - int mode; - struct proc *p; +sioopen(dev_t dev, int flag, int mode, struct thread *td) { struct com_s *com; int error; @@ -1524,7 +1520,7 @@ open_top: } } if (tp->t_state & TS_XCLUDE && - suser(p)) { + suser_xxx(td->td_proc->p_ucred, 0)) { error = EBUSY; goto out; } @@ -1644,11 +1640,7 @@ out: } static int -sioclose(dev, flag, mode, p) - dev_t dev; - int flag; - int mode; - struct proc *p; +sioclose(dev_t dev, int flag, int mode, struct thread *td) { struct com_s *com; int mynor; @@ -2202,12 +2194,7 @@ cont: } static int -sioioctl(dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +sioioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct com_s *com; int error; @@ -2238,7 +2225,7 @@ sioioctl(dev, cmd, data, flag, p) } switch (cmd) { case TIOCSETA: - error = suser(p); + error = suser_xxx(td->td_proc->p_ucred, 0); if (error != 0) return (error); *ct = *(struct termios *)data; @@ -2288,7 +2275,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(); @@ -2329,7 +2316,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_xxx(td->td_proc->p_ucred, 0); if (error != 0) { splx(s); return (error); diff --git a/sys/dev/sound/isa/i386/spkr/spkr.c b/sys/dev/sound/isa/i386/spkr/spkr.c index f31fb0dcc2..75dc8bcf4e 100644 --- a/sys/dev/sound/isa/i386/spkr/spkr.c +++ b/sys/dev/sound/isa/i386/spkr/spkr.c @@ -5,7 +5,7 @@ * modified for FreeBSD by Andrew A. Chernov * * $FreeBSD: src/sys/i386/isa/spkr.c,v 1.45 2000/01/29 16:00:32 peter Exp $ - * $DragonFly: src/sys/dev/sound/isa/i386/spkr/Attic/spkr.c,v 1.2 2003/06/17 04:28:37 dillon Exp $ + * $DragonFly: src/sys/dev/sound/isa/i386/spkr/Attic/spkr.c,v 1.3 2003/06/23 17:55:39 dillon Exp $ */ #include @@ -457,11 +457,7 @@ static int spkr_active = FALSE; /* exclusion flag */ static struct buf *spkr_inbuf; /* incoming buf */ int -spkropen(dev, flags, fmt, p) - dev_t dev; - int flags; - int fmt; - struct proc *p; +spkropen(dev_t dev, int flags, int fmt, struct thread *td) { #ifdef DEBUG (void) printf("spkropen: entering with dev = %s\n", devtoname(dev)); @@ -516,11 +512,7 @@ spkrwrite(dev, uio, ioflag) } int -spkrclose(dev, flags, fmt, p) - dev_t dev; - int flags; - int fmt; - struct proc *p; +spkrclose(dev_t dev, int flags, int fmt, struct thread *td) { #ifdef DEBUG (void) printf("spkrclose: entering with dev = %s\n", devtoname(dev)); @@ -539,12 +531,7 @@ spkrclose(dev, flags, fmt, p) } int -spkrioctl(dev, cmd, cmdarg, flags, p) - dev_t dev; - unsigned long cmd; - caddr_t cmdarg; - int flags; - struct proc *p; +spkrioctl(dev_t dev, unsigned long cmd, caddr_t cmdarg, int flags, struct thread*td) { #ifdef DEBUG (void) printf("spkrioctl: entering with dev = %s, cmd = %lx\n", diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index fccc0869bd..3fa0791ea7 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -25,14 +25,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/channel.c,v 1.19.2.19 2003/03/11 15:15:41 orion Exp $ - * $DragonFly: src/sys/dev/sound/pcm/channel.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/channel.c,v 1.3 2003/06/23 17:55:34 dillon Exp $ */ #include #include "feeder_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/channel.c,v 1.2 2003/06/17 04:28:31 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/channel.c,v 1.3 2003/06/23 17:55:34 dillon Exp $"); #define MIN_CHUNK_SIZE 256 /* for uiomove etc. */ #define DMA_ALIGN_THRESHOLD 4 @@ -540,7 +540,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(p->p_thread, sndbuf_getsel(bs)); return ret; } diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 34a6ba4665..3d1ca86db1 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/dsp.c,v 1.15.2.13 2002/08/30 13:53:03 orion Exp $ - * $DragonFly: src/sys/dev/sound/pcm/dsp.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/dsp.c,v 1.3 2003/06/23 17:55:34 dillon Exp $ */ #include @@ -32,7 +32,7 @@ #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/dsp.c,v 1.2 2003/06/17 04:28:31 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/dsp.c,v 1.3 2003/06/23 17:55:34 dillon Exp $"); #define OLDPCM_IOCTL @@ -172,13 +172,16 @@ 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; intrmask_t s; u_int32_t fmt; int devtype; + struct proc *p = td->td_proc; + + KKASSERT(p != NULL); s = spltty(); d = dsp_get_info(i_dev); @@ -312,7 +315,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; @@ -431,7 +434,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; @@ -448,7 +451,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(); @@ -962,7 +965,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; @@ -975,12 +978,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->td_proc); } if (rdch) { e = (events & (POLLIN | POLLRDNORM)); if (e) - ret |= chn_poll(rdch, e, p); + ret |= chn_poll(rdch, e, td->td_proc); } 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 a83cd0cf8c..65ef95ffa3 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -24,14 +24,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/mixer.c,v 1.4.2.8 2002/04/22 15:49:36 cg Exp $ - * $DragonFly: src/sys/dev/sound/pcm/mixer.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/mixer.c,v 1.3 2003/06/23 17:55:34 dillon Exp $ */ #include #include "mixer_if.h" -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/mixer.c,v 1.2 2003/06/17 04:28:31 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/mixer.c,v 1.3 2003/06/23 17:55:34 dillon Exp $"); MALLOC_DEFINE(M_MIXER, "mixer", "mixer"); @@ -395,7 +395,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; @@ -412,7 +412,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; @@ -434,7 +434,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 4c129fc10b..aba64bba6a 100644 --- a/sys/dev/sound/pcm/mixer.h +++ b/sys/dev/sound/pcm/mixer.h @@ -24,13 +24,13 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/mixer.h,v 1.2.2.6 2002/04/22 15:49:36 cg Exp $ - * $DragonFly: src/sys/dev/sound/pcm/mixer.h,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/mixer.h,v 1.3 2003/06/23 17:55:34 dillon Exp $ */ 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 d1834994a2..1936eca18c 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -24,13 +24,13 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/sound/pcm/sndstat.c,v 1.4.2.2 2002/04/22 15:49:36 cg Exp $ - * $DragonFly: src/sys/dev/sound/pcm/sndstat.c,v 1.2 2003/06/17 04:28:31 dillon Exp $ + * $DragonFly: src/sys/dev/sound/pcm/sndstat.c,v 1.3 2003/06/23 17:55:34 dillon Exp $ */ #include #include -SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/sndstat.c,v 1.2 2003/06/17 04:28:31 dillon Exp $"); +SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pcm/sndstat.c,v 1.3 2003/06/23 17:55:34 dillon Exp $"); #define SS_TYPE_MODULE 0 #define SS_TYPE_FIRST 1 @@ -107,7 +107,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; @@ -131,7 +131,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/usbmisc/ucom/ucom.c b/sys/dev/usbmisc/ucom/ucom.c index 58e6473a20..a130d5c449 100644 --- a/sys/dev/usbmisc/ucom/ucom.c +++ b/sys/dev/usbmisc/ucom/ucom.c @@ -1,6 +1,6 @@ /* $NetBSD: ucom.c,v 1.39 2001/08/16 22:31:24 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/ucom.c,v 1.24.2.2 2003/01/17 17:32:10 joe Exp $ */ -/* $DragonFly: src/sys/dev/usbmisc/ucom/ucom.c,v 1.2 2003/06/17 04:28:32 dillon Exp $ */ +/* $DragonFly: src/sys/dev/usbmisc/ucom/ucom.c,v 1.3 2003/06/23 17:55:36 dillon Exp $ */ /*- * Copyright (c) 2001-2002, Shunsuke Akiyama . @@ -259,7 +259,7 @@ ucom_shutdown(struct ucom_softc *sc) } Static int -ucomopen(dev_t dev, int flag, int mode, usb_proc_ptr p) +ucomopen(dev_t dev, int flag, int mode, usb_proc_ptr td) { int unit = UCOMUNIT(dev); struct ucom_softc *sc; @@ -267,6 +267,9 @@ ucomopen(dev_t dev, int flag, int mode, usb_proc_ptr p) struct tty *tp; int s; int error; + struct proc *p = td->td_proc; + + KKASSERT(p != NULL); USB_GET_SC_OPEN(ucom, unit, sc); @@ -279,7 +282,7 @@ ucomopen(dev_t dev, int flag, int mode, usb_proc_ptr p) if (ISSET(tp->t_state, TS_ISOPEN) && ISSET(tp->t_state, TS_XCLUDE) && - suser(p)) + suser_xxx(p->p_ucred, 0)) return (EBUSY); /* diff --git a/sys/dev/usbmisc/ugen/ugen.c b/sys/dev/usbmisc/ugen/ugen.c index 977d286519..207f2f5b11 100644 --- a/sys/dev/usbmisc/ugen/ugen.c +++ b/sys/dev/usbmisc/ugen/ugen.c @@ -1,6 +1,6 @@ /* $NetBSD: ugen.c,v 1.27 1999/10/28 12:08:38 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.38.2.9 2002/11/06 14:41:01 joe Exp $ */ -/* $DragonFly: src/sys/dev/usbmisc/ugen/ugen.c,v 1.2 2003/06/17 04:28:32 dillon Exp $ */ +/* $DragonFly: src/sys/dev/usbmisc/ugen/ugen.c,v 1.3 2003/06/23 17:55:36 dillon Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -1213,7 +1213,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_procp = p->td_proc; #if defined(__NetBSD__) || defined(__OpenBSD__) error = uiomove((caddr_t)cdesc, len, &uio); #elif defined(__FreeBSD__) @@ -1263,7 +1263,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, uio.uio_rw = ur->ucr_request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; - uio.uio_procp = p; + uio.uio_procp = p->td_proc; ptr = malloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); diff --git a/sys/dev/usbmisc/uhid/uhid.c b/sys/dev/usbmisc/uhid/uhid.c index db1ddcbdec..b35014ae34 100644 --- a/sys/dev/usbmisc/uhid/uhid.c +++ b/sys/dev/usbmisc/uhid/uhid.c @@ -1,6 +1,6 @@ /* $NetBSD: uhid.c,v 1.38 2000/04/27 15:26:48 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhid.c,v 1.27.2.12 2002/11/06 20:23:50 joe Exp $ */ -/* $DragonFly: src/sys/dev/usbmisc/uhid/uhid.c,v 1.2 2003/06/17 04:28:32 dillon Exp $ */ +/* $DragonFly: src/sys/dev/usbmisc/uhid/uhid.c,v 1.3 2003/06/23 17:55:36 dillon Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -598,7 +598,7 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, caddr_t addr, int flag, if (*(int *)addr) { if (sc->sc_async != NULL) return (EBUSY); - sc->sc_async = p; + sc->sc_async = p->td_proc; DPRINTF(("uhid_do_ioctl: FIOASYNC %p\n", p)); } else sc->sc_async = NULL; diff --git a/sys/dev/usbmisc/umodem/umodem.c b/sys/dev/usbmisc/umodem/umodem.c index 94f77b065b..76883b8c30 100644 --- a/sys/dev/usbmisc/umodem/umodem.c +++ b/sys/dev/usbmisc/umodem/umodem.c @@ -1,6 +1,6 @@ /* $NetBSD: umodem.c,v 1.5 1999/01/08 11:58:25 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/umodem.c,v 1.17.2.9 2002/11/06 20:23:50 joe Exp $ */ -/* $DragonFly: src/sys/dev/usbmisc/umodem/umodem.c,v 1.2 2003/06/17 04:28:32 dillon Exp $ */ +/* $DragonFly: src/sys/dev/usbmisc/umodem/umodem.c,v 1.3 2003/06/23 17:55:36 dillon Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -565,7 +565,7 @@ umodemparam(struct tty *tp, struct termios *t) } int -umodemopen(dev_t dev, int flag, int mode, usb_proc_ptr p) +umodemopen(dev_t dev, int flag, int mode, usb_proc_ptr td) { int unit = UMODEMUNIT(dev); struct umodem_softc *sc; @@ -573,6 +573,9 @@ umodemopen(dev_t dev, int flag, int mode, usb_proc_ptr p) struct tty *tp; int s; int error; + struct proc *p = td->td_proc; + + KKASSERT(p != NULL); USB_GET_SC_OPEN(umodem, unit, sc); diff --git a/sys/dev/usbmisc/urio/urio.c b/sys/dev/usbmisc/urio/urio.c index 9d85351095..f09dd5343b 100644 --- a/sys/dev/usbmisc/urio/urio.c +++ b/sys/dev/usbmisc/urio/urio.c @@ -29,7 +29,7 @@ */ /* $FreeBSD: src/sys/dev/usb/urio.c,v 1.11.2.4 2002/11/06 14:41:01 joe Exp $ */ -/* $DragonFly: src/sys/dev/usbmisc/urio/urio.c,v 1.2 2003/06/17 04:28:32 dillon Exp $ */ +/* $DragonFly: src/sys/dev/usbmisc/urio/urio.c,v 1.3 2003/06/23 17:55:36 dillon Exp $ */ /* * 2000/3/24 added NetBSD/OpenBSD support (from Alex Nemirovsky) @@ -69,6 +69,7 @@ #include #include #include +#include #include #include @@ -571,7 +572,7 @@ urioioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, usb_proc_ptr p) uio.uio_rw = req.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; - uio.uio_procp = p; + uio.uio_procp = p->td_proc; ptr = malloc(len, M_TEMP, M_WAITOK); if (uio.uio_rw == UIO_WRITE) { error = uiomove(ptr, len, &uio); diff --git a/sys/dev/video/bktr/bktr_core.c b/sys/dev/video/bktr/bktr_core.c index 663b4ecd48..13e31aae3d 100644 --- a/sys/dev/video/bktr/bktr_core.c +++ b/sys/dev/video/bktr/bktr_core.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.103.2.4 2000/11/01 09:36:14 roger Exp $ */ -/* $DragonFly: src/sys/dev/video/bktr/bktr_core.c,v 1.2 2003/06/17 04:28:23 dillon Exp $ */ +/* $DragonFly: src/sys/dev/video/bktr/bktr_core.c,v 1.3 2003/06/23 17:55:30 dillon Exp $ */ /* * This is part of the Driver for Video Capture Cards (Frame grabbers) @@ -1265,7 +1265,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; @@ -1552,8 +1552,9 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct pro return( EINVAL ); break; } + KKASSERT(td->td_proc != NULL); bktr->signal = *(int *) arg; - bktr->proc = pr; + bktr->proc = td->td_proc; break; case METEORGSIGNAL: @@ -1874,7 +1875,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/video/bktr/bktr_core.h b/sys/dev/video/bktr/bktr_core.h index 9676e13ced..f386a19634 100644 --- a/sys/dev/video/bktr/bktr_core.h +++ b/sys/dev/video/bktr/bktr_core.h @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/bktr/bktr_core.h,v 1.2.2.2 2000/09/11 07:59:57 roger Exp $ */ -/* $DragonFly: src/sys/dev/video/bktr/bktr_core.h,v 1.2 2003/06/17 04:28:23 dillon Exp $ */ +/* $DragonFly: src/sys/dev/video/bktr/bktr_core.h,v 1.3 2003/06/23 17:55:30 dillon Exp $ */ /* * This is part of the Driver for Video Capture Cards (Frame grabbers) @@ -83,13 +83,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 *td); 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 *td); int vbi_open( bktr_ptr_t bktr ); int vbi_close( bktr_ptr_t bktr ); diff --git a/sys/dev/video/bktr/bktr_os.c b/sys/dev/video/bktr/bktr_os.c index 637d5f706a..1a989e75a7 100644 --- a/sys/dev/video/bktr/bktr_os.c +++ b/sys/dev/video/bktr/bktr_os.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.4.2.3 2000/10/27 00:46:09 jhb Exp $ */ -/* $DragonFly: src/sys/dev/video/bktr/bktr_os.c,v 1.2 2003/06/17 04:28:23 dillon Exp $ */ +/* $DragonFly: src/sys/dev/video/bktr/bktr_os.c,v 1.3 2003/06/23 17:55:30 dillon Exp $ */ /* * This is part of the Driver for Video Capture Cards (Frame grabbers) @@ -557,7 +557,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, d_thread_t *td) { bktr_ptr_t bktr; int unit; @@ -637,7 +637,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, d_thread_t *td) { bktr_ptr_t bktr; int unit; @@ -714,7 +714,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, d_thread_t *td) { bktr_ptr_t bktr; int unit; @@ -733,9 +733,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 ); @@ -775,7 +775,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, d_thread_t *td) { int unit; bktr_ptr_t bktr; @@ -798,7 +798,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; @@ -1062,7 +1062,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, d_thread_t *td) { bktr_ptr_t bktr; int unit; @@ -1125,7 +1125,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, d_thread_t *td) { bktr_ptr_t bktr; int unit; @@ -1186,7 +1186,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, d_thread_t *td) { bktr_ptr_t bktr; int unit; @@ -1202,9 +1202,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 ); @@ -1240,7 +1240,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, d_thread_t *td) { int unit; bktr_ptr_t bktr; @@ -1603,7 +1603,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, d_thread_t *td) { bktr_ptr_t bktr; int unit; @@ -1636,7 +1636,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, d_thread_t *td) { bktr_ptr_t bktr; int unit; @@ -1695,7 +1695,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, d_thread_t *td) { bktr_ptr_t bktr; int unit; @@ -1709,9 +1709,9 @@ bktr_ioctl(dev_t dev, ioctl_cmd_t cmd, caddr_t arg, int flag, struct proc* pr) switch (FUNCTION(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); diff --git a/sys/emulation/ibcs2/i386/ibcs2_fcntl.c b/sys/emulation/ibcs2/i386/ibcs2_fcntl.c index e667af20e7..688b1c350d 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_fcntl.c +++ b/sys/emulation/ibcs2/i386/ibcs2_fcntl.c @@ -25,7 +25,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/ibcs2/ibcs2_fcntl.c,v 1.14 1999/09/19 17:00:14 green Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_fcntl.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_fcntl.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ #include "opt_spx_hack.h" @@ -168,25 +168,24 @@ oflags2ioflags(flags) } int -ibcs2_open(p, uap) - struct proc *p; - struct ibcs2_open_args *uap; +ibcs2_open(struct ibcs2_open_args *uap) { + struct proc *p = curproc; int noctty = SCARG(uap, flags) & IBCS2_O_NOCTTY; int ret; caddr_t sg = stackgap_init(); SCARG(uap, flags) = cvt_o_flags(SCARG(uap, flags)); if (SCARG(uap, flags) & O_CREAT) - CHECKALTCREAT(p, &sg, SCARG(uap, path)); + CHECKALTCREAT(&sg, SCARG(uap, path)); else - CHECKALTEXIST(p, &sg, SCARG(uap, path)); - ret = open(p, (struct open_args *)uap); + CHECKALTEXIST(&sg, SCARG(uap, path)); + ret = open((struct open_args *)uap); #ifdef SPX_HACK if (ret == ENXIO) { if (!strcmp(SCARG(uap, path), "/compat/ibcs2/dev/spx")) - ret = spx_open(p, uap); + ret = spx_open(uap); } else #endif /* SPX_HACK */ if (!ret && !noctty && SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) { @@ -201,39 +200,34 @@ ibcs2_open(p, uap) } int -ibcs2_creat(p, uap) - struct proc *p; - struct ibcs2_creat_args *uap; +ibcs2_creat(struct ibcs2_creat_args *uap) { struct open_args cup; caddr_t sg = stackgap_init(); - CHECKALTCREAT(p, &sg, SCARG(uap, path)); + CHECKALTCREAT(&sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, mode) = SCARG(uap, mode); SCARG(&cup, flags) = O_WRONLY | O_CREAT | O_TRUNC; - return open(p, &cup); + return open(&cup); } int -ibcs2_access(p, uap) - struct proc *p; - struct ibcs2_access_args *uap; +ibcs2_access(struct ibcs2_access_args *uap) { struct access_args cup; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, flags) = SCARG(uap, flags); - return access(p, &cup); + return access(&cup); } int -ibcs2_fcntl(p, uap) - struct proc *p; - struct ibcs2_fcntl_args *uap; +ibcs2_fcntl(struct ibcs2_fcntl_args *uap) { + struct proc *p = curproc; int error; struct fcntl_args fa; struct flock *flp; @@ -244,22 +238,22 @@ ibcs2_fcntl(p, uap) SCARG(&fa, fd) = SCARG(uap, fd); SCARG(&fa, cmd) = F_DUPFD; SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg); - return fcntl(p, &fa); + return fcntl(&fa); case IBCS2_F_GETFD: SCARG(&fa, fd) = SCARG(uap, fd); SCARG(&fa, cmd) = F_GETFD; SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg); - return fcntl(p, &fa); + return fcntl(&fa); case IBCS2_F_SETFD: SCARG(&fa, fd) = SCARG(uap, fd); SCARG(&fa, cmd) = F_SETFD; SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg); - return fcntl(p, &fa); + return fcntl(&fa); case IBCS2_F_GETFL: SCARG(&fa, fd) = SCARG(uap, fd); SCARG(&fa, cmd) = F_GETFL; SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg); - error = fcntl(p, &fa); + error = fcntl(&fa); if (error) return error; p->p_retval[0] = oflags2ioflags(p->p_retval[0]); @@ -269,7 +263,7 @@ ibcs2_fcntl(p, uap) SCARG(&fa, cmd) = F_SETFL; SCARG(&fa, arg) = (/* XXX */ int) ioflags2oflags((int)SCARG(uap, arg)); - return fcntl(p, &fa); + return fcntl(&fa); case IBCS2_F_GETLK: { @@ -283,7 +277,7 @@ ibcs2_fcntl(p, uap) SCARG(&fa, fd) = SCARG(uap, fd); SCARG(&fa, cmd) = F_GETLK; SCARG(&fa, arg) = (/* XXX */ int)flp; - error = fcntl(p, &fa); + error = fcntl(&fa); if (error) return error; cvt_flock2iflock(flp, &ifl); @@ -304,7 +298,7 @@ ibcs2_fcntl(p, uap) SCARG(&fa, cmd) = F_SETLK; SCARG(&fa, arg) = (/* XXX */ int)flp; - return fcntl(p, &fa); + return fcntl(&fa); } case IBCS2_F_SETLKW: @@ -319,7 +313,7 @@ ibcs2_fcntl(p, uap) SCARG(&fa, fd) = SCARG(uap, fd); SCARG(&fa, cmd) = F_SETLKW; SCARG(&fa, arg) = (/* XXX */ int)flp; - return fcntl(p, &fa); + return fcntl(&fa); } } return ENOSYS; diff --git a/sys/emulation/ibcs2/i386/ibcs2_ioctl.c b/sys/emulation/ibcs2/i386/ibcs2_ioctl.c index d67c4ba3f1..e06e8b47a1 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_ioctl.c +++ b/sys/emulation/ibcs2/i386/ibcs2_ioctl.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/ibcs2/ibcs2_ioctl.c,v 1.13.2.1 2001/07/31 20:14:21 jon Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_ioctl.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_ioctl.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ #include @@ -56,7 +56,7 @@ static void stio2stios __P((struct ibcs2_termio *, struct ibcs2_termios *)); int -ibcs2_gtty(struct proc *p, struct ibcs2_gtty_args *args) +ibcs2_gtty(struct ibcs2_gtty_args *args) { struct ioctl_args ioctl_arg; @@ -64,11 +64,11 @@ ibcs2_gtty(struct proc *p, struct ibcs2_gtty_args *args) ioctl_arg.com = TIOCGETC; ioctl_arg.data = (caddr_t)args->buf; - return ioctl(p, &ioctl_arg); + return ioctl(&ioctl_arg); } int -ibcs2_stty(struct proc *p, struct ibcs2_stty_args *args) +ibcs2_stty(struct ibcs2_stty_args *args) { struct ioctl_args ioctl_arg; @@ -76,7 +76,7 @@ ibcs2_stty(struct proc *p, struct ibcs2_stty_args *args) ioctl_arg.com = TIOCSETC; ioctl_arg.data = (caddr_t)args->buf; - return ioctl(p, &ioctl_arg); + return ioctl(&ioctl_arg); } @@ -335,10 +335,9 @@ stio2stios(t, ts) } int -ibcs2_ioctl(p, uap) - struct proc *p; - struct ibcs2_ioctl_args *uap; +ibcs2_ioctl(struct ibcs2_ioctl_args *uap) { + struct proc *p = curproc; struct filedesc *fdp = p->p_fd; struct file *fp; int error; @@ -492,11 +491,11 @@ ibcs2_ioctl(p, uap) case IBCS2_TIOCGWINSZ: SCARG(uap, cmd) = TIOCGWINSZ; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_TIOCSWINSZ: SCARG(uap, cmd) = TIOCSWINSZ; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_TIOCGPGRP: return copyout((caddr_t)&p->p_pgrp->pg_id, SCARG(uap, data), @@ -508,7 +507,7 @@ ibcs2_ioctl(p, uap) SCARG(&sa, pid) = 0; SCARG(&sa, pgid) = (int)SCARG(uap, data); - if ((error = setpgid(p, &sa)) != 0) + if ((error = setpgid(&sa)) != 0) return error; return 0; } @@ -542,92 +541,92 @@ ibcs2_ioctl(p, uap) case IBCS2_KDGKBMODE: /* get keyboard translation mode */ SCARG(uap, cmd) = KDGKBMODE; /* printf("ioctl KDGKBMODE = %x\n", SCARG(uap, cmd));*/ - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDSKBMODE: /* set keyboard translation mode */ SCARG(uap, cmd) = KDSKBMODE; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDMKTONE: /* sound tone */ SCARG(uap, cmd) = KDMKTONE; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDGETMODE: /* get text/graphics mode */ SCARG(uap, cmd) = KDGETMODE; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDSETMODE: /* set text/graphics mode */ SCARG(uap, cmd) = KDSETMODE; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDSBORDER: /* set ega color border */ SCARG(uap, cmd) = KDSBORDER; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDGKBSTATE: SCARG(uap, cmd) = KDGKBSTATE; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDSETRAD: SCARG(uap, cmd) = KDSETRAD; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDENABIO: /* enable direct I/O to ports */ SCARG(uap, cmd) = KDENABIO; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDDISABIO: /* disable direct I/O to ports */ SCARG(uap, cmd) = KDDISABIO; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KIOCSOUND: /* start sound generation */ SCARG(uap, cmd) = KIOCSOUND; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDGKBTYPE: /* get keyboard type */ SCARG(uap, cmd) = KDGKBTYPE; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDGETLED: /* get keyboard LED status */ SCARG(uap, cmd) = KDGETLED; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_KDSETLED: /* set keyboard LED status */ SCARG(uap, cmd) = KDSETLED; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); /* Xenix keyboard and display ioctl's from sys/kd.h -- type 'k' */ case IBCS2_GETFKEY: /* Get function key */ SCARG(uap, cmd) = GETFKEY; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_SETFKEY: /* Set function key */ SCARG(uap, cmd) = SETFKEY; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_GIO_SCRNMAP: /* Get screen output map table */ SCARG(uap, cmd) = GIO_SCRNMAP; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_PIO_SCRNMAP: /* Set screen output map table */ SCARG(uap, cmd) = PIO_SCRNMAP; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_GIO_KEYMAP: /* Get keyboard map table */ SCARG(uap, cmd) = GIO_KEYMAP; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); case IBCS2_PIO_KEYMAP: /* Set keyboard map table */ SCARG(uap, cmd) = PIO_KEYMAP; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); /* socksys */ case IBCS2_SIOCSOCKSYS: - return ibcs2_socksys(p, (struct ibcs2_socksys_args *)uap); + return ibcs2_socksys((struct ibcs2_socksys_args *)uap); case IBCS2_I_NREAD: /* STREAMS */ SCARG(uap, cmd) = FIONREAD; - return ioctl(p, (struct ioctl_args *)uap); + return ioctl((struct ioctl_args *)uap); default: DPRINTF(("ibcs2_ioctl(%d): unknown cmd 0x%lx ", diff --git a/sys/emulation/ibcs2/i386/ibcs2_ipc.c b/sys/emulation/ibcs2/i386/ibcs2_ipc.c index a394617ff1..44c4919e5f 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_ipc.c +++ b/sys/emulation/ibcs2/i386/ibcs2_ipc.c @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/ibcs2/ibcs2_ipc.c,v 1.15 1999/08/28 00:43:57 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_ipc.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_ipc.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ #include @@ -103,14 +103,12 @@ struct msqid_ds *bp; } int -ibcs2_msgsys(p, uap) - struct proc *p; - struct ibcs2_msgsys_args *uap; +ibcs2_msgsys(struct ibcs2_msgsys_args *uap) { switch (SCARG(uap, which)) { case 0: /* msgget */ SCARG(uap, which) = 1; - return msgsys(p, (struct msgsys_args *)uap); + return msgsys((struct msgsys_args *)uap); case 1: { /* msgctl */ int error; struct msgsys_args margs; @@ -123,7 +121,7 @@ ibcs2_msgsys(p, uap) SCARG(&margs, a3) = SCARG(uap, a3); switch (SCARG(&margs, a3)) { case IBCS2_IPC_STAT: - error = msgsys(p, &margs); + error = msgsys(&margs); if (!error) cvt_msqid2imsqid( (struct msqid_ds *)SCARG(&margs, a4), @@ -133,18 +131,18 @@ ibcs2_msgsys(p, uap) cvt_imsqid2msqid((struct ibcs2_msqid_ds *)SCARG(uap, a4), (struct msqid_ds *)SCARG(&margs, a4)); - return msgsys(p, &margs); + return msgsys(&margs); case IBCS2_IPC_RMID: - return msgsys(p, &margs); + return msgsys(&margs); } return EINVAL; } case 2: /* msgrcv */ SCARG(uap, which) = 3; - return msgsys(p, (struct msgsys_args *)uap); + return msgsys((struct msgsys_args *)uap); case 3: /* msgsnd */ SCARG(uap, which) = 2; - return msgsys(p, (struct msgsys_args *)uap); + return msgsys((struct msgsys_args *)uap); default: return EINVAL; } @@ -234,9 +232,7 @@ struct semid_ds *bp; } int -ibcs2_semsys(p, uap) - struct proc *p; - struct ibcs2_semsys_args *uap; +ibcs2_semsys(struct ibcs2_semsys_args *uap) { int error; @@ -256,7 +252,7 @@ ibcs2_semsys(p, uap) sup = stackgap_alloc(&sg, sizeof(union semun)); sup->buf = sp; SCARG(uap, a5) = (int)sup; - error = semsys(p, (struct semsys_args *)uap); + error = semsys((struct semsys_args *)uap); if (!error) { SCARG(uap, a5) = (int)ssu.buf; isp = stackgap_alloc(&sg, sizeof(*isp)); @@ -281,7 +277,7 @@ ibcs2_semsys(p, uap) return error; cvt_isemid2semid(isp, sp); SCARG(uap, a5) = (int)sp; - return semsys(p, (struct semsys_args *)uap); + return semsys((struct semsys_args *)uap); } case IBCS2_SETVAL: { @@ -291,17 +287,17 @@ ibcs2_semsys(p, uap) sp = stackgap_alloc(&sg, sizeof(*sp)); sp->val = (int) SCARG(uap, a5); SCARG(uap, a5) = (int)sp; - return semsys(p, (struct semsys_args *)uap); + return semsys((struct semsys_args *)uap); } } - return semsys(p, (struct semsys_args *)uap); + return semsys((struct semsys_args *)uap); case 1: /* semget */ - return semsys(p, (struct semsys_args *)uap); + return semsys((struct semsys_args *)uap); case 2: /* semop */ - return semsys(p, (struct semsys_args *)uap); + return semsys((struct semsys_args *)uap); } return EINVAL; } @@ -346,15 +342,13 @@ struct shmid_ds *bp; } int -ibcs2_shmsys(p, uap) - struct proc *p; - struct ibcs2_shmsys_args *uap; +ibcs2_shmsys(struct ibcs2_shmsys_args *uap) { int error; switch (SCARG(uap, which)) { case 0: /* shmat */ - return shmsys(p, (struct shmsys_args *)uap); + return shmsys((struct shmsys_args *)uap); case 1: /* shmctl */ switch(SCARG(uap, a3)) { @@ -367,7 +361,7 @@ ibcs2_shmsys(p, uap) isp = (struct ibcs2_shmid_ds *)SCARG(uap, a4); sp = stackgap_alloc(&sg, sizeof(*sp)); SCARG(uap, a4) = (int)sp; - error = shmsys(p, (struct shmsys_args *)uap); + error = shmsys((struct shmsys_args *)uap); if (!error) { SCARG(uap, a4) = (int)isp; isp = stackgap_alloc(&sg, sizeof(*isp)); @@ -392,17 +386,17 @@ ibcs2_shmsys(p, uap) return error; cvt_ishmid2shmid(isp, sp); SCARG(uap, a4) = (int)sp; - return shmsys(p, (struct shmsys_args *)uap); + return shmsys((struct shmsys_args *)uap); } } - return shmsys(p, (struct shmsys_args *)uap); + return shmsys((struct shmsys_args *)uap); case 2: /* shmdt */ - return shmsys(p, (struct shmsys_args *)uap); + return shmsys((struct shmsys_args *)uap); case 3: /* shmget */ - return shmsys(p, (struct shmsys_args *)uap); + return shmsys((struct shmsys_args *)uap); } return EINVAL; } diff --git a/sys/emulation/ibcs2/i386/ibcs2_isc.c b/sys/emulation/ibcs2/i386/ibcs2_isc.c index 385ae2d5cc..7da4189879 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_isc.c +++ b/sys/emulation/ibcs2/i386/ibcs2_isc.c @@ -28,7 +28,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/ibcs2/ibcs2_isc.c,v 1.12 1999/08/28 00:43:58 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_isc.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_isc.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ #include @@ -45,8 +45,9 @@ extern struct sysent isc_sysent[]; int -ibcs2_isc(struct proc *p, struct ibcs2_isc_args *uap) +ibcs2_isc(struct ibcs2_isc_args *uap) { + struct proc *p = curproc; struct trapframe *tf = p->p_md.md_regs; struct sysent *callp; u_int code; @@ -55,7 +56,7 @@ ibcs2_isc(struct proc *p, struct ibcs2_isc_args *uap) callp = &isc_sysent[code]; if(code < IBCS2_ISC_MAXSYSCALL) - return((*callp->sy_call)(p, (void *)uap)); + return((*callp->sy_call)((void *)uap)); else return ENOSYS; } diff --git a/sys/emulation/ibcs2/i386/ibcs2_isc_syscall.h b/sys/emulation/ibcs2/i386/ibcs2_isc_syscall.h index e04634ec5b..b4adae3947 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_isc_syscall.h +++ b/sys/emulation/ibcs2/i386/ibcs2_isc_syscall.h @@ -2,9 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/ibcs2/ibcs2_isc_syscall.h,v 1.5.2.2 2000/08/08 23:28:16 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_isc_syscall.h,v 1.2 2003/06/17 04:28:35 dillon Exp $ - * created from FreeBSD: src/sys/i386/ibcs2/syscalls.isc,v 1.5 1999/08/28 00:44:01 peter Exp + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_isc_syscall.h,v 1.3 2003/06/23 17:55:38 dillon Exp $ + * created from TurtleBSD: src/sys/i386/ibcs2/syscalls.isc,v 1.2 2003/06/17 04:28:35 dillon Exp */ #define IBCS2_ISC_ibcs2_rename 2 diff --git a/sys/emulation/ibcs2/i386/ibcs2_isc_sysent.c b/sys/emulation/ibcs2/i386/ibcs2_isc_sysent.c index 338f934bc4..c7ba4ef576 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_isc_sysent.c +++ b/sys/emulation/ibcs2/i386/ibcs2_isc_sysent.c @@ -2,9 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/ibcs2/ibcs2_isc_sysent.c,v 1.7.2.2 2000/08/08 23:28:16 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_isc_sysent.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ - * created from FreeBSD: src/sys/i386/ibcs2/syscalls.isc,v 1.5 1999/08/28 00:44:01 peter Exp + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_isc_sysent.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ + * created from TurtleBSD: src/sys/i386/ibcs2/syscalls.isc,v 1.2 2003/06/17 04:28:35 dillon Exp */ #include diff --git a/sys/emulation/ibcs2/i386/ibcs2_misc.c b/sys/emulation/ibcs2/i386/ibcs2_misc.c index ef62aabf97..25f8b34958 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_misc.c +++ b/sys/emulation/ibcs2/i386/ibcs2_misc.c @@ -46,7 +46,7 @@ * @(#)sun_misc.c 8.1 (Berkeley) 6/18/93 * * $FreeBSD: src/sys/i386/ibcs2/ibcs2_misc.c,v 1.34 1999/09/29 15:12:09 marcel Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_misc.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_misc.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ /* @@ -85,9 +85,7 @@ #include int -ibcs2_ulimit(p, uap) - struct proc *p; - struct ibcs2_ulimit_args *uap; +ibcs2_ulimit(struct ibcs2_ulimit_args *uap) { #ifdef notyet int error; @@ -97,6 +95,8 @@ ibcs2_ulimit(p, uap) struct rlimit *rlp; } sra; #endif + struct proc *p = curproc; + #define IBCS2_GETFSIZE 1 #define IBCS2_SETFSIZE 2 #define IBCS2_GETPSIZE 3 @@ -112,7 +112,7 @@ ibcs2_ulimit(p, uap) rl.rlim_cur = SCARG(uap, newlimit); sra.resource = RLIMIT_FSIZE; sra.rlp = &rl; - error = setrlimit(p, &sra); + error = setrlimit(&sra); if (!error) p->p_retval[0] = p->p_rlimit[RLIMIT_FSIZE].rlim_cur; else @@ -127,7 +127,7 @@ ibcs2_ulimit(p, uap) return 0; case IBCS2_GETDTABLESIZE: uap->cmd = IBCS2_SC_OPEN_MAX; - return ibcs2_sysconf(p, (struct ibcs2_sysconf_args *)uap); + return ibcs2_sysconf((struct ibcs2_sysconf_args *)uap); default: return ENOSYS; } @@ -136,10 +136,9 @@ ibcs2_ulimit(p, uap) #define IBCS2_WSTOPPED 0177 #define IBCS2_STOPCODE(sig) ((sig) << 8 | IBCS2_WSTOPPED) int -ibcs2_wait(p, uap) - struct proc *p; - struct ibcs2_wait_args *uap; +ibcs2_wait(struct ibcs2_wait_args *uap) { + struct proc *p = curproc; int error, status; struct wait_args w4; struct trapframe *tf = p->p_md.md_regs; @@ -157,7 +156,7 @@ ibcs2_wait(p, uap) SCARG(&w4, status) = (int *)SCARG(uap, a1); SCARG(&w4, options) = 0; } - if ((error = wait4(p, &w4)) != 0) + if ((error = wait4(&w4)) != 0) return error; if (SCARG(&w4, status)) { /* this is real iBCS brain-damage */ error = copyin((caddr_t)SCARG(&w4, status), (caddr_t)&status, @@ -183,46 +182,38 @@ ibcs2_wait(p, uap) } int -ibcs2_execv(p, uap) - struct proc *p; - struct ibcs2_execv_args *uap; +ibcs2_execv(struct ibcs2_execv_args *uap) { struct execve_args ea; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&ea, fname) = SCARG(uap, path); SCARG(&ea, argv) = SCARG(uap, argp); SCARG(&ea, envv) = NULL; - return execve(p, &ea); + return execve(&ea); } int -ibcs2_execve(p, uap) - struct proc *p; - struct ibcs2_execve_args *uap; +ibcs2_execve(struct ibcs2_execve_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); - return execve(p, (struct execve_args *)uap); + CHECKALTEXIST(&sg, SCARG(uap, path)); + return execve((struct execve_args *)uap); } int -ibcs2_umount(p, uap) - struct proc *p; - struct ibcs2_umount_args *uap; +ibcs2_umount(struct ibcs2_umount_args *uap) { struct unmount_args um; SCARG(&um, path) = SCARG(uap, name); SCARG(&um, flags) = 0; - return unmount(p, &um); + return unmount(&um); } int -ibcs2_mount(p, uap) - struct proc *p; - struct ibcs2_mount_args *uap; +ibcs2_mount(struct ibcs2_mount_args *uap) { #ifdef notyet int oflags = SCARG(uap, flags), nflags, error; @@ -278,7 +269,7 @@ ibcs2_mount(p, uap) if (error = copyout(&na, SCARG(uap, data), sizeof na)) return (error); } - return (mount(p, uap)); + return (mount(uap)); #else return EINVAL; #endif @@ -293,15 +284,14 @@ ibcs2_mount(p, uap) */ int -ibcs2_getdents(p, uap) - struct proc *p; - register struct ibcs2_getdents_args *uap; +ibcs2_getdents(struct ibcs2_getdents_args *uap) { - register struct vnode *vp; - register caddr_t inp, buf; /* BSD-format */ - register int len, reclen; /* BSD-format */ - register caddr_t outp; /* iBCS2-format */ - register int resid; /* iBCS2-format */ + struct proc *p = curproc; + struct vnode *vp; + caddr_t inp, buf; /* BSD-format */ + int len, reclen; /* BSD-format */ + caddr_t outp; /* iBCS2-format */ + int resid; /* iBCS2-format */ struct file *fp; struct uio auio; struct iovec aiov; @@ -434,15 +424,14 @@ out: } int -ibcs2_read(p, uap) - struct proc *p; - struct ibcs2_read_args *uap; +ibcs2_read(struct ibcs2_read_args *uap) { - register struct vnode *vp; - register caddr_t inp, buf; /* BSD-format */ - register int len, reclen; /* BSD-format */ - register caddr_t outp; /* iBCS2-format */ - register int resid; /* iBCS2-format */ + struct proc *p = curproc; + struct vnode *vp; + caddr_t inp, buf; /* BSD-format */ + int len, reclen; /* BSD-format */ + caddr_t outp; /* iBCS2-format */ + int resid; /* iBCS2-format */ struct file *fp; struct uio auio; struct iovec aiov; @@ -457,7 +446,7 @@ ibcs2_read(p, uap) if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) { if (error == EINVAL) - return read(p, (struct read_args *)uap); + return read((struct read_args *)uap); else return error; } @@ -465,7 +454,7 @@ ibcs2_read(p, uap) return (EBADF); vp = (struct vnode *)fp->f_data; if (vp->v_type != VDIR) - return read(p, (struct read_args *)uap); + return read((struct read_args *)uap); DPRINTF(("ibcs2_read: read directory\n")); @@ -585,32 +574,29 @@ out: } int -ibcs2_mknod(p, uap) - struct proc *p; - struct ibcs2_mknod_args *uap; +ibcs2_mknod(struct ibcs2_mknod_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTCREAT(p, &sg, SCARG(uap, path)); + CHECKALTCREAT(&sg, SCARG(uap, path)); if (S_ISFIFO(SCARG(uap, mode))) { struct mkfifo_args ap; SCARG(&ap, path) = SCARG(uap, path); SCARG(&ap, mode) = SCARG(uap, mode); - return mkfifo(p, &ap); + return mkfifo(&ap); } else { struct mknod_args ap; SCARG(&ap, path) = SCARG(uap, path); SCARG(&ap, mode) = SCARG(uap, mode); SCARG(&ap, dev) = SCARG(uap, dev); - return mknod(p, &ap); + return mknod(&ap); } } int -ibcs2_getgroups(p, uap) - struct proc *p; - struct ibcs2_getgroups_args *uap; +ibcs2_getgroups(struct ibcs2_getgroups_args *uap) { + struct proc *p = curproc; int error, i; ibcs2_gid_t *iset = NULL; struct getgroups_args sa; @@ -624,7 +610,7 @@ ibcs2_getgroups(p, uap) iset = stackgap_alloc(&sg, SCARG(uap, gidsetsize) * sizeof(ibcs2_gid_t)); } - if ((error = getgroups(p, &sa)) != 0) + if ((error = getgroups(&sa)) != 0) return error; if (SCARG(uap, gidsetsize) == 0) return 0; @@ -639,9 +625,7 @@ ibcs2_getgroups(p, uap) } int -ibcs2_setgroups(p, uap) - struct proc *p; - struct ibcs2_setgroups_args *uap; +ibcs2_setgroups(struct ibcs2_setgroups_args *uap) { int error, i; ibcs2_gid_t *iset; @@ -662,36 +646,31 @@ ibcs2_setgroups(p, uap) } for (i = 0, gp = SCARG(&sa, gidset); i < SCARG(&sa, gidsetsize); i++) *gp++ = (gid_t)iset[i]; - return setgroups(p, &sa); + return setgroups(&sa); } int -ibcs2_setuid(p, uap) - struct proc *p; - struct ibcs2_setuid_args *uap; +ibcs2_setuid(struct ibcs2_setuid_args *uap) { struct setuid_args sa; SCARG(&sa, uid) = (uid_t)SCARG(uap, uid); - return setuid(p, &sa); + return setuid(&sa); } int -ibcs2_setgid(p, uap) - struct proc *p; - struct ibcs2_setgid_args *uap; +ibcs2_setgid(struct ibcs2_setgid_args *uap) { struct setgid_args sa; SCARG(&sa, gid) = (gid_t)SCARG(uap, gid); - return setgid(p, &sa); + return setgid(&sa); } int -ibcs2_time(p, uap) - struct proc *p; - struct ibcs2_time_args *uap; +ibcs2_time(struct ibcs2_time_args *uap) { + struct proc *p = curproc; struct timeval tv; microtime(&tv); @@ -704,28 +683,23 @@ ibcs2_time(p, uap) } int -ibcs2_pathconf(p, uap) - struct proc *p; - struct ibcs2_pathconf_args *uap; +ibcs2_pathconf(struct ibcs2_pathconf_args *uap) { SCARG(uap, name)++; /* iBCS2 _PC_* defines are offset by one */ - return pathconf(p, (struct pathconf_args *)uap); + return pathconf((struct pathconf_args *)uap); } int -ibcs2_fpathconf(p, uap) - struct proc *p; - struct ibcs2_fpathconf_args *uap; +ibcs2_fpathconf(struct ibcs2_fpathconf_args *uap) { SCARG(uap, name)++; /* iBCS2 _PC_* defines are offset by one */ - return fpathconf(p, (struct fpathconf_args *)uap); + return fpathconf((struct fpathconf_args *)uap); } int -ibcs2_sysconf(p, uap) - struct proc *p; - struct ibcs2_sysconf_args *uap; +ibcs2_sysconf(struct ibcs2_sysconf_args *uap) { + struct proc *p = curproc; int mib[2], value, len, error; struct sysctl_args sa; struct __getrlimit_args ga; @@ -741,7 +715,7 @@ ibcs2_sysconf(p, uap) SCARG(&ga, which) = RLIMIT_NPROC; SCARG(&ga, rlp) = stackgap_alloc(&sg, sizeof(struct rlimit *)); - if ((error = getrlimit(p, &ga)) != 0) + if ((error = getrlimit(&ga)) != 0) return error; p->p_retval[0] = SCARG(&ga, rlp)->rlim_cur; return 0; @@ -761,7 +735,7 @@ ibcs2_sysconf(p, uap) SCARG(&ga, which) = RLIMIT_NOFILE; SCARG(&ga, rlp) = stackgap_alloc(&sg, sizeof(struct rlimit *)); - if ((error = getrlimit(p, &ga)) != 0) + if ((error = getrlimit(&ga)) != 0) return error; p->p_retval[0] = SCARG(&ga, rlp)->rlim_cur; return 0; @@ -799,17 +773,16 @@ ibcs2_sysconf(p, uap) SCARG(&sa, oldlenp) = &len; SCARG(&sa, new) = NULL; SCARG(&sa, newlen) = 0; - if ((error = __sysctl(p, &sa)) != 0) + if ((error = __sysctl(&sa)) != 0) return error; p->p_retval[0] = value; return 0; } int -ibcs2_alarm(p, uap) - struct proc *p; - struct ibcs2_alarm_args *uap; +ibcs2_alarm(struct ibcs2_alarm_args *uap) { + struct proc *p = curproc; int error; struct itimerval *itp, *oitp; struct setitimer_args sa; @@ -824,7 +797,7 @@ ibcs2_alarm(p, uap) SCARG(&sa, which) = ITIMER_REAL; SCARG(&sa, itv) = itp; SCARG(&sa, oitv) = oitp; - error = setitimer(p, &sa); + error = setitimer(&sa); if (error) return error; if (oitp->it_value.tv_usec) @@ -834,10 +807,9 @@ ibcs2_alarm(p, uap) } int -ibcs2_times(p, uap) - struct proc *p; - struct ibcs2_times_args *uap; +ibcs2_times(struct ibcs2_times_args *uap) { + struct proc *p = curproc; int error; struct getrusage_args ga; struct tms tms; @@ -848,14 +820,14 @@ ibcs2_times(p, uap) SCARG(&ga, who) = RUSAGE_SELF; SCARG(&ga, rusage) = ru; - error = getrusage(p, &ga); + error = getrusage(&ga); if (error) return error; tms.tms_utime = CONVTCK(ru->ru_utime); tms.tms_stime = CONVTCK(ru->ru_stime); SCARG(&ga, who) = RUSAGE_CHILDREN; - error = getrusage(p, &ga); + error = getrusage(&ga); if (error) return error; tms.tms_cutime = CONVTCK(ru->ru_utime); @@ -869,9 +841,7 @@ ibcs2_times(p, uap) } int -ibcs2_stime(p, uap) - struct proc *p; - struct ibcs2_stime_args *uap; +ibcs2_stime(struct ibcs2_stime_args *uap) { int error; struct settimeofday_args sa; @@ -883,22 +853,20 @@ ibcs2_stime(p, uap) &(SCARG(&sa, tv)->tv_sec), sizeof(long))) != 0) return error; SCARG(&sa, tv)->tv_usec = 0; - if ((error = settimeofday(p, &sa)) != 0) + if ((error = settimeofday(&sa)) != 0) return EPERM; return 0; } int -ibcs2_utime(p, uap) - struct proc *p; - struct ibcs2_utime_args *uap; +ibcs2_utime(struct ibcs2_utime_args *uap) { int error; struct utimes_args sa; struct timeval *tp; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&sa, path) = SCARG(uap, path); if (SCARG(uap, buf)) { struct ibcs2_utimbuf ubuf; @@ -916,21 +884,20 @@ ibcs2_utime(p, uap) tp->tv_usec = 0; } else SCARG(&sa, tptr) = NULL; - return utimes(p, &sa); + return utimes(&sa); } int -ibcs2_nice(p, uap) - struct proc *p; - struct ibcs2_nice_args *uap; +ibcs2_nice(struct ibcs2_nice_args *uap) { + struct proc *p = curproc; int error; struct setpriority_args sa; SCARG(&sa, which) = PRIO_PROCESS; SCARG(&sa, who) = 0; SCARG(&sa, prio) = p->p_nice + SCARG(uap, incr); - if ((error = setpriority(p, &sa)) != 0) + if ((error = setpriority(&sa)) != 0) return EPERM; p->p_retval[0] = p->p_nice; return 0; @@ -941,10 +908,10 @@ ibcs2_nice(p, uap) */ int -ibcs2_pgrpsys(p, uap) - struct proc *p; - struct ibcs2_pgrpsys_args *uap; +ibcs2_pgrpsys(struct ibcs2_pgrpsys_args *uap) { + struct proc *p = curproc; + switch (SCARG(uap, type)) { case 0: /* getpgrp */ p->p_retval[0] = p->p_pgrp->pg_id; @@ -956,7 +923,7 @@ ibcs2_pgrpsys(p, uap) SCARG(&sa, pid) = 0; SCARG(&sa, pgid) = 0; - setpgid(p, &sa); + setpgid(&sa); p->p_retval[0] = p->p_pgrp->pg_id; return 0; } @@ -967,11 +934,11 @@ ibcs2_pgrpsys(p, uap) SCARG(&sa, pid) = SCARG(uap, pid); SCARG(&sa, pgid) = SCARG(uap, pgid); - return setpgid(p, &sa); + return setpgid(&sa); } case 3: /* setsid */ - return setsid(p, NULL); + return setsid(NULL); default: return EINVAL; @@ -983,9 +950,7 @@ ibcs2_pgrpsys(p, uap) */ int -ibcs2_plock(p, uap) - struct proc *p; - struct ibcs2_plock_args *uap; +ibcs2_plock(struct ibcs2_plock_args *uap) { int error; #define IBCS2_UNLOCK 0 @@ -994,7 +959,7 @@ ibcs2_plock(p, uap) #define IBCS2_DATALOCK 4 - if ((error = suser(p)) != 0) + if ((error = suser()) != 0) return EPERM; switch(SCARG(uap, cmd)) { case IBCS2_UNLOCK: @@ -1007,9 +972,7 @@ ibcs2_plock(p, uap) } int -ibcs2_uadmin(p, uap) - struct proc *p; - struct ibcs2_uadmin_args *uap; +ibcs2_uadmin(struct ibcs2_uadmin_args *uap) { #define SCO_A_REBOOT 1 #define SCO_A_SHUTDOWN 2 @@ -1029,7 +992,7 @@ ibcs2_uadmin(p, uap) #define SCO_AD_GETBMAJ 0 #define SCO_AD_GETCMAJ 1 - if (suser(p)) + if (suser()) return EPERM; switch(SCARG(uap, cmd)) { @@ -1041,11 +1004,11 @@ ibcs2_uadmin(p, uap) case SCO_AD_PWRDOWN: case SCO_AD_PWRNAP: r.opt = RB_HALT; - reboot(p, &r); + reboot(&r); case SCO_AD_BOOT: case SCO_AD_IBOOT: r.opt = RB_AUTOBOOT; - reboot(p, &r); + reboot(&r); } return EINVAL; case SCO_A_REMOUNT: @@ -1059,9 +1022,7 @@ ibcs2_uadmin(p, uap) } int -ibcs2_sysfs(p, uap) - struct proc *p; - struct ibcs2_sysfs_args *uap; +ibcs2_sysfs(struct ibcs2_sysfs_args *uap) { #define IBCS2_GETFSIND 1 #define IBCS2_GETFSTYP 2 @@ -1077,102 +1038,84 @@ ibcs2_sysfs(p, uap) } int -ibcs2_unlink(p, uap) - struct proc *p; - struct ibcs2_unlink_args *uap; +ibcs2_unlink(struct ibcs2_unlink_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); - return unlink(p, (struct unlink_args *)uap); + CHECKALTEXIST(&sg, SCARG(uap, path)); + return unlink((struct unlink_args *)uap); } int -ibcs2_chdir(p, uap) - struct proc *p; - struct ibcs2_chdir_args *uap; +ibcs2_chdir(struct ibcs2_chdir_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); - return chdir(p, (struct chdir_args *)uap); + CHECKALTEXIST(&sg, SCARG(uap, path)); + return chdir((struct chdir_args *)uap); } int -ibcs2_chmod(p, uap) - struct proc *p; - struct ibcs2_chmod_args *uap; +ibcs2_chmod(struct ibcs2_chmod_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); - return chmod(p, (struct chmod_args *)uap); + CHECKALTEXIST(&sg, SCARG(uap, path)); + return chmod((struct chmod_args *)uap); } int -ibcs2_chown(p, uap) - struct proc *p; - struct ibcs2_chown_args *uap; +ibcs2_chown(struct ibcs2_chown_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); - return chown(p, (struct chown_args *)uap); + CHECKALTEXIST(&sg, SCARG(uap, path)); + return chown((struct chown_args *)uap); } int -ibcs2_rmdir(p, uap) - struct proc *p; - struct ibcs2_rmdir_args *uap; +ibcs2_rmdir(struct ibcs2_rmdir_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); - return rmdir(p, (struct rmdir_args *)uap); + CHECKALTEXIST(&sg, SCARG(uap, path)); + return rmdir((struct rmdir_args *)uap); } int -ibcs2_mkdir(p, uap) - struct proc *p; - struct ibcs2_mkdir_args *uap; +ibcs2_mkdir(struct ibcs2_mkdir_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTCREAT(p, &sg, SCARG(uap, path)); - return mkdir(p, (struct mkdir_args *)uap); + CHECKALTCREAT(&sg, SCARG(uap, path)); + return mkdir((struct mkdir_args *)uap); } int -ibcs2_symlink(p, uap) - struct proc *p; - struct ibcs2_symlink_args *uap; +ibcs2_symlink(struct ibcs2_symlink_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); - CHECKALTCREAT(p, &sg, SCARG(uap, link)); - return symlink(p, (struct symlink_args *)uap); + CHECKALTEXIST(&sg, SCARG(uap, path)); + CHECKALTCREAT(&sg, SCARG(uap, link)); + return symlink((struct symlink_args *)uap); } int -ibcs2_rename(p, uap) - struct proc *p; - struct ibcs2_rename_args *uap; +ibcs2_rename(struct ibcs2_rename_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, from)); - CHECKALTCREAT(p, &sg, SCARG(uap, to)); - return rename(p, (struct rename_args *)uap); + CHECKALTEXIST(&sg, SCARG(uap, from)); + CHECKALTCREAT(&sg, SCARG(uap, to)); + return rename((struct rename_args *)uap); } int -ibcs2_readlink(p, uap) - struct proc *p; - struct ibcs2_readlink_args *uap; +ibcs2_readlink(struct ibcs2_readlink_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); - return readlink(p, (struct readlink_args *) uap); + CHECKALTEXIST(&sg, SCARG(uap, path)); + return readlink((struct readlink_args *) uap); } diff --git a/sys/emulation/ibcs2/i386/ibcs2_msg.c b/sys/emulation/ibcs2/i386/ibcs2_msg.c index c8ea036564..c1ed0ea898 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_msg.c +++ b/sys/emulation/ibcs2/i386/ibcs2_msg.c @@ -22,7 +22,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/ibcs2/ibcs2_msg.c,v 1.7 1999/08/28 00:43:59 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_msg.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_msg.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ /* @@ -42,27 +42,22 @@ int -ibcs2_getmsg(p, uap) - struct proc *p; - struct ibcs2_getmsg_args *uap; +ibcs2_getmsg(struct ibcs2_getmsg_args *uap) { return 0; /* fake */ } int -ibcs2_putmsg(p, uap) - struct proc *p; - struct ibcs2_putmsg_args *uap; +ibcs2_putmsg(struct ibcs2_putmsg_args *uap) { return 0; /* fake */ } int -ibcs2_poll(p, uap) - struct proc *p; - struct ibcs2_poll_args *uap; +ibcs2_poll(struct ibcs2_poll_args *uap) { + struct proc *p = curproc; int error, i; fd_set *readfds, *writefds, *exceptfds; struct timeval *timeout; @@ -108,7 +103,7 @@ ibcs2_poll(p, uap) FD_SET(conv.fd, writefds); FD_SET(conv.fd, exceptfds); } - if ((error = select(p, &tmp_select)) != 0) + if ((error = select(&tmp_select)) != 0) return error; if (p->p_retval[0] == 0) return 0; diff --git a/sys/emulation/ibcs2/i386/ibcs2_other.c b/sys/emulation/ibcs2/i386/ibcs2_other.c index cb0d7f8b24..9678c4c398 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_other.c +++ b/sys/emulation/ibcs2/i386/ibcs2_other.c @@ -22,7 +22,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/ibcs2/ibcs2_other.c,v 1.10 1999/08/28 00:43:59 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_other.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_other.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ /* @@ -44,17 +44,16 @@ #define IBCS2_SECURE_SETLUID 2 int -ibcs2_secure(struct proc *p, struct ibcs2_secure_args *uap) +ibcs2_secure(struct ibcs2_secure_args *uap) { - switch (uap->cmd) { + struct proc *p = curproc; + switch (uap->cmd) { case IBCS2_SECURE_GETLUID: /* get login uid */ p->p_retval[0] = p->p_ucred->cr_uid; return 0; - case IBCS2_SECURE_SETLUID: /* set login uid */ return EPERM; - default: printf("IBCS2: 'secure' cmd=%d not implemented\n", uap->cmd); } @@ -63,7 +62,7 @@ ibcs2_secure(struct proc *p, struct ibcs2_secure_args *uap) } int -ibcs2_lseek(struct proc *p, register struct ibcs2_lseek_args *uap) +ibcs2_lseek(register struct ibcs2_lseek_args *uap) { struct lseek_args largs; int error; @@ -71,7 +70,7 @@ ibcs2_lseek(struct proc *p, register struct ibcs2_lseek_args *uap) largs.fd = uap->fd; largs.offset = uap->offset; largs.whence = uap->whence; - error = lseek(p, &largs); + error = lseek(&largs); return (error); } @@ -80,7 +79,7 @@ ibcs2_lseek(struct proc *p, register struct ibcs2_lseek_args *uap) #include int -spx_open(struct proc *p, void *uap) +spx_open(void *uap) { struct socket_args sock; struct connect_args conn; @@ -93,7 +92,7 @@ spx_open(struct proc *p, void *uap) sock.domain = AF_UNIX; sock.type = SOCK_STREAM; sock.protocol = 0; - error = socket(p, &sock); + error = socket(&sock); if (error) return error; @@ -108,11 +107,11 @@ spx_open(struct proc *p, void *uap) conn.s = fd = p->p_retval[0]; conn.name = (caddr_t)Xaddr; conn.namelen = sizeof(struct sockaddr_un); - error = connect(p, &conn); + error = connect(&conn); if (error) { struct close_args cl; cl.fd = fd; - close(p, &cl); + close(&cl); return error; } p->p_retval[0] = fd; diff --git a/sys/emulation/ibcs2/i386/ibcs2_proto.h b/sys/emulation/ibcs2/i386/ibcs2_proto.h index 54216f0ddb..ab3697d5e9 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_proto.h +++ b/sys/emulation/ibcs2/i386/ibcs2_proto.h @@ -2,9 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/ibcs2/ibcs2_proto.h,v 1.10.2.4 2001/10/05 07:38:43 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_proto.h,v 1.2 2003/06/17 04:28:35 dillon Exp $ - * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.9.2.2 2001/10/05 07:34:36 peter Exp + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_proto.h,v 1.3 2003/06/23 17:55:38 dillon Exp $ + * created from TurtleBSD: src/sys/i386/ibcs2/syscalls.master,v 1.2 2003/06/17 04:28:35 dillon Exp */ #ifndef _IBCS2_SYSPROTO_H_ @@ -14,8 +13,6 @@ #include -struct proc; - #define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ 0 : sizeof(register_t) - sizeof(t)) @@ -274,62 +271,62 @@ struct ibcs2_readlink_args { struct ibcs2_isc_args { register_t dummy; }; -int ibcs2_read __P((struct proc *, struct ibcs2_read_args *)); -int ibcs2_open __P((struct proc *, struct ibcs2_open_args *)); -int ibcs2_wait __P((struct proc *, struct ibcs2_wait_args *)); -int ibcs2_creat __P((struct proc *, struct ibcs2_creat_args *)); -int ibcs2_unlink __P((struct proc *, struct ibcs2_unlink_args *)); -int ibcs2_execv __P((struct proc *, struct ibcs2_execv_args *)); -int ibcs2_chdir __P((struct proc *, struct ibcs2_chdir_args *)); -int ibcs2_time __P((struct proc *, struct ibcs2_time_args *)); -int ibcs2_mknod __P((struct proc *, struct ibcs2_mknod_args *)); -int ibcs2_chmod __P((struct proc *, struct ibcs2_chmod_args *)); -int ibcs2_chown __P((struct proc *, struct ibcs2_chown_args *)); -int ibcs2_stat __P((struct proc *, struct ibcs2_stat_args *)); -int ibcs2_lseek __P((struct proc *, struct ibcs2_lseek_args *)); -int ibcs2_mount __P((struct proc *, struct ibcs2_mount_args *)); -int ibcs2_umount __P((struct proc *, struct ibcs2_umount_args *)); -int ibcs2_setuid __P((struct proc *, struct ibcs2_setuid_args *)); -int ibcs2_stime __P((struct proc *, struct ibcs2_stime_args *)); -int ibcs2_alarm __P((struct proc *, struct ibcs2_alarm_args *)); -int ibcs2_fstat __P((struct proc *, struct ibcs2_fstat_args *)); -int ibcs2_pause __P((struct proc *, struct ibcs2_pause_args *)); -int ibcs2_utime __P((struct proc *, struct ibcs2_utime_args *)); -int ibcs2_stty __P((struct proc *, struct ibcs2_stty_args *)); -int ibcs2_gtty __P((struct proc *, struct ibcs2_gtty_args *)); -int ibcs2_access __P((struct proc *, struct ibcs2_access_args *)); -int ibcs2_nice __P((struct proc *, struct ibcs2_nice_args *)); -int ibcs2_statfs __P((struct proc *, struct ibcs2_statfs_args *)); -int ibcs2_kill __P((struct proc *, struct ibcs2_kill_args *)); -int ibcs2_fstatfs __P((struct proc *, struct ibcs2_fstatfs_args *)); -int ibcs2_pgrpsys __P((struct proc *, struct ibcs2_pgrpsys_args *)); -int ibcs2_xenix __P((struct proc *, struct ibcs2_xenix_args *)); -int ibcs2_times __P((struct proc *, struct ibcs2_times_args *)); -int ibcs2_plock __P((struct proc *, struct ibcs2_plock_args *)); -int ibcs2_setgid __P((struct proc *, struct ibcs2_setgid_args *)); -int ibcs2_sigsys __P((struct proc *, struct ibcs2_sigsys_args *)); -int ibcs2_msgsys __P((struct proc *, struct ibcs2_msgsys_args *)); -int ibcs2_sysi86 __P((struct proc *, struct ibcs2_sysi86_args *)); -int ibcs2_shmsys __P((struct proc *, struct ibcs2_shmsys_args *)); -int ibcs2_semsys __P((struct proc *, struct ibcs2_semsys_args *)); -int ibcs2_ioctl __P((struct proc *, struct ibcs2_ioctl_args *)); -int ibcs2_uadmin __P((struct proc *, struct ibcs2_uadmin_args *)); -int ibcs2_utssys __P((struct proc *, struct ibcs2_utssys_args *)); -int ibcs2_execve __P((struct proc *, struct ibcs2_execve_args *)); -int ibcs2_fcntl __P((struct proc *, struct ibcs2_fcntl_args *)); -int ibcs2_ulimit __P((struct proc *, struct ibcs2_ulimit_args *)); -int ibcs2_rmdir __P((struct proc *, struct ibcs2_rmdir_args *)); -int ibcs2_mkdir __P((struct proc *, struct ibcs2_mkdir_args *)); -int ibcs2_getdents __P((struct proc *, struct ibcs2_getdents_args *)); -int ibcs2_sysfs __P((struct proc *, struct ibcs2_sysfs_args *)); -int ibcs2_getmsg __P((struct proc *, struct ibcs2_getmsg_args *)); -int ibcs2_putmsg __P((struct proc *, struct ibcs2_putmsg_args *)); -int ibcs2_poll __P((struct proc *, struct ibcs2_poll_args *)); -int ibcs2_secure __P((struct proc *, struct ibcs2_secure_args *)); -int ibcs2_symlink __P((struct proc *, struct ibcs2_symlink_args *)); -int ibcs2_lstat __P((struct proc *, struct ibcs2_lstat_args *)); -int ibcs2_readlink __P((struct proc *, struct ibcs2_readlink_args *)); -int ibcs2_isc __P((struct proc *, struct ibcs2_isc_args *)); +int ibcs2_read __P((struct ibcs2_read_args *)); +int ibcs2_open __P((struct ibcs2_open_args *)); +int ibcs2_wait __P((struct ibcs2_wait_args *)); +int ibcs2_creat __P((struct ibcs2_creat_args *)); +int ibcs2_unlink __P((struct ibcs2_unlink_args *)); +int ibcs2_execv __P((struct ibcs2_execv_args *)); +int ibcs2_chdir __P((struct ibcs2_chdir_args *)); +int ibcs2_time __P((struct ibcs2_time_args *)); +int ibcs2_mknod __P((struct ibcs2_mknod_args *)); +int ibcs2_chmod __P((struct ibcs2_chmod_args *)); +int ibcs2_chown __P((struct ibcs2_chown_args *)); +int ibcs2_stat __P((struct ibcs2_stat_args *)); +int ibcs2_lseek __P((struct ibcs2_lseek_args *)); +int ibcs2_mount __P((struct ibcs2_mount_args *)); +int ibcs2_umount __P((struct ibcs2_umount_args *)); +int ibcs2_setuid __P((struct ibcs2_setuid_args *)); +int ibcs2_stime __P((struct ibcs2_stime_args *)); +int ibcs2_alarm __P((struct ibcs2_alarm_args *)); +int ibcs2_fstat __P((struct ibcs2_fstat_args *)); +int ibcs2_pause __P((struct ibcs2_pause_args *)); +int ibcs2_utime __P((struct ibcs2_utime_args *)); +int ibcs2_stty __P((struct ibcs2_stty_args *)); +int ibcs2_gtty __P((struct ibcs2_gtty_args *)); +int ibcs2_access __P((struct ibcs2_access_args *)); +int ibcs2_nice __P((struct ibcs2_nice_args *)); +int ibcs2_statfs __P((struct ibcs2_statfs_args *)); +int ibcs2_kill __P((struct ibcs2_kill_args *)); +int ibcs2_fstatfs __P((struct ibcs2_fstatfs_args *)); +int ibcs2_pgrpsys __P((struct ibcs2_pgrpsys_args *)); +int ibcs2_xenix __P((struct ibcs2_xenix_args *)); +int ibcs2_times __P((struct ibcs2_times_args *)); +int ibcs2_plock __P((struct ibcs2_plock_args *)); +int ibcs2_setgid __P((struct ibcs2_setgid_args *)); +int ibcs2_sigsys __P((struct ibcs2_sigsys_args *)); +int ibcs2_msgsys __P((struct ibcs2_msgsys_args *)); +int ibcs2_sysi86 __P((struct ibcs2_sysi86_args *)); +int ibcs2_shmsys __P((struct ibcs2_shmsys_args *)); +int ibcs2_semsys __P((struct ibcs2_semsys_args *)); +int ibcs2_ioctl __P((struct ibcs2_ioctl_args *)); +int ibcs2_uadmin __P((struct ibcs2_uadmin_args *)); +int ibcs2_utssys __P((struct ibcs2_utssys_args *)); +int ibcs2_execve __P((struct ibcs2_execve_args *)); +int ibcs2_fcntl __P((struct ibcs2_fcntl_args *)); +int ibcs2_ulimit __P((struct ibcs2_ulimit_args *)); +int ibcs2_rmdir __P((struct ibcs2_rmdir_args *)); +int ibcs2_mkdir __P((struct ibcs2_mkdir_args *)); +int ibcs2_getdents __P((struct ibcs2_getdents_args *)); +int ibcs2_sysfs __P((struct ibcs2_sysfs_args *)); +int ibcs2_getmsg __P((struct ibcs2_getmsg_args *)); +int ibcs2_putmsg __P((struct ibcs2_putmsg_args *)); +int ibcs2_poll __P((struct ibcs2_poll_args *)); +int ibcs2_secure __P((struct ibcs2_secure_args *)); +int ibcs2_symlink __P((struct ibcs2_symlink_args *)); +int ibcs2_lstat __P((struct ibcs2_lstat_args *)); +int ibcs2_readlink __P((struct ibcs2_readlink_args *)); +int ibcs2_isc __P((struct ibcs2_isc_args *)); #ifdef COMPAT_43 diff --git a/sys/emulation/ibcs2/i386/ibcs2_signal.c b/sys/emulation/ibcs2/i386/ibcs2_signal.c index dd198a202f..c36646b377 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_signal.c +++ b/sys/emulation/ibcs2/i386/ibcs2_signal.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/ibcs2/ibcs2_signal.c,v 1.16 1999/10/10 09:14:31 marcel Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_signal.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_signal.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ #include @@ -187,9 +187,7 @@ bsd_to_ibcs2_sigaction(bsa, isa) } int -ibcs2_sigaction(p, uap) - register struct proc *p; - struct ibcs2_sigaction_args *uap; +ibcs2_sigaction(struct ibcs2_sigaction_args *uap) { struct ibcs2_sigaction *nisa, *oisa, tmpisa; struct sigaction *nbsa, *obsa, tmpbsa; @@ -220,7 +218,7 @@ ibcs2_sigaction(p, uap) SCARG(&sa, act) = nbsa; SCARG(&sa, oact) = obsa; - if ((error = sigaction(p, &sa)) != 0) + if ((error = sigaction(&sa)) != 0) return error; if (oisa != NULL) { @@ -235,10 +233,9 @@ ibcs2_sigaction(p, uap) } int -ibcs2_sigsys(p, uap) - register struct proc *p; - struct ibcs2_sigsys_args *uap; +ibcs2_sigsys(struct ibcs2_sigsys_args *uap) { + struct proc *p = curproc; struct sigaction sa; int signum = ibcs2_to_bsd_sig[_SIG_IDX(IBCS2_SIGNO(SCARG(uap, sig)))]; int error; @@ -274,7 +271,7 @@ ibcs2_sigsys(p, uap) SCARG(&sa, how) = SIG_BLOCK; SCARG(&sa, set) = &mask; SCARG(&sa, oset) = NULL; - return sigprocmask(p, &sa); + return sigprocmask(&sa); } case IBCS2_SIGNAL_MASK: @@ -309,7 +306,7 @@ ibcs2_sigsys(p, uap) /* perform native sigaction() */ if ((error = copyout(&sa, nbsa, sizeof(sa))) != 0) return error; - if ((error = sigaction(p, &sa_args)) != 0) { + if ((error = sigaction(&sa_args)) != 0) { DPRINTF(("signal: sigaction failed: %d\n", error)); return error; @@ -340,7 +337,7 @@ ibcs2_sigsys(p, uap) SCARG(&sa, how) = SIG_UNBLOCK; SCARG(&sa, set) = &mask; SCARG(&sa, oset) = NULL; - return sigprocmask(p, &sa); + return sigprocmask(&sa); } case IBCS2_SIGIGNORE_MASK: @@ -358,7 +355,7 @@ ibcs2_sigsys(p, uap) sa.sa_flags = 0; if ((error = copyout(&sa, bsa, sizeof(sa))) != 0) return error; - if ((error = sigaction(p, &sa_args)) != 0) { + if ((error = sigaction(&sa_args)) != 0) { DPRINTF(("sigignore: sigaction failed\n")); return error; } @@ -373,7 +370,7 @@ ibcs2_sigsys(p, uap) mask = p->p_sigmask; SIGDELSET(mask, signum); SCARG(&sa, sigmask) = &mask; - return sigsuspend(p, &sa); + return sigsuspend(&sa); } default: @@ -382,10 +379,9 @@ ibcs2_sigsys(p, uap) } int -ibcs2_sigprocmask(p, uap) - register struct proc *p; - struct ibcs2_sigprocmask_args *uap; +ibcs2_sigprocmask(struct ibcs2_sigprocmask_args *uap) { + struct proc *p = curproc; ibcs2_sigset_t iss; sigset_t bss; int error = 0; @@ -434,10 +430,9 @@ ibcs2_sigprocmask(p, uap) } int -ibcs2_sigpending(p, uap) - register struct proc *p; - struct ibcs2_sigpending_args *uap; +ibcs2_sigpending(struct ibcs2_sigpending_args *uap) { + struct proc *p = curproc; sigset_t bss; ibcs2_sigset_t iss; @@ -449,9 +444,7 @@ ibcs2_sigpending(p, uap) } int -ibcs2_sigsuspend(p, uap) - register struct proc *p; - struct ibcs2_sigsuspend_args *uap; +ibcs2_sigsuspend(struct ibcs2_sigsuspend_args *uap) { ibcs2_sigset_t sss; sigset_t bss; @@ -463,30 +456,27 @@ ibcs2_sigsuspend(p, uap) ibcs2_to_bsd_sigset(&sss, &bss); SCARG(&sa, sigmask) = &bss; - return sigsuspend(p, &sa); + return sigsuspend(&sa); } int -ibcs2_pause(p, uap) - register struct proc *p; - struct ibcs2_pause_args *uap; +ibcs2_pause(struct ibcs2_pause_args *uap) { + struct proc *p = curproc; sigset_t mask; struct sigsuspend_args sa; mask = p->p_sigmask; SCARG(&sa, sigmask) = &mask; - return sigsuspend(p, &sa); + return sigsuspend(&sa); } int -ibcs2_kill(p, uap) - register struct proc *p; - struct ibcs2_kill_args *uap; +ibcs2_kill(struct ibcs2_kill_args *uap) { struct kill_args ka; SCARG(&ka, pid) = SCARG(uap, pid); SCARG(&ka, signum) = ibcs2_to_bsd_sig[_SIG_IDX(SCARG(uap, signo))]; - return kill(p, &ka); + return kill(&ka); } diff --git a/sys/emulation/ibcs2/i386/ibcs2_socksys.c b/sys/emulation/ibcs2/i386/ibcs2_socksys.c index 16d964e5c1..9048c90c1a 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_socksys.c +++ b/sys/emulation/ibcs2/i386/ibcs2_socksys.c @@ -44,19 +44,15 @@ struct setipdomainname_args { }; /* Local prototypes */ -static int ibcs2_getipdomainname __P((struct proc *, - struct getipdomainname_args *)); -static int ibcs2_setipdomainname __P((struct proc *, - struct setipdomainname_args *)); +static int ibcs2_getipdomainname __P((struct getipdomainname_args *)); +static int ibcs2_setipdomainname __P((struct setipdomainname_args *)); /* * iBCS2 socksys calls. */ int -ibcs2_socksys(p, uap) - register struct proc *p; - register struct ibcs2_socksys_args *uap; +ibcs2_socksys(struct ibcs2_socksys_args *uap) { int error; int realargs[7]; /* 1 for command, 6 for recvfrom */ @@ -77,55 +73,55 @@ ibcs2_socksys(p, uap) passargs = (void *)(realargs + 1); switch (realargs[0]) { case SOCKSYS_ACCEPT: - return accept(p, passargs); + return accept(passargs); case SOCKSYS_BIND: - return bind(p, passargs); + return bind(passargs); case SOCKSYS_CONNECT: - return connect(p, passargs); + return connect(passargs); case SOCKSYS_GETPEERNAME: - return getpeername(p, passargs); + return getpeername(passargs); case SOCKSYS_GETSOCKNAME: - return getsockname(p, passargs); + return getsockname(passargs); case SOCKSYS_GETSOCKOPT: - return getsockopt(p, passargs); + return getsockopt(passargs); case SOCKSYS_LISTEN: - return listen(p, passargs); + return listen(passargs); case SOCKSYS_RECV: realargs[5] = realargs[6] = 0; /* FALLTHROUGH */ case SOCKSYS_RECVFROM: - return recvfrom(p, passargs); + return recvfrom(passargs); case SOCKSYS_SEND: realargs[5] = realargs[6] = 0; /* FALLTHROUGH */ case SOCKSYS_SENDTO: - return sendto(p, passargs); + return sendto(passargs); case SOCKSYS_SETSOCKOPT: - return setsockopt(p, passargs); + return setsockopt(passargs); case SOCKSYS_SHUTDOWN: - return shutdown(p, passargs); + return shutdown(passargs); case SOCKSYS_SOCKET: - return socket(p, passargs); + return socket(passargs); case SOCKSYS_SELECT: - return select(p, passargs); + return select(passargs); case SOCKSYS_GETIPDOMAIN: - return ibcs2_getipdomainname(p, passargs); + return ibcs2_getipdomainname(passargs); case SOCKSYS_SETIPDOMAIN: - return ibcs2_setipdomainname(p, passargs); + return ibcs2_setipdomainname(passargs); case SOCKSYS_ADJTIME: - return adjtime(p, passargs); + return adjtime(passargs); case SOCKSYS_SETREUID: - return setreuid(p, passargs); + return setreuid(passargs); case SOCKSYS_SETREGID: - return setregid(p, passargs); + return setregid(passargs); case SOCKSYS_GETTIME: - return gettimeofday(p, passargs); + return gettimeofday(passargs); case SOCKSYS_SETTIME: - return settimeofday(p, passargs); + return settimeofday(passargs); case SOCKSYS_GETITIMER: - return getitimer(p, passargs); + return getitimer(passargs); case SOCKSYS_SETITIMER: - return setitimer(p, passargs); + return setitimer(passargs); default: printf("socksys unknown %08x %08x %08x %08x %08x %08x %08x\n", @@ -138,9 +134,7 @@ ibcs2_socksys(p, uap) /* ARGSUSED */ static int -ibcs2_getipdomainname(p, uap) - struct proc *p; - struct getipdomainname_args *uap; +ibcs2_getipdomainname(struct getipdomainname_args *uap) { char hname[MAXHOSTNAMELEN], *dptr; int len; @@ -162,14 +156,12 @@ ibcs2_getipdomainname(p, uap) /* ARGSUSED */ static int -ibcs2_setipdomainname(p, uap) - struct proc *p; - struct setipdomainname_args *uap; +ibcs2_setipdomainname(struct setipdomainname_args *uap) { char hname[MAXHOSTNAMELEN], *ptr; int error, sctl[2], hlen; - if ((error = suser(p))) + if ((error = suser())) return (error); /* W/out a hostname a domain-name is nonsense */ @@ -200,5 +192,5 @@ ibcs2_setipdomainname(p, uap) sctl[0] = CTL_KERN; sctl[1] = KERN_HOSTNAME; hlen = strlen(hname) + 1; - return (kernel_sysctl(p, sctl, 2, 0, 0, hname, hlen, 0)); + return (kernel_sysctl(sctl, 2, 0, 0, hname, hlen, 0)); } diff --git a/sys/emulation/ibcs2/i386/ibcs2_socksys.h b/sys/emulation/ibcs2/i386/ibcs2_socksys.h index f6b212e0f7..5341293808 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_socksys.h +++ b/sys/emulation/ibcs2/i386/ibcs2_socksys.h @@ -121,6 +121,6 @@ struct ibcs2_socksys_args { caddr_t argsp; }; -int ibcs2_socksys __P((struct proc *, struct ibcs2_socksys_args *)); +int ibcs2_socksys __P((struct ibcs2_socksys_args *)); #endif /* !_I386_IBCS2_IBCS2_SOCKSYS_H_ */ diff --git a/sys/emulation/ibcs2/i386/ibcs2_stat.c b/sys/emulation/ibcs2/i386/ibcs2_stat.c index b1733041b9..e4596f3f8a 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_stat.c +++ b/sys/emulation/ibcs2/i386/ibcs2_stat.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/ibcs2/ibcs2_stat.c,v 1.10 1999/12/15 23:01:45 eivind Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_stat.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_stat.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ #include @@ -97,17 +97,16 @@ cvt_statfs(sp, buf, len) } int -ibcs2_statfs(p, uap) - struct proc *p; - struct ibcs2_statfs_args *uap; +ibcs2_statfs(struct ibcs2_statfs_args *uap) { - register struct mount *mp; - register struct statfs *sp; + struct proc *p = curproc; + struct mount *mp; + struct statfs *sp; int error; struct nameidata nd; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if ((error = namei(&nd)) != 0) return (error); @@ -122,10 +121,9 @@ ibcs2_statfs(p, uap) } int -ibcs2_fstatfs(p, uap) - struct proc *p; - struct ibcs2_fstatfs_args *uap; +ibcs2_fstatfs(struct ibcs2_fstatfs_args *uap) { + struct proc *p = curproc; struct file *fp; struct mount *mp; register struct statfs *sp; @@ -142,9 +140,7 @@ ibcs2_fstatfs(p, uap) } int -ibcs2_stat(p, uap) - struct proc *p; - struct ibcs2_stat_args *uap; +ibcs2_stat(struct ibcs2_stat_args *uap) { struct stat st; struct ibcs2_stat ibcs2_st; @@ -152,11 +148,11 @@ ibcs2_stat(p, uap) int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(st)); - if ((error = stat(p, &cup)) != 0) + if ((error = stat(&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, ub), &st, sizeof(st))) != 0) @@ -167,9 +163,7 @@ ibcs2_stat(p, uap) } int -ibcs2_lstat(p, uap) - struct proc *p; - struct ibcs2_lstat_args *uap; +ibcs2_lstat(struct ibcs2_lstat_args *uap) { struct stat st; struct ibcs2_stat ibcs2_st; @@ -177,11 +171,11 @@ ibcs2_lstat(p, uap) int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(st)); - if ((error = lstat(p, &cup)) != 0) + if ((error = lstat(&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, ub), &st, sizeof(st))) != 0) @@ -192,9 +186,7 @@ ibcs2_lstat(p, uap) } int -ibcs2_fstat(p, uap) - struct proc *p; - struct ibcs2_fstat_args *uap; +ibcs2_fstat(struct ibcs2_fstat_args *uap) { struct stat st; struct ibcs2_stat ibcs2_st; @@ -205,7 +197,7 @@ ibcs2_fstat(p, uap) SCARG(&cup, fd) = SCARG(uap, fd); SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(st)); - if ((error = fstat(p, &cup)) != 0) + if ((error = fstat(&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, sb), &st, sizeof(st))) != 0) @@ -216,9 +208,7 @@ ibcs2_fstat(p, uap) } int -ibcs2_utssys(p, uap) - struct proc *p; - struct ibcs2_utssys_args *uap; +ibcs2_utssys(struct ibcs2_utssys_args *uap) { switch (SCARG(uap, flag)) { case 0: /* uname(2) */ diff --git a/sys/emulation/ibcs2/i386/ibcs2_syscall.h b/sys/emulation/ibcs2/i386/ibcs2_syscall.h index 3fbf47b57e..a99fc4c288 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_syscall.h +++ b/sys/emulation/ibcs2/i386/ibcs2_syscall.h @@ -2,9 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/ibcs2/ibcs2_syscall.h,v 1.8.2.4 2001/10/05 07:38:43 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_syscall.h,v 1.2 2003/06/17 04:28:35 dillon Exp $ - * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.9.2.2 2001/10/05 07:34:36 peter Exp + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_syscall.h,v 1.3 2003/06/23 17:55:38 dillon Exp $ + * created from TurtleBSD: src/sys/i386/ibcs2/syscalls.master,v 1.2 2003/06/17 04:28:35 dillon Exp */ #define IBCS2_SYS_syscall 0 diff --git a/sys/emulation/ibcs2/i386/ibcs2_sysent.c b/sys/emulation/ibcs2/i386/ibcs2_sysent.c index 531d9de85a..3198bd2ba3 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_sysent.c +++ b/sys/emulation/ibcs2/i386/ibcs2_sysent.c @@ -2,9 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/ibcs2/ibcs2_sysent.c,v 1.11.2.4 2001/10/05 07:38:43 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_sysent.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ - * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.9.2.2 2001/10/05 07:34:36 peter Exp + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_sysent.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ + * created from TurtleBSD: src/sys/i386/ibcs2/syscalls.master,v 1.2 2003/06/17 04:28:35 dillon Exp */ #include diff --git a/sys/emulation/ibcs2/i386/ibcs2_sysi86.c b/sys/emulation/ibcs2/i386/ibcs2_sysi86.c index bcc758b606..198cc4d74b 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_sysi86.c +++ b/sys/emulation/ibcs2/i386/ibcs2_sysi86.c @@ -51,8 +51,10 @@ extern int hw_float; int -ibcs2_sysi86(struct proc *p, struct ibcs2_sysi86_args *args) +ibcs2_sysi86(struct ibcs2_sysi86_args *args) { + struct proc *p = curproc; + switch (SCARG(args, cmd)) { case SI86_FPHW: { /* Floating Point information */ int val, error; @@ -73,11 +75,11 @@ ibcs2_sysi86(struct proc *p, struct ibcs2_sysi86_args *args) int name[2]; int error; - if ((error = suser(p))) + if ((error = suser())) return (error); name[0] = CTL_KERN; name[1] = KERN_HOSTNAME; - return (userland_sysctl(p, name, 2, 0, 0, 0, + return (userland_sysctl(name, 2, 0, 0, 0, SCARG(args, arg), 7, 0)); } diff --git a/sys/emulation/ibcs2/i386/ibcs2_util.c b/sys/emulation/ibcs2/i386/ibcs2_util.c index 4abb734f1d..50260a5134 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_util.c +++ b/sys/emulation/ibcs2/i386/ibcs2_util.c @@ -28,7 +28,7 @@ * * from: svr4_util.c,v 1.5 1995/01/22 23:44:50 christos Exp * $FreeBSD: src/sys/i386/ibcs2/ibcs2_util.c,v 1.7 1999/12/15 23:01:45 eivind Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_util.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_util.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ #include @@ -52,14 +52,14 @@ const char ibcs2_emul_path[] = "/compat/ibcs2"; * be in exists. */ int -ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag) - struct proc *p; +ibcs2_emul_find(sgp, prefix, path, pbuf, cflag) caddr_t *sgp; /* Pointer to stackgap memory */ const char *prefix; char *path; char **pbuf; int cflag; { + struct proc *p = curproc; struct nameidata nd; struct nameidata ndroot; struct vattr vat; diff --git a/sys/emulation/ibcs2/i386/ibcs2_util.h b/sys/emulation/ibcs2/i386/ibcs2_util.h index 4ef390f64f..d2eb3befdf 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_util.h +++ b/sys/emulation/ibcs2/i386/ibcs2_util.h @@ -82,17 +82,17 @@ stackgap_alloc(sgp, sz) extern const char ibcs2_emul_path[]; -int ibcs2_emul_find __P((struct proc *, caddr_t *, const char *, char *, +int ibcs2_emul_find __P((caddr_t *, const char *, char *, char **, int)); -#define CHECKALTEXIST(p, sgp, path) \ - ibcs2_emul_find(p, sgp, ibcs2_emul_path, path, &(path), 0) +#define CHECKALTEXIST(sgp, path) \ + ibcs2_emul_find(sgp, ibcs2_emul_path, path, &(path), 0) -#define CHECKALTCREAT(p, sgp, path) \ - ibcs2_emul_find(p, sgp, ibcs2_emul_path, path, &(path), 1) +#define CHECKALTCREAT(sgp, path) \ + ibcs2_emul_find(sgp, ibcs2_emul_path, path, &(path), 1) #ifdef SPX_HACK -int spx_open __P((struct proc *p, void *uap)); +int spx_open __P((void *uap)); #endif #endif /* !_IBCS2_UTIL_H_ */ diff --git a/sys/emulation/ibcs2/i386/ibcs2_xenix.c b/sys/emulation/ibcs2/i386/ibcs2_xenix.c index 29889e9b7c..4bb8383b8e 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_xenix.c +++ b/sys/emulation/ibcs2/i386/ibcs2_xenix.c @@ -28,7 +28,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix.c,v 1.20 1999/12/15 23:01:46 eivind Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_xenix.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_xenix.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ #include @@ -55,8 +55,9 @@ extern struct sysent xenix_sysent[]; int -ibcs2_xenix(struct proc *p, struct ibcs2_xenix_args *uap) +ibcs2_xenix(struct ibcs2_xenix_args *uap) { + struct proc *p = curproc; struct trapframe *tf = p->p_md.md_regs; struct sysent *callp; u_int code; @@ -64,17 +65,16 @@ ibcs2_xenix(struct proc *p, struct ibcs2_xenix_args *uap) code = (tf->tf_eax & 0xff00) >> 8; callp = &xenix_sysent[code]; - if(code < IBCS2_XENIX_MAXSYSCALL) - return((*callp->sy_call)(p, (void *)uap)); + if (code < IBCS2_XENIX_MAXSYSCALL) + return((*callp->sy_call)((void *)uap)); else - return ENOSYS; + return ENOSYS; } int -xenix_rdchk(p, uap) - struct proc *p; - struct xenix_rdchk_args *uap; +xenix_rdchk(struct xenix_rdchk_args *uap) { + struct proc *p = curproc; int error; struct ioctl_args sa; caddr_t sg = stackgap_init(); @@ -83,16 +83,14 @@ xenix_rdchk(p, uap) SCARG(&sa, fd) = SCARG(uap, fd); SCARG(&sa, com) = FIONREAD; SCARG(&sa, data) = stackgap_alloc(&sg, sizeof(int)); - if ((error = ioctl(p, &sa)) != 0) + if ((error = ioctl(&sa)) != 0) return error; p->p_retval[0] = (*((int*)SCARG(&sa, data))) ? 1 : 0; return 0; } int -xenix_chsize(p, uap) - struct proc *p; - struct xenix_chsize_args *uap; +xenix_chsize(struct xenix_chsize_args *uap) { struct ftruncate_args sa; @@ -100,14 +98,12 @@ xenix_chsize(p, uap) SCARG(&sa, fd) = SCARG(uap, fd); SCARG(&sa, pad) = 0; SCARG(&sa, length) = SCARG(uap, size); - return ftruncate(p, &sa); + return ftruncate(&sa); } int -xenix_ftime(p, uap) - struct proc *p; - struct xenix_ftime_args *uap; +xenix_ftime(struct xenix_ftime_args *uap) { struct timeval tv; struct ibcs2_timeb { @@ -129,7 +125,7 @@ xenix_ftime(p, uap) } int -xenix_nap(struct proc *p, struct xenix_nap_args *uap) +xenix_nap(struct xenix_nap_args *uap) { long period; @@ -142,7 +138,7 @@ xenix_nap(struct proc *p, struct xenix_nap_args *uap) } int -xenix_utsname(struct proc *p, struct xenix_utsname_args *uap) +xenix_utsname(struct xenix_utsname_args *uap) { struct ibcs2_sco_utsname { char sysname[9]; @@ -185,23 +181,26 @@ xenix_utsname(struct proc *p, struct xenix_utsname_args *uap) } int -xenix_scoinfo(struct proc *p, struct xenix_scoinfo_args *uap) +xenix_scoinfo(struct xenix_scoinfo_args *uap) { - /* scoinfo (not documented) */ - p->p_retval[0] = 0; - return 0; + struct proc *p = curproc; + + /* scoinfo (not documented) */ + p->p_retval[0] = 0; + return 0; } int -xenix_eaccess(struct proc *p, struct xenix_eaccess_args *uap) +xenix_eaccess(struct xenix_eaccess_args *uap) { + struct proc *p = curproc; struct ucred *cred = p->p_ucred; struct vnode *vp; struct nameidata nd; int error, flags; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, SCARG(uap, path), p); diff --git a/sys/emulation/ibcs2/i386/ibcs2_xenix.h b/sys/emulation/ibcs2/i386/ibcs2_xenix.h index 87ca31b0a7..8985cc5b23 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_xenix.h +++ b/sys/emulation/ibcs2/i386/ibcs2_xenix.h @@ -2,9 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix.h,v 1.9.2.2 2000/08/08 23:28:16 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_xenix.h,v 1.2 2003/06/17 04:28:35 dillon Exp $ - * created from FreeBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.6 1999/08/28 00:44:02 peter Exp + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_xenix.h,v 1.3 2003/06/23 17:55:38 dillon Exp $ + * created from TurtleBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.2 2003/06/17 04:28:35 dillon Exp */ #ifndef _IBCS2_XENIX_H_ @@ -14,8 +13,6 @@ #include -struct proc; - #define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ 0 : sizeof(register_t) - sizeof(t)) @@ -81,23 +78,23 @@ struct ibcs2_rename_args { struct xenix_utsname_args { long addr; char addr_[PAD_(long)]; }; -int xenix_rdchk __P((struct proc *, struct xenix_rdchk_args *)); -int xenix_chsize __P((struct proc *, struct xenix_chsize_args *)); -int xenix_ftime __P((struct proc *, struct xenix_ftime_args *)); -int xenix_nap __P((struct proc *, struct xenix_nap_args *)); -int xenix_scoinfo __P((struct proc *, struct xenix_scoinfo_args *)); -int xenix_eaccess __P((struct proc *, struct xenix_eaccess_args *)); -int ibcs2_sigaction __P((struct proc *, struct ibcs2_sigaction_args *)); -int ibcs2_sigprocmask __P((struct proc *, struct ibcs2_sigprocmask_args *)); -int ibcs2_sigpending __P((struct proc *, struct ibcs2_sigpending_args *)); -int ibcs2_sigsuspend __P((struct proc *, struct ibcs2_sigsuspend_args *)); -int ibcs2_getgroups __P((struct proc *, struct ibcs2_getgroups_args *)); -int ibcs2_setgroups __P((struct proc *, struct ibcs2_setgroups_args *)); -int ibcs2_sysconf __P((struct proc *, struct ibcs2_sysconf_args *)); -int ibcs2_pathconf __P((struct proc *, struct ibcs2_pathconf_args *)); -int ibcs2_fpathconf __P((struct proc *, struct ibcs2_fpathconf_args *)); -int ibcs2_rename __P((struct proc *, struct ibcs2_rename_args *)); -int xenix_utsname __P((struct proc *, struct xenix_utsname_args *)); +int xenix_rdchk __P((struct xenix_rdchk_args *)); +int xenix_chsize __P((struct xenix_chsize_args *)); +int xenix_ftime __P((struct xenix_ftime_args *)); +int xenix_nap __P((struct xenix_nap_args *)); +int xenix_scoinfo __P((struct xenix_scoinfo_args *)); +int xenix_eaccess __P((struct xenix_eaccess_args *)); +int ibcs2_sigaction __P((struct ibcs2_sigaction_args *)); +int ibcs2_sigprocmask __P((struct ibcs2_sigprocmask_args *)); +int ibcs2_sigpending __P((struct ibcs2_sigpending_args *)); +int ibcs2_sigsuspend __P((struct ibcs2_sigsuspend_args *)); +int ibcs2_getgroups __P((struct ibcs2_getgroups_args *)); +int ibcs2_setgroups __P((struct ibcs2_setgroups_args *)); +int ibcs2_sysconf __P((struct ibcs2_sysconf_args *)); +int ibcs2_pathconf __P((struct ibcs2_pathconf_args *)); +int ibcs2_fpathconf __P((struct ibcs2_fpathconf_args *)); +int ibcs2_rename __P((struct ibcs2_rename_args *)); +int xenix_utsname __P((struct xenix_utsname_args *)); #ifdef COMPAT_43 diff --git a/sys/emulation/ibcs2/i386/ibcs2_xenix_syscall.h b/sys/emulation/ibcs2/i386/ibcs2_xenix_syscall.h index f75a461458..0572317a76 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_xenix_syscall.h +++ b/sys/emulation/ibcs2/i386/ibcs2_xenix_syscall.h @@ -2,9 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix_syscall.h,v 1.6.2.2 2000/08/08 23:28:16 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_xenix_syscall.h,v 1.2 2003/06/17 04:28:35 dillon Exp $ - * created from FreeBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.6 1999/08/28 00:44:02 peter Exp + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_xenix_syscall.h,v 1.3 2003/06/23 17:55:38 dillon Exp $ + * created from TurtleBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.2 2003/06/17 04:28:35 dillon Exp */ #define IBCS2_XENIX_xenix_rdchk 7 diff --git a/sys/emulation/ibcs2/i386/ibcs2_xenix_sysent.c b/sys/emulation/ibcs2/i386/ibcs2_xenix_sysent.c index 062bd6d115..c20ef263bb 100644 --- a/sys/emulation/ibcs2/i386/ibcs2_xenix_sysent.c +++ b/sys/emulation/ibcs2/i386/ibcs2_xenix_sysent.c @@ -2,9 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix_sysent.c,v 1.7.2.2 2000/08/08 23:28:16 peter Exp $ - * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_xenix_sysent.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ - * created from FreeBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.6 1999/08/28 00:44:02 peter Exp + * $DragonFly: src/sys/emulation/ibcs2/i386/Attic/ibcs2_xenix_sysent.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ + * created from TurtleBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.2 2003/06/17 04:28:35 dillon Exp */ #include diff --git a/sys/emulation/linux/i386/linprocfs/linprocfs_misc.c b/sys/emulation/linux/i386/linprocfs/linprocfs_misc.c index da226e6a74..4e0e6e0a87 100644 --- a/sys/emulation/linux/i386/linprocfs/linprocfs_misc.c +++ b/sys/emulation/linux/i386/linprocfs/linprocfs_misc.c @@ -39,7 +39,7 @@ * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 * * $FreeBSD: src/sys/i386/linux/linprocfs/linprocfs_misc.c,v 1.3.2.8 2001/06/25 19:46:47 pirzyk Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_misc.c,v 1.2 2003/06/17 04:28:39 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_misc.c,v 1.3 2003/06/23 17:55:40 dillon Exp $ */ #include @@ -438,14 +438,14 @@ linprocfs_doprocstatus(curp, p, pfs, uio) */ PS_ADD(ps, "Pid:\t%d\n", p->p_pid); PS_ADD(ps, "PPid:\t%d\n", p->p_pptr ? p->p_pptr->p_pid : 0); - PS_ADD(ps, "Uid:\t%d %d %d %d\n", p->p_cred->p_ruid, + PS_ADD(ps, "Uid:\t%d %d %d %d\n", p->p_ucred->cr_ruid, p->p_ucred->cr_uid, - p->p_cred->p_svuid, + p->p_ucred->cr_svuid, /* FreeBSD doesn't have fsuid */ p->p_ucred->cr_uid); - PS_ADD(ps, "Gid:\t%d %d %d %d\n", p->p_cred->p_rgid, + PS_ADD(ps, "Gid:\t%d %d %d %d\n", p->p_ucred->cr_rgid, p->p_ucred->cr_gid, - p->p_cred->p_svgid, + p->p_ucred->cr_svgid, /* FreeBSD doesn't have fsgid */ p->p_ucred->cr_gid); PS_ADD(ps, "Groups:\t"); @@ -498,6 +498,8 @@ linprocfs_doprocstatus(curp, p, pfs, uio) return (xlen <= 0 ? 0 : uiomove(ps, xlen, uio)); } +extern int nextpid; + int linprocfs_doloadavg(curp, p, pfs, uio) struct proc *curp; @@ -505,9 +507,8 @@ linprocfs_doloadavg(curp, p, pfs, uio) struct pfsnode *pfs; struct uio *uio; { - char *ps, psbuf[512]; - int xlen; - extern int nextpid; + char *ps, psbuf[512]; + int xlen; ps=psbuf; @@ -528,5 +529,5 @@ linprocfs_doloadavg(curp, p, pfs, uio) xlen -= uio->uio_offset; ps = psbuf + uio->uio_offset; xlen = imin(xlen, uio->uio_resid); - return (xlen <= 0 ? 0 : uiomove(ps, xlen, uio)); + return (xlen <= 0 ? 0 : uiomove(ps, xlen, uio)); } diff --git a/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c b/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c index adc655a4df..4cb9ecb975 100644 --- a/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c +++ b/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c @@ -39,7 +39,7 @@ * @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/i386/linux/linprocfs/linprocfs_vnops.c,v 1.3.2.5 2001/08/12 14:29:19 rwatson Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c,v 1.2 2003/06/17 04:28:39 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c,v 1.3 2003/06/23 17:55:40 dillon Exp $ */ /* @@ -128,12 +128,12 @@ linprocfs_open(ap) } */ *ap; { struct pfsnode *pfs = VTOPFS(ap->a_vp); - struct proc *p1, *p2; + struct proc *p2; p2 = PFIND(pfs->pfs_pid); if (p2 == NULL) return (ENOENT); - if (pfs->pfs_pid && !PRISON_CHECK(ap->a_p, p2)) + if (pfs->pfs_pid && !PRISON_CHECK(ap->a_cred, p2->p_ucred)) return (ENOENT); switch (pfs->pfs_type) { @@ -142,8 +142,7 @@ linprocfs_open(ap) ((pfs->pfs_flags & O_EXCL) && (ap->a_mode & FWRITE))) return (EBUSY); - p1 = ap->a_p; - if (p_trespass(p1, p2)) + if (p_trespass(ap->a_cred, p2->p_ucred)) return (EPERM); if (ap->a_mode & FWRITE) @@ -226,7 +225,7 @@ linprocfs_ioctl(ap) return ENOTTY; } - if (p_trespass(p, procp)) + if (p_trespass(ap->a_cred, procp->p_ucred)) return EPERM; switch (ap->a_command) { @@ -243,7 +242,7 @@ linprocfs_ioctl(ap) */ #define NFLAGS (PF_ISUGID) flags = (unsigned char)*(unsigned int*)ap->a_data; - if (flags & NFLAGS && (error = suser(p))) + if (flags & NFLAGS && (error = suser_xxx(ap->a_cred, 0))) return error; procp->p_pfsflags = flags; break; @@ -423,8 +422,7 @@ linprocfs_getattr(ap) default: procp = PFIND(pfs->pfs_pid); - if (procp == 0 || procp->p_cred == NULL || - procp->p_ucred == NULL) + if (procp == 0 || procp->p_ucred == NULL) return (ENOENT); } @@ -795,7 +793,7 @@ linprocfs_readdir(ap) p = PFIND(pfs->pfs_pid); if (p == NULL) break; - if (!PRISON_CHECK(curproc, p)) + if (!PRISON_CHECK(ap->a_cred, p->p_ucred)) break; for (pt = &proc_targets[i]; @@ -901,11 +899,11 @@ linprocfs_readdir(ap) p = p->p_list.le_next; if (!p) goto done; - if (!PRISON_CHECK(curproc, p)) + if (!PRISON_CHECK(ap->a_cred, p->p_ucred)) continue; pcnt++; } - while (!PRISON_CHECK(curproc, p)) { + while (!PRISON_CHECK(ap->a_cred, p->p_ucred)) { p = p->p_list.le_next; if (!p) goto done; @@ -973,8 +971,7 @@ linprocfs_readlink(ap) */ case Pexe: procp = PFIND(pfs->pfs_pid); - if (procp == NULL || procp->p_cred == NULL || - procp->p_ucred == NULL) { + if (procp == NULL || procp->p_ucred == NULL) { printf("linprocfs_readlink: pid %d disappeared\n", pfs->pfs_pid); return (uiomove("unknown", sizeof("unknown") - 1, diff --git a/sys/emulation/linux/i386/linux_machdep.c b/sys/emulation/linux/i386/linux_machdep.c index ac874b9622..822cff902f 100644 --- a/sys/emulation/linux/i386/linux_machdep.c +++ b/sys/emulation/linux/i386/linux_machdep.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/linux/linux_machdep.c,v 1.6.2.4 2001/11/05 19:08:23 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linux_machdep.c,v 1.2 2003/06/17 04:28:38 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linux_machdep.c,v 1.3 2003/06/23 17:55:39 dillon Exp $ */ #include @@ -99,13 +99,13 @@ bsd_to_linux_sigaltstack(int bsa) } int -linux_execve(struct proc *p, struct linux_execve_args *args) +linux_execve(struct linux_execve_args *args) { struct execve_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(execve)) @@ -115,7 +115,7 @@ linux_execve(struct proc *p, struct linux_execve_args *args) bsd.fname = args->path; bsd.argv = args->argp; bsd.envv = args->envp; - return (execve(p, &bsd)); + return (execve(&bsd)); } struct l_ipc_kludge { @@ -124,7 +124,7 @@ struct l_ipc_kludge { }; int -linux_ipc(struct proc *p, struct linux_ipc_args *args) +linux_ipc(struct linux_ipc_args *args) { switch (args->what & 0xFFFF) { @@ -134,7 +134,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args) a.semid = args->arg1; a.tsops = args->ptr; a.nsops = args->arg2; - return (linux_semop(p, &a)); + return (linux_semop(&a)); } case LINUX_SEMGET: { struct linux_semget_args a; @@ -142,7 +142,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args) a.key = args->arg1; a.nsems = args->arg2; a.semflg = args->arg3; - return (linux_semget(p, &a)); + return (linux_semget(&a)); } case LINUX_SEMCTL: { struct linux_semctl_args a; @@ -154,7 +154,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args) error = copyin((caddr_t)args->ptr, &a.arg, sizeof(a.arg)); if (error) return (error); - return (linux_semctl(p, &a)); + return (linux_semctl(&a)); } case LINUX_MSGSND: { struct linux_msgsnd_args a; @@ -163,7 +163,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args) a.msgp = args->ptr; a.msgsz = args->arg2; a.msgflg = args->arg3; - return (linux_msgsnd(p, &a)); + return (linux_msgsnd(&a)); } case LINUX_MSGRCV: { struct linux_msgrcv_args a; @@ -186,14 +186,14 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args) a.msgp = args->ptr; a.msgtyp = args->arg5; } - return (linux_msgrcv(p, &a)); + return (linux_msgrcv(&a)); } case LINUX_MSGGET: { struct linux_msgget_args a; a.key = args->arg1; a.msgflg = args->arg2; - return (linux_msgget(p, &a)); + return (linux_msgget(&a)); } case LINUX_MSGCTL: { struct linux_msgctl_args a; @@ -201,7 +201,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args) a.msqid = args->arg1; a.cmd = args->arg2; a.buf = args->ptr; - return (linux_msgctl(p, &a)); + return (linux_msgctl(&a)); } case LINUX_SHMAT: { struct linux_shmat_args a; @@ -210,13 +210,13 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args) a.shmaddr = args->ptr; a.shmflg = args->arg2; a.raddr = (l_ulong *)args->arg3; - return (linux_shmat(p, &a)); + return (linux_shmat(&a)); } case LINUX_SHMDT: { struct linux_shmdt_args a; a.shmaddr = args->ptr; - return (linux_shmdt(p, &a)); + return (linux_shmdt(&a)); } case LINUX_SHMGET: { struct linux_shmget_args a; @@ -224,7 +224,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args) a.key = args->arg1; a.size = args->arg2; a.shmflg = args->arg3; - return (linux_shmget(p, &a)); + return (linux_shmget(&a)); } case LINUX_SHMCTL: { struct linux_shmctl_args a; @@ -232,7 +232,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args) a.shmid = args->arg1; a.cmd = args->arg2; a.buf = args->ptr; - return (linux_shmctl(p, &a)); + return (linux_shmctl(&a)); } default: break; @@ -242,7 +242,7 @@ linux_ipc(struct proc *p, struct linux_ipc_args *args) } int -linux_old_select(struct proc *p, struct linux_old_select_args *args) +linux_old_select(struct linux_old_select_args *args) { struct l_old_select_argv linux_args; struct linux_select_args newsel; @@ -262,12 +262,13 @@ linux_old_select(struct proc *p, struct linux_old_select_args *args) newsel.writefds = linux_args.writefds; newsel.exceptfds = linux_args.exceptfds; newsel.timeout = linux_args.timeout; - return (linux_select(p, &newsel)); + return (linux_select(&newsel)); } int -linux_fork(struct proc *p, struct linux_fork_args *args) +linux_fork(struct linux_fork_args *args) { + struct proc *p = curproc; int error; #ifdef DEBUG @@ -275,7 +276,7 @@ linux_fork(struct proc *p, struct linux_fork_args *args) printf(ARGS(fork, "")); #endif - if ((error = fork(p, (struct fork_args *)args)) != 0) + if ((error = fork((struct fork_args *)args)) != 0) return (error); if (p->p_retval[1] == 1) @@ -284,8 +285,9 @@ linux_fork(struct proc *p, struct linux_fork_args *args) } int -linux_vfork(struct proc *p, struct linux_vfork_args *args) +linux_vfork(struct linux_vfork_args *args) { + struct proc *p = curproc; int error; #ifdef DEBUG @@ -293,7 +295,7 @@ linux_vfork(struct proc *p, struct linux_vfork_args *args) printf(ARGS(vfork, "")); #endif - if ((error = vfork(p, (struct vfork_args *)args)) != 0) + if ((error = vfork((struct vfork_args *)args)) != 0) return (error); /* Are we the child? */ if (p->p_retval[1] == 1) @@ -308,8 +310,9 @@ linux_vfork(struct proc *p, struct linux_vfork_args *args) #define CLONE_PID 0x1000 int -linux_clone(struct proc *p, struct linux_clone_args *args) +linux_clone(struct linux_clone_args *args) { + struct proc *p = curproc; int error, ff = RFPROC; struct proc *p2; int exit_signal; @@ -349,7 +352,7 @@ linux_clone(struct proc *p, struct linux_clone_args *args) start = 0; rf_args.flags = ff; - if ((error = rfork(p, &rf_args)) != 0) + if ((error = rfork(&rf_args)) != 0) return (error); p2 = pfind(p->p_retval[0]); @@ -382,8 +385,9 @@ struct l_mmap_argv { #define GUARD_SIZE (4 * PAGE_SIZE) int -linux_mmap(struct proc *p, struct linux_mmap_args *args) +linux_mmap(struct linux_mmap_args *args) { + struct proc *p = curproc; struct mmap_args /* { caddr_t addr; size_t len; @@ -498,12 +502,13 @@ linux_mmap(struct proc *p, struct linux_mmap_args *args) bsd_args.flags, bsd_args.fd, (int)bsd_args.pos); #endif - return (mmap(p, &bsd_args)); + return (mmap(&bsd_args)); } int -linux_pipe(struct proc *p, struct linux_pipe_args *args) +linux_pipe(struct linux_pipe_args *args) { + struct proc *p = curproc; int error; int reg_edx; @@ -513,7 +518,7 @@ linux_pipe(struct proc *p, struct linux_pipe_args *args) #endif reg_edx = p->p_retval[1]; - error = pipe(p, 0); + error = pipe(NULL); if (error) { p->p_retval[1] = reg_edx; return (error); @@ -531,7 +536,7 @@ linux_pipe(struct proc *p, struct linux_pipe_args *args) } int -linux_ioperm(struct proc *p, struct linux_ioperm_args *args) +linux_ioperm(struct linux_ioperm_args *args) { struct sysarch_args sa; struct i386_ioperm_args *iia; @@ -544,17 +549,18 @@ linux_ioperm(struct proc *p, struct linux_ioperm_args *args) iia->enable = args->enable; sa.op = I386_SET_IOPERM; sa.parms = (char *)iia; - return (sysarch(p, &sa)); + return (sysarch(&sa)); } int -linux_iopl(struct proc *p, struct linux_iopl_args *args) +linux_iopl(struct linux_iopl_args *args) { + struct proc *p = curproc; int error; if (args->level < 0 || args->level > 3) return (EINVAL); - if ((error = suser(p)) != 0) + if ((error = suser()) != 0) return (error); if (securelevel > 0) return (EPERM); @@ -564,10 +570,9 @@ linux_iopl(struct proc *p, struct linux_iopl_args *args) } int -linux_modify_ldt(p, uap) - struct proc *p; - struct linux_modify_ldt_args *uap; +linux_modify_ldt(struct linux_modify_ldt_args *uap) { + struct proc *p = curproc; int error; caddr_t sg; struct sysarch_args args; @@ -588,7 +593,7 @@ linux_modify_ldt(p, uap) ldt->num = uap->bytecount / sizeof(union descriptor); args.op = I386_GET_LDT; args.parms = (char*)ldt; - error = sysarch(p, &args); + error = sysarch(&args); p->p_retval[0] *= sizeof(union descriptor); break; case 0x01: /* write_ldt */ @@ -618,7 +623,7 @@ linux_modify_ldt(p, uap) desc->sd.sd_gran = ld.limit_in_pages; args.op = I386_SET_LDT; args.parms = (char*)ldt; - error = sysarch(p, &args); + error = sysarch(&args); break; default: error = EINVAL; @@ -634,7 +639,7 @@ linux_modify_ldt(p, uap) } int -linux_sigaction(struct proc *p, struct linux_sigaction_args *args) +linux_sigaction(struct linux_sigaction_args *args) { l_osigaction_t osa; l_sigaction_t act, oact; @@ -658,7 +663,7 @@ linux_sigaction(struct proc *p, struct linux_sigaction_args *args) act.lsa_mask.__bits[0] = osa.lsa_mask; } - error = linux_do_sigaction(p, args->sig, args->nsa ? &act : NULL, + error = linux_do_sigaction(args->sig, args->nsa ? &act : NULL, args->osa ? &oact : NULL); if (args->osa != NULL && !error) { @@ -679,7 +684,7 @@ linux_sigaction(struct proc *p, struct linux_sigaction_args *args) * enables the signal to happen with a different register set. */ int -linux_sigsuspend(struct proc *p, struct linux_sigsuspend_args *args) +linux_sigsuspend(struct linux_sigsuspend_args *args) { struct sigsuspend_args bsd; sigset_t *sigmask; @@ -696,13 +701,11 @@ linux_sigsuspend(struct proc *p, struct linux_sigsuspend_args *args) mask.__bits[0] = args->mask; linux_to_bsd_sigset(&mask, sigmask); bsd.sigmask = sigmask; - return (sigsuspend(p, &bsd)); + return (sigsuspend(&bsd)); } int -linux_rt_sigsuspend(p, uap) - struct proc *p; - struct linux_rt_sigsuspend_args *uap; +linux_rt_sigsuspend(struct linux_rt_sigsuspend_args *uap) { l_sigset_t lmask; sigset_t *bmask; @@ -726,12 +729,13 @@ linux_rt_sigsuspend(p, uap) bmask = stackgap_alloc(&sg, sizeof(sigset_t)); linux_to_bsd_sigset(&lmask, bmask); bsd.sigmask = bmask; - return (sigsuspend(p, &bsd)); + return (sigsuspend(&bsd)); } int -linux_pause(struct proc *p, struct linux_pause_args *args) +linux_pause(struct linux_pause_args *args) { + struct proc *p = curproc; struct sigsuspend_args bsd; sigset_t *sigmask; caddr_t sg = stackgap_init(); @@ -744,11 +748,11 @@ linux_pause(struct proc *p, struct linux_pause_args *args) sigmask = stackgap_alloc(&sg, sizeof(sigset_t)); *sigmask = p->p_sigmask; bsd.sigmask = sigmask; - return (sigsuspend(p, &bsd)); + return (sigsuspend(&bsd)); } int -linux_sigaltstack(struct proc *p, struct linux_sigaltstack_args *uap) +linux_sigaltstack(struct linux_sigaltstack_args *uap) { struct sigaltstack_args bsd; stack_t *ss, *oss; @@ -779,7 +783,7 @@ linux_sigaltstack(struct proc *p, struct linux_sigaltstack_args *uap) bsd.ss = ss; bsd.oss = oss; - error = sigaltstack(p, &bsd); + error = sigaltstack(&bsd); if (!error && oss != NULL) { lss.ss_sp = oss->ss_sp; diff --git a/sys/emulation/linux/i386/linux_proto.h b/sys/emulation/linux/i386/linux_proto.h index 49898dc51e..773ed8c296 100644 --- a/sys/emulation/linux/i386/linux_proto.h +++ b/sys/emulation/linux/i386/linux_proto.h @@ -2,9 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_proto.h,v 1.32.2.10 2003/01/02 20:41:33 kan Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linux_proto.h,v 1.2 2003/06/17 04:28:38 dillon Exp $ - * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.30.2.7 2001/11/05 19:08:23 marcel Exp + * $DragonFly: src/sys/emulation/linux/i386/linux_proto.h,v 1.3 2003/06/23 17:55:39 dillon Exp $ + * created from TurtleBSD: src/sys/i386/linux/syscalls.master,v 1.2 2003/06/17 04:28:39 dillon Exp */ #ifndef _LINUX_SYSPROTO_H_ @@ -14,8 +13,6 @@ #include -struct proc; - #define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ 0 : sizeof(register_t) - sizeof(t)) @@ -631,159 +628,159 @@ struct linux_fcntl64_args { l_uint cmd; char cmd_[PAD_(l_uint)]; l_ulong arg; char arg_[PAD_(l_ulong)]; }; -int linux_fork __P((struct proc *, struct linux_fork_args *)); -int linux_open __P((struct proc *, struct linux_open_args *)); -int linux_waitpid __P((struct proc *, struct linux_waitpid_args *)); -int linux_creat __P((struct proc *, struct linux_creat_args *)); -int linux_link __P((struct proc *, struct linux_link_args *)); -int linux_unlink __P((struct proc *, struct linux_unlink_args *)); -int linux_execve __P((struct proc *, struct linux_execve_args *)); -int linux_chdir __P((struct proc *, struct linux_chdir_args *)); -int linux_time __P((struct proc *, struct linux_time_args *)); -int linux_mknod __P((struct proc *, struct linux_mknod_args *)); -int linux_chmod __P((struct proc *, struct linux_chmod_args *)); -int linux_lchown16 __P((struct proc *, struct linux_lchown16_args *)); -int linux_stat __P((struct proc *, struct linux_stat_args *)); -int linux_lseek __P((struct proc *, struct linux_lseek_args *)); -int linux_getpid __P((struct proc *, struct linux_getpid_args *)); -int linux_mount __P((struct proc *, struct linux_mount_args *)); -int linux_oldumount __P((struct proc *, struct linux_oldumount_args *)); -int linux_setuid16 __P((struct proc *, struct linux_setuid16_args *)); -int linux_getuid16 __P((struct proc *, struct linux_getuid16_args *)); -int linux_stime __P((struct proc *, struct linux_stime_args *)); -int linux_ptrace __P((struct proc *, struct linux_ptrace_args *)); -int linux_alarm __P((struct proc *, struct linux_alarm_args *)); -int linux_fstat __P((struct proc *, struct linux_fstat_args *)); -int linux_pause __P((struct proc *, struct linux_pause_args *)); -int linux_utime __P((struct proc *, struct linux_utime_args *)); -int linux_access __P((struct proc *, struct linux_access_args *)); -int linux_nice __P((struct proc *, struct linux_nice_args *)); -int linux_kill __P((struct proc *, struct linux_kill_args *)); -int linux_rename __P((struct proc *, struct linux_rename_args *)); -int linux_mkdir __P((struct proc *, struct linux_mkdir_args *)); -int linux_rmdir __P((struct proc *, struct linux_rmdir_args *)); -int linux_pipe __P((struct proc *, struct linux_pipe_args *)); -int linux_times __P((struct proc *, struct linux_times_args *)); -int linux_brk __P((struct proc *, struct linux_brk_args *)); -int linux_setgid16 __P((struct proc *, struct linux_setgid16_args *)); -int linux_getgid16 __P((struct proc *, struct linux_getgid16_args *)); -int linux_signal __P((struct proc *, struct linux_signal_args *)); -int linux_geteuid16 __P((struct proc *, struct linux_geteuid16_args *)); -int linux_getegid16 __P((struct proc *, struct linux_getegid16_args *)); -int linux_umount __P((struct proc *, struct linux_umount_args *)); -int linux_ioctl __P((struct proc *, struct linux_ioctl_args *)); -int linux_fcntl __P((struct proc *, struct linux_fcntl_args *)); -int linux_olduname __P((struct proc *, struct linux_olduname_args *)); -int linux_ustat __P((struct proc *, struct linux_ustat_args *)); -int linux_sigaction __P((struct proc *, struct linux_sigaction_args *)); -int linux_sgetmask __P((struct proc *, struct linux_sgetmask_args *)); -int linux_ssetmask __P((struct proc *, struct linux_ssetmask_args *)); -int linux_setreuid16 __P((struct proc *, struct linux_setreuid16_args *)); -int linux_setregid16 __P((struct proc *, struct linux_setregid16_args *)); -int linux_sigsuspend __P((struct proc *, struct linux_sigsuspend_args *)); -int linux_sigpending __P((struct proc *, struct linux_sigpending_args *)); -int linux_setrlimit __P((struct proc *, struct linux_setrlimit_args *)); -int linux_old_getrlimit __P((struct proc *, struct linux_old_getrlimit_args *)); -int linux_getgroups16 __P((struct proc *, struct linux_getgroups16_args *)); -int linux_setgroups16 __P((struct proc *, struct linux_setgroups16_args *)); -int linux_old_select __P((struct proc *, struct linux_old_select_args *)); -int linux_symlink __P((struct proc *, struct linux_symlink_args *)); -int linux_readlink __P((struct proc *, struct linux_readlink_args *)); -int linux_uselib __P((struct proc *, struct linux_uselib_args *)); -int linux_reboot __P((struct proc *, struct linux_reboot_args *)); -int linux_readdir __P((struct proc *, struct linux_readdir_args *)); -int linux_mmap __P((struct proc *, struct linux_mmap_args *)); -int linux_truncate __P((struct proc *, struct linux_truncate_args *)); -int linux_statfs __P((struct proc *, struct linux_statfs_args *)); -int linux_fstatfs __P((struct proc *, struct linux_fstatfs_args *)); -int linux_ioperm __P((struct proc *, struct linux_ioperm_args *)); -int linux_socketcall __P((struct proc *, struct linux_socketcall_args *)); -int linux_syslog __P((struct proc *, struct linux_syslog_args *)); -int linux_setitimer __P((struct proc *, struct linux_setitimer_args *)); -int linux_getitimer __P((struct proc *, struct linux_getitimer_args *)); -int linux_newstat __P((struct proc *, struct linux_newstat_args *)); -int linux_newlstat __P((struct proc *, struct linux_newlstat_args *)); -int linux_newfstat __P((struct proc *, struct linux_newfstat_args *)); -int linux_uname __P((struct proc *, struct linux_uname_args *)); -int linux_iopl __P((struct proc *, struct linux_iopl_args *)); -int linux_vhangup __P((struct proc *, struct linux_vhangup_args *)); -int linux_vm86old __P((struct proc *, struct linux_vm86old_args *)); -int linux_wait4 __P((struct proc *, struct linux_wait4_args *)); -int linux_swapoff __P((struct proc *, struct linux_swapoff_args *)); -int linux_sysinfo __P((struct proc *, struct linux_sysinfo_args *)); -int linux_ipc __P((struct proc *, struct linux_ipc_args *)); -int linux_sigreturn __P((struct proc *, struct linux_sigreturn_args *)); -int linux_clone __P((struct proc *, struct linux_clone_args *)); -int linux_newuname __P((struct proc *, struct linux_newuname_args *)); -int linux_modify_ldt __P((struct proc *, struct linux_modify_ldt_args *)); -int linux_adjtimex __P((struct proc *, struct linux_adjtimex_args *)); -int linux_sigprocmask __P((struct proc *, struct linux_sigprocmask_args *)); -int linux_create_module __P((struct proc *, struct linux_create_module_args *)); -int linux_init_module __P((struct proc *, struct linux_init_module_args *)); -int linux_delete_module __P((struct proc *, struct linux_delete_module_args *)); -int linux_get_kernel_syms __P((struct proc *, struct linux_get_kernel_syms_args *)); -int linux_quotactl __P((struct proc *, struct linux_quotactl_args *)); -int linux_bdflush __P((struct proc *, struct linux_bdflush_args *)); -int linux_sysfs __P((struct proc *, struct linux_sysfs_args *)); -int linux_personality __P((struct proc *, struct linux_personality_args *)); -int linux_setfsuid16 __P((struct proc *, struct linux_setfsuid16_args *)); -int linux_setfsgid16 __P((struct proc *, struct linux_setfsgid16_args *)); -int linux_llseek __P((struct proc *, struct linux_llseek_args *)); -int linux_getdents __P((struct proc *, struct linux_getdents_args *)); -int linux_select __P((struct proc *, struct linux_select_args *)); -int linux_msync __P((struct proc *, struct linux_msync_args *)); -int linux_getsid __P((struct proc *, struct linux_getsid_args *)); -int linux_fdatasync __P((struct proc *, struct linux_fdatasync_args *)); -int linux_sysctl __P((struct proc *, struct linux_sysctl_args *)); -int linux_sched_setscheduler __P((struct proc *, struct linux_sched_setscheduler_args *)); -int linux_sched_getscheduler __P((struct proc *, struct linux_sched_getscheduler_args *)); -int linux_sched_get_priority_max __P((struct proc *, struct linux_sched_get_priority_max_args *)); -int linux_sched_get_priority_min __P((struct proc *, struct linux_sched_get_priority_min_args *)); -int linux_mremap __P((struct proc *, struct linux_mremap_args *)); -int linux_setresuid16 __P((struct proc *, struct linux_setresuid16_args *)); -int linux_getresuid16 __P((struct proc *, struct linux_getresuid16_args *)); -int linux_vm86 __P((struct proc *, struct linux_vm86_args *)); -int linux_query_module __P((struct proc *, struct linux_query_module_args *)); -int linux_nfsservctl __P((struct proc *, struct linux_nfsservctl_args *)); -int linux_setresgid16 __P((struct proc *, struct linux_setresgid16_args *)); -int linux_getresgid16 __P((struct proc *, struct linux_getresgid16_args *)); -int linux_prctl __P((struct proc *, struct linux_prctl_args *)); -int linux_rt_sigreturn __P((struct proc *, struct linux_rt_sigreturn_args *)); -int linux_rt_sigaction __P((struct proc *, struct linux_rt_sigaction_args *)); -int linux_rt_sigprocmask __P((struct proc *, struct linux_rt_sigprocmask_args *)); -int linux_rt_sigpending __P((struct proc *, struct linux_rt_sigpending_args *)); -int linux_rt_sigtimedwait __P((struct proc *, struct linux_rt_sigtimedwait_args *)); -int linux_rt_sigqueueinfo __P((struct proc *, struct linux_rt_sigqueueinfo_args *)); -int linux_rt_sigsuspend __P((struct proc *, struct linux_rt_sigsuspend_args *)); -int linux_pread __P((struct proc *, struct linux_pread_args *)); -int linux_pwrite __P((struct proc *, struct linux_pwrite_args *)); -int linux_chown16 __P((struct proc *, struct linux_chown16_args *)); -int linux_getcwd __P((struct proc *, struct linux_getcwd_args *)); -int linux_capget __P((struct proc *, struct linux_capget_args *)); -int linux_capset __P((struct proc *, struct linux_capset_args *)); -int linux_sigaltstack __P((struct proc *, struct linux_sigaltstack_args *)); -int linux_sendfile __P((struct proc *, struct linux_sendfile_args *)); -int linux_vfork __P((struct proc *, struct linux_vfork_args *)); -int linux_getrlimit __P((struct proc *, struct linux_getrlimit_args *)); -int linux_mmap2 __P((struct proc *, struct linux_mmap2_args *)); -int linux_truncate64 __P((struct proc *, struct linux_truncate64_args *)); -int linux_ftruncate64 __P((struct proc *, struct linux_ftruncate64_args *)); -int linux_stat64 __P((struct proc *, struct linux_stat64_args *)); -int linux_lstat64 __P((struct proc *, struct linux_lstat64_args *)); -int linux_fstat64 __P((struct proc *, struct linux_fstat64_args *)); -int linux_lchown __P((struct proc *, struct linux_lchown_args *)); -int linux_getuid __P((struct proc *, struct linux_getuid_args *)); -int linux_getgid __P((struct proc *, struct linux_getgid_args *)); -int linux_getgroups __P((struct proc *, struct linux_getgroups_args *)); -int linux_setgroups __P((struct proc *, struct linux_setgroups_args *)); -int linux_chown __P((struct proc *, struct linux_chown_args *)); -int linux_setfsuid __P((struct proc *, struct linux_setfsuid_args *)); -int linux_setfsgid __P((struct proc *, struct linux_setfsgid_args *)); -int linux_pivot_root __P((struct proc *, struct linux_pivot_root_args *)); -int linux_mincore __P((struct proc *, struct linux_mincore_args *)); -int linux_madvise __P((struct proc *, struct linux_madvise_args *)); -int linux_getdents64 __P((struct proc *, struct linux_getdents64_args *)); -int linux_fcntl64 __P((struct proc *, struct linux_fcntl64_args *)); +int linux_fork __P((struct linux_fork_args *)); +int linux_open __P((struct linux_open_args *)); +int linux_waitpid __P((struct linux_waitpid_args *)); +int linux_creat __P((struct linux_creat_args *)); +int linux_link __P((struct linux_link_args *)); +int linux_unlink __P((struct linux_unlink_args *)); +int linux_execve __P((struct linux_execve_args *)); +int linux_chdir __P((struct linux_chdir_args *)); +int linux_time __P((struct linux_time_args *)); +int linux_mknod __P((struct linux_mknod_args *)); +int linux_chmod __P((struct linux_chmod_args *)); +int linux_lchown16 __P((struct linux_lchown16_args *)); +int linux_stat __P((struct linux_stat_args *)); +int linux_lseek __P((struct linux_lseek_args *)); +int linux_getpid __P((struct linux_getpid_args *)); +int linux_mount __P((struct linux_mount_args *)); +int linux_oldumount __P((struct linux_oldumount_args *)); +int linux_setuid16 __P((struct linux_setuid16_args *)); +int linux_getuid16 __P((struct linux_getuid16_args *)); +int linux_stime __P((struct linux_stime_args *)); +int linux_ptrace __P((struct linux_ptrace_args *)); +int linux_alarm __P((struct linux_alarm_args *)); +int linux_fstat __P((struct linux_fstat_args *)); +int linux_pause __P((struct linux_pause_args *)); +int linux_utime __P((struct linux_utime_args *)); +int linux_access __P((struct linux_access_args *)); +int linux_nice __P((struct linux_nice_args *)); +int linux_kill __P((struct linux_kill_args *)); +int linux_rename __P((struct linux_rename_args *)); +int linux_mkdir __P((struct linux_mkdir_args *)); +int linux_rmdir __P((struct linux_rmdir_args *)); +int linux_pipe __P((struct linux_pipe_args *)); +int linux_times __P((struct linux_times_args *)); +int linux_brk __P((struct linux_brk_args *)); +int linux_setgid16 __P((struct linux_setgid16_args *)); +int linux_getgid16 __P((struct linux_getgid16_args *)); +int linux_signal __P((struct linux_signal_args *)); +int linux_geteuid16 __P((struct linux_geteuid16_args *)); +int linux_getegid16 __P((struct linux_getegid16_args *)); +int linux_umount __P((struct linux_umount_args *)); +int linux_ioctl __P((struct linux_ioctl_args *)); +int linux_fcntl __P((struct linux_fcntl_args *)); +int linux_olduname __P((struct linux_olduname_args *)); +int linux_ustat __P((struct linux_ustat_args *)); +int linux_sigaction __P((struct linux_sigaction_args *)); +int linux_sgetmask __P((struct linux_sgetmask_args *)); +int linux_ssetmask __P((struct linux_ssetmask_args *)); +int linux_setreuid16 __P((struct linux_setreuid16_args *)); +int linux_setregid16 __P((struct linux_setregid16_args *)); +int linux_sigsuspend __P((struct linux_sigsuspend_args *)); +int linux_sigpending __P((struct linux_sigpending_args *)); +int linux_setrlimit __P((struct linux_setrlimit_args *)); +int linux_old_getrlimit __P((struct linux_old_getrlimit_args *)); +int linux_getgroups16 __P((struct linux_getgroups16_args *)); +int linux_setgroups16 __P((struct linux_setgroups16_args *)); +int linux_old_select __P((struct linux_old_select_args *)); +int linux_symlink __P((struct linux_symlink_args *)); +int linux_readlink __P((struct linux_readlink_args *)); +int linux_uselib __P((struct linux_uselib_args *)); +int linux_reboot __P((struct linux_reboot_args *)); +int linux_readdir __P((struct linux_readdir_args *)); +int linux_mmap __P((struct linux_mmap_args *)); +int linux_truncate __P((struct linux_truncate_args *)); +int linux_statfs __P((struct linux_statfs_args *)); +int linux_fstatfs __P((struct linux_fstatfs_args *)); +int linux_ioperm __P((struct linux_ioperm_args *)); +int linux_socketcall __P((struct linux_socketcall_args *)); +int linux_syslog __P((struct linux_syslog_args *)); +int linux_setitimer __P((struct linux_setitimer_args *)); +int linux_getitimer __P((struct linux_getitimer_args *)); +int linux_newstat __P((struct linux_newstat_args *)); +int linux_newlstat __P((struct linux_newlstat_args *)); +int linux_newfstat __P((struct linux_newfstat_args *)); +int linux_uname __P((struct linux_uname_args *)); +int linux_iopl __P((struct linux_iopl_args *)); +int linux_vhangup __P((struct linux_vhangup_args *)); +int linux_vm86old __P((struct linux_vm86old_args *)); +int linux_wait4 __P((struct linux_wait4_args *)); +int linux_swapoff __P((struct linux_swapoff_args *)); +int linux_sysinfo __P((struct linux_sysinfo_args *)); +int linux_ipc __P((struct linux_ipc_args *)); +int linux_sigreturn __P((struct linux_sigreturn_args *)); +int linux_clone __P((struct linux_clone_args *)); +int linux_newuname __P((struct linux_newuname_args *)); +int linux_modify_ldt __P((struct linux_modify_ldt_args *)); +int linux_adjtimex __P((struct linux_adjtimex_args *)); +int linux_sigprocmask __P((struct linux_sigprocmask_args *)); +int linux_create_module __P((struct linux_create_module_args *)); +int linux_init_module __P((struct linux_init_module_args *)); +int linux_delete_module __P((struct linux_delete_module_args *)); +int linux_get_kernel_syms __P((struct linux_get_kernel_syms_args *)); +int linux_quotactl __P((struct linux_quotactl_args *)); +int linux_bdflush __P((struct linux_bdflush_args *)); +int linux_sysfs __P((struct linux_sysfs_args *)); +int linux_personality __P((struct linux_personality_args *)); +int linux_setfsuid16 __P((struct linux_setfsuid16_args *)); +int linux_setfsgid16 __P((struct linux_setfsgid16_args *)); +int linux_llseek __P((struct linux_llseek_args *)); +int linux_getdents __P((struct linux_getdents_args *)); +int linux_select __P((struct linux_select_args *)); +int linux_msync __P((struct linux_msync_args *)); +int linux_getsid __P((struct linux_getsid_args *)); +int linux_fdatasync __P((struct linux_fdatasync_args *)); +int linux_sysctl __P((struct linux_sysctl_args *)); +int linux_sched_setscheduler __P((struct linux_sched_setscheduler_args *)); +int linux_sched_getscheduler __P((struct linux_sched_getscheduler_args *)); +int linux_sched_get_priority_max __P((struct linux_sched_get_priority_max_args *)); +int linux_sched_get_priority_min __P((struct linux_sched_get_priority_min_args *)); +int linux_mremap __P((struct linux_mremap_args *)); +int linux_setresuid16 __P((struct linux_setresuid16_args *)); +int linux_getresuid16 __P((struct linux_getresuid16_args *)); +int linux_vm86 __P((struct linux_vm86_args *)); +int linux_query_module __P((struct linux_query_module_args *)); +int linux_nfsservctl __P((struct linux_nfsservctl_args *)); +int linux_setresgid16 __P((struct linux_setresgid16_args *)); +int linux_getresgid16 __P((struct linux_getresgid16_args *)); +int linux_prctl __P((struct linux_prctl_args *)); +int linux_rt_sigreturn __P((struct linux_rt_sigreturn_args *)); +int linux_rt_sigaction __P((struct linux_rt_sigaction_args *)); +int linux_rt_sigprocmask __P((struct linux_rt_sigprocmask_args *)); +int linux_rt_sigpending __P((struct linux_rt_sigpending_args *)); +int linux_rt_sigtimedwait __P((struct linux_rt_sigtimedwait_args *)); +int linux_rt_sigqueueinfo __P((struct linux_rt_sigqueueinfo_args *)); +int linux_rt_sigsuspend __P((struct linux_rt_sigsuspend_args *)); +int linux_pread __P((struct linux_pread_args *)); +int linux_pwrite __P((struct linux_pwrite_args *)); +int linux_chown16 __P((struct linux_chown16_args *)); +int linux_getcwd __P((struct linux_getcwd_args *)); +int linux_capget __P((struct linux_capget_args *)); +int linux_capset __P((struct linux_capset_args *)); +int linux_sigaltstack __P((struct linux_sigaltstack_args *)); +int linux_sendfile __P((struct linux_sendfile_args *)); +int linux_vfork __P((struct linux_vfork_args *)); +int linux_getrlimit __P((struct linux_getrlimit_args *)); +int linux_mmap2 __P((struct linux_mmap2_args *)); +int linux_truncate64 __P((struct linux_truncate64_args *)); +int linux_ftruncate64 __P((struct linux_ftruncate64_args *)); +int linux_stat64 __P((struct linux_stat64_args *)); +int linux_lstat64 __P((struct linux_lstat64_args *)); +int linux_fstat64 __P((struct linux_fstat64_args *)); +int linux_lchown __P((struct linux_lchown_args *)); +int linux_getuid __P((struct linux_getuid_args *)); +int linux_getgid __P((struct linux_getgid_args *)); +int linux_getgroups __P((struct linux_getgroups_args *)); +int linux_setgroups __P((struct linux_setgroups_args *)); +int linux_chown __P((struct linux_chown_args *)); +int linux_setfsuid __P((struct linux_setfsuid_args *)); +int linux_setfsgid __P((struct linux_setfsgid_args *)); +int linux_pivot_root __P((struct linux_pivot_root_args *)); +int linux_mincore __P((struct linux_mincore_args *)); +int linux_madvise __P((struct linux_madvise_args *)); +int linux_getdents64 __P((struct linux_getdents64_args *)); +int linux_fcntl64 __P((struct linux_fcntl64_args *)); #ifdef COMPAT_43 diff --git a/sys/emulation/linux/i386/linux_ptrace.c b/sys/emulation/linux/i386/linux_ptrace.c index 6fafef8e74..643e80ccdc 100644 --- a/sys/emulation/linux/i386/linux_ptrace.c +++ b/sys/emulation/linux/i386/linux_ptrace.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/linux/linux_ptrace.c,v 1.7.4.3 2003/01/03 17:13:23 kan Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linux_ptrace.c,v 1.3 2003/06/18 18:30:03 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linux_ptrace.c,v 1.4 2003/06/23 17:55:39 dillon Exp $ */ #include "opt_cpu.h" @@ -246,8 +246,9 @@ linux_proc_write_fpxregs(struct proc *p, struct linux_pt_fpxreg *fpxregs) #endif int -linux_ptrace(struct proc *curp, struct linux_ptrace_args *uap) +linux_ptrace(struct linux_ptrace_args *uap) { + struct proc *curp = curproc; union { struct linux_pt_reg reg; struct linux_pt_fpreg fpreg; @@ -361,7 +362,7 @@ linux_ptrace(struct proc *curp, struct linux_ptrace_args *uap) break; } - if (!PRISON_CHECK(curp, p)) { + if (!PRISON_CHECK(curp->p_ucred, p->p_ucred)) { error = ESRCH; goto fail; } diff --git a/sys/emulation/linux/i386/linux_syscall.h b/sys/emulation/linux/i386/linux_syscall.h index a71ed24d0e..c4f1d6bdb1 100644 --- a/sys/emulation/linux/i386/linux_syscall.h +++ b/sys/emulation/linux/i386/linux_syscall.h @@ -2,9 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_syscall.h,v 1.27.2.10 2003/01/02 20:41:33 kan Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linux_syscall.h,v 1.2 2003/06/17 04:28:38 dillon Exp $ - * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.30.2.7 2001/11/05 19:08:23 marcel Exp + * $DragonFly: src/sys/emulation/linux/i386/linux_syscall.h,v 1.3 2003/06/23 17:55:39 dillon Exp $ + * created from TurtleBSD: src/sys/i386/linux/syscalls.master,v 1.2 2003/06/17 04:28:39 dillon Exp */ #define LINUX_SYS_exit 1 diff --git a/sys/emulation/linux/i386/linux_sysent.c b/sys/emulation/linux/i386/linux_sysent.c index 954d97540e..496f872596 100644 --- a/sys/emulation/linux/i386/linux_sysent.c +++ b/sys/emulation/linux/i386/linux_sysent.c @@ -2,9 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/i386/linux/linux_sysent.c,v 1.33.2.10 2003/01/02 20:41:33 kan Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linux_sysent.c,v 1.2 2003/06/17 04:28:38 dillon Exp $ - * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.30.2.7 2001/11/05 19:08:23 marcel Exp + * $DragonFly: src/sys/emulation/linux/i386/linux_sysent.c,v 1.3 2003/06/23 17:55:39 dillon Exp $ + * created from TurtleBSD: src/sys/i386/linux/syscalls.master,v 1.2 2003/06/17 04:28:39 dillon Exp */ #include "opt_compat.h" diff --git a/sys/emulation/linux/i386/linux_sysvec.c b/sys/emulation/linux/i386/linux_sysvec.c index a681da9ca1..39ce9a9082 100644 --- a/sys/emulation/linux/i386/linux_sysvec.c +++ b/sys/emulation/linux/i386/linux_sysvec.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/linux/linux_sysvec.c,v 1.55.2.9 2002/01/12 11:03:30 bde Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linux_sysvec.c,v 1.2 2003/06/17 04:28:38 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linux_sysvec.c,v 1.3 2003/06/23 17:55:39 dillon Exp $ */ /* XXX we use functions that might not exist. */ @@ -228,10 +228,10 @@ elf_linux_fixup(register_t **stack_base, struct image_params *imgp) AUXARGS_ENTRY(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY(pos, AT_ENTRY, args->entry); AUXARGS_ENTRY(pos, AT_BASE, args->base); - AUXARGS_ENTRY(pos, AT_UID, imgp->proc->p_cred->p_ruid); - AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_cred->p_svuid); - AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_cred->p_rgid); - AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_cred->p_svgid); + AUXARGS_ENTRY(pos, AT_UID, imgp->proc->p_ucred->cr_ruid); + AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); + AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); + AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); AUXARGS_ENTRY(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); @@ -248,8 +248,8 @@ extern unsigned long linux_sznonrtsigcode; static void linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) { - register struct proc *p = curproc; - register struct trapframe *regs; + struct proc *p = curproc; + struct trapframe *regs; struct l_rt_sigframe *fp, frame; int oonstack; @@ -392,8 +392,8 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) static void linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) { - register struct proc *p = curproc; - register struct trapframe *regs; + struct proc *p = curproc; + struct trapframe *regs; struct l_sigframe *fp, frame; l_sigset_t lmask; int oonstack, i; @@ -517,10 +517,9 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) * a machine fault. */ int -linux_sigreturn(p, args) - struct proc *p; - struct linux_sigreturn_args *args; +linux_sigreturn(struct linux_sigreturn_args *args) { + struct proc *p = curproc; struct l_sigframe frame; register struct trapframe *regs; l_sigset_t lmask; @@ -611,10 +610,9 @@ linux_sigreturn(p, args) * a machine fault. */ int -linux_rt_sigreturn(p, args) - struct proc *p; - struct linux_rt_sigreturn_args *args; +linux_rt_sigreturn(struct linux_rt_sigreturn_args *args) { + struct proc *p = curproc; struct sigaltstack_args sasargs; struct l_ucontext uc; struct l_sigcontext *context; @@ -710,7 +708,7 @@ linux_rt_sigreturn(p, args) #endif sasargs.ss = ss; sasargs.oss = NULL; - (void) sigaltstack(p, &sasargs); + (void) sigaltstack(&sasargs); return (EJUSTRETURN); } diff --git a/sys/emulation/linux/linux_file.c b/sys/emulation/linux/linux_file.c index 440be3471b..2f29d7db17 100644 --- a/sys/emulation/linux/linux_file.c +++ b/sys/emulation/linux/linux_file.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_file.c,v 1.41.2.6 2003/01/06 09:19:43 fjoe Exp $ - * $DragonFly: src/sys/emulation/linux/linux_file.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_file.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ #include "opt_compat.h" @@ -55,7 +55,7 @@ #ifndef __alpha__ int -linux_creat(struct proc *p, struct linux_creat_args *args) +linux_creat(struct linux_creat_args *args) { struct open_args /* { char *path; @@ -65,7 +65,7 @@ linux_creat(struct proc *p, struct linux_creat_args *args) caddr_t sg; sg = stackgap_init(); - CHECKALTCREAT(p, &sg, args->path); + CHECKALTCREAT(&sg, args->path); #ifdef DEBUG if (ldebug(creat)) @@ -74,12 +74,12 @@ linux_creat(struct proc *p, struct linux_creat_args *args) bsd_open_args.path = args->path; bsd_open_args.mode = args->mode; bsd_open_args.flags = O_WRONLY | O_CREAT | O_TRUNC; - return open(p, &bsd_open_args); + return open(&bsd_open_args); } #endif /*!__alpha__*/ int -linux_open(struct proc *p, struct linux_open_args *args) +linux_open(struct linux_open_args *args) { struct open_args /* { char *path; @@ -88,13 +88,14 @@ linux_open(struct proc *p, struct linux_open_args *args) } */ bsd_open_args; int error; caddr_t sg; + struct proc *p; sg = stackgap_init(); if (args->flags & LINUX_O_CREAT) - CHECKALTCREAT(p, &sg, args->path); + CHECKALTCREAT(&sg, args->path); else - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(open)) @@ -129,7 +130,8 @@ linux_open(struct proc *p, struct linux_open_args *args) bsd_open_args.path = args->path; bsd_open_args.mode = args->mode; - error = open(p, &bsd_open_args); + error = open(&bsd_open_args); + p = curproc; if (!error && !(bsd_open_args.flags & O_NOCTTY) && SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) { struct filedesc *fdp = p->p_fd; @@ -146,7 +148,7 @@ linux_open(struct proc *p, struct linux_open_args *args) } int -linux_lseek(struct proc *p, struct linux_lseek_args *args) +linux_lseek(struct linux_lseek_args *args) { struct lseek_args /* { @@ -165,14 +167,15 @@ linux_lseek(struct proc *p, struct linux_lseek_args *args) tmp_args.fd = args->fdes; tmp_args.offset = (off_t)args->off; tmp_args.whence = args->whence; - error = lseek(p, &tmp_args); + error = lseek(&tmp_args); return error; } #ifndef __alpha__ int -linux_llseek(struct proc *p, struct linux_llseek_args *args) +linux_llseek(struct linux_llseek_args *args) { + struct proc *p = curproc; struct lseek_args bsd_args; int error; off_t off; @@ -188,7 +191,7 @@ linux_llseek(struct proc *p, struct linux_llseek_args *args) bsd_args.offset = off; bsd_args.whence = args->whence; - if ((error = lseek(p, &bsd_args))) + if ((error = lseek(&bsd_args))) return error; if ((error = copyout(p->p_retval, (caddr_t)args->res, sizeof (off_t)))) @@ -201,14 +204,14 @@ linux_llseek(struct proc *p, struct linux_llseek_args *args) #ifndef __alpha__ int -linux_readdir(struct proc *p, struct linux_readdir_args *args) +linux_readdir(struct linux_readdir_args *args) { struct linux_getdents_args lda; lda.fd = args->fd; lda.dent = args->dent; lda.count = 1; - return linux_getdents(p, &lda); + return linux_getdents(&lda); } #endif /*!__alpha__*/ @@ -242,10 +245,10 @@ struct l_dirent64 { #define LINUX_DIRBLKSIZ 512 static int -getdents_common(struct proc *p, struct linux_getdents64_args *args, - int is64bit) +getdents_common(struct linux_getdents64_args *args, int is64bit) { - register struct dirent *bdp; + struct proc *p = curproc; + struct dirent *bdp; struct vnode *vp; caddr_t inp, buf; /* BSD-format */ int len, reclen; /* BSD-format */ @@ -435,27 +438,23 @@ out: } int -linux_getdents(struct proc *p, struct linux_getdents_args *args) +linux_getdents(struct linux_getdents_args *args) { - #ifdef DEBUG if (ldebug(getdents)) printf(ARGS(getdents, "%d, *, %d"), args->fd, args->count); #endif - - return (getdents_common(p, (struct linux_getdents64_args*)args, 0)); + return (getdents_common((struct linux_getdents64_args*)args, 0)); } int -linux_getdents64(struct proc *p, struct linux_getdents64_args *args) +linux_getdents64(struct linux_getdents64_args *args) { - #ifdef DEBUG if (ldebug(getdents64)) printf(ARGS(getdents64, "%d, *, %d"), args->fd, args->count); #endif - - return (getdents_common(p, args, 1)); + return (getdents_common(args, 1)); } /* @@ -463,13 +462,13 @@ linux_getdents64(struct proc *p, struct linux_getdents64_args *args) */ int -linux_access(struct proc *p, struct linux_access_args *args) +linux_access(struct linux_access_args *args) { struct access_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(access)) @@ -478,17 +477,17 @@ linux_access(struct proc *p, struct linux_access_args *args) bsd.path = args->path; bsd.flags = args->flags; - return access(p, &bsd); + return access(&bsd); } int -linux_unlink(struct proc *p, struct linux_unlink_args *args) +linux_unlink(struct linux_unlink_args *args) { struct unlink_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(unlink)) @@ -496,17 +495,17 @@ linux_unlink(struct proc *p, struct linux_unlink_args *args) #endif bsd.path = args->path; - return unlink(p, &bsd); + return unlink(&bsd); } int -linux_chdir(struct proc *p, struct linux_chdir_args *args) +linux_chdir(struct linux_chdir_args *args) { struct chdir_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(chdir)) @@ -514,17 +513,17 @@ linux_chdir(struct proc *p, struct linux_chdir_args *args) #endif bsd.path = args->path; - return chdir(p, &bsd); + return chdir(&bsd); } int -linux_chmod(struct proc *p, struct linux_chmod_args *args) +linux_chmod(struct linux_chmod_args *args) { struct chmod_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(chmod)) @@ -533,17 +532,17 @@ linux_chmod(struct proc *p, struct linux_chmod_args *args) bsd.path = args->path; bsd.mode = args->mode; - return chmod(p, &bsd); + return chmod(&bsd); } int -linux_mkdir(struct proc *p, struct linux_mkdir_args *args) +linux_mkdir(struct linux_mkdir_args *args) { struct mkdir_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTCREAT(p, &sg, args->path); + CHECKALTCREAT(&sg, args->path); #ifdef DEBUG if (ldebug(mkdir)) @@ -552,17 +551,17 @@ linux_mkdir(struct proc *p, struct linux_mkdir_args *args) bsd.path = args->path; bsd.mode = args->mode; - return mkdir(p, &bsd); + return mkdir(&bsd); } int -linux_rmdir(struct proc *p, struct linux_rmdir_args *args) +linux_rmdir(struct linux_rmdir_args *args) { struct rmdir_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(rmdir)) @@ -570,18 +569,18 @@ linux_rmdir(struct proc *p, struct linux_rmdir_args *args) #endif bsd.path = args->path; - return rmdir(p, &bsd); + return rmdir(&bsd); } int -linux_rename(struct proc *p, struct linux_rename_args *args) +linux_rename(struct linux_rename_args *args) { struct rename_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->from); - CHECKALTCREAT(p, &sg, args->to); + CHECKALTEXIST(&sg, args->from); + CHECKALTCREAT(&sg, args->to); #ifdef DEBUG if (ldebug(rename)) @@ -590,18 +589,18 @@ linux_rename(struct proc *p, struct linux_rename_args *args) bsd.from = args->from; bsd.to = args->to; - return rename(p, &bsd); + return rename(&bsd); } int -linux_symlink(struct proc *p, struct linux_symlink_args *args) +linux_symlink(struct linux_symlink_args *args) { struct symlink_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); - CHECKALTCREAT(p, &sg, args->to); + CHECKALTEXIST(&sg, args->path); + CHECKALTCREAT(&sg, args->to); #ifdef DEBUG if (ldebug(symlink)) @@ -610,17 +609,17 @@ linux_symlink(struct proc *p, struct linux_symlink_args *args) bsd.path = args->path; bsd.link = args->to; - return symlink(p, &bsd); + return symlink(&bsd); } int -linux_readlink(struct proc *p, struct linux_readlink_args *args) +linux_readlink(struct linux_readlink_args *args) { struct readlink_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->name); + CHECKALTEXIST(&sg, args->name); #ifdef DEBUG if (ldebug(readlink)) @@ -631,17 +630,17 @@ linux_readlink(struct proc *p, struct linux_readlink_args *args) bsd.buf = args->buf; bsd.count = args->count; - return readlink(p, &bsd); + return readlink(&bsd); } int -linux_truncate(struct proc *p, struct linux_truncate_args *args) +linux_truncate(struct linux_truncate_args *args) { struct truncate_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(truncate)) @@ -651,18 +650,18 @@ linux_truncate(struct proc *p, struct linux_truncate_args *args) bsd.path = args->path; bsd.length = args->length; - return truncate(p, &bsd); + return truncate(&bsd); } int -linux_link(struct proc *p, struct linux_link_args *args) +linux_link(struct linux_link_args *args) { struct link_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); - CHECKALTCREAT(p, &sg, args->to); + CHECKALTEXIST(&sg, args->path); + CHECKALTCREAT(&sg, args->to); #ifdef DEBUG if (ldebug(link)) @@ -672,26 +671,22 @@ linux_link(struct proc *p, struct linux_link_args *args) bsd.path = args->path; bsd.link = args->to; - return link(p, &bsd); + return link(&bsd); } #ifndef __alpha__ int -linux_fdatasync(p, uap) - struct proc *p; - struct linux_fdatasync_args *uap; +linux_fdatasync(struct linux_fdatasync_args *uap) { struct fsync_args bsd; bsd.fd = uap->fd; - return fsync(p, &bsd); + return fsync(&bsd); } #endif /*!__alpha__*/ int -linux_pread(p, uap) - struct proc *p; - struct linux_pread_args *uap; +linux_pread(struct linux_pread_args *uap) { struct pread_args bsd; @@ -699,13 +694,11 @@ linux_pread(p, uap) bsd.buf = uap->buf; bsd.nbyte = uap->nbyte; bsd.offset = uap->offset; - return pread(p, &bsd); + return pread(&bsd); } int -linux_pwrite(p, uap) - struct proc *p; - struct linux_pwrite_args *uap; +linux_pwrite(struct linux_pwrite_args *uap) { struct pwrite_args bsd; @@ -713,27 +706,27 @@ linux_pwrite(p, uap) bsd.buf = uap->buf; bsd.nbyte = uap->nbyte; bsd.offset = uap->offset; - return pwrite(p, &bsd); + return pwrite(&bsd); } int -linux_oldumount(struct proc *p, struct linux_oldumount_args *args) +linux_oldumount(struct linux_oldumount_args *args) { struct linux_umount_args args2; args2.path = args->path; args2.flags = 0; - return (linux_umount(p, &args2)); + return (linux_umount(&args2)); } int -linux_umount(struct proc *p, struct linux_umount_args *args) +linux_umount(struct linux_umount_args *args) { struct unmount_args bsd; bsd.path = args->path; bsd.flags = args->flags; /* XXX correct? */ - return (unmount(p, &bsd)); + return (unmount(&bsd)); } /* @@ -849,8 +842,9 @@ bsd_to_linux_flock64(struct flock *bsd_flock, struct l_flock64 *linux_flock) #endif static int -fcntl_common(struct proc *p, struct linux_fcntl64_args *args) +fcntl_common(struct linux_fcntl64_args *args) { + struct proc *p = curproc; struct l_flock linux_flock; struct flock *bsd_flock; struct fcntl_args fcntl_args; @@ -868,20 +862,20 @@ fcntl_common(struct proc *p, struct linux_fcntl64_args *args) case LINUX_F_DUPFD: fcntl_args.cmd = F_DUPFD; fcntl_args.arg = args->arg; - return (fcntl(p, &fcntl_args)); + return (fcntl(&fcntl_args)); case LINUX_F_GETFD: fcntl_args.cmd = F_GETFD; - return (fcntl(p, &fcntl_args)); + return (fcntl(&fcntl_args)); case LINUX_F_SETFD: fcntl_args.cmd = F_SETFD; fcntl_args.arg = args->arg; - return (fcntl(p, &fcntl_args)); + return (fcntl(&fcntl_args)); case LINUX_F_GETFL: fcntl_args.cmd = F_GETFL; - error = fcntl(p, &fcntl_args); + error = fcntl(&fcntl_args); result = p->p_retval[0]; p->p_retval[0] = 0; if (result & O_RDONLY) @@ -911,7 +905,7 @@ fcntl_common(struct proc *p, struct linux_fcntl64_args *args) if (args->arg & LINUX_FASYNC) fcntl_args.arg |= O_ASYNC; fcntl_args.cmd = F_SETFL; - return (fcntl(p, &fcntl_args)); + return (fcntl(&fcntl_args)); case LINUX_F_GETLK: error = copyin((caddr_t)args->arg, &linux_flock, @@ -922,7 +916,7 @@ fcntl_common(struct proc *p, struct linux_fcntl64_args *args) fcntl_args.fd = args->fd; fcntl_args.cmd = F_GETLK; fcntl_args.arg = (long)bsd_flock; - error = fcntl(p, &fcntl_args); + error = fcntl(&fcntl_args); if (error) return (error); bsd_to_linux_flock(bsd_flock, &linux_flock); @@ -938,7 +932,7 @@ fcntl_common(struct proc *p, struct linux_fcntl64_args *args) fcntl_args.fd = args->fd; fcntl_args.cmd = F_SETLK; fcntl_args.arg = (long)bsd_flock; - return (fcntl(p, &fcntl_args)); + return (fcntl(&fcntl_args)); case LINUX_F_SETLKW: error = copyin((caddr_t)args->arg, &linux_flock, @@ -949,11 +943,11 @@ fcntl_common(struct proc *p, struct linux_fcntl64_args *args) fcntl_args.fd = args->fd; fcntl_args.cmd = F_SETLKW; fcntl_args.arg = (long)bsd_flock; - return (fcntl(p, &fcntl_args)); + return (fcntl(&fcntl_args)); case LINUX_F_GETOWN: fcntl_args.cmd = F_GETOWN; - return (fcntl(p, &fcntl_args)); + return (fcntl(&fcntl_args)); case LINUX_F_SETOWN: /* @@ -970,14 +964,14 @@ fcntl_common(struct proc *p, struct linux_fcntl64_args *args) fcntl_args.cmd = F_SETOWN; fcntl_args.arg = args->arg; - return (fcntl(p, &fcntl_args)); + return (fcntl(&fcntl_args)); } return (EINVAL); } int -linux_fcntl(struct proc *p, struct linux_fcntl_args *args) +linux_fcntl(struct linux_fcntl_args *args) { struct linux_fcntl64_args args64; @@ -989,12 +983,12 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args) args64.fd = args->fd; args64.cmd = args->cmd; args64.arg = args->arg; - return (fcntl_common(p, &args64)); + return (fcntl_common(&args64)); } #if defined(__i386__) int -linux_fcntl64(struct proc *p, struct linux_fcntl64_args *args) +linux_fcntl64(struct linux_fcntl64_args *args) { struct fcntl_args fcntl_args; struct l_flock64 linux_flock; @@ -1020,7 +1014,7 @@ linux_fcntl64(struct proc *p, struct linux_fcntl64_args *args) fcntl_args.fd = args->fd; fcntl_args.cmd = F_GETLK; fcntl_args.arg = (long)bsd_flock; - error = fcntl(p, &fcntl_args); + error = fcntl(&fcntl_args); if (error) return (error); bsd_to_linux_flock64(bsd_flock, &linux_flock); @@ -1036,7 +1030,7 @@ linux_fcntl64(struct proc *p, struct linux_fcntl64_args *args) fcntl_args.fd = args->fd; fcntl_args.cmd = F_SETLK; fcntl_args.arg = (long)bsd_flock; - return (fcntl(p, &fcntl_args)); + return (fcntl(&fcntl_args)); case LINUX_F_SETLKW64: error = copyin((caddr_t)args->arg, &linux_flock, @@ -1047,21 +1041,21 @@ linux_fcntl64(struct proc *p, struct linux_fcntl64_args *args) fcntl_args.fd = args->fd; fcntl_args.cmd = F_SETLKW; fcntl_args.arg = (long)bsd_flock; - return (fcntl(p, &fcntl_args)); + return (fcntl(&fcntl_args)); } - return (fcntl_common(p, args)); + return (fcntl_common(args)); } #endif /* __i386__ */ int -linux_chown(struct proc *p, struct linux_chown_args *args) +linux_chown(struct linux_chown_args *args) { struct chown_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(chown)) @@ -1072,17 +1066,17 @@ linux_chown(struct proc *p, struct linux_chown_args *args) bsd.path = args->path; bsd.uid = args->uid; bsd.gid = args->gid; - return (chown(p, &bsd)); + return (chown(&bsd)); } int -linux_lchown(struct proc *p, struct linux_lchown_args *args) +linux_lchown(struct linux_lchown_args *args) { struct lchown_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(lchown)) @@ -1093,5 +1087,5 @@ linux_lchown(struct proc *p, struct linux_lchown_args *args) bsd.path = args->path; bsd.uid = args->uid; bsd.gid = args->gid; - return (lchown(p, &bsd)); + return (lchown(&bsd)); } diff --git a/sys/emulation/linux/linux_getcwd.c b/sys/emulation/linux/linux_getcwd.c index f22414f414..eb96346f59 100644 --- a/sys/emulation/linux/linux_getcwd.c +++ b/sys/emulation/linux/linux_getcwd.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/compat/linux/linux_getcwd.c,v 1.2.2.3 2001/11/05 19:08:22 marcel Exp $ */ -/* $DragonFly: src/sys/emulation/linux/linux_getcwd.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ */ +/* $DragonFly: src/sys/emulation/linux/linux_getcwd.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ /* $OpenBSD: linux_getcwd.c,v 1.2 2001/05/16 12:50:21 ho Exp $ */ /* $NetBSD: vfs_getcwd.c,v 1.3.2.3 1999/07/11 10:24:09 sommerfeld Exp $ */ @@ -406,8 +406,9 @@ out: */ int -linux_getcwd(struct proc *p, struct linux_getcwd_args *args) +linux_getcwd(struct linux_getcwd_args *args) { + struct proc *p = curproc; struct __getcwd_args bsd; caddr_t sg, bp, bend, path; int error, len, lenused; @@ -420,7 +421,7 @@ linux_getcwd(struct proc *p, struct linux_getcwd_args *args) sg = stackgap_init(); bsd.buf = stackgap_alloc(&sg, SPARE_USRSPACE); bsd.buflen = SPARE_USRSPACE; - error = __getcwd(p, &bsd); + error = __getcwd(&bsd); if (!error) { lenused = strlen(bsd.buf) + 1; if (lenused <= args->bufsize) { diff --git a/sys/emulation/linux/linux_ioctl.c b/sys/emulation/linux/linux_ioctl.c index 75b2fc8d2a..82e6b41711 100644 --- a/sys/emulation/linux/linux_ioctl.c +++ b/sys/emulation/linux/linux_ioctl.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.55.2.11 2003/05/01 20:16:09 anholt Exp $ - * $DragonFly: src/sys/emulation/linux/linux_ioctl.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_ioctl.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ #include @@ -636,7 +636,7 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args) wr.fd = args->fd; wr.buf = &c; wr.nbyte = sizeof(c); - return (write(p, &wr)); + return (write(&wr)); } else return (0); } @@ -644,7 +644,7 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args) return (EINVAL); } args->arg = 0; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); } case LINUX_TCFLSH: { @@ -662,66 +662,66 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args) default: return (EINVAL); } - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); } case LINUX_TIOCEXCL: args->cmd = TIOCEXCL; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_TIOCNXCL: args->cmd = TIOCNXCL; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); /* LINUX_TIOCSCTTY */ case LINUX_TIOCGPGRP: args->cmd = TIOCGPGRP; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_TIOCSPGRP: args->cmd = TIOCSPGRP; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); /* LINUX_TIOCOUTQ */ /* LINUX_TIOCSTI */ case LINUX_TIOCGWINSZ: args->cmd = TIOCGWINSZ; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_TIOCSWINSZ: args->cmd = TIOCSWINSZ; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_TIOCMGET: args->cmd = TIOCMGET; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_TIOCMBIS: args->cmd = TIOCMBIS; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_TIOCMBIC: args->cmd = TIOCMBIC; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_TIOCMSET: args->cmd = TIOCMSET; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); /* TIOCGSOFTCAR */ /* TIOCSSOFTCAR */ case LINUX_FIONREAD: /* LINUX_TIOCINQ */ args->cmd = FIONREAD; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); /* LINUX_TIOCLINUX */ case LINUX_TIOCCONS: args->cmd = TIOCCONS; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_TIOCGSERIAL: { struct linux_serial_struct lss; @@ -746,11 +746,11 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args) case LINUX_FIONBIO: args->cmd = FIONBIO; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_TIOCNOTTY: args->cmd = TIOCNOTTY; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_TIOCSETD: { int line; @@ -797,15 +797,15 @@ linux_ioctl_termio(struct proc *p, struct linux_ioctl_args *args) case LINUX_FIONCLEX: args->cmd = FIONCLEX; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_FIOCLEX: args->cmd = FIOCLEX; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_FIOASYNC: args->cmd = FIOASYNC; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); /* LINUX_TIOCSERCONFIG */ /* LINUX_TIOCSERGWILD */ @@ -905,19 +905,19 @@ linux_ioctl_cdrom(struct proc *p, struct linux_ioctl_args *args) case LINUX_CDROMPAUSE: args->cmd = CDIOCPAUSE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_CDROMRESUME: args->cmd = CDIOCRESUME; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_CDROMPLAYMSF: args->cmd = CDIOCPLAYMSF; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_CDROMPLAYTRKIND: args->cmd = CDIOCPLAYTRACKS; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_CDROMREADTOCHDR: { struct ioc_toc_header th; @@ -951,15 +951,15 @@ linux_ioctl_cdrom(struct proc *p, struct linux_ioctl_args *args) case LINUX_CDROMSTOP: args->cmd = CDIOCSTOP; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_CDROMSTART: args->cmd = CDIOCSTART; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_CDROMEJECT: args->cmd = CDIOCEJECT; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); /* LINUX_CDROMVOLCTRL */ @@ -1005,7 +1005,7 @@ linux_ioctl_cdrom(struct proc *p, struct linux_ioctl_args *args) case LINUX_CDROMRESET: args->cmd = CDIOCRESET; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); /* LINUX_CDROMVOLREAD */ /* LINUX_CDROMREADRAW */ @@ -1037,71 +1037,71 @@ linux_ioctl_sound(struct proc *p, struct linux_ioctl_args *args) case LINUX_SOUND_MIXER_WRITE_VOLUME: args->cmd = SETDIR(SOUND_MIXER_WRITE_VOLUME); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_BASS: args->cmd = SETDIR(SOUND_MIXER_WRITE_BASS); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_TREBLE: args->cmd = SETDIR(SOUND_MIXER_WRITE_TREBLE); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_SYNTH: args->cmd = SETDIR(SOUND_MIXER_WRITE_SYNTH); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_PCM: args->cmd = SETDIR(SOUND_MIXER_WRITE_PCM); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_SPEAKER: args->cmd = SETDIR(SOUND_MIXER_WRITE_SPEAKER); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_LINE: args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_MIC: args->cmd = SETDIR(SOUND_MIXER_WRITE_MIC); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_CD: args->cmd = SETDIR(SOUND_MIXER_WRITE_CD); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_IMIX: args->cmd = SETDIR(SOUND_MIXER_WRITE_IMIX); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_ALTPCM: args->cmd = SETDIR(SOUND_MIXER_WRITE_ALTPCM); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_RECLEV: args->cmd = SETDIR(SOUND_MIXER_WRITE_RECLEV); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_IGAIN: args->cmd = SETDIR(SOUND_MIXER_WRITE_IGAIN); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_OGAIN: args->cmd = SETDIR(SOUND_MIXER_WRITE_OGAIN); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_LINE1: args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE1); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_LINE2: args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE2); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_MIXER_WRITE_LINE3: args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE3); - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_OSS_GETVERSION: { int version = linux_get_oss_version(p); @@ -1110,147 +1110,147 @@ linux_ioctl_sound(struct proc *p, struct linux_ioctl_args *args) case LINUX_SOUND_MIXER_READ_DEVMASK: args->cmd = SOUND_MIXER_READ_DEVMASK; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_RESET: args->cmd = SNDCTL_DSP_RESET; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_SYNC: args->cmd = SNDCTL_DSP_SYNC; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_SPEED: args->cmd = SNDCTL_DSP_SPEED; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_STEREO: args->cmd = SNDCTL_DSP_STEREO; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_GETBLKSIZE: /* LINUX_SNDCTL_DSP_SETBLKSIZE */ args->cmd = SNDCTL_DSP_GETBLKSIZE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_SETFMT: args->cmd = SNDCTL_DSP_SETFMT; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_PCM_WRITE_CHANNELS: args->cmd = SOUND_PCM_WRITE_CHANNELS; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SOUND_PCM_WRITE_FILTER: args->cmd = SOUND_PCM_WRITE_FILTER; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_POST: args->cmd = SNDCTL_DSP_POST; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_SUBDIVIDE: args->cmd = SNDCTL_DSP_SUBDIVIDE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_SETFRAGMENT: args->cmd = SNDCTL_DSP_SETFRAGMENT; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_GETFMTS: args->cmd = SNDCTL_DSP_GETFMTS; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_GETOSPACE: args->cmd = SNDCTL_DSP_GETOSPACE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_GETISPACE: args->cmd = SNDCTL_DSP_GETISPACE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_NONBLOCK: args->cmd = SNDCTL_DSP_NONBLOCK; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_GETCAPS: args->cmd = SNDCTL_DSP_GETCAPS; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_SETTRIGGER: /* LINUX_SNDCTL_GETTRIGGER */ args->cmd = SNDCTL_DSP_SETTRIGGER; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_GETIPTR: args->cmd = SNDCTL_DSP_GETIPTR; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_GETOPTR: args->cmd = SNDCTL_DSP_GETOPTR; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_DSP_GETODELAY: args->cmd = SNDCTL_DSP_GETODELAY; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SEQ_RESET: args->cmd = SNDCTL_SEQ_RESET; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SEQ_SYNC: args->cmd = SNDCTL_SEQ_SYNC; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SYNTH_INFO: args->cmd = SNDCTL_SYNTH_INFO; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SEQ_CTRLRATE: args->cmd = SNDCTL_SEQ_CTRLRATE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SEQ_GETOUTCOUNT: args->cmd = SNDCTL_SEQ_GETOUTCOUNT; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SEQ_GETINCOUNT: args->cmd = SNDCTL_SEQ_GETINCOUNT; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SEQ_PERCMODE: args->cmd = SNDCTL_SEQ_PERCMODE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_FM_LOAD_INSTR: args->cmd = SNDCTL_FM_LOAD_INSTR; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SEQ_TESTMIDI: args->cmd = SNDCTL_SEQ_TESTMIDI; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SEQ_RESETSAMPLES: args->cmd = SNDCTL_SEQ_RESETSAMPLES; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SEQ_NRSYNTHS: args->cmd = SNDCTL_SEQ_NRSYNTHS; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SEQ_NRMIDIS: args->cmd = SNDCTL_SEQ_NRMIDIS; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_MIDI_INFO: args->cmd = SNDCTL_MIDI_INFO; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SEQ_TRESHOLD: args->cmd = SNDCTL_SEQ_TRESHOLD; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_SNDCTL_SYNTH_MEMAVL: args->cmd = SNDCTL_SYNTH_MEMAVL; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); } @@ -1272,31 +1272,31 @@ linux_ioctl_console(struct proc *p, struct linux_ioctl_args *args) case LINUX_KIOCSOUND: args->cmd = KIOCSOUND; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_KDMKTONE: args->cmd = KDMKTONE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_KDGETLED: args->cmd = KDGETLED; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_KDSETLED: args->cmd = KDSETLED; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_KDSETMODE: args->cmd = KDSETMODE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_KDGETMODE: args->cmd = KDGETMODE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_KDGKBMODE: args->cmd = KDGKBMODE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_KDSKBMODE: { int kbdmode; @@ -1318,11 +1318,11 @@ linux_ioctl_console(struct proc *p, struct linux_ioctl_args *args) case LINUX_VT_OPENQRY: args->cmd = VT_OPENQRY; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_VT_GETMODE: args->cmd = VT_GETMODE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_VT_SETMODE: { struct vt_mode *mode; @@ -1330,24 +1330,24 @@ linux_ioctl_console(struct proc *p, struct linux_ioctl_args *args) mode = (struct vt_mode *)args->arg; if (!ISSIGVALID(mode->frsig) && ISSIGVALID(mode->acqsig)) mode->frsig = mode->acqsig; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); } case LINUX_VT_GETSTATE: args->cmd = VT_GETACTIVE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_VT_RELDISP: args->cmd = VT_RELDISP; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_VT_ACTIVATE: args->cmd = VT_ACTIVATE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); case LINUX_VT_WAITACTIVE: args->cmd = VT_WAITACTIVE; - return (ioctl(p, (struct ioctl_args *)args)); + return (ioctl((struct ioctl_args *)args)); } @@ -1651,27 +1651,27 @@ linux_ioctl_socket(struct proc *p, struct linux_ioctl_args *args) case LINUX_FIOSETOWN: args->cmd = FIOSETOWN; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCSPGRP: args->cmd = SIOCSPGRP; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_FIOGETOWN: args->cmd = FIOGETOWN; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCGPGRP: args->cmd = SIOCGPGRP; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCATMARK: args->cmd = SIOCATMARK; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; /* LINUX_SIOCGSTAMP */ @@ -1687,28 +1687,28 @@ linux_ioctl_socket(struct proc *p, struct linux_ioctl_args *args) case LINUX_SIOCGIFADDR: args->cmd = OSIOCGIFADDR; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCSIFADDR: /* XXX probably doesn't work, included for completeness */ args->cmd = SIOCSIFADDR; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCGIFDSTADDR: args->cmd = OSIOCGIFDSTADDR; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCGIFBRDADDR: args->cmd = OSIOCGIFBRDADDR; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCGIFNETMASK: args->cmd = OSIOCGIFNETMASK; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCSIFNETMASK: @@ -1717,12 +1717,12 @@ linux_ioctl_socket(struct proc *p, struct linux_ioctl_args *args) case LINUX_SIOCGIFMTU: args->cmd = SIOCGIFMTU; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCSIFMTU: args->cmd = SIOCSIFMTU; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCSIFNAME: @@ -1739,12 +1739,12 @@ linux_ioctl_socket(struct proc *p, struct linux_ioctl_args *args) case LINUX_SIOCADDMULTI: args->cmd = SIOCADDMULTI; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCDELMULTI: args->cmd = SIOCDELMULTI; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; /* @@ -1753,12 +1753,12 @@ linux_ioctl_socket(struct proc *p, struct linux_ioctl_args *args) */ case LINUX_SIOCDEVPRIVATE: args->cmd = SIOCGPRIVATE_0; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCDEVPRIVATE+1: args->cmd = SIOCGPRIVATE_1; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; } @@ -1801,7 +1801,7 @@ static int linux_ioctl_drm(struct proc *p, struct linux_ioctl_args *args) { args->cmd = SETDIR(args->cmd); - return ioctl(p, (struct ioctl_args *)args); + return ioctl((struct ioctl_args *)args); } /* @@ -1815,15 +1815,15 @@ linux_ioctl_special(struct proc *p, struct linux_ioctl_args *args) switch (args->cmd) { case LINUX_SIOCGIFADDR: args->cmd = SIOCGIFADDR; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCSIFADDR: args->cmd = SIOCSIFADDR; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; case LINUX_SIOCGIFFLAGS: args->cmd = SIOCGIFFLAGS; - error = ioctl(p, (struct ioctl_args *)args); + error = ioctl((struct ioctl_args *)args); break; default: error = ENOIOCTL; @@ -1837,8 +1837,9 @@ linux_ioctl_special(struct proc *p, struct linux_ioctl_args *args) */ int -linux_ioctl(struct proc *p, struct linux_ioctl_args *args) +linux_ioctl(struct linux_ioctl_args *args) { + struct proc *p = curproc; struct filedesc *fdp; struct file *fp; struct handler_element *he; diff --git a/sys/emulation/linux/linux_ipc.c b/sys/emulation/linux/linux_ipc.c index f4d7bd94c3..d92d920303 100644 --- a/sys/emulation/linux/linux_ipc.c +++ b/sys/emulation/linux/linux_ipc.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_ipc.c,v 1.17.2.3 2001/11/05 19:08:22 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_ipc.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_ipc.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ #include @@ -180,7 +180,7 @@ bsd_to_linux_shmid_ds(struct shmid_ds *bsp, struct l_shmid_ds *lsp) } int -linux_semop(struct proc *p, struct linux_semop_args *args) +linux_semop(struct linux_semop_args *args) { struct semop_args /* { int semid; @@ -191,11 +191,11 @@ linux_semop(struct proc *p, struct linux_semop_args *args) bsd_args.semid = args->semid; bsd_args.sops = (struct sembuf *)args->tsops; bsd_args.nsops = args->nsops; - return semop(p, &bsd_args); + return semop(&bsd_args); } int -linux_semget(struct proc *p, struct linux_semget_args *args) +linux_semget(struct linux_semget_args *args) { struct semget_args /* { key_t key; @@ -206,12 +206,13 @@ linux_semget(struct proc *p, struct linux_semget_args *args) bsd_args.key = args->key; bsd_args.nsems = args->nsems; bsd_args.semflg = args->semflg; - return semget(p, &bsd_args); + return semget(&bsd_args); } int -linux_semctl(struct proc *p, struct linux_semctl_args *args) +linux_semctl(struct linux_semctl_args *args) { + struct proc *p = curproc; struct l_semid_ds linux_semid; struct __semctl_args /* { int semid; @@ -261,11 +262,11 @@ linux_semctl(struct proc *p, struct linux_semctl_args *args) return (error); unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds)); linux_to_bsd_semid_ds(&linux_semid, unptr->buf); - return __semctl(p, &bsd_args); + return __semctl(&bsd_args); case LINUX_IPC_STAT: bsd_args.cmd = IPC_STAT; unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds)); - error = __semctl(p, &bsd_args); + error = __semctl(&bsd_args); if (error) return error; p->p_retval[0] = IXSEQ_TO_IPCID(bsd_args.semid, @@ -300,11 +301,11 @@ linux_semctl(struct proc *p, struct linux_semctl_args *args) uprintf("linux: 'ipc' typ=%d not implemented\n", args->cmd); return EINVAL; } - return __semctl(p, &bsd_args); + return __semctl(&bsd_args); } int -linux_msgsnd(struct proc *p, struct linux_msgsnd_args *args) +linux_msgsnd(struct linux_msgsnd_args *args) { struct msgsnd_args /* { int msqid; @@ -317,11 +318,11 @@ linux_msgsnd(struct proc *p, struct linux_msgsnd_args *args) bsd_args.msgp = args->msgp; bsd_args.msgsz = args->msgsz; bsd_args.msgflg = args->msgflg; - return msgsnd(p, &bsd_args); + return msgsnd(&bsd_args); } int -linux_msgrcv(struct proc *p, struct linux_msgrcv_args *args) +linux_msgrcv(struct linux_msgrcv_args *args) { struct msgrcv_args /* { int msqid; @@ -336,11 +337,11 @@ linux_msgrcv(struct proc *p, struct linux_msgrcv_args *args) bsd_args.msgsz = args->msgsz; bsd_args.msgtyp = 0; /* XXX - args->msgtyp; */ bsd_args.msgflg = args->msgflg; - return msgrcv(p, &bsd_args); + return msgrcv(&bsd_args); } int -linux_msgget(struct proc *p, struct linux_msgget_args *args) +linux_msgget(struct linux_msgget_args *args) { struct msgget_args /* { key_t key; @@ -349,11 +350,11 @@ linux_msgget(struct proc *p, struct linux_msgget_args *args) bsd_args.key = args->key; bsd_args.msgflg = args->msgflg; - return msgget(p, &bsd_args); + return msgget(&bsd_args); } int -linux_msgctl(struct proc *p, struct linux_msgctl_args *args) +linux_msgctl(struct linux_msgctl_args *args) { struct msgctl_args /* { int msqid; @@ -365,13 +366,14 @@ linux_msgctl(struct proc *p, struct linux_msgctl_args *args) bsd_args.msqid = args->msqid; bsd_args.cmd = args->cmd; bsd_args.buf = (struct msqid_ds *)args->buf; - error = msgctl(p, &bsd_args); + error = msgctl(&bsd_args); return ((args->cmd == LINUX_IPC_RMID && error == EINVAL) ? 0 : error); } int -linux_shmat(struct proc *p, struct linux_shmat_args *args) +linux_shmat(struct linux_shmat_args *args) { + struct proc *p = curproc; struct shmat_args /* { int shmid; void *shmaddr; @@ -382,7 +384,7 @@ linux_shmat(struct proc *p, struct linux_shmat_args *args) bsd_args.shmid = args->shmid; bsd_args.shmaddr = args->shmaddr; bsd_args.shmflg = args->shmflg; - if ((error = shmat(p, &bsd_args))) + if ((error = shmat(&bsd_args))) return error; #ifdef __i386__ if ((error = copyout(p->p_retval, (caddr_t)args->raddr, sizeof(l_ulong)))) @@ -393,18 +395,18 @@ linux_shmat(struct proc *p, struct linux_shmat_args *args) } int -linux_shmdt(struct proc *p, struct linux_shmdt_args *args) +linux_shmdt(struct linux_shmdt_args *args) { struct shmdt_args /* { void *shmaddr; } */ bsd_args; bsd_args.shmaddr = args->shmaddr; - return shmdt(p, &bsd_args); + return shmdt(&bsd_args); } int -linux_shmget(struct proc *p, struct linux_shmget_args *args) +linux_shmget(struct linux_shmget_args *args) { struct shmget_args /* { key_t key; @@ -415,11 +417,11 @@ linux_shmget(struct proc *p, struct linux_shmget_args *args) bsd_args.key = args->key; bsd_args.size = args->size; bsd_args.shmflg = args->shmflg; - return shmget(p, &bsd_args); + return shmget(&bsd_args); } int -linux_shmctl(struct proc *p, struct linux_shmctl_args *args) +linux_shmctl(struct linux_shmctl_args *args) { struct l_shmid_ds linux_shmid; struct shmctl_args /* { @@ -435,7 +437,7 @@ linux_shmctl(struct proc *p, struct linux_shmctl_args *args) bsd_args.shmid = args->shmid; bsd_args.cmd = IPC_STAT; bsd_args.buf = (struct shmid_ds*)stackgap_alloc(&sg, sizeof(struct shmid_ds)); - if ((error = shmctl(p, &bsd_args))) + if ((error = shmctl(&bsd_args))) return error; bsd_to_linux_shmid_ds(bsd_args.buf, &linux_shmid); return copyout(&linux_shmid, (caddr_t)args->buf, sizeof(linux_shmid)); @@ -448,7 +450,7 @@ linux_shmctl(struct proc *p, struct linux_shmctl_args *args) linux_to_bsd_shmid_ds(&linux_shmid, bsd_args.buf); bsd_args.shmid = args->shmid; bsd_args.cmd = IPC_SET; - return shmctl(p, &bsd_args); + return shmctl(&bsd_args); case LINUX_IPC_RMID: bsd_args.shmid = args->shmid; @@ -462,7 +464,7 @@ linux_shmctl(struct proc *p, struct linux_shmctl_args *args) bsd_args.buf = (struct shmid_ds*)stackgap_alloc(&sg, sizeof(struct shmid_ds)); linux_to_bsd_shmid_ds(&linux_shmid, bsd_args.buf); } - return shmctl(p, &bsd_args); + return shmctl(&bsd_args); case LINUX_IPC_INFO: case LINUX_SHM_STAT: diff --git a/sys/emulation/linux/linux_ipc.h b/sys/emulation/linux/linux_ipc.h index 8ee3d4d54c..c4f92d446e 100644 --- a/sys/emulation/linux/linux_ipc.h +++ b/sys/emulation/linux/linux_ipc.h @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_ipc.h,v 1.2.2.4 2001/11/05 19:08:22 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_ipc.h,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_ipc.h,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ #ifndef _LINUX_IPC_H_ @@ -113,19 +113,19 @@ struct linux_shmget_args l_int shmflg; }; -int linux_msgctl __P((struct proc *, struct linux_msgctl_args *)); -int linux_msgget __P((struct proc *, struct linux_msgget_args *)); -int linux_msgrcv __P((struct proc *, struct linux_msgrcv_args *)); -int linux_msgsnd __P((struct proc *, struct linux_msgsnd_args *)); +int linux_msgctl __P((struct linux_msgctl_args *)); +int linux_msgget __P((struct linux_msgget_args *)); +int linux_msgrcv __P((struct linux_msgrcv_args *)); +int linux_msgsnd __P((struct linux_msgsnd_args *)); -int linux_semctl __P((struct proc *, struct linux_semctl_args *)); -int linux_semget __P((struct proc *, struct linux_semget_args *)); -int linux_semop __P((struct proc *, struct linux_semop_args *)); +int linux_semctl __P((struct linux_semctl_args *)); +int linux_semget __P((struct linux_semget_args *)); +int linux_semop __P((struct linux_semop_args *)); -int linux_shmat __P((struct proc *, struct linux_shmat_args *)); -int linux_shmctl __P((struct proc *, struct linux_shmctl_args *)); -int linux_shmdt __P((struct proc *, struct linux_shmdt_args *)); -int linux_shmget __P((struct proc *, struct linux_shmget_args *)); +int linux_shmat __P((struct linux_shmat_args *)); +int linux_shmctl __P((struct linux_shmctl_args *)); +int linux_shmdt __P((struct linux_shmdt_args *)); +int linux_shmget __P((struct linux_shmget_args *)); #endif /* __i386__ */ diff --git a/sys/emulation/linux/linux_mib.c b/sys/emulation/linux/linux_mib.c index aff2c397b8..95c80ea991 100644 --- a/sys/emulation/linux/linux_mib.c +++ b/sys/emulation/linux/linux_mib.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_mib.c,v 1.7.2.2 2001/11/05 19:08:22 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_mib.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_mib.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ #include @@ -115,10 +115,10 @@ SYSCTL_PROC(_compat_linux, OID_AUTO, oss_version, static struct linux_prison * get_prison(struct proc *p) { - register struct prison *pr; - register struct linux_prison *lpr; + struct prison *pr; + struct linux_prison *lpr; - pr = p->p_prison; + pr = p->p_ucred->cr_prison; if (pr == NULL) return (NULL); @@ -138,7 +138,7 @@ linux_get_osname(p) register struct prison *pr; register struct linux_prison *lpr; - pr = p->p_prison; + pr = p->p_ucred->cr_prison; if (pr != NULL && pr->pr_linux != NULL) { lpr = pr->pr_linux; if (lpr->pr_osname[0]) @@ -171,7 +171,7 @@ linux_get_osrelease(p) register struct prison *pr; register struct linux_prison *lpr; - pr = p->p_prison; + pr = p->p_ucred->cr_prison; if (pr != NULL && pr->pr_linux != NULL) { lpr = pr->pr_linux; if (lpr->pr_osrelease[0]) @@ -204,7 +204,7 @@ linux_get_oss_version(p) register struct prison *pr; register struct linux_prison *lpr; - pr = p->p_prison; + pr = p->p_ucred->cr_prison; if (pr != NULL && pr->pr_linux != NULL) { lpr = pr->pr_linux; if (lpr->pr_oss_version) diff --git a/sys/emulation/linux/linux_misc.c b/sys/emulation/linux/linux_misc.c index 9d6eb889a2..06ba00701b 100644 --- a/sys/emulation/linux/linux_misc.c +++ b/sys/emulation/linux/linux_misc.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.85.2.9 2002/09/24 08:11:41 mdodd Exp $ - * $DragonFly: src/sys/emulation/linux/linux_misc.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_misc.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ #include "opt_compat.h" @@ -108,7 +108,7 @@ struct l_sysinfo { }; #ifndef __alpha__ int -linux_sysinfo(struct proc *p, struct linux_sysinfo_args *args) +linux_sysinfo(struct linux_sysinfo_args *args) { struct l_sysinfo sysinfo; vm_object_t object; @@ -164,8 +164,9 @@ linux_sysinfo(struct proc *p, struct linux_sysinfo_args *args) #ifndef __alpha__ int -linux_alarm(struct proc *p, struct linux_alarm_args *args) +linux_alarm(struct linux_alarm_args *args) { + struct proc *p = curproc; struct itimerval it, old_it; struct timeval tv; int s; @@ -205,8 +206,9 @@ linux_alarm(struct proc *p, struct linux_alarm_args *args) #endif /*!__alpha__*/ int -linux_brk(struct proc *p, struct linux_brk_args *args) +linux_brk(struct linux_brk_args *args) { + struct proc *p = curproc; struct vmspace *vm = p->p_vmspace; vm_offset_t new, old; struct obreak_args /* { @@ -220,7 +222,7 @@ linux_brk(struct proc *p, struct linux_brk_args *args) old = (vm_offset_t)vm->vm_daddr + ctob(vm->vm_dsize); new = (vm_offset_t)args->dsend; tmp.nsize = (char *) new; - if (((caddr_t)new > vm->vm_daddr) && !obreak(p, &tmp)) + if (((caddr_t)new > vm->vm_daddr) && !obreak(&tmp)) p->p_retval[0] = (long)new; else p->p_retval[0] = (long)old; @@ -229,8 +231,9 @@ linux_brk(struct proc *p, struct linux_brk_args *args) } int -linux_uselib(struct proc *p, struct linux_uselib_args *args) +linux_uselib(struct linux_uselib_args *args) { + struct proc *p = curproc; struct nameidata ni; struct vnode *vp; struct exec *a_out; @@ -244,7 +247,7 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args) int locked; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->library); + CHECKALTEXIST(&sg, args->library); #ifdef DEBUG if (ldebug(uselib)) @@ -460,8 +463,9 @@ cleanup: } int -linux_select(struct proc *p, struct linux_select_args *args) +linux_select(struct linux_select_args *args) { + struct proc *p = curproc; struct select_args bsa; struct timeval tv0, tv1, utv, *tvp; caddr_t sg; @@ -517,7 +521,7 @@ linux_select(struct proc *p, struct linux_select_args *args) microtime(&tv0); } - error = select(p, &bsa); + error = select(&bsa); #ifdef DEBUG if (ldebug(select)) printf(LMSG("real select returns %d"), error); @@ -566,8 +570,9 @@ select_out: } int -linux_mremap(struct proc *p, struct linux_mremap_args *args) +linux_mremap(struct linux_mremap_args *args) { + struct proc *p = curproc; struct munmap_args /* { void *addr; size_t len; @@ -593,7 +598,7 @@ linux_mremap(struct proc *p, struct linux_mremap_args *args) if (args->new_len < args->old_len) { bsd_args.addr = (caddr_t)(args->addr + args->new_len); bsd_args.len = args->old_len - args->new_len; - error = munmap(p, &bsd_args); + error = munmap(&bsd_args); } p->p_retval[0] = error ? 0 : (u_long)args->addr; @@ -605,7 +610,7 @@ linux_mremap(struct proc *p, struct linux_mremap_args *args) #define LINUX_MS_SYNC 0x0004 int -linux_msync(struct proc *p, struct linux_msync_args *args) +linux_msync(struct linux_msync_args *args) { struct msync_args bsd_args; @@ -613,13 +618,14 @@ linux_msync(struct proc *p, struct linux_msync_args *args) bsd_args.len = args->len; bsd_args.flags = args->fl & ~LINUX_MS_SYNC; - return msync(p, &bsd_args); + return msync(&bsd_args); } #ifndef __alpha__ int -linux_time(struct proc *p, struct linux_time_args *args) +linux_time(struct linux_time_args *args) { + struct proc *p = curproc; struct timeval tv; l_time_t tm; int error; @@ -654,8 +660,9 @@ struct l_times_argv { #define CONVTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK)) int -linux_times(struct proc *p, struct linux_times_args *args) +linux_times(struct linux_times_args *args) { + struct proc *p = curproc; struct timeval tv; struct l_times_argv tms; struct rusage ru; @@ -683,8 +690,9 @@ linux_times(struct proc *p, struct linux_times_args *args) } int -linux_newuname(struct proc *p, struct linux_newuname_args *args) +linux_newuname(struct linux_newuname_args *args) { + struct proc *p = curproc; struct l_new_utsname utsname; char *osrelease, *osname; @@ -714,7 +722,7 @@ struct l_utimbuf { }; int -linux_utime(struct proc *p, struct linux_utime_args *args) +linux_utime(struct linux_utime_args *args) { struct utimes_args /* { char *path; @@ -726,7 +734,7 @@ linux_utime(struct proc *p, struct linux_utime_args *args) caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->fname); + CHECKALTEXIST(&sg, args->fname); #ifdef DEBUG if (ldebug(utime)) @@ -751,7 +759,7 @@ linux_utime(struct proc *p, struct linux_utime_args *args) bsdutimes.tptr = NULL; bsdutimes.path = args->fname; - return utimes(p, &bsdutimes); + return utimes(&bsdutimes); } #endif /* __i386__ */ @@ -759,7 +767,7 @@ linux_utime(struct proc *p, struct linux_utime_args *args) #ifndef __alpha__ int -linux_waitpid(struct proc *p, struct linux_waitpid_args *args) +linux_waitpid(struct linux_waitpid_args *args) { struct wait_args /* { int pid; @@ -783,7 +791,7 @@ linux_waitpid(struct proc *p, struct linux_waitpid_args *args) tmp.options |= WLINUXCLONE; tmp.rusage = NULL; - if ((error = wait4(p, &tmp)) != 0) + if ((error = wait4(&tmp)) != 0) return error; if (args->status) { @@ -805,8 +813,9 @@ linux_waitpid(struct proc *p, struct linux_waitpid_args *args) #endif /*!__alpha__*/ int -linux_wait4(struct proc *p, struct linux_wait4_args *args) +linux_wait4(struct linux_wait4_args *args) { + struct proc *p = curproc; struct wait_args /* { int pid; int *status; @@ -830,7 +839,7 @@ linux_wait4(struct proc *p, struct linux_wait4_args *args) tmp.options |= WLINUXCLONE; tmp.rusage = (struct rusage *)args->rusage; - if ((error = wait4(p, &tmp)) != 0) + if ((error = wait4(&tmp)) != 0) return error; SIGDELSET(p->p_siglist, SIGCHLD); @@ -853,7 +862,7 @@ linux_wait4(struct proc *p, struct linux_wait4_args *args) } int -linux_mknod(struct proc *p, struct linux_mknod_args *args) +linux_mknod(struct linux_mknod_args *args) { caddr_t sg; struct mknod_args bsd_mknod; @@ -861,7 +870,7 @@ linux_mknod(struct proc *p, struct linux_mknod_args *args) sg = stackgap_init(); - CHECKALTCREAT(p, &sg, args->path); + CHECKALTCREAT(&sg, args->path); #ifdef DEBUG if (ldebug(mknod)) @@ -872,12 +881,12 @@ linux_mknod(struct proc *p, struct linux_mknod_args *args) if (args->mode & S_IFIFO) { bsd_mkfifo.path = args->path; bsd_mkfifo.mode = args->mode; - return mkfifo(p, &bsd_mkfifo); + return mkfifo(&bsd_mkfifo); } else { bsd_mknod.path = args->path; bsd_mknod.mode = args->mode; bsd_mknod.dev = args->dev; - return mknod(p, &bsd_mknod); + return mknod(&bsd_mknod); } } @@ -885,8 +894,9 @@ linux_mknod(struct proc *p, struct linux_mknod_args *args) * UGH! This is just about the dumbest idea I've ever heard!! */ int -linux_personality(struct proc *p, struct linux_personality_args *args) +linux_personality(struct linux_personality_args *args) { + struct proc *p = curproc; #ifdef DEBUG if (ldebug(personality)) printf(ARGS(personality, "%d"), args->per); @@ -905,7 +915,7 @@ linux_personality(struct proc *p, struct linux_personality_args *args) * Wrappers for get/setitimer for debugging.. */ int -linux_setitimer(struct proc *p, struct linux_setitimer_args *args) +linux_setitimer(struct linux_setitimer_args *args) { struct setitimer_args bsa; struct itimerval foo; @@ -931,11 +941,11 @@ linux_setitimer(struct proc *p, struct linux_setitimer_args *args) } #endif } - return setitimer(p, &bsa); + return setitimer(&bsa); } int -linux_getitimer(struct proc *p, struct linux_getitimer_args *args) +linux_getitimer(struct linux_getitimer_args *args) { struct getitimer_args bsa; #ifdef DEBUG @@ -944,25 +954,26 @@ linux_getitimer(struct proc *p, struct linux_getitimer_args *args) #endif bsa.which = args->which; bsa.itv = (struct itimerval *)args->itv; - return getitimer(p, &bsa); + return getitimer(&bsa); } #ifndef __alpha__ int -linux_nice(struct proc *p, struct linux_nice_args *args) +linux_nice(struct linux_nice_args *args) { struct setpriority_args bsd_args; bsd_args.which = PRIO_PROCESS; bsd_args.who = 0; /* current process */ bsd_args.prio = args->inc; - return setpriority(p, &bsd_args); + return setpriority(&bsd_args); } #endif /*!__alpha__*/ int -linux_setgroups(struct proc *p, struct linux_setgroups_args *args) +linux_setgroups(struct linux_setgroups_args *args) { + struct proc *p = curproc; struct ucred *newcred, *oldcred; l_gid_t linux_gidset[NGROUPS]; gid_t *bsd_gidset; @@ -977,7 +988,7 @@ linux_setgroups(struct proc *p, struct linux_setgroups_args *args) * Keep cr_groups[0] unchanged to prevent that. */ - if ((error = suser_xxx(oldcred, NULL, PRISON_ROOT)) != 0) + if ((error = suser_xxx(oldcred, PRISON_ROOT)) != 0) return (error); if (ngrp >= NGROUPS) @@ -998,19 +1009,20 @@ linux_setgroups(struct proc *p, struct linux_setgroups_args *args) bsd_gidset[ngrp + 1] = linux_gidset[ngrp]; ngrp--; } - } - else + } else { newcred->cr_ngroups = 1; + } - setsugid(p); + setsugid(); p->p_ucred = newcred; crfree(oldcred); return (0); } int -linux_getgroups(struct proc *p, struct linux_getgroups_args *args) +linux_getgroups(struct linux_getgroups_args *args) { + struct proc *p = curproc; struct ucred *cred; l_gid_t linux_gidset[NGROUPS]; gid_t *bsd_gidset; @@ -1050,7 +1062,7 @@ linux_getgroups(struct proc *p, struct linux_getgroups_args *args) #ifndef __alpha__ int -linux_setrlimit(struct proc *p, struct linux_setrlimit_args *args) +linux_setrlimit(struct linux_setrlimit_args *args) { struct __setrlimit_args bsd; struct l_rlimit rlim; @@ -1077,11 +1089,11 @@ linux_setrlimit(struct proc *p, struct linux_setrlimit_args *args) bsd.rlp = stackgap_alloc(&sg, sizeof(struct rlimit)); bsd.rlp->rlim_cur = (rlim_t)rlim.rlim_cur; bsd.rlp->rlim_max = (rlim_t)rlim.rlim_max; - return (setrlimit(p, &bsd)); + return (setrlimit(&bsd)); } int -linux_old_getrlimit(struct proc *p, struct linux_old_getrlimit_args *args) +linux_old_getrlimit(struct linux_old_getrlimit_args *args) { struct __getrlimit_args bsd; struct l_rlimit rlim; @@ -1102,7 +1114,7 @@ linux_old_getrlimit(struct proc *p, struct linux_old_getrlimit_args *args) return (EINVAL); bsd.rlp = stackgap_alloc(&sg, sizeof(struct rlimit)); - error = getrlimit(p, &bsd); + error = getrlimit(&bsd); if (error) return (error); @@ -1116,7 +1128,7 @@ linux_old_getrlimit(struct proc *p, struct linux_old_getrlimit_args *args) } int -linux_getrlimit(struct proc *p, struct linux_getrlimit_args *args) +linux_getrlimit(struct linux_getrlimit_args *args) { struct __getrlimit_args bsd; struct l_rlimit rlim; @@ -1137,7 +1149,7 @@ linux_getrlimit(struct proc *p, struct linux_getrlimit_args *args) return (EINVAL); bsd.rlp = stackgap_alloc(&sg, sizeof(struct rlimit)); - error = getrlimit(p, &bsd); + error = getrlimit(&bsd); if (error) return (error); @@ -1148,8 +1160,7 @@ linux_getrlimit(struct proc *p, struct linux_getrlimit_args *args) #endif /*!__alpha__*/ int -linux_sched_setscheduler(struct proc *p, - struct linux_sched_setscheduler_args *args) +linux_sched_setscheduler(struct linux_sched_setscheduler_args *args) { struct sched_setscheduler_args bsd; @@ -1175,13 +1186,13 @@ linux_sched_setscheduler(struct proc *p, bsd.pid = args->pid; bsd.param = (struct sched_param *)args->param; - return sched_setscheduler(p, &bsd); + return sched_setscheduler(&bsd); } int -linux_sched_getscheduler(struct proc *p, - struct linux_sched_getscheduler_args *args) +linux_sched_getscheduler(struct linux_sched_getscheduler_args *args) { + struct proc *p = curproc; struct sched_getscheduler_args bsd; int error; @@ -1191,7 +1202,7 @@ linux_sched_getscheduler(struct proc *p, #endif bsd.pid = args->pid; - error = sched_getscheduler(p, &bsd); + error = sched_getscheduler(&bsd); switch (p->p_retval[0]) { case SCHED_OTHER: @@ -1209,8 +1220,7 @@ linux_sched_getscheduler(struct proc *p, } int -linux_sched_get_priority_max(struct proc *p, - struct linux_sched_get_priority_max_args *args) +linux_sched_get_priority_max(struct linux_sched_get_priority_max_args *args) { struct sched_get_priority_max_args bsd; @@ -1232,12 +1242,11 @@ linux_sched_get_priority_max(struct proc *p, default: return EINVAL; } - return sched_get_priority_max(p, &bsd); + return sched_get_priority_max(&bsd); } int -linux_sched_get_priority_min(struct proc *p, - struct linux_sched_get_priority_min_args *args) +linux_sched_get_priority_min(struct linux_sched_get_priority_min_args *args) { struct sched_get_priority_min_args bsd; @@ -1259,7 +1268,7 @@ linux_sched_get_priority_min(struct proc *p, default: return EINVAL; } - return sched_get_priority_min(p, &bsd); + return sched_get_priority_min(&bsd); } #define REBOOT_CAD_ON 0x89abcdef @@ -1267,7 +1276,7 @@ linux_sched_get_priority_min(struct proc *p, #define REBOOT_HALT 0xcdef0123 int -linux_reboot(struct proc *p, struct linux_reboot_args *args) +linux_reboot(struct linux_reboot_args *args) { struct reboot_args bsd_args; @@ -1278,7 +1287,7 @@ linux_reboot(struct proc *p, struct linux_reboot_args *args) if (args->cmd == REBOOT_CAD_ON || args->cmd == REBOOT_CAD_OFF) return (0); bsd_args.opt = (args->cmd == REBOOT_HALT) ? RB_HALT : 0; - return (reboot(p, &bsd_args)); + return (reboot(&bsd_args)); } #ifndef __alpha__ @@ -1296,35 +1305,38 @@ linux_reboot(struct proc *p, struct linux_reboot_args *args) */ int -linux_getpid(struct proc *p, struct linux_getpid_args *args) +linux_getpid(struct linux_getpid_args *args) { + struct proc *p = curproc; p->p_retval[0] = p->p_pid; return (0); } int -linux_getgid(struct proc *p, struct linux_getgid_args *args) +linux_getgid(struct linux_getgid_args *args) { + struct proc *p = curproc; - p->p_retval[0] = p->p_cred->p_rgid; + p->p_retval[0] = p->p_ucred->cr_rgid; return (0); } int -linux_getuid(struct proc *p, struct linux_getuid_args *args) +linux_getuid(struct linux_getuid_args *args) { + struct proc *p = curproc; - p->p_retval[0] = p->p_cred->p_ruid; + p->p_retval[0] = p->p_ucred->cr_ruid; return (0); } #endif /*!__alpha__*/ int -linux_getsid(struct proc *p, struct linux_getsid_args *args) +linux_getsid(struct linux_getsid_args *args) { struct getsid_args bsd; bsd.pid = args->pid; - return getsid(p, &bsd); + return getsid(&bsd); } diff --git a/sys/emulation/linux/linux_signal.c b/sys/emulation/linux/linux_signal.c index 0b8b86545c..a5c4339d82 100644 --- a/sys/emulation/linux/linux_signal.c +++ b/sys/emulation/linux/linux_signal.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_signal.c,v 1.23.2.3 2001/11/05 19:08:23 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_signal.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_signal.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ #include @@ -131,7 +131,7 @@ bsd_to_linux_sigaction(struct sigaction *bsa, l_sigaction_t *lsa) } int -linux_do_sigaction(struct proc *p, int linux_sig, l_sigaction_t *linux_nsa, +linux_do_sigaction(int linux_sig, l_sigaction_t *linux_nsa, l_sigaction_t *linux_osa) { struct sigaction *nsa, *osa; @@ -163,7 +163,7 @@ linux_do_sigaction(struct proc *p, int linux_sig, l_sigaction_t *linux_nsa, sa_args.act = nsa; sa_args.oact = osa; - error = sigaction(p, &sa_args); + error = sigaction(&sa_args); if (error) return (error); @@ -176,8 +176,9 @@ linux_do_sigaction(struct proc *p, int linux_sig, l_sigaction_t *linux_nsa, #ifndef __alpha__ int -linux_signal(struct proc *p, struct linux_signal_args *args) +linux_signal(struct linux_signal_args *args) { + struct proc *p = curproc; l_sigaction_t nsa, osa; int error; @@ -191,7 +192,7 @@ linux_signal(struct proc *p, struct linux_signal_args *args) nsa.lsa_flags = LINUX_SA_ONESHOT | LINUX_SA_NOMASK; LINUX_SIGEMPTYSET(nsa.lsa_mask); - error = linux_do_sigaction(p, args->sig, &nsa, &osa); + error = linux_do_sigaction(args->sig, &nsa, &osa); p->p_retval[0] = (int)osa.lsa_handler; return (error); @@ -199,7 +200,7 @@ linux_signal(struct proc *p, struct linux_signal_args *args) #endif /*!__alpha__*/ int -linux_rt_sigaction(struct proc *p, struct linux_rt_sigaction_args *args) +linux_rt_sigaction(struct linux_rt_sigaction_args *args) { l_sigaction_t nsa, osa; int error; @@ -220,7 +221,7 @@ linux_rt_sigaction(struct proc *p, struct linux_rt_sigaction_args *args) return (error); } - error = linux_do_sigaction(p, args->sig, + error = linux_do_sigaction(args->sig, args->act ? &nsa : NULL, args->oact ? &osa : NULL); @@ -232,9 +233,9 @@ linux_rt_sigaction(struct proc *p, struct linux_rt_sigaction_args *args) } static int -linux_do_sigprocmask(struct proc *p, int how, l_sigset_t *new, - l_sigset_t *old) +linux_do_sigprocmask(int how, l_sigset_t *new, l_sigset_t *old) { + struct proc *p = curproc; int error; sigset_t mask; @@ -270,7 +271,7 @@ linux_do_sigprocmask(struct proc *p, int how, l_sigset_t *new, #ifndef __alpha__ int -linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args) +linux_sigprocmask(struct linux_sigprocmask_args *args) { l_osigset_t mask; l_sigset_t set, oset; @@ -289,7 +290,7 @@ linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args) set.__bits[0] = mask; } - error = linux_do_sigprocmask(p, args->how, + error = linux_do_sigprocmask(args->how, args->mask ? &set : NULL, args->omask ? &oset : NULL); @@ -303,7 +304,7 @@ linux_sigprocmask(struct proc *p, struct linux_sigprocmask_args *args) #endif /*!__alpha__*/ int -linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args) +linux_rt_sigprocmask(struct linux_rt_sigprocmask_args *args) { l_sigset_t set, oset; int error; @@ -324,7 +325,7 @@ linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args) return (error); } - error = linux_do_sigprocmask(p, args->how, + error = linux_do_sigprocmask(args->how, args->mask ? &set : NULL, args->omask ? &oset : NULL); @@ -337,8 +338,9 @@ linux_rt_sigprocmask(struct proc *p, struct linux_rt_sigprocmask_args *args) #ifndef __alpha__ int -linux_sgetmask(struct proc *p, struct linux_sgetmask_args *args) +linux_sgetmask(struct linux_sgetmask_args *args) { + struct proc *p = curproc; l_sigset_t mask; #ifdef DEBUG @@ -352,8 +354,9 @@ linux_sgetmask(struct proc *p, struct linux_sgetmask_args *args) } int -linux_ssetmask(struct proc *p, struct linux_ssetmask_args *args) +linux_ssetmask(struct linux_ssetmask_args *args) { + struct proc *p = curproc; l_sigset_t lset; sigset_t bset; @@ -373,8 +376,9 @@ linux_ssetmask(struct proc *p, struct linux_ssetmask_args *args) } int -linux_sigpending(struct proc *p, struct linux_sigpending_args *args) +linux_sigpending(struct linux_sigpending_args *args) { + struct proc *p = curproc; sigset_t bset; l_sigset_t lset; l_osigset_t mask; @@ -393,7 +397,7 @@ linux_sigpending(struct proc *p, struct linux_sigpending_args *args) #endif /*!__alpha__*/ int -linux_kill(struct proc *p, struct linux_kill_args *args) +linux_kill(struct linux_kill_args *args) { struct kill_args /* { int pid; @@ -419,5 +423,5 @@ linux_kill(struct proc *p, struct linux_kill_args *args) tmp.signum = args->signum; tmp.pid = args->pid; - return (kill(p, &tmp)); + return (kill(&tmp)); } diff --git a/sys/emulation/linux/linux_signal.h b/sys/emulation/linux/linux_signal.h index d25eed93e5..65c7e6c251 100644 --- a/sys/emulation/linux/linux_signal.h +++ b/sys/emulation/linux/linux_signal.h @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_signal.h,v 1.2.2.3 2001/11/05 19:08:23 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_signal.h,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_signal.h,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ #ifndef _LINUX_SIGNAL_H_ @@ -34,7 +34,6 @@ void linux_to_bsd_sigset __P((l_sigset_t *, sigset_t *)); void bsd_to_linux_sigset __P((sigset_t *, l_sigset_t *)); -int linux_do_sigaction __P((struct proc *, int, l_sigaction_t *, - l_sigaction_t *)); +int linux_do_sigaction __P((int, l_sigaction_t *, l_sigaction_t *)); #endif /* _LINUX_SIGNAL_H_ */ diff --git a/sys/emulation/linux/linux_socket.c b/sys/emulation/linux/linux_socket.c index bbb53b6a47..e54a8c0c9d 100644 --- a/sys/emulation/linux/linux_socket.c +++ b/sys/emulation/linux/linux_socket.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_socket.c,v 1.19.2.8 2001/11/07 20:33:55 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_socket.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_socket.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ /* XXX we use functions that might not exist. */ @@ -209,7 +209,7 @@ linux_to_bsd_msg_flags(int flags) /* Return 0 if IP_HDRINCL is set for the given socket. */ static int -linux_check_hdrincl(struct proc *p, int s) +linux_check_hdrincl(int s) { struct getsockopt_args /* { int s; @@ -235,7 +235,7 @@ linux_check_hdrincl(struct proc *p, int s) bsd_args.name = IP_HDRINCL; bsd_args.val = val; bsd_args.avalsize = (int *)valsize; - if ((error = getsockopt(p, &bsd_args))) + if ((error = getsockopt(&bsd_args))) return (error); if ((error = copyin(val, &optval, sizeof(optval)))) @@ -249,7 +249,7 @@ linux_check_hdrincl(struct proc *p, int s) * tweak endian-dependent fields in the IP packet. */ static int -linux_sendto_hdrincl(struct proc *p, struct sendto_args *bsd_args) +linux_sendto_hdrincl(struct sendto_args *bsd_args) { /* * linux_ip_copysize defines how many bytes we should copy @@ -310,7 +310,7 @@ linux_sendto_hdrincl(struct proc *p, struct sendto_args *bsd_args) sendmsg_args.s = bsd_args->s; sendmsg_args.msg = (caddr_t)msg; sendmsg_args.flags = bsd_args->flags; - return (sendmsg(p, &sendmsg_args)); + return (sendmsg(&sendmsg_args)); } struct linux_socket_args { @@ -320,8 +320,9 @@ struct linux_socket_args { }; static int -linux_socket(struct proc *p, struct linux_socket_args *args) +linux_socket(struct linux_socket_args *args) { + struct proc *p = curproc; struct linux_socket_args linux_args; struct socket_args /* { int domain; @@ -340,7 +341,7 @@ linux_socket(struct proc *p, struct linux_socket_args *args) if (bsd_args.domain == -1) return (EINVAL); - retval_socket = socket(p, &bsd_args); + retval_socket = socket(&bsd_args); if (bsd_args.type == SOCK_RAW && (bsd_args.protocol == IPPROTO_RAW || bsd_args.protocol == 0) && bsd_args.domain == AF_INET @@ -365,7 +366,7 @@ linux_socket(struct proc *p, struct linux_socket_args *args) bsd_setsockopt_args.val = (caddr_t)hdrincl; bsd_setsockopt_args.valsize = sizeof(*hdrincl); /* We ignore any error returned by setsockopt() */ - setsockopt(p, &bsd_setsockopt_args); + setsockopt(&bsd_setsockopt_args); /* Copy back the return value from socket() */ p->p_retval[0] = bsd_setsockopt_args.s; } @@ -380,7 +381,7 @@ struct linux_bind_args { }; static int -linux_bind(struct proc *p, struct linux_bind_args *args) +linux_bind(struct linux_bind_args *args) { struct linux_bind_args linux_args; struct bind_args /* { @@ -397,7 +398,7 @@ linux_bind(struct proc *p, struct linux_bind_args *args) bsd_args.name = (caddr_t)linux_args.name; bsd_args.namelen = linux_to_bsd_namelen(bsd_args.name, linux_args.namelen); - return (bind(p, &bsd_args)); + return (bind(&bsd_args)); } struct linux_connect_args { @@ -405,12 +406,13 @@ struct linux_connect_args { struct sockaddr * name; int namelen; }; -int linux_connect(struct proc *, struct linux_connect_args *); +int linux_connect(struct linux_connect_args *); #endif /* !__alpha__*/ int -linux_connect(struct proc *p, struct linux_connect_args *args) +linux_connect(struct linux_connect_args *args) { + struct proc *p = curproc; struct linux_connect_args linux_args; struct connect_args /* { int s; @@ -432,7 +434,7 @@ linux_connect(struct proc *p, struct linux_connect_args *args) bsd_args.name = (caddr_t)linux_args.name; bsd_args.namelen = linux_to_bsd_namelen(bsd_args.name, linux_args.namelen); - error = connect(p, &bsd_args); + error = connect(&bsd_args); if (error != EISCONN) return (error); @@ -463,7 +465,7 @@ struct linux_listen_args { }; static int -linux_listen(struct proc *p, struct linux_listen_args *args) +linux_listen(struct linux_listen_args *args) { struct linux_listen_args linux_args; struct listen_args /* { @@ -477,7 +479,7 @@ linux_listen(struct proc *p, struct linux_listen_args *args) bsd_args.s = linux_args.s; bsd_args.backlog = linux_args.backlog; - return (listen(p, &bsd_args)); + return (listen(&bsd_args)); } struct linux_accept_args { @@ -487,8 +489,9 @@ struct linux_accept_args { }; static int -linux_accept(struct proc *p, struct linux_accept_args *args) +linux_accept(struct linux_accept_args *args) { + struct proc *p = curproc; struct linux_accept_args linux_args; struct accept_args /* { int s; @@ -508,7 +511,7 @@ linux_accept(struct proc *p, struct linux_accept_args *args) bsd_args.s = linux_args.s; bsd_args.name = (caddr_t)linux_args.addr; bsd_args.anamelen = linux_args.namelen; - error = oaccept(p, &bsd_args); + error = oaccept(&bsd_args); if (error) return (error); @@ -520,7 +523,7 @@ linux_accept(struct proc *p, struct linux_accept_args *args) f_args.fd = p->p_retval[0]; f_args.cmd = F_SETFL; f_args.arg = 0; - (void)fcntl(p, &f_args); + (void)fcntl(&f_args); p->p_retval[0] = f_args.fd; return (0); } @@ -532,7 +535,7 @@ struct linux_getsockname_args { }; static int -linux_getsockname(struct proc *p, struct linux_getsockname_args *args) +linux_getsockname(struct linux_getsockname_args *args) { struct linux_getsockname_args linux_args; struct getsockname_args /* { @@ -548,7 +551,7 @@ linux_getsockname(struct proc *p, struct linux_getsockname_args *args) bsd_args.fdes = linux_args.s; bsd_args.asa = (caddr_t) linux_args.addr; bsd_args.alen = linux_args.namelen; - return (ogetsockname(p, &bsd_args)); + return (ogetsockname(&bsd_args)); } struct linux_getpeername_args { @@ -558,7 +561,7 @@ struct linux_getpeername_args { }; static int -linux_getpeername(struct proc *p, struct linux_getpeername_args *args) +linux_getpeername(struct linux_getpeername_args *args) { struct linux_getpeername_args linux_args; struct ogetpeername_args /* { @@ -574,7 +577,7 @@ linux_getpeername(struct proc *p, struct linux_getpeername_args *args) bsd_args.fdes = linux_args.s; bsd_args.asa = (caddr_t) linux_args.addr; bsd_args.alen = linux_args.namelen; - return (ogetpeername(p, &bsd_args)); + return (ogetpeername(&bsd_args)); } struct linux_socketpair_args { @@ -585,7 +588,7 @@ struct linux_socketpair_args { }; static int -linux_socketpair(struct proc *p, struct linux_socketpair_args *args) +linux_socketpair(struct linux_socketpair_args *args) { struct linux_socketpair_args linux_args; struct socketpair_args /* { @@ -606,7 +609,7 @@ linux_socketpair(struct proc *p, struct linux_socketpair_args *args) bsd_args.type = linux_args.type; bsd_args.protocol = linux_args.protocol; bsd_args.rsv = linux_args.rsv; - return (socketpair(p, &bsd_args)); + return (socketpair(&bsd_args)); } struct linux_send_args { @@ -617,7 +620,7 @@ struct linux_send_args { }; static int -linux_send(struct proc *p, struct linux_send_args *args) +linux_send(struct linux_send_args *args) { struct linux_send_args linux_args; struct osend_args /* { @@ -635,7 +638,7 @@ linux_send(struct proc *p, struct linux_send_args *args) bsd_args.buf = linux_args.msg; bsd_args.len = linux_args.len; bsd_args.flags = linux_args.flags; - return (osend(p, &bsd_args)); + return (osend(&bsd_args)); } struct linux_recv_args { @@ -646,7 +649,7 @@ struct linux_recv_args { }; static int -linux_recv(struct proc *p, struct linux_recv_args *args) +linux_recv(struct linux_recv_args *args) { struct linux_recv_args linux_args; struct orecv_args /* { @@ -664,7 +667,7 @@ linux_recv(struct proc *p, struct linux_recv_args *args) bsd_args.buf = linux_args.msg; bsd_args.len = linux_args.len; bsd_args.flags = linux_args.flags; - return (orecv(p, &bsd_args)); + return (orecv(&bsd_args)); } struct linux_sendto_args { @@ -677,7 +680,7 @@ struct linux_sendto_args { }; static int -linux_sendto(struct proc *p, struct linux_sendto_args *args) +linux_sendto(struct linux_sendto_args *args) { struct linux_sendto_args linux_args; struct sendto_args /* { @@ -700,11 +703,11 @@ linux_sendto(struct proc *p, struct linux_sendto_args *args) bsd_args.to = linux_args.to; bsd_args.tolen = linux_args.tolen; - if (linux_check_hdrincl(p, linux_args.s) == 0) + if (linux_check_hdrincl(linux_args.s) == 0) /* IP_HDRINCL set, tweak the packet before sending */ - return (linux_sendto_hdrincl(p, &bsd_args)); + return (linux_sendto_hdrincl(&bsd_args)); - return (sendto(p, &bsd_args)); + return (sendto(&bsd_args)); } struct linux_recvfrom_args { @@ -717,7 +720,7 @@ struct linux_recvfrom_args { }; static int -linux_recvfrom(struct proc *p, struct linux_recvfrom_args *args) +linux_recvfrom(struct linux_recvfrom_args *args) { struct linux_recvfrom_args linux_args; struct recvfrom_args /* { @@ -739,7 +742,7 @@ linux_recvfrom(struct proc *p, struct linux_recvfrom_args *args) bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags); bsd_args.from = linux_args.from; bsd_args.fromlenaddr = linux_args.fromlen; - return (orecvfrom(p, &bsd_args)); + return (orecvfrom(&bsd_args)); } struct linux_recvmsg_args { @@ -749,7 +752,7 @@ struct linux_recvmsg_args { }; static int -linux_recvmsg(struct proc *p, struct linux_recvmsg_args *args) +linux_recvmsg(struct linux_recvmsg_args *args) { struct linux_recvmsg_args linux_args; struct recvmsg_args /* { @@ -765,7 +768,7 @@ linux_recvmsg(struct proc *p, struct linux_recvmsg_args *args) bsd_args.s = linux_args.s; bsd_args.msg = linux_args.msg; bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags); - return (recvmsg(p, &bsd_args)); + return (recvmsg(&bsd_args)); } struct linux_shutdown_args { @@ -774,7 +777,7 @@ struct linux_shutdown_args { }; static int -linux_shutdown(struct proc *p, struct linux_shutdown_args *args) +linux_shutdown(struct linux_shutdown_args *args) { struct linux_shutdown_args linux_args; struct shutdown_args /* { @@ -788,7 +791,7 @@ linux_shutdown(struct proc *p, struct linux_shutdown_args *args) bsd_args.s = linux_args.s; bsd_args.how = linux_args.how; - return (shutdown(p, &bsd_args)); + return (shutdown(&bsd_args)); } struct linux_setsockopt_args { @@ -800,7 +803,7 @@ struct linux_setsockopt_args { }; static int -linux_setsockopt(struct proc *p, struct linux_setsockopt_args *args) +linux_setsockopt(struct linux_setsockopt_args *args) { struct linux_setsockopt_args linux_args; struct setsockopt_args /* { @@ -838,7 +841,7 @@ linux_setsockopt(struct proc *p, struct linux_setsockopt_args *args) bsd_args.name = name; bsd_args.val = linux_args.optval; bsd_args.valsize = linux_args.optlen; - return (setsockopt(p, &bsd_args)); + return (setsockopt(&bsd_args)); } struct linux_getsockopt_args { @@ -850,7 +853,7 @@ struct linux_getsockopt_args { }; static int -linux_getsockopt(struct proc *p, struct linux_getsockopt_args *args) +linux_getsockopt(struct linux_getsockopt_args *args) { struct linux_getsockopt_args linux_args; struct getsockopt_args /* { @@ -888,45 +891,45 @@ linux_getsockopt(struct proc *p, struct linux_getsockopt_args *args) bsd_args.name = name; bsd_args.val = linux_args.optval; bsd_args.avalsize = linux_args.optlen; - return (getsockopt(p, &bsd_args)); + return (getsockopt(&bsd_args)); } int -linux_socketcall(struct proc *p, struct linux_socketcall_args *args) +linux_socketcall(struct linux_socketcall_args *args) { void *arg = (void *)args->args; switch (args->what) { case LINUX_SOCKET: - return (linux_socket(p, arg)); + return (linux_socket(arg)); case LINUX_BIND: - return (linux_bind(p, arg)); + return (linux_bind(arg)); case LINUX_CONNECT: - return (linux_connect(p, arg)); + return (linux_connect(arg)); case LINUX_LISTEN: - return (linux_listen(p, arg)); + return (linux_listen(arg)); case LINUX_ACCEPT: - return (linux_accept(p, arg)); + return (linux_accept(arg)); case LINUX_GETSOCKNAME: - return (linux_getsockname(p, arg)); + return (linux_getsockname(arg)); case LINUX_GETPEERNAME: - return (linux_getpeername(p, arg)); + return (linux_getpeername(arg)); case LINUX_SOCKETPAIR: - return (linux_socketpair(p, arg)); + return (linux_socketpair(arg)); case LINUX_SEND: - return (linux_send(p, arg)); + return (linux_send(arg)); case LINUX_RECV: - return (linux_recv(p, arg)); + return (linux_recv(arg)); case LINUX_SENDTO: - return (linux_sendto(p, arg)); + return (linux_sendto(arg)); case LINUX_RECVFROM: - return (linux_recvfrom(p, arg)); + return (linux_recvfrom(arg)); case LINUX_SHUTDOWN: - return (linux_shutdown(p, arg)); + return (linux_shutdown(arg)); case LINUX_SETSOCKOPT: - return (linux_setsockopt(p, arg)); + return (linux_setsockopt(arg)); case LINUX_GETSOCKOPT: - return (linux_getsockopt(p, arg)); + return (linux_getsockopt(arg)); case LINUX_SENDMSG: do { int error; @@ -964,10 +967,10 @@ linux_socketcall(struct proc *p, struct linux_socketcall_args *args) return (error); } done: - return (sendmsg(p, arg)); + return (sendmsg(arg)); } while (0); case LINUX_RECVMSG: - return (linux_recvmsg(p, arg)); + return (linux_recvmsg(arg)); } uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what); diff --git a/sys/emulation/linux/linux_stats.c b/sys/emulation/linux/linux_stats.c index 234f5b0d6c..4af4f0459e 100644 --- a/sys/emulation/linux/linux_stats.c +++ b/sys/emulation/linux/linux_stats.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_stats.c,v 1.22.2.3 2001/11/05 19:08:23 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_stats.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_stats.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ #include @@ -88,15 +88,16 @@ newstat_copyout(struct stat *buf, void *ubuf) } int -linux_newstat(struct proc *p, struct linux_newstat_args *args) +linux_newstat(struct linux_newstat_args *args) { + struct proc *p = curproc; struct stat buf; struct nameidata nd; int error; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(newstat)) @@ -119,15 +120,16 @@ linux_newstat(struct proc *p, struct linux_newstat_args *args) } int -linux_newlstat(struct proc *p, struct linux_newlstat_args *args) +linux_newlstat(struct linux_newlstat_args *args) { + struct proc *p = curproc; int error; struct stat sb; struct nameidata nd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(newlstat)) @@ -150,8 +152,9 @@ linux_newlstat(struct proc *p, struct linux_newlstat_args *args) } int -linux_newfstat(struct proc *p, struct linux_newfstat_args *args) +linux_newfstat(struct linux_newfstat_args *args) { + struct proc *p = curproc; struct filedesc *fdp; struct file *fp; struct stat buf; @@ -224,8 +227,9 @@ bsd_to_linux_ftype(const char *fstypename) } int -linux_statfs(struct proc *p, struct linux_statfs_args *args) +linux_statfs(struct linux_statfs_args *args) { + struct proc *p = curproc; struct mount *mp; struct nameidata *ndp; struct statfs *bsd_statfs; @@ -235,7 +239,7 @@ linux_statfs(struct proc *p, struct linux_statfs_args *args) caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(statfs)) @@ -269,8 +273,9 @@ linux_statfs(struct proc *p, struct linux_statfs_args *args) } int -linux_fstatfs(struct proc *p, struct linux_fstatfs_args *args) +linux_fstatfs(struct linux_fstatfs_args *args) { + struct proc *p = curproc; struct file *fp; struct mount *mp; struct statfs *bsd_statfs; @@ -313,8 +318,9 @@ struct l_ustat }; int -linux_ustat(struct proc *p, struct linux_ustat_args *args) +linux_ustat(struct linux_ustat_args *args) { + struct proc *p = curproc; struct l_ustat lu; dev_t dev; struct vnode *vp; @@ -389,15 +395,16 @@ stat64_copyout(struct stat *buf, void *ubuf) } int -linux_stat64(struct proc *p, struct linux_stat64_args *args) +linux_stat64(struct linux_stat64_args *args) { + struct proc *p = curproc; struct stat buf; struct nameidata nd; int error; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->filename); + CHECKALTEXIST(&sg, args->filename); #ifdef DEBUG if (ldebug(stat64)) @@ -420,15 +427,16 @@ linux_stat64(struct proc *p, struct linux_stat64_args *args) } int -linux_lstat64(struct proc *p, struct linux_lstat64_args *args) +linux_lstat64(struct linux_lstat64_args *args) { + struct proc *p = curproc; int error; struct stat sb; struct nameidata nd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->filename); + CHECKALTEXIST(&sg, args->filename); #ifdef DEBUG if (ldebug(lstat64)) @@ -451,8 +459,9 @@ linux_lstat64(struct proc *p, struct linux_lstat64_args *args) } int -linux_fstat64(struct proc *p, struct linux_fstat64_args *args) +linux_fstat64(struct linux_fstat64_args *args) { + struct proc *p = curproc; struct filedesc *fdp; struct file *fp; struct stat buf; diff --git a/sys/emulation/linux/linux_sysctl.c b/sys/emulation/linux/linux_sysctl.c index 9f84a6db74..f704320cac 100644 --- a/sys/emulation/linux/linux_sysctl.c +++ b/sys/emulation/linux/linux_sysctl.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_sysctl.c,v 1.2.2.1 2001/10/21 03:57:35 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_sysctl.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_sysctl.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ #include "opt_compat.h" @@ -76,7 +76,7 @@ handle_string(struct l___sysctl_args *la, char *value) } int -linux_sysctl(struct proc *p, struct linux_sysctl_args *args) +linux_sysctl(struct linux_sysctl_args *args) { struct l___sysctl_args la; l_int *mib; diff --git a/sys/emulation/linux/linux_uid16.c b/sys/emulation/linux/linux_uid16.c index a141dfa233..d1e24cbfc4 100644 --- a/sys/emulation/linux/linux_uid16.c +++ b/sys/emulation/linux/linux_uid16.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_uid16.c,v 1.4.2.1 2001/10/21 03:57:35 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_uid16.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_uid16.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ */ #include "opt_compat.h" @@ -46,13 +46,13 @@ DUMMY(getresgid16); #define CAST_NOCHG(x) (x == 0xFFFF) ? -1 : x; int -linux_chown16(struct proc *p, struct linux_chown16_args *args) +linux_chown16(struct linux_chown16_args *args) { struct chown_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(chown16)) @@ -63,17 +63,17 @@ linux_chown16(struct proc *p, struct linux_chown16_args *args) bsd.path = args->path; bsd.uid = CAST_NOCHG(args->uid); bsd.gid = CAST_NOCHG(args->gid); - return (chown(p, &bsd)); + return (chown(&bsd)); } int -linux_lchown16(struct proc *p, struct linux_lchown16_args *args) +linux_lchown16(struct linux_lchown16_args *args) { struct lchown_args bsd; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, args->path); + CHECKALTEXIST(&sg, args->path); #ifdef DEBUG if (ldebug(lchown16)) @@ -84,12 +84,13 @@ linux_lchown16(struct proc *p, struct linux_lchown16_args *args) bsd.path = args->path; bsd.uid = CAST_NOCHG(args->uid); bsd.gid = CAST_NOCHG(args->gid); - return (lchown(p, &bsd)); + return (lchown(&bsd)); } int -linux_setgroups16(struct proc *p, struct linux_setgroups16_args *args) +linux_setgroups16(struct linux_setgroups16_args *args) { + struct proc *p = curproc; struct ucred *newcred, *oldcred; l_gid16_t linux_gidset[NGROUPS]; gid_t *bsd_gidset; @@ -109,7 +110,7 @@ linux_setgroups16(struct proc *p, struct linux_setgroups16_args *args) * Keep cr_groups[0] unchanged to prevent that. */ - if ((error = suser_xxx(oldcred, NULL, PRISON_ROOT)) != 0) + if ((error = suser_xxx(oldcred, PRISON_ROOT)) != 0) return (error); if (ngrp >= NGROUPS) @@ -134,15 +135,16 @@ linux_setgroups16(struct proc *p, struct linux_setgroups16_args *args) else newcred->cr_ngroups = 1; - setsugid(p); + setsugid(); p->p_ucred = newcred; crfree(oldcred); return (0); } int -linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args) +linux_getgroups16(struct linux_getgroups16_args *args) { + struct proc *p = curproc; struct ucred *cred; l_gid16_t linux_gidset[NGROUPS]; gid_t *bsd_gidset; @@ -198,93 +200,95 @@ linux_getgroups16(struct proc *p, struct linux_getgroups16_args *args) */ int -linux_getgid16(struct proc *p, struct linux_getgid16_args *args) +linux_getgid16(struct linux_getgid16_args *args) { + struct proc *p = curproc; - p->p_retval[0] = p->p_cred->p_rgid; + p->p_retval[0] = p->p_ucred->cr_rgid; return (0); } int -linux_getuid16(struct proc *p, struct linux_getuid16_args *args) +linux_getuid16(struct linux_getuid16_args *args) { + struct proc *p = curproc; - p->p_retval[0] = p->p_cred->p_ruid; + p->p_retval[0] = p->p_ucred->cr_ruid; return (0); } int -linux_getegid16(struct proc *p, struct linux_getegid16_args *args) +linux_getegid16(struct linux_getegid16_args *args) { struct getegid_args bsd; - return (getegid(p, &bsd)); + return (getegid(&bsd)); } int -linux_geteuid16(struct proc *p, struct linux_geteuid16_args *args) +linux_geteuid16(struct linux_geteuid16_args *args) { struct geteuid_args bsd; - return (geteuid(p, &bsd)); + return (geteuid(&bsd)); } int -linux_setgid16(struct proc *p, struct linux_setgid16_args *args) +linux_setgid16(struct linux_setgid16_args *args) { struct setgid_args bsd; bsd.gid = args->gid; - return (setgid(p, &bsd)); + return (setgid(&bsd)); } int -linux_setuid16(struct proc *p, struct linux_setuid16_args *args) +linux_setuid16(struct linux_setuid16_args *args) { struct setuid_args bsd; bsd.uid = args->uid; - return (setuid(p, &bsd)); + return (setuid(&bsd)); } int -linux_setregid16(struct proc *p, struct linux_setregid16_args *args) +linux_setregid16(struct linux_setregid16_args *args) { struct setregid_args bsd; bsd.rgid = CAST_NOCHG(args->rgid); bsd.egid = CAST_NOCHG(args->egid); - return (setregid(p, &bsd)); + return (setregid(&bsd)); } int -linux_setreuid16(struct proc *p, struct linux_setreuid16_args *args) +linux_setreuid16(struct linux_setreuid16_args *args) { struct setreuid_args bsd; bsd.ruid = CAST_NOCHG(args->ruid); bsd.euid = CAST_NOCHG(args->euid); - return (setreuid(p, &bsd)); + return (setreuid(&bsd)); } int -linux_setresgid16(struct proc *p, struct linux_setresgid16_args *args) +linux_setresgid16(struct linux_setresgid16_args *args) { struct setresgid_args bsd; bsd.rgid = CAST_NOCHG(args->rgid); bsd.egid = CAST_NOCHG(args->egid); bsd.sgid = CAST_NOCHG(args->sgid); - return (setresgid(p, &bsd)); + return (setresgid(&bsd)); } int -linux_setresuid16(struct proc *p, struct linux_setresuid16_args *args) +linux_setresuid16(struct linux_setresuid16_args *args) { struct setresuid_args bsd; bsd.ruid = CAST_NOCHG(args->ruid); bsd.euid = CAST_NOCHG(args->euid); bsd.suid = CAST_NOCHG(args->suid); - return (setresuid(p, &bsd)); + return (setresuid(&bsd)); } diff --git a/sys/emulation/linux/linux_util.c b/sys/emulation/linux/linux_util.c index 52c191cee4..41be4a895e 100644 --- a/sys/emulation/linux/linux_util.c +++ b/sys/emulation/linux/linux_util.c @@ -28,7 +28,7 @@ * * from: svr4_util.c,v 1.5 1995/01/22 23:44:50 christos Exp * $FreeBSD: src/sys/compat/linux/linux_util.c,v 1.12.2.2 2001/11/05 19:08:23 marcel Exp $ - * $DragonFly: src/sys/emulation/linux/linux_util.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_util.c,v 1.3 2003/06/23 17:55:27 dillon Exp $ */ #include @@ -52,7 +52,7 @@ const char linux_emul_path[] = "/compat/linux"; */ int linux_emul_find(p, sgp, prefix, path, pbuf, cflag) - struct proc *p; + struct proc *p; caddr_t *sgp; /* Pointer to stackgap memory */ const char *prefix; char *path; diff --git a/sys/emulation/linux/linux_util.h b/sys/emulation/linux/linux_util.h index ecc41a2ce6..594d1aa80f 100644 --- a/sys/emulation/linux/linux_util.h +++ b/sys/emulation/linux/linux_util.h @@ -29,7 +29,7 @@ * from: svr4_util.h,v 1.5 1994/11/18 02:54:31 christos Exp * from: linux_util.h,v 1.2 1995/03/05 23:23:50 fvdl Exp * $FreeBSD: src/sys/compat/linux/linux_util.h,v 1.12.2.2 2000/11/02 23:31:28 obrien Exp $ - * $DragonFly: src/sys/emulation/linux/linux_util.h,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_util.h,v 1.3 2003/06/23 17:55:27 dillon Exp $ */ /* @@ -77,34 +77,33 @@ stackgap_alloc(sgp, sz) extern const char linux_emul_path[]; -int linux_emul_find __P((struct proc *, caddr_t *, const char *, char *, - char **, int)); +int linux_emul_find __P((struct proc *, caddr_t *, const char *, char *, char **, int)); -#define CHECKALT(p, sgp, path, i) \ +#define CHECKALT(sgp, path, i) \ do { \ int _error; \ \ - _error = linux_emul_find(p, sgp, linux_emul_path, path, \ + _error = linux_emul_find(curproc, sgp, linux_emul_path, path, \ &path, i); \ if (_error == EFAULT) \ return (_error); \ } while (0) -#define CHECKALTEXIST(p, sgp, path) CHECKALT(p, sgp, path, 0) -#define CHECKALTCREAT(p, sgp, path) CHECKALT(p, sgp, path, 1) +#define CHECKALTEXIST(sgp, path) CHECKALT(sgp, path, 0) +#define CHECKALTCREAT(sgp, path) CHECKALT(sgp, path, 1) #define DUMMY(s) \ int \ -linux_ ## s(struct proc *p, struct linux_ ## s ## _args *args) \ +linux_ ## s(struct linux_ ## s ## _args *args) \ { \ - return (unsupported_msg(p, #s)); \ + return (unsupported_msg(#s)); \ } \ struct __hack static __inline int -unsupported_msg(struct proc *p, const char *fname) +unsupported_msg(const char *fname) { - + struct proc *p = curproc; printf("linux: syscall %s is obsoleted or not implemented (pid=%ld)\n", fname, (long)p->p_pid); return (ENOSYS); diff --git a/sys/emulation/posix4/p1003_1b.c b/sys/emulation/posix4/p1003_1b.c index 90d050afe3..676f773d9d 100644 --- a/sys/emulation/posix4/p1003_1b.c +++ b/sys/emulation/posix4/p1003_1b.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/posix4/p1003_1b.c,v 1.5.2.2 2003/03/25 06:13:35 rwatson Exp $ - * $DragonFly: src/sys/emulation/posix4/Attic/p1003_1b.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/emulation/posix4/Attic/p1003_1b.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ /* p1003_1b: Real Time common code. @@ -69,14 +69,14 @@ MALLOC_DEFINE(M_P31B, "p1003.1b", "Posix 1003.1B"); * * Can process p, with pcred pc, do "write flavor" operations to process q? */ -#define CAN_AFFECT(p, pc, q) \ - ((pc)->pc_ucred->cr_uid == 0 || \ - (pc)->p_ruid == (q)->p_cred->p_ruid || \ - (pc)->pc_ucred->cr_uid == (q)->p_cred->p_ruid || \ - (pc)->p_ruid == (q)->p_ucred->cr_uid || \ - (pc)->pc_ucred->cr_uid == (q)->p_ucred->cr_uid) +#define CAN_AFFECT(p, cr, q) \ + ((cr)->cr_uid == 0 || \ + (cr)->cr_ruid == (q)->p_ucred->cr_ruid || \ + (cr)->cr_uid == (q)->p_ucred->cr_ruid || \ + (cr)->cr_ruid == (q)->p_ucred->cr_uid || \ + (cr)->cr_uid == (q)->p_ucred->cr_uid) #else -#define CAN_AFFECT(p, pc, q) ((pc)->pc_ucred->cr_uid == 0) +#define CAN_AFFECT(p, cr, q) ((cr)->cr_uid == 0) #endif /* @@ -97,7 +97,7 @@ int p31b_proc(struct proc *p, pid_t pid, struct proc **pp) { /* Enforce permission policy. */ - if (CAN_AFFECT(p, p->p_cred, other_proc)) + if (CAN_AFFECT(p, p->p_ucred, other_proc)) *pp = other_proc; else ret = EPERM; @@ -159,26 +159,26 @@ static int sched_attach(void) return ret; } -int sched_setparam(struct proc *p, - struct sched_setparam_args *uap) +int +sched_setparam(struct sched_setparam_args *uap) { + struct proc *p = curproc; int e; struct sched_param sched_param; copyin(uap->param, &sched_param, sizeof(sched_param)); - (void) (0 - || (e = p31b_proc(p, uap->pid, &p)) - || (e = ksched_setparam(&p->p_retval[0], ksched, p, - (const struct sched_param *)&sched_param)) - ); - + if ((e = p31b_proc(p, uap->pid, &p)) == 0) { + e = ksched_setparam(&p->p_retval[0], ksched, p, + (const struct sched_param *)&sched_param); + } return e; } -int sched_getparam(struct proc *p, - struct sched_getparam_args *uap) +int +sched_getparam(struct sched_getparam_args *uap) { + struct proc *p = curproc; struct proc *targetp; struct sched_param sched_param; int e; @@ -187,8 +187,9 @@ int sched_getparam(struct proc *p, e = p31b_proc(p, uap->pid, &targetp); if (e) return e; - } else + } else { targetp = p; + } e = ksched_getparam(&p->p_retval[0], ksched, targetp, &sched_param); @@ -197,26 +198,27 @@ int sched_getparam(struct proc *p, return e; } -int sched_setscheduler(struct proc *p, - struct sched_setscheduler_args *uap) + +int +sched_setscheduler(struct sched_setscheduler_args *uap) { + struct proc *p = curproc; int e; struct sched_param sched_param; copyin(uap->param, &sched_param, sizeof(sched_param)); - (void) (0 - || (e = p31b_proc(p, uap->pid, &p)) - || (e = ksched_setscheduler(&p->p_retval[0], - ksched, p, uap->policy, - (const struct sched_param *)&sched_param)) - ); - + if ((e = p31b_proc(p, uap->pid, &p)) == 0) { + e = ksched_setscheduler(&p->p_retval[0], ksched, p, + uap->policy, (const struct sched_param *)&sched_param); + } return e; } -int sched_getscheduler(struct proc *p, - struct sched_getscheduler_args *uap) + +int +sched_getscheduler(struct sched_getscheduler_args *uap) { + struct proc *p = curproc; struct proc *targetp; int e; @@ -224,41 +226,46 @@ int sched_getscheduler(struct proc *p, e = p31b_proc(p, uap->pid, &targetp); if (e) return e; - } else + } else { targetp = p; + } e = ksched_getscheduler(&p->p_retval[0], ksched, targetp); return e; } -int sched_yield(struct proc *p, - struct sched_yield_args *uap) + +int +sched_yield(struct sched_yield_args *uap) { + struct proc *p = curproc; return ksched_yield(&p->p_retval[0], ksched); } -int sched_get_priority_max(struct proc *p, - struct sched_get_priority_max_args *uap) + +int +sched_get_priority_max(struct sched_get_priority_max_args *uap) { - return ksched_get_priority_max(&p->p_retval[0], - ksched, uap->policy); + struct proc *p = curproc; + return ksched_get_priority_max(&p->p_retval[0], ksched, uap->policy); } -int sched_get_priority_min(struct proc *p, - struct sched_get_priority_min_args *uap) + +int +sched_get_priority_min(struct sched_get_priority_min_args *uap) { - return ksched_get_priority_min(&p->p_retval[0], - ksched, uap->policy); + struct proc *p = curproc; + return ksched_get_priority_min(&p->p_retval[0], ksched, uap->policy); } -int sched_rr_get_interval(struct proc *p, - struct sched_rr_get_interval_args *uap) + +int +sched_rr_get_interval(struct sched_rr_get_interval_args *uap) { int e; + struct proc *p = curproc; - (void) (0 - || (e = p31b_proc(p, uap->pid, &p)) - || (e = ksched_rr_get_interval(&p->p_retval[0], ksched, - p, uap->interval)) - ); - + if ((e = p31b_proc(p, uap->pid, &p)) == 0) { + e = ksched_rr_get_interval(&p->p_retval[0], ksched, + p, uap->interval); + } return e; } diff --git a/sys/emulation/svr4/i386/svr4_machdep.c b/sys/emulation/svr4/i386/svr4_machdep.c index 370fc7afa5..9b20e34c0a 100644 --- a/sys/emulation/svr4/i386/svr4_machdep.c +++ b/sys/emulation/svr4/i386/svr4_machdep.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/svr4/svr4_machdep.c,v 1.13.2.1 2002/01/12 11:03:30 bde Exp $ - * $DragonFly: src/sys/emulation/svr4/i386/Attic/svr4_machdep.c,v 1.3 2003/06/18 18:30:06 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/i386/Attic/svr4_machdep.c,v 1.4 2003/06/23 17:55:40 dillon Exp $ */ #include @@ -483,9 +483,7 @@ svr4_sendsig(catcher, sig, mask, code) int -svr4_sys_sysarch(p, v) - struct proc *p; - struct svr4_sys_sysarch_args *v; +svr4_sys_sysarch(struct svr4_sys_sysarch_args *v) { struct svr4_sys_sysarch_args *uap = v; #ifdef USER_LDT diff --git a/sys/emulation/svr4/svr4_fcntl.c b/sys/emulation/svr4/svr4_fcntl.c index 1e2de6094d..19aa86f0c5 100644 --- a/sys/emulation/svr4/svr4_fcntl.c +++ b/sys/emulation/svr4/svr4_fcntl.c @@ -29,7 +29,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_fcntl.c,v 1.7 1999/12/12 10:27:04 newton Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_fcntl.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_fcntl.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ #include #include @@ -243,9 +243,7 @@ svr4_to_bsd_flock64(iflp, oflp) static int -fd_revoke(p, fd) - struct proc *p; - int fd; +fd_revoke(struct proc *p, int fd) { struct filedesc *fdp = p->p_fd; struct file *fp; @@ -271,7 +269,7 @@ fd_revoke(p, fd) goto out; if (p->p_ucred->cr_uid != vattr.va_uid && - (error = suser(p)) != 0) + (error = suser_xxx(p->p_ucred, 0)) != 0) goto out; if (vcount(vp) > 1) @@ -283,10 +281,7 @@ out: static int -fd_truncate(p, fd, flp) - struct proc *p; - int fd; - struct flock *flp; +fd_truncate(struct proc *p, int fd, struct flock *flp) { struct filedesc *fdp = p->p_fd; struct file *fp; @@ -338,24 +333,23 @@ fd_truncate(p, fd, flp) SCARG(&ft, fd) = fd; SCARG(&ft, length) = start; - return ftruncate(p, &ft); + return ftruncate(&ft); } int -svr4_sys_open(p, uap) - register struct proc *p; - struct svr4_sys_open_args *uap; +svr4_sys_open(struct svr4_sys_open_args *uap) { + struct proc *p = curproc; int error, retval; struct open_args cup; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); (&cup)->path = uap->path; (&cup)->flags = svr4_to_bsd_flags(uap->flags); (&cup)->mode = uap->mode; - error = open(p, &cup); + error = open(&cup); if (error) { /* uprintf("svr4_open(%s, 0x%0x, 0%o): %d\n", uap->path, @@ -380,42 +374,34 @@ svr4_sys_open(p, uap) } int -svr4_sys_open64(p, uap) - register struct proc *p; - struct svr4_sys_open64_args *uap; +svr4_sys_open64(struct svr4_sys_open64_args *uap) { - return svr4_sys_open(p, (struct svr4_sys_open_args *)uap); + return svr4_sys_open((struct svr4_sys_open_args *)uap); } int -svr4_sys_creat(p, uap) - register struct proc *p; - struct svr4_sys_creat_args *uap; +svr4_sys_creat(struct svr4_sys_creat_args *uap) { struct open_args cup; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, mode) = SCARG(uap, mode); SCARG(&cup, flags) = O_WRONLY | O_CREAT | O_TRUNC; - return open(p, &cup); + return open(&cup); } int -svr4_sys_creat64(p, uap) - register struct proc *p; - struct svr4_sys_creat64_args *uap; +svr4_sys_creat64(struct svr4_sys_creat64_args *uap) { - return svr4_sys_creat(p, (struct svr4_sys_creat_args *)uap); + return svr4_sys_creat((struct svr4_sys_creat_args *)uap); } int -svr4_sys_llseek(p, v) - register struct proc *p; - struct svr4_sys_llseek_args *v; +svr4_sys_llseek(struct svr4_sys_llseek_args *v) { struct svr4_sys_llseek_args *uap = v; struct lseek_args ap; @@ -431,33 +417,30 @@ svr4_sys_llseek(p, v) #endif SCARG(&ap, whence) = SCARG(uap, whence); - return lseek(p, &ap); + return lseek(&ap); } int -svr4_sys_access(p, uap) - register struct proc *p; - struct svr4_sys_access_args *uap; +svr4_sys_access(struct svr4_sys_access_args *uap) { + struct proc *p = curproc; struct access_args cup; int *retval; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); retval = p->p_retval; SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, flags) = SCARG(uap, flags); - return access(p, &cup); + return access(&cup); } #if defined(NOTYET) int -svr4_sys_pread(p, uap) - register struct proc *p; - struct svr4_sys_pread_args *uap; +svr4_sys_pread(struct svr4_sys_pread_args *uap) { struct pread_args pra; @@ -470,7 +453,7 @@ svr4_sys_pread(p, uap) SCARG(&pra, nbyte) = SCARG(uap, nbyte); SCARG(&pra, offset) = SCARG(uap, off); - return pread(p, &pra); + return pread(&pra); } #endif @@ -494,15 +477,13 @@ svr4_sys_pread64(p, v, retval) SCARG(&pra, nbyte) = SCARG(uap, nbyte); SCARG(&pra, offset) = SCARG(uap, off); - return (sys_pread(p, &pra, retval)); + return (sys_pread(&pra, retval)); } #endif /* NOTYET */ #if defined(NOTYET) int -svr4_sys_pwrite(p, uap) - register struct proc *p; - struct svr4_sys_pwrite_args *uap; +svr4_sys_pwrite(struct svr4_sys_pwrite_args *uap) { struct pwrite_args pwa; @@ -515,7 +496,7 @@ svr4_sys_pwrite(p, uap) SCARG(&pwa, nbyte) = SCARG(uap, nbyte); SCARG(&pwa, offset) = SCARG(uap, off); - return pwrite(p, &pwa); + return pwrite(&pwa); } #endif @@ -543,10 +524,9 @@ svr4_sys_pwrite64(p, v, retval) #endif /* NOTYET */ int -svr4_sys_fcntl(p, uap) - register struct proc *p; - struct svr4_sys_fcntl_args *uap; +svr4_sys_fcntl(struct svr4_sys_fcntl_args *uap) { + struct proc *p = curproc; int error; struct fcntl_args fa; int *retval; @@ -561,11 +541,11 @@ svr4_sys_fcntl(p, uap) case F_GETFD: case F_SETFD: SCARG(&fa, arg) = (long) SCARG(uap, arg); - return fcntl(p, &fa); + return fcntl(&fa); case F_GETFL: SCARG(&fa, arg) = (long) SCARG(uap, arg); - error = fcntl(p, &fa); + error = fcntl(&fa); if (error) return error; *retval = bsd_to_svr4_flags(*retval); @@ -584,14 +564,14 @@ svr4_sys_fcntl(p, uap) cmd = SCARG(&fa, cmd); /* save it for a while */ SCARG(&fa, cmd) = F_GETFL; - if ((error = fcntl(p, &fa)) != 0) + if ((error = fcntl(&fa)) != 0) return error; flags = *retval; flags &= O_ASYNC; flags |= svr4_to_bsd_flags((u_long) SCARG(uap, arg)); SCARG(&fa, cmd) = cmd; SCARG(&fa, arg) = (long) flags; - return fcntl(p, &fa); + return fcntl(&fa); } case F_GETLK: @@ -615,7 +595,7 @@ svr4_sys_fcntl(p, uap) if (error) return error; - error = fcntl(p, &fa); + error = fcntl(&fa); if (error || SCARG(&fa, cmd) != F_GETLK) return error; @@ -635,7 +615,7 @@ svr4_sys_fcntl(p, uap) SCARG(&du, from) = SCARG(uap, fd); SCARG(&du, to) = (int)SCARG(uap, arg); - error = dup2(p, &du); + error = dup2(&du); if (error) return error; *retval = SCARG(&du, to); @@ -677,7 +657,7 @@ svr4_sys_fcntl(p, uap) if (error) return error; - error = fcntl(p, &fa); + error = fcntl(&fa); if (error || SCARG(&fa, cmd) != F_GETLK) return error; diff --git a/sys/emulation/svr4/svr4_filio.c b/sys/emulation/svr4/svr4_filio.c index a6ebb8326d..6d6401271f 100644 --- a/sys/emulation/svr4/svr4_filio.c +++ b/sys/emulation/svr4/svr4_filio.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_filio.c,v 1.8 2000/01/15 15:30:44 newton Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_filio.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_filio.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ #include @@ -52,9 +52,7 @@ /*#define GROTTY_READ_HACK*/ int -svr4_sys_poll(p, uap) - struct proc *p; - struct svr4_sys_poll_args *uap; +svr4_sys_poll(struct svr4_sys_poll_args *uap) { int error; struct poll_args pa; @@ -69,7 +67,7 @@ svr4_sys_poll(p, uap) siz = SCARG(uap, nfds) * sizeof(struct pollfd); pfd = (struct pollfd *)malloc(siz, M_TEMP, M_WAITOK); - error = poll(p, (struct poll_args *)uap); + error = poll((struct poll_args *)uap); if ((cerr = copyin(SCARG(uap, fds), pfd, siz)) != 0) { error = cerr; @@ -93,9 +91,7 @@ done: #if defined(READ_TEST) int -svr4_sys_read(p, uap) - struct proc *p; - struct svr4_sys_read_args *uap; +svr4_sys_read(struct svr4_sys_read_args *uap) { struct read_args ra; struct filedesc *fdp = p->p_fd; @@ -127,7 +123,7 @@ svr4_sys_read(p, uap) #endif } - rv = read(p, &ra); + rv = read(&ra); DPRINTF(("svr4_read(%d, 0x%0x, %d) = %d\n", SCARG(uap, fd), SCARG(uap, buf), SCARG(uap, nbyte), rv)); @@ -150,9 +146,7 @@ svr4_sys_read(p, uap) #if defined(BOGUS) int -svr4_sys_write(p, uap) - struct proc *p; - struct svr4_sys_write_args *uap; +svr4_sys_write(struct svr4_sys_write_args *uap) { struct write_args wa; struct filedesc *fdp; @@ -163,7 +157,7 @@ svr4_sys_write(p, uap) SCARG(&wa, buf) = SCARG(uap, buf); SCARG(&wa, nbyte) = SCARG(uap, nbyte); - rv = write(p, &wa); + rv = write(&wa); DPRINTF(("svr4_write(%d, 0x%0x, %d) = %d\n", SCARG(uap, fd), SCARG(uap, buf), SCARG(uap, nbyte), rv)); diff --git a/sys/emulation/svr4/svr4_ioctl.c b/sys/emulation/svr4/svr4_ioctl.c index f4463d2e16..e639e68834 100644 --- a/sys/emulation/svr4/svr4_ioctl.c +++ b/sys/emulation/svr4/svr4_ioctl.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_ioctl.c,v 1.6 1999/12/08 12:00:48 newton Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_ioctl.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_ioctl.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ #include @@ -79,10 +79,9 @@ svr4_decode_cmd(cmd, dir, c, num, argsiz) #endif int -svr4_sys_ioctl(p, uap) - register struct proc *p; - struct svr4_sys_ioctl_args *uap; +svr4_sys_ioctl(struct svr4_sys_ioctl_args *uap) { + struct proc *p = curproc; int *retval; struct file *fp; struct filedesc *fdp; diff --git a/sys/emulation/svr4/svr4_misc.c b/sys/emulation/svr4/svr4_misc.c index f11531ee83..361f469031 100644 --- a/sys/emulation/svr4/svr4_misc.c +++ b/sys/emulation/svr4/svr4_misc.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_misc.c,v 1.13.2.7 2003/01/14 21:33:58 dillon Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_misc.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_misc.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ /* @@ -95,15 +95,13 @@ #define BSD_DIRENT(cp) ((struct dirent *)(cp)) -static int svr4_mknod __P((struct proc *, register_t *, char *, - svr4_mode_t, svr4_dev_t)); +static int svr4_mknod __P((register_t *, char *, svr4_mode_t, svr4_dev_t)); static __inline clock_t timeval_to_clock_t __P((struct timeval *)); static int svr4_setinfo __P((struct proc *, int, svr4_siginfo_t *)); struct svr4_hrtcntl_args; -static int svr4_hrtcntl __P((struct proc *, struct svr4_hrtcntl_args *, - register_t *)); +static int svr4_hrtcntl __P((struct svr4_hrtcntl_args *, register_t *)); static void bsd_statfs_to_svr4_statvfs __P((const struct statfs *, struct svr4_statvfs *)); static void bsd_statfs_to_svr4_statvfs64 __P((const struct statfs *, @@ -113,9 +111,7 @@ static struct proc *svr4_pfind __P((pid_t pid)); /* BOGUS noop */ #if defined(BOGUS) int -svr4_sys_setitimer(p, uap) - register struct proc *p; - struct svr4_sys_setitimer_args *uap; +svr4_sys_setitimer(struct svr4_sys_setitimer_args *uap) { p->p_retval[0] = 0; return 0; @@ -123,10 +119,9 @@ svr4_sys_setitimer(p, uap) #endif int -svr4_sys_wait(p, uap) - struct proc *p; - struct svr4_sys_wait_args *uap; +svr4_sys_wait(struct svr4_sys_wait_args *uap) { + struct proc *p = curproc; struct wait_args w4; int error, *retval = p->p_retval, st, sig; size_t sz = sizeof(*SCARG(&w4, status)); @@ -144,7 +139,7 @@ svr4_sys_wait(p, uap) SCARG(&w4, pid) = WAIT_ANY; - if ((error = wait4(p, &w4)) != 0) + if ((error = wait4(&w4)) != 0) return error; if ((error = copyin(SCARG(&w4, status), &st, sizeof(st))) != 0) @@ -174,46 +169,41 @@ svr4_sys_wait(p, uap) } int -svr4_sys_execv(p, uap) - struct proc *p; - struct svr4_sys_execv_args *uap; +svr4_sys_execv(struct svr4_sys_execv_args *uap) { struct execve_args ap; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&ap, fname) = SCARG(uap, path); SCARG(&ap, argv) = SCARG(uap, argp); SCARG(&ap, envv) = NULL; - return execve(p, &ap); + return execve(&ap); } int -svr4_sys_execve(p, uap) - struct proc *p; - struct svr4_sys_execve_args *uap; +svr4_sys_execve(struct svr4_sys_execve_args *uap) { struct execve_args ap; caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(p, &sg, uap->path); + CHECKALTEXIST(&sg, uap->path); SCARG(&ap, fname) = SCARG(uap, path); SCARG(&ap, argv) = SCARG(uap, argp); SCARG(&ap, envv) = SCARG(uap, envp); - return execve(p, &ap); + return execve(&ap); } int -svr4_sys_time(p, v) - struct proc *p; - struct svr4_sys_time_args *v; +svr4_sys_time(struct svr4_sys_time_args *v) { + struct proc *p = curproc; struct svr4_sys_time_args *uap = v; int error = 0; struct timeval tv; @@ -237,11 +227,10 @@ svr4_sys_time(p, v) * to adapt the NetBSD version. */ int -svr4_sys_getdents64(p, uap) - struct proc *p; - struct svr4_sys_getdents64_args *uap; +svr4_sys_getdents64(struct svr4_sys_getdents64_args *uap) { - register struct dirent *bdp; + struct proc *p = curproc; + struct dirent *bdp; struct vnode *vp; caddr_t inp, buf; /* BSD-format */ int len, reclen; /* BSD-format */ @@ -409,10 +398,9 @@ out: int -svr4_sys_getdents(p, uap) - struct proc *p; - struct svr4_sys_getdents_args *uap; +svr4_sys_getdents(struct svr4_sys_getdents_args *uap) { + struct proc *p = curproc; struct dirent *bdp; struct vnode *vp; caddr_t inp, buf; /* BSD-format */ @@ -523,10 +511,9 @@ out: int -svr4_sys_mmap(p, uap) - struct proc *p; - struct svr4_sys_mmap_args *uap; +svr4_sys_mmap(struct svr4_sys_mmap_args *uap) { + struct proc *p = curproc; struct mmap_args mm; int *retval; @@ -548,14 +535,13 @@ svr4_sys_mmap(p, uap) SCARG(&mm, addr) = SCARG(uap, addr); SCARG(&mm, pos) = SCARG(uap, pos); - return mmap(p, &mm); + return mmap(&mm); } int -svr4_sys_mmap64(p, uap) - struct proc *p; - struct svr4_sys_mmap64_args *uap; +svr4_sys_mmap64(struct svr4_sys_mmap64_args *uap) { + struct proc *p = curproc; struct mmap_args mm; void *rp; @@ -581,21 +567,20 @@ svr4_sys_mmap64(p, uap) SCARG(&mm, addr) != 0 && (void *)SCARG(&mm, addr) < rp) SCARG(&mm, addr) = rp; - return mmap(p, &mm); + return mmap(&mm); } int -svr4_sys_fchroot(p, uap) - struct proc *p; - struct svr4_sys_fchroot_args *uap; +svr4_sys_fchroot(struct svr4_sys_fchroot_args *uap) { + struct proc *p = curproc; struct filedesc *fdp = p->p_fd; struct vnode *vp; struct file *fp; int error; - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return error; if ((error = getvnode(fdp, SCARG(uap, fd), &fp)) != 0) return error; @@ -617,8 +602,7 @@ svr4_sys_fchroot(p, uap) static int -svr4_mknod(p, retval, path, mode, dev) - struct proc *p; +svr4_mknod(retval, path, mode, dev) register_t *retval; char *path; svr4_mode_t mode; @@ -626,61 +610,55 @@ svr4_mknod(p, retval, path, mode, dev) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, path); + CHECKALTEXIST(&sg, path); if (S_ISFIFO(mode)) { struct mkfifo_args ap; SCARG(&ap, path) = path; SCARG(&ap, mode) = mode; - return mkfifo(p, &ap); + return mkfifo(&ap); } else { struct mknod_args ap; SCARG(&ap, path) = path; SCARG(&ap, mode) = mode; SCARG(&ap, dev) = dev; - return mknod(p, &ap); + return mknod(&ap); } } int -svr4_sys_mknod(p, uap) - register struct proc *p; - struct svr4_sys_mknod_args *uap; +svr4_sys_mknod(struct svr4_sys_mknod_args *uap) { + struct proc *p = curproc; + int *retval = p->p_retval; - return svr4_mknod(p, retval, - SCARG(uap, path), SCARG(uap, mode), + return svr4_mknod(retval, SCARG(uap, path), SCARG(uap, mode), (svr4_dev_t)svr4_to_bsd_odev_t(SCARG(uap, dev))); } int -svr4_sys_xmknod(p, uap) - struct proc *p; - struct svr4_sys_xmknod_args *uap; +svr4_sys_xmknod(struct svr4_sys_xmknod_args *uap) { + struct proc *p = curproc; int *retval = p->p_retval; - return svr4_mknod(p, retval, - SCARG(uap, path), SCARG(uap, mode), + return svr4_mknod(retval, SCARG(uap, path), SCARG(uap, mode), (svr4_dev_t)svr4_to_bsd_dev_t(SCARG(uap, dev))); } int -svr4_sys_vhangup(p, uap) - struct proc *p; - struct svr4_sys_vhangup_args *uap; +svr4_sys_vhangup(struct svr4_sys_vhangup_args *uap) { return 0; } int -svr4_sys_sysconfig(p, uap) - struct proc *p; - struct svr4_sys_sysconfig_args *uap; +svr4_sys_sysconfig(struct svr4_sys_sysconfig_args *uap) { + struct proc *p = curproc; int *retval; retval = &(p->p_retval[0]); @@ -779,10 +757,9 @@ extern int swap_pager_full; /* ARGSUSED */ int -svr4_sys_break(p, uap) - struct proc *p; - struct svr4_sys_break_args *uap; +svr4_sys_break(struct svr4_sys_break_args *uap) { + struct proc *p = curproc; struct vmspace *vm = p->p_vmspace; vm_offset_t new, old, base, ns; int rv; @@ -839,10 +816,9 @@ timeval_to_clock_t(tv) int -svr4_sys_times(p, uap) - struct proc *p; - struct svr4_sys_times_args *uap; +svr4_sys_times(struct svr4_sys_times_args *uap) { + struct proc *p = curproc; int error, *retval = p->p_retval; struct tms tms; struct timeval t; @@ -856,7 +832,7 @@ svr4_sys_times(p, uap) SCARG(&ga, who) = RUSAGE_SELF; SCARG(&ga, rusage) = ru; - error = getrusage(p, &ga); + error = getrusage(&ga); if (error) return error; @@ -867,7 +843,7 @@ svr4_sys_times(p, uap) tms.tms_stime = timeval_to_clock_t(&r.ru_stime); SCARG(&ga, who) = RUSAGE_CHILDREN; - error = getrusage(p, &ga); + error = getrusage(&ga); if (error) return error; @@ -885,10 +861,9 @@ svr4_sys_times(p, uap) int -svr4_sys_ulimit(p, uap) - struct proc *p; - struct svr4_sys_ulimit_args *uap; +svr4_sys_ulimit(struct svr4_sys_ulimit_args *uap) { + struct proc *p = curproc; int *retval = p->p_retval; switch (SCARG(uap, cmd)) { @@ -917,7 +892,7 @@ svr4_sys_ulimit(p, uap) SCARG(&srl, which) = RLIMIT_FSIZE; SCARG(&srl, rlp) = (struct orlimit *)url; - error = setrlimit(p, &srl); + error = setrlimit(&srl); if (error) return error; @@ -972,10 +947,9 @@ svr4_pfind(pid) int -svr4_sys_pgrpsys(p, uap) - struct proc *p; - struct svr4_sys_pgrpsys_args *uap; +svr4_sys_pgrpsys(struct svr4_sys_pgrpsys_args *uap) { + struct proc *p = curproc; int *retval = p->p_retval; switch (SCARG(uap, cmd)) { @@ -987,7 +961,7 @@ svr4_sys_pgrpsys(p, uap) * setsid() for SVR4. (Under BSD, the difference is that * a setpgid(0,0) will not create a new session.) */ - setsid(p, NULL); + setsid(NULL); /*FALLTHROUGH*/ case 0: /* getpgrp() */ @@ -1006,7 +980,7 @@ svr4_sys_pgrpsys(p, uap) return 0; case 3: /* setsid() */ - return setsid(p, NULL); + return setsid(NULL); case 4: /* getpgid(pid) */ @@ -1023,7 +997,7 @@ svr4_sys_pgrpsys(p, uap) SCARG(&sa, pid) = SCARG(uap, pid); SCARG(&sa, pgid) = SCARG(uap, pgid); - return setpgid(p, &sa); + return setpgid(&sa); } default: @@ -1043,10 +1017,7 @@ struct svr4_hrtcntl_args { static int -svr4_hrtcntl(p, uap, retval) - struct proc *p; - struct svr4_hrtcntl_args *uap; - register_t *retval; +svr4_hrtcntl(struct svr4_hrtcntl_args *uap, register_t *retval) { switch (SCARG(uap, fun)) { case SVR4_HRT_CNTL_RES: @@ -1089,16 +1060,14 @@ svr4_hrtcntl(p, uap, retval) int -svr4_sys_hrtsys(p, uap) - struct proc *p; - struct svr4_sys_hrtsys_args *uap; +svr4_sys_hrtsys(struct svr4_sys_hrtsys_args *uap) { + struct proc *p = curproc; int *retval = p->p_retval; switch (SCARG(uap, cmd)) { case SVR4_HRT_CNTL: - return svr4_hrtcntl(p, (struct svr4_hrtcntl_args *) uap, - retval); + return svr4_hrtcntl((struct svr4_hrtcntl_args *) uap, retval); case SVR4_HRT_ALRM: DPRINTF(("hrtalarm\n")); @@ -1176,10 +1145,9 @@ svr4_setinfo(p, st, s) int -svr4_sys_waitsys(p, uap) - struct proc *p; - struct svr4_sys_waitsys_args *uap; +svr4_sys_waitsys(struct svr4_sys_waitsys_args *uap) { + struct proc *p = curproc; int nfound; int error, *retval = p->p_retval; struct proc *q, *t; @@ -1270,10 +1238,8 @@ loop: /* * Free up credentials. */ - if (--q->p_cred->p_refcnt == 0) { - crfree(q->p_ucred); - FREE(q->p_cred, M_SUBPROC); - } + crfree(q->p_ucred); + q->p_ucred = NULL; /* * Release reference to text vnode @@ -1375,9 +1341,7 @@ bsd_statfs_to_svr4_statvfs64(bfs, sfs) int -svr4_sys_statvfs(p, uap) - struct proc *p; - struct svr4_sys_statvfs_args *uap; +svr4_sys_statvfs(struct svr4_sys_statvfs_args *uap) { struct statfs_args fs_args; caddr_t sg = stackgap_init(); @@ -1386,11 +1350,11 @@ svr4_sys_statvfs(p, uap) struct svr4_statvfs sfs; int error; - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&fs_args, path) = SCARG(uap, path); SCARG(&fs_args, buf) = fs; - if ((error = statfs(p, &fs_args)) != 0) + if ((error = statfs(&fs_args)) != 0) return error; if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0) @@ -1403,9 +1367,7 @@ svr4_sys_statvfs(p, uap) int -svr4_sys_fstatvfs(p, uap) - struct proc *p; - struct svr4_sys_fstatvfs_args *uap; +svr4_sys_fstatvfs(struct svr4_sys_fstatvfs_args *uap) { struct fstatfs_args fs_args; caddr_t sg = stackgap_init(); @@ -1417,7 +1379,7 @@ svr4_sys_fstatvfs(p, uap) SCARG(&fs_args, fd) = SCARG(uap, fd); SCARG(&fs_args, buf) = fs; - if ((error = fstatfs(p, &fs_args)) != 0) + if ((error = fstatfs(&fs_args)) != 0) return error; if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0) @@ -1430,9 +1392,7 @@ svr4_sys_fstatvfs(p, uap) int -svr4_sys_statvfs64(p, uap) - struct proc *p; - struct svr4_sys_statvfs64_args *uap; +svr4_sys_statvfs64(struct svr4_sys_statvfs64_args *uap) { struct statfs_args fs_args; caddr_t sg = stackgap_init(); @@ -1441,11 +1401,11 @@ svr4_sys_statvfs64(p, uap) struct svr4_statvfs64 sfs; int error; - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&fs_args, path) = SCARG(uap, path); SCARG(&fs_args, buf) = fs; - if ((error = statfs(p, &fs_args)) != 0) + if ((error = statfs(&fs_args)) != 0) return error; if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0) @@ -1458,9 +1418,7 @@ svr4_sys_statvfs64(p, uap) int -svr4_sys_fstatvfs64(p, uap) - struct proc *p; - struct svr4_sys_fstatvfs64_args *uap; +svr4_sys_fstatvfs64(struct svr4_sys_fstatvfs64_args *uap) { struct fstatfs_args fs_args; caddr_t sg = stackgap_init(); @@ -1472,7 +1430,7 @@ svr4_sys_fstatvfs64(p, uap) SCARG(&fs_args, fd) = SCARG(uap, fd); SCARG(&fs_args, buf) = fs; - if ((error = fstatfs(p, &fs_args)) != 0) + if ((error = fstatfs(&fs_args)) != 0) return error; if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0) @@ -1484,10 +1442,9 @@ svr4_sys_fstatvfs64(p, uap) } int -svr4_sys_alarm(p, uap) - struct proc *p; - struct svr4_sys_alarm_args *uap; +svr4_sys_alarm(struct svr4_sys_alarm_args *uap) { + struct proc *p = curproc; int error; struct itimerval *itp, *oitp; struct setitimer_args sa; @@ -1502,7 +1459,7 @@ svr4_sys_alarm(p, uap) SCARG(&sa, which) = ITIMER_REAL; SCARG(&sa, itv) = itp; SCARG(&sa, oitv) = oitp; - error = setitimer(p, &sa); + error = setitimer(&sa); if (error) return error; if (oitp->it_value.tv_usec) @@ -1513,9 +1470,7 @@ svr4_sys_alarm(p, uap) } int -svr4_sys_gettimeofday(p, uap) - struct proc *p; - struct svr4_sys_gettimeofday_args *uap; +svr4_sys_gettimeofday(struct svr4_sys_gettimeofday_args *uap) { if (SCARG(uap, tp)) { struct timeval atv; @@ -1528,10 +1483,9 @@ svr4_sys_gettimeofday(p, uap) } int -svr4_sys_facl(p, uap) - struct proc *p; - struct svr4_sys_facl_args *uap; +svr4_sys_facl(struct svr4_sys_facl_args *uap) { + struct proc *p = curproc; int *retval; retval = p->p_retval; @@ -1556,18 +1510,14 @@ svr4_sys_facl(p, uap) int -svr4_sys_acl(p, uap) - struct proc *p; - struct svr4_sys_acl_args *uap; +svr4_sys_acl(struct svr4_sys_acl_args *uap) { /* XXX: for now the same */ - return svr4_sys_facl(p, (struct svr4_sys_facl_args *)uap); + return svr4_sys_facl((struct svr4_sys_facl_args *)uap); } int -svr4_sys_auditsys(p, uap) - struct proc *p; - struct svr4_sys_auditsys_args *uap; +svr4_sys_auditsys(struct svr4_sys_auditsys_args *uap) { /* * XXX: Big brother is *not* watching. @@ -1576,9 +1526,7 @@ svr4_sys_auditsys(p, uap) } int -svr4_sys_memcntl(p, uap) - struct proc *p; - struct svr4_sys_memcntl_args *uap; +svr4_sys_memcntl(struct svr4_sys_memcntl_args *uap) { switch (SCARG(uap, cmd)) { case SVR4_MC_SYNC: @@ -1589,7 +1537,7 @@ svr4_sys_memcntl(p, uap) SCARG(&msa, len) = SCARG(uap, len); SCARG(&msa, flags) = (int)SCARG(uap, arg); - return msync(p, &msa); + return msync(&msa); } case SVR4_MC_ADVISE: { @@ -1599,7 +1547,7 @@ svr4_sys_memcntl(p, uap) SCARG(&maa, len) = SCARG(uap, len); SCARG(&maa, behav) = (int)SCARG(uap, arg); - return madvise(p, &maa); + return madvise(&maa); } case SVR4_MC_LOCK: case SVR4_MC_UNLOCK: @@ -1613,9 +1561,7 @@ svr4_sys_memcntl(p, uap) int -svr4_sys_nice(p, uap) - struct proc *p; - struct svr4_sys_nice_args *uap; +svr4_sys_nice(struct svr4_sys_nice_args *uap) { struct setpriority_args ap; int error; @@ -1624,21 +1570,20 @@ svr4_sys_nice(p, uap) SCARG(&ap, who) = 0; SCARG(&ap, prio) = SCARG(uap, prio); - if ((error = setpriority(p, &ap)) != 0) + if ((error = setpriority(&ap)) != 0) return error; /* the cast is stupid, but the structures are the same */ - if ((error = getpriority(p, (struct getpriority_args *)&ap)) != 0) + if ((error = getpriority((struct getpriority_args *)&ap)) != 0) return error; return 0; } int -svr4_sys_resolvepath(p, uap) - struct proc *p; - struct svr4_sys_resolvepath_args *uap; +svr4_sys_resolvepath(struct svr4_sys_resolvepath_args *uap) { + struct proc *p = curproc; struct nameidata nd; int error, *retval = p->p_retval; diff --git a/sys/emulation/svr4/svr4_proto.h b/sys/emulation/svr4/svr4_proto.h index ce745e99d9..0ea17ca254 100644 --- a/sys/emulation/svr4/svr4_proto.h +++ b/sys/emulation/svr4/svr4_proto.h @@ -2,9 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/svr4/svr4_proto.h,v 1.6.2.4 2001/10/05 07:38:44 peter Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_proto.h,v 1.2 2003/06/17 04:28:57 dillon Exp $ - * created from FreeBSD: src/sys/svr4/syscalls.master,v 1.6.2.2 2001/10/05 07:34:37 peter Exp + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_proto.h,v 1.3 2003/06/23 17:55:49 dillon Exp $ + * created from TurtleBSD: src/sys/svr4/syscalls.master,v 1.2 2003/06/17 04:28:58 dillon Exp */ #ifndef _SVR4_SYSPROTO_H_ @@ -14,8 +13,6 @@ #include -struct proc; - #define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ 0 : sizeof(register_t) - sizeof(t)) @@ -382,86 +379,86 @@ struct svr4_sys_sendto_args { struct sockaddr * to; char to_[PAD_(struct sockaddr *)]; int tolen; char tolen_[PAD_(int)]; }; -int svr4_sys_open __P((struct proc *, struct svr4_sys_open_args *)); -int svr4_sys_wait __P((struct proc *, struct svr4_sys_wait_args *)); -int svr4_sys_creat __P((struct proc *, struct svr4_sys_creat_args *)); -int svr4_sys_execv __P((struct proc *, struct svr4_sys_execv_args *)); -int svr4_sys_time __P((struct proc *, struct svr4_sys_time_args *)); -int svr4_sys_mknod __P((struct proc *, struct svr4_sys_mknod_args *)); -int svr4_sys_break __P((struct proc *, struct svr4_sys_break_args *)); -int svr4_sys_stat __P((struct proc *, struct svr4_sys_stat_args *)); -int svr4_sys_alarm __P((struct proc *, struct svr4_sys_alarm_args *)); -int svr4_sys_fstat __P((struct proc *, struct svr4_sys_fstat_args *)); -int svr4_sys_pause __P((struct proc *, struct svr4_sys_pause_args *)); -int svr4_sys_utime __P((struct proc *, struct svr4_sys_utime_args *)); -int svr4_sys_access __P((struct proc *, struct svr4_sys_access_args *)); -int svr4_sys_nice __P((struct proc *, struct svr4_sys_nice_args *)); -int svr4_sys_kill __P((struct proc *, struct svr4_sys_kill_args *)); -int svr4_sys_pgrpsys __P((struct proc *, struct svr4_sys_pgrpsys_args *)); -int svr4_sys_times __P((struct proc *, struct svr4_sys_times_args *)); -int svr4_sys_signal __P((struct proc *, struct svr4_sys_signal_args *)); +int svr4_sys_open __P((struct svr4_sys_open_args *)); +int svr4_sys_wait __P((struct svr4_sys_wait_args *)); +int svr4_sys_creat __P((struct svr4_sys_creat_args *)); +int svr4_sys_execv __P((struct svr4_sys_execv_args *)); +int svr4_sys_time __P((struct svr4_sys_time_args *)); +int svr4_sys_mknod __P((struct svr4_sys_mknod_args *)); +int svr4_sys_break __P((struct svr4_sys_break_args *)); +int svr4_sys_stat __P((struct svr4_sys_stat_args *)); +int svr4_sys_alarm __P((struct svr4_sys_alarm_args *)); +int svr4_sys_fstat __P((struct svr4_sys_fstat_args *)); +int svr4_sys_pause __P((struct svr4_sys_pause_args *)); +int svr4_sys_utime __P((struct svr4_sys_utime_args *)); +int svr4_sys_access __P((struct svr4_sys_access_args *)); +int svr4_sys_nice __P((struct svr4_sys_nice_args *)); +int svr4_sys_kill __P((struct svr4_sys_kill_args *)); +int svr4_sys_pgrpsys __P((struct svr4_sys_pgrpsys_args *)); +int svr4_sys_times __P((struct svr4_sys_times_args *)); +int svr4_sys_signal __P((struct svr4_sys_signal_args *)); #if defined(NOTYET) -int svr4_sys_msgsys __P((struct proc *, struct svr4_sys_msgsys_args *)); +int svr4_sys_msgsys __P((struct svr4_sys_msgsys_args *)); #else #endif -int svr4_sys_sysarch __P((struct proc *, struct svr4_sys_sysarch_args *)); -int svr4_sys_ioctl __P((struct proc *, struct svr4_sys_ioctl_args *)); -int svr4_sys_utssys __P((struct proc *, struct svr4_sys_utssys_args *)); -int svr4_sys_execve __P((struct proc *, struct svr4_sys_execve_args *)); -int svr4_sys_fcntl __P((struct proc *, struct svr4_sys_fcntl_args *)); -int svr4_sys_ulimit __P((struct proc *, struct svr4_sys_ulimit_args *)); -int svr4_sys_getdents __P((struct proc *, struct svr4_sys_getdents_args *)); -int svr4_sys_getmsg __P((struct proc *, struct svr4_sys_getmsg_args *)); -int svr4_sys_putmsg __P((struct proc *, struct svr4_sys_putmsg_args *)); -int svr4_sys_poll __P((struct proc *, struct svr4_sys_poll_args *)); -int svr4_sys_lstat __P((struct proc *, struct svr4_sys_lstat_args *)); -int svr4_sys_sigprocmask __P((struct proc *, struct svr4_sys_sigprocmask_args *)); -int svr4_sys_sigsuspend __P((struct proc *, struct svr4_sys_sigsuspend_args *)); -int svr4_sys_sigaltstack __P((struct proc *, struct svr4_sys_sigaltstack_args *)); -int svr4_sys_sigaction __P((struct proc *, struct svr4_sys_sigaction_args *)); -int svr4_sys_sigpending __P((struct proc *, struct svr4_sys_sigpending_args *)); -int svr4_sys_context __P((struct proc *, struct svr4_sys_context_args *)); -int svr4_sys_statvfs __P((struct proc *, struct svr4_sys_statvfs_args *)); -int svr4_sys_fstatvfs __P((struct proc *, struct svr4_sys_fstatvfs_args *)); -int svr4_sys_waitsys __P((struct proc *, struct svr4_sys_waitsys_args *)); -int svr4_sys_hrtsys __P((struct proc *, struct svr4_sys_hrtsys_args *)); -int svr4_sys_pathconf __P((struct proc *, struct svr4_sys_pathconf_args *)); -int svr4_sys_mmap __P((struct proc *, struct svr4_sys_mmap_args *)); -int svr4_sys_fpathconf __P((struct proc *, struct svr4_sys_fpathconf_args *)); -int svr4_sys_xstat __P((struct proc *, struct svr4_sys_xstat_args *)); -int svr4_sys_lxstat __P((struct proc *, struct svr4_sys_lxstat_args *)); -int svr4_sys_fxstat __P((struct proc *, struct svr4_sys_fxstat_args *)); -int svr4_sys_xmknod __P((struct proc *, struct svr4_sys_xmknod_args *)); -int svr4_sys_setrlimit __P((struct proc *, struct svr4_sys_setrlimit_args *)); -int svr4_sys_getrlimit __P((struct proc *, struct svr4_sys_getrlimit_args *)); -int svr4_sys_memcntl __P((struct proc *, struct svr4_sys_memcntl_args *)); -int svr4_sys_uname __P((struct proc *, struct svr4_sys_uname_args *)); -int svr4_sys_sysconfig __P((struct proc *, struct svr4_sys_sysconfig_args *)); -int svr4_sys_systeminfo __P((struct proc *, struct svr4_sys_systeminfo_args *)); -int svr4_sys_fchroot __P((struct proc *, struct svr4_sys_fchroot_args *)); -int svr4_sys_utimes __P((struct proc *, struct svr4_sys_utimes_args *)); -int svr4_sys_vhangup __P((struct proc *, struct svr4_sys_vhangup_args *)); -int svr4_sys_gettimeofday __P((struct proc *, struct svr4_sys_gettimeofday_args *)); -int svr4_sys_llseek __P((struct proc *, struct svr4_sys_llseek_args *)); -int svr4_sys_acl __P((struct proc *, struct svr4_sys_acl_args *)); -int svr4_sys_auditsys __P((struct proc *, struct svr4_sys_auditsys_args *)); -int svr4_sys_facl __P((struct proc *, struct svr4_sys_facl_args *)); -int svr4_sys_resolvepath __P((struct proc *, struct svr4_sys_resolvepath_args *)); -int svr4_sys_getdents64 __P((struct proc *, struct svr4_sys_getdents64_args *)); -int svr4_sys_mmap64 __P((struct proc *, struct svr4_sys_mmap64_args *)); -int svr4_sys_stat64 __P((struct proc *, struct svr4_sys_stat64_args *)); -int svr4_sys_lstat64 __P((struct proc *, struct svr4_sys_lstat64_args *)); -int svr4_sys_fstat64 __P((struct proc *, struct svr4_sys_fstat64_args *)); -int svr4_sys_statvfs64 __P((struct proc *, struct svr4_sys_statvfs64_args *)); -int svr4_sys_fstatvfs64 __P((struct proc *, struct svr4_sys_fstatvfs64_args *)); -int svr4_sys_setrlimit64 __P((struct proc *, struct svr4_sys_setrlimit64_args *)); -int svr4_sys_getrlimit64 __P((struct proc *, struct svr4_sys_getrlimit64_args *)); -int svr4_sys_creat64 __P((struct proc *, struct svr4_sys_creat64_args *)); -int svr4_sys_open64 __P((struct proc *, struct svr4_sys_open64_args *)); -int svr4_sys_socket __P((struct proc *, struct svr4_sys_socket_args *)); -int svr4_sys_recv __P((struct proc *, struct svr4_sys_recv_args *)); -int svr4_sys_send __P((struct proc *, struct svr4_sys_send_args *)); -int svr4_sys_sendto __P((struct proc *, struct svr4_sys_sendto_args *)); +int svr4_sys_sysarch __P((struct svr4_sys_sysarch_args *)); +int svr4_sys_ioctl __P((struct svr4_sys_ioctl_args *)); +int svr4_sys_utssys __P((struct svr4_sys_utssys_args *)); +int svr4_sys_execve __P((struct svr4_sys_execve_args *)); +int svr4_sys_fcntl __P((struct svr4_sys_fcntl_args *)); +int svr4_sys_ulimit __P((struct svr4_sys_ulimit_args *)); +int svr4_sys_getdents __P((struct svr4_sys_getdents_args *)); +int svr4_sys_getmsg __P((struct svr4_sys_getmsg_args *)); +int svr4_sys_putmsg __P((struct svr4_sys_putmsg_args *)); +int svr4_sys_poll __P((struct svr4_sys_poll_args *)); +int svr4_sys_lstat __P((struct svr4_sys_lstat_args *)); +int svr4_sys_sigprocmask __P((struct svr4_sys_sigprocmask_args *)); +int svr4_sys_sigsuspend __P((struct svr4_sys_sigsuspend_args *)); +int svr4_sys_sigaltstack __P((struct svr4_sys_sigaltstack_args *)); +int svr4_sys_sigaction __P((struct svr4_sys_sigaction_args *)); +int svr4_sys_sigpending __P((struct svr4_sys_sigpending_args *)); +int svr4_sys_context __P((struct svr4_sys_context_args *)); +int svr4_sys_statvfs __P((struct svr4_sys_statvfs_args *)); +int svr4_sys_fstatvfs __P((struct svr4_sys_fstatvfs_args *)); +int svr4_sys_waitsys __P((struct svr4_sys_waitsys_args *)); +int svr4_sys_hrtsys __P((struct svr4_sys_hrtsys_args *)); +int svr4_sys_pathconf __P((struct svr4_sys_pathconf_args *)); +int svr4_sys_mmap __P((struct svr4_sys_mmap_args *)); +int svr4_sys_fpathconf __P((struct svr4_sys_fpathconf_args *)); +int svr4_sys_xstat __P((struct svr4_sys_xstat_args *)); +int svr4_sys_lxstat __P((struct svr4_sys_lxstat_args *)); +int svr4_sys_fxstat __P((struct svr4_sys_fxstat_args *)); +int svr4_sys_xmknod __P((struct svr4_sys_xmknod_args *)); +int svr4_sys_setrlimit __P((struct svr4_sys_setrlimit_args *)); +int svr4_sys_getrlimit __P((struct svr4_sys_getrlimit_args *)); +int svr4_sys_memcntl __P((struct svr4_sys_memcntl_args *)); +int svr4_sys_uname __P((struct svr4_sys_uname_args *)); +int svr4_sys_sysconfig __P((struct svr4_sys_sysconfig_args *)); +int svr4_sys_systeminfo __P((struct svr4_sys_systeminfo_args *)); +int svr4_sys_fchroot __P((struct svr4_sys_fchroot_args *)); +int svr4_sys_utimes __P((struct svr4_sys_utimes_args *)); +int svr4_sys_vhangup __P((struct svr4_sys_vhangup_args *)); +int svr4_sys_gettimeofday __P((struct svr4_sys_gettimeofday_args *)); +int svr4_sys_llseek __P((struct svr4_sys_llseek_args *)); +int svr4_sys_acl __P((struct svr4_sys_acl_args *)); +int svr4_sys_auditsys __P((struct svr4_sys_auditsys_args *)); +int svr4_sys_facl __P((struct svr4_sys_facl_args *)); +int svr4_sys_resolvepath __P((struct svr4_sys_resolvepath_args *)); +int svr4_sys_getdents64 __P((struct svr4_sys_getdents64_args *)); +int svr4_sys_mmap64 __P((struct svr4_sys_mmap64_args *)); +int svr4_sys_stat64 __P((struct svr4_sys_stat64_args *)); +int svr4_sys_lstat64 __P((struct svr4_sys_lstat64_args *)); +int svr4_sys_fstat64 __P((struct svr4_sys_fstat64_args *)); +int svr4_sys_statvfs64 __P((struct svr4_sys_statvfs64_args *)); +int svr4_sys_fstatvfs64 __P((struct svr4_sys_fstatvfs64_args *)); +int svr4_sys_setrlimit64 __P((struct svr4_sys_setrlimit64_args *)); +int svr4_sys_getrlimit64 __P((struct svr4_sys_getrlimit64_args *)); +int svr4_sys_creat64 __P((struct svr4_sys_creat64_args *)); +int svr4_sys_open64 __P((struct svr4_sys_open64_args *)); +int svr4_sys_socket __P((struct svr4_sys_socket_args *)); +int svr4_sys_recv __P((struct svr4_sys_recv_args *)); +int svr4_sys_send __P((struct svr4_sys_send_args *)); +int svr4_sys_sendto __P((struct svr4_sys_sendto_args *)); #ifdef COMPAT_43 diff --git a/sys/emulation/svr4/svr4_resource.c b/sys/emulation/svr4/svr4_resource.c index 3417b36355..08800c1d15 100644 --- a/sys/emulation/svr4/svr4_resource.c +++ b/sys/emulation/svr4/svr4_resource.c @@ -40,7 +40,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_resource.c,v 1.4.2.1 2002/09/02 21:22:54 dillon Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_resource.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_resource.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ /* @@ -128,10 +128,9 @@ svr4_to_native_rl(rl) ((svr4_rlim64_t)(l)) != SVR4_RLIM64_SAVED_MAX) int -svr4_sys_getrlimit(p, uap) - register struct proc *p; - struct svr4_sys_getrlimit_args *uap; +svr4_sys_getrlimit(struct svr4_sys_getrlimit_args *uap) { + struct proc *p = curproc; int rl = svr4_to_native_rl(SCARG(uap, which)); struct rlimit blim; struct svr4_rlimit slim; @@ -173,10 +172,9 @@ svr4_sys_getrlimit(p, uap) int -svr4_sys_setrlimit(p, uap) - register struct proc *p; - struct svr4_sys_setrlimit_args *uap; +svr4_sys_setrlimit(struct svr4_sys_setrlimit_args *uap) { + struct proc *p = curproc; int rl = svr4_to_native_rl(SCARG(uap, which)); struct rlimit blim, *limp; struct svr4_rlimit slim; @@ -217,15 +215,14 @@ svr4_sys_setrlimit(p, uap) else if (slim.rlim_cur == SVR4_RLIM_SAVED_CUR) blim.rlim_cur = limp->rlim_cur; - return dosetrlimit(p, rl, &blim); + return dosetrlimit(rl, &blim); } int -svr4_sys_getrlimit64(p, uap) - register struct proc *p; - struct svr4_sys_getrlimit64_args *uap; +svr4_sys_getrlimit64(struct svr4_sys_getrlimit64_args *uap) { + struct proc *p = curproc; int rl = svr4_to_native_rl(SCARG(uap, which)); struct rlimit blim; struct svr4_rlimit64 slim; @@ -267,10 +264,9 @@ svr4_sys_getrlimit64(p, uap) int -svr4_sys_setrlimit64(p, uap) - register struct proc *p; - struct svr4_sys_setrlimit64_args *uap; +svr4_sys_setrlimit64(struct svr4_sys_setrlimit64_args *uap) { + struct proc *p = curproc; int rl = svr4_to_native_rl(SCARG(uap, which)); struct rlimit blim, *limp; struct svr4_rlimit64 slim; @@ -311,5 +307,5 @@ svr4_sys_setrlimit64(p, uap) else if (slim.rlim_cur == SVR4_RLIM64_SAVED_CUR) blim.rlim_cur = limp->rlim_cur; - return dosetrlimit(p, rl, &blim); + return dosetrlimit(rl, &blim); } diff --git a/sys/emulation/svr4/svr4_signal.c b/sys/emulation/svr4/svr4_signal.c index f15e882da2..04f31e5c5b 100644 --- a/sys/emulation/svr4/svr4_signal.c +++ b/sys/emulation/svr4/svr4_signal.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_signal.c,v 1.9 2000/01/15 15:38:17 newton Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_signal.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_signal.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ #include @@ -257,9 +257,7 @@ bsd_to_svr4_sigaltstack(bss, sss) } int -svr4_sys_sigaction(p, uap) - register struct proc *p; - struct svr4_sys_sigaction_args *uap; +svr4_sys_sigaction(struct svr4_sys_sigaction_args *uap) { struct svr4_sigaction *nisa, *oisa, tmpisa; struct sigaction *nbsa, *obsa, tmpbsa; @@ -304,7 +302,7 @@ svr4_sys_sigaction(p, uap) SCARG(&sa, act) = nbsa; SCARG(&sa, oact) = obsa; - if ((error = sigaction(p, &sa)) != 0) + if ((error = sigaction(&sa)) != 0) return error; if (oisa != NULL) { @@ -319,10 +317,9 @@ svr4_sys_sigaction(p, uap) } int -svr4_sys_sigaltstack(p, uap) - register struct proc *p; - struct svr4_sys_sigaltstack_args *uap; +svr4_sys_sigaltstack(struct svr4_sys_sigaltstack_args *uap) { + struct proc *p = curproc; struct svr4_sigaltstack *nsss, *osss, tmpsss; struct sigaltstack *nbss, *obss, tmpbss; struct sigaltstack_args sa; @@ -352,7 +349,7 @@ svr4_sys_sigaltstack(p, uap) SCARG(&sa, ss) = nbss; SCARG(&sa, oss) = obss; - if ((error = sigaltstack(p, &sa)) != 0) + if ((error = sigaltstack(&sa)) != 0) return error; if (obss != NULL) { @@ -370,10 +367,9 @@ svr4_sys_sigaltstack(p, uap) * Stolen from the ibcs2 one */ int -svr4_sys_signal(p, uap) - register struct proc *p; - struct svr4_sys_signal_args *uap; +svr4_sys_signal(struct svr4_sys_signal_args *uap) { + struct proc *p = curproc; int signum; int error, *retval = p->p_retval; caddr_t sg = stackgap_init(); @@ -410,7 +406,7 @@ svr4_sys_signal(p, uap) if ((error = copyout(&sa, nbsa, sizeof(sa))) != 0) return error; - if ((error = sigaction(p, &sa_args)) != 0) { + if ((error = sigaction(&sa_args)) != 0) { DPRINTF(("signal: sigaction failed: %d\n", error)); *retval = (int)SVR4_SIG_ERR; @@ -434,7 +430,7 @@ sighold: SCARG(&sa, how) = SIG_BLOCK; SCARG(&sa, set) = set; SCARG(&sa, oset) = NULL; - return sigprocmask(p, &sa); + return sigprocmask(&sa); } case SVR4_SIGRELSE_MASK: @@ -448,7 +444,7 @@ sighold: SCARG(&sa, how) = SIG_UNBLOCK; SCARG(&sa, set) = set; SCARG(&sa, oset) = NULL; - return sigprocmask(p, &sa); + return sigprocmask(&sa); } case SVR4_SIGIGNORE_MASK: @@ -466,7 +462,7 @@ sighold: sa.sa_flags = 0; if ((error = copyout(&sa, bsa, sizeof(sa))) != 0) return error; - if ((error = sigaction(p, &sa_args)) != 0) { + if ((error = sigaction(&sa_args)) != 0) { DPRINTF(("sigignore: sigaction failed\n")); return error; } @@ -482,7 +478,7 @@ sighold: *set = p->p_sigmask; SIGDELSET(*set, signum); SCARG(&sa, sigmask) = set; - return sigsuspend(p, &sa); + return sigsuspend(&sa); } default: @@ -492,10 +488,9 @@ sighold: int -svr4_sys_sigprocmask(p, uap) - struct proc *p; - struct svr4_sys_sigprocmask_args *uap; +svr4_sys_sigprocmask(struct svr4_sys_sigprocmask_args *uap) { + struct proc *p = curproc; svr4_sigset_t sss; sigset_t bss; int error = 0, *retval; @@ -545,10 +540,9 @@ svr4_sys_sigprocmask(p, uap) } int -svr4_sys_sigpending(p, uap) - struct proc *p; - struct svr4_sys_sigpending_args *uap; +svr4_sys_sigpending(struct svr4_sys_sigpending_args *uap) { + struct proc *p = curproc; sigset_t bss; int *retval; svr4_sigset_t sss; @@ -583,9 +577,7 @@ svr4_sys_sigpending(p, uap) } int -svr4_sys_sigsuspend(p, uap) - register struct proc *p; - struct svr4_sys_sigsuspend_args *uap; +svr4_sys_sigsuspend(struct svr4_sys_sigsuspend_args *uap) { svr4_sigset_t sss; sigset_t *bss; @@ -600,28 +592,25 @@ svr4_sys_sigsuspend(p, uap) svr4_to_bsd_sigset(&sss, bss); SCARG(&sa, sigmask) = bss; - return sigsuspend(p, &sa); + return sigsuspend(&sa); } int -svr4_sys_kill(p, uap) - register struct proc *p; - struct svr4_sys_kill_args *uap; +svr4_sys_kill(struct svr4_sys_kill_args *uap) { struct kill_args ka; SCARG(&ka, pid) = SCARG(uap, pid); SCARG(&ka, signum) = SVR4_SVR42BSD_SIG(SCARG(uap, signum)); - return kill(p, &ka); + return kill(&ka); } int -svr4_sys_context(p, uap) - register struct proc *p; - struct svr4_sys_context_args *uap; +svr4_sys_context(struct svr4_sys_context_args *uap) { + struct proc *p = curproc; struct svr4_ucontext uc; int error; @@ -656,12 +645,11 @@ svr4_sys_context(p, uap) } int -svr4_sys_pause(p, uap) - register struct proc *p; - struct svr4_sys_pause_args *uap; +svr4_sys_pause(struct svr4_sys_pause_args *uap) { + struct proc *p = curproc; struct sigsuspend_args bsa; SCARG(&bsa, sigmask) = &p->p_sigmask; - return sigsuspend(p, &bsa); + return sigsuspend(&bsa); } diff --git a/sys/emulation/svr4/svr4_socket.c b/sys/emulation/svr4/svr4_socket.c index 601ce72a8e..74a52e1c57 100644 --- a/sys/emulation/svr4/svr4_socket.c +++ b/sys/emulation/svr4/svr4_socket.c @@ -29,7 +29,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_socket.c,v 1.7 1999/12/08 12:00:48 newton Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_socket.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_socket.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ /* @@ -153,9 +153,7 @@ svr4_add_socket(p, path, st) int -svr4_sys_socket(p, uap) - struct proc *p; - struct svr4_sys_socket_args *uap; +svr4_sys_socket(struct svr4_sys_socket_args *uap) { switch (SCARG(uap, type)) { case SVR4_SOCK_DGRAM: @@ -180,5 +178,5 @@ svr4_sys_socket(p, uap) default: return EINVAL; } - return socket(p, (struct socket_args *)uap); + return socket((struct socket_args *)uap); } diff --git a/sys/emulation/svr4/svr4_stat.c b/sys/emulation/svr4/svr4_stat.c index bbee63fff6..d29dd2e5cb 100644 --- a/sys/emulation/svr4/svr4_stat.c +++ b/sys/emulation/svr4/svr4_stat.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_stat.c,v 1.6 1999/12/08 12:00:48 newton Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_stat.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_stat.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ #include @@ -74,7 +74,7 @@ struct svr4_ustat_args { static void bsd_to_svr4_xstat __P((struct stat *, struct svr4_xstat *)); static void bsd_to_svr4_stat64 __P((struct stat *, struct svr4_stat64 *)); -int svr4_ustat __P((struct proc *, struct svr4_ustat_args *)); +int svr4_ustat __P((struct svr4_ustat_args *)); static int svr4_to_bsd_pathconf __P((int)); /* @@ -154,23 +154,22 @@ bsd_to_svr4_stat64(st, st4) } int -svr4_sys_stat(p, uap) - struct proc *p; - struct svr4_sys_stat_args *uap; +svr4_sys_stat(struct svr4_sys_stat_args *uap) { + struct proc *p = curproc; struct stat st; struct svr4_stat svr4_st; struct stat_args cup; int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - if ((error = stat(p, &cup)) != 0) + if ((error = stat(&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) @@ -189,22 +188,21 @@ svr4_sys_stat(p, uap) int -svr4_sys_lstat(p, uap) - register struct proc *p; - struct svr4_sys_lstat_args *uap; +svr4_sys_lstat(struct svr4_sys_lstat_args *uap) { + struct proc *p = curproc; struct stat st; struct svr4_stat svr4_st; struct lstat_args cup; int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - if ((error = lstat(p, &cup)) != 0) + if ((error = lstat(&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) @@ -223,9 +221,7 @@ svr4_sys_lstat(p, uap) int -svr4_sys_fstat(p, uap) - register struct proc *p; - struct svr4_sys_fstat_args *uap; +svr4_sys_fstat(struct svr4_sys_fstat_args *uap) { struct stat st; struct svr4_stat svr4_st; @@ -236,7 +232,7 @@ svr4_sys_fstat(p, uap) SCARG(&cup, fd) = SCARG(uap, fd); SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat)); - if ((error = fstat(p, &cup)) != 0) + if ((error = fstat(&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, sb), &st, sizeof st)) != 0) @@ -252,9 +248,7 @@ svr4_sys_fstat(p, uap) int -svr4_sys_xstat(p, uap) - register struct proc *p; - struct svr4_sys_xstat_args *uap; +svr4_sys_xstat(struct svr4_sys_xstat_args *uap) { struct stat st; struct svr4_xstat svr4_st; @@ -262,12 +256,12 @@ svr4_sys_xstat(p, uap) int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - if ((error = stat(p, &cup)) != 0) + if ((error = stat(&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) @@ -287,21 +281,19 @@ svr4_sys_xstat(p, uap) } int -svr4_sys_lxstat(p, uap) - register struct proc *p; - struct svr4_sys_lxstat_args *uap; +svr4_sys_lxstat(struct svr4_sys_lxstat_args *uap) { struct stat st; struct svr4_xstat svr4_st; struct lstat_args cup; int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - if ((error = lstat(p, &cup)) != 0) + if ((error = lstat(&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) @@ -321,9 +313,7 @@ svr4_sys_lxstat(p, uap) int -svr4_sys_fxstat(p, uap) - register struct proc *p; - struct svr4_sys_fxstat_args *uap; +svr4_sys_fxstat(struct svr4_sys_fxstat_args *uap) { struct stat st; struct svr4_xstat svr4_st; @@ -335,7 +325,7 @@ svr4_sys_fxstat(p, uap) SCARG(&cup, fd) = SCARG(uap, fd); SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat)); - if ((error = fstat(p, &cup)) != 0) + if ((error = fstat(&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, sb), &st, sizeof st)) != 0) @@ -350,22 +340,21 @@ svr4_sys_fxstat(p, uap) } int -svr4_sys_stat64(p, uap) - register struct proc *p; - struct svr4_sys_stat64_args *uap; +svr4_sys_stat64(struct svr4_sys_stat64_args *uap) { + struct proc *p = curproc; struct stat st; struct svr4_stat64 svr4_st; struct stat_args cup; int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - if ((error = stat(p, &cup)) != 0) + if ((error = stat(&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) @@ -384,22 +373,21 @@ svr4_sys_stat64(p, uap) int -svr4_sys_lstat64(p, uap) - register struct proc *p; - struct svr4_sys_lstat64_args *uap; +svr4_sys_lstat64(struct svr4_sys_lstat64_args *uap) { + struct proc *p = curproc; struct stat st; struct svr4_stat64 svr4_st; struct stat_args cup; int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, (char *) SCARG(uap, path)); + CHECKALTEXIST(&sg, (char *) SCARG(uap, path)); SCARG(&cup, path) = SCARG(uap, path); SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - if ((error = lstat(p, (struct lstat_args *)&cup)) != 0) + if ((error = lstat((struct lstat_args *)&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) @@ -418,9 +406,7 @@ svr4_sys_lstat64(p, uap) int -svr4_sys_fstat64(p, uap) - register struct proc *p; - struct svr4_sys_fstat64_args *uap; +svr4_sys_fstat64(struct svr4_sys_fstat64_args *uap) { struct stat st; struct svr4_stat64 svr4_st; @@ -431,7 +417,7 @@ svr4_sys_fstat64(p, uap) SCARG(&cup, fd) = SCARG(uap, fd); SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat)); - if ((error = fstat(p, &cup)) != 0) + if ((error = fstat(&cup)) != 0) return error; if ((error = copyin(SCARG(&cup, sb), &st, sizeof st)) != 0) @@ -447,9 +433,7 @@ svr4_sys_fstat64(p, uap) int -svr4_ustat(p, uap) - register struct proc *p; - struct svr4_ustat_args *uap; +svr4_ustat(struct svr4_ustat_args *uap) { struct svr4_ustat us; int error; @@ -469,13 +453,10 @@ svr4_ustat(p, uap) /*extern char ostype[], hostname[], osrelease[], version[], machine[];*/ int -svr4_sys_uname(p, uap) - register struct proc *p; - struct svr4_sys_uname_args *uap; +svr4_sys_uname(struct svr4_sys_uname_args *uap) { struct svr4_utsname sut; - memset(&sut, 0, sizeof(sut)); strncpy(sut.sysname, ostype, sizeof(sut.sysname)); @@ -498,10 +479,9 @@ svr4_sys_uname(p, uap) } int -svr4_sys_systeminfo(p, uap) - struct proc *p; - struct svr4_sys_systeminfo_args *uap; +svr4_sys_systeminfo(struct svr4_sys_systeminfo_args *uap) { + struct proc *p = curproc; char *str = NULL; int error = 0; register_t *retval = p->p_retval; @@ -608,16 +588,14 @@ svr4_sys_systeminfo(p, uap) } int -svr4_sys_utssys(p, uap) - register struct proc *p; - struct svr4_sys_utssys_args *uap; +svr4_sys_utssys(struct svr4_sys_utssys_args *uap) { switch (SCARG(uap, sel)) { case 0: /* uname(2) */ { struct svr4_sys_uname_args ua; SCARG(&ua, name) = SCARG(uap, a1); - return svr4_sys_uname(p, &ua); + return svr4_sys_uname(&ua); } case 2: /* ustat(2) */ @@ -625,7 +603,7 @@ svr4_sys_utssys(p, uap) struct svr4_ustat_args ua; SCARG(&ua, dev) = (svr4_dev_t) SCARG(uap, a2); SCARG(&ua, name) = SCARG(uap, a1); - return svr4_ustat(p, &ua); + return svr4_ustat(&ua); } case 3: /* fusers(2) */ @@ -639,9 +617,7 @@ svr4_sys_utssys(p, uap) int -svr4_sys_utime(p, uap) - register struct proc *p; - struct svr4_sys_utime_args *uap; +svr4_sys_utime(struct svr4_sys_utime_args *uap) { struct svr4_utimbuf ub; struct timeval tbuf[2]; @@ -650,7 +626,7 @@ svr4_sys_utime(p, uap) caddr_t sg = stackgap_init(); void *ttp; - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(&ap, path) = SCARG(uap, path); if (SCARG(uap, ubuf) != NULL) { if ((error = copyin(SCARG(uap, ubuf), &ub, sizeof(ub))) != 0) @@ -667,18 +643,16 @@ svr4_sys_utime(p, uap) } else SCARG(&ap, tptr) = NULL; - return utimes(p, &ap); + return utimes(&ap); } int -svr4_sys_utimes(p, uap) - register struct proc *p; - struct svr4_sys_utimes_args *uap; +svr4_sys_utimes(struct svr4_sys_utimes_args *uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(p, &sg, SCARG(uap, path)); - return utimes(p, (struct utimes_args *)uap); + CHECKALTEXIST(&sg, SCARG(uap, path)); + return utimes((struct utimes_args *)uap); } static int @@ -731,14 +705,13 @@ svr4_to_bsd_pathconf(name) int -svr4_sys_pathconf(p, uap) - register struct proc *p; - struct svr4_sys_pathconf_args *uap; +svr4_sys_pathconf(struct svr4_sys_pathconf_args *uap) { + struct proc *p = curproc; caddr_t sg = stackgap_init(); register_t *retval = p->p_retval; - CHECKALTEXIST(p, &sg, SCARG(uap, path)); + CHECKALTEXIST(&sg, SCARG(uap, path)); SCARG(uap, name) = svr4_to_bsd_pathconf(SCARG(uap, name)); @@ -750,16 +723,15 @@ svr4_sys_pathconf(p, uap) *retval = 0; return 0; default: - return pathconf(p, (struct pathconf_args *)uap); + return pathconf((struct pathconf_args *)uap); } } int -svr4_sys_fpathconf(p, uap) - register struct proc *p; - struct svr4_sys_fpathconf_args *uap; +svr4_sys_fpathconf(struct svr4_sys_fpathconf_args *uap) { + struct proc *p = curproc; register_t *retval = p->p_retval; SCARG(uap, name) = svr4_to_bsd_pathconf(SCARG(uap, name)); @@ -772,6 +744,6 @@ svr4_sys_fpathconf(p, uap) *retval = 0; return 0; default: - return fpathconf(p, (struct fpathconf_args *)uap); + return fpathconf((struct fpathconf_args *)uap); } } diff --git a/sys/emulation/svr4/svr4_stream.c b/sys/emulation/svr4/svr4_stream.c index 7d15f757e5..eea72d382e 100644 --- a/sys/emulation/svr4/svr4_stream.c +++ b/sys/emulation/svr4/svr4_stream.c @@ -28,7 +28,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_stream.c,v 1.12.2.2 2000/11/26 04:42:27 dillon Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_stream.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_stream.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ /* @@ -76,7 +76,7 @@ #include /* Utils */ -static int clean_pipe __P((struct proc *, const char *)); +static int clean_pipe __P((const char *)); static void getparm __P((struct file *, struct svr4_si_sockparms *)); /* Address Conversions */ @@ -146,15 +146,15 @@ static int svr4_recvit __P((struct proc *p, int s, struct msghdr *mp, */ static int svr4_sendit(p, s, mp, flags) - register struct proc *p; + struct proc *p; int s; - register struct msghdr *mp; + struct msghdr *mp; int flags; { struct file *fp; struct uio auio; - register struct iovec *iov; - register int i; + struct iovec *iov; + int i; struct mbuf *control; struct sockaddr *to; int len, error; @@ -243,15 +243,15 @@ bad: static int svr4_recvit(p, s, mp, namelenp) - register struct proc *p; + struct proc *p; int s; - register struct msghdr *mp; + struct msghdr *mp; caddr_t namelenp; { struct file *fp; struct uio auio; - register struct iovec *iov; - register int i; + struct iovec *iov; + int i; int len, error; struct mbuf *m, *control = 0; caddr_t ctlbuf; @@ -497,9 +497,7 @@ show_msg(str, fd, ctl, dat, flags) * to avoid code duplication. */ static int -clean_pipe(p, path) - struct proc *p; - const char *path; +clean_pipe(const char *path) { struct lstat_args la; struct unlink_args ua; @@ -517,7 +515,7 @@ clean_pipe(p, path) SCARG(&la, path) = tpath; - if ((error = lstat(p, &la)) != 0) + if ((error = lstat(&la)) != 0) return 0; if ((error = copyin(SCARG(&la, ub), &st, sizeof(st))) != 0) @@ -534,7 +532,7 @@ clean_pipe(p, path) SCARG(&ua, path) = SCARG(&la, path); - if ((error = unlink(p, &ua)) != 0) { + if ((error = unlink(&ua)) != 0) { DPRINTF(("clean_pipe: unlink failed %d\n", error)); return error; } @@ -760,7 +758,7 @@ si_listen(fp, fd, ioc, p) DPRINTF(("SI_LISTEN: fileno %d backlog = %d\n", fd, 5)); SCARG(&la, backlog) = 5; - if ((error = listen(p, &la)) != 0) { + if ((error = listen(&la)) != 0) { DPRINTF(("SI_LISTEN: listen failed %d\n", error)); return error; } @@ -874,7 +872,7 @@ si_shutdown(fp, fd, ioc, p) SCARG(&ap, s) = fd; - return shutdown(p, &ap); + return shutdown(&ap); } @@ -1031,7 +1029,7 @@ ti_bind(fp, fd, ioc, p) DPRINTF(("TI_BIND: fam %d, path %s\n", saun.sun_family, saun.sun_path)); - if ((error = clean_pipe(p, saun.sun_path)) != 0) + if ((error = clean_pipe(saun.sun_path)) != 0) return error; bnd.pad[28] = 0x00001000; /* magic again */ @@ -1054,7 +1052,7 @@ ti_bind(fp, fd, ioc, p) SCARG(&ba, name) = (void *) sup; SCARG(&ba, namelen) = sasize; - if ((error = bind(p, &ba)) != 0) { + if ((error = bind(&ba)) != 0) { DPRINTF(("TI_BIND: bind failed %d\n", error)); return error; } @@ -1172,7 +1170,7 @@ svr4_stream_ti_ioctl(fp, p, retval, fd, cmd, dat) SCARG(&ap, fdes) = fd; SCARG(&ap, asa) = sup; SCARG(&ap, alen) = lenp; - if ((error = getsockname(p, &ap)) != 0) { + if ((error = getsockname(&ap)) != 0) { DPRINTF(("ti_ioctl: getsockname error\n")); return error; } @@ -1186,7 +1184,7 @@ svr4_stream_ti_ioctl(fp, p, retval, fd, cmd, dat) SCARG(&ap, fdes) = fd; SCARG(&ap, asa) = sup; SCARG(&ap, alen) = lenp; - if ((error = getpeername(p, &ap)) != 0) { + if ((error = getpeername(&ap)) != 0) { DPRINTF(("ti_ioctl: getpeername error\n")); return error; } @@ -1319,7 +1317,7 @@ i_fdinsert(fp, p, retval, fd, cmd, dat) SCARG(&d2p, from) = st->s_afd; SCARG(&d2p, to) = fdi.fd; - if ((error = dup2(p, &d2p)) != 0) { + if ((error = dup2(&d2p)) != 0) { DPRINTF(("fdinsert: dup2(%d, %d) failed %d\n", st->s_afd, fdi.fd, error)); return error; @@ -1327,7 +1325,7 @@ i_fdinsert(fp, p, retval, fd, cmd, dat) SCARG(&clp, fd) = st->s_afd; - if ((error = close(p, &clp)) != 0) { + if ((error = close(&clp)) != 0) { DPRINTF(("fdinsert: close(%d) failed %d\n", st->s_afd, error)); return error; @@ -1361,7 +1359,7 @@ _i_bind_rsvd(fp, p, retval, fd, cmd, dat) SCARG(&ap, path) = dat; SCARG(&ap, mode) = S_IFIFO; - return mkfifo(p, &ap); + return mkfifo(&ap); } static int @@ -1381,7 +1379,7 @@ _i_rele_rsvd(fp, p, retval, fd, cmd, dat) */ SCARG(&ap, path) = dat; - return unlink(p, &ap); + return unlink(&ap); } static int @@ -1457,7 +1455,7 @@ i_setsig(fp, p, retval, fd, cmd, dat) /* get old status flags */ SCARG(&fa, fd) = fd; SCARG(&fa, cmd) = F_GETFL; - if ((error = fcntl(p, &fa)) != 0) + if ((error = fcntl(&fa)) != 0) return error; oflags = p->p_retval[0]; @@ -1486,7 +1484,7 @@ i_setsig(fp, p, retval, fd, cmd, dat) if (flags != oflags) { SCARG(&fa, cmd) = F_SETFL; SCARG(&fa, arg) = (long) flags; - if ((error = fcntl(p, &fa)) != 0) + if ((error = fcntl(&fa)) != 0) return error; flags = p->p_retval[0]; } @@ -1495,7 +1493,7 @@ i_setsig(fp, p, retval, fd, cmd, dat) if (dat != NULL) { SCARG(&fa, cmd) = F_SETOWN; SCARG(&fa, arg) = (long) p->p_pid; - return fcntl(p, &fa); + return fcntl(&fa); } return 0; } @@ -1705,10 +1703,9 @@ svr4_stream_ioctl(fp, p, retval, fd, cmd, dat) int -svr4_sys_putmsg(p, uap) - register struct proc *p; - struct svr4_sys_putmsg_args *uap; +svr4_sys_putmsg(struct svr4_sys_putmsg_args *uap) { + struct proc *p = curproc; struct filedesc *fdp = p->p_fd; struct file *fp; struct svr4_strbuf dat, ctl; @@ -1800,7 +1797,7 @@ svr4_sys_putmsg(p, uap) SCARG(&wa, fd) = SCARG(uap, fd); SCARG(&wa, buf) = dat.buf; SCARG(&wa, nbyte) = dat.len; - return write(p, &wa); + return write(&wa); } DPRINTF(("putmsg: Invalid inet length %ld\n", sc.len)); return EINVAL; @@ -1853,7 +1850,7 @@ svr4_sys_putmsg(p, uap) SCARG(&co, name) = (void *) sup; SCARG(&co, namelen) = (int) sasize; - return connect(p, &co); + return connect(&co); } case SVR4_TI_SENDTO_REQUEST: /* sendto */ @@ -1887,10 +1884,9 @@ svr4_sys_putmsg(p, uap) } int -svr4_sys_getmsg(p, uap) - register struct proc *p; - struct svr4_sys_getmsg_args *uap; +svr4_sys_getmsg(struct svr4_sys_getmsg_args *uap) { + struct proc *p = curproc; struct filedesc *fdp = p->p_fd; struct file *fp; struct getpeername_args ga; @@ -2008,7 +2004,7 @@ svr4_sys_getmsg(p, uap) SCARG(&ga, asa) = (void *) sup; SCARG(&ga, alen) = flen; - if ((error = getpeername(p, &ga)) != 0) { + if ((error = getpeername(&ga)) != 0) { DPRINTF(("getmsg: getpeername failed %d\n", error)); return error; } @@ -2067,7 +2063,7 @@ svr4_sys_getmsg(p, uap) SCARG(&aa, name) = (void *) sup; SCARG(&aa, anamelen) = flen; - if ((error = accept(p, &aa)) != 0) { + if ((error = accept(&aa)) != 0) { DPRINTF(("getmsg: accept failed %d\n", error)); return error; } @@ -2189,7 +2185,7 @@ svr4_sys_getmsg(p, uap) SCARG(&ra, fd) = SCARG(uap, fd); SCARG(&ra, buf) = dat.buf; SCARG(&ra, nbyte) = dat.maxlen; - if ((error = read(p, &ra)) != 0) { + if ((error = read(&ra)) != 0) { return error; } dat.len = *retval; @@ -2229,28 +2225,24 @@ svr4_sys_getmsg(p, uap) return error; } -int svr4_sys_send(p, uap) - struct proc *p; - struct svr4_sys_send_args *uap; +int svr4_sys_send(struct svr4_sys_send_args *uap) { struct osend_args osa; SCARG(&osa, s) = SCARG(uap, s); SCARG(&osa, buf) = SCARG(uap, buf); SCARG(&osa, len) = SCARG(uap, len); SCARG(&osa, flags) = SCARG(uap, flags); - return osend(p, &osa); + return osend(&osa); } -int svr4_sys_recv(p, uap) - struct proc *p; - struct svr4_sys_recv_args *uap; +int svr4_sys_recv(struct svr4_sys_recv_args *uap) { struct orecv_args ora; SCARG(&ora, s) = SCARG(uap, s); SCARG(&ora, buf) = SCARG(uap, buf); SCARG(&ora, len) = SCARG(uap, len); SCARG(&ora, flags) = SCARG(uap, flags); - return orecv(p, &ora); + return orecv(&ora); } /* @@ -2258,9 +2250,7 @@ int svr4_sys_recv(p, uap) * sendto(). Let's leave it here for now... */ int -svr4_sys_sendto(p, uap) - struct proc *p; - struct svr4_sys_sendto_args *uap; +svr4_sys_sendto(struct svr4_sys_sendto_args *uap) { struct sendto_args sa; @@ -2272,6 +2262,6 @@ svr4_sys_sendto(p, uap) SCARG(&sa, tolen) = SCARG(uap, tolen); DPRINTF(("calling sendto()\n")); - return sendto(p, &sa); + return sendto(&sa); } diff --git a/sys/emulation/svr4/svr4_syscall.h b/sys/emulation/svr4/svr4_syscall.h index f19bfa3cf2..8d7db28389 100644 --- a/sys/emulation/svr4/svr4_syscall.h +++ b/sys/emulation/svr4/svr4_syscall.h @@ -2,9 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/svr4/svr4_syscall.h,v 1.5.2.3 2001/10/05 07:38:44 peter Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_syscall.h,v 1.2 2003/06/17 04:28:57 dillon Exp $ - * created from FreeBSD: src/sys/svr4/syscalls.master,v 1.6.2.2 2001/10/05 07:34:37 peter Exp + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_syscall.h,v 1.3 2003/06/23 17:55:49 dillon Exp $ + * created from TurtleBSD: src/sys/svr4/syscalls.master,v 1.2 2003/06/17 04:28:58 dillon Exp */ #define SVR4_SYS_exit 1 diff --git a/sys/emulation/svr4/svr4_syscallnames.c b/sys/emulation/svr4/svr4_syscallnames.c index 0aab14423c..280fed240d 100644 --- a/sys/emulation/svr4/svr4_syscallnames.c +++ b/sys/emulation/svr4/svr4_syscallnames.c @@ -2,9 +2,8 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/svr4/svr4_syscallnames.c,v 1.5.2.3 2001/10/05 07:38:44 peter Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_syscallnames.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ - * created from FreeBSD: src/sys/svr4/syscalls.master,v 1.6.2.2 2001/10/05 07:34:37 peter Exp + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_syscallnames.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ + * created from TurtleBSD: src/sys/svr4/syscalls.master,v 1.2 2003/06/17 04:28:58 dillon Exp */ char *svr4_syscallnames[] = { diff --git a/sys/emulation/svr4/svr4_sysent.c b/sys/emulation/svr4/svr4_sysent.c index 74e3a97b73..a22f073886 100644 --- a/sys/emulation/svr4/svr4_sysent.c +++ b/sys/emulation/svr4/svr4_sysent.c @@ -2,9 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/svr4/svr4_sysent.c,v 1.5.2.3 2001/10/05 07:38:44 peter Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_sysent.c,v 1.2 2003/06/17 04:28:58 dillon Exp $ - * created from FreeBSD: src/sys/svr4/syscalls.master,v 1.6.2.2 2001/10/05 07:34:37 peter Exp + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_sysent.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ + * created from TurtleBSD: src/sys/svr4/syscalls.master,v 1.2 2003/06/17 04:28:58 dillon Exp */ #include diff --git a/sys/emulation/svr4/svr4_sysvec.c b/sys/emulation/svr4/svr4_sysvec.c index cee7a77dee..44ab9cf1aa 100644 --- a/sys/emulation/svr4/svr4_sysvec.c +++ b/sys/emulation/svr4/svr4_sysvec.c @@ -28,7 +28,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_sysvec.c,v 1.10.2.2 2002/07/09 14:12:43 robert Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_sysvec.c,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_sysvec.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ /* XXX we use functions that might not exist. */ @@ -216,10 +216,10 @@ svr4_fixup(long **stack_base, struct image_params *imgp) AUXARGS_ENTRY(pos, AT_FLAGS, args->flags); AUXARGS_ENTRY(pos, AT_ENTRY, args->entry); AUXARGS_ENTRY(pos, AT_BASE, args->base); - AUXARGS_ENTRY(pos, AT_UID, imgp->proc->p_cred->p_ruid); - AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_cred->p_svuid); - AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_cred->p_rgid); - AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_cred->p_svgid); + AUXARGS_ENTRY(pos, AT_UID, imgp->proc->p_ucred->cr_ruid); + AUXARGS_ENTRY(pos, AT_EUID, imgp->proc->p_ucred->cr_svuid); + AUXARGS_ENTRY(pos, AT_GID, imgp->proc->p_ucred->cr_rgid); + AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); AUXARGS_ENTRY(pos, AT_NULL, 0); free(imgp->auxargs, M_TEMP); @@ -241,14 +241,14 @@ svr4_fixup(long **stack_base, struct image_params *imgp) * Code shamelessly stolen by Mark Newton from IBCS2 emulation code. */ int -svr4_emul_find(p, sgp, prefix, path, pbuf, cflag) - struct proc *p; +svr4_emul_find(sgp, prefix, path, pbuf, cflag) caddr_t *sgp; /* Pointer to stackgap memory */ const char *prefix; char *path; char **pbuf; int cflag; { + struct proc *p = curproc; struct nameidata nd; struct nameidata ndroot; struct vattr vat; diff --git a/sys/emulation/svr4/svr4_util.h b/sys/emulation/svr4/svr4_util.h index 648b67d464..a7fc8b34e2 100644 --- a/sys/emulation/svr4/svr4_util.h +++ b/sys/emulation/svr4/svr4_util.h @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/svr4/svr4_util.h,v 1.4 1999/08/28 00:51:28 peter Exp $ - * $DragonFly: src/sys/emulation/svr4/Attic/svr4_util.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/emulation/svr4/Attic/svr4_util.h,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ #ifndef _SVR4_UTIL_H_ @@ -69,20 +69,19 @@ stackgap_alloc(sgp, sz) } extern const char svr4_emul_path[]; -int svr4_emul_find __P((struct proc *, caddr_t *, const char *, char *, - char **, int)); +int svr4_emul_find __P((caddr_t *, const char *, char *, char **, int)); -#define CHECKALT(p, sgp, path, i) \ +#define CHECKALT(sgp, path, i) \ do { \ int _error; \ \ - _error = svr4_emul_find(p, sgp, svr4_emul_path, path, \ + _error = svr4_emul_find(sgp, svr4_emul_path, path, \ &path, i); \ if (_error == EFAULT) \ return (_error); \ } while (0) -#define CHECKALTEXIST(p, sgp, path) CHECKALT(p, sgp, path, 0) -#define CHECKALTCREAT(p, sgp, path) CHECKALT(p, sgp, path, 1) +#define CHECKALTEXIST(sgp, path) CHECKALT(sgp, path, 0) +#define CHECKALTCREAT(sgp, path) CHECKALT(sgp, path, 1) #endif /* !_SVR4_UTIL_H_ */ diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c index 7ab3f6c3ea..1e00112393 100644 --- a/sys/i386/apm/apm.c +++ b/sys/i386/apm/apm.c @@ -16,7 +16,7 @@ * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * * $FreeBSD: src/sys/i386/apm/apm.c,v 1.114.2.5 2002/11/02 04:41:50 iwasaki Exp $ - * $DragonFly: src/sys/i386/apm/Attic/apm.c,v 1.2 2003/06/17 04:28:34 dillon Exp $ + * $DragonFly: src/sys/i386/apm/Attic/apm.c,v 1.3 2003/06/23 17:55:37 dillon Exp $ */ #include @@ -1123,7 +1123,7 @@ apm_attach(device_t dev) } static int -apmopen(dev_t dev, int flag, int fmt, struct proc *p) +apmopen(dev_t dev, int flag, int fmt, d_thread_t *td) { struct apm_softc *sc = &apm_softc; int ctl = APMDEV(dev); @@ -1151,7 +1151,7 @@ apmopen(dev_t dev, int flag, int fmt, struct proc *p) } static int -apmclose(dev_t dev, int flag, int fmt, struct proc *p) +apmclose(dev_t dev, int flag, int fmt, d_thread_t *td) { struct apm_softc *sc = &apm_softc; int ctl = APMDEV(dev); @@ -1174,7 +1174,7 @@ apmclose(dev_t dev, int flag, int fmt, struct proc *p) } static int -apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td) { struct apm_softc *sc = &apm_softc; struct apm_bios_arg *args; @@ -1358,7 +1358,7 @@ apmwrite(dev_t dev, struct uio *uio, int ioflag) } static int -apmpoll(dev_t dev, int events, struct proc *p) +apmpoll(dev_t dev, int events, d_thread_t *td) { struct apm_softc *sc = &apm_softc; int revents = 0; @@ -1367,7 +1367,7 @@ apmpoll(dev_t dev, int events, struct proc *p) if (sc->event_count) { revents |= events & (POLLIN | POLLRDNORM); } else { - selrecord(p, &sc->sc_rsel); + selrecord(td, &sc->sc_rsel); } } diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c index 20e31407ee..0cfe14b58f 100644 --- a/sys/i386/i386/genassym.c +++ b/sys/i386/i386/genassym.c @@ -35,7 +35,7 @@ * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $ - * $DragonFly: src/sys/i386/i386/Attic/genassym.c,v 1.10 2003/06/21 17:31:08 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/genassym.c,v 1.11 2003/06/23 17:55:38 dillon Exp $ */ #include "opt_user_ldt.h" @@ -198,7 +198,7 @@ ASSYM(GD_CURRENTLDT, offsetof(struct globaldata, gd_currentldt)); #endif #ifdef SMP -ASSYM(GD_CPU, offsetof(struct globaldata, gd_cpuid)); +ASSYM(GD_CPU, offsetof(struct globaldata, gd_cpu)); ASSYM(GD_CPU_LOCKID, offsetof(struct globaldata, gd_cpu_lockid)); ASSYM(GD_OTHER_CPUS, offsetof(struct globaldata, gd_other_cpus)); ASSYM(GD_SS_EFLAGS, offsetof(struct globaldata, gd_ss_eflags)); diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 69fafe90ae..b296be19bb 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -36,7 +36,7 @@ * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.385.2.30 2003/05/31 08:48:05 alc Exp $ - * $DragonFly: src/sys/i386/i386/Attic/machdep.c,v 1.10 2003/06/22 08:54:18 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/machdep.c,v 1.11 2003/06/23 17:55:38 dillon Exp $ */ #include "apm.h" @@ -720,6 +720,8 @@ sendsig(catcher, sig, mask, code) } /* + * osigreturn_args(struct osigcontext *sigcntxp) + * * System call to cleanup state after a signal * has been taken. Reset signal mask and * stack state from context left by sendsig (above). @@ -732,14 +734,11 @@ sendsig(catcher, sig, mask, code) #define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) int -osigreturn(p, uap) - struct proc *p; - struct osigreturn_args /* { - struct osigcontext *sigcntxp; - } */ *uap; +osigreturn(struct osigreturn_args *uap) { - register struct osigcontext *scp; - register struct trapframe *regs = p->p_md.md_regs; + struct proc *p = curproc; + struct osigcontext *scp; + struct trapframe *regs = p->p_md.md_regs; int eflags; scp = uap->sigcntxp; @@ -837,13 +836,13 @@ osigreturn(p, uap) return(EJUSTRETURN); } +/* + * sigreturn(ucontext_t *sigcntxp) + */ int -sigreturn(p, uap) - struct proc *p; - struct sigreturn_args /* { - ucontext_t *sigcntxp; - } */ *uap; +sigreturn(struct sigreturn_args *uap) { + struct proc *p = curproc; struct trapframe *regs; ucontext_t *ucp; int cs, eflags; @@ -853,7 +852,7 @@ sigreturn(p, uap) if (!useracc((caddr_t)ucp, sizeof(struct osigcontext), VM_PROT_READ)) return (EFAULT); if (((struct osigcontext *)ucp)->sc_trapno == 0x01d516) - return (osigreturn(p, (struct osigreturn_args *)uap)); + return (osigreturn((struct osigreturn_args *)uap)); /* * Since ucp is not an osigcontext but a ucontext_t, we have to @@ -2434,7 +2433,7 @@ set_dbregs(p, dbregs) * from within kernel mode? */ - if (suser(p) != 0) { + if (suser_xxx(p->p_ucred, 0) != 0) { if (dbregs->dr7 & 0x3) { /* dr0 is enabled */ if (dbregs->dr0 >= VM_MAXUSER_ADDRESS) diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 587159373a..a4fdaea6f5 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -39,7 +39,7 @@ * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/mem.c,v 1.79.2.9 2003/01/04 22:58:01 njl Exp $ - * $DragonFly: src/sys/i386/i386/Attic/mem.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/mem.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ /* @@ -101,19 +101,17 @@ static struct random_softc random_softc[16]; static caddr_t zbuf; MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); -static int mem_ioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); -static int random_ioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); +static int mem_ioctl __P((dev_t, u_long, caddr_t, int, struct thread *)); +static int random_ioctl __P((dev_t, u_long, caddr_t, int, struct thread *)); struct mem_range_softc mem_range_softc; static int -mmclose(dev, flags, fmt, p) - dev_t dev; - int flags; - int fmt; - struct proc *p; +mmclose(dev_t dev, int flags, int fmt, struct thread *td) { + struct proc *p = td->td_proc; + switch (minor(dev)) { case 14: p->p_md.md_regs->tf_eflags &= ~PSL_IOPL; @@ -125,13 +123,10 @@ mmclose(dev, flags, fmt, p) } static int -mmopen(dev, flags, fmt, p) - dev_t dev; - int flags; - int fmt; - struct proc *p; +mmopen(dev_t dev, int flags, int fmt, struct thread *td) { int error; + struct proc *p = td->td_proc; switch (minor(dev)) { case 0: @@ -140,7 +135,7 @@ mmopen(dev, flags, fmt, p) return (EPERM); break; case 14: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); if (securelevel > 0) @@ -329,20 +324,15 @@ memmmap(dev_t dev, vm_offset_t offset, int nprot) } static int -mmioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { switch (minor(dev)) { case 0: - return mem_ioctl(dev, cmd, data, flags, p); + return mem_ioctl(dev, cmd, data, flags, td); case 3: case 4: - return random_ioctl(dev, cmd, data, flags, p); + return random_ioctl(dev, cmd, data, flags, td); } return (ENODEV); } @@ -354,12 +344,7 @@ mmioctl(dev, cmd, data, flags, p) * and mem_range_attr_set. */ static int -mem_ioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +mem_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { int nd, error = 0; struct mem_range_op *mo = (struct mem_range_op *)data; @@ -453,13 +438,9 @@ mem_range_AP_init(void) #endif static int -random_ioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +random_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { + struct proc *p = td->td_proc; static intrmask_t interrupt_allowed; intrmask_t interrupt_mask; int error, intr; @@ -490,7 +471,7 @@ random_ioctl(dev, cmd, data, flags, p) case FIONBIO: break; case MEM_SETIRQ: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); if (intr < 0 || intr >= 16) @@ -507,7 +488,7 @@ random_ioctl(dev, cmd, data, flags, p) enable_intr(); break; case MEM_CLEARIRQ: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); if (intr < 0 || intr >= 16) @@ -521,7 +502,7 @@ random_ioctl(dev, cmd, data, flags, p) enable_intr(); break; case MEM_RETURNIRQ: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); *(u_int16_t *)data = interrupt_allowed; @@ -531,17 +512,14 @@ random_ioctl(dev, cmd, data, flags, p) } int -mmpoll(dev, events, p) - dev_t dev; - int events; - struct proc *p; +mmpoll(dev_t dev, int events, struct thread *td) { switch (minor(dev)) { case 3: /* /dev/random */ - return random_poll(dev, events, p); + return random_poll(dev, events, td); case 4: /* /dev/urandom */ default: - return seltrue(dev, events, p); + return seltrue(dev, events, td); } } diff --git a/sys/i386/i386/perfmon.c b/sys/i386/i386/perfmon.c index 15d8b3cb38..9b1bbd5378 100644 --- a/sys/i386/i386/perfmon.c +++ b/sys/i386/i386/perfmon.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/perfmon.c,v 1.21 1999/09/25 18:24:04 phk Exp $ - * $DragonFly: src/sys/i386/i386/Attic/perfmon.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/perfmon.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ #include @@ -284,7 +284,7 @@ static int writer; static int writerpmc; static int -perfmon_open(dev_t dev, int flags, int fmt, struct proc *p) +perfmon_open(dev_t dev, int flags, int fmt, struct thread *td) { if (!perfmon_cpuok) return ENXIO; @@ -301,7 +301,7 @@ perfmon_open(dev_t dev, int flags, int fmt, struct proc *p) } static int -perfmon_close(dev_t dev, int flags, int fmt, struct proc *p) +perfmon_close(dev_t dev, int flags, int fmt, struct thread *td) { if (flags & FWRITE) { int i; @@ -316,7 +316,7 @@ perfmon_close(dev_t dev, int flags, int fmt, struct proc *p) } static int -perfmon_ioctl(dev_t dev, u_long cmd, caddr_t param, int flags, struct proc *p) +perfmon_ioctl(dev_t dev, u_long cmd, caddr_t param, int flags, struct thread *td) { struct pmc *pmc; struct pmc_data *pmcd; diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index 7ffe298dfe..8ca1f52850 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -32,7 +32,7 @@ * * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 * $FreeBSD: src/sys/i386/i386/sys_machdep.c,v 1.47.2.3 2002/10/07 17:20:00 jhb Exp $ - * $DragonFly: src/sys/i386/i386/Attic/sys_machdep.c,v 1.3 2003/06/18 18:29:55 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/sys_machdep.c,v 1.4 2003/06/23 17:55:38 dillon Exp $ * */ @@ -77,18 +77,14 @@ static int i386_get_ioperm __P((struct proc *, char *)); static int i386_set_ioperm __P((struct proc *, char *)); int i386_extend_pcb __P((struct proc *)); -#ifndef _SYS_SYSPROTO_H_ -struct sysarch_args { - int op; - char *parms; -}; -#endif +/* + * sysarch_args(int op, char *params) + */ int -sysarch(p, uap) - struct proc *p; - register struct sysarch_args *uap; +sysarch(struct sysarch_args *uap) { + struct proc *p = curproc; int error = 0; switch(uap->op) { @@ -178,7 +174,7 @@ i386_set_ioperm(p, args) if ((error = copyin(args, &ua, sizeof(struct i386_ioperm_args))) != 0) return (error); - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); if (securelevel > 0) return (EPERM); diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 7dbb2f5529..adafbb7269 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -36,7 +36,7 @@ * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 * $FreeBSD: src/sys/i386/i386/trap.c,v 1.147.2.11 2003/02/27 19:09:59 luoqi Exp $ - * $DragonFly: src/sys/i386/i386/Attic/trap.c,v 1.5 2003/06/22 08:54:18 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/trap.c,v 1.6 2003/06/23 17:55:38 dillon Exp $ */ /* @@ -93,6 +93,7 @@ #include #include +#include #include "isa.h" #include "npx.h" @@ -1089,12 +1090,12 @@ syscall2(frame) #endif /* - * handle atomicy by looping since interrupts are enabled and the - * MP lock is not held. + * access non-atomic field from critical section. p_sticks is + * updated by the clock interrupt. */ + crit_enter(); sticks = ((volatile struct proc *)p)->p_sticks; - while (sticks != ((volatile struct proc *)p)->p_sticks) - sticks = ((volatile struct proc *)p)->p_sticks; + crit_exit(); p->p_md.md_regs = &frame; params = (caddr_t)frame.tf_esp + sizeof(int); @@ -1177,7 +1178,7 @@ syscall2(frame) STOPEVENT(p, S_SCE, narg); /* MP aware */ - error = (*callp->sy_call)(p, args); + error = (*callp->sy_call)(args); /* * MP SAFE (we may or may not have the MP lock at this point) diff --git a/sys/i386/i386/vm86.c b/sys/i386/i386/vm86.c index 105d7d78a7..afd41cce86 100644 --- a/sys/i386/i386/vm86.c +++ b/sys/i386/i386/vm86.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/vm86.c,v 1.31.2.2 2001/10/05 06:18:55 peter Exp $ - * $DragonFly: src/sys/i386/i386/Attic/vm86.c,v 1.3 2003/06/18 18:29:55 dillon Exp $ + * $DragonFly: src/sys/i386/i386/Attic/vm86.c,v 1.4 2003/06/23 17:55:38 dillon Exp $ */ #include @@ -705,7 +705,7 @@ vm86_sysarch(p, args) case VM86_INTCALL: { struct vm86_intcall_args sa; - if ((error = suser(p))) + if ((error = suser_xxx(p->p_ucred, 0))) return (error); if ((error = copyin(ua.sub_args, &sa, sizeof(sa)))) return (error); diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 535fea02f0..78a8c19edd 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -40,7 +40,7 @@ * * @(#)init_main.c 8.9 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/init_main.c,v 1.134.2.8 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/kern/init_main.c,v 1.9 2003/06/22 04:30:42 dillon Exp $ + * $DragonFly: src/sys/kern/init_main.c,v 1.10 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_init_path.h" @@ -80,7 +80,6 @@ void mi_startup(void); /* Should be elsewhere */ /* Components of the first process -- never freed. */ static struct session session0; static struct pgrp pgrp0; -static struct pcred cred0; static struct procsig procsig0; static struct filedesc0 filedesc0; static struct plimit limit0; @@ -303,15 +302,13 @@ proc0_init(void *dummy __unused) bcopy("swapper", p->p_comm, sizeof ("swapper")); /* Create credentials. */ - cred0.p_refcnt = 1; - cred0.p_uidinfo = uifind(0); - p->p_cred = &cred0; p->p_ucred = crget(); + p->p_ucred->cr_ruidinfo = uifind(0); p->p_ucred->cr_ngroups = 1; /* group 0 */ p->p_ucred->cr_uidinfo = uifind(0); /* Don't jail it */ - p->p_prison = 0; + p->p_ucred->cr_prison = NULL; /* Create procsig. */ p->p_procsig = &procsig0; @@ -364,7 +361,7 @@ proc0_init(void *dummy __unused) /* * Charge root for one process. */ - (void)chgproccnt(cred0.p_uidinfo, 1, 0); + (void)chgproccnt(p->p_ucred->cr_uidinfo, 1, 0); } SYSINIT(p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc0_init, NULL) @@ -535,7 +532,7 @@ start_init(void *dummy) * Otherwise, return via fork_trampoline() all the way * to user mode as init! */ - if ((error = execve(p, &args)) == 0) + if ((error = execve(&args)) == 0) return; if (error != ENOENT) printf("exec %.*s: error %d\n", (int)(next - path), diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index 9ea6485fb0..909e113c4f 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -2,8 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $DragonFly: src/sys/kern/init_sysent.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ - * created from TurtleBSD: src/sys/kern/syscalls.master,v 1.1 2003/06/16 06:26:15 dillon Exp + * $DragonFly: src/sys/kern/init_sysent.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ + * created from TurtleBSD: src/sys/kern/syscalls.master,v 1.2 2003/06/17 04:28:41 dillon Exp */ #include "opt_compat.h" diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 7c311ee648..3d1535f830 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -38,7 +38,7 @@ * * @(#)kern_acct.c 8.1 (Berkeley) 6/14/93 * $FreeBSD: src/sys/kern/kern_acct.c,v 1.23.2.1 2002/07/24 18:33:55 johan Exp $ - * $DragonFly: src/sys/kern/kern_acct.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_acct.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -111,8 +111,7 @@ SYSCTL_INT(_kern, OID_AUTO, acct_chkfreq, CTLFLAG_RW, * previous implementation done by Mark Tinguely. */ int -acct(a1, uap) - struct proc *a1; +acct(uap) struct acct_args /* { syscallarg(char *) path; } */ *uap; @@ -122,7 +121,7 @@ acct(a1, uap) int error; /* Make sure that the caller is root. */ - error = suser(p); + error = suser(); if (error) return (error); @@ -220,8 +219,8 @@ acct_process(p) acct.ac_io = encode_comp_t(r->ru_inblock + r->ru_oublock, 0); /* (6) The UID and GID of the process */ - acct.ac_uid = p->p_cred->p_ruid; - acct.ac_gid = p->p_cred->p_rgid; + acct.ac_uid = p->p_ucred->cr_ruid; + acct.ac_gid = p->p_ucred->cr_rgid; /* (7) The terminal from which the process was started */ if ((p->p_flag & P_CONTROLT) && p->p_pgrp->pg_session->s_ttyp) diff --git a/sys/kern/kern_acl.c b/sys/kern/kern_acl.c index 79a492e5e2..e3b69aeb5c 100644 --- a/sys/kern/kern_acl.c +++ b/sys/kern/kern_acl.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_acl.c,v 1.2.2.1 2000/07/28 18:48:16 rwatson Exp $ - * $DragonFly: src/sys/kern/kern_acl.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_acl.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* @@ -49,12 +49,9 @@ static MALLOC_DEFINE(M_ACL, "acl", "access control list"); -static int vacl_set_acl(struct proc *p, struct vnode *vp, acl_type_t type, - struct acl *aclp); -static int vacl_get_acl(struct proc *p, struct vnode *vp, acl_type_t type, - struct acl *aclp); -static int vacl_aclcheck(struct proc *p, struct vnode *vp, acl_type_t type, - struct acl *aclp); +static int vacl_set_acl(struct vnode *vp, acl_type_t type, struct acl *aclp); +static int vacl_get_acl(struct vnode *vp, acl_type_t type, struct acl *aclp); +static int vacl_aclcheck(struct vnode *vp, acl_type_t type, struct acl *aclp); /* * These calls wrap the real vnode operations, and are called by the @@ -69,9 +66,9 @@ static int vacl_aclcheck(struct proc *p, struct vnode *vp, acl_type_t type, * Given a vnode, set its ACL. */ static int -vacl_set_acl(struct proc *p, struct vnode *vp, acl_type_t type, - struct acl *aclp) +vacl_set_acl(struct vnode *vp, acl_type_t type, struct acl *aclp) { + struct proc *p = curproc; struct acl inkernacl; int error; @@ -89,9 +86,9 @@ vacl_set_acl(struct proc *p, struct vnode *vp, acl_type_t type, * Given a vnode, get its ACL. */ static int -vacl_get_acl(struct proc *p, struct vnode *vp, acl_type_t type, - struct acl *aclp) +vacl_get_acl(struct vnode *vp, acl_type_t type, struct acl *aclp) { + struct proc *p = curproc; struct acl inkernelacl; int error; @@ -105,8 +102,9 @@ vacl_get_acl(struct proc *p, struct vnode *vp, acl_type_t type, * Given a vnode, delete its ACL. */ static int -vacl_delete(struct proc *p, struct vnode *vp, acl_type_t type) +vacl_delete(struct vnode *vp, acl_type_t type) { + struct proc *p = curproc; int error; VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); @@ -120,9 +118,9 @@ vacl_delete(struct proc *p, struct vnode *vp, acl_type_t type) * Given a vnode, check whether an ACL is appropriate for it */ static int -vacl_aclcheck(struct proc *p, struct vnode *vp, acl_type_t type, - struct acl *aclp) +vacl_aclcheck(struct vnode *vp, acl_type_t type, struct acl *aclp) { + struct proc *p = curproc; struct acl inkernelacl; int error; @@ -143,8 +141,9 @@ vacl_aclcheck(struct proc *p, struct vnode *vp, acl_type_t type, * Given a file path, get an ACL for it */ int -__acl_get_file(struct proc *p, struct __acl_get_file_args *uap) +__acl_get_file(struct __acl_get_file_args *uap) { + struct proc *p = curproc; struct nameidata nd; int error; @@ -153,7 +152,7 @@ __acl_get_file(struct proc *p, struct __acl_get_file_args *uap) error = namei(&nd); if (error) return(error); - error = vacl_get_acl(p, nd.ni_vp, SCARG(uap, type), SCARG(uap, aclp)); + error = vacl_get_acl(nd.ni_vp, SCARG(uap, type), SCARG(uap, aclp)); NDFREE(&nd, 0); return (error); } @@ -162,8 +161,9 @@ __acl_get_file(struct proc *p, struct __acl_get_file_args *uap) * Given a file path, set an ACL for it */ int -__acl_set_file(struct proc *p, struct __acl_set_file_args *uap) +__acl_set_file(struct __acl_set_file_args *uap) { + struct proc *p = curproc; struct nameidata nd; int error; @@ -171,7 +171,7 @@ __acl_set_file(struct proc *p, struct __acl_set_file_args *uap) error = namei(&nd); if (error) return(error); - error = vacl_set_acl(p, nd.ni_vp, SCARG(uap, type), SCARG(uap, aclp)); + error = vacl_set_acl(nd.ni_vp, SCARG(uap, type), SCARG(uap, aclp)); NDFREE(&nd, 0); return (error); } @@ -180,15 +180,16 @@ __acl_set_file(struct proc *p, struct __acl_set_file_args *uap) * Given a file descriptor, get an ACL for it */ int -__acl_get_fd(struct proc *p, struct __acl_get_fd_args *uap) +__acl_get_fd(struct __acl_get_fd_args *uap) { + struct proc *p = curproc; struct file *fp; int error; error = getvnode(p->p_fd, SCARG(uap, filedes), &fp); if (error) return(error); - return vacl_get_acl(p, (struct vnode *)fp->f_data, SCARG(uap, type), + return vacl_get_acl((struct vnode *)fp->f_data, SCARG(uap, type), SCARG(uap, aclp)); } @@ -196,15 +197,16 @@ __acl_get_fd(struct proc *p, struct __acl_get_fd_args *uap) * Given a file descriptor, set an ACL for it */ int -__acl_set_fd(struct proc *p, struct __acl_set_fd_args *uap) +__acl_set_fd(struct __acl_set_fd_args *uap) { + struct proc *p = curproc; struct file *fp; int error; error = getvnode(p->p_fd, SCARG(uap, filedes), &fp); if (error) return(error); - return vacl_set_acl(p, (struct vnode *)fp->f_data, SCARG(uap, type), + return vacl_set_acl((struct vnode *)fp->f_data, SCARG(uap, type), SCARG(uap, aclp)); } @@ -212,8 +214,9 @@ __acl_set_fd(struct proc *p, struct __acl_set_fd_args *uap) * Given a file path, delete an ACL from it. */ int -__acl_delete_file(struct proc *p, struct __acl_delete_file_args *uap) +__acl_delete_file(struct __acl_delete_file_args *uap) { + struct proc *p = curproc; struct nameidata nd; int error; @@ -221,7 +224,7 @@ __acl_delete_file(struct proc *p, struct __acl_delete_file_args *uap) error = namei(&nd); if (error) return(error); - error = vacl_delete(p, nd.ni_vp, SCARG(uap, type)); + error = vacl_delete(nd.ni_vp, SCARG(uap, type)); NDFREE(&nd, 0); return (error); } @@ -230,15 +233,16 @@ __acl_delete_file(struct proc *p, struct __acl_delete_file_args *uap) * Given a file path, delete an ACL from it. */ int -__acl_delete_fd(struct proc *p, struct __acl_delete_fd_args *uap) +__acl_delete_fd(struct __acl_delete_fd_args *uap) { + struct proc *p = curproc; struct file *fp; int error; error = getvnode(p->p_fd, SCARG(uap, filedes), &fp); if (error) return(error); - error = vacl_delete(p, (struct vnode *)fp->f_data, SCARG(uap, type)); + error = vacl_delete((struct vnode *)fp->f_data, SCARG(uap, type)); return (error); } @@ -246,8 +250,9 @@ __acl_delete_fd(struct proc *p, struct __acl_delete_fd_args *uap) * Given a file path, check an ACL for it */ int -__acl_aclcheck_file(struct proc *p, struct __acl_aclcheck_file_args *uap) +__acl_aclcheck_file(struct __acl_aclcheck_file_args *uap) { + struct proc *p = curproc; struct nameidata nd; int error; @@ -255,7 +260,7 @@ __acl_aclcheck_file(struct proc *p, struct __acl_aclcheck_file_args *uap) error = namei(&nd); if (error) return(error); - error = vacl_aclcheck(p, nd.ni_vp, SCARG(uap, type), SCARG(uap, aclp)); + error = vacl_aclcheck(nd.ni_vp, SCARG(uap, type), SCARG(uap, aclp)); NDFREE(&nd, 0); return (error); } @@ -264,14 +269,15 @@ __acl_aclcheck_file(struct proc *p, struct __acl_aclcheck_file_args *uap) * Given a file descriptor, check an ACL for it */ int -__acl_aclcheck_fd(struct proc *p, struct __acl_aclcheck_fd_args *uap) +__acl_aclcheck_fd(struct __acl_aclcheck_fd_args *uap) { + struct proc *p = curproc; struct file *fp; int error; error = getvnode(p->p_fd, SCARG(uap, filedes), &fp); if (error) return(error); - return vacl_aclcheck(p, (struct vnode *)fp->f_data, SCARG(uap, type), + return vacl_aclcheck((struct vnode *)fp->f_data, SCARG(uap, type), SCARG(uap, aclp)); } diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 41dd5fe117..166aac662a 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -37,7 +37,7 @@ * * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 * $FreeBSD: src/sys/kern/kern_descrip.c,v 1.81.2.17 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/kern/kern_descrip.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_descrip.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_compat.h" @@ -118,10 +118,9 @@ struct getdtablesize_args { #endif /* ARGSUSED */ int -getdtablesize(p, uap) - struct proc *p; - struct getdtablesize_args *uap; +getdtablesize(struct getdtablesize_args *uap) { + struct proc *p = curproc; p->p_retval[0] = min((int)p->p_rlimit[RLIMIT_NOFILE].rlim_cur, maxfilesperproc); @@ -142,12 +141,11 @@ struct dup2_args { #endif /* ARGSUSED */ int -dup2(p, uap) - struct proc *p; - struct dup2_args *uap; +dup2(struct dup2_args *uap) { - register struct filedesc *fdp = p->p_fd; - register u_int old = uap->from, new = uap->to; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; + u_int old = uap->from, new = uap->to; int i, error; retry: @@ -182,11 +180,10 @@ struct dup_args { #endif /* ARGSUSED */ int -dup(p, uap) - struct proc *p; - struct dup_args *uap; +dup(struct dup_args *uap) { - register struct filedesc *fdp; + struct proc *p = curproc; + struct filedesc *fdp; u_int old; int new, error; @@ -211,13 +208,12 @@ struct fcntl_args { #endif /* ARGSUSED */ int -fcntl(p, uap) - struct proc *p; - register struct fcntl_args *uap; +fcntl(struct fcntl_args *uap) { - register struct filedesc *fdp = p->p_fd; - register struct file *fp; - register char *pop; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; + struct file *fp; + char *pop; struct vnode *vp; int i, tmp, error, flg = F_POSIX; struct flock fl; @@ -389,8 +385,8 @@ fcntl(p, uap) */ static int do_dup(fdp, old, new, retval, p) - register struct filedesc *fdp; - register int old, new; + struct filedesc *fdp; + int old, new; register_t *retval; struct proc *p; { @@ -554,7 +550,7 @@ fsetown(pgid, sigiop) crhold(curproc->p_ucred); sigio->sio_ucred = curproc->p_ucred; /* It would be convenient if p_ruid was in ucred. */ - sigio->sio_ruid = curproc->p_cred->p_ruid; + sigio->sio_ruid = curproc->p_ucred->cr_ruid; sigio->sio_myref = sigiop; s = splhigh(); *sigiop = sigio; @@ -582,13 +578,12 @@ struct close_args { #endif /* ARGSUSED */ int -close(p, uap) - struct proc *p; - struct close_args *uap; +close(struct close_args *uap) { - register struct filedesc *fdp = p->p_fd; - register struct file *fp; - register int fd = uap->fd; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; + struct file *fp; + int fd = uap->fd; int error; int holdleaders; @@ -645,12 +640,11 @@ struct ofstat_args { #endif /* ARGSUSED */ int -ofstat(p, uap) - struct proc *p; - register struct ofstat_args *uap; +ofstat(struct ofstat_args *uap) { - register struct filedesc *fdp = p->p_fd; - register struct file *fp; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; + struct file *fp; struct stat ub; struct ostat oub; int error; @@ -680,12 +674,11 @@ struct fstat_args { #endif /* ARGSUSED */ int -fstat(p, uap) - struct proc *p; - register struct fstat_args *uap; +fstat(struct fstat_args *uap) { - register struct filedesc *fdp = p->p_fd; - register struct file *fp; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; + struct file *fp; struct stat ub; int error; @@ -711,12 +704,11 @@ struct nfstat_args { #endif /* ARGSUSED */ int -nfstat(p, uap) - struct proc *p; - register struct nfstat_args *uap; +nfstat(struct nfstat_args *uap) { - register struct filedesc *fdp = p->p_fd; - register struct file *fp; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; + struct file *fp; struct stat ub; struct nstat nub; int error; @@ -745,10 +737,9 @@ struct fpathconf_args { #endif /* ARGSUSED */ int -fpathconf(p, uap) - struct proc *p; - register struct fpathconf_args *uap; +fpathconf(struct fpathconf_args *uap) { + struct proc *p = curproc; struct filedesc *fdp = p->p_fd; struct file *fp; struct vnode *vp; @@ -795,8 +786,8 @@ fdalloc(p, want, result) int want; int *result; { - register struct filedesc *fdp = p->p_fd; - register int i; + struct filedesc *fdp = p->p_fd; + int i; int lim, last, nfiles; struct file **newofile; char *newofileflags; @@ -871,11 +862,11 @@ fdalloc(p, want, result) int fdavail(p, n) struct proc *p; - register int n; + int n; { - register struct filedesc *fdp = p->p_fd; - register struct file **fpp; - register int i, lim, last; + struct filedesc *fdp = p->p_fd; + struct file **fpp; + int i, lim, last; lim = min((int)p->p_rlimit[RLIMIT_NOFILE].rlim_cur, maxfilesperproc); if ((i = lim - fdp->fd_nfiles) > 0 && (n -= i) <= 0) @@ -896,11 +887,11 @@ fdavail(p, n) */ int falloc(p, resultfp, resultfd) - register struct proc *p; + struct proc *p; struct file **resultfp; int *resultfd; { - register struct file *fp, *fq; + struct file *fp, *fq; int error, i; if (nfiles >= maxfiles) { @@ -950,7 +941,7 @@ falloc(p, resultfp, resultfd) */ void ffree(fp) - register struct file *fp; + struct file *fp; { KASSERT((fp->f_count == 0), ("ffree: fp_fcount not 0!")); LIST_REMOVE(fp, f_list); @@ -966,8 +957,8 @@ struct filedesc * fdinit(p) struct proc *p; { - register struct filedesc0 *newfdp; - register struct filedesc *fdp = p->p_fd; + struct filedesc0 *newfdp; + struct filedesc *fdp = p->p_fd; MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0), M_FILEDESC, M_WAITOK); @@ -1011,9 +1002,9 @@ struct filedesc * fdcopy(p) struct proc *p; { - register struct filedesc *newfdp, *fdp = p->p_fd; - register struct file **fpp; - register int i; + struct filedesc *newfdp, *fdp = p->p_fd; + struct file **fpp; + int i; /* Certain daemons might not have file descriptors. */ if (fdp == NULL) @@ -1090,12 +1081,11 @@ fdcopy(p) * Release a filedesc structure. */ void -fdfree(p) - struct proc *p; +fdfree(struct proc *p) { - register struct filedesc *fdp = p->p_fd; + struct filedesc *fdp = p->p_fd; struct file **fpp; - register int i; + int i; struct filedesc_to_leader *fdtol; struct file *fp; struct vnode *vp; @@ -1226,7 +1216,7 @@ setugidsafety(p) struct proc *p; { struct filedesc *fdp = p->p_fd; - register int i; + int i; /* Certain daemons might not have file descriptors. */ if (fdp == NULL) @@ -1272,7 +1262,7 @@ fdcloseexec(p) struct proc *p; { struct filedesc *fdp = p->p_fd; - register int i; + int i; /* Certain daemons might not have file descriptors. */ if (fdp == NULL) @@ -1374,8 +1364,8 @@ fdcheckstd(p) */ int closef(fp, p) - register struct file *fp; - register struct proc *p; + struct file *fp; + struct proc *p; { struct vnode *vp; struct flock lf; @@ -1478,12 +1468,11 @@ struct flock_args { #endif /* ARGSUSED */ int -flock(p, uap) - struct proc *p; - register struct flock_args *uap; +flock(struct flock_args *uap) { - register struct filedesc *fdp = p->p_fd; - register struct file *fp; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; + struct file *fp; struct vnode *vp; struct flock lf; @@ -1523,11 +1512,9 @@ flock(p, uap) */ /* ARGSUSED */ static int -fdopen(dev, mode, type, p) - dev_t dev; - int mode, type; - struct proc *p; +fdopen(dev_t dev, int mode, int type, struct thread *td) { + KKASSERT(td->td_proc != NULL); /* * XXX Kludge: set curproc->p_dupfd to contain the value of the @@ -1537,7 +1524,7 @@ fdopen(dev, mode, type, p) * actions in dupfdopen below. Other callers of vn_open or VOP_OPEN * will simply report the error. */ - p->p_dupfd = minor(dev); + td->td_proc->p_dupfd = minor(dev); return (ENODEV); } @@ -1545,14 +1532,9 @@ fdopen(dev, mode, type, p) * Duplicate the specified descriptor to a free descriptor. */ int -dupfdopen(p, fdp, indx, dfd, mode, error) - struct proc *p; - struct filedesc *fdp; - int indx, dfd; - int mode; - int error; +dupfdopen(struct filedesc *fdp, int indx, int dfd, int mode, int error) { - register struct file *wfp; + struct file *wfp; struct file *fp; /* @@ -1600,7 +1582,7 @@ dupfdopen(p, fdp, indx, dfd, mode, error) * used to own. Release it. */ if (fp) - fdrop(fp, p); + fdrop(fp, curproc); return (0); case ENXIO: @@ -1622,7 +1604,7 @@ dupfdopen(p, fdp, indx, dfd, mode, error) * used to own. Release it. */ if (fp) - fdrop(fp, p); + fdrop(fp, curproc); /* * Complete the clean up of the filedesc structure by * recomputing the various hints. diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 47ee0bcec2..a591e9691c 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_event.c,v 1.2.2.9 2003/05/08 07:47:16 kbyanc Exp $ - * $DragonFly: src/sys/kern/kern_event.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_event.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -190,7 +190,7 @@ filt_procattach(struct knote *kn) } if (p == NULL) return (ESRCH); - if (! PRISON_CHECK(curproc, p)) + if (! PRISON_CHECK(curproc->p_ucred, p->p_ucred)) return (EACCES); kn->kn_ptr.p_proc = p; @@ -357,8 +357,9 @@ filt_timer(struct knote *kn, long hint) } int -kqueue(struct proc *p, struct kqueue_args *uap) +kqueue(struct kqueue_args *uap) { + struct proc *p = curproc; struct filedesc *fdp = p->p_fd; struct kqueue *kq; struct file *fp; @@ -391,8 +392,9 @@ struct kevent_args { }; #endif int -kevent(struct proc *p, struct kevent_args *uap) +kevent(struct kevent_args *uap) { + struct proc *p = curproc; struct filedesc* fdp = p->p_fd; struct kevent *kevp; struct kqueue *kq; @@ -756,7 +758,7 @@ kqueue_poll(struct file *fp, int events, struct ucred *cred, struct proc *p) if (kq->kq_count) { revents |= events & (POLLIN | POLLRDNORM); } else { - selrecord(p, &kq->kq_sel); + selrecord(p->p_thread, &kq->kq_sel); kq->kq_state |= KQ_SEL; } } diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 84c2006dd7..e18713641d 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_exec.c,v 1.107.2.15 2002/07/30 15:40:46 nectar Exp $ - * $DragonFly: src/sys/kern/kern_exec.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_exec.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -101,10 +101,9 @@ struct execve_args { * execve() system call. */ int -execve(p, uap) - struct proc *p; - register struct execve_args *uap; +execve(struct execve_args *uap) { + struct proc *p = curproc; struct nameidata nd, *ndp; register_t *stack_base; int error, len, i; @@ -319,8 +318,8 @@ interpret: * root. Record any set-id flags first to make sure that * we do not regain any tracing during a possible block. */ - setsugid(p); - if (p->p_tracep && suser(p)) { + setsugid(); + if (p->p_tracep && suser()) { struct vnode *vtmp; if ((vtmp = p->p_tracep) != NULL) { @@ -340,20 +339,20 @@ interpret: */ p->p_ucred = crcopy(p->p_ucred); if (attr.va_mode & VSUID) - change_euid(p, attr.va_uid); + change_euid(attr.va_uid); if (attr.va_mode & VSGID) p->p_ucred->cr_gid = attr.va_gid; } else { - if (p->p_ucred->cr_uid == p->p_cred->p_ruid && - p->p_ucred->cr_gid == p->p_cred->p_rgid) + if (p->p_ucred->cr_uid == p->p_ucred->cr_ruid && + p->p_ucred->cr_gid == p->p_ucred->cr_rgid) p->p_flag &= ~P_SUGID; } /* * Implement correct POSIX saved-id behavior. */ - p->p_cred->p_svuid = p->p_ucred->cr_uid; - p->p_cred->p_svgid = p->p_ucred->cr_gid; + p->p_ucred->cr_svuid = p->p_ucred->cr_uid; + p->p_ucred->cr_svgid = p->p_ucred->cr_gid; /* * Store the vp for use in procfs @@ -426,7 +425,7 @@ exec_fail: p->p_flag &= ~P_INEXEC; if (imgp->vmspace_destroyed) { /* sorry, no more process anymore. exit gracefully */ - exit1(p, W_EXITCODE(0, SIGABRT)); + exit1(W_EXITCODE(0, SIGABRT)); /* NOT REACHED */ return(0); } else { @@ -435,8 +434,7 @@ exec_fail: } int -exec_map_first_page(imgp) - struct image_params *imgp; +exec_map_first_page(struct image_params *imgp) { int s, rv, i; int initial_pagein; diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index d368a261d9..90fce8a7d3 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -37,7 +37,7 @@ * * @(#)kern_exit.c 8.7 (Berkeley) 2/12/94 * $FreeBSD: src/sys/kern/kern_exit.c,v 1.92.2.11 2003/01/13 22:51:16 dillon Exp $ - * $DragonFly: src/sys/kern/kern_exit.c,v 1.7 2003/06/21 17:31:19 dillon Exp $ + * $DragonFly: src/sys/kern/kern_exit.c,v 1.8 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_compat.h" @@ -77,7 +77,7 @@ MALLOC_DEFINE(M_ZOMBIE, "zombie", "zombie proc status"); static MALLOC_DEFINE(M_ATEXIT, "atexit", "atexit callback"); -static int wait1 __P((struct proc *, struct wait_args *, int)); +static int wait1 __P((struct wait_args *, int)); /* * callout list for things to do at exit time @@ -93,16 +93,13 @@ static struct exit_list_head exit_list = TAILQ_HEAD_INITIALIZER(exit_list); /* * exit -- * Death of process. + * + * SYS_EXIT_ARGS(int rval) */ void -sys_exit(p, uap) - struct proc *p; - struct sys_exit_args /* { - int rval; - } */ *uap; +sys_exit(struct sys_exit_args *uap) { - - exit1(p, W_EXITCODE(uap->rval, 0)); + exit1(W_EXITCODE(uap->rval, 0)); /* NOTREACHED */ } @@ -112,12 +109,11 @@ sys_exit(p, uap) * status and rusage for wait(). Check for child processes and orphan them. */ void -exit1(p, rv) - register struct proc *p; - int rv; +exit1(int rv) { - register struct proc *q, *nq; - register struct vmspace *vm; + struct proc *p = curproc; + struct proc *q, *nq; + struct vmspace *vm; struct vnode *vtmp; struct exitlist *ep; @@ -140,7 +136,7 @@ exit1(p, rv) * The interface for kill is better * than the internal signal */ - kill(p, &killArgs); + kill(&killArgs); nq = q; q = q->p_peers; } @@ -392,12 +388,13 @@ exit1(p, rv) } #ifdef COMPAT_43 +/* + * owait() + * + * owait_args(int dummy) + */ int -owait(p, uap) - struct proc *p; - register struct owait_args /* { - int dummy; - } */ *uap; +owait(struct owait_args *uap) { struct wait_args w; @@ -405,33 +402,27 @@ owait(p, uap) w.rusage = NULL; w.pid = WAIT_ANY; w.status = NULL; - return (wait1(p, &w, 1)); + return (wait1(&w, 1)); } #endif /* COMPAT_43 */ int -wait4(p, uap) - struct proc *p; - struct wait_args *uap; +wait4(struct wait_args *uap) { - - return (wait1(p, uap, 0)); + return (wait1(uap, 0)); } +/* + * wait1() + * + * wait_args(int pid, int *status, int options, struct rusage *rusage) + */ static int -wait1(q, uap, compat) - register struct proc *q; - register struct wait_args /* { - int pid; - int *status; - int options; - struct rusage *rusage; - } */ *uap; - int compat; +wait1(struct wait_args *uap, int compat) { - register int nfound; - register struct proc *p, *t; - int status, error; + struct proc *q = curproc; + struct proc *p, *t; + int status, nfound, error; if (uap->pid == 0) uap->pid = -q->p_pgid; @@ -511,26 +502,13 @@ loop: /* * Decrement the count of procs running with this uid. */ - (void)chgproccnt(p->p_cred->p_uidinfo, -1, 0); + (void)chgproccnt(p->p_ucred->cr_ruidinfo, -1, 0); /* * Free up credentials. */ - if (--p->p_cred->p_refcnt == 0) { - crfree(p->p_ucred); - uifree(p->p_cred->p_uidinfo); - FREE(p->p_cred, M_SUBPROC); - p->p_cred = NULL; - } - - /* - * Destroy empty prisons - */ - if (p->p_prison && !--p->p_prison->pr_ref) { - if (p->p_prison->pr_linux != NULL) - FREE(p->p_prison->pr_linux, M_PRISON); - FREE(p->p_prison, M_PRISON); - } + crfree(p->p_ucred); + p->p_ucred = NULL; /* * Remove unused arguments diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 20971fdc10..50651cacd6 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -37,7 +37,7 @@ * * @(#)kern_fork.c 8.6 (Berkeley) 4/8/94 * $FreeBSD: src/sys/kern/kern_fork.c,v 1.72.2.13 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/kern/kern_fork.c,v 1.6 2003/06/22 04:30:42 dillon Exp $ + * $DragonFly: src/sys/kern/kern_fork.c,v 1.7 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_ktrace.h" @@ -91,12 +91,11 @@ int forksleep; /* Place for fork1() to sleep on. */ /* ARGSUSED */ int -fork(p, uap) - struct proc *p; - struct fork_args *uap; +fork(struct fork_args *uap) { - int error; + struct proc *p = curproc; struct proc *p2; + int error; error = fork1(p, RFFDG | RFPROC, &p2); if (error == 0) { @@ -109,12 +108,11 @@ fork(p, uap) /* ARGSUSED */ int -vfork(p, uap) - struct proc *p; - struct vfork_args *uap; +vfork(struct vfork_args *uap) { - int error; + struct proc *p = curproc; struct proc *p2; + int error; error = fork1(p, RFFDG | RFPROC | RFPPWAIT | RFMEM, &p2); if (error == 0) { @@ -126,12 +124,11 @@ vfork(p, uap) } int -rfork(p, uap) - struct proc *p; - struct rfork_args *uap; +rfork(struct rfork_args *uap) { - int error; + struct proc *p = curproc; struct proc *p2; + int error; error = fork1(p, uap->flags, &p2); if (error == 0) { @@ -235,7 +232,7 @@ fork1(p1, flags, procp) * exceed the limit. The variable nprocs is the current number of * processes, maxproc is the limit. */ - uid = p1->p_cred->p_ruid; + uid = p1->p_ucred->cr_ruid; if ((nprocs >= maxproc - 10 && uid != 0) || nprocs >= maxproc) { tsleep(&forksleep, PUSER, "fork", hz / 2); return (EAGAIN); @@ -250,7 +247,7 @@ fork1(p1, flags, procp) * Increment the count of procs running with this uid. Don't allow * a nonprivileged user to exceed their current limit. */ - ok = chgproccnt(p1->p_cred->p_uidinfo, 1, + ok = chgproccnt(p1->p_ucred->cr_ruidinfo, 1, (uid != 0) ? p1->p_rlimit[RLIMIT_NPROC].rlim_cur : 0); if (!ok) { /* @@ -359,15 +356,11 @@ again: p2->p_flag = P_INMEM; if (p1->p_flag & P_PROFIL) startprofclock(p2); - MALLOC(p2->p_cred, struct pcred *, sizeof(struct pcred), - M_SUBPROC, M_WAITOK); - bcopy(p1->p_cred, p2->p_cred, sizeof(*p2->p_cred)); - p2->p_cred->p_refcnt = 1; crhold(p1->p_ucred); - uihold(p1->p_cred->p_uidinfo); + p2->p_ucred = p1->p_ucred; - if (p2->p_prison) { - p2->p_prison->pr_ref++; + if (p2->p_ucred->cr_prison) { + p2->p_ucred->cr_prison->pr_ref++; p2->p_flag |= P_JAILED; } diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 8254205231..8cdb815854 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/sys/kern/kern_jail.c,v 1.6.2.3 2001/08/17 01:00:26 rwatson Exp $ - * $DragonFly: src/sys/kern/kern_jail.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_jail.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ * */ @@ -45,19 +45,21 @@ SYSCTL_INT(_jail, OID_AUTO, sysvipc_allowed, CTLFLAG_RW, &jail_sysvipc_allowed, 0, "Processes in jail can use System V IPC primitives"); +/* + * jail() + * + * jail_args(syscallarg(struct jail *) jail) + */ int -jail(p, uap) - struct proc *p; - struct jail_args /* { - syscallarg(struct jail *) jail; - } */ *uap; +jail(struct jail_args *uap) { int error; struct prison *pr; struct jail j; struct chroot_args ca; + struct proc *p = curproc; - error = suser(p); + error = suser(); if (error) return (error); error = copyin(uap->jail, &j, sizeof j); @@ -73,12 +75,13 @@ jail(p, uap) pr->pr_ip = j.ip_number; ca.path = j.path; - error = chroot(p, &ca); + error = chroot(&ca); if (error) goto bail; pr->pr_ref++; - p->p_prison = pr; + p->p_ucred = crcopy(p->p_ucred); + p->p_ucred->cr_prison = pr; p->p_flag |= P_JAILED; return (0); @@ -91,8 +94,9 @@ int prison_ip(struct proc *p, int flag, u_int32_t *ip) { u_int32_t tmp; + struct prison *pr; - if (!p->p_prison) + if ((pr = p->p_ucred->cr_prison) == NULL) return (0); if (flag) tmp = *ip; @@ -100,19 +104,19 @@ prison_ip(struct proc *p, int flag, u_int32_t *ip) tmp = ntohl(*ip); if (tmp == INADDR_ANY) { if (flag) - *ip = p->p_prison->pr_ip; + *ip = pr->pr_ip; else - *ip = htonl(p->p_prison->pr_ip); + *ip = htonl(pr->pr_ip); return (0); } if (tmp == INADDR_LOOPBACK) { if (flag) - *ip = p->p_prison->pr_ip; + *ip = pr->pr_ip; else - *ip = htonl(p->p_prison->pr_ip); + *ip = htonl(pr->pr_ip); return (0); } - if (p->p_prison->pr_ip != tmp) + if (pr->pr_ip != tmp) return (1); return (0); } @@ -121,8 +125,11 @@ void prison_remote_ip(struct proc *p, int flag, u_int32_t *ip) { u_int32_t tmp; + struct prison *pr; - if (!p || !p->p_prison) + if (p == NULL) + return; + if ((pr = p->p_ucred->cr_prison) == NULL) return; if (flag) tmp = *ip; @@ -130,9 +137,9 @@ prison_remote_ip(struct proc *p, int flag, u_int32_t *ip) tmp = ntohl(*ip); if (tmp == INADDR_LOOPBACK) { if (flag) - *ip = p->p_prison->pr_ip; + *ip = pr->pr_ip; else - *ip = htonl(p->p_prison->pr_ip); + *ip = htonl(pr->pr_ip); return; } return; @@ -141,14 +148,17 @@ prison_remote_ip(struct proc *p, int flag, u_int32_t *ip) int prison_if(struct proc *p, struct sockaddr *sa) { + struct prison *pr; struct sockaddr_in *sai = (struct sockaddr_in*) sa; int ok; + pr = p->p_ucred->cr_prison; + if ((sai->sin_family != AF_INET) && jail_socket_unixiproute_only) ok = 1; else if (sai->sin_family != AF_INET) ok = 0; - else if (p->p_prison->pr_ip != ntohl(sai->sin_addr.s_addr)) + else if (pr->pr_ip != ntohl(sai->sin_addr.s_addr)) ok = 1; else ok = 0; diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index b6bb4229e6..8fbaf93690 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_kthread.c,v 1.5.2.3 2001/12/25 01:51:14 dillon Exp $ - * $DragonFly: src/sys/kern/kern_kthread.c,v 1.4 2003/06/22 17:39:42 dillon Exp $ + * $DragonFly: src/sys/kern/kern_kthread.c,v 1.5 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -104,7 +104,7 @@ void kthread_exit(int ecode) { proc_reparent(curproc, initproc); - exit1(curproc, W_EXITCODE(ecode, 0)); + exit1(W_EXITCODE(ecode, 0)); } /* diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index cdd11069a9..36aee9351c 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -32,7 +32,7 @@ * * @(#)kern_ktrace.c 8.2 (Berkeley) 9/23/93 * $FreeBSD: src/sys/kern/kern_ktrace.c,v 1.35.2.6 2002/07/05 22:36:38 darrenr Exp $ - * $DragonFly: src/sys/kern/kern_ktrace.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_ktrace.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_ktrace.h" @@ -269,13 +269,12 @@ struct ktrace_args { #endif /* ARGSUSED */ int -ktrace(curp, uap) - struct proc *curp; - register struct ktrace_args *uap; +ktrace(struct ktrace_args *uap) { #ifdef KTRACE - register struct vnode *vp = NULL; - register struct proc *p; + struct proc *curp = curproc; + struct vnode *vp = NULL; + struct proc *p; struct pgrp *pg; int facs = uap->facs & ~KTRFAC_ROOT; int ops = KTROP(uap->ops); @@ -379,9 +378,7 @@ done: */ /* ARGSUSED */ int -utrace(curp, uap) - struct proc *curp; - register struct utrace_args *uap; +utrace(struct utrace_args *uap) { #ifdef KTRACE struct ktr_header *kth; @@ -560,21 +557,20 @@ ktrwrite(vp, kth, uio) * TODO: check groups. use caller effective gid. */ static int -ktrcanset(callp, targetp) - struct proc *callp, *targetp; +ktrcanset(struct proc *callp, struct proc *targetp) { - register struct pcred *caller = callp->p_cred; - register struct pcred *target = targetp->p_cred; + struct ucred *caller = callp->p_ucred; + struct ucred *target = targetp->p_ucred; - if (!PRISON_CHECK(callp, targetp)) + if (!PRISON_CHECK(caller, target)) return (0); - if ((caller->pc_ucred->cr_uid == target->p_ruid && - target->p_ruid == target->p_svuid && - caller->p_rgid == target->p_rgid && /* XXX */ - target->p_rgid == target->p_svgid && + if ((caller->cr_uid == target->cr_ruid && + target->cr_ruid == target->cr_svuid && + caller->cr_rgid == target->cr_rgid && /* XXX */ + target->cr_rgid == target->cr_svgid && (targetp->p_traceflag & KTRFAC_ROOT) == 0 && (targetp->p_flag & P_SUGID) == 0) || - caller->pc_ucred->cr_uid == 0) + caller->cr_uid == 0) return (1); return (0); diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index 2c57d188e7..5dda4a9b84 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_linker.c,v 1.41.2.3 2001/11/21 17:50:35 luigi Exp $ - * $DragonFly: src/sys/kern/kern_linker.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_linker.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_ddb.h" @@ -649,8 +649,9 @@ linker_ddb_symbol_values(c_linker_sym_t sym, linker_symval_t *symval) */ int -kldload(struct proc* p, struct kldload_args* uap) +kldload(struct kldload_args *uap) { + struct proc *p = curproc; char* filename = NULL, *modulename; linker_file_t lf; int error = 0; @@ -660,7 +661,7 @@ kldload(struct proc* p, struct kldload_args* uap) if (securelevel > 0) /* redundant, but that's OK */ return EPERM; - if ((error = suser(p)) != 0) + if ((error = suser()) != 0) return error; filename = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); @@ -691,7 +692,7 @@ out: } int -kldunload(struct proc* p, struct kldunload_args* uap) +kldunload(struct kldunload_args *uap) { linker_file_t lf; int error = 0; @@ -699,7 +700,7 @@ kldunload(struct proc* p, struct kldunload_args* uap) if (securelevel > 0) /* redundant, but that's OK */ return EPERM; - if ((error = suser(p)) != 0) + if ((error = suser()) != 0) return error; lf = linker_find_file_by_id(SCARG(uap, fileid)); @@ -722,9 +723,10 @@ out: } int -kldfind(struct proc* p, struct kldfind_args* uap) +kldfind(struct kldfind_args *uap) { - char* filename = NULL, *modulename; + struct proc *p = curproc; + char *filename = NULL, *modulename; linker_file_t lf; int error = 0; @@ -751,8 +753,9 @@ out: } int -kldnext(struct proc* p, struct kldnext_args* uap) +kldnext(struct kldnext_args *uap) { + struct proc *p = curproc; linker_file_t lf; int error = 0; @@ -777,8 +780,9 @@ kldnext(struct proc* p, struct kldnext_args* uap) } int -kldstat(struct proc* p, struct kldstat_args* uap) +kldstat(struct kldstat_args *uap) { + struct proc *p = curproc; linker_file_t lf; int error = 0; int version; @@ -824,8 +828,9 @@ out: } int -kldfirstmod(struct proc* p, struct kldfirstmod_args* uap) +kldfirstmod(struct kldfirstmod_args *uap) { + struct proc *p = curproc; linker_file_t lf; int error = 0; @@ -842,7 +847,7 @@ kldfirstmod(struct proc* p, struct kldfirstmod_args* uap) } int -kldsym(struct proc *p, struct kldsym_args *uap) +kldsym(struct kldsym_args *uap) { char *symstr = NULL; c_linker_sym_t sym; diff --git a/sys/kern/kern_memio.c b/sys/kern/kern_memio.c index 9754d11339..96da393458 100644 --- a/sys/kern/kern_memio.c +++ b/sys/kern/kern_memio.c @@ -39,7 +39,7 @@ * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/mem.c,v 1.79.2.9 2003/01/04 22:58:01 njl Exp $ - * $DragonFly: src/sys/kern/kern_memio.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/kern/kern_memio.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ /* @@ -101,19 +101,17 @@ static struct random_softc random_softc[16]; static caddr_t zbuf; MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); -static int mem_ioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); -static int random_ioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); +static int mem_ioctl __P((dev_t, u_long, caddr_t, int, struct thread *)); +static int random_ioctl __P((dev_t, u_long, caddr_t, int, struct thread *)); struct mem_range_softc mem_range_softc; static int -mmclose(dev, flags, fmt, p) - dev_t dev; - int flags; - int fmt; - struct proc *p; +mmclose(dev_t dev, int flags, int fmt, struct thread *td) { + struct proc *p = td->td_proc; + switch (minor(dev)) { case 14: p->p_md.md_regs->tf_eflags &= ~PSL_IOPL; @@ -125,13 +123,10 @@ mmclose(dev, flags, fmt, p) } static int -mmopen(dev, flags, fmt, p) - dev_t dev; - int flags; - int fmt; - struct proc *p; +mmopen(dev_t dev, int flags, int fmt, struct thread *td) { int error; + struct proc *p = td->td_proc; switch (minor(dev)) { case 0: @@ -140,7 +135,7 @@ mmopen(dev, flags, fmt, p) return (EPERM); break; case 14: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); if (securelevel > 0) @@ -329,20 +324,15 @@ memmmap(dev_t dev, vm_offset_t offset, int nprot) } static int -mmioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { switch (minor(dev)) { case 0: - return mem_ioctl(dev, cmd, data, flags, p); + return mem_ioctl(dev, cmd, data, flags, td); case 3: case 4: - return random_ioctl(dev, cmd, data, flags, p); + return random_ioctl(dev, cmd, data, flags, td); } return (ENODEV); } @@ -354,12 +344,7 @@ mmioctl(dev, cmd, data, flags, p) * and mem_range_attr_set. */ static int -mem_ioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +mem_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { int nd, error = 0; struct mem_range_op *mo = (struct mem_range_op *)data; @@ -453,13 +438,9 @@ mem_range_AP_init(void) #endif static int -random_ioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +random_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { + struct proc *p = td->td_proc; static intrmask_t interrupt_allowed; intrmask_t interrupt_mask; int error, intr; @@ -490,7 +471,7 @@ random_ioctl(dev, cmd, data, flags, p) case FIONBIO: break; case MEM_SETIRQ: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); if (intr < 0 || intr >= 16) @@ -507,7 +488,7 @@ random_ioctl(dev, cmd, data, flags, p) enable_intr(); break; case MEM_CLEARIRQ: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); if (intr < 0 || intr >= 16) @@ -521,7 +502,7 @@ random_ioctl(dev, cmd, data, flags, p) enable_intr(); break; case MEM_RETURNIRQ: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); *(u_int16_t *)data = interrupt_allowed; @@ -531,17 +512,14 @@ random_ioctl(dev, cmd, data, flags, p) } int -mmpoll(dev, events, p) - dev_t dev; - int events; - struct proc *p; +mmpoll(dev_t dev, int events, struct thread *td) { switch (minor(dev)) { case 3: /* /dev/random */ - return random_poll(dev, events, p); + return random_poll(dev, events, td); case 4: /* /dev/urandom */ default: - return seltrue(dev, events, p); + return seltrue(dev, events, td); } } diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index bf57e4d936..836c9e20a7 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -38,7 +38,7 @@ * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 * $FreeBSD: src/sys/kern/kern_mib.c,v 1.29.2.4 2001/07/30 23:28:00 peter Exp $ - * $DragonFly: src/sys/kern/kern_mib.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_mib.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -148,17 +148,19 @@ char hostname[MAXHOSTNAMELEN]; static int sysctl_hostname(SYSCTL_HANDLER_ARGS) { + struct proc *p = req->p; int error; - if (req->p->p_prison) { + if (p && p->p_ucred->cr_prison) { if (!jail_set_hostname_allowed && req->newptr) return(EPERM); error = sysctl_handle_string(oidp, - req->p->p_prison->pr_host, - sizeof req->p->p_prison->pr_host, req); - } else + p->p_ucred->cr_prison->pr_host, + sizeof p->p_ucred->cr_prison->pr_host, req); + } else { error = sysctl_handle_string(oidp, hostname, sizeof hostname, req); + } return (error); } diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c index 9f9dc69bc5..d487566760 100644 --- a/sys/kern/kern_module.c +++ b/sys/kern/kern_module.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_module.c,v 1.21 1999/11/08 06:53:30 peter Exp $ - * $DragonFly: src/sys/kern/kern_module.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_module.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -231,8 +231,9 @@ module_setspecific(module_t mod, modspecific_t *datap) * Syscalls. */ int -modnext(struct proc* p, struct modnext_args* uap) +modnext(struct modnext_args *uap) { + struct proc *p = curproc; module_t mod; p->p_retval[0] = -1; @@ -257,8 +258,9 @@ modnext(struct proc* p, struct modnext_args* uap) } int -modfnext(struct proc* p, struct modfnext_args* uap) +modfnext(struct modfnext_args *uap) { + struct proc *p = curproc; module_t mod; p->p_retval[0] = -1; @@ -282,8 +284,9 @@ struct module_stat_v1 { }; int -modstat(struct proc* p, struct modstat_args* uap) +modstat(struct modstat_args *uap) { + struct proc *p = curproc; module_t mod; int error = 0; int namelen; @@ -333,8 +336,9 @@ out: } int -modfind(struct proc* p, struct modfind_args* uap) +modfind(struct modfind_args *uap) { + struct proc *p = curproc; int error = 0; char name[MAXMODNAME]; module_t mod; diff --git a/sys/kern/kern_ntptime.c b/sys/kern/kern_ntptime.c index aa4f1ba212..3a8f154c0c 100644 --- a/sys/kern/kern_ntptime.c +++ b/sys/kern/kern_ntptime.c @@ -29,7 +29,7 @@ * confusing and/or plain wrong in that context. * * $FreeBSD: src/sys/kern/kern_ntptime.c,v 1.32.2.2 2001/04/22 11:19:46 jhay Exp $ - * $DragonFly: src/sys/kern/kern_ntptime.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_ntptime.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_ntp.h" @@ -271,7 +271,7 @@ struct ntp_adjtime_args { #endif int -ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap) +ntp_adjtime(struct ntp_adjtime_args *uap) { struct timex ntv; /* temporary structure */ long freq; /* frequency ns/s) */ @@ -294,7 +294,7 @@ ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap) */ modes = ntv.modes; if (modes) - error = suser(p); + error = suser(); if (error) return (error); s = splclock(); @@ -410,9 +410,9 @@ ntp_adjtime(struct proc *p, struct ntp_adjtime_args *uap) time_status & STA_PPSJITTER) || (time_status & STA_PPSFREQ && time_status & (STA_PPSWANDER | STA_PPSERROR))) - p->p_retval[0] = TIME_ERROR; + curproc->p_retval[0] = TIME_ERROR; else - p->p_retval[0] = time_state; + curproc->p_retval[0] = time_state; return (error); } diff --git a/sys/kern/kern_p1003_1b.c b/sys/kern/kern_p1003_1b.c index 25f6aaa1bc..a985960a74 100644 --- a/sys/kern/kern_p1003_1b.c +++ b/sys/kern/kern_p1003_1b.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/posix4/p1003_1b.c,v 1.5.2.2 2003/03/25 06:13:35 rwatson Exp $ - * $DragonFly: src/sys/kern/kern_p1003_1b.c,v 1.2 2003/06/17 04:28:57 dillon Exp $ + * $DragonFly: src/sys/kern/kern_p1003_1b.c,v 1.3 2003/06/23 17:55:49 dillon Exp $ */ /* p1003_1b: Real Time common code. @@ -69,14 +69,14 @@ MALLOC_DEFINE(M_P31B, "p1003.1b", "Posix 1003.1B"); * * Can process p, with pcred pc, do "write flavor" operations to process q? */ -#define CAN_AFFECT(p, pc, q) \ - ((pc)->pc_ucred->cr_uid == 0 || \ - (pc)->p_ruid == (q)->p_cred->p_ruid || \ - (pc)->pc_ucred->cr_uid == (q)->p_cred->p_ruid || \ - (pc)->p_ruid == (q)->p_ucred->cr_uid || \ - (pc)->pc_ucred->cr_uid == (q)->p_ucred->cr_uid) +#define CAN_AFFECT(p, cr, q) \ + ((cr)->cr_uid == 0 || \ + (cr)->cr_ruid == (q)->p_ucred->cr_ruid || \ + (cr)->cr_uid == (q)->p_ucred->cr_ruid || \ + (cr)->cr_ruid == (q)->p_ucred->cr_uid || \ + (cr)->cr_uid == (q)->p_ucred->cr_uid) #else -#define CAN_AFFECT(p, pc, q) ((pc)->pc_ucred->cr_uid == 0) +#define CAN_AFFECT(p, cr, q) ((cr)->cr_uid == 0) #endif /* @@ -97,7 +97,7 @@ int p31b_proc(struct proc *p, pid_t pid, struct proc **pp) { /* Enforce permission policy. */ - if (CAN_AFFECT(p, p->p_cred, other_proc)) + if (CAN_AFFECT(p, p->p_ucred, other_proc)) *pp = other_proc; else ret = EPERM; @@ -159,26 +159,26 @@ static int sched_attach(void) return ret; } -int sched_setparam(struct proc *p, - struct sched_setparam_args *uap) +int +sched_setparam(struct sched_setparam_args *uap) { + struct proc *p = curproc; int e; struct sched_param sched_param; copyin(uap->param, &sched_param, sizeof(sched_param)); - (void) (0 - || (e = p31b_proc(p, uap->pid, &p)) - || (e = ksched_setparam(&p->p_retval[0], ksched, p, - (const struct sched_param *)&sched_param)) - ); - + if ((e = p31b_proc(p, uap->pid, &p)) == 0) { + e = ksched_setparam(&p->p_retval[0], ksched, p, + (const struct sched_param *)&sched_param); + } return e; } -int sched_getparam(struct proc *p, - struct sched_getparam_args *uap) +int +sched_getparam(struct sched_getparam_args *uap) { + struct proc *p = curproc; struct proc *targetp; struct sched_param sched_param; int e; @@ -187,8 +187,9 @@ int sched_getparam(struct proc *p, e = p31b_proc(p, uap->pid, &targetp); if (e) return e; - } else + } else { targetp = p; + } e = ksched_getparam(&p->p_retval[0], ksched, targetp, &sched_param); @@ -197,26 +198,27 @@ int sched_getparam(struct proc *p, return e; } -int sched_setscheduler(struct proc *p, - struct sched_setscheduler_args *uap) + +int +sched_setscheduler(struct sched_setscheduler_args *uap) { + struct proc *p = curproc; int e; struct sched_param sched_param; copyin(uap->param, &sched_param, sizeof(sched_param)); - (void) (0 - || (e = p31b_proc(p, uap->pid, &p)) - || (e = ksched_setscheduler(&p->p_retval[0], - ksched, p, uap->policy, - (const struct sched_param *)&sched_param)) - ); - + if ((e = p31b_proc(p, uap->pid, &p)) == 0) { + e = ksched_setscheduler(&p->p_retval[0], ksched, p, + uap->policy, (const struct sched_param *)&sched_param); + } return e; } -int sched_getscheduler(struct proc *p, - struct sched_getscheduler_args *uap) + +int +sched_getscheduler(struct sched_getscheduler_args *uap) { + struct proc *p = curproc; struct proc *targetp; int e; @@ -224,41 +226,46 @@ int sched_getscheduler(struct proc *p, e = p31b_proc(p, uap->pid, &targetp); if (e) return e; - } else + } else { targetp = p; + } e = ksched_getscheduler(&p->p_retval[0], ksched, targetp); return e; } -int sched_yield(struct proc *p, - struct sched_yield_args *uap) + +int +sched_yield(struct sched_yield_args *uap) { + struct proc *p = curproc; return ksched_yield(&p->p_retval[0], ksched); } -int sched_get_priority_max(struct proc *p, - struct sched_get_priority_max_args *uap) + +int +sched_get_priority_max(struct sched_get_priority_max_args *uap) { - return ksched_get_priority_max(&p->p_retval[0], - ksched, uap->policy); + struct proc *p = curproc; + return ksched_get_priority_max(&p->p_retval[0], ksched, uap->policy); } -int sched_get_priority_min(struct proc *p, - struct sched_get_priority_min_args *uap) + +int +sched_get_priority_min(struct sched_get_priority_min_args *uap) { - return ksched_get_priority_min(&p->p_retval[0], - ksched, uap->policy); + struct proc *p = curproc; + return ksched_get_priority_min(&p->p_retval[0], ksched, uap->policy); } -int sched_rr_get_interval(struct proc *p, - struct sched_rr_get_interval_args *uap) + +int +sched_rr_get_interval(struct sched_rr_get_interval_args *uap) { int e; + struct proc *p = curproc; - (void) (0 - || (e = p31b_proc(p, uap->pid, &p)) - || (e = ksched_rr_get_interval(&p->p_retval[0], ksched, - p, uap->interval)) - ); - + if ((e = p31b_proc(p, uap->pid, &p)) == 0) { + e = ksched_rr_get_interval(&p->p_retval[0], ksched, + p, uap->interval); + } return e; } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 48909428d7..530c27ec4e 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -32,7 +32,7 @@ * * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 * $FreeBSD: src/sys/kern/kern_proc.c,v 1.63.2.9 2003/05/08 07:47:16 kbyanc Exp $ - * $DragonFly: src/sys/kern/kern_proc.c,v 1.3 2003/06/18 16:30:14 dillon Exp $ + * $DragonFly: src/sys/kern/kern_proc.c,v 1.4 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -362,10 +362,8 @@ fill_eproc(p, ep) bzero(ep, sizeof(*ep)); ep->e_paddr = p; - if (p->p_cred) { - ep->e_pcred = *p->p_cred; - if (p->p_ucred) - ep->e_ucred = *p->p_ucred; + if (p->p_ucred) { + ep->e_ucred = *p->p_ucred; } if (p->p_procsig) { ep->e_procsig = *p->p_procsig; @@ -447,6 +445,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) struct proc *p; int doingzomb; int error = 0; + struct ucred *cr1 = curproc->p_ucred; if (oidp->oid_number == KERN_PROC_PID) { if (namelen != 1) @@ -454,7 +453,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) p = pfind((pid_t)name[0]); if (!p) return (0); - if (!PRISON_CHECK(curproc, p)) + if (!PRISON_CHECK(cr1, p->p_ucred)) return (0); error = sysctl_out_proc(p, req, 0); return (error); @@ -481,7 +480,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) /* * Show a user only their processes. */ - if ((!ps_showallprocs) && p_trespass(curproc, p)) + if ((!ps_showallprocs) && p_trespass(cr1, p->p_ucred)) continue; /* * Skip embryonic processes. @@ -518,12 +517,12 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS) case KERN_PROC_RUID: if (p->p_ucred == NULL || - p->p_cred->p_ruid != (uid_t)name[0]) + p->p_ucred->cr_ruid != (uid_t)name[0]) continue; break; } - if (!PRISON_CHECK(curproc, p)) + if (!PRISON_CHECK(cr1, p->p_ucred)) continue; error = sysctl_out_proc(p, req, doingzomb); @@ -548,6 +547,7 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS) struct proc *p; struct pargs *pa; int error = 0; + struct ucred *cr1 = curproc->p_ucred; if (namelen != 1) return (EINVAL); @@ -556,7 +556,7 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS) if (!p) return (0); - if ((!ps_argsopen) && p_trespass(curproc, p)) + if ((!ps_argsopen) && p_trespass(cr1, p->p_ucred)) return (0); if (req->newptr && curproc != p) diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index a7c110725b..f2d596c4ef 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -37,7 +37,7 @@ * * @(#)kern_prot.c 8.6 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_prot.c,v 1.53.2.9 2002/03/09 05:20:26 dd Exp $ - * $DragonFly: src/sys/kern/kern_prot.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_prot.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* @@ -55,6 +55,7 @@ #include #include #include +#include static MALLOC_DEFINE(M_CRED, "cred", "credentials"); @@ -69,10 +70,9 @@ struct getpid_args { */ /* ARGSUSED */ int -getpid(p, uap) - struct proc *p; - struct getpid_args *uap; +getpid(struct getpid_args *uap) { + struct proc *p = curproc; p->p_retval[0] = p->p_pid; #if defined(COMPAT_43) || defined(COMPAT_SUNOS) @@ -88,10 +88,9 @@ struct getppid_args { #endif /* ARGSUSED */ int -getppid(p, uap) - struct proc *p; - struct getppid_args *uap; +getppid(struct getppid_args *uap) { + struct proc *p = curproc; p->p_retval[0] = p->p_pptr->p_pid; return (0); @@ -109,10 +108,9 @@ struct getpgrp_args { #endif int -getpgrp(p, uap) - struct proc *p; - struct getpgrp_args *uap; +getpgrp(struct getpgrp_args *uap) { + struct proc *p = curproc; p->p_retval[0] = p->p_pgrp->pg_id; return (0); @@ -126,10 +124,9 @@ struct getpgid_args { #endif int -getpgid(p, uap) - struct proc *p; - struct getpgid_args *uap; +getpgid(struct getpgid_args *uap) { + struct proc *p = curproc; struct proc *pt; pt = p; @@ -153,10 +150,9 @@ struct getsid_args { #endif int -getsid(p, uap) - struct proc *p; - struct getsid_args *uap; +getsid(struct getsid_args *uap) { + struct proc *p = curproc; struct proc *pt; pt = p; @@ -182,12 +178,11 @@ struct getuid_args { /* ARGSUSED */ int -getuid(p, uap) - struct proc *p; - struct getuid_args *uap; +getuid(struct getuid_args *uap) { + struct proc *p = curproc; - p->p_retval[0] = p->p_cred->p_ruid; + p->p_retval[0] = p->p_ucred->cr_ruid; #if defined(COMPAT_43) || defined(COMPAT_SUNOS) p->p_retval[1] = p->p_ucred->cr_uid; #endif @@ -205,10 +200,9 @@ struct geteuid_args { /* ARGSUSED */ int -geteuid(p, uap) - struct proc *p; - struct geteuid_args *uap; +geteuid(struct geteuid_args *uap) { + struct proc *p = curproc; p->p_retval[0] = p->p_ucred->cr_uid; return (0); @@ -225,12 +219,11 @@ struct getgid_args { /* ARGSUSED */ int -getgid(p, uap) - struct proc *p; - struct getgid_args *uap; +getgid(struct getgid_args *uap) { + struct proc *p = curproc; - p->p_retval[0] = p->p_cred->p_rgid; + p->p_retval[0] = p->p_ucred->cr_rgid; #if defined(COMPAT_43) || defined(COMPAT_SUNOS) p->p_retval[1] = p->p_ucred->cr_groups[0]; #endif @@ -250,10 +243,9 @@ struct getegid_args { /* ARGSUSED */ int -getegid(p, uap) - struct proc *p; - struct getegid_args *uap; +getegid(struct getegid_args *uap) { + struct proc *p = curproc; p->p_retval[0] = p->p_ucred->cr_groups[0]; return (0); @@ -266,22 +258,25 @@ struct getgroups_args { }; #endif int -getgroups(p, uap) - struct proc *p; - register struct getgroups_args *uap; +getgroups(struct getgroups_args *uap) { - register struct pcred *pc = p->p_cred; - register u_int ngrp; + struct proc *p = curproc; + struct ucred *cr; + u_int ngrp; int error; + if (p == NULL) /* API enforcement */ + return(EPERM); + cr = p->p_ucred; + if ((ngrp = uap->gidsetsize) == 0) { - p->p_retval[0] = pc->pc_ucred->cr_ngroups; + p->p_retval[0] = cr->cr_ngroups; return (0); } - if (ngrp < pc->pc_ucred->cr_ngroups) + if (ngrp < cr->cr_ngroups) return (EINVAL); - ngrp = pc->pc_ucred->cr_ngroups; - if ((error = copyout((caddr_t)pc->pc_ucred->cr_groups, + ngrp = cr->cr_ngroups; + if ((error = copyout((caddr_t)cr->cr_groups, (caddr_t)uap->gidset, ngrp * sizeof(gid_t)))) return (error); p->p_retval[0] = ngrp; @@ -296,10 +291,9 @@ struct setsid_args { /* ARGSUSED */ int -setsid(p, uap) - register struct proc *p; - struct setsid_args *uap; +setsid(struct setsid_args *uap) { + struct proc *p = curproc; if (p->p_pgid == p->p_pid || pgfind(p->p_pid)) { return (EPERM); @@ -331,12 +325,11 @@ struct setpgid_args { #endif /* ARGSUSED */ int -setpgid(curp, uap) - struct proc *curp; - register struct setpgid_args *uap; +setpgid(struct setpgid_args *uap) { - register struct proc *targp; /* target process */ - register struct pgrp *pgrp; /* target pgrp */ + struct proc *curp = curproc; + struct proc *targp; /* target process */ + struct pgrp *pgrp; /* target pgrp */ if (uap->pgid < 0) return (EINVAL); @@ -379,14 +372,17 @@ struct setuid_args { #endif /* ARGSUSED */ int -setuid(p, uap) - struct proc *p; - struct setuid_args *uap; +setuid(struct setuid_args *uap) { - register struct pcred *pc = p->p_cred; - register uid_t uid; + struct proc *p = curproc; + struct ucred *cr; + uid_t uid; int error; + if (p == NULL) /* API enforcement */ + return(EPERM); + cr = p->p_ucred; + /* * See if we have "permission" by POSIX 1003.1 rules. * @@ -405,14 +401,14 @@ setuid(p, uap) * 3: Change euid last. (after tests in #2 for "appropriate privs") */ uid = uap->uid; - if (uid != pc->p_ruid && /* allow setuid(getuid()) */ + if (uid != cr->cr_ruid && /* allow setuid(getuid()) */ #ifdef _POSIX_SAVED_IDS - uid != pc->p_svuid && /* allow setuid(saved gid) */ + uid != crc->cr_svuid && /* allow setuid(saved gid) */ #endif #ifdef POSIX_APPENDIX_B_4_2_2 /* Use BSD-compat clause from B.4.2.2 */ - uid != pc->pc_ucred->cr_uid && /* allow setuid(geteuid()) */ + uid != cr->cr_uid && /* allow setuid(geteuid()) */ #endif - (error = suser_xxx(0, p, PRISON_ROOT))) + (error = suser_xxx(0, PRISON_ROOT))) return (error); #ifdef _POSIX_SAVED_IDS @@ -422,17 +418,17 @@ setuid(p, uap) */ if ( #ifdef POSIX_APPENDIX_B_4_2_2 /* Use the clause from B.4.2.2 */ - uid == pc->pc_ucred->cr_uid || + uid == cr->cr_uid || #endif - suser_xxx(0, p, PRISON_ROOT) == 0) /* we are using privs */ + suser_xxx(0, PRISON_ROOT) == 0) /* we are using privs */ #endif { /* * Set the real uid and transfer proc count to new user. */ - if (uid != pc->p_ruid) { - change_ruid(p, uid); - setsugid(p); + if (uid != cr->cr_ruid) { + change_ruid(uid); + setsugid(); } /* * Set saved uid @@ -441,9 +437,9 @@ setuid(p, uap) * the security of seteuid() depends on it. B.4.2.2 says it * is important that we should do this. */ - if (pc->p_svuid != uid) { - pc->p_svuid = uid; - setsugid(p); + if (cr->cr_svuid != uid) { + cr->cr_svuid = uid; + setsugid(); } } @@ -451,9 +447,9 @@ setuid(p, uap) * In all permitted cases, we are changing the euid. * Copy credentials so other references do not see our changes. */ - if (pc->pc_ucred->cr_uid != uid) { - change_euid(p, uid); - setsugid(p); + if (cr->cr_uid != uid) { + change_euid(uid); + setsugid(); } return (0); } @@ -465,26 +461,29 @@ struct seteuid_args { #endif /* ARGSUSED */ int -seteuid(p, uap) - struct proc *p; - struct seteuid_args *uap; +seteuid(struct seteuid_args *uap) { - register struct pcred *pc = p->p_cred; - register uid_t euid; + struct proc *p = curproc; + struct ucred *cr; + uid_t euid; int error; + if (p == NULL) /* API enforcement */ + return(EPERM); + + cr = p->p_ucred; euid = uap->euid; - if (euid != pc->p_ruid && /* allow seteuid(getuid()) */ - euid != pc->p_svuid && /* allow seteuid(saved uid) */ - (error = suser_xxx(0, p, PRISON_ROOT))) + if (euid != cr->cr_ruid && /* allow seteuid(getuid()) */ + euid != cr->cr_svuid && /* allow seteuid(saved uid) */ + (error = suser_xxx(0, PRISON_ROOT))) return (error); /* * Everything's okay, do it. Copy credentials so other references do * not see our changes. */ - if (pc->pc_ucred->cr_uid != euid) { - change_euid(p, euid); - setsugid(p); + if (cr->cr_uid != euid) { + change_euid(euid); + setsugid(); } return (0); } @@ -496,14 +495,17 @@ struct setgid_args { #endif /* ARGSUSED */ int -setgid(p, uap) - struct proc *p; - struct setgid_args *uap; +setgid(struct setgid_args *uap) { - register struct pcred *pc = p->p_cred; - register gid_t gid; + struct proc *p = curproc; + struct ucred *cr; + gid_t gid; int error; + if (p == NULL) /* API enforcement */ + return(EPERM); + cr = p->p_ucred; + /* * See if we have "permission" by POSIX 1003.1 rules. * @@ -516,14 +518,14 @@ setgid(p, uap) * For notes on the logic here, see setuid() above. */ gid = uap->gid; - if (gid != pc->p_rgid && /* allow setgid(getgid()) */ + if (gid != cr->cr_rgid && /* allow setgid(getgid()) */ #ifdef _POSIX_SAVED_IDS - gid != pc->p_svgid && /* allow setgid(saved gid) */ + gid != cr->cr_svgid && /* allow setgid(saved gid) */ #endif #ifdef POSIX_APPENDIX_B_4_2_2 /* Use BSD-compat clause from B.4.2.2 */ - gid != pc->pc_ucred->cr_groups[0] && /* allow setgid(getegid()) */ + gid != cr->cr_groups[0] && /* allow setgid(getegid()) */ #endif - (error = suser_xxx(0, p, PRISON_ROOT))) + (error = suser_xxx(0, PRISON_ROOT))) return (error); #ifdef _POSIX_SAVED_IDS @@ -533,17 +535,17 @@ setgid(p, uap) */ if ( #ifdef POSIX_APPENDIX_B_4_2_2 /* use the clause from B.4.2.2 */ - gid == pc->pc_ucred->cr_groups[0] || + gid == cr->cr_groups[0] || #endif - suser_xxx(0, p, PRISON_ROOT) == 0) /* we are using privs */ + suser_xxx(0, PRISON_ROOT) == 0) /* we are using privs */ #endif { /* * Set real gid */ - if (pc->p_rgid != gid) { - pc->p_rgid = gid; - setsugid(p); + if (cr->cr_rgid != gid) { + cr->cr_rgid = gid; + setsugid(); } /* * Set saved gid @@ -552,19 +554,19 @@ setgid(p, uap) * the security of setegid() depends on it. B.4.2.2 says it * is important that we should do this. */ - if (pc->p_svgid != gid) { - pc->p_svgid = gid; - setsugid(p); + if (cr->cr_svgid != gid) { + cr->cr_svgid = gid; + setsugid(); } } /* * In all cases permitted cases, we are changing the egid. * Copy credentials so other references do not see our changes. */ - if (pc->pc_ucred->cr_groups[0] != gid) { - pc->pc_ucred = crcopy(pc->pc_ucred); - pc->pc_ucred->cr_groups[0] = gid; - setsugid(p); + if (cr->cr_groups[0] != gid) { + cr = p->p_ucred = crcopy(cr); + cr->cr_groups[0] = gid; + setsugid(); } return (0); } @@ -576,23 +578,26 @@ struct setegid_args { #endif /* ARGSUSED */ int -setegid(p, uap) - struct proc *p; - struct setegid_args *uap; +setegid(struct setegid_args *uap) { - register struct pcred *pc = p->p_cred; - register gid_t egid; + struct proc *p = curproc; + struct ucred *cr; + gid_t egid; int error; + if (p == NULL) /* API enforcement */ + return(EPERM); + cr = p->p_ucred; + egid = uap->egid; - if (egid != pc->p_rgid && /* allow setegid(getgid()) */ - egid != pc->p_svgid && /* allow setegid(saved gid) */ - (error = suser_xxx(0, p, PRISON_ROOT))) + if (egid != cr->cr_rgid && /* allow setegid(getgid()) */ + egid != cr->cr_svgid && /* allow setegid(saved gid) */ + (error = suser_xxx(0, PRISON_ROOT))) return (error); - if (pc->pc_ucred->cr_groups[0] != egid) { - pc->pc_ucred = crcopy(pc->pc_ucred); - pc->pc_ucred->cr_groups[0] = egid; - setsugid(p); + if (cr->cr_groups[0] != egid) { + cr = p->p_ucred = crcopy(cr); + cr->cr_groups[0] = egid; + setsugid(); } return (0); } @@ -605,15 +610,18 @@ struct setgroups_args { #endif /* ARGSUSED */ int -setgroups(p, uap) - struct proc *p; - struct setgroups_args *uap; +setgroups(struct setgroups_args *uap) { - register struct pcred *pc = p->p_cred; - register u_int ngrp; + struct proc *p = curproc; + struct ucred *cr; + u_int ngrp; int error; - if ((error = suser_xxx(0, p, PRISON_ROOT))) + if (p == NULL) /* API enforcement */ + return(EPERM); + cr = p->p_ucred; + + if ((error = suser_xxx(0, PRISON_ROOT))) return (error); ngrp = uap->gidsetsize; if (ngrp > NGROUPS) @@ -622,7 +630,7 @@ setgroups(p, uap) * XXX A little bit lazy here. We could test if anything has * changed before crcopy() and setting P_SUGID. */ - pc->pc_ucred = crcopy(pc->pc_ucred); + cr = p->p_ucred = crcopy(cr); if (ngrp < 1) { /* * setgroups(0, NULL) is a legitimate way of clearing the @@ -630,14 +638,14 @@ setgroups(p, uap) * have the egid in the groups[0]). We risk security holes * when running non-BSD software if we do not do the same. */ - pc->pc_ucred->cr_ngroups = 1; + cr->cr_ngroups = 1; } else { if ((error = copyin((caddr_t)uap->gidset, - (caddr_t)pc->pc_ucred->cr_groups, ngrp * sizeof(gid_t)))) + (caddr_t)cr->cr_groups, ngrp * sizeof(gid_t)))) return (error); - pc->pc_ucred->cr_ngroups = ngrp; + cr->cr_ngroups = ngrp; } - setsugid(p); + setsugid(); return (0); } @@ -649,34 +657,38 @@ struct setreuid_args { #endif /* ARGSUSED */ int -setreuid(p, uap) - register struct proc *p; - struct setreuid_args *uap; +setreuid(struct setreuid_args *uap) { - register struct pcred *pc = p->p_cred; - register uid_t ruid, euid; + struct proc *p = curproc; + struct ucred *cr; + uid_t ruid, euid; int error; + if (p == NULL) /* API enforcement */ + return(EPERM); + cr = p->p_ucred; + ruid = uap->ruid; euid = uap->euid; - if (((ruid != (uid_t)-1 && ruid != pc->p_ruid && ruid != pc->p_svuid) || - (euid != (uid_t)-1 && euid != pc->pc_ucred->cr_uid && - euid != pc->p_ruid && euid != pc->p_svuid)) && - (error = suser_xxx(0, p, PRISON_ROOT)) != 0) + if (((ruid != (uid_t)-1 && ruid != cr->cr_ruid && ruid != cr->cr_svuid) || + (euid != (uid_t)-1 && euid != cr->cr_uid && + euid != cr->cr_ruid && euid != cr->cr_svuid)) && + (error = suser_xxx(0, PRISON_ROOT)) != 0) return (error); - if (euid != (uid_t)-1 && pc->pc_ucred->cr_uid != euid) { - change_euid(p, euid); - setsugid(p); + if (euid != (uid_t)-1 && cr->cr_uid != euid) { + change_euid(euid); + setsugid(); } - if (ruid != (uid_t)-1 && pc->p_ruid != ruid) { - change_ruid(p, ruid); - setsugid(p); + if (ruid != (uid_t)-1 && cr->cr_ruid != ruid) { + change_ruid(ruid); + setsugid(); } - if ((ruid != (uid_t)-1 || pc->pc_ucred->cr_uid != pc->p_ruid) && - pc->p_svuid != pc->pc_ucred->cr_uid) { - pc->p_svuid = pc->pc_ucred->cr_uid; - setsugid(p); + if ((ruid != (uid_t)-1 || cr->cr_uid != cr->cr_ruid) && + cr->cr_svuid != cr->cr_uid) { + cr = p->p_ucred = crcopy(cr); + cr->cr_svuid = cr->cr_uid; + setsugid(); } return (0); } @@ -689,35 +701,40 @@ struct setregid_args { #endif /* ARGSUSED */ int -setregid(p, uap) - register struct proc *p; - struct setregid_args *uap; +setregid(struct setregid_args *uap) { - register struct pcred *pc = p->p_cred; - register gid_t rgid, egid; + struct proc *p = curproc; + struct ucred *cr; + gid_t rgid, egid; int error; + if (p == NULL) /* API enforcement */ + return(EPERM); + cr = p->p_ucred; + rgid = uap->rgid; egid = uap->egid; - if (((rgid != (gid_t)-1 && rgid != pc->p_rgid && rgid != pc->p_svgid) || - (egid != (gid_t)-1 && egid != pc->pc_ucred->cr_groups[0] && - egid != pc->p_rgid && egid != pc->p_svgid)) && - (error = suser_xxx(0, p, PRISON_ROOT)) != 0) + if (((rgid != (gid_t)-1 && rgid != cr->cr_rgid && rgid != cr->cr_svgid) || + (egid != (gid_t)-1 && egid != cr->cr_groups[0] && + egid != cr->cr_rgid && egid != cr->cr_svgid)) && + (error = suser_xxx(0, PRISON_ROOT)) != 0) return (error); - if (egid != (gid_t)-1 && pc->pc_ucred->cr_groups[0] != egid) { - pc->pc_ucred = crcopy(pc->pc_ucred); - pc->pc_ucred->cr_groups[0] = egid; - setsugid(p); + if (egid != (gid_t)-1 && cr->cr_groups[0] != egid) { + cr = p->p_ucred = crcopy(cr); + cr->cr_groups[0] = egid; + setsugid(); } - if (rgid != (gid_t)-1 && pc->p_rgid != rgid) { - pc->p_rgid = rgid; - setsugid(p); + if (rgid != (gid_t)-1 && cr->cr_rgid != rgid) { + cr = p->p_ucred = crcopy(cr); + cr->cr_rgid = rgid; + setsugid(); } - if ((rgid != (gid_t)-1 || pc->pc_ucred->cr_groups[0] != pc->p_rgid) && - pc->p_svgid != pc->pc_ucred->cr_groups[0]) { - pc->p_svgid = pc->pc_ucred->cr_groups[0]; - setsugid(p); + if ((rgid != (gid_t)-1 || cr->cr_groups[0] != cr->cr_rgid) && + cr->cr_svgid != cr->cr_groups[0]) { + cr = p->p_ucred = crcopy(cr); + cr->cr_svgid = cr->cr_groups[0]; + setsugid(); } return (0); } @@ -736,36 +753,37 @@ struct setresuid_args { #endif /* ARGSUSED */ int -setresuid(p, uap) - register struct proc *p; - struct setresuid_args *uap; +setresuid(struct setresuid_args *uap) { - register struct pcred *pc = p->p_cred; - register uid_t ruid, euid, suid; + struct proc *p = curproc; + struct ucred *cr; + uid_t ruid, euid, suid; int error; + cr = p->p_ucred; ruid = uap->ruid; euid = uap->euid; suid = uap->suid; - if (((ruid != (uid_t)-1 && ruid != pc->p_ruid && ruid != pc->p_svuid && - ruid != pc->pc_ucred->cr_uid) || - (euid != (uid_t)-1 && euid != pc->p_ruid && euid != pc->p_svuid && - euid != pc->pc_ucred->cr_uid) || - (suid != (uid_t)-1 && suid != pc->p_ruid && suid != pc->p_svuid && - suid != pc->pc_ucred->cr_uid)) && - (error = suser_xxx(0, p, PRISON_ROOT)) != 0) + if (((ruid != (uid_t)-1 && ruid != cr->cr_ruid && ruid != cr->cr_svuid && + ruid != cr->cr_uid) || + (euid != (uid_t)-1 && euid != cr->cr_ruid && euid != cr->cr_svuid && + euid != cr->cr_uid) || + (suid != (uid_t)-1 && suid != cr->cr_ruid && suid != cr->cr_svuid && + suid != cr->cr_uid)) && + (error = suser_xxx(0, PRISON_ROOT)) != 0) return (error); - if (euid != (uid_t)-1 && pc->pc_ucred->cr_uid != euid) { - change_euid(p, euid); - setsugid(p); + if (euid != (uid_t)-1 && cr->cr_uid != euid) { + change_euid(euid); + setsugid(); } - if (ruid != (uid_t)-1 && pc->p_ruid != ruid) { - change_ruid(p, ruid); - setsugid(p); + if (ruid != (uid_t)-1 && cr->cr_ruid != ruid) { + change_ruid(ruid); + setsugid(); } - if (suid != (uid_t)-1 && pc->p_svuid != suid) { - pc->p_svuid = suid; - setsugid(p); + if (suid != (uid_t)-1 && cr->cr_svuid != suid) { + cr = p->p_ucred = crcopy(cr); + cr->cr_svuid = suid; + setsugid(); } return (0); } @@ -784,38 +802,40 @@ struct setresgid_args { #endif /* ARGSUSED */ int -setresgid(p, uap) - register struct proc *p; - struct setresgid_args *uap; +setresgid(struct setresgid_args *uap) { - register struct pcred *pc = p->p_cred; - register gid_t rgid, egid, sgid; + struct proc *p = curproc; + struct ucred *cr; + gid_t rgid, egid, sgid; int error; + cr = p->p_ucred; rgid = uap->rgid; egid = uap->egid; sgid = uap->sgid; - if (((rgid != (gid_t)-1 && rgid != pc->p_rgid && rgid != pc->p_svgid && - rgid != pc->pc_ucred->cr_groups[0]) || - (egid != (gid_t)-1 && egid != pc->p_rgid && egid != pc->p_svgid && - egid != pc->pc_ucred->cr_groups[0]) || - (sgid != (gid_t)-1 && sgid != pc->p_rgid && sgid != pc->p_svgid && - sgid != pc->pc_ucred->cr_groups[0])) && - (error = suser_xxx(0, p, PRISON_ROOT)) != 0) + if (((rgid != (gid_t)-1 && rgid != cr->cr_rgid && rgid != cr->cr_svgid && + rgid != cr->cr_groups[0]) || + (egid != (gid_t)-1 && egid != cr->cr_rgid && egid != cr->cr_svgid && + egid != cr->cr_groups[0]) || + (sgid != (gid_t)-1 && sgid != cr->cr_rgid && sgid != cr->cr_svgid && + sgid != cr->cr_groups[0])) && + (error = suser_xxx(0, PRISON_ROOT)) != 0) return (error); - if (egid != (gid_t)-1 && pc->pc_ucred->cr_groups[0] != egid) { - pc->pc_ucred = crcopy(pc->pc_ucred); - pc->pc_ucred->cr_groups[0] = egid; - setsugid(p); + if (egid != (gid_t)-1 && cr->cr_groups[0] != egid) { + cr = p->p_ucred = crcopy(cr); + cr->cr_groups[0] = egid; + setsugid(); } - if (rgid != (gid_t)-1 && pc->p_rgid != rgid) { - pc->p_rgid = rgid; - setsugid(p); + if (rgid != (gid_t)-1 && cr->cr_rgid != rgid) { + cr = p->p_ucred = crcopy(cr); + cr->cr_rgid = rgid; + setsugid(); } - if (sgid != (gid_t)-1 && pc->p_svgid != sgid) { - pc->p_svgid = sgid; - setsugid(p); + if (sgid != (gid_t)-1 && cr->cr_svgid != sgid) { + cr = p->p_ucred = crcopy(cr); + cr->cr_svgid = sgid; + setsugid(); } return (0); } @@ -829,22 +849,21 @@ struct getresuid_args { #endif /* ARGSUSED */ int -getresuid(p, uap) - register struct proc *p; - struct getresuid_args *uap; +getresuid(struct getresuid_args *uap) { - struct pcred *pc = p->p_cred; + struct proc *p = curproc; + struct ucred *cr = p->p_ucred; int error1 = 0, error2 = 0, error3 = 0; if (uap->ruid) - error1 = copyout((caddr_t)&pc->p_ruid, - (caddr_t)uap->ruid, sizeof(pc->p_ruid)); + error1 = copyout((caddr_t)&cr->cr_ruid, + (caddr_t)uap->ruid, sizeof(cr->cr_ruid)); if (uap->euid) - error2 = copyout((caddr_t)&pc->pc_ucred->cr_uid, - (caddr_t)uap->euid, sizeof(pc->pc_ucred->cr_uid)); + error2 = copyout((caddr_t)&cr->cr_uid, + (caddr_t)uap->euid, sizeof(cr->cr_uid)); if (uap->suid) - error3 = copyout((caddr_t)&pc->p_svuid, - (caddr_t)uap->suid, sizeof(pc->p_svuid)); + error3 = copyout((caddr_t)&cr->cr_svuid, + (caddr_t)uap->suid, sizeof(cr->cr_svuid)); return error1 ? error1 : (error2 ? error2 : error3); } @@ -857,22 +876,21 @@ struct getresgid_args { #endif /* ARGSUSED */ int -getresgid(p, uap) - register struct proc *p; - struct getresgid_args *uap; +getresgid(struct getresgid_args *uap) { - struct pcred *pc = p->p_cred; + struct proc *p = curproc; + struct ucred *cr = p->p_ucred; int error1 = 0, error2 = 0, error3 = 0; if (uap->rgid) - error1 = copyout((caddr_t)&pc->p_rgid, - (caddr_t)uap->rgid, sizeof(pc->p_rgid)); + error1 = copyout((caddr_t)&cr->cr_rgid, + (caddr_t)uap->rgid, sizeof(cr->cr_rgid)); if (uap->egid) - error2 = copyout((caddr_t)&pc->pc_ucred->cr_groups[0], - (caddr_t)uap->egid, sizeof(pc->pc_ucred->cr_groups[0])); + error2 = copyout((caddr_t)&cr->cr_groups[0], + (caddr_t)uap->egid, sizeof(cr->cr_groups[0])); if (uap->sgid) - error3 = copyout((caddr_t)&pc->p_svgid, - (caddr_t)uap->sgid, sizeof(pc->p_svgid)); + error3 = copyout((caddr_t)&cr->cr_svgid, + (caddr_t)uap->sgid, sizeof(cr->cr_svgid)); return error1 ? error1 : (error2 ? error2 : error3); } @@ -884,10 +902,9 @@ struct issetugid_args { #endif /* ARGSUSED */ int -issetugid(p, uap) - register struct proc *p; - struct issetugid_args *uap; +issetugid(struct issetugid_args *uap) { + struct proc *p = curproc; /* * Note: OpenBSD sets a P_SUGIDEXEC flag set at execve() time, * we use P_SUGID because we consider changing the owners as @@ -904,11 +921,9 @@ issetugid(p, uap) * Check if gid is a member of the group set. */ int -groupmember(gid, cred) - gid_t gid; - register struct ucred *cred; +groupmember(gid_t gid, struct ucred *cred) { - register gid_t *gp; + gid_t *gp; gid_t *egp; egp = &(cred->cr_groups[cred->cr_ngroups]); @@ -925,54 +940,67 @@ groupmember(gid, cred) * Returns 0 or error. */ int -suser(p) - struct proc *p; +suser(void) { - return suser_xxx(0, p, 0); + struct proc *p = curthread->td_proc; + + if (p != NULL) { + return suser_xxx(p->p_ucred, 0); + } else { + printf("suser(): wasn't run from a thread with a process context: %p\n", curthread); + return (EPERM); + } } int -suser_xxx(cred, proc, flag) - struct ucred *cred; - struct proc *proc; - int flag; +suser_xxx(struct ucred *cred, int flag) { - if (!cred && !proc) { - printf("suser_xxx(): THINK!\n"); - return (EPERM); + struct proc *p = curthread->td_proc; + + /* + * Either a cred or a process is required to check for + * superuser permissions (API enforcement). + */ + if (cred == NULL) { + if (p == NULL) { + printf("suser_xxx(): THINK!\n"); + return (EPERM); + } + cred = p->p_ucred; } - if (!cred) - cred = proc->p_ucred; if (cred->cr_uid != 0) return (EPERM); - if (proc && proc->p_prison && !(flag & PRISON_ROOT)) + if (cred->cr_prison && !(flag & PRISON_ROOT)) return (EPERM); - if (proc) - proc->p_acflag |= ASU; + /* + * YYY for accounting only, but suser_xxx can be called from a + * different process with the cred for the original process and + * this will not work as expected YYY + */ + if (p) + p->p_acflag |= ASU; return (0); } /* * Return zero if p1 can fondle p2, return errno (EPERM/ESRCH) otherwise. */ - int -p_trespass(struct proc *p1, struct proc *p2) +p_trespass(struct ucred *cr1, struct ucred *cr2) { - - if (p1 == p2) + if (cr1 == cr2) return (0); - if (!PRISON_CHECK(p1, p2)) + if (!PRISON_CHECK(cr1, cr2)) return (ESRCH); - if (p1->p_cred->p_ruid == p2->p_cred->p_ruid) + if (cr1->cr_ruid == cr2->cr_ruid) return (0); - if (p1->p_ucred->cr_uid == p2->p_cred->p_ruid) + if (cr1->cr_uid == cr2->cr_ruid) return (0); - if (p1->p_cred->p_ruid == p2->p_ucred->cr_uid) + if (cr1->cr_ruid == cr2->cr_uid) return (0); - if (p1->p_ucred->cr_uid == p2->p_ucred->cr_uid) + if (cr1->cr_uid == cr2->cr_uid) return (0); - if (!suser_xxx(0, p1, PRISON_ROOT)) + if (!suser_xxx(cr1, PRISON_ROOT)) return (0); return (EPERM); } @@ -995,8 +1023,7 @@ crget() * Claim another reference to a ucred structure */ void -crhold(cr) - struct ucred *cr; +crhold(struct ucred *cr) { cr->cr_ref++; } @@ -1006,8 +1033,7 @@ crhold(cr) * Throws away space when ref count gets to 0. */ void -crfree(cr) - struct ucred *cr; +crfree(struct ucred *cr) { if (cr->cr_ref == 0) panic("Freeing already free credential! %p", cr); @@ -1020,6 +1046,19 @@ crfree(cr) */ if (cr->cr_uidinfo != NULL) uifree(cr->cr_uidinfo); + if (cr->cr_ruidinfo != NULL) + uifree(cr->cr_ruidinfo); + + /* + * Destroy empty prisons + */ + if (cr->cr_prison && !--cr->cr_prison->pr_ref) { + if (cr->cr_prison->pr_linux != NULL) + FREE(cr->cr_prison->pr_linux, M_PRISON); + FREE(cr->cr_prison, M_PRISON); + } + cr->cr_prison = NULL; /* safety */ + FREE((caddr_t)cr, M_CRED); } } @@ -1028,8 +1067,7 @@ crfree(cr) * Copy cred structure to a new one and free the old one. */ struct ucred * -crcopy(cr) - struct ucred *cr; +crcopy(struct ucred *cr) { struct ucred *newcr; @@ -1037,9 +1075,14 @@ crcopy(cr) return (cr); newcr = crget(); *newcr = *cr; - uihold(newcr->cr_uidinfo); - crfree(cr); + if (newcr->cr_uidinfo) + uihold(newcr->cr_uidinfo); + if (newcr->cr_ruidinfo) + uihold(newcr->cr_ruidinfo); + if (newcr->cr_prison) + ++newcr->cr_prison->pr_ref; newcr->cr_ref = 1; + crfree(cr); return (newcr); } @@ -1054,7 +1097,12 @@ crdup(cr) newcr = crget(); *newcr = *cr; - uihold(newcr->cr_uidinfo); + if (newcr->cr_uidinfo) + uihold(newcr->cr_uidinfo); + if (newcr->cr_ruidinfo) + uihold(newcr->cr_ruidinfo); + if (newcr->cr_prison) + ++newcr->cr_prison->pr_ref; newcr->cr_ref = 1; return (newcr); } @@ -1086,10 +1134,9 @@ struct getlogin_args { #endif /* ARGSUSED */ int -getlogin(p, uap) - struct proc *p; - struct getlogin_args *uap; +getlogin(struct getlogin_args *uap) { + struct proc *p = curproc; if (uap->namelen > MAXLOGNAME) uap->namelen = MAXLOGNAME; @@ -1107,14 +1154,14 @@ struct setlogin_args { #endif /* ARGSUSED */ int -setlogin(p, uap) - struct proc *p; - struct setlogin_args *uap; +setlogin(struct setlogin_args *uap) { + struct proc *p = curproc; int error; char logintmp[MAXLOGNAME]; - if ((error = suser_xxx(0, p, PRISON_ROOT))) + KKASSERT(p != NULL); + if ((error = suser_xxx(0, PRISON_ROOT))) return (error); error = copyinstr((caddr_t) uap->namebuf, (caddr_t) logintmp, sizeof(logintmp), (size_t *)0); @@ -1127,9 +1174,11 @@ setlogin(p, uap) } void -setsugid(p) - struct proc *p; +setsugid() { + struct proc *p = curproc; + + KKASSERT(p != NULL); p->p_flag |= P_SUGID; if (!(p->p_pfsflags & PF_ISUGID)) p->p_stops = 0; @@ -1139,22 +1188,23 @@ setsugid(p) * Helper function to change the effective uid of a process */ void -change_euid(p, euid) - struct proc *p; - uid_t euid; +change_euid(uid_t euid) { - struct pcred *pc; + struct proc *p = curproc; + struct ucred *cr; struct uidinfo *uip; - pc = p->p_cred; + KKASSERT(p != NULL); + + cr = p->p_ucred; /* * crcopy is essentially a NOP if ucred has a reference count * of 1, which is true if it has already been copied. */ - pc->pc_ucred = crcopy(pc->pc_ucred); - uip = pc->pc_ucred->cr_uidinfo; - pc->pc_ucred->cr_uid = euid; - pc->pc_ucred->cr_uidinfo = uifind(euid); + cr = p->p_ucred = crcopy(cr); + uip = cr->cr_uidinfo; + cr->cr_uid = euid; + cr->cr_uidinfo = uifind(euid); uifree(uip); } @@ -1165,19 +1215,20 @@ change_euid(p, euid) * the old uid to the new uid. */ void -change_ruid(p, ruid) - struct proc *p; - uid_t ruid; +change_ruid(uid_t ruid) { - struct pcred *pc; + struct proc *p = curproc; + struct ucred *cr; struct uidinfo *uip; - pc = p->p_cred; - (void)chgproccnt(pc->p_uidinfo, -1, 0); - uip = pc->p_uidinfo; + KKASSERT(p != NULL); + + cr = p->p_ucred = crcopy(p->p_ucred); + (void)chgproccnt(cr->cr_ruidinfo, -1, 0); + uip = cr->cr_ruidinfo; /* It is assumed that pcred is not shared between processes */ - pc->p_ruid = ruid; - pc->p_uidinfo = uifind(ruid); - (void)chgproccnt(pc->p_uidinfo, 1, 0); + cr->cr_ruid = ruid; + cr->cr_ruidinfo = uifind(ruid); + (void)chgproccnt(cr->cr_ruidinfo, 1, 0); uifree(uip); } diff --git a/sys/kern/kern_random.c b/sys/kern/kern_random.c index 72d7b12add..664a61cad7 100644 --- a/sys/kern/kern_random.c +++ b/sys/kern/kern_random.c @@ -2,7 +2,7 @@ * kern_random.c -- A strong random number generator * * $FreeBSD: src/sys/kern/kern_random.c,v 1.36.2.4 2002/09/17 17:11:57 sam Exp $ - * $DragonFly: src/sys/kern/Attic/kern_random.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/Attic/kern_random.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ * * Version 0.95, last modified 18-Oct-95 * @@ -384,7 +384,7 @@ add_true_randomness(int val) } int -random_poll(dev_t dev, int events, struct proc *p) +random_poll(dev_t dev, int events, struct thread *td) { int s; int revents = 0; @@ -394,7 +394,7 @@ random_poll(dev_t dev, int events, struct proc *p) if (random_state.entropy_count >= 8) revents |= events & (POLLIN | POLLRDNORM); else - selrecord(p, &random_state.rsel); + selrecord(td, &random_state.rsel); } splx(s); if (events & (POLLOUT | POLLWRNORM)) diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index d687a03af3..ea29a1ecaf 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -37,7 +37,7 @@ * * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_resource.c,v 1.55.2.5 2001/11/03 01:41:08 ps Exp $ - * $DragonFly: src/sys/kern/kern_resource.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ + * $DragonFly: src/sys/kern/kern_resource.c,v 1.4 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_compat.h" @@ -58,9 +58,9 @@ #include #include -static int donice __P((struct proc *curp, struct proc *chgp, int n)); +static int donice __P((struct proc *chgp, int n)); /* dosetrlimit non-static: Needed by SysVR4 emulator */ -int dosetrlimit __P((struct proc *p, u_int which, struct rlimit *limp)); +int dosetrlimit __P((u_int which, struct rlimit *limp)); static MALLOC_DEFINE(M_UIDINFO, "uidinfo", "uidinfo structures"); #define UIHASH(uid) (&uihashtbl[(uid) & uihash]) @@ -81,15 +81,13 @@ struct getpriority_args { }; #endif int -getpriority(curp, uap) - struct proc *curp; - register struct getpriority_args *uap; +getpriority(struct getpriority_args *uap) { - register struct proc *p; - register int low = PRIO_MAX + 1; + struct proc *curp = curproc; + struct proc *p; + int low = PRIO_MAX + 1; switch (uap->which) { - case PRIO_PROCESS: if (uap->who == 0) p = curp; @@ -97,12 +95,13 @@ getpriority(curp, uap) p = pfind(uap->who); if (p == 0) break; - if (!PRISON_CHECK(curp, p)) + if (!PRISON_CHECK(curp->p_ucred, p->p_ucred)) break; low = p->p_nice; break; - case PRIO_PGRP: { + case PRIO_PGRP: + { register struct pgrp *pg; if (uap->who == 0) @@ -110,17 +109,16 @@ getpriority(curp, uap) else if ((pg = pgfind(uap->who)) == NULL) break; LIST_FOREACH(p, &pg->pg_members, p_pglist) { - if ((PRISON_CHECK(curp, p) && p->p_nice < low)) + if ((PRISON_CHECK(curp->p_ucred, p->p_ucred) && p->p_nice < low)) low = p->p_nice; } break; } - case PRIO_USER: if (uap->who == 0) uap->who = curp->p_ucred->cr_uid; LIST_FOREACH(p, &allproc, p_list) - if (PRISON_CHECK(curp, p) && + if (PRISON_CHECK(curp->p_ucred, p->p_ucred) && p->p_ucred->cr_uid == uap->who && p->p_nice < low) low = p->p_nice; @@ -144,11 +142,10 @@ struct setpriority_args { #endif /* ARGSUSED */ int -setpriority(curp, uap) - struct proc *curp; - register struct setpriority_args *uap; +setpriority(struct setpriority_args *uap) { - register struct proc *p; + struct proc *curp = curproc; + struct proc *p; int found = 0, error = 0; switch (uap->which) { @@ -160,13 +157,14 @@ setpriority(curp, uap) p = pfind(uap->who); if (p == 0) break; - if (!PRISON_CHECK(curp, p)) + if (!PRISON_CHECK(curp->p_ucred, p->p_ucred)) break; - error = donice(curp, p, uap->prio); + error = donice(p, uap->prio); found++; break; - case PRIO_PGRP: { + case PRIO_PGRP: + { register struct pgrp *pg; if (uap->who == 0) @@ -174,21 +172,20 @@ setpriority(curp, uap) else if ((pg = pgfind(uap->who)) == NULL) break; LIST_FOREACH(p, &pg->pg_members, p_pglist) { - if (PRISON_CHECK(curp, p)) { - error = donice(curp, p, uap->prio); + if (PRISON_CHECK(curp->p_ucred, p->p_ucred)) { + error = donice(p, uap->prio); found++; } } break; } - case PRIO_USER: if (uap->who == 0) uap->who = curp->p_ucred->cr_uid; LIST_FOREACH(p, &allproc, p_list) if (p->p_ucred->cr_uid == uap->who && - PRISON_CHECK(curp, p)) { - error = donice(curp, p, uap->prio); + PRISON_CHECK(curp->p_ucred, p->p_ucred)) { + error = donice(p, uap->prio); found++; } break; @@ -202,21 +199,20 @@ setpriority(curp, uap) } static int -donice(curp, chgp, n) - register struct proc *curp, *chgp; - register int n; +donice(struct proc *chgp, int n) { - register struct pcred *pcred = curp->p_cred; + struct proc *curp = curproc; + struct ucred *cr = curp->p_ucred; - if (pcred->pc_ucred->cr_uid && pcred->p_ruid && - pcred->pc_ucred->cr_uid != chgp->p_ucred->cr_uid && - pcred->p_ruid != chgp->p_ucred->cr_uid) + if (cr->cr_uid && cr->cr_ruid && + cr->cr_uid != chgp->p_ucred->cr_uid && + cr->cr_ruid != chgp->p_ucred->cr_uid) return (EPERM); if (n > PRIO_MAX) n = PRIO_MAX; if (n < PRIO_MIN) n = PRIO_MIN; - if (n < chgp->p_nice && suser(curp)) + if (n < chgp->p_nice && suser()) return (EACCES); chgp->p_nice = n; (void)resetpriority(chgp); @@ -238,12 +234,11 @@ struct rtprio_args { /* ARGSUSED */ int -rtprio(curp, uap) - struct proc *curp; - register struct rtprio_args *uap; +rtprio(register struct rtprio_args *uap) { - register struct proc *p; - register struct pcred *pcred = curp->p_cred; + struct proc *curp = curproc; + struct proc *p; + struct ucred *cr = curp->p_ucred; struct rtprio rtp; int error; @@ -263,12 +258,12 @@ rtprio(curp, uap) case RTP_LOOKUP: return (copyout(&p->p_rtprio, uap->rtp, sizeof(struct rtprio))); case RTP_SET: - if (pcred->pc_ucred->cr_uid && pcred->p_ruid && - pcred->pc_ucred->cr_uid != p->p_ucred->cr_uid && - pcred->p_ruid != p->p_ucred->cr_uid) + if (cr->cr_uid && cr->cr_ruid && + cr->cr_uid != p->p_ucred->cr_uid && + cr->cr_ruid != p->p_ucred->cr_uid) return (EPERM); /* disallow setting rtprio in most cases if not superuser */ - if (suser(curp)) { + if (suser()) { /* can't set someone else's */ if (uap->pid) return (EPERM); @@ -315,9 +310,7 @@ struct osetrlimit_args { #endif /* ARGSUSED */ int -osetrlimit(p, uap) - struct proc *p; - register struct osetrlimit_args *uap; +osetrlimit(struct osetrlimit_args *uap) { struct orlimit olim; struct rlimit lim; @@ -328,7 +321,7 @@ osetrlimit(p, uap) return (error); lim.rlim_cur = olim.rlim_cur; lim.rlim_max = olim.rlim_max; - return (dosetrlimit(p, uap->which, &lim)); + return (dosetrlimit(uap->which, &lim)); } #ifndef _SYS_SYSPROTO_H_ @@ -339,10 +332,9 @@ struct ogetrlimit_args { #endif /* ARGSUSED */ int -ogetrlimit(p, uap) - struct proc *p; - register struct ogetrlimit_args *uap; +ogetrlimit(struct ogetrlimit_args *uap) { + struct proc *p = curproc; struct orlimit olim; if (uap->which >= RLIM_NLIMITS) @@ -365,9 +357,7 @@ struct __setrlimit_args { #endif /* ARGSUSED */ int -setrlimit(p, uap) - struct proc *p; - register struct __setrlimit_args *uap; +setrlimit(struct __setrlimit_args *uap) { struct rlimit alim; int error; @@ -375,16 +365,14 @@ setrlimit(p, uap) if ((error = copyin((caddr_t)uap->rlp, (caddr_t)&alim, sizeof (struct rlimit)))) return (error); - return (dosetrlimit(p, uap->which, &alim)); + return (dosetrlimit(uap->which, &alim)); } int -dosetrlimit(p, which, limp) - struct proc *p; - u_int which; - struct rlimit *limp; +dosetrlimit(u_int which, struct rlimit *limp) { - register struct rlimit *alimp; + struct proc *p = curproc; + struct rlimit *alimp; int error; if (which >= RLIM_NLIMITS) @@ -401,7 +389,7 @@ dosetrlimit(p, which, limp) if (limp->rlim_cur > alimp->rlim_max || limp->rlim_max > alimp->rlim_max) - if ((error = suser_xxx(0, p, PRISON_ROOT))) + if ((error = suser_xxx(0, PRISON_ROOT))) return (error); if (limp->rlim_cur > limp->rlim_max) limp->rlim_cur = limp->rlim_max; @@ -489,10 +477,9 @@ struct __getrlimit_args { #endif /* ARGSUSED */ int -getrlimit(p, uap) - struct proc *p; - register struct __getrlimit_args *uap; +getrlimit(struct __getrlimit_args *uap) { + struct proc *p = curproc; if (uap->which >= RLIM_NLIMITS) return (EINVAL); @@ -605,11 +592,10 @@ struct getrusage_args { #endif /* ARGSUSED */ int -getrusage(p, uap) - register struct proc *p; - register struct getrusage_args *uap; +getrusage(struct getrusage_args *uap) { - register struct rusage *rup; + struct proc *p = curproc; + struct rusage *rup; switch (uap->who) { diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 8acaa529e9..94bf976f90 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -37,7 +37,7 @@ * * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_shutdown.c,v 1.72.2.12 2002/02/21 19:15:10 dillon Exp $ - * $DragonFly: src/sys/kern/kern_shutdown.c,v 1.4 2003/06/22 17:39:42 dillon Exp $ + * $DragonFly: src/sys/kern/kern_shutdown.c,v 1.5 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_ddb.h" @@ -139,13 +139,11 @@ SYSINIT(shutdown_conf, SI_SUB_INTRINSIC, SI_ORDER_ANY, shutdown_conf, NULL) * The system call that results in a reboot */ int -reboot(p, uap) - struct proc *p; - struct reboot_args *uap; +reboot(struct reboot_args *uap) { int error; - if ((error = suser(p))) + if ((error = suser())) return (error); boot(uap->opt); @@ -207,8 +205,7 @@ print_uptime() * anything machine dependant in it. */ static void -boot(howto) - int howto; +boot(int howto) { /* collect extra flags that shutdown_nice might have set */ @@ -234,7 +231,7 @@ boot(howto) waittime = 0; printf("\nsyncing disks... "); - sync(&proc0, NULL); + sync(NULL); /* YYY was sync(&proc0, NULL). why proc0 ? */ /* * With soft updates, some buffers that are @@ -261,7 +258,7 @@ boot(howto) pbusy = nbusy; if (iter > 5 && bioops.io_sync) (*bioops.io_sync)(NULL); - sync(&proc0, NULL); + sync(NULL); /* YYY was sync(&proc0, NULL). why proc0 ? */ DELAY(50000 * iter); } printf("\n"); diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 5eeea2e7d0..e0e5aa8c46 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -37,7 +37,7 @@ * * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94 * $FreeBSD: src/sys/kern/kern_sig.c,v 1.72.2.17 2003/05/16 16:34:34 obrien Exp $ - * $DragonFly: src/sys/kern/kern_sig.c,v 1.3 2003/06/22 04:31:04 dillon Exp $ + * $DragonFly: src/sys/kern/kern_sig.c,v 1.4 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_compat.h" @@ -73,12 +73,12 @@ #define ONSIG 32 /* NSIG for osig* syscalls. XXX. */ static int coredump __P((struct proc *)); -static int do_sigaction __P((struct proc *p, int sig, struct sigaction *act, +static int do_sigaction __P((int sig, struct sigaction *act, struct sigaction *oact, int old)); -static int do_sigprocmask __P((struct proc *p, int how, sigset_t *set, +static int do_sigprocmask __P((int how, sigset_t *set, sigset_t *oset, int old)); static char *expand_name __P((const char *, uid_t, pid_t)); -static int killpg1 __P((struct proc *cp, int sig, int pgid, int all)); +static int killpg1 __P((int sig, int pgid, int all)); static int sig_ffs __P((sigset_t *set)); static int sigprop __P((int sig)); static void stop __P((struct proc *)); @@ -98,17 +98,17 @@ SYSCTL_INT(_kern, KERN_LOGSIGEXIT, logsigexit, CTLFLAG_RW, /* * Can process p, with pcred pc, send the signal sig to process q? */ -#define CANSIGNAL(p, q, sig) \ - (!p_trespass(p, q) || \ - ((sig) == SIGCONT && (q)->p_session == (p)->p_session)) +#define CANSIGNAL(q, sig) \ + (!p_trespass(curproc->p_ucred, (q)->p_ucred) || \ + ((sig) == SIGCONT && (q)->p_session == curproc->p_session)) /* * Policy -- Can real uid ruid with ucred uc send a signal to process q? */ #define CANSIGIO(ruid, uc, q) \ ((uc)->cr_uid == 0 || \ - (ruid) == (q)->p_cred->p_ruid || \ - (uc)->cr_uid == (q)->p_cred->p_ruid || \ + (ruid) == (q)->p_ucred->cr_ruid || \ + (uc)->cr_uid == (q)->p_ucred->cr_ruid || \ (ruid) == (q)->p_ucred->cr_uid || \ (uc)->cr_uid == (q)->p_ucred->cr_uid) @@ -193,13 +193,10 @@ sig_ffs(sigset_t *set) * osigaction */ static int -do_sigaction(p, sig, act, oact, old) - struct proc *p; - register int sig; - struct sigaction *act, *oact; - int old; +do_sigaction(int sig, struct sigaction *act, struct sigaction *oact, int old) { - register struct sigacts *ps = p->p_sigacts; + struct proc *p = curproc; + struct sigacts *ps = p->p_sigacts; if (sig <= 0 || sig > _SIG_MAXSIG) return (EINVAL); @@ -326,9 +323,7 @@ struct sigaction_args { #endif /* ARGSUSED */ int -sigaction(p, uap) - struct proc *p; - register struct sigaction_args *uap; +sigaction(struct sigaction_args *uap) { struct sigaction act, oact; register struct sigaction *actp, *oactp; @@ -341,7 +336,7 @@ sigaction(p, uap) if (error) return (error); } - error = do_sigaction(p, uap->sig, actp, oactp, 0); + error = do_sigaction(uap->sig, actp, oactp, 0); if (oactp && !error) { error = copyout(oactp, uap->oact, sizeof(oact)); } @@ -357,9 +352,7 @@ struct osigaction_args { #endif /* ARGSUSED */ int -osigaction(p, uap) - struct proc *p; - register struct osigaction_args *uap; +osigaction(struct osigaction_args *uap) { struct osigaction sa; struct sigaction nsa, osa; @@ -378,7 +371,7 @@ osigaction(p, uap) nsap->sa_flags = sa.sa_flags; OSIG2SIG(sa.sa_mask, nsap->sa_mask); } - error = do_sigaction(p, uap->signum, nsap, osap, 1); + error = do_sigaction(uap->signum, nsap, osap, 1); if (osap && !error) { sa.sa_handler = osap->sa_handler; sa.sa_flags = osap->sa_flags; @@ -450,12 +443,9 @@ execsigs(p) * no spl*() calls may be made. */ static int -do_sigprocmask(p, how, set, oset, old) - struct proc *p; - int how; - sigset_t *set, *oset; - int old; +do_sigprocmask(int how, sigset_t *set, sigset_t *oset, int old) { + struct proc *p = curproc; int error; if (oset != NULL) @@ -498,9 +488,7 @@ struct sigprocmask_args { }; #endif int -sigprocmask(p, uap) - register struct proc *p; - struct sigprocmask_args *uap; +sigprocmask(struct sigprocmask_args *uap) { sigset_t set, oset; sigset_t *setp, *osetp; @@ -513,7 +501,7 @@ sigprocmask(p, uap) if (error) return (error); } - error = do_sigprocmask(p, uap->how, setp, osetp, 0); + error = do_sigprocmask(uap->how, setp, osetp, 0); if (osetp && !error) { error = copyout(osetp, uap->oset, sizeof(oset)); } @@ -531,16 +519,14 @@ struct osigprocmask_args { }; #endif int -osigprocmask(p, uap) - register struct proc *p; - struct osigprocmask_args *uap; +osigprocmask(struct osigprocmask_args *uap) { sigset_t set, oset; int error; OSIG2SIG(uap->mask, set); - error = do_sigprocmask(p, uap->how, &set, &oset, 1); - SIG2OSIG(oset, p->p_retval[0]); + error = do_sigprocmask(uap->how, &set, &oset, 1); + SIG2OSIG(oset, curproc->p_retval[0]); return (error); } @@ -551,10 +537,9 @@ struct sigpending_args { #endif /* ARGSUSED */ int -sigpending(p, uap) - struct proc *p; - struct sigpending_args *uap; +sigpending(struct sigpending_args *uap) { + struct proc *p = curproc; return (copyout(&p->p_siglist, uap->set, sizeof(sigset_t))); } @@ -566,10 +551,9 @@ struct osigpending_args { #endif /* ARGSUSED */ int -osigpending(p, uap) - struct proc *p; - struct osigpending_args *uap; +osigpending(struct osigpending_args *uap) { + struct proc *p = curproc; SIG2OSIG(p->p_siglist, p->p_retval[0]); return (0); @@ -588,9 +572,7 @@ struct osigvec_args { #endif /* ARGSUSED */ int -osigvec(p, uap) - struct proc *p; - register struct osigvec_args *uap; +osigvec(struct osigvec_args *uap) { struct sigvec vec; struct sigaction nsa, osa; @@ -613,7 +595,7 @@ osigvec(p, uap) nsap->sa_flags |= SA_USERTRAMP; #endif } - error = do_sigaction(p, uap->signum, nsap, osap, 1); + error = do_sigaction(uap->signum, nsap, osap, 1); if (osap && !error) { vec.sv_handler = osap->sa_handler; SIG2OSIG(osap->sa_mask, vec.sv_mask); @@ -634,10 +616,9 @@ struct osigblock_args { }; #endif int -osigblock(p, uap) - register struct proc *p; - struct osigblock_args *uap; +osigblock(struct osigblock_args *uap) { + struct proc *p = curproc; sigset_t set; OSIG2SIG(uap->mask, set); @@ -655,10 +636,9 @@ struct osigsetmask_args { }; #endif int -osigsetmask(p, uap) - struct proc *p; - struct osigsetmask_args *uap; +osigsetmask(struct osigsetmask_args *uap) { + struct proc *p = curproc; sigset_t set; OSIG2SIG(uap->mask, set); @@ -683,12 +663,11 @@ struct sigsuspend_args { #endif /* ARGSUSED */ int -sigsuspend(p, uap) - register struct proc *p; - struct sigsuspend_args *uap; +sigsuspend(struct sigsuspend_args *uap) { + struct proc *p = curproc; sigset_t mask; - register struct sigacts *ps = p->p_sigacts; + struct sigacts *ps = p->p_sigacts; int error; error = copyin(uap->sigmask, &mask, sizeof(mask)); @@ -720,12 +699,11 @@ struct osigsuspend_args { #endif /* ARGSUSED */ int -osigsuspend(p, uap) - register struct proc *p; - struct osigsuspend_args *uap; +osigsuspend(struct osigsuspend_args *uap) { sigset_t mask; - register struct sigacts *ps = p->p_sigacts; + struct proc *p = curproc; + struct sigacts *ps = p->p_sigacts; p->p_oldsigmask = p->p_sigmask; p->p_flag |= P_OLDMASK; @@ -747,10 +725,9 @@ struct osigstack_args { #endif /* ARGSUSED */ int -osigstack(p, uap) - struct proc *p; - register struct osigstack_args *uap; +osigstack(struct osigstack_args *uap) { + struct proc *p = curproc; struct sigstack ss; int error = 0; @@ -777,10 +754,9 @@ struct sigaltstack_args { #endif /* ARGSUSED */ int -sigaltstack(p, uap) - struct proc *p; - register struct sigaltstack_args *uap; +sigaltstack(struct sigaltstack_args *uap) { + struct proc *p = curproc; stack_t ss; int error; @@ -812,11 +788,10 @@ sigaltstack(p, uap) * cp is calling process. */ int -killpg1(cp, sig, pgid, all) - register struct proc *cp; - int sig, pgid, all; +killpg1(int sig, int pgid, int all) { - register struct proc *p; + struct proc *cp = curproc; + struct proc *p; struct pgrp *pgrp; int nfound = 0; @@ -826,7 +801,7 @@ killpg1(cp, sig, pgid, all) */ LIST_FOREACH(p, &allproc, p_list) { if (p->p_pid <= 1 || p->p_flag & P_SYSTEM || - p == cp || !CANSIGNAL(cp, p, sig)) + p == cp || !CANSIGNAL(p, sig)) continue; nfound++; if (sig) @@ -846,7 +821,7 @@ killpg1(cp, sig, pgid, all) LIST_FOREACH(p, &pgrp->pg_members, p_pglist) { if (p->p_pid <= 1 || p->p_flag & P_SYSTEM || p->p_stat == SZOMB || - !CANSIGNAL(cp, p, sig)) + !CANSIGNAL(p, sig)) continue; nfound++; if (sig) @@ -864,11 +839,9 @@ struct kill_args { #endif /* ARGSUSED */ int -kill(cp, uap) - register struct proc *cp; - register struct kill_args *uap; +kill(struct kill_args *uap) { - register struct proc *p; + struct proc *p; if ((u_int)uap->signum > _SIG_MAXSIG) return (EINVAL); @@ -876,7 +849,7 @@ kill(cp, uap) /* kill single process */ if ((p = pfind(uap->pid)) == NULL) return (ESRCH); - if (!CANSIGNAL(cp, p, uap->signum)) + if (!CANSIGNAL(p, uap->signum)) return (EPERM); if (uap->signum) psignal(p, uap->signum); @@ -884,11 +857,11 @@ kill(cp, uap) } switch (uap->pid) { case -1: /* broadcast signal */ - return (killpg1(cp, uap->signum, 0, 1)); + return (killpg1(uap->signum, 0, 1)); case 0: /* signal own process group */ - return (killpg1(cp, uap->signum, 0, 0)); + return (killpg1(uap->signum, 0, 0)); default: /* negative explicit process group */ - return (killpg1(cp, uap->signum, -uap->pid, 0)); + return (killpg1(uap->signum, -uap->pid, 0)); } /* NOTREACHED */ } @@ -902,14 +875,11 @@ struct okillpg_args { #endif /* ARGSUSED */ int -okillpg(p, uap) - struct proc *p; - register struct okillpg_args *uap; +okillpg(struct okillpg_args *uap) { - if ((u_int)uap->signum > _SIG_MAXSIG) return (EINVAL); - return (killpg1(p, uap->signum, uap->pgid, 0)); + return (killpg1(uap->signum, uap->pgid, 0)); } #endif /* COMPAT_43 || COMPAT_SUNOS */ @@ -917,8 +887,7 @@ okillpg(p, uap) * Send a signal to a process group. */ void -gsignal(pgid, sig) - int pgid, sig; +gsignal(int pgid, int sig) { struct pgrp *pgrp; @@ -1383,7 +1352,7 @@ void postsig(sig) register int sig; { - register struct proc *p = curproc; + struct proc *p = curproc; struct sigacts *ps = p->p_sigacts; sig_t action; sigset_t returnmask; @@ -1465,7 +1434,7 @@ killproc(p, why) char *why; { log(LOG_ERR, "pid %d (%s), uid %d, was killed: %s\n", p->p_pid, p->p_comm, - p->p_cred && p->p_ucred ? p->p_ucred->cr_uid : -1, why); + p->p_ucred ? p->p_ucred->cr_uid : -1, why); psignal(p, SIGKILL); } @@ -1478,11 +1447,8 @@ killproc(p, why) * does not return. */ void -sigexit(p, sig) - register struct proc *p; - int sig; +sigexit(struct proc *p, int sig) { - p->p_acflag |= AXSIG; if (sigprop(sig) & SA_CORE) { p->p_sig = sig; @@ -1498,11 +1464,11 @@ sigexit(p, sig) log(LOG_INFO, "pid %d (%s), uid %d: exited on signal %d%s\n", p->p_pid, p->p_comm, - p->p_cred && p->p_ucred ? p->p_ucred->cr_uid : -1, + p->p_ucred ? p->p_ucred->cr_uid : -1, sig &~ WCOREFLAG, sig & WCOREFLAG ? " (core dumped)" : ""); } - exit1(p, W_EXITCODE(0, sig)); + exit1(W_EXITCODE(0, sig)); /* NOTREACHED */ } @@ -1686,12 +1652,9 @@ struct nosys_args { #endif /* ARGSUSED */ int -nosys(p, args) - struct proc *p; - struct nosys_args *args; +nosys(struct nosys_args *args) { - - psignal(p, SIGSYS); + psignal(curproc, SIGSYS); return (EINVAL); } diff --git a/sys/kern/kern_syscalls.c b/sys/kern/kern_syscalls.c index 0f90a90012..2b020c58ef 100644 --- a/sys/kern/kern_syscalls.c +++ b/sys/kern/kern_syscalls.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_syscalls.c,v 1.6 1999/10/11 15:19:10 peter Exp $ - * $DragonFly: src/sys/kern/kern_syscalls.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_syscalls.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -40,9 +40,9 @@ * Place holder for system call slots reserved for loadable modules. */ int -lkmnosys(struct proc *p, struct nosys_args *args) +lkmnosys(struct nosys_args *args) { - return(nosys(p, args)); + return(nosys(args)); } int diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 48a201092e..d96667f845 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -38,7 +38,7 @@ * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 * $FreeBSD: src/sys/kern/kern_sysctl.c,v 1.92.2.9 2003/05/01 22:48:09 trhodes Exp $ - * $DragonFly: src/sys/kern/kern_sysctl.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_sysctl.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_compat.h" @@ -474,7 +474,7 @@ sysctl_sysctl_debug(SYSCTL_HANDLER_ARGS) { int error; - error = suser(req->p); + error = suser_xxx(req->p->p_ucred, 0); if (error) return error; sysctl_sysctl_debug_dump_node(&sysctl__children, 0); @@ -881,21 +881,21 @@ sysctl_new_kernel(struct sysctl_req *req, void *p, size_t l) } int -kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval) +kernel_sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval) { int error = 0; struct sysctl_req req; bzero(&req, sizeof req); - req.p = p; + req.p = curproc; if (oldlenp) { req.oldlen = *oldlenp; } if (old) { - req.oldptr= old; + req.oldptr = old; } if (new != NULL) { @@ -940,7 +940,7 @@ kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldle } int -kernel_sysctlbyname(struct proc *p, char *name, void *old, size_t *oldlenp, +kernel_sysctlbyname(char *name, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval) { int oid[CTL_MAXNAME]; @@ -951,12 +951,12 @@ kernel_sysctlbyname(struct proc *p, char *name, void *old, size_t *oldlenp, oid[1] = 3; /* name2oid */ oidlen = sizeof(oid); - error = kernel_sysctl(p, oid, 2, oid, &oidlen, - (void *)name, strlen(name), &plen); + error = kernel_sysctl(oid, 2, oid, &oidlen, (void *)name, + strlen(name), &plen); if (error) return (error); - error = kernel_sysctl(p, oid, plen / sizeof(int), old, oldlenp, + error = kernel_sysctl(oid, plen / sizeof(int), old, oldlenp, new, newlen, retval); return (error); } @@ -1051,6 +1051,7 @@ sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, int sysctl_root(SYSCTL_HANDLER_ARGS) { + struct proc *p = req->p; struct sysctl_oid *oid; int error, indx; @@ -1074,10 +1075,9 @@ sysctl_root(SYSCTL_HANDLER_ARGS) return (EPERM); /* Most likely only root can write */ - if (!(oid->oid_kind & CTLFLAG_ANYBODY) && - req->newptr && req->p && - (error = suser_xxx(0, req->p, - (oid->oid_kind & CTLFLAG_PRISON) ? PRISON_ROOT : 0))) + if (!(oid->oid_kind & CTLFLAG_ANYBODY) && p && + (error = suser_xxx(p->p_ucred, + (oid->oid_kind & CTLFLAG_PRISON) ? PRISON_ROOT : 0))) return (error); if (!oid->oid_handler) @@ -1104,7 +1104,7 @@ struct sysctl_args { #endif int -__sysctl(struct proc *p, struct sysctl_args *uap) +__sysctl(struct sysctl_args *uap) { int error, i, name[CTL_MAXNAME]; size_t j; @@ -1116,7 +1116,7 @@ __sysctl(struct proc *p, struct sysctl_args *uap) if (error) return (error); - error = userland_sysctl(p, name, uap->namelen, + error = userland_sysctl(name, uap->namelen, uap->old, uap->oldlenp, 0, uap->new, uap->newlen, &j); if (error && error != ENOMEM) @@ -1134,15 +1134,13 @@ __sysctl(struct proc *p, struct sysctl_args *uap) * must be in kernel space. */ int -userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen, size_t *retval) +userland_sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen, size_t *retval) { int error = 0; struct sysctl_req req, req2; bzero(&req, sizeof req); - req.p = p; - if (oldlenp) { if (inkernel) { req.oldlen = *oldlenp; @@ -1275,7 +1273,7 @@ struct getkerninfo_args { #endif int -ogetkerninfo(struct proc *p, struct getkerninfo_args *uap) +ogetkerninfo(struct getkerninfo_args *uap) { int error, name[6]; size_t size; @@ -1289,14 +1287,14 @@ ogetkerninfo(struct proc *p, struct getkerninfo_args *uap) name[3] = (uap->op & 0xff0000) >> 16; name[4] = uap->op & 0xff; name[5] = uap->arg; - error = userland_sysctl(p, name, 6, uap->where, uap->size, + error = userland_sysctl(name, 6, uap->where, uap->size, 0, 0, 0, &size); break; case KINFO_VNODE: name[0] = CTL_KERN; name[1] = KERN_VNODE; - error = userland_sysctl(p, name, 2, uap->where, uap->size, + error = userland_sysctl(name, 2, uap->where, uap->size, 0, 0, 0, &size); break; @@ -1305,35 +1303,35 @@ ogetkerninfo(struct proc *p, struct getkerninfo_args *uap) name[1] = KERN_PROC; name[2] = uap->op & 0xff; name[3] = uap->arg; - error = userland_sysctl(p, name, 4, uap->where, uap->size, + error = userland_sysctl(name, 4, uap->where, uap->size, 0, 0, 0, &size); break; case KINFO_FILE: name[0] = CTL_KERN; name[1] = KERN_FILE; - error = userland_sysctl(p, name, 2, uap->where, uap->size, + error = userland_sysctl(name, 2, uap->where, uap->size, 0, 0, 0, &size); break; case KINFO_METER: name[0] = CTL_VM; name[1] = VM_METER; - error = userland_sysctl(p, name, 2, uap->where, uap->size, + error = userland_sysctl(name, 2, uap->where, uap->size, 0, 0, 0, &size); break; case KINFO_LOADAVG: name[0] = CTL_VM; name[1] = VM_LOADAVG; - error = userland_sysctl(p, name, 2, uap->where, uap->size, + error = userland_sysctl(name, 2, uap->where, uap->size, 0, 0, 0, &size); break; case KINFO_CLOCKRATE: name[0] = CTL_KERN; name[1] = KERN_CLOCKRATE; - error = userland_sysctl(p, name, 2, uap->where, uap->size, + error = userland_sysctl(name, 2, uap->where, uap->size, 0, 0, 0, &size); break; @@ -1406,7 +1404,7 @@ ogetkerninfo(struct proc *p, struct getkerninfo_args *uap) } if (error) return (error); - p->p_retval[0] = size; + curproc->p_retval[0] = size; if (uap->size) error = copyout((caddr_t)&size, (caddr_t)uap->size, sizeof(size)); diff --git a/sys/kern/kern_threads.c b/sys/kern/kern_threads.c index d2f67bed32..61d8d41fd7 100644 --- a/sys/kern/kern_threads.c +++ b/sys/kern/kern_threads.c @@ -47,7 +47,7 @@ * and I certainly make no claims as to its fitness for *any* purpose. * * $FreeBSD: src/sys/kern/kern_threads.c,v 1.15 1999/08/28 00:46:15 peter Exp $ - * $DragonFly: src/sys/kern/kern_threads.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_threads.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -69,7 +69,9 @@ * returns time waiting in ticks. */ int -thr_sleep(struct proc *p, struct thr_sleep_args *uap) { +thr_sleep(struct thr_sleep_args *uap) +{ + struct proc *p = curproc; int sleepstart; struct timespec ts; struct timeval atv; @@ -115,7 +117,9 @@ thr_sleep(struct proc *p, struct thr_sleep_args *uap) { } int -thr_wakeup(struct proc *p, struct thr_wakeup_args *uap) { +thr_wakeup(struct thr_wakeup_args *uap) +{ + struct proc *p = curproc; struct proc *pSlave = p->p_leader; while(pSlave && (pSlave->p_pid != uap->pid)) @@ -140,7 +144,9 @@ thr_wakeup(struct proc *p, struct thr_wakeup_args *uap) { * General purpose yield system call */ int -yield(struct proc *p, struct yield_args *uap) { +yield(struct yield_args *uap) +{ + struct proc *p = curproc; int s; p->p_retval[0] = 0; diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 6218900dd5..aa73131653 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -32,7 +32,7 @@ * * @(#)kern_time.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/kern/kern_time.c,v 1.68.2.1 2002/10/01 08:00:41 bde Exp $ - * $DragonFly: src/sys/kern/kern_time.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_time.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -62,7 +62,7 @@ struct timezone tz; * timers when they expire. */ -static int nanosleep1 __P((struct proc *p, struct timespec *rqt, +static int nanosleep1 __P((struct timespec *rqt, struct timespec *rmt)); static int settime __P((struct timeval *)); static void timevalfix __P((struct timeval *)); @@ -146,9 +146,7 @@ struct clock_gettime_args { /* ARGSUSED */ int -clock_gettime(p, uap) - struct proc *p; - struct clock_gettime_args *uap; +clock_gettime(struct clock_gettime_args *uap) { struct timespec ats; @@ -167,15 +165,13 @@ struct clock_settime_args { /* ARGSUSED */ int -clock_settime(p, uap) - struct proc *p; - struct clock_settime_args *uap; +clock_settime(struct clock_settime_args *uap) { struct timeval atv; struct timespec ats; int error; - if ((error = suser(p)) != 0) + if ((error = suser()) != 0) return (error); if (SCARG(uap, clock_id) != CLOCK_REALTIME) return (EINVAL); @@ -198,9 +194,7 @@ struct clock_getres_args { #endif int -clock_getres(p, uap) - struct proc *p; - struct clock_getres_args *uap; +clock_getres(struct clock_getres_args *uap) { struct timespec ts; int error; @@ -224,9 +218,7 @@ clock_getres(p, uap) static int nanowait; static int -nanosleep1(p, rqt, rmt) - struct proc *p; - struct timespec *rqt, *rmt; +nanosleep1(struct timespec *rqt, struct timespec *rmt) { struct timespec ts, ts2, ts3; struct timeval tv; @@ -271,9 +263,7 @@ struct nanosleep_args { /* ARGSUSED */ int -nanosleep(p, uap) - struct proc *p; - struct nanosleep_args *uap; +nanosleep(struct nanosleep_args *uap) { struct timespec rmt, rqt; int error, error2; @@ -285,7 +275,7 @@ nanosleep(p, uap) if (!useracc((caddr_t)SCARG(uap, rmtp), sizeof(rmt), VM_PROT_WRITE)) return (EFAULT); - error = nanosleep1(p, &rqt, &rmt); + error = nanosleep1(&rqt, &rmt); if (error && SCARG(uap, rmtp)) { error2 = copyout(&rmt, SCARG(uap, rmtp), sizeof(rmt)); if (error2) /* XXX shouldn't happen, did useracc() above */ @@ -302,9 +292,7 @@ struct gettimeofday_args { #endif /* ARGSUSED */ int -gettimeofday(p, uap) - struct proc *p; - register struct gettimeofday_args *uap; +gettimeofday(struct gettimeofday_args *uap) { struct timeval atv; int error = 0; @@ -329,15 +317,13 @@ struct settimeofday_args { #endif /* ARGSUSED */ int -settimeofday(p, uap) - struct proc *p; - struct settimeofday_args *uap; +settimeofday(struct settimeofday_args *uap) { struct timeval atv; struct timezone atz; int error; - if ((error = suser(p))) + if ((error = suser())) return (error); /* Verify all parameters before changing time. */ if (uap->tv) { @@ -369,15 +355,13 @@ struct adjtime_args { #endif /* ARGSUSED */ int -adjtime(p, uap) - struct proc *p; - register struct adjtime_args *uap; +adjtime(struct adjtime_args *uap) { struct timeval atv; register long ndelta, ntickdelta, odelta; int s, error; - if ((error = suser(p))) + if ((error = suser())) return (error); if ((error = copyin((caddr_t)uap->delta, (caddr_t)&atv, sizeof(struct timeval)))) @@ -449,10 +433,9 @@ struct getitimer_args { #endif /* ARGSUSED */ int -getitimer(p, uap) - struct proc *p; - register struct getitimer_args *uap; +getitimer(struct getitimer_args *uap) { + struct proc *p = curproc; struct timeval ctv; struct itimerval aitv; int s; @@ -490,13 +473,12 @@ struct setitimer_args { #endif /* ARGSUSED */ int -setitimer(p, uap) - struct proc *p; - register struct setitimer_args *uap; +setitimer(struct setitimer_args *uap) { struct itimerval aitv; struct timeval ctv; - register struct itimerval *itvp; + struct itimerval *itvp; + struct proc *p = curproc; int s, error; if (uap->which > ITIMER_PROF) @@ -506,7 +488,7 @@ setitimer(p, uap) sizeof(struct itimerval)))) return (error); if ((uap->itv = uap->oitv) && - (error = getitimer(p, (struct getitimer_args *)uap))) + (error = getitimer((struct getitimer_args *)uap))) return (error); if (itvp == 0) return (0); diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index 9c08b92604..26a8a82fdd 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -32,7 +32,7 @@ * * @(#)kern_xxx.c 8.2 (Berkeley) 11/14/93 * $FreeBSD: src/sys/kern/kern_xxx.c,v 1.31 1999/08/28 00:46:15 peter Exp $ - * $DragonFly: src/sys/kern/kern_xxx.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/kern_xxx.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_compat.h" @@ -56,16 +56,14 @@ struct gethostname_args { #endif /* ARGSUSED */ int -ogethostname(p, uap) - struct proc *p; - struct gethostname_args *uap; +ogethostname(struct gethostname_args *uap) { int name[2]; size_t len = uap->len; name[0] = CTL_KERN; name[1] = KERN_HOSTNAME; - return (userland_sysctl(p, name, 2, uap->hostname, &len, + return (userland_sysctl(name, 2, uap->hostname, &len, 1, 0, 0, 0)); } @@ -77,18 +75,16 @@ struct sethostname_args { #endif /* ARGSUSED */ int -osethostname(p, uap) - struct proc *p; - register struct sethostname_args *uap; +osethostname(struct sethostname_args *uap) { int name[2]; int error; name[0] = CTL_KERN; name[1] = KERN_HOSTNAME; - if ((error = suser_xxx(0, p, PRISON_ROOT))) + if ((error = suser_xxx(0, PRISON_ROOT))) return (error); - return (userland_sysctl(p, name, 2, 0, 0, 0, + return (userland_sysctl(name, 2, 0, 0, 0, uap->hostname, uap->len, 0)); } @@ -99,10 +95,9 @@ struct ogethostid_args { #endif /* ARGSUSED */ int -ogethostid(p, uap) - struct proc *p; - struct ogethostid_args *uap; +ogethostid(struct ogethostid_args *uap) { + struct proc *p = curproc; *(long *)(p->p_retval) = hostid; return (0); @@ -117,24 +112,19 @@ struct osethostid_args { #endif /* ARGSUSED */ int -osethostid(p, uap) - struct proc *p; - struct osethostid_args *uap; +osethostid(struct osethostid_args *uap) { int error; - if ((error = suser(p))) + if ((error = suser())) return (error); hostid = uap->hostid; return (0); } int -oquota(p, uap) - struct proc *p; - struct oquota_args *uap; +oquota(struct oquota_args *uap) { - return (ENOSYS); } #endif /* COMPAT_43 */ @@ -147,9 +137,7 @@ struct uname_args { /* ARGSUSED */ int -uname(p, uap) - struct proc *p; - struct uname_args *uap; +uname(struct uname_args *uap) { int name[2], rtval; size_t len; @@ -158,21 +146,21 @@ uname(p, uap) name[0] = CTL_KERN; name[1] = KERN_OSTYPE; len = sizeof uap->name->sysname; - rtval = userland_sysctl(p, name, 2, uap->name->sysname, &len, + rtval = userland_sysctl(name, 2, uap->name->sysname, &len, 1, 0, 0, 0); if( rtval) return rtval; subyte( uap->name->sysname + sizeof(uap->name->sysname) - 1, 0); name[1] = KERN_HOSTNAME; len = sizeof uap->name->nodename; - rtval = userland_sysctl(p, name, 2, uap->name->nodename, &len, + rtval = userland_sysctl(name, 2, uap->name->nodename, &len, 1, 0, 0, 0); if( rtval) return rtval; subyte( uap->name->nodename + sizeof(uap->name->nodename) - 1, 0); name[1] = KERN_OSRELEASE; len = sizeof uap->name->release; - rtval = userland_sysctl(p, name, 2, uap->name->release, &len, + rtval = userland_sysctl(name, 2, uap->name->release, &len, 1, 0, 0, 0); if( rtval) return rtval; subyte( uap->name->release + sizeof(uap->name->release) - 1, 0); @@ -180,7 +168,7 @@ uname(p, uap) /* name = KERN_VERSION; len = sizeof uap->name->version; - rtval = userland_sysctl(p, name, 2, uap->name->version, &len, + rtval = userland_sysctl(name, 2, uap->name->version, &len, 1, 0, 0, 0); if( rtval) return rtval; subyte( uap->name->version + sizeof(uap->name->version) - 1, 0); @@ -203,7 +191,7 @@ uname(p, uap) name[0] = CTL_HW; name[1] = HW_MACHINE; len = sizeof uap->name->machine; - rtval = userland_sysctl(p, name, 2, uap->name->machine, &len, + rtval = userland_sysctl(name, 2, uap->name->machine, &len, 1, 0, 0, 0); if( rtval) return rtval; subyte( uap->name->machine + sizeof(uap->name->machine) - 1, 0); @@ -220,9 +208,7 @@ struct getdomainname_args { /* ARGSUSED */ int -getdomainname(p, uap) - struct proc *p; - struct getdomainname_args *uap; +getdomainname(struct getdomainname_args *uap) { int domainnamelen = strlen(domainname) + 1; if ((u_int)uap->len > domainnamelen + 1) @@ -239,13 +225,11 @@ struct setdomainname_args { /* ARGSUSED */ int -setdomainname(p, uap) - struct proc *p; - struct setdomainname_args *uap; +setdomainname(struct setdomainname_args *uap) { int error, domainnamelen; - if ((error = suser(p))) + if ((error = suser())) return (error); if ((u_int)uap->len > sizeof (domainname) - 1) return EINVAL; diff --git a/sys/kern/makesyscalls.sh b/sys/kern/makesyscalls.sh index 7a9170ced7..b76e112286 100644 --- a/sys/kern/makesyscalls.sh +++ b/sys/kern/makesyscalls.sh @@ -1,7 +1,7 @@ #! /bin/sh - # @(#)makesyscalls.sh 8.1 (Berkeley) 6/10/93 # $FreeBSD: src/sys/kern/makesyscalls.sh,v 1.39.2.4 2001/10/20 09:01:24 marcel Exp $ -# $DragonFly: src/sys/kern/makesyscalls.sh,v 1.3 2003/06/17 05:21:46 dillon Exp $ +# $DragonFly: src/sys/kern/makesyscalls.sh,v 1.4 2003/06/23 17:55:41 dillon Exp $ set -e @@ -114,7 +114,6 @@ s/\$//g printf "#define\t%s\n\n", sysproto_h > sysarg printf "#include \n\n" > sysarg printf "#include \n\n" > sysarg - printf "struct proc;\n\n" > sysarg printf "#define\tPAD_(t)\t(sizeof(register_t) <= sizeof(t) ? \\\n" > sysarg printf "\t\t0 : sizeof(register_t) - sizeof(t))\n\n" > sysarg @@ -293,7 +292,7 @@ s/\$//g (funcname != "nosys" || !nosys)) || \ (funcname == "lkmnosys" && !lkmnosys) || \ funcname == "lkmressys") { - printf("%s\t%s __P((struct proc *, struct %s *))", + printf("%s\t%s __P((struct %s *))", rettype, funcname, argalias) > sysdcl printf(";\n") > sysdcl } @@ -338,7 +337,7 @@ s/\$//g else if($2 != "CPT_NOA") printf("struct\t%s {\n\tregister_t dummy;\n};\n", argalias) > sysarg - printf("%s\to%s __P((struct proc *, struct %s *));\n", + printf("%s\to%s __P((struct %s *));\n", rettype, funcname, argalias) > syscompatdcl printf("\t{ compat(%s%s,%s) },", mpsafe, argssize, funcname) > sysent diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 511ce84014..c434173415 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/sys/kern/subr_disk.c,v 1.20.2.6 2001/10/05 07:14:57 peter Exp $ - * $DragonFly: src/sys/kern/subr_disk.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/subr_disk.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ * */ @@ -161,7 +161,7 @@ SYSCTL_PROC(_kern, OID_AUTO, disks, CTLTYPE_STRING | CTLFLAG_RD, 0, NULL, */ static int -diskopen(dev_t dev, int oflags, int devtype, struct proc *p) +diskopen(dev_t dev, int oflags, int devtype, struct thread *td) { dev_t pdev; struct disk *dp; @@ -185,7 +185,7 @@ diskopen(dev_t dev, int oflags, int devtype, struct proc *p) if (!dsisopen(dp->d_slice)) { if (!pdev->si_iosize_max) pdev->si_iosize_max = dev->si_iosize_max; - error = dp->d_devsw->d_open(pdev, oflags, devtype, p); + error = dp->d_devsw->d_open(pdev, oflags, devtype, td); } /* Inherit properties from the whole/raw dev_t */ @@ -197,7 +197,7 @@ diskopen(dev_t dev, int oflags, int devtype, struct proc *p) error = dsopen(dev, devtype, dp->d_dsflags, &dp->d_slice, &dp->d_label); if (!dsisopen(dp->d_slice)) - dp->d_devsw->d_close(pdev, oflags, devtype, p); + dp->d_devsw->d_close(pdev, oflags, devtype, td); out: dp->d_flags &= ~DISKFLAG_LOCK; if (dp->d_flags & DISKFLAG_WANTED) { @@ -209,7 +209,7 @@ out: } static int -diskclose(dev_t dev, int fflag, int devtype, struct proc *p) +diskclose(dev_t dev, int fflag, int devtype, struct thread *td) { struct disk *dp; int error; @@ -222,7 +222,7 @@ diskclose(dev_t dev, int fflag, int devtype, struct proc *p) return (ENXIO); dsclose(dev, devtype, dp->d_slice); if (!dsisopen(dp->d_slice)) - error = dp->d_devsw->d_close(dp->d_dev, fflag, devtype, p); + error = dp->d_devsw->d_close(dp->d_dev, fflag, devtype, td); return (error); } @@ -255,7 +255,7 @@ diskstrategy(struct buf *bp) } static int -diskioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p) +diskioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { struct disk *dp; int error; @@ -267,7 +267,7 @@ diskioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p) return (ENXIO); error = dsioctl(dev, cmd, data, fflag, &dp->d_slice); if (error == ENOIOCTL) - error = dp->d_devsw->d_ioctl(dev, cmd, data, fflag, p); + error = dp->d_devsw->d_ioctl(dev, cmd, data, fflag, td); return (error); } diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c index 9413f7dc72..a83b6babfa 100644 --- a/sys/kern/subr_diskslice.c +++ b/sys/kern/subr_diskslice.c @@ -44,7 +44,7 @@ * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ * $FreeBSD: src/sys/kern/subr_diskslice.c,v 1.82.2.6 2001/07/24 09:49:41 dd Exp $ - * $DragonFly: src/sys/kern/subr_diskslice.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/subr_diskslice.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -825,10 +825,9 @@ dssize(dev, sspp) ssp = *sspp; if (ssp == NULL || slice >= ssp->dss_nslices || !(ssp->dss_slices[slice].ds_openmask & (1 << part))) { - if (devsw(dev)->d_open(dev, FREAD, S_IFCHR, - (struct proc *)NULL) != 0) + if (devsw(dev)->d_open(dev, FREAD, S_IFCHR, NULL) != 0) return (-1); - devsw(dev)->d_close(dev, FREAD, S_IFCHR, (struct proc *)NULL); + devsw(dev)->d_close(dev, FREAD, S_IFCHR, NULL); ssp = *sspp; } lp = ssp->dss_slices[slice].ds_label; diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index 1c44fd3b31..fa608aa021 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -32,7 +32,7 @@ * * @(#)subr_log.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/kern/subr_log.c,v 1.39.2.2 2001/06/02 08:11:25 phk Exp $ - * $DragonFly: src/sys/kern/subr_log.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/subr_log.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* @@ -100,8 +100,11 @@ SYSCTL_INT(_kern, OID_AUTO, log_wakeups_per_second, CTLFLAG_RW, /*ARGSUSED*/ static int -logopen(dev_t dev, int flags, int mode, struct proc *p) +logopen(dev_t dev, int flags, int mode, struct thread *td) { + struct proc *p = td->td_proc; + + KKASSERT(p != NULL); if (log_open) return (EBUSY); log_open = 1; @@ -114,7 +117,7 @@ logopen(dev_t dev, int flags, int mode, struct proc *p) /*ARGSUSED*/ static int -logclose(dev_t dev, int flag, int mode, struct proc *p) +logclose(dev_t dev, int flag, int mode, struct thread *td) { log_open = 0; @@ -169,7 +172,7 @@ logread(dev_t dev, struct uio *uio, int flag) /*ARGSUSED*/ static int -logpoll(dev_t dev, int events, struct proc *p) +logpoll(dev_t dev, int events, struct thread *td) { int s; int revents = 0; @@ -180,7 +183,7 @@ logpoll(dev_t dev, int events, struct proc *p) if (msgbufp->msg_bufr != msgbufp->msg_bufx) revents |= events & (POLLIN | POLLRDNORM); else - selrecord(p, &logsoftc.sc_selp); + selrecord(td, &logsoftc.sc_selp); } splx(s); return (revents); @@ -211,7 +214,7 @@ logtimeout(void *arg) /*ARGSUSED*/ static int -logioctl(dev_t dev, u_long com, caddr_t data, int flag, struct proc *p) +logioctl(dev_t dev, u_long com, caddr_t data, int flag, struct thread *td) { long l; int s; diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c index dc70e92c13..431a754c5e 100644 --- a/sys/kern/subr_prof.c +++ b/sys/kern/subr_prof.c @@ -32,7 +32,7 @@ * * @(#)subr_prof.c 8.3 (Berkeley) 9/23/93 * $FreeBSD: src/sys/kern/subr_prof.c,v 1.32.2.2 2000/08/03 00:09:32 ps Exp $ - * $DragonFly: src/sys/kern/subr_prof.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/subr_prof.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -353,11 +353,10 @@ struct profil_args { #endif /* ARGSUSED */ int -profil(p, uap) - struct proc *p; - register struct profil_args *uap; +profil(struct profil_args *uap) { - register struct uprof *upp; + struct proc *p = curproc; + struct uprof *upp; int s; if (uap->scale > (1 << 16)) diff --git a/sys/kern/subr_xxx.c b/sys/kern/subr_xxx.c index fe299dc4ec..341fb9c0cf 100644 --- a/sys/kern/subr_xxx.c +++ b/sys/kern/subr_xxx.c @@ -32,7 +32,7 @@ * * @(#)subr_xxx.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/kern/subr_xxx.c,v 1.15.2.1 2001/02/26 04:23:16 jlemon Exp $ - * $DragonFly: src/sys/kern/Attic/subr_xxx.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/Attic/subr_xxx.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* @@ -81,22 +81,22 @@ nullop() */ int -noopen(dev, flags, fmt, p) +noopen(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { return (ENODEV); } int -noclose(dev, flags, fmt, p) +noclose(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { return (ENODEV); @@ -123,12 +123,12 @@ nowrite(dev, uio, ioflag) } int -noioctl(dev, cmd, data, flags, p) +noioctl(dev, cmd, data, flags, td) dev_t dev; u_long cmd; caddr_t data; int flags; - struct proc *p; + struct thread *td; { return (ENODEV); @@ -173,22 +173,22 @@ nodump(dev) * minor number. */ int -nullopen(dev, flags, fmt, p) +nullopen(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { return (0); } int -nullclose(dev, flags, fmt, p) +nullclose(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { return (0); diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index a8cbb82c97..2881f7f286 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -37,7 +37,7 @@ * * @(#)sys_generic.c 8.5 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/sys_generic.c,v 1.55.2.10 2001/03/17 10:39:32 peter Exp $ - * $DragonFly: src/sys/kern/sys_generic.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/sys_generic.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_ktrace.h" @@ -74,9 +74,9 @@ MALLOC_DEFINE(M_IOV, "iov", "large iov's"); static int pollscan __P((struct proc *, struct pollfd *, u_int)); static int selscan __P((struct proc *, fd_mask **, fd_mask **, int)); -static int dofileread __P((struct proc *, struct file *, int, void *, +static int dofileread __P((struct file *, int, void *, size_t, off_t, int)); -static int dofilewrite __P((struct proc *, struct file *, int, +static int dofilewrite __P((struct file *, int, const void *, size_t, off_t, int)); struct file* @@ -106,16 +106,15 @@ struct read_args { }; #endif int -read(p, uap) - struct proc *p; - register struct read_args *uap; +read(struct read_args *uap) { - register struct file *fp; + struct proc *p = curproc; + struct file *fp; int error; if ((fp = holdfp(p->p_fd, uap->fd, FREAD)) == NULL) return (EBADF); - error = dofileread(p, fp, uap->fd, uap->buf, uap->nbyte, (off_t)-1, 0); + error = dofileread(fp, uap->fd, uap->buf, uap->nbyte, (off_t)-1, 0); fdrop(fp, p); return(error); } @@ -133,11 +132,10 @@ struct pread_args { }; #endif int -pread(p, uap) - struct proc *p; - register struct pread_args *uap; +pread(struct pread_args *uap) { - register struct file *fp; + struct proc *p = curproc; + struct file *fp; int error; if ((fp = holdfp(p->p_fd, uap->fd, FREAD)) == NULL) @@ -145,7 +143,7 @@ pread(p, uap) if (fp->f_type != DTYPE_VNODE) { error = ESPIPE; } else { - error = dofileread(p, fp, uap->fd, uap->buf, uap->nbyte, + error = dofileread(fp, uap->fd, uap->buf, uap->nbyte, uap->offset, FOF_OFFSET); } fdrop(fp, p); @@ -156,14 +154,14 @@ pread(p, uap) * Code common for read and pread */ int -dofileread(p, fp, fd, buf, nbyte, offset, flags) - struct proc *p; +dofileread(fp, fd, buf, nbyte, offset, flags) struct file *fp; int fd, flags; void *buf; size_t nbyte; off_t offset; { + struct proc *p = curproc; struct uio auio; struct iovec aiov; long cnt, error = 0; @@ -224,14 +222,13 @@ struct readv_args { }; #endif int -readv(p, uap) - struct proc *p; - register struct readv_args *uap; +readv(struct readv_args *uap) { - register struct file *fp; - register struct filedesc *fdp = p->p_fd; + struct proc *p = curproc; + struct file *fp; + struct filedesc *fdp = p->p_fd; struct uio auio; - register struct iovec *iov; + struct iovec *iov; struct iovec *needfree; struct iovec aiov[UIO_SMALLIOV]; long i, cnt, error = 0; @@ -318,16 +315,15 @@ struct write_args { }; #endif int -write(p, uap) - struct proc *p; - register struct write_args *uap; +write(struct write_args *uap) { - register struct file *fp; + struct proc *p = curproc; + struct file *fp; int error; if ((fp = holdfp(p->p_fd, uap->fd, FWRITE)) == NULL) return (EBADF); - error = dofilewrite(p, fp, uap->fd, uap->buf, uap->nbyte, (off_t)-1, 0); + error = dofilewrite(fp, uap->fd, uap->buf, uap->nbyte, (off_t)-1, 0); fdrop(fp, p); return(error); } @@ -345,11 +341,10 @@ struct pwrite_args { }; #endif int -pwrite(p, uap) - struct proc *p; - register struct pwrite_args *uap; +pwrite(struct pwrite_args *uap) { - register struct file *fp; + struct proc *p = curproc; + struct file *fp; int error; if ((fp = holdfp(p->p_fd, uap->fd, FWRITE)) == NULL) @@ -357,7 +352,7 @@ pwrite(p, uap) if (fp->f_type != DTYPE_VNODE) { error = ESPIPE; } else { - error = dofilewrite(p, fp, uap->fd, uap->buf, uap->nbyte, + error = dofilewrite(fp, uap->fd, uap->buf, uap->nbyte, uap->offset, FOF_OFFSET); } fdrop(fp, p); @@ -365,14 +360,15 @@ pwrite(p, uap) } static int -dofilewrite(p, fp, fd, buf, nbyte, offset, flags) - struct proc *p; - struct file *fp; - int fd, flags; - const void *buf; - size_t nbyte; - off_t offset; -{ +dofilewrite( + struct file *fp, + int fd, + const void *buf, + size_t nbyte, + off_t offset, + int flags +) { + struct proc *p = curproc; struct uio auio; struct iovec aiov; long cnt, error = 0; @@ -436,14 +432,13 @@ struct writev_args { }; #endif int -writev(p, uap) - struct proc *p; - register struct writev_args *uap; +writev(struct writev_args *uap) { - register struct file *fp; - register struct filedesc *fdp = p->p_fd; + struct proc *p = curproc; + struct file *fp; + struct filedesc *fdp = p->p_fd; struct uio auio; - register struct iovec *iov; + struct iovec *iov; struct iovec *needfree; struct iovec aiov[UIO_SMALLIOV]; long i, cnt, error = 0; @@ -538,13 +533,12 @@ struct ioctl_args { #endif /* ARGSUSED */ int -ioctl(p, uap) - struct proc *p; - register struct ioctl_args *uap; +ioctl(struct ioctl_args *uap) { - register struct file *fp; - register struct filedesc *fdp; - register u_long com; + struct proc *p = curproc; + struct file *fp; + struct filedesc *fdp; + u_long com; int error; register u_int size; caddr_t data, memp; @@ -660,10 +654,10 @@ struct select_args { }; #endif int -select(p, uap) - register struct proc *p; - register struct select_args *uap; +select(struct select_args *uap) { + struct proc *p = curproc; + /* * The magic 2048 here is chosen to be just enough for FD_SETSIZE * infds with the new FD_SETSIZE of 1024, and more than enough for @@ -840,9 +834,7 @@ struct poll_args { }; #endif int -poll(p, uap) - struct proc *p; - struct poll_args *uap; +poll(struct poll_args *uap) { caddr_t bits; char smallbits[32 * sizeof(struct pollfd)]; @@ -850,6 +842,7 @@ poll(p, uap) int s, ncoll, error = 0, timo; u_int nfds; size_t ni; + struct proc *p = curproc; nfds = SCARG(uap, nfds); /* @@ -976,53 +969,49 @@ struct openbsd_poll_args { }; #endif int -openbsd_poll(p, uap) - register struct proc *p; - register struct openbsd_poll_args *uap; +openbsd_poll(struct openbsd_poll_args *uap) { - return (poll(p, (struct poll_args *)uap)); + return (poll((struct poll_args *)uap)); } /*ARGSUSED*/ int -seltrue(dev, events, p) - dev_t dev; - int events; - struct proc *p; +seltrue(dev_t dev, int events, struct thread *td) { - return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); } /* - * Record a select request. + * Record a select request. A global wait must be used since a process/thread + * might go away after recording its request. */ void -selrecord(selector, sip) - struct proc *selector; - struct selinfo *sip; +selrecord(struct thread *selector, struct selinfo *sip) { struct proc *p; pid_t mypid; - mypid = selector->p_pid; + if ((p = selector->td_proc) == NULL) + panic("selrecord: thread needs a process"); + + mypid = p->p_pid; if (sip->si_pid == mypid) return; if (sip->si_pid && (p = pfind(sip->si_pid)) && - p->p_wchan == (caddr_t)&selwait) + p->p_wchan == (caddr_t)&selwait) { sip->si_flags |= SI_COLL; - else + } else { sip->si_pid = mypid; + } } /* * Do a wakeup when a selectable event occurs. */ void -selwakeup(sip) - register struct selinfo *sip; +selwakeup(struct selinfo *sip) { - register struct proc *p; + struct proc *p; int s; if (sip->si_pid == 0) @@ -1030,7 +1019,7 @@ selwakeup(sip) if (sip->si_flags & SI_COLL) { nselcoll++; sip->si_flags &= ~SI_COLL; - wakeup((caddr_t)&selwait); + wakeup((caddr_t)&selwait); /* YYY fixable */ } p = pfind(sip->si_pid); sip->si_pid = 0; @@ -1046,3 +1035,4 @@ selwakeup(sip) splx(s); } } + diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 6c94cc6022..5c1115e12d 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -17,7 +17,7 @@ * are met. * * $FreeBSD: src/sys/kern/sys_pipe.c,v 1.60.2.13 2002/08/05 15:05:15 des Exp $ - * $DragonFly: src/sys/kern/sys_pipe.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/sys_pipe.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* @@ -162,16 +162,15 @@ static vm_zone_t pipe_zone; /* * The pipe system call for the DTYPE_PIPE type of pipes + * + * pipe_ARgs(int dummy) */ /* ARGSUSED */ int -pipe(p, uap) - struct proc *p; - struct pipe_args /* { - int dummy; - } */ *uap; +pipe(struct pipe_args *uap) { + struct proc *p = curproc; struct filedesc *fdp = p->p_fd; struct file *rf, *wf; struct pipe *rpipe, *wpipe; @@ -1103,12 +1102,12 @@ pipe_poll(fp, events, cred, p) if (revents == 0) { if (events & (POLLIN | POLLRDNORM)) { - selrecord(p, &rpipe->pipe_sel); + selrecord(p->p_thread, &rpipe->pipe_sel); rpipe->pipe_state |= PIPE_SEL; } if (events & (POLLOUT | POLLWRNORM)) { - selrecord(p, &wpipe->pipe_sel); + selrecord(p->p_thread, &wpipe->pipe_sel); wpipe->pipe_state |= PIPE_SEL; } } diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index a7c17b31b4..7592debfe4 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -29,7 +29,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/sys_process.c,v 1.51.2.6 2003/01/08 03:06:45 kan Exp $ - * $DragonFly: src/sys/kern/sys_process.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/sys_process.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -200,8 +200,10 @@ struct ptrace_args { #endif int -ptrace(struct proc *p, struct ptrace_args *uap) +ptrace(struct ptrace_args *uap) { + struct proc *p = curproc; + /* * XXX this obfuscation is to reduce stack usage, but the register * structs may be too large to put on the stack anyway. @@ -284,7 +286,7 @@ kern_ptrace(struct proc *curp, int req, pid_t pid, void *addr, int data) if ((p = pfind(pid)) == NULL) return ESRCH; } - if (!PRISON_CHECK(curp, p)) + if (!PRISON_CHECK(curp->p_ucred, p->p_ucred)) return (ESRCH); /* Can't trace a process that's currently exec'ing. */ @@ -314,9 +316,9 @@ kern_ptrace(struct proc *curp, int req, pid_t pid, void *addr, int data) return (EINVAL); /* not owned by you, has done setuid (unless you're root) */ - if ((p->p_cred->p_ruid != curp->p_cred->p_ruid) || + if ((p->p_ucred->cr_ruid != curp->p_ucred->cr_ruid) || (p->p_flag & P_SUGID)) { - if ((error = suser(curp)) != 0) + if ((error = suser()) != 0) return error; } diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 5a22a3f39a..483108e6f6 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -2,8 +2,8 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * $DragonFly: src/sys/kern/syscalls.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ - * created from TurtleBSD: src/sys/kern/syscalls.master,v 1.1 2003/06/16 06:26:15 dillon Exp + * $DragonFly: src/sys/kern/syscalls.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ + * created from TurtleBSD: src/sys/kern/syscalls.master,v 1.2 2003/06/17 04:28:41 dillon Exp */ char *syscallnames[] = { diff --git a/sys/kern/sysv_ipc.c b/sys/kern/sysv_ipc.c index 02b7118804..7abdd7e74a 100644 --- a/sys/kern/sysv_ipc.c +++ b/sys/kern/sysv_ipc.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/kern/sysv_ipc.c,v 1.13.2.2 2000/07/01 14:33:49 bsd Exp $ */ -/* $DragonFly: src/sys/kern/sysv_ipc.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ */ +/* $DragonFly: src/sys/kern/sysv_ipc.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* $NetBSD: sysv_ipc.c,v 1.7 1994/06/29 06:33:11 cgd Exp $ */ /* @@ -46,17 +46,14 @@ */ int -ipcperm(p, perm, mode) - struct proc *p; - struct ipc_perm *perm; - int mode; +ipcperm(struct proc *p, struct ipc_perm *perm, int mode) { struct ucred *cred = p->p_ucred; /* Check for user match. */ if (cred->cr_uid != perm->cuid && cred->cr_uid != perm->uid) { if (mode & IPC_M) - return (suser(p) == 0 ? 0 : EPERM); + return (suser() == 0 ? 0 : EPERM); /* Check for group match. */ mode >>= 3; if (!groupmember(perm->gid, cred) && @@ -67,7 +64,7 @@ ipcperm(p, perm, mode) if (mode & IPC_M) return (0); - return ((mode & perm->mode) == mode || suser(p) == 0 ? 0 : EACCES); + return ((mode & perm->mode) == mode || suser() == 0 ? 0 : EACCES); } #endif /* defined(SYSVSEM) || defined(SYSVSHM) || defined(SYSVMSG) */ diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index ff64fca46d..591866da90 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/kern/sysv_msg.c,v 1.23.2.5 2002/12/31 08:54:53 maxim Exp $ */ -/* $DragonFly: src/sys/kern/sysv_msg.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ */ +/* $DragonFly: src/sys/kern/sysv_msg.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* * Implementation of SVID messages @@ -198,32 +198,24 @@ SYSINIT(sysv_msg, SI_SUB_SYSV_MSG, SI_ORDER_FIRST, msginit, NULL) /* * Entry point for all MSG calls + * + * msgsys_args(u_int which, int a2, ...) (VARARGS) */ int -msgsys(p, uap) - struct proc *p; - /* XXX actually varargs. */ - struct msgsys_args /* { - u_int which; - int a2; - int a3; - int a4; - int a5; - int a6; - } */ *uap; +msgsys(struct msgsys_args *uap) { + struct proc *p = curproc; - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); if (uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0])) return (EINVAL); - return ((*msgcalls[uap->which])(p, &uap->a2)); + return ((*msgcalls[uap->which])(&uap->a2)); } static void -msg_freehdr(msghdr) - struct msg *msghdr; +msg_freehdr(struct msg *msghdr) { while (msghdr->msg_ts > 0) { short next; @@ -254,10 +246,9 @@ struct msgctl_args { #endif int -msgctl(p, uap) - struct proc *p; - register struct msgctl_args *uap; +msgctl(struct msgctl_args *uap) { + struct proc *p = curproc; int msqid = uap->msqid; int cmd = uap->cmd; struct msqid_ds *user_msqptr = uap->buf; @@ -269,7 +260,7 @@ msgctl(p, uap) printf("call to msgctl(%d, %d, 0x%x)\n", msqid, cmd, user_msqptr); #endif - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); msqid = IPCID_TO_IX(msqid); @@ -338,7 +329,7 @@ msgctl(p, uap) if ((eval = copyin(user_msqptr, &msqbuf, sizeof(msqbuf))) != 0) return(eval); if (msqbuf.msg_qbytes > msqptr->msg_qbytes) { - eval = suser(p); + eval = suser(); if (eval) return(eval); } @@ -394,10 +385,9 @@ struct msgget_args { #endif int -msgget(p, uap) - struct proc *p; - register struct msgget_args *uap; +msgget(struct msgget_args *uap) { + struct proc *p = curproc; int msqid, eval; int key = uap->key; int msgflg = uap->msgflg; @@ -408,7 +398,7 @@ msgget(p, uap) printf("msgget(0x%x, 0%o)\n", key, msgflg); #endif - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); if (key != IPC_PRIVATE) { @@ -505,10 +495,9 @@ struct msgsnd_args { #endif int -msgsnd(p, uap) - struct proc *p; - register struct msgsnd_args *uap; +msgsnd(struct msgsnd_args *uap) { + struct proc *p = curproc; int msqid = uap->msqid; void *user_msgp = uap->msgp; size_t msgsz = uap->msgsz; @@ -523,7 +512,7 @@ msgsnd(p, uap) msgflg); #endif - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); msqid = IPCID_TO_IX(msqid); @@ -830,10 +819,9 @@ struct msgrcv_args { #endif int -msgrcv(p, uap) - struct proc *p; - register struct msgrcv_args *uap; +msgrcv(struct msgrcv_args *uap) { + struct proc *p = curproc; int msqid = uap->msqid; void *user_msgp = uap->msgp; size_t msgsz = uap->msgsz; @@ -850,7 +838,7 @@ msgrcv(p, uap) msgsz, msgtyp, msgflg); #endif - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); msqid = IPCID_TO_IX(msqid); diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index 8595f63491..e309ecc740 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/kern/sysv_sem.c,v 1.24.2.8 2002/10/22 20:45:03 fjoe Exp $ */ -/* $DragonFly: src/sys/kern/sysv_sem.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ */ +/* $DragonFly: src/sys/kern/sysv_sem.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* * Implementation of SVID semaphores @@ -200,26 +200,20 @@ SYSINIT(sysv_sem, SI_SUB_SYSV_SEM, SI_ORDER_FIRST, seminit, NULL) /* * Entry point for all SEM calls + * + * semsys_args(u_int which, a2, a3, ...) (VARARGS) */ int -semsys(p, uap) - struct proc *p; - /* XXX actually varargs. */ - struct semsys_args /* { - u_int which; - int a2; - int a3; - int a4; - int a5; - } */ *uap; +semsys(struct semsys_args *uap) { + struct proc *p = curproc; - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); if (uap->which >= sizeof(semcalls)/sizeof(semcalls[0])) return (EINVAL); - return ((*semcalls[uap->which])(p, &uap->a2)); + return ((*semcalls[uap->which])(&uap->a2)); } /* @@ -405,10 +399,9 @@ struct __semctl_args { #endif int -__semctl(p, uap) - struct proc *p; - register struct __semctl_args *uap; +__semctl(struct __semctl_args *uap) { + struct proc *p = curproc; int semid = uap->semid; int semnum = uap->semnum; int cmd = uap->cmd; @@ -423,7 +416,7 @@ __semctl(p, uap) printf("call to semctl(%d, %d, %d, 0x%x)\n", semid, semnum, cmd, arg); #endif - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); semid = IPCID_TO_IX(semid); @@ -572,10 +565,9 @@ struct semget_args { #endif int -semget(p, uap) - struct proc *p; - register struct semget_args *uap; +semget(struct semget_args *uap) { + struct proc *p = curproc; int semid, eval; int key = uap->key; int nsems = uap->nsems; @@ -586,7 +578,7 @@ semget(p, uap) printf("semget(0x%x, %d, 0%o)\n", key, nsems, semflg); #endif - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); if (key != IPC_PRIVATE) { @@ -689,10 +681,9 @@ struct semop_args { #endif int -semop(p, uap) - struct proc *p; - register struct semop_args *uap; +semop(struct semop_args *uap) { + struct proc *p = curproc; int semid = uap->semid; u_int nsops = uap->nsops; struct sembuf sops[MAX_SOPS]; @@ -707,7 +698,7 @@ semop(p, uap) printf("call to semop(%d, 0x%x, %u)\n", semid, sops, nsops); #endif - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); semid = IPCID_TO_IX(semid); /* Convert back to zero origin */ diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 4f680c6161..d268030133 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/kern/sysv_shm.c,v 1.45.2.6 2002/10/22 20:45:03 fjoe Exp $ */ -/* $DragonFly: src/sys/kern/sysv_shm.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ */ +/* $DragonFly: src/sys/kern/sysv_shm.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */ /* @@ -223,14 +223,13 @@ struct shmdt_args { #endif int -shmdt(p, uap) - struct proc *p; - struct shmdt_args *uap; +shmdt(struct shmdt_args *uap) { + struct proc *p = curproc; struct shmmap_state *shmmap_s; int i; - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); shmmap_s = (struct shmmap_state *)p->p_vmspace->vm_shm; @@ -254,10 +253,9 @@ struct shmat_args { #endif int -shmat(p, uap) - struct proc *p; - struct shmat_args *uap; +shmat(struct shmat_args *uap) { + struct proc *p = curproc; int error, i, flags; struct shmid_ds *shmseg; struct shmmap_state *shmmap_s = NULL; @@ -267,7 +265,7 @@ shmat(p, uap) vm_size_t size; int rv; - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); shmmap_s = (struct shmmap_state *)p->p_vmspace->vm_shm; @@ -361,7 +359,7 @@ oshmctl(p, uap) struct shmid_ds *shmseg; struct oshmid_ds outbuf; - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); shmseg = shm_find_segment_by_shmid(uap->shmid); @@ -387,7 +385,7 @@ oshmctl(p, uap) break; default: /* XXX casting to (sy_call_t *) is bogus, as usual. */ - return ((sy_call_t *)shmctl)(p, uap); + return ((sy_call_t *)shmctl)(uap); } return 0; #else @@ -404,15 +402,14 @@ struct shmctl_args { #endif int -shmctl(p, uap) - struct proc *p; - struct shmctl_args *uap; +shmctl(struct shmctl_args *uap) { + struct proc *p = curproc; int error; struct shmid_ds inbuf; struct shmid_ds *shmseg; - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); shmseg = shm_find_segment_by_shmid(uap->shmid); @@ -585,13 +582,12 @@ shmget_allocate_segment(p, uap, mode) } int -shmget(p, uap) - struct proc *p; - struct shmget_args *uap; +shmget(struct shmget_args *uap) { + struct proc *p = curproc; int segnum, mode, error; - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); mode = uap->shmflg & ACCESSPERMS; @@ -610,24 +606,20 @@ shmget(p, uap) return shmget_allocate_segment(p, uap, mode); } +/* + * shmsys_args(u_int which, int a2, ...) (VARARGS) + */ int -shmsys(p, uap) - struct proc *p; - /* XXX actually varargs. */ - struct shmsys_args /* { - u_int which; - int a2; - int a3; - int a4; - } */ *uap; +shmsys(struct shmsys_args *uap) { + struct proc *p = curproc; - if (!jail_sysvipc_allowed && p->p_prison != NULL) + if (!jail_sysvipc_allowed && p->p_ucred->cr_prison != NULL) return (ENOSYS); if (uap->which >= sizeof(shmcalls)/sizeof(shmcalls[0])) return EINVAL; - return ((*shmcalls[uap->which])(p, &uap->a2)); + return ((*shmcalls[uap->which])(&uap->a2)); } void diff --git a/sys/kern/tty.c b/sys/kern/tty.c index b8c3913d44..b8bbd11aea 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -37,7 +37,7 @@ * * @(#)tty.c 8.8 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/tty.c,v 1.129.2.5 2002/03/11 01:32:31 dd Exp $ - * $DragonFly: src/sys/kern/tty.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/tty.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /*- @@ -701,16 +701,14 @@ ttyoutput(c, tp) /* ARGSUSED */ int ttioctl(tp, cmd, data, flag) - register struct tty *tp; + struct tty *tp; u_long cmd; int flag; void *data; { - register struct proc *p; + struct proc *p = curproc; int s, error; - p = curproc; /* XXX */ - /* If the ioctl involves modification, hang if in the background. */ switch (cmd) { case TIOCCBRK: @@ -815,7 +813,7 @@ ttioctl(tp, cmd, data, flag) ISSET(constty->t_state, TS_CONNECTED)) return (EBUSY); #ifndef UCONSOLE - if ((error = suser(p)) != 0) + if ((error = suser()) != 0) return (error); #endif constty = tp; @@ -987,9 +985,9 @@ ttioctl(tp, cmd, data, flag) splx(s); break; case TIOCSTI: /* simulate terminal input */ - if ((flag & FREAD) == 0 && suser(p)) + if ((flag & FREAD) == 0 && suser()) return (EPERM); - if (!isctty(p, tp) && suser(p)) + if (!isctty(p, tp) && suser()) return (EACCES); s = spltty(); (*linesw[tp->t_line].l_rint)(*(u_char *)data, tp); @@ -1037,7 +1035,7 @@ ttioctl(tp, cmd, data, flag) } break; case TIOCSDRAINWAIT: - error = suser(p); + error = suser(); if (error) return (error); tp->t_timeout = *(int *)data * hz; @@ -1058,10 +1056,10 @@ ttioctl(tp, cmd, data, flag) } int -ttypoll(dev, events, p) +ttypoll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { int s; int revents = 0; @@ -1077,7 +1075,7 @@ ttypoll(dev, events, p) if (ttnread(tp) > 0 || ISSET(tp->t_state, TS_ZOMBIE)) revents |= events & (POLLIN | POLLRDNORM); else - selrecord(p, &tp->t_rsel); + selrecord(td, &tp->t_rsel); } if (events & (POLLOUT | POLLWRNORM)) { if ((tp->t_outq.c_cc <= tp->t_olowat && @@ -1085,7 +1083,7 @@ ttypoll(dev, events, p) || ISSET(tp->t_state, TS_ZOMBIE)) revents |= events & (POLLOUT | POLLWRNORM); else - selrecord(p, &tp->t_wsel); + selrecord(td, &tp->t_wsel); } splx(s); return (revents); diff --git a/sys/kern/tty_conf.c b/sys/kern/tty_conf.c index b3cde96bcb..43fdc8522b 100644 --- a/sys/kern/tty_conf.c +++ b/sys/kern/tty_conf.c @@ -37,7 +37,7 @@ * * @(#)tty_conf.c 8.4 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/tty_conf.c,v 1.16.2.1 2002/03/11 01:14:55 dd Exp $ - * $DragonFly: src/sys/kern/tty_conf.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/tty_conf.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_compat.h" @@ -199,12 +199,12 @@ l_nostart(tp) * discipline specific ioctl command. */ int -l_nullioctl(tp, cmd, data, flags, p) +l_nullioctl(tp, cmd, data, flags, td) struct tty *tp; u_long cmd; char *data; int flags; - struct proc *p; + struct thread *td; { return (ENOIOCTL); diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index ec1051ae7e..04ff56fc08 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -37,7 +37,7 @@ * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 * $FreeBSD: src/sys/kern/tty_cons.c,v 1.81.2.4 2001/12/17 18:44:41 guido Exp $ - * $DragonFly: src/sys/kern/tty_cons.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/tty_cons.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_ddb.h" @@ -232,7 +232,7 @@ sysctl_kern_consmute(SYSCTL_HANDLER_ARGS) if(cn_is_open) /* XXX curproc is not what we want really */ error = cnopen(cn_dev_t, openflag, - openmode, curproc); + openmode, curthread); /* if it failed, back it out */ if ( error != 0) cnuninit(); } else if (!ocn_mute && cn_mute) { @@ -242,7 +242,7 @@ sysctl_kern_consmute(SYSCTL_HANDLER_ARGS) */ if(cn_is_open) error = cnclose(cn_dev_t, openflag, - openmode, curproc); + openmode, curthread); if ( error == 0) cnuninit(); } if (error != 0) { @@ -259,10 +259,10 @@ SYSCTL_PROC(_kern, OID_AUTO, consmute, CTLTYPE_INT|CTLFLAG_RW, 0, sizeof cn_mute, sysctl_kern_consmute, "I", ""); static int -cnopen(dev, flag, mode, p) +cnopen(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { dev_t cndev, physdev; int retval = 0; @@ -277,7 +277,7 @@ cnopen(dev, flag, mode, p) * bypass this and go straight to the device. */ if(!cn_mute) - retval = (*cn_phys_open)(physdev, flag, mode, p); + retval = (*cn_phys_open)(physdev, flag, mode, td); if (retval == 0) { /* * check if we openned it via /dev/console or @@ -296,10 +296,10 @@ cnopen(dev, flag, mode, p) } static int -cnclose(dev, flag, mode, p) +cnclose(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { dev_t cndev; struct tty *cn_tp; @@ -334,7 +334,7 @@ cnclose(dev, flag, mode, p) dev = cndev; } if(cn_phys_close) - return ((*cn_phys_close)(dev, flag, mode, p)); + return ((*cn_phys_close)(dev, flag, mode, td)); return (0); } @@ -371,44 +371,45 @@ cnwrite(dev, uio, flag) } static int -cnioctl(dev, cmd, data, flag, p) +cnioctl(dev, cmd, data, flag, td) dev_t dev; u_long cmd; caddr_t data; int flag; - struct proc *p; + struct thread *td; { int error; if (cn_tab == NULL || cn_phys_open == NULL) return (0); + KKASSERT(td->td_proc != NULL); /* * Superuser can always use this to wrest control of console * output from the "virtual" console. */ if (cmd == TIOCCONS && constty) { - error = suser(p); + error = suser_xxx(td->td_proc->p_ucred, 0); if (error) return (error); constty = NULL; return (0); } dev = cn_tab->cn_dev; - return ((*devsw(dev)->d_ioctl)(dev, cmd, data, flag, p)); + return ((*devsw(dev)->d_ioctl)(dev, cmd, data, flag, td)); } static int -cnpoll(dev, events, p) +cnpoll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { if ((cn_tab == NULL) || cn_mute) return (1); dev = cn_tab->cn_dev; - return ((*devsw(dev)->d_poll)(dev, events, p)); + return ((*devsw(dev)->d_poll)(dev, events, td)); } static int diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 09c6780810..9bb351882a 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -32,7 +32,7 @@ * * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 * $FreeBSD: src/sys/kern/tty_pty.c,v 1.74.2.4 2002/02/20 19:58:13 dillon Exp $ - * $DragonFly: src/sys/kern/tty_pty.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/tty_pty.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* @@ -166,16 +166,17 @@ ptyinit(n) /*ARGSUSED*/ static int -ptsopen(dev, flag, devtype, p) - dev_t dev; - int flag, devtype; - struct proc *p; +ptsopen(dev_t dev, int flag, int devtype, struct thread *td) { register struct tty *tp; int error; int minr; dev_t nextdev; struct pt_ioctl *pti; + struct proc *p; + + p = td->td_proc; + KKASSERT(p != NULL); /* * XXX: Gross hack for DEVFS: @@ -203,9 +204,9 @@ ptsopen(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()) { return (EBUSY); - } else if (pti->pt_prison != p->p_prison) { + } else if (pti->pt_prison != p->p_ucred->cr_prison) { return (EBUSY); } if (tp->t_oproc) /* Ctrlr still around. */ @@ -225,10 +226,10 @@ ptsopen(dev, flag, devtype, p) } static int -ptsclose(dev, flag, mode, p) +ptsclose(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { register struct tty *tp; int err; @@ -345,10 +346,10 @@ ptcwakeup(tp, flag) } static int -ptcopen(dev, flag, devtype, p) +ptcopen(dev, flag, devtype, td) dev_t dev; int flag, devtype; - struct proc *p; + struct thread *td; { register struct tty *tp; struct pt_ioctl *pti; @@ -360,12 +361,13 @@ ptcopen(dev, flag, devtype, p) tp = dev->si_tty; if (tp->t_oproc) return (EIO); + KKASSERT(td->td_proc != NULL); tp->t_oproc = ptsstart; tp->t_stop = ptsstop; (void)(*linesw[tp->t_line].l_modem)(tp, 1); tp->t_lflag &= ~EXTPROC; pti = dev->si_drv1; - pti->pt_prison = p->p_prison; + pti->pt_prison = td->td_proc->p_ucred->cr_prison; pti->pt_flags = 0; pti->pt_send = 0; pti->pt_ucntl = 0; @@ -373,11 +375,11 @@ ptcopen(dev, flag, devtype, p) } static int -ptcclose(dev, flags, fmt, p) +ptcclose(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { register struct tty *tp; @@ -489,10 +491,10 @@ ptsstop(tp, flush) } static int -ptcpoll(dev, events, p) +ptcpoll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { register struct tty *tp = dev->si_tty; struct pt_ioctl *pti = dev->si_drv1; @@ -500,7 +502,7 @@ ptcpoll(dev, events, p) int s; if ((tp->t_state & TS_CONNECTED) == 0) - return (seltrue(dev, events, p) | POLLHUP); + return (seltrue(dev, events, td) | POLLHUP); /* * Need to block timeouts (ttrstart). @@ -528,10 +530,10 @@ ptcpoll(dev, events, p) if (revents == 0) { if (events & (POLLIN | POLLRDNORM)) - selrecord(p, &pti->pt_selr); + selrecord(td, &pti->pt_selr); if (events & (POLLOUT | POLLWRNORM)) - selrecord(p, &pti->pt_selw); + selrecord(td, &pti->pt_selw); } splx(s); @@ -650,12 +652,12 @@ block: /*ARGSUSED*/ static int -ptyioctl(dev, cmd, data, flag, p) +ptyioctl(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; register struct pt_ioctl *pti = dev->si_drv1; @@ -759,7 +761,7 @@ ptyioctl(dev, cmd, data, flag, p) } return(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) error = ttioctl(tp, cmd, data, flag); if (error == ENOIOCTL) { diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 0dbc111609..7074c144b8 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -32,7 +32,7 @@ * * @(#)tty_tty.c 8.2 (Berkeley) 9/23/93 * $FreeBSD: src/sys/kern/tty_tty.c,v 1.30 1999/09/25 18:24:24 phk Exp $ - * $DragonFly: src/sys/kern/tty_tty.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/tty_tty.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* @@ -77,17 +77,20 @@ struct cdevsw ctty_cdevsw = { /*ARGSUSED*/ static int -cttyopen(dev, flag, mode, p) +cttyopen(dev, flag, mode, td) dev_t dev; int flag, mode; - struct proc *p; + struct thread *td; { - struct vnode *ttyvp = cttyvp(p); + struct vnode *ttyvp; int error; + KKASSERT(td->td_proc != NULL); + ttyvp = cttyvp(td->td_proc); + if (ttyvp == NULL) return (ENXIO); - vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY, td->td_proc); #ifdef PARANOID /* * Since group is tty and mode is 620 on most terminal lines @@ -101,8 +104,8 @@ cttyopen(dev, flag, mode, p) (flag&FREAD ? VREAD : 0) | (flag&FWRITE ? VWRITE : 0), p->p_ucred, p); if (!error) #endif /* PARANOID */ - error = VOP_OPEN(ttyvp, flag, NOCRED, p); - VOP_UNLOCK(ttyvp, 0, p); + error = VOP_OPEN(ttyvp, flag, NOCRED, td->td_proc); + VOP_UNLOCK(ttyvp, 0, td->td_proc); return (error); } @@ -146,42 +149,46 @@ cttywrite(dev, uio, flag) /*ARGSUSED*/ static int -cttyioctl(dev, cmd, addr, flag, p) +cttyioctl(dev, cmd, addr, flag, td) dev_t dev; u_long cmd; caddr_t addr; int flag; - struct proc *p; + struct thread *td; { - struct vnode *ttyvp = cttyvp(p); + struct vnode *ttyvp; + KKASSERT(td->td_proc != NULL); + ttyvp = cttyvp(td->td_proc); if (ttyvp == NULL) return (EIO); if (cmd == TIOCSCTTY) /* don't allow controlling tty to be set */ return EINVAL; /* to controlling tty -- infinite recursion */ if (cmd == TIOCNOTTY) { - if (!SESS_LEADER(p)) { - p->p_flag &= ~P_CONTROLT; + if (!SESS_LEADER(td->td_proc)) { + td->td_proc->p_flag &= ~P_CONTROLT; return (0); } else return (EINVAL); } - return (VOP_IOCTL(ttyvp, cmd, addr, flag, NOCRED, p)); + return (VOP_IOCTL(ttyvp, cmd, addr, flag, NOCRED, td->td_proc)); } /*ARGSUSED*/ static int -cttypoll(dev, events, p) +cttypoll(dev, events, td) dev_t dev; int events; - struct proc *p; + struct thread *td; { - struct vnode *ttyvp = cttyvp(p); + struct vnode *ttyvp; + KKASSERT(td->td_proc != NULL); + ttyvp = cttyvp(td->td_proc); if (ttyvp == NULL) /* try operation to get EOF/failure */ - return (seltrue(dev, events, p)); - return (VOP_POLL(ttyvp, events, p->p_ucred, p)); + return (seltrue(dev, events, td)); + return (VOP_POLL(ttyvp, events, td->td_proc->p_ucred, td->td_proc)); } static void ctty_drvinit __P((void *unused)); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index a279fb9f48..6d6e8cf021 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -32,7 +32,7 @@ * * @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94 * $FreeBSD: src/sys/kern/uipc_socket.c,v 1.68.2.22 2002/12/15 09:24:23 maxim Exp $ - * $DragonFly: src/sys/kern/uipc_socket.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/uipc_socket.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_inet.h" @@ -141,7 +141,7 @@ socreate(dom, aso, type, proto, p) if (prp == 0 || prp->pr_usrreqs->pru_attach == 0) return (EPROTONOSUPPORT); - if (p->p_prison && jail_socket_unixiproute_only && + if (p->p_ucred->cr_prison && jail_socket_unixiproute_only && prp->pr_domain->dom_family != PF_LOCAL && prp->pr_domain->dom_family != PF_INET && prp->pr_domain->dom_family != PF_ROUTE) { @@ -1528,12 +1528,12 @@ sopoll(struct socket *so, int events, struct ucred *cred, struct proc *p) if (revents == 0) { if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { - selrecord(p, &so->so_rcv.sb_sel); + selrecord(p->p_thread, &so->so_rcv.sb_sel); so->so_rcv.sb_flags |= SB_SEL; } if (events & (POLLOUT | POLLWRNORM)) { - selrecord(p, &so->so_snd.sb_sel); + selrecord(p->p_thread, &so->so_snd.sb_sel); so->so_snd.sb_flags |= SB_SEL; } } diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 9dec29bb77..bdc600e554 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -35,7 +35,7 @@ * * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94 * $FreeBSD: src/sys/kern/uipc_syscalls.c,v 1.65.2.17 2003/04/04 17:11:16 tegge Exp $ - * $DragonFly: src/sys/kern/uipc_syscalls.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/uipc_syscalls.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include "opt_compat.h" @@ -74,17 +74,14 @@ static void sf_buf_init(void *arg); SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL) -static int sendit __P((struct proc *p, int s, struct msghdr *mp, int flags)); -static int recvit __P((struct proc *p, int s, struct msghdr *mp, +static int sendit __P((int s, struct msghdr *mp, int flags)); +static int recvit __P((int s, struct msghdr *mp, caddr_t namelenp)); -static int accept1 __P((struct proc *p, struct accept_args *uap, int compat)); -static int do_sendfile __P((struct proc *p, struct sendfile_args *uap, - int compat)); -static int getsockname1 __P((struct proc *p, struct getsockname_args *uap, - int compat)); -static int getpeername1 __P((struct proc *p, struct getpeername_args *uap, - int compat)); +static int accept1 __P((struct accept_args *uap, int compat)); +static int do_sendfile __P((struct sendfile_args *uap, int compat)); +static int getsockname1 __P((struct getsockname_args *uap, int compat)); +static int getpeername1 __P((struct getpeername_args *uap, int compat)); static SLIST_HEAD(, sf_buf) sf_freelist; static vm_offset_t sf_base; @@ -100,15 +97,13 @@ static int sf_buf_alloc_want; extern struct fileops socketops; +/* + * socket_args(int domain, int type, int protocol) + */ int -socket(p, uap) - struct proc *p; - register struct socket_args /* { - int domain; - int type; - int protocol; - } */ *uap; +socket(struct socket_args *uap) { + struct proc *p = curproc; struct filedesc *fdp = p->p_fd; struct socket *so; struct file *fp; @@ -135,16 +130,15 @@ socket(p, uap) return (error); } +/* + * bind_args(int s, caddr_t name, int namelen) + * + */ /* ARGSUSED */ int -bind(p, uap) - struct proc *p; - register struct bind_args /* { - int s; - caddr_t name; - int namelen; - } */ *uap; +bind(struct bind_args *uap) { + struct proc *p = curproc; struct file *fp; struct sockaddr *sa; int error; @@ -163,15 +157,14 @@ bind(p, uap) return (error); } +/* + * listen_args(int s, int backlog) + */ /* ARGSUSED */ int -listen(p, uap) - struct proc *p; - register struct listen_args /* { - int s; - int backlog; - } */ *uap; +listen(struct listen_args *uap) { + struct proc *p = curproc; struct file *fp; int error; @@ -183,16 +176,13 @@ listen(p, uap) return(error); } +/* + * accept_args(int s, caddr_t name, int *anamelen) + */ static int -accept1(p, uap, compat) - struct proc *p; - register struct accept_args /* { - int s; - caddr_t name; - int *anamelen; - } */ *uap; - int compat; +accept1(struct accept_args *uap, int compat) { + struct proc *p = curproc; struct filedesc *fdp = p->p_fd; struct file *lfp = NULL; struct file *nfp = NULL; @@ -354,35 +344,28 @@ done: } int -accept(p, uap) - struct proc *p; - struct accept_args *uap; +accept(struct accept_args *uap) { - - return (accept1(p, uap, 0)); + return (accept1(uap, 0)); } #ifdef COMPAT_OLDSOCK int -oaccept(p, uap) - struct proc *p; - struct accept_args *uap; +oaccept(struct accept_args *uap) { - return (accept1(p, uap, 1)); + return (accept1(uap, 1)); } #endif /* COMPAT_OLDSOCK */ +/* + * connect_args(int s, caddr_t name, int namelen) + */ /* ARGSUSED */ int -connect(p, uap) - struct proc *p; - register struct connect_args /* { - int s; - caddr_t name; - int namelen; - } */ *uap; +connect(struct connect_args *uap) { + struct proc *p = curproc; struct file *fp; register struct socket *so; struct sockaddr *sa; @@ -429,17 +412,14 @@ done: return (error); } +/* + * socketpair(int domain, int type, int protocol, int *rsv) + */ int -socketpair(p, uap) - struct proc *p; - register struct socketpair_args /* { - int domain; - int type; - int protocol; - int *rsv; - } */ *uap; +socketpair(struct socketpair_args *uap) { - register struct filedesc *fdp = p->p_fd; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; struct file *fp1, *fp2; struct socket *so1, *so2; int fd, error, sv[2]; @@ -500,12 +480,12 @@ free1: } static int -sendit(p, s, mp, flags) - register struct proc *p; +sendit(s, mp, flags) int s; - register struct msghdr *mp; + struct msghdr *mp; int flags; { + struct proc *p = curproc; struct file *fp; struct uio auio; register struct iovec *iov; @@ -616,17 +596,11 @@ bad: return (error); } +/* + * sendto_args(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen) + */ int -sendto(p, uap) - struct proc *p; - register struct sendto_args /* { - int s; - caddr_t buf; - size_t len; - int flags; - caddr_t to; - int tolen; - } */ *uap; +sendto(struct sendto_args *uap) { struct msghdr msg; struct iovec aiov; @@ -641,19 +615,15 @@ sendto(p, uap) #endif aiov.iov_base = uap->buf; aiov.iov_len = uap->len; - return (sendit(p, uap->s, &msg, uap->flags)); + return (sendit(uap->s, &msg, uap->flags)); } #ifdef COMPAT_OLDSOCK +/* + * osend_args(int s, caddr_t buf, int len, int flags) + */ int -osend(p, uap) - struct proc *p; - register struct osend_args /* { - int s; - caddr_t buf; - int len; - int flags; - } */ *uap; +osend(struct osend_args *uap) { struct msghdr msg; struct iovec aiov; @@ -666,17 +636,14 @@ osend(p, uap) aiov.iov_len = uap->len; msg.msg_control = 0; msg.msg_flags = 0; - return (sendit(p, uap->s, &msg, uap->flags)); + return (sendit(uap->s, &msg, uap->flags)); } +/* + * osendmsg_args(int s, caddr_t msg, int flags) + */ int -osendmsg(p, uap) - struct proc *p; - register struct osendmsg_args /* { - int s; - caddr_t msg; - int flags; - } */ *uap; +osendmsg(struct osendmsg_args *uap) { struct msghdr msg; struct iovec aiov[UIO_SMALLIOV], *iov; @@ -699,7 +666,7 @@ osendmsg(p, uap) goto done; msg.msg_flags = MSG_COMPAT; msg.msg_iov = iov; - error = sendit(p, uap->s, &msg, uap->flags); + error = sendit(uap->s, &msg, uap->flags); done: if (iov != aiov) FREE(iov, M_IOV); @@ -707,14 +674,11 @@ done: } #endif +/* + * sendmsg_args(int s, caddr_t msg, int flags) + */ int -sendmsg(p, uap) - struct proc *p; - register struct sendmsg_args /* { - int s; - caddr_t msg; - int flags; - } */ *uap; +sendmsg(struct sendmsg_args *uap) { struct msghdr msg; struct iovec aiov[UIO_SMALLIOV], *iov; @@ -739,7 +703,7 @@ sendmsg(p, uap) #ifdef COMPAT_OLDSOCK msg.msg_flags = 0; #endif - error = sendit(p, uap->s, &msg, uap->flags); + error = sendit(uap->s, &msg, uap->flags); done: if (iov != aiov) FREE(iov, M_IOV); @@ -747,12 +711,12 @@ done: } static int -recvit(p, s, mp, namelenp) - register struct proc *p; +recvit(s, mp, namelenp) int s; - register struct msghdr *mp; + struct msghdr *mp; caddr_t namelenp; { + struct proc *p = curproc; struct file *fp; struct uio auio; register struct iovec *iov; @@ -902,17 +866,12 @@ out: return (error); } +/* + * recvfrom_args(int s, caddr_t buf, size_t len, int flags, + * caddr_t from, int *fromlenaddr) + */ int -recvfrom(p, uap) - struct proc *p; - register struct recvfrom_args /* { - int s; - caddr_t buf; - size_t len; - int flags; - caddr_t from; - int *fromlenaddr; - } */ *uap; +recvfrom(struct recvfrom_args *uap) { struct msghdr msg; struct iovec aiov; @@ -932,32 +891,24 @@ recvfrom(p, uap) aiov.iov_len = uap->len; msg.msg_control = 0; msg.msg_flags = uap->flags; - return (recvit(p, uap->s, &msg, (caddr_t)uap->fromlenaddr)); + return (recvit(uap->s, &msg, (caddr_t)uap->fromlenaddr)); } #ifdef COMPAT_OLDSOCK int -orecvfrom(p, uap) - struct proc *p; - struct recvfrom_args *uap; +orecvfrom(struct recvfrom_args *uap) { - uap->flags |= MSG_COMPAT; - return (recvfrom(p, uap)); + return (recvfrom(uap)); } #endif - #ifdef COMPAT_OLDSOCK +/* + * struct orecv_args(int s, caddr_t buf, int len, int flags) + */ int -orecv(p, uap) - struct proc *p; - register struct orecv_args /* { - int s; - caddr_t buf; - int len; - int flags; - } */ *uap; +orecv(struct orecv_args *uap) { struct msghdr msg; struct iovec aiov; @@ -970,22 +921,18 @@ orecv(p, uap) aiov.iov_len = uap->len; msg.msg_control = 0; msg.msg_flags = uap->flags; - return (recvit(p, uap->s, &msg, (caddr_t)0)); + return (recvit(uap->s, &msg, (caddr_t)0)); } /* * Old recvmsg. This code takes advantage of the fact that the old msghdr * overlays the new one, missing only the flags, and with the (old) access * rights where the control fields are now. + * + * orecvmsg_args(int s, struct omsghdr *msg, int flags) */ int -orecvmsg(p, uap) - struct proc *p; - register struct orecvmsg_args /* { - int s; - struct omsghdr *msg; - int flags; - } */ *uap; +orecvmsg(struct orecvmsg_args *uap) { struct msghdr msg; struct iovec aiov[UIO_SMALLIOV], *iov; @@ -1009,7 +956,7 @@ orecvmsg(p, uap) if (error) goto done; msg.msg_iov = iov; - error = recvit(p, uap->s, &msg, (caddr_t)&uap->msg->msg_namelen); + error = recvit(uap->s, &msg, (caddr_t)&uap->msg->msg_namelen); if (msg.msg_controllen && error == 0) error = copyout((caddr_t)&msg.msg_controllen, @@ -1021,18 +968,15 @@ done: } #endif +/* + * recvmsg_args(int s, struct msghdr *msg, int flags) + */ int -recvmsg(p, uap) - struct proc *p; - register struct recvmsg_args /* { - int s; - struct msghdr *msg; - int flags; - } */ *uap; +recvmsg(struct recvmsg_args *uap) { struct msghdr msg; struct iovec aiov[UIO_SMALLIOV], *uiov, *iov; - register int error; + int error; error = copyin((caddr_t)uap->msg, (caddr_t)&msg, sizeof (msg)); if (error) @@ -1056,7 +1000,7 @@ recvmsg(p, uap) (unsigned)(msg.msg_iovlen * sizeof (struct iovec))); if (error) goto done; - error = recvit(p, uap->s, &msg, (caddr_t)0); + error = recvit(uap->s, &msg, (caddr_t)0); if (!error) { msg.msg_iov = uiov; error = copyout((caddr_t)&msg, (caddr_t)uap->msg, sizeof(msg)); @@ -1067,15 +1011,14 @@ done: return (error); } +/* + * shutdown_args(int s, int how) + */ /* ARGSUSED */ int -shutdown(p, uap) - struct proc *p; - register struct shutdown_args /* { - int s; - int how; - } */ *uap; +shutdown(struct shutdown_args *uap) { + struct proc *p = curproc; struct file *fp; int error; @@ -1087,18 +1030,14 @@ shutdown(p, uap) return(error); } +/* + * setsockopt_args(int s, int level, int name, caddr_t val, int valsize) + */ /* ARGSUSED */ int -setsockopt(p, uap) - struct proc *p; - register struct setsockopt_args /* { - int s; - int level; - int name; - caddr_t val; - int valsize; - } */ *uap; +setsockopt(struct setsockopt_args *uap) { + struct proc *p = curproc; struct file *fp; struct sockopt sopt; int error; @@ -1123,18 +1062,14 @@ setsockopt(p, uap) return(error); } +/* + * getsockopt_Args(int s, int level, int name, caddr_t val, int *avalsize) + */ /* ARGSUSED */ int -getsockopt(p, uap) - struct proc *p; - register struct getsockopt_args /* { - int s; - int level; - int name; - caddr_t val; - int *avalsize; - } */ *uap; +getsockopt(struct getsockopt_args *uap) { + struct proc *p = curproc; int valsize, error; struct file *fp; struct sockopt sopt; @@ -1175,19 +1110,15 @@ getsockopt(p, uap) } /* + * getsockname_args(int fdes, caddr_t asa, int *alen) + * * Get socket name. */ /* ARGSUSED */ static int -getsockname1(p, uap, compat) - struct proc *p; - register struct getsockname_args /* { - int fdes; - caddr_t asa; - int *alen; - } */ *uap; - int compat; +getsockname1(struct getsockname_args *uap, int compat) { + struct proc *p = curproc; struct file *fp; register struct socket *so; struct sockaddr *sa; @@ -1233,39 +1164,31 @@ bad: } int -getsockname(p, uap) - struct proc *p; - struct getsockname_args *uap; +getsockname(struct getsockname_args *uap) { - return (getsockname1(p, uap, 0)); + return (getsockname1(uap, 0)); } #ifdef COMPAT_OLDSOCK int -ogetsockname(p, uap) - struct proc *p; - struct getsockname_args *uap; +ogetsockname(struct getsockname_args *uap) { - return (getsockname1(p, uap, 1)); + return (getsockname1(uap, 1)); } #endif /* COMPAT_OLDSOCK */ /* + * getpeername_args(int fdes, caddr_t asa, int *alen) + * * Get name of peer for connected socket. */ /* ARGSUSED */ static int -getpeername1(p, uap, compat) - struct proc *p; - register struct getpeername_args /* { - int fdes; - caddr_t asa; - int *alen; - } */ *uap; - int compat; +getpeername1(struct getpeername_args *uap, int compat) { + struct proc *p = curproc; struct file *fp; register struct socket *so; struct sockaddr *sa; @@ -1315,23 +1238,17 @@ bad: } int -getpeername(p, uap) - struct proc *p; - struct getpeername_args *uap; +getpeername(struct getpeername_args *uap) { - - return (getpeername1(p, uap, 0)); + return (getpeername1(uap, 0)); } #ifdef COMPAT_OLDSOCK int -ogetpeername(p, uap) - struct proc *p; - struct ogetpeername_args *uap; +ogetpeername(struct ogetpeername_args *uap) { - /* XXX uap should have type `getpeername_args *' to begin with. */ - return (getpeername1(p, (struct getpeername_args *)uap, 1)); + return (getpeername1((struct getpeername_args *)uap, 1)); } #endif /* COMPAT_OLDSOCK */ @@ -1533,15 +1450,14 @@ sf_buf_free(caddr_t addr, u_int size) * output. If specified, write the total number of bytes sent into *sbytes. */ int -sendfile(struct proc *p, struct sendfile_args *uap) +sendfile(struct sendfile_args *uap) { - - return (do_sendfile(p, uap, 0)); + return (do_sendfile(uap, 0)); } #ifdef COMPAT_43 int -osendfile(struct proc *p, struct osendfile_args *uap) +osendfile(struct osendfile_args *uap) { struct sendfile_args args; @@ -1553,13 +1469,14 @@ osendfile(struct proc *p, struct osendfile_args *uap) args.sbytes = uap->sbytes; args.flags = uap->flags; - return (do_sendfile(p, &args, 1)); + return (do_sendfile(&args, 1)); } #endif int -do_sendfile(struct proc *p, struct sendfile_args *uap, int compat) +do_sendfile(struct sendfile_args *uap, int compat) { + struct proc *p = curproc; struct file *fp; struct filedesc *fdp = p->p_fd; struct vnode *vp; @@ -1627,7 +1544,7 @@ do_sendfile(struct proc *p, struct sendfile_args *uap, int compat) nuap.fd = uap->s; nuap.iovp = hdtr.headers; nuap.iovcnt = hdtr.hdr_cnt; - error = writev(p, &nuap); + error = writev(&nuap); if (error) goto done; if (compat) @@ -1870,7 +1787,7 @@ retry_space: nuap.fd = uap->s; nuap.iovp = hdtr.trailers; nuap.iovcnt = hdtr.trl_cnt; - error = writev(p, &nuap); + error = writev(&nuap); if (error) goto done; if (compat) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 4d17e38378..d4c8394c0d 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -32,7 +32,7 @@ * * From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94 * $FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.54.2.10 2003/03/04 17:28:09 nectar Exp $ - * $DragonFly: src/sys/kern/uipc_usrreq.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/kern/uipc_usrreq.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -788,7 +788,7 @@ unp_abort(unp) static int prison_unpcb(struct proc *p, struct unpcb *unp) { - if (!p->p_prison) + if (!p->p_ucred->cr_prison) return (0); if (p->p_fd->fd_rdir == unp->unp_rvnode) return (0); @@ -806,6 +806,8 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) head = ((intptr_t)arg1 == SOCK_DGRAM ? &unp_dhead : &unp_shead); + KKASSERT(curproc != NULL); + /* * The process of preparing the PCB list is too time-consuming and * resource-intensive to repeat twice on every request. @@ -1036,8 +1038,8 @@ unp_internalize(control, p) if (cm->cmsg_type == SCM_CREDS) { cmcred = (struct cmsgcred *)(cm + 1); cmcred->cmcred_pid = p->p_pid; - cmcred->cmcred_uid = p->p_cred->p_ruid; - cmcred->cmcred_gid = p->p_cred->p_rgid; + cmcred->cmcred_uid = p->p_ucred->cr_ruid; + cmcred->cmcred_gid = p->p_ucred->cr_rgid; cmcred->cmcred_euid = p->p_ucred->cr_uid; cmcred->cmcred_ngroups = MIN(p->p_ucred->cr_ngroups, CMGROUP_MAX); diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 643cbc2bdd..10a9500180 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -14,7 +14,7 @@ * of the author. This software is distributed AS-IS. * * $FreeBSD: src/sys/kern/vfs_aio.c,v 1.70.2.28 2003/05/29 06:15:35 alc Exp $ - * $DragonFly: src/sys/kern/vfs_aio.c,v 1.3 2003/06/22 04:30:42 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_aio.c,v 1.4 2003/06/23 17:55:41 dillon Exp $ */ /* @@ -218,7 +218,7 @@ static void aio_onceonly(void *); static int aio_free_entry(struct aiocblist *aiocbe); static void aio_process(struct aiocblist *aiocbe); static int aio_newproc(void); -static int aio_aqueue(struct proc *p, struct aiocb *job, int type); +static int aio_aqueue(struct aiocb *job, int type); static void aio_physwakeup(struct buf *bp); static int aio_fphysio(struct aiocblist *aiocbe); static int aio_qphysio(struct proc *p, struct aiocblist *iocb); @@ -1130,8 +1130,9 @@ aio_swake(struct socket *so, struct sockbuf *sb) * technique is done in this code. */ static int -_aio_aqueue(struct proc *p, struct aiocb *job, struct aio_liojob *lj, int type) +_aio_aqueue(struct aiocb *job, struct aio_liojob *lj, int type) { + struct proc *p = curprpoc; struct filedesc *fdp; struct file *fp; unsigned int fd; @@ -1374,8 +1375,9 @@ done: * This routine queues an AIO request, checking for quotas. */ static int -aio_aqueue(struct proc *p, struct aiocb *job, int type) +aio_aqueue(struct aiocb *job, int type) { + struct proc *p = curprpoc; struct kaioinfo *ki; if (p->p_aioinfo == NULL) @@ -1388,7 +1390,7 @@ aio_aqueue(struct proc *p, struct aiocb *job, int type) if (ki->kaio_queue_count >= ki->kaio_qallowed_count) return EAGAIN; - return _aio_aqueue(p, job, NULL, type); + return _aio_aqueue(job, NULL, type); } #endif /* VFS_AIO */ @@ -1397,11 +1399,12 @@ aio_aqueue(struct proc *p, struct aiocb *job, int type) * released. */ int -aio_return(struct proc *p, struct aio_return_args *uap) +aio_return(struct aio_return_args *uap) { #ifndef VFS_AIO return ENOSYS; #else + struct proc *p = curproc; int s; long jobref; struct aiocblist *cb, *ncb; @@ -1463,11 +1466,12 @@ aio_return(struct proc *p, struct aio_return_args *uap) * Allow a process to wakeup when any of the I/O requests are completed. */ int -aio_suspend(struct proc *p, struct aio_suspend_args *uap) +aio_suspend(struct aio_suspend_args *uap) { #ifndef VFS_AIO return ENOSYS; #else + struct proc *p = curproc; struct timeval atv; struct timespec ts; struct aiocb *const *cbptr, *cbp; @@ -1579,11 +1583,12 @@ aio_suspend(struct proc *p, struct aio_suspend_args *uap) * progress. */ int -aio_cancel(struct proc *p, struct aio_cancel_args *uap) +aio_cancel(struct aio_cancel_args *uap) { #ifndef VFS_AIO return ENOSYS; #else + struct proc *p = curproc; struct kaioinfo *ki; struct aiocblist *cbe, *cbn; struct file *fp; @@ -1696,11 +1701,12 @@ done: * subroutine. */ int -aio_error(struct proc *p, struct aio_error_args *uap) +aio_error(struct aio_error_args *uap) { #ifndef VFS_AIO return ENOSYS; #else + struct proc *p = curproc; int s; struct aiocblist *cb; struct kaioinfo *ki; @@ -1781,33 +1787,34 @@ aio_error(struct proc *p, struct aio_error_args *uap) /* syscall - asynchronous read from a file (REALTIME) */ int -aio_read(struct proc *p, struct aio_read_args *uap) +aio_read(struct aio_read_args *uap) { #ifndef VFS_AIO return ENOSYS; #else - return aio_aqueue(p, uap->aiocbp, LIO_READ); + return aio_aqueue(uap->aiocbp, LIO_READ); #endif /* VFS_AIO */ } /* syscall - asynchronous write to a file (REALTIME) */ int -aio_write(struct proc *p, struct aio_write_args *uap) +aio_write(struct aio_write_args *uap) { #ifndef VFS_AIO return ENOSYS; #else - return aio_aqueue(p, uap->aiocbp, LIO_WRITE); + return aio_aqueue(uap->aiocbp, LIO_WRITE); #endif /* VFS_AIO */ } /* syscall - XXX undocumented */ int -lio_listio(struct proc *p, struct lio_listio_args *uap) +lio_listio(struct lio_listio_args *uap) { #ifndef VFS_AIO return ENOSYS; #else + struct proc *p = curproc; int nent, nentqueued; struct aiocb *iocb, * const *cbptr; struct aiocblist *cb; @@ -1875,7 +1882,7 @@ lio_listio(struct proc *p, struct lio_listio_args *uap) for (i = 0; i < uap->nent; i++) { iocb = (struct aiocb *)(intptr_t)fuword(&cbptr[i]); if (((intptr_t)iocb != -1) && ((intptr_t)iocb != 0)) { - error = _aio_aqueue(p, iocb, lj, 0); + error = _aio_aqueue(iocb, lj, 0); if (error == 0) nentqueued++; else @@ -2070,11 +2077,12 @@ aio_physwakeup(struct buf *bp) /* syscall - wait for the next completion of an aio request */ int -aio_waitcomplete(struct proc *p, struct aio_waitcomplete_args *uap) +aio_waitcomplete(struct aio_waitcomplete_args *uap) { #ifndef VFS_AIO return ENOSYS; #else + struct proc *p = curproc; struct timeval atv; struct timespec ts; struct kaioinfo *ki; diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 0eaa936d6a..96d6c60911 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -35,7 +35,7 @@ * * @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95 * $FreeBSD: src/sys/kern/vfs_cache.c,v 1.42.2.6 2001/10/05 20:07:03 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_cache.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_cache.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -537,11 +537,11 @@ static u_long numcwdfail2; STATNODE(CTLFLAG_RD, numcwdfail2, &numcwdfail2); static u_long numcwdfail3; STATNODE(CTLFLAG_RD, numcwdfail3, &numcwdfail3); static u_long numcwdfail4; STATNODE(CTLFLAG_RD, numcwdfail4, &numcwdfail4); static u_long numcwdfound; STATNODE(CTLFLAG_RD, numcwdfound, &numcwdfound); + int -__getcwd(p, uap) - struct proc *p; - struct __getcwd_args *uap; +__getcwd(struct __getcwd_args *uap) { + struct proc *p = curproc; char *bp, *buf; int error, i, slash_prefixed; struct filedesc *fdp; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 9b461858b8..aa1d8fb7b0 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -37,7 +37,7 @@ * * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 * $FreeBSD: src/sys/kern/vfs_subr.c,v 1.249.2.30 2003/04/04 20:35:57 tegge Exp $ - * $DragonFly: src/sys/kern/vfs_subr.c,v 1.4 2003/06/22 17:39:42 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_subr.c,v 1.5 2003/06/23 17:55:41 dillon Exp $ */ /* @@ -2823,7 +2823,7 @@ vn_pollrecord(vp, p, events) return events; } vp->v_pollinfo.vpi_events |= events; - selrecord(p, &vp->v_pollinfo.vpi_selinfo); + selrecord(p->p_thread, &vp->v_pollinfo.vpi_selinfo); simple_unlock(&vp->v_pollinfo.vpi_lock); return 0; } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index a94bc3eb3b..67a3550f27 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -37,7 +37,7 @@ * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 * $FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.151.2.18 2003/04/04 20:35:58 tegge Exp $ - * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_syscalls.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ /* For 4.3 integer FS ID compatibility */ @@ -75,11 +75,10 @@ static int change_dir __P((struct nameidata *ndp, struct proc *p)); static void checkdirs __P((struct vnode *olddp)); static int chroot_refuse_vdir_fds __P((struct filedesc *fdp)); static int getutimes __P((const struct timeval *, struct timespec *)); -static int setfown __P((struct proc *, struct vnode *, uid_t, gid_t)); -static int setfmode __P((struct proc *, struct vnode *, int)); -static int setfflags __P((struct proc *, struct vnode *, int)); -static int setutimes __P((struct proc *, struct vnode *, - const struct timespec *, int)); +static int setfown __P((struct vnode *, uid_t, gid_t)); +static int setfmode __P((struct vnode *, int)); +static int setfflags __P((struct vnode *, int)); +static int setutimes __P((struct vnode *, const struct timespec *, int)); static int usermount = 0; /* if 1, non-root can mount fs. */ int (*union_dircheckp) __P((struct proc *, struct vnode **, struct file *)); @@ -101,17 +100,14 @@ struct mount_args { caddr_t data; }; #endif +/* + * mount_args(char *type, char *path, int flags, caddr_t data) + */ /* ARGSUSED */ int -mount(p, uap) - struct proc *p; - register struct mount_args /* { - syscallarg(char *) type; - syscallarg(char *) path; - syscallarg(int) flags; - syscallarg(caddr_t) data; - } */ *uap; +mount(struct mount_args *uap) { + struct proc *p = curproc; struct vnode *vp; struct mount *mp; struct vfsconf *vfsp; @@ -123,20 +119,20 @@ mount(p, uap) struct nameidata nd; char fstypename[MFSNAMELEN]; - if (usermount == 0 && (error = suser(p))) + if (usermount == 0 && (error = suser())) return (error); /* * Do not allow NFS export by non-root users. */ if (SCARG(uap, flags) & MNT_EXPORTED) { - error = suser(p); + error = suser(); if (error) return (error); } /* * Silently enforce MNT_NOSUID and MNT_NODEV for non-root users */ - if (suser_xxx(p->p_ucred, 0, 0)) + if (suser_xxx(p->p_ucred, 0)) SCARG(uap, flags) |= MNT_NOSUID | MNT_NODEV; /* * Get vnode to be covered @@ -169,7 +165,7 @@ mount(p, uap) * permitted to update it. */ if (mp->mnt_stat.f_owner != p->p_ucred->cr_uid && - (error = suser(p))) { + (error = suser())) { vput(vp); return (error); } @@ -198,7 +194,7 @@ mount(p, uap) */ if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)) || (va.va_uid != p->p_ucred->cr_uid && - (error = suser(p)))) { + (error = suser()))) { vput(vp); return (error); } @@ -239,7 +235,7 @@ mount(p, uap) linker_file_t lf; /* Only load modules for root (very important!) */ - if ((error = suser(p)) != 0) { + if ((error = suser()) != 0) { vput(vp); return error; } @@ -420,16 +416,15 @@ struct unmount_args { int flags; }; #endif +/* + * umount_args(char *path, int flags) + */ /* ARGSUSED */ int -unmount(p, uap) - struct proc *p; - register struct unmount_args /* { - syscallarg(char *) path; - syscallarg(int) flags; - } */ *uap; +unmount(struct unmount_args *uap) { - register struct vnode *vp; + struct proc *p = curproc; + struct vnode *vp; struct mount *mp; int error; struct nameidata nd; @@ -447,7 +442,7 @@ unmount(p, uap) * permitted to unmount this filesystem. */ if ((mp->mnt_stat.f_owner != p->p_ucred->cr_uid) && - (error = suser(p))) { + (error = suser())) { vput(vp); return (error); } @@ -558,11 +553,10 @@ SYSCTL_INT(_debug, OID_AUTO, syncprt, CTLFLAG_RW, &syncprt, 0, ""); /* ARGSUSED */ int -sync(p, uap) - struct proc *p; - struct sync_args *uap; +sync(struct sync_args *uap) { - register struct mount *mp, *nmp; + struct proc *p = curproc; + struct mount *mp, *nmp; int asyncflag; simple_lock(&mountlist_slock); @@ -604,32 +598,20 @@ SYSCTL_INT(_kern_prison, OID_AUTO, quotas, CTLFLAG_RW, &prison_quotas, 0, ""); #endif /* + * quotactl_args(char *path, int fcmd, int uid, caddr_t arg) + * * Change filesystem quotas. */ -#ifndef _SYS_SYSPROTO_H_ -struct quotactl_args { - char *path; - int cmd; - int uid; - caddr_t arg; -}; -#endif /* ARGSUSED */ int -quotactl(p, uap) - struct proc *p; - register struct quotactl_args /* { - syscallarg(char *) path; - syscallarg(int) cmd; - syscallarg(int) uid; - syscallarg(caddr_t) arg; - } */ *uap; +quotactl(struct quotactl_args *uap) { - register struct mount *mp; + struct proc *p = curproc; + struct mount *mp; int error; struct nameidata nd; - if (p->p_prison && !prison_quotas) + if (p->p_ucred->cr_prison && !prison_quotas) return (EPERM); NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if ((error = namei(&nd)) != 0) @@ -642,25 +624,17 @@ quotactl(p, uap) } /* + * statfs_args(char *path, struct statfs *buf) + * * Get filesystem statistics. */ -#ifndef _SYS_SYSPROTO_H_ -struct statfs_args { - char *path; - struct statfs *buf; -}; -#endif /* ARGSUSED */ int -statfs(p, uap) - struct proc *p; - register struct statfs_args /* { - syscallarg(char *) path; - syscallarg(struct statfs *) buf; - } */ *uap; +statfs(struct statfs_args *uap) { - register struct mount *mp; - register struct statfs *sp; + struct proc *p = curproc; + struct mount *mp; + struct statfs *sp; int error; struct nameidata nd; struct statfs sb; @@ -676,7 +650,7 @@ statfs(p, uap) if (error) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - if (suser_xxx(p->p_ucred, 0, 0)) { + if (suser_xxx(p->p_ucred, 0)) { bcopy((caddr_t)sp, (caddr_t)&sb, sizeof(sb)); sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; sp = &sb; @@ -685,23 +659,15 @@ statfs(p, uap) } /* + * fstatfs_args(int fd, struct statfs *buf) + * * Get filesystem statistics. */ -#ifndef _SYS_SYSPROTO_H_ -struct fstatfs_args { - int fd; - struct statfs *buf; -}; -#endif /* ARGSUSED */ int -fstatfs(p, uap) - struct proc *p; - register struct fstatfs_args /* { - syscallarg(int) fd; - syscallarg(struct statfs *) buf; - } */ *uap; +fstatfs(struct fstatfs_args *uap) { + struct proc *p = curproc; struct file *fp; struct mount *mp; register struct statfs *sp; @@ -718,7 +684,7 @@ fstatfs(p, uap) if (error) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - if (suser_xxx(p->p_ucred, 0, 0)) { + if (suser_xxx(p->p_ucred, 0)) { bcopy((caddr_t)sp, (caddr_t)&sb, sizeof(sb)); sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; sp = &sb; @@ -727,26 +693,17 @@ fstatfs(p, uap) } /* + * getfsstat_args(struct statfs *buf, long bufsize, int flags) + * * Get statistics on all filesystems. */ -#ifndef _SYS_SYSPROTO_H_ -struct getfsstat_args { - struct statfs *buf; - long bufsize; - int flags; -}; -#endif +/* ARGSUSED */ int -getfsstat(p, uap) - struct proc *p; - register struct getfsstat_args /* { - syscallarg(struct statfs *) buf; - syscallarg(long) bufsize; - syscallarg(int) flags; - } */ *uap; +getfsstat(struct getfsstat_args *uap) { - register struct mount *mp, *nmp; - register struct statfs *sp; + struct proc *p = curproc; + struct mount *mp, *nmp; + struct statfs *sp; caddr_t sfsp; long count, maxcount, error; @@ -796,22 +753,16 @@ getfsstat(p, uap) } /* + * fchdir_args(int fd) + * * Change current working directory to a given file descriptor. */ -#ifndef _SYS_SYSPROTO_H_ -struct fchdir_args { - int fd; -}; -#endif /* ARGSUSED */ int -fchdir(p, uap) - struct proc *p; - struct fchdir_args /* { - syscallarg(int) fd; - } */ *uap; +fchdir(struct fchdir_args *uap) { - register struct filedesc *fdp = p->p_fd; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; struct vnode *vp, *tdp; struct mount *mp; struct file *fp; @@ -847,22 +798,16 @@ fchdir(p, uap) } /* + * chdir_args(char *path) + * * Change current working directory (``.''). */ -#ifndef _SYS_SYSPROTO_H_ -struct chdir_args { - char *path; -}; -#endif /* ARGSUSED */ int -chdir(p, uap) - struct proc *p; - struct chdir_args /* { - syscallarg(char *) path; - } */ *uap; +chdir(struct chdir_args *uap) { - register struct filedesc *fdp = p->p_fd; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; int error; struct nameidata nd; @@ -915,26 +860,20 @@ SYSCTL_INT(_kern, OID_AUTO, chroot_allow_open_directories, CTLFLAG_RW, &chroot_allow_open_directories, 0, ""); /* + * chroot_args(char *path) + * * Change notion of root (``/'') directory. */ -#ifndef _SYS_SYSPROTO_H_ -struct chroot_args { - char *path; -}; -#endif /* ARGSUSED */ int -chroot(p, uap) - struct proc *p; - struct chroot_args /* { - syscallarg(char *) path; - } */ *uap; +chroot(struct chroot_args *uap) { - register struct filedesc *fdp = p->p_fd; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; int error; struct nameidata nd; - error = suser_xxx(0, p, PRISON_ROOT); + error = suser_xxx(0, PRISON_ROOT); if (error) return (error); if (chroot_allow_open_directories == 0 || @@ -960,9 +899,7 @@ chroot(p, uap) * Common routine for chroot and chdir. */ static int -change_dir(ndp, p) - register struct nameidata *ndp; - struct proc *p; +change_dir(struct nameidata *ndp, struct proc *p) { struct vnode *vp; int error; @@ -983,28 +920,18 @@ change_dir(ndp, p) } /* + * open_args(char *path, int flags, int mode) + * * Check permissions, allocate an open file structure, * and call the device open routine if any. */ -#ifndef _SYS_SYSPROTO_H_ -struct open_args { - char *path; - int flags; - int mode; -}; -#endif int -open(p, uap) - struct proc *p; - register struct open_args /* { - syscallarg(char *) path; - syscallarg(int) flags; - syscallarg(int) mode; - } */ *uap; +open(struct open_args *uap) { - register struct filedesc *fdp = p->p_fd; - register struct file *fp; - register struct vnode *vp; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; + struct file *fp; + struct vnode *vp; int cmode, flags, oflags; struct file *nfp; int type, indx, error; @@ -1042,7 +969,7 @@ open(p, uap) if ((error == ENODEV || error == ENXIO) && p->p_dupfd >= 0 && /* XXX from fdopen */ (error = - dupfdopen(p, fdp, indx, p->p_dupfd, flags, error)) == 0) { + dupfdopen(fdp, indx, p->p_dupfd, flags, error)) == 0) { p->p_retval[0] = indx; return (0); } @@ -1130,21 +1057,12 @@ open(p, uap) #ifdef COMPAT_43 /* + * ocreat(char *path, int mode) + * * Create a file. */ -#ifndef _SYS_SYSPROTO_H_ -struct ocreat_args { - char *path; - int mode; -}; -#endif int -ocreat(p, uap) - struct proc *p; - register struct ocreat_args /* { - syscallarg(char *) path; - syscallarg(int) mode; - } */ *uap; +ocreat(struct ocreat_args *uap) { struct open_args /* { syscallarg(char *) path; @@ -1155,31 +1073,21 @@ ocreat(p, uap) SCARG(&nuap, path) = SCARG(uap, path); SCARG(&nuap, mode) = SCARG(uap, mode); SCARG(&nuap, flags) = O_WRONLY | O_CREAT | O_TRUNC; - return (open(p, &nuap)); + return (open(&nuap)); } #endif /* COMPAT_43 */ /* + * mknod_args(char *path, int mode, int dev) + * * Create a special file. */ -#ifndef _SYS_SYSPROTO_H_ -struct mknod_args { - char *path; - int mode; - int dev; -}; -#endif /* ARGSUSED */ int -mknod(p, uap) - struct proc *p; - register struct mknod_args /* { - syscallarg(char *) path; - syscallarg(int) mode; - syscallarg(int) dev; - } */ *uap; +mknod(struct mknod_args *uap) { - register struct vnode *vp; + struct proc *p = curproc; + struct vnode *vp; struct vattr vattr; int error; int whiteout = 0; @@ -1188,10 +1096,10 @@ mknod(p, uap) switch (SCARG(uap, mode) & S_IFMT) { case S_IFCHR: case S_IFBLK: - error = suser(p); + error = suser(); break; default: - error = suser_xxx(0, p, PRISON_ROOT); + error = suser_xxx(0, PRISON_ROOT); break; } if (error) @@ -1254,23 +1162,15 @@ mknod(p, uap) } /* + * mkfifo_args(char *path, int mode) + * * Create a named pipe. */ -#ifndef _SYS_SYSPROTO_H_ -struct mkfifo_args { - char *path; - int mode; -}; -#endif /* ARGSUSED */ int -mkfifo(p, uap) - struct proc *p; - register struct mkfifo_args /* { - syscallarg(char *) path; - syscallarg(int) mode; - } */ *uap; +mkfifo(struct mkfifo_args *uap) { + struct proc *p = curproc; struct vattr vattr; int error; struct nameidata nd; @@ -1301,24 +1201,16 @@ mkfifo(p, uap) } /* + * link_args(char *path, char *link) + * * Make a hard file link. */ -#ifndef _SYS_SYSPROTO_H_ -struct link_args { - char *path; - char *link; -}; -#endif /* ARGSUSED */ int -link(p, uap) - struct proc *p; - register struct link_args /* { - syscallarg(char *) path; - syscallarg(char *) link; - } */ *uap; +link(struct link_args *uap) { - register struct vnode *vp; + struct proc *p = curproc; + struct vnode *vp; struct nameidata nd; int error; @@ -1358,23 +1250,15 @@ link(p, uap) } /* + * symlink(char *path, char *link) + * * Make a symbolic link. */ -#ifndef _SYS_SYSPROTO_H_ -struct symlink_args { - char *path; - char *link; -}; -#endif /* ARGSUSED */ int -symlink(p, uap) - struct proc *p; - register struct symlink_args /* { - syscallarg(char *) path; - syscallarg(char *) link; - } */ *uap; +symlink(struct symlink_args *uap) { + struct proc *p = curproc; struct vattr vattr; char *path; int error; @@ -1413,16 +1297,15 @@ out: } /* + * undelete_args(char *path) + * * Delete a whiteout from the filesystem. */ /* ARGSUSED */ int -undelete(p, uap) - struct proc *p; - register struct undelete_args /* { - syscallarg(char *) path; - } */ *uap; +undelete(struct undelete_args *uap) { + struct proc *p = curproc; int error; struct nameidata nd; @@ -1454,22 +1337,15 @@ undelete(p, uap) } /* + * unlink_args(char *path) + * * Delete a name from the filesystem. */ -#ifndef _SYS_SYSPROTO_H_ -struct unlink_args { - char *path; -}; -#endif -/* ARGSUSED */ int -unlink(p, uap) - struct proc *p; - struct unlink_args /* { - syscallarg(char *) path; - } */ *uap; +unlink(struct unlink_args *uap) { - register struct vnode *vp; + struct proc *p = curproc; + struct vnode *vp; int error; struct nameidata nd; @@ -1510,29 +1386,17 @@ unlink(p, uap) } /* + * lseek_args(int fd, int pad, off_t offset, int whence) + * * Reposition read/write file offset. */ -#ifndef _SYS_SYSPROTO_H_ -struct lseek_args { - int fd; - int pad; - off_t offset; - int whence; -}; -#endif int -lseek(p, uap) - struct proc *p; - register struct lseek_args /* { - syscallarg(int) fd; - syscallarg(int) pad; - syscallarg(off_t) offset; - syscallarg(int) whence; - } */ *uap; +lseek(struct lseek_args *uap) { + struct proc *p = curproc; struct ucred *cred = p->p_ucred; - register struct filedesc *fdp = p->p_fd; - register struct file *fp; + struct filedesc *fdp = p->p_fd; + struct file *fp; struct vattr vattr; int error; @@ -1564,22 +1428,11 @@ lseek(p, uap) #if defined(COMPAT_43) || defined(COMPAT_SUNOS) /* * Reposition read/write file offset. + * + * olseek_args(int fd, long offset, int whence) */ -#ifndef _SYS_SYSPROTO_H_ -struct olseek_args { - int fd; - long offset; - int whence; -}; -#endif int -olseek(p, uap) - struct proc *p; - register struct olseek_args /* { - syscallarg(int) fd; - syscallarg(long) offset; - syscallarg(int) whence; - } */ *uap; +olseek(struct olseek_args *uap) { struct lseek_args /* { syscallarg(int) fd; @@ -1592,30 +1445,22 @@ olseek(p, uap) SCARG(&nuap, fd) = SCARG(uap, fd); SCARG(&nuap, offset) = SCARG(uap, offset); SCARG(&nuap, whence) = SCARG(uap, whence); - error = lseek(p, &nuap); + error = lseek(&nuap); return (error); } #endif /* COMPAT_43 */ /* + * access_args(char *path, int flags) + * * Check access permissions. */ -#ifndef _SYS_SYSPROTO_H_ -struct access_args { - char *path; - int flags; -}; -#endif int -access(p, uap) - struct proc *p; - register struct access_args /* { - syscallarg(char *) path; - syscallarg(int) flags; - } */ *uap; +access(struct access_args *uap) { + struct proc *p = curproc; struct ucred *cred, *tmpcred; - register struct vnode *vp; + struct vnode *vp; int error, flags; struct nameidata nd; @@ -1626,8 +1471,8 @@ access(p, uap) * buffer accounting which can run in an interrupt context. */ tmpcred = crdup(cred); - tmpcred->cr_uid = p->p_cred->p_ruid; - tmpcred->cr_groups[0] = p->p_cred->p_rgid; + tmpcred->cr_uid = p->p_ucred->cr_ruid; + tmpcred->cr_groups[0] = p->p_ucred->cr_rgid; p->p_ucred = tmpcred; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, SCARG(uap, path), p); @@ -1657,23 +1502,15 @@ out1: #if defined(COMPAT_43) || defined(COMPAT_SUNOS) /* + * ostat_args(char *path, struct ostat *ub) + * * Get file status; this version follows links. */ -#ifndef _SYS_SYSPROTO_H_ -struct ostat_args { - char *path; - struct ostat *ub; -}; -#endif /* ARGSUSED */ int -ostat(p, uap) - struct proc *p; - register struct ostat_args /* { - syscallarg(char *) path; - syscallarg(struct ostat *) ub; - } */ *uap; +ostat(struct ostat_args *uap) { + struct proc *p = curproc; struct stat sb; struct ostat osb; int error; @@ -1694,23 +1531,15 @@ ostat(p, uap) } /* + * olstat_args(char *path, struct ostat *ub) + * * Get file status; this version does not follow links. */ -#ifndef _SYS_SYSPROTO_H_ -struct olstat_args { - char *path; - struct ostat *ub; -}; -#endif /* ARGSUSED */ int -olstat(p, uap) - struct proc *p; - register struct olstat_args /* { - syscallarg(char *) path; - syscallarg(struct ostat *) ub; - } */ *uap; +olstat(struct olstat_args *uap) { + struct proc *p = curproc; struct vnode *vp; struct stat sb; struct ostat osb; @@ -1740,7 +1569,6 @@ cvtstat(st, ost) struct stat *st; struct ostat *ost; { - ost->st_dev = st->st_dev; ost->st_ino = st->st_ino; ost->st_mode = st->st_mode; @@ -1763,23 +1591,15 @@ cvtstat(st, ost) #endif /* COMPAT_43 || COMPAT_SUNOS */ /* + * stat_args(char *path, struct stat *ub) + * * Get file status; this version follows links. */ -#ifndef _SYS_SYSPROTO_H_ -struct stat_args { - char *path; - struct stat *ub; -}; -#endif /* ARGSUSED */ int -stat(p, uap) - struct proc *p; - register struct stat_args /* { - syscallarg(char *) path; - syscallarg(struct stat *) ub; - } */ *uap; +stat(struct stat_args *uap) { + struct proc *p = curproc; struct stat sb; int error; struct nameidata nd; @@ -1798,23 +1618,15 @@ stat(p, uap) } /* + * lstat_args(char *path, struct stat *ub) + * * Get file status; this version does not follow links. */ -#ifndef _SYS_SYSPROTO_H_ -struct lstat_args { - char *path; - struct stat *ub; -}; -#endif /* ARGSUSED */ int -lstat(p, uap) - struct proc *p; - register struct lstat_args /* { - syscallarg(char *) path; - syscallarg(struct stat *) ub; - } */ *uap; +lstat(struct lstat_args *uap) { + struct proc *p = curproc; int error; struct vnode *vp; struct stat sb; @@ -1858,21 +1670,14 @@ cvtnstat(sb, nsb) nsb->st_qspare[1] = sb->st_qspare[1]; } -#ifndef _SYS_SYSPROTO_H_ -struct nstat_args { - char *path; - struct nstat *ub; -}; -#endif +/* + * nstat_args(char *path, struct nstat *ub) + */ /* ARGSUSED */ int -nstat(p, uap) - struct proc *p; - register struct nstat_args /* { - syscallarg(char *) path; - syscallarg(struct nstat *) ub; - } */ *uap; +nstat(struct nstat_args *uap) { + struct proc *p = curproc; struct stat sb; struct nstat nsb; int error; @@ -1893,23 +1698,15 @@ nstat(p, uap) } /* + * lstat_args(char *path, struct stat *ub) + * * Get file status; this version does not follow links. */ -#ifndef _SYS_SYSPROTO_H_ -struct lstat_args { - char *path; - struct stat *ub; -}; -#endif /* ARGSUSED */ int -nlstat(p, uap) - struct proc *p; - register struct nlstat_args /* { - syscallarg(char *) path; - syscallarg(struct nstat *) ub; - } */ *uap; +nlstat(struct nlstat_args *uap) { + struct proc *p = curproc; int error; struct vnode *vp; struct stat sb; @@ -1932,23 +1729,15 @@ nlstat(p, uap) } /* + * pathconf_Args(char *path, int name) + * * Get configurable pathname variables. */ -#ifndef _SYS_SYSPROTO_H_ -struct pathconf_args { - char *path; - int name; -}; -#endif /* ARGSUSED */ int -pathconf(p, uap) - struct proc *p; - register struct pathconf_args /* { - syscallarg(char *) path; - syscallarg(int) name; - } */ *uap; +pathconf(struct pathconf_args *uap) { + struct proc *p = curproc; int error; struct nameidata nd; @@ -1963,26 +1752,16 @@ pathconf(p, uap) } /* + * readlink_args(char *path, char *buf, int count) + * * Return target name of a symbolic link. */ -#ifndef _SYS_SYSPROTO_H_ -struct readlink_args { - char *path; - char *buf; - int count; -}; -#endif /* ARGSUSED */ int -readlink(p, uap) - struct proc *p; - register struct readlink_args /* { - syscallarg(char *) path; - syscallarg(char *) buf; - syscallarg(int) count; - } */ *uap; +readlink(struct readlink_args *uap) { - register struct vnode *vp; + struct proc *p = curproc; + struct vnode *vp; struct iovec aiov; struct uio auio; int error; @@ -2014,11 +1793,9 @@ readlink(p, uap) } static int -setfflags(p, vp, flags) - struct proc *p; - struct vnode *vp; - int flags; +setfflags(struct vnode *vp, int flags) { + struct proc *p = curproc; int error; struct vattr vattr; @@ -2029,7 +1806,7 @@ setfflags(p, vp, flags) * chown can't fail when done as root. */ if ((vp->v_type == VCHR || vp->v_type == VBLK) && - ((error = suser_xxx(p->p_ucred, p, PRISON_ROOT)) != 0)) + ((error = suser_xxx(p->p_ucred, PRISON_ROOT)) != 0)) return (error); VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); @@ -2042,23 +1819,15 @@ setfflags(p, vp, flags) } /* + * chflags(char *path, int flags) + * * Change flags of a file given a path name. */ -#ifndef _SYS_SYSPROTO_H_ -struct chflags_args { - char *path; - int flags; -}; -#endif /* ARGSUSED */ int -chflags(p, uap) - struct proc *p; - register struct chflags_args /* { - syscallarg(char *) path; - syscallarg(int) flags; - } */ *uap; +chflags(struct chflags_args *uap) { + struct proc *p = curproc; int error; struct nameidata nd; @@ -2066,43 +1835,33 @@ chflags(p, uap) if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfflags(p, nd.ni_vp, SCARG(uap, flags)); + error = setfflags(nd.ni_vp, SCARG(uap, flags)); vrele(nd.ni_vp); return error; } /* + * fchflags_args(int fd, int flags) + * * Change flags of a file given a file descriptor. */ -#ifndef _SYS_SYSPROTO_H_ -struct fchflags_args { - int fd; - int flags; -}; -#endif /* ARGSUSED */ int -fchflags(p, uap) - struct proc *p; - register struct fchflags_args /* { - syscallarg(int) fd; - syscallarg(int) flags; - } */ *uap; +fchflags(struct fchflags_args *uap) { + struct proc *p = curproc; struct file *fp; int error; if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) return (error); - return setfflags(p, (struct vnode *) fp->f_data, SCARG(uap, flags)); + return setfflags((struct vnode *) fp->f_data, SCARG(uap, flags)); } static int -setfmode(p, vp, mode) - struct proc *p; - struct vnode *vp; - int mode; +setfmode(struct vnode *vp, int mode) { + struct proc *p = curproc; int error; struct vattr vattr; @@ -2116,23 +1875,15 @@ setfmode(p, vp, mode) } /* + * chmod_args(char *path, int mode) + * * Change mode of a file given path name. */ -#ifndef _SYS_SYSPROTO_H_ -struct chmod_args { - char *path; - int mode; -}; -#endif /* ARGSUSED */ int -chmod(p, uap) - struct proc *p; - register struct chmod_args /* { - syscallarg(char *) path; - syscallarg(int) mode; - } */ *uap; +chmod(struct chmod_args *uap) { + struct proc *p = curproc; int error; struct nameidata nd; @@ -2140,29 +1891,21 @@ chmod(p, uap) if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfmode(p, nd.ni_vp, SCARG(uap, mode)); + error = setfmode(nd.ni_vp, SCARG(uap, mode)); vrele(nd.ni_vp); return error; } /* + * lchmod_args(char *path, int mode) + * * Change mode of a file given path name (don't follow links.) */ -#ifndef _SYS_SYSPROTO_H_ -struct lchmod_args { - char *path; - int mode; -}; -#endif /* ARGSUSED */ int -lchmod(p, uap) - struct proc *p; - register struct lchmod_args /* { - syscallarg(char *) path; - syscallarg(int) mode; - } */ *uap; +lchmod(struct lchmod_args *uap) { + struct proc *p = curproc; int error; struct nameidata nd; @@ -2170,44 +1913,33 @@ lchmod(p, uap) if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfmode(p, nd.ni_vp, SCARG(uap, mode)); + error = setfmode(nd.ni_vp, SCARG(uap, mode)); vrele(nd.ni_vp); return error; } /* + * fchmod_args(int fd, int mode) + * * Change mode of a file given a file descriptor. */ -#ifndef _SYS_SYSPROTO_H_ -struct fchmod_args { - int fd; - int mode; -}; -#endif /* ARGSUSED */ int -fchmod(p, uap) - struct proc *p; - register struct fchmod_args /* { - syscallarg(int) fd; - syscallarg(int) mode; - } */ *uap; +fchmod(struct fchmod_args *uap) { + struct proc *p = curproc; struct file *fp; int error; if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) return (error); - return setfmode(p, (struct vnode *)fp->f_data, SCARG(uap, mode)); + return setfmode((struct vnode *)fp->f_data, SCARG(uap, mode)); } static int -setfown(p, vp, uid, gid) - struct proc *p; - struct vnode *vp; - uid_t uid; - gid_t gid; +setfown(struct vnode *vp, uid_t uid, gid_t gid) { + struct proc *p = curproc; int error; struct vattr vattr; @@ -2222,25 +1954,15 @@ setfown(p, vp, uid, gid) } /* + * chown(char *path, int uid, int gid) + * * Set ownership given a path name. */ -#ifndef _SYS_SYSPROTO_H_ -struct chown_args { - char *path; - int uid; - int gid; -}; -#endif /* ARGSUSED */ int -chown(p, uap) - struct proc *p; - register struct chown_args /* { - syscallarg(char *) path; - syscallarg(int) uid; - syscallarg(int) gid; - } */ *uap; +chown(struct chown_args *uap) { + struct proc *p = curproc; int error; struct nameidata nd; @@ -2248,31 +1970,21 @@ chown(p, uap) if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid)); + error = setfown(nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid)); vrele(nd.ni_vp); return (error); } /* + * lchown_args(char *path, int uid, int gid) + * * Set ownership given a path name, do not cross symlinks. */ -#ifndef _SYS_SYSPROTO_H_ -struct lchown_args { - char *path; - int uid; - int gid; -}; -#endif /* ARGSUSED */ int -lchown(p, uap) - struct proc *p; - register struct lchown_args /* { - syscallarg(char *) path; - syscallarg(int) uid; - syscallarg(int) gid; - } */ *uap; +lchown(struct lchown_args *uap) { + struct proc *p = curproc; int error; struct nameidata nd; @@ -2280,44 +1992,32 @@ lchown(p, uap) if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid)); + error = setfown(nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid)); vrele(nd.ni_vp); return (error); } /* + * fchown_args(int fd, int uid, int gid) + * * Set ownership given a file descriptor. */ -#ifndef _SYS_SYSPROTO_H_ -struct fchown_args { - int fd; - int uid; - int gid; -}; -#endif /* ARGSUSED */ int -fchown(p, uap) - struct proc *p; - register struct fchown_args /* { - syscallarg(int) fd; - syscallarg(int) uid; - syscallarg(int) gid; - } */ *uap; +fchown(struct fchown_args *uap) { + struct proc *p = curproc; struct file *fp; int error; if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) return (error); - return setfown(p, (struct vnode *)fp->f_data, + return setfown((struct vnode *)fp->f_data, SCARG(uap, uid), SCARG(uap, gid)); } static int -getutimes(usrtvp, tsp) - const struct timeval *usrtvp; - struct timespec *tsp; +getutimes(const struct timeval *usrtvp, struct timespec *tsp) { struct timeval tv[2]; int error; @@ -2336,12 +2036,9 @@ getutimes(usrtvp, tsp) } static int -setutimes(p, vp, ts, nullflag) - struct proc *p; - struct vnode *vp; - const struct timespec *ts; - int nullflag; +setutimes(struct vnode *vp, const struct timespec *ts, int nullflag) { + struct proc *p = curproc; int error; struct vattr vattr; @@ -2358,23 +2055,15 @@ setutimes(p, vp, ts, nullflag) } /* + * utimes_args(char *path, struct timeval *tptr) + * * Set the access and modification times of a file. */ -#ifndef _SYS_SYSPROTO_H_ -struct utimes_args { - char *path; - struct timeval *tptr; -}; -#endif /* ARGSUSED */ int -utimes(p, uap) - struct proc *p; - register struct utimes_args /* { - syscallarg(char *) path; - syscallarg(struct timeval *) tptr; - } */ *uap; +utimes(struct utimes_args *uap) { + struct proc *p = curproc; struct timespec ts[2]; struct timeval *usrtvp; int error; @@ -2387,29 +2076,21 @@ utimes(p, uap) if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setutimes(p, nd.ni_vp, ts, usrtvp == NULL); + error = setutimes(nd.ni_vp, ts, usrtvp == NULL); vrele(nd.ni_vp); return (error); } /* + * lutimes_args(char *path, struct timeval *tptr) + * * Set the access and modification times of a file. */ -#ifndef _SYS_SYSPROTO_H_ -struct lutimes_args { - char *path; - struct timeval *tptr; -}; -#endif /* ARGSUSED */ int -lutimes(p, uap) - struct proc *p; - register struct lutimes_args /* { - syscallarg(char *) path; - syscallarg(struct timeval *) tptr; - } */ *uap; +lutimes(struct lutimes_args *uap) { + struct proc *p = curproc; struct timespec ts[2]; struct timeval *usrtvp; int error; @@ -2422,29 +2103,21 @@ lutimes(p, uap) if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setutimes(p, nd.ni_vp, ts, usrtvp == NULL); + error = setutimes(nd.ni_vp, ts, usrtvp == NULL); vrele(nd.ni_vp); return (error); } /* + * futimes_args(int fd, struct timeval *tptr) + * * Set the access and modification times of a file. */ -#ifndef _SYS_SYSPROTO_H_ -struct futimes_args { - int fd; - struct timeval *tptr; -}; -#endif /* ARGSUSED */ int -futimes(p, uap) - struct proc *p; - register struct futimes_args /* { - syscallarg(int ) fd; - syscallarg(struct timeval *) tptr; - } */ *uap; +futimes(struct futimes_args *uap) { + struct proc *p = curproc; struct timespec ts[2]; struct file *fp; struct timeval *usrtvp; @@ -2455,30 +2128,20 @@ futimes(p, uap) return (error); if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) return (error); - return setutimes(p, (struct vnode *)fp->f_data, ts, usrtvp == NULL); + return setutimes((struct vnode *)fp->f_data, ts, usrtvp == NULL); } /* + * truncate(char *path, int pad, off_t length) + * * Truncate a file given its path name. */ -#ifndef _SYS_SYSPROTO_H_ -struct truncate_args { - char *path; - int pad; - off_t length; -}; -#endif /* ARGSUSED */ int -truncate(p, uap) - struct proc *p; - register struct truncate_args /* { - syscallarg(char *) path; - syscallarg(int) pad; - syscallarg(off_t) length; - } */ *uap; +truncate(struct truncate_args *uap) { - register struct vnode *vp; + struct proc *p = curproc; + struct vnode *vp; struct vattr vattr; int error; struct nameidata nd; @@ -2505,25 +2168,15 @@ truncate(p, uap) } /* + * ftruncate_args(int fd, int pad, off_t length) + * * Truncate a file given a file descriptor. */ -#ifndef _SYS_SYSPROTO_H_ -struct ftruncate_args { - int fd; - int pad; - off_t length; -}; -#endif /* ARGSUSED */ int -ftruncate(p, uap) - struct proc *p; - register struct ftruncate_args /* { - syscallarg(int) fd; - syscallarg(int) pad; - syscallarg(off_t) length; - } */ *uap; +ftruncate(struct ftruncate_args *uap) { + struct proc *p = curproc; struct vattr vattr; struct vnode *vp; struct file *fp; @@ -2551,22 +2204,13 @@ ftruncate(p, uap) #if defined(COMPAT_43) || defined(COMPAT_SUNOS) /* + * otruncate_args(char *path, long length) + * * Truncate a file given its path name. */ -#ifndef _SYS_SYSPROTO_H_ -struct otruncate_args { - char *path; - long length; -}; -#endif /* ARGSUSED */ int -otruncate(p, uap) - struct proc *p; - register struct otruncate_args /* { - syscallarg(char *) path; - syscallarg(long) length; - } */ *uap; +otruncate(struct otruncate_args *uap) { struct truncate_args /* { syscallarg(char *) path; @@ -2576,26 +2220,17 @@ otruncate(p, uap) SCARG(&nuap, path) = SCARG(uap, path); SCARG(&nuap, length) = SCARG(uap, length); - return (truncate(p, &nuap)); + return (truncate(&nuap)); } /* + * oftruncate_args(int fd, long length) + * * Truncate a file given a file descriptor. */ -#ifndef _SYS_SYSPROTO_H_ -struct oftruncate_args { - int fd; - long length; -}; -#endif /* ARGSUSED */ int -oftruncate(p, uap) - struct proc *p; - register struct oftruncate_args /* { - syscallarg(int) fd; - syscallarg(long) length; - } */ *uap; +oftruncate(struct oftruncate_args *uap) { struct ftruncate_args /* { syscallarg(int) fd; @@ -2605,27 +2240,21 @@ oftruncate(p, uap) SCARG(&nuap, fd) = SCARG(uap, fd); SCARG(&nuap, length) = SCARG(uap, length); - return (ftruncate(p, &nuap)); + return (ftruncate(&nuap)); } #endif /* COMPAT_43 || COMPAT_SUNOS */ /* + * fsync(int fd) + * * Sync an open file. */ -#ifndef _SYS_SYSPROTO_H_ -struct fsync_args { - int fd; -}; -#endif /* ARGSUSED */ int -fsync(p, uap) - struct proc *p; - struct fsync_args /* { - syscallarg(int) fd; - } */ *uap; +fsync(struct fsync_args *uap) { - register struct vnode *vp; + struct proc *p = curproc; + struct vnode *vp; struct file *fp; vm_object_t obj; int error; @@ -2645,25 +2274,17 @@ fsync(p, uap) } /* + * rename_args(char *from, char *to) + * * Rename files. Source and destination must either both be directories, * or both not be directories. If target is a directory, it must be empty. */ -#ifndef _SYS_SYSPROTO_H_ -struct rename_args { - char *from; - char *to; -}; -#endif /* ARGSUSED */ int -rename(p, uap) - struct proc *p; - register struct rename_args /* { - syscallarg(char *) from; - syscallarg(char *) to; - } */ *uap; +rename(struct rename_args *uap) { - register struct vnode *tvp, *fvp, *tdvp; + struct proc *p = curproc; + struct vnode *tvp, *fvp, *tdvp; struct nameidata fromnd, tond; int error; @@ -2744,24 +2365,16 @@ out1: } /* + * mkdir_args(char *path, int mode) + * * Make a directory file. */ -#ifndef _SYS_SYSPROTO_H_ -struct mkdir_args { - char *path; - int mode; -}; -#endif /* ARGSUSED */ int -mkdir(p, uap) - struct proc *p; - register struct mkdir_args /* { - syscallarg(char *) path; - syscallarg(int) mode; - } */ *uap; +mkdir(struct mkdir_args *uap) { - register struct vnode *vp; + struct proc *p = curproc; + struct vnode *vp; struct vattr vattr; int error; struct nameidata nd; @@ -2796,22 +2409,16 @@ mkdir(p, uap) } /* + * rmdir_args(char *path) + * * Remove a directory file. */ -#ifndef _SYS_SYSPROTO_H_ -struct rmdir_args { - char *path; -}; -#endif /* ARGSUSED */ int -rmdir(p, uap) - struct proc *p; - struct rmdir_args /* { - syscallarg(char *) path; - } */ *uap; +rmdir(struct rmdir_args *uap) { - register struct vnode *vp; + struct proc *p = curproc; + struct vnode *vp; int error; struct nameidata nd; @@ -2857,26 +2464,14 @@ out: #ifdef COMPAT_43 /* + * ogetdirentries_args(int fd, char *buf, u_int count, long *basep) + * * Read a block of directory entries in a file system independent format. */ -#ifndef _SYS_SYSPROTO_H_ -struct ogetdirentries_args { - int fd; - char *buf; - u_int count; - long *basep; -}; -#endif int -ogetdirentries(p, uap) - struct proc *p; - register struct ogetdirentries_args /* { - syscallarg(int) fd; - syscallarg(char *) buf; - syscallarg(u_int) count; - syscallarg(long *) basep; - } */ *uap; +ogetdirentries(struct ogetdirentries_args *uap) { + struct proc *p = curproc; struct vnode *vp; struct file *fp; struct uio auio, kuio; @@ -2988,26 +2583,14 @@ unionread: #endif /* COMPAT_43 */ /* + * getdirentries_args(int fd, char *buf, u_int conut, long *basep) + * * Read a block of directory entries in a file system independent format. */ -#ifndef _SYS_SYSPROTO_H_ -struct getdirentries_args { - int fd; - char *buf; - u_int count; - long *basep; -}; -#endif int -getdirentries(p, uap) - struct proc *p; - register struct getdirentries_args /* { - syscallarg(int) fd; - syscallarg(char *) buf; - syscallarg(u_int) count; - syscallarg(long *) basep; - } */ *uap; +getdirentries(struct getdirentries_args *uap) { + struct proc *p = curproc; struct vnode *vp; struct file *fp; struct uio auio; @@ -3065,48 +2648,34 @@ unionread: p->p_retval[0] = SCARG(uap, count) - auio.uio_resid; return (error); } -#ifndef _SYS_SYSPROTO_H_ -struct getdents_args { - int fd; - char *buf; - size_t count; -}; -#endif + +/* + * getdents_args(int fd, char *buf, size_t count) + */ int -getdents(p, uap) - struct proc *p; - register struct getdents_args /* { - syscallarg(int) fd; - syscallarg(char *) buf; - syscallarg(u_int) count; - } */ *uap; +getdents(struct getdents_args *uap) { struct getdirentries_args ap; + ap.fd = uap->fd; ap.buf = uap->buf; ap.count = uap->count; ap.basep = NULL; - return getdirentries(p, &ap); + return getdirentries(&ap); } /* + * umask(int newmask) + * * Set the mode mask for creation of filesystem nodes. * * MP SAFE */ -#ifndef _SYS_SYSPROTO_H_ -struct umask_args { - int newmask; -}; -#endif int -umask(p, uap) - struct proc *p; - struct umask_args /* { - syscallarg(int) newmask; - } */ *uap; +umask(struct umask_args *uap) { - register struct filedesc *fdp; + struct proc *p = curproc; + struct filedesc *fdp; fdp = p->p_fd; p->p_retval[0] = fdp->fd_cmask; @@ -3115,23 +2684,17 @@ umask(p, uap) } /* + * revoke(char *path) + * * Void all references to file by ripping underlying filesystem * away from vnode. */ -#ifndef _SYS_SYSPROTO_H_ -struct revoke_args { - char *path; -}; -#endif /* ARGSUSED */ int -revoke(p, uap) - struct proc *p; - register struct revoke_args /* { - syscallarg(char *) path; - } */ *uap; +revoke(struct revoke_args *uap) { - register struct vnode *vp; + struct proc *p = curproc; + struct vnode *vp; struct vattr vattr; int error; struct nameidata nd; @@ -3148,7 +2711,7 @@ revoke(p, uap) if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) != 0) goto out; if (p->p_ucred->cr_uid != vattr.va_uid && - (error = suser_xxx(0, p, PRISON_ROOT))) + (error = suser_xxx(0, PRISON_ROOT))) goto out; if (vcount(vp) > 1) VOP_REVOKE(vp, REVOKEALL); @@ -3161,10 +2724,7 @@ out: * Convert a user file descriptor to a kernel file entry. */ int -getvnode(fdp, fd, fpp) - struct filedesc *fdp; - int fd; - struct file **fpp; +getvnode(struct filedesc *fdp, int fd, struct file **fpp) { struct file *fp; @@ -3177,28 +2737,23 @@ getvnode(fdp, fd, fpp) return (0); } /* + * getfh_args(char *fname, fhandle_t *fhp) + * * Get (NFS) file handle */ -#ifndef _SYS_SYSPROTO_H_ -struct getfh_args { - char *fname; - fhandle_t *fhp; -}; -#endif int -getfh(p, uap) - struct proc *p; - register struct getfh_args *uap; +getfh(struct getfh_args *uap) { + struct proc *p = curproc; struct nameidata nd; fhandle_t fh; - register struct vnode *vp; + struct vnode *vp; int error; /* * Must be super user */ - error = suser(p); + error = suser(); if (error) return (error); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->fname, p); @@ -3218,26 +2773,18 @@ getfh(p, uap) } /* + * fhopen_args(const struct fhandle *u_fhp, int flags) + * * syscall for the rpc.lockd to use to translate a NFS file handle into * an open descriptor. * * warning: do not remove the suser() call or this becomes one giant * security hole. */ -#ifndef _SYS_SYSPROTO_H_ -struct fhopen_args { - const struct fhandle *u_fhp; - int flags; -}; -#endif int -fhopen(p, uap) - struct proc *p; - struct fhopen_args /* { - syscallarg(const struct fhandle *) u_fhp; - syscallarg(int) flags; - } */ *uap; +fhopen(struct fhopen_args *uap) { + struct proc *p = curproc; struct mount *mp; struct vnode *vp; struct fhandle fhp; @@ -3245,7 +2792,7 @@ fhopen(p, uap) struct vattr *vap = &vat; struct flock lf; struct file *fp; - register struct filedesc *fdp = p->p_fd; + struct filedesc *fdp = p->p_fd; int fmode, mode, error, type; struct file *nfp; int indx; @@ -3253,7 +2800,7 @@ fhopen(p, uap) /* * Must be super user */ - error = suser(p); + error = suser(); if (error) return (error); @@ -3396,20 +2943,13 @@ bad: return (error); } -#ifndef _SYS_SYSPROTO_H_ -struct fhstat_args { - struct fhandle *u_fhp; - struct stat *sb; -}; -#endif +/* + * fhstat_args(struct fhandle *u_fhp, struct stat *sb) + */ int -fhstat(p, uap) - struct proc *p; - register struct fhstat_args /* { - syscallarg(struct fhandle *) u_fhp; - syscallarg(struct stat *) sb; - } */ *uap; +fhstat(struct fhstat_args *uap) { + struct proc *p = curproc; struct stat sb; fhandle_t fh; struct mount *mp; @@ -3419,7 +2959,7 @@ fhstat(p, uap) /* * Must be super user */ - error = suser(p); + error = suser(); if (error) return (error); @@ -3439,20 +2979,13 @@ fhstat(p, uap) return (error); } -#ifndef _SYS_SYSPROTO_H_ -struct fhstatfs_args { - struct fhandle *u_fhp; - struct statfs *buf; -}; -#endif +/* + * fhstatfs_args(struct fhandle *u_fhp, struct statfs *buf) + */ int -fhstatfs(p, uap) - struct proc *p; - struct fhstatfs_args /* { - syscallarg(struct fhandle) *u_fhp; - syscallarg(struct statfs) *buf; - } */ *uap; +fhstatfs(struct fhstatfs_args *uap) { + struct proc *p = curproc; struct statfs *sp; struct mount *mp; struct vnode *vp; @@ -3463,7 +2996,7 @@ fhstatfs(p, uap) /* * Must be super user */ - if ((error = suser(p))) + if ((error = suser())) return (error); if ((error = copyin(SCARG(uap, u_fhp), &fh, sizeof(fhandle_t))) != 0) @@ -3479,7 +3012,7 @@ fhstatfs(p, uap) if ((error = VFS_STATFS(mp, sp, p)) != 0) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - if (suser_xxx(p->p_ucred, 0, 0)) { + if (suser_xxx(p->p_ucred, 0)) { bcopy((caddr_t)sp, (caddr_t)&sb, sizeof(sb)); sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; sp = &sb; @@ -3499,10 +3032,9 @@ fhstatfs(p, uap) * Currently this is used only by UFS Extended Attributes. */ int -extattrctl(p, uap) - struct proc *p; - struct extattrctl_args *uap; +extattrctl(struct extattrctl_args *uap) { + struct proc *p = curproc; struct nameidata nd; struct mount *mp; int error; @@ -3523,10 +3055,9 @@ extattrctl(p, uap) * in VOP_SETEXTATTR(). */ int -extattr_set_file(p, uap) - struct proc *p; - struct extattr_set_file_args *uap; +extattr_set_file(struct extattr_set_file_args *uap) { + struct proc *p = curproc; struct nameidata nd; struct uio auio; struct iovec *iov, *needfree = NULL, aiov[UIO_SMALLIOV]; @@ -3569,8 +3100,7 @@ extattr_set_file(p, uap) iov++; } cnt = auio.uio_resid; - error = VOP_SETEXTATTR(nd.ni_vp, attrname, &auio, p->p_cred->pc_ucred, - p); + error = VOP_SETEXTATTR(nd.ni_vp, attrname, &auio, p->p_ucred, p); cnt -= auio.uio_resid; p->p_retval[0] = cnt; done: @@ -3587,10 +3117,9 @@ done: * happens in VOP_GETEXTATTR(); */ int -extattr_get_file(p, uap) - struct proc *p; - struct extattr_get_file_args *uap; +extattr_get_file(struct extattr_get_file_args *uap) { + struct proc *p = curproc; struct nameidata nd; struct uio auio; struct iovec *iov, *needfree, aiov[UIO_SMALLIOV]; @@ -3635,8 +3164,7 @@ extattr_get_file(p, uap) iov++; } cnt = auio.uio_resid; - error = VOP_GETEXTATTR(nd.ni_vp, attrname, &auio, p->p_cred->pc_ucred, - p); + error = VOP_GETEXTATTR(nd.ni_vp, attrname, &auio, p->p_ucred, p); cnt -= auio.uio_resid; p->p_retval[0] = cnt; done: @@ -3651,10 +3179,9 @@ done: * Accepts attribute name. The real work happens in VOP_SETEXTATTR(). */ int -extattr_delete_file(p, uap) - struct proc *p; - struct extattr_delete_file_args *uap; +extattr_delete_file(struct extattr_delete_file_args *uap) { + struct proc *p = curproc; struct nameidata nd; char attrname[EXTATTR_MAXNAMELEN]; int error; @@ -3666,8 +3193,7 @@ extattr_delete_file(p, uap) SCARG(uap, path), p); if ((error = namei(&nd)) != 0) return(error); - error = VOP_SETEXTATTR(nd.ni_vp, attrname, NULL, p->p_cred->pc_ucred, - p); + error = VOP_SETEXTATTR(nd.ni_vp, attrname, NULL, p->p_ucred, p); NDFREE(&nd, 0); return(error); } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index cdbe8c0ab5..55a19f1a1a 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -37,7 +37,7 @@ * * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/vfs_vnops.c,v 1.87.2.13 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_vnops.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/kern/vfs_vnops.c,v 1.3 2003/06/23 17:55:42 dillon Exp $ */ #include @@ -545,7 +545,7 @@ vn_stat(vp, sb, p) } sb->st_flags = vap->va_flags; - if (suser_xxx(p->p_ucred, 0, 0)) + if (suser_xxx(p->p_ucred, 0)) sb->st_gen = 0; else sb->st_gen = vap->va_gen; diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 0d4cef08c8..447e5d996d 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -38,7 +38,7 @@ * @(#)bpf.c 8.2 (Berkeley) 3/28/94 * * $FreeBSD: src/sys/net/bpf.c,v 1.59.2.12 2002/04/14 21:41:48 luigi Exp $ - * $DragonFly: src/sys/net/bpf.c,v 1.2 2003/06/17 04:28:47 dillon Exp $ + * $DragonFly: src/sys/net/bpf.c,v 1.3 2003/06/23 17:55:45 dillon Exp $ */ #include "bpf.h" @@ -341,15 +341,14 @@ bpf_detachd(d) */ /* ARGSUSED */ static int -bpfopen(dev, flags, fmt, p) - dev_t dev; - int flags; - int fmt; - struct proc *p; +bpfopen(dev_t dev, int flags, int fmt, struct thread *td) { - register struct bpf_d *d; + struct bpf_d *d; + struct proc *p = td->td_proc; + + KKASSERT(p != NULL); - if (p->p_prison) + if (p->p_ucred->cr_prison) return (EPERM); d = dev->si_drv1; @@ -375,14 +374,14 @@ bpfopen(dev, flags, fmt, p) */ /* ARGSUSED */ static int -bpfclose(dev, flags, fmt, p) +bpfclose(dev, flags, fmt, td) dev_t dev; int flags; int fmt; - struct proc *p; + struct thread *td; { - register struct bpf_d *d = dev->si_drv1; - register int s; + struct bpf_d *d = dev->si_drv1; + int s; funsetown(d->bd_sigio); s = splimp(); @@ -685,14 +684,9 @@ reset_d(d) */ /* ARGSUSED */ static int -bpfioctl(dev, cmd, addr, flags, p) - dev_t dev; - u_long cmd; - caddr_t addr; - int flags; - struct proc *p; +bpfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { - register struct bpf_d *d = dev->si_drv1; + struct bpf_d *d = dev->si_drv1; int s, error = 0; s = splimp(); @@ -1073,10 +1067,7 @@ bpf_setif(d, ifr) * Otherwise, return false but make a note that a selwakeup() must be done. */ int -bpfpoll(dev, events, p) - register dev_t dev; - int events; - struct proc *p; +bpfpoll(dev_t dev, int events, struct thread *td) { register struct bpf_d *d; register int s; @@ -1100,7 +1091,7 @@ bpfpoll(dev, events, p) d->bd_slen != 0)) revents |= events & (POLLIN | POLLRDNORM); else { - selrecord(p, &d->bd_sel); + selrecord(td, &d->bd_sel); /* Start the read timeout if necessary. */ if (d->bd_rtout > 0 && d->bd_state == BPF_IDLE) { callout_reset(&d->bd_callout, d->bd_rtout, diff --git a/sys/net/gre/if_gre.c b/sys/net/gre/if_gre.c index 062023cc60..7fd559af15 100644 --- a/sys/net/gre/if_gre.c +++ b/sys/net/gre/if_gre.c @@ -1,6 +1,6 @@ /* $NetBSD: if_gre.c,v 1.42 2002/08/14 00:23:27 itojun Exp $ */ /* $FreeBSD: src/sys/net/if_gre.c,v 1.9.2.3 2003/01/23 21:06:44 sam Exp $ */ -/* $DragonFly: src/sys/net/gre/if_gre.c,v 1.2 2003/06/17 04:28:48 dillon Exp $ */ +/* $DragonFly: src/sys/net/gre/if_gre.c,v 1.3 2003/06/23 17:55:45 dillon Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -433,6 +433,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct sockaddr *sa = NULL; int error; struct sockaddr_in sp, sm, dp, dm; + struct proc *p = curproc; error = 0; @@ -444,7 +445,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFDSTADDR: break; case SIOCSIFFLAGS: - if ((error = suser(curproc)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; if ((ifr->ifr_flags & IFF_LINK0) != 0) sc->g_proto = IPPROTO_GRE; @@ -452,7 +453,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) sc->g_proto = IPPROTO_MOBILE; goto recompute; case SIOCSIFMTU: - if ((error = suser(curproc)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; if (ifr->ifr_mtu < 576) { error = EINVAL; @@ -465,7 +466,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCADDMULTI: case SIOCDELMULTI: - if ((error = suser(curproc)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; if (ifr == 0) { error = EAFNOSUPPORT; @@ -482,7 +483,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; case GRESPROTO: - if ((error = suser(curproc)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; sc->g_proto = ifr->ifr_flags; switch (sc->g_proto) { @@ -502,7 +503,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case GRESADDRS: case GRESADDRD: - if ((error = suser(curproc)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; /* * set tunnel endpoints, compute a less specific route @@ -568,7 +569,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) ifr->ifr_addr = *sa; break; case SIOCSIFPHYADDR: - if ((error = suser(curproc)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; if (aifr->ifra_addr.sin_family != AF_INET || aifr->ifra_dstaddr.sin_family != AF_INET) { @@ -584,7 +585,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) sc->g_dst = aifr->ifra_dstaddr.sin_addr; goto recompute; case SIOCSLIFPHYADDR: - if ((error = suser(curproc)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; if (lifr->addr.ss_family != AF_INET || lifr->dstaddr.ss_family != AF_INET) { @@ -601,7 +602,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) (satosin((struct sockadrr *)&lifr->dstaddr))->sin_addr; goto recompute; case SIOCDIFPHYADDR: - if ((error = suser(curproc)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; sc->g_src.s_addr = INADDR_ANY; sc->g_dst.s_addr = INADDR_ANY; diff --git a/sys/net/if.c b/sys/net/if.c index 0d8c1ea72d..1605fa9c57 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -32,7 +32,7 @@ * * @(#)if.c 8.3 (Berkeley) 1/4/94 * $FreeBSD: src/sys/net/if.c,v 1.85.2.23 2003/04/15 18:11:19 fjoe Exp $ - * $DragonFly: src/sys/net/if.c,v 1.2 2003/06/17 04:28:47 dillon Exp $ + * $DragonFly: src/sys/net/if.c,v 1.3 2003/06/23 17:55:45 dillon Exp $ */ #include "opt_compat.h" @@ -941,14 +941,10 @@ if_withname(sa) * Interface ioctls. */ int -ifioctl(so, cmd, data, p) - struct socket *so; - u_long cmd; - caddr_t data; - struct proc *p; +ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p) { - register struct ifnet *ifp; - register struct ifreq *ifr; + struct ifnet *ifp; + struct ifreq *ifr; struct ifstat *ifs; int error; short oif_flags; @@ -965,7 +961,7 @@ ifioctl(so, cmd, data, p) switch (cmd) { case SIOCIFCREATE: case SIOCIFDESTROY: - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); return ((cmd == SIOCIFCREATE) ? if_clone_create(ifr->ifr_name, sizeof(ifr->ifr_name)) : @@ -1003,7 +999,7 @@ ifioctl(so, cmd, data, p) break; case SIOCSIFFLAGS: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) return (error); new_flags = (ifr->ifr_flags & 0xffff) | @@ -1037,7 +1033,7 @@ ifioctl(so, cmd, data, p) break; case SIOCSIFCAP: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) return (error); if (ifr->ifr_reqcap & ~ifp->if_capabilities) @@ -1046,7 +1042,7 @@ ifioctl(so, cmd, data, p) break; case SIOCSIFMETRIC: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) return (error); ifp->if_metric = ifr->ifr_metric; @@ -1054,7 +1050,7 @@ ifioctl(so, cmd, data, p) break; case SIOCSIFPHYS: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) return error; if (!ifp->if_ioctl) @@ -1068,7 +1064,7 @@ ifioctl(so, cmd, data, p) { u_long oldmtu = ifp->if_mtu; - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) return (error); if (ifp->if_ioctl == NULL) @@ -1093,7 +1089,7 @@ ifioctl(so, cmd, data, p) case SIOCADDMULTI: case SIOCDELMULTI: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) return (error); @@ -1123,7 +1119,7 @@ ifioctl(so, cmd, data, p) case SIOCSLIFPHYADDR: case SIOCSIFMEDIA: case SIOCSIFGENERIC: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) return (error); if (ifp->if_ioctl == 0) @@ -1147,7 +1143,7 @@ ifioctl(so, cmd, data, p) return ((*ifp->if_ioctl)(ifp, cmd, data)); case SIOCSIFLLADDR: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) return (error); return if_setlladdr(ifp, @@ -1288,13 +1284,11 @@ ifpromisc(ifp, pswitch) */ /*ARGSUSED*/ static int -ifconf(cmd, data) - u_long cmd; - caddr_t data; +ifconf(u_long cmd, caddr_t data) { - register struct ifconf *ifc = (struct ifconf *)data; - register struct ifnet *ifp; - register struct ifaddr *ifa; + struct ifconf *ifc = (struct ifconf *)data; + struct ifnet *ifp; + struct ifaddr *ifa; struct sockaddr *sa; struct ifreq ifr, *ifrp; int space = ifc->ifc_len, error = 0; @@ -1321,7 +1315,7 @@ ifconf(cmd, data) if (space <= sizeof(ifr)) break; sa = ifa->ifa_addr; - if (curproc->p_prison && prison_if(curproc, sa)) + if (curproc->p_ucred->cr_prison && prison_if(curproc, sa)) continue; addrs++; #ifdef COMPAT_43 diff --git a/sys/net/ppp/if_ppp.c b/sys/net/ppp/if_ppp.c index 3be97d576b..d0472e3769 100644 --- a/sys/net/ppp/if_ppp.c +++ b/sys/net/ppp/if_ppp.c @@ -70,7 +70,7 @@ */ /* $FreeBSD: src/sys/net/if_ppp.c,v 1.67.2.4 2002/04/14 21:41:48 luigi Exp $ */ -/* $DragonFly: src/sys/net/ppp/if_ppp.c,v 1.2 2003/06/17 04:28:48 dillon Exp $ */ +/* $DragonFly: src/sys/net/ppp/if_ppp.c,v 1.3 2003/06/23 17:55:45 dillon Exp $ */ /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */ /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */ @@ -368,7 +368,7 @@ pppioctl(sc, cmd, data, flag, p) break; case PPPIOCSFLAGS: - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); flags = *(int *)data & SC_MASK; s = splsoftnet(); @@ -382,7 +382,7 @@ pppioctl(sc, cmd, data, flag, p) break; case PPPIOCSMRU: - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); mru = *(int *)data; if (mru >= PPP_MRU && mru <= PPP_MAXMRU) @@ -395,7 +395,7 @@ pppioctl(sc, cmd, data, flag, p) #ifdef VJC case PPPIOCSMAXCID: - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); if (sc->sc_comp) { s = splsoftnet(); @@ -406,14 +406,14 @@ pppioctl(sc, cmd, data, flag, p) #endif case PPPIOCXFERUNIT: - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); sc->sc_xfer = p->p_pid; break; #ifdef PPP_COMPRESS case PPPIOCSCOMPRESS: - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); odp = (struct ppp_option_data *) data; nb = odp->length; @@ -483,7 +483,7 @@ pppioctl(sc, cmd, data, flag, p) if (cmd == PPPIOCGNPMODE) { npi->mode = sc->sc_npmode[npx]; } else { - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); if (npi->mode != sc->sc_npmode[npx]) { s = splsoftnet(); @@ -604,7 +604,7 @@ pppsioctl(ifp, cmd, data) break; case SIOCSIFMTU: - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; if (ifr->ifr_mtu > PPP_MAXMTU) error = EINVAL; diff --git a/sys/net/ppp_layer/ppp_tty.c b/sys/net/ppp_layer/ppp_tty.c index 80fed4e8ea..aef2054581 100644 --- a/sys/net/ppp_layer/ppp_tty.c +++ b/sys/net/ppp_layer/ppp_tty.c @@ -71,7 +71,7 @@ */ /* $FreeBSD: src/sys/net/ppp_tty.c,v 1.43.2.1 2002/02/13 00:43:11 dillon Exp $ */ -/* $DragonFly: src/sys/net/ppp_layer/ppp_tty.c,v 1.2 2003/06/17 04:28:48 dillon Exp $ */ +/* $DragonFly: src/sys/net/ppp_layer/ppp_tty.c,v 1.3 2003/06/23 17:55:45 dillon Exp $ */ #include "opt_ppp.h" /* XXX for ppp_defs.h */ @@ -103,8 +103,8 @@ static int pppopen __P((dev_t dev, struct tty *tp)); static int pppclose __P((struct tty *tp, int flag)); static int pppread __P((struct tty *tp, struct uio *uio, int flag)); static int pppwrite __P((struct tty *tp, struct uio *uio, int flag)); -static int ppptioctl __P((struct tty *tp, u_long cmd, caddr_t data, int flag, - struct proc *)); +static int ppptioctl __P((struct tty *tp, u_long cmd, caddr_t data, + int flag, struct thread *)); static int pppinput __P((int c, struct tty *tp)); static int pppstart __P((struct tty *tp)); @@ -193,15 +193,13 @@ pppasyncattach(dummy) */ /* ARGSUSED */ static int -pppopen(dev, tp) - dev_t dev; - register struct tty *tp; +pppopen(dev_t dev, struct tty *tp) { struct proc *p = curproc; /* XXX */ - register struct ppp_softc *sc; + struct ppp_softc *sc; int error, s; - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); s = spltty(); @@ -454,23 +452,21 @@ pppwrite(tp, uio, flag) */ /* ARGSUSED */ static int -ppptioctl(tp, cmd, data, flag, p) - struct tty *tp; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +ppptioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct thread *td) { struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc; + struct proc *p = td->td_proc; int error, s; + KKASSERT(p != NULL); + if (sc == NULL || tp != (struct tty *) sc->sc_devp) return (ENOIOCTL); error = 0; switch (cmd) { case PPPIOCSASYNCMAP: - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; sc->sc_asyncmap[0] = *(u_int *)data; break; @@ -480,7 +476,7 @@ ppptioctl(tp, cmd, data, flag, p) break; case PPPIOCSRASYNCMAP: - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; sc->sc_rasyncmap = *(u_int *)data; break; @@ -490,7 +486,7 @@ ppptioctl(tp, cmd, data, flag, p) break; case PPPIOCSXASYNCMAP: - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) break; s = spltty(); bcopy(data, sc->sc_asyncmap, sizeof(sc->sc_asyncmap)); diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c index a670041ac8..2275d51d59 100644 --- a/sys/net/raw_usrreq.c +++ b/sys/net/raw_usrreq.c @@ -32,7 +32,7 @@ * * @(#)raw_usrreq.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/net/raw_usrreq.c,v 1.18 1999/08/28 00:48:28 peter Exp $ - * $DragonFly: src/sys/net/raw_usrreq.c,v 1.2 2003/06/17 04:28:48 dillon Exp $ + * $DragonFly: src/sys/net/raw_usrreq.c,v 1.3 2003/06/23 17:55:45 dillon Exp $ */ #include @@ -159,7 +159,7 @@ raw_uattach(struct socket *so, int proto, struct proc *p) if (rp == 0) return EINVAL; - if (p && (error = suser(p)) != 0) + if (p && (error = suser_xxx(p->p_ucred, 0)) != 0) return error; return raw_attach(so, proto); } diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 59409b41c6..5085367808 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -32,7 +32,7 @@ * * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 * $FreeBSD: src/sys/net/rtsock.c,v 1.44.2.11 2002/12/04 14:05:41 ru Exp $ - * $DragonFly: src/sys/net/rtsock.c,v 1.2 2003/06/17 04:28:48 dillon Exp $ + * $DragonFly: src/sys/net/rtsock.c,v 1.3 2003/06/23 17:55:45 dillon Exp $ */ @@ -331,7 +331,7 @@ route_output(m, so) * Verify that the caller has the appropriate privilege; RTM_GET * is the only operation the non-superuser is allowed. */ - if (rtm->rtm_type != RTM_GET && suser_xxx(so->so_cred, NULL, 0) != 0) + if (rtm->rtm_type != RTM_GET && suser_xxx(so->so_cred, 0) != 0) senderr(EPERM); switch (rtm->rtm_type) { @@ -966,7 +966,7 @@ sysctl_iflist(af, w) while ((ifa = TAILQ_NEXT(ifa, ifa_link)) != 0) { if (af && af != ifa->ifa_addr->sa_family) continue; - if (curproc->p_prison && prison_if(curproc, ifa->ifa_addr)) + if (curproc->p_ucred->cr_prison && prison_if(curproc, ifa->ifa_addr)) continue; ifaaddr = ifa->ifa_addr; netmask = ifa->ifa_netmask; diff --git a/sys/net/sl/if_sl.c b/sys/net/sl/if_sl.c index 97db622fb2..7653499d19 100644 --- a/sys/net/sl/if_sl.c +++ b/sys/net/sl/if_sl.c @@ -32,7 +32,7 @@ * * @(#)if_sl.c 8.6 (Berkeley) 2/1/94 * $FreeBSD: src/sys/net/if_sl.c,v 1.84.2.2 2002/02/13 00:43:10 dillon Exp $ - * $DragonFly: src/sys/net/sl/if_sl.c,v 1.2 2003/06/17 04:28:48 dillon Exp $ + * $DragonFly: src/sys/net/sl/if_sl.c,v 1.3 2003/06/23 17:55:45 dillon Exp $ */ /* @@ -187,7 +187,7 @@ static timeout_t sl_outfill; static int slclose __P((struct tty *,int)); static int slinput __P((int, struct tty *)); static int slioctl __P((struct ifnet *, u_long, caddr_t)); -static int sltioctl __P((struct tty *, u_long, caddr_t, int, struct proc *)); +static int sltioctl __P((struct tty *, u_long, caddr_t, int, struct thread *)); static int slopen __P((dev_t, struct tty *)); static int sloutput __P((struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *)); @@ -273,16 +273,13 @@ slinit(sc) */ /* ARGSUSED */ static int -slopen(dev, tp) - dev_t dev; - register struct tty *tp; +slopen(dev_t dev, struct tty *tp) { - struct proc *p = curproc; /* XXX */ - register struct sl_softc *sc; - register int nsl; + struct sl_softc *sc; + int nsl; int s, error; - error = suser(p); + error = suser(); /* YYY uses curproc */ if (error) return (error); @@ -373,12 +370,7 @@ slclose(tp,flag) */ /* ARGSUSED */ static int -sltioctl(tp, cmd, data, flag, p) - struct tty *tp; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +sltioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct thread *p) { struct sl_softc *sc = (struct sl_softc *)tp->t_sc, *nc, *tmpnc; int s, nsl; diff --git a/sys/net/tap/if_tap.c b/sys/net/tap/if_tap.c index 3ebc149c1f..e63a63d875 100644 --- a/sys/net/tap/if_tap.c +++ b/sys/net/tap/if_tap.c @@ -32,7 +32,7 @@ /* * $FreeBSD: src/sys/net/if_tap.c,v 1.3.2.3 2002/04/14 21:41:48 luigi Exp $ - * $DragonFly: src/sys/net/tap/if_tap.c,v 1.2 2003/06/17 04:28:48 dillon Exp $ + * $DragonFly: src/sys/net/tap/if_tap.c,v 1.3 2003/06/23 17:55:45 dillon Exp $ * $Id: if_tap.c,v 0.21 2000/07/23 21:46:02 max Exp $ */ @@ -264,16 +264,15 @@ tapcreate(dev) * to open tunnel. must be superuser */ static int -tapopen(dev, flag, mode, p) - dev_t dev; - int flag; - int mode; - struct proc *p; +tapopen(dev_t dev, int flag, int mode, d_thread_t *td) { struct tap_softc *tp = NULL; int error; + struct proc *p = td->td_proc; + + KKASSERT(p != NULL); - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); tp = dev->si_drv1; @@ -305,11 +304,7 @@ tapopen(dev, flag, mode, p) * close the device - mark i/f down & delete routing info */ static int -tapclose(dev, foo, bar, p) - dev_t dev; - int foo; - int bar; - struct proc *p; +tapclose(dev_t dev, int foo, int bar, d_thread_t *td) { int s; struct tap_softc *tp = dev->si_drv1; @@ -517,12 +512,7 @@ tapifstart(ifp) * the cdevsw interface is now pretty minimal */ static int -tapioctl(dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +tapioctl(dev_t dev, u_long cmd, caddr_t data, int flag, d_thread_t *td) { struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = &tp->tap_if; @@ -787,10 +777,7 @@ tapwrite(dev, uio, flag) * anyway, it either accepts the packet or drops it */ static int -tappoll(dev, events, p) - dev_t dev; - int events; - struct proc *p; +tappoll(dev_t dev, int events, d_thread_t *td) { struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = &tp->tap_if; @@ -812,7 +799,7 @@ tappoll(dev, events, p) TAPDEBUG("%s%d waiting for data, minor = %#x\n", ifp->if_name, ifp->if_unit, minor(tp->tap_dev)); - selrecord(p, &tp->tap_rsel); + selrecord(td, &tp->tap_rsel); } } diff --git a/sys/net/tun/if_tun.c b/sys/net/tun/if_tun.c index a178bf172a..bd9c1dc782 100644 --- a/sys/net/tun/if_tun.c +++ b/sys/net/tun/if_tun.c @@ -14,7 +14,7 @@ * operation though. * * $FreeBSD: src/sys/net/if_tun.c,v 1.74.2.8 2002/02/13 00:43:11 dillon Exp $ - * $DragonFly: src/sys/net/tun/if_tun.c,v 1.2 2003/06/17 04:28:48 dillon Exp $ + * $DragonFly: src/sys/net/tun/if_tun.c,v 1.3 2003/06/23 17:55:45 dillon Exp $ */ #include "opt_inet.h" @@ -134,16 +134,14 @@ tuncreate(dev) * configured in */ static int -tunopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +tunopen(dev_t dev, int flag, int mode, struct thread *td) { struct ifnet *ifp; struct tun_softc *tp; register int error; - error = suser(p); + KKASSERT(td->td_proc); + error = suser_xxx(td->td_proc->p_ucred, 0); if (error) return (error); @@ -154,7 +152,7 @@ tunopen(dev, flag, mode, p) } if (tp->tun_flags & TUN_OPEN) return EBUSY; - tp->tun_pid = p->p_pid; + tp->tun_pid = td->td_proc->p_pid; ifp = &tp->tun_if; tp->tun_flags |= TUN_OPEN; TUNDEBUG("%s%d: open\n", ifp->if_name, ifp->if_unit); @@ -166,11 +164,7 @@ tunopen(dev, flag, mode, p) * routing info */ static int -tunclose(dev, foo, bar, p) - dev_t dev; - int foo; - int bar; - struct proc *p; +tunclose(dev_t dev, int foo, int bar, struct thread *td) { register int s; struct tun_softc *tp; @@ -420,12 +414,7 @@ tunoutput(ifp, m0, dst, rt) * the cdevsw interface is now pretty minimal. */ static int -tunioctl(dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +tunioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) { int s; struct tun_softc *tp = dev->si_drv1; @@ -696,10 +685,7 @@ tunwrite(dev, uio, flag) * anyway, it either accepts the packet or drops it. */ static int -tunpoll(dev, events, p) - dev_t dev; - int events; - struct proc *p; +tunpoll(dev_t dev, int events, struct thread *td) { int s; struct tun_softc *tp = dev->si_drv1; @@ -717,7 +703,7 @@ tunpoll(dev, events, p) } else { TUNDEBUG("%s%d: tunpoll waiting\n", ifp->if_name, ifp->if_unit); - selrecord(p, &tp->tun_rsel); + selrecord(td, &tp->tun_rsel); } } if (events & (POLLOUT | POLLWRNORM)) diff --git a/sys/netgraph/socket/ng_socket.c b/sys/netgraph/socket/ng_socket.c index 6c65182d85..f985d7b8f9 100644 --- a/sys/netgraph/socket/ng_socket.c +++ b/sys/netgraph/socket/ng_socket.c @@ -37,7 +37,7 @@ * Author: Julian Elischer * * $FreeBSD: src/sys/netgraph/ng_socket.c,v 1.11.2.6 2002/07/02 22:17:18 archie Exp $ - * $DragonFly: src/sys/netgraph/socket/ng_socket.c,v 1.2 2003/06/17 04:28:51 dillon Exp $ + * $DragonFly: src/sys/netgraph/socket/ng_socket.c,v 1.3 2003/06/23 17:55:46 dillon Exp $ * $Whistle: ng_socket.c,v 1.28 1999/11/01 09:24:52 julian Exp $ */ @@ -161,7 +161,7 @@ ngc_attach(struct socket *so, int proto, struct proc *p) { struct ngpcb *const pcbp = sotongpcb(so); - if (suser(p)) + if (suser_xxx(p->p_ucred, 0)) return (EPERM); if (pcbp != NULL) return (EISCONN); diff --git a/sys/netgraph/tty/ng_tty.c b/sys/netgraph/tty/ng_tty.c index 6e752ae906..b6df184a7a 100644 --- a/sys/netgraph/tty/ng_tty.c +++ b/sys/netgraph/tty/ng_tty.c @@ -37,7 +37,7 @@ * Author: Archie Cobbs * * $FreeBSD: src/sys/netgraph/ng_tty.c,v 1.7.2.3 2002/02/13 00:43:12 dillon Exp $ - * $DragonFly: src/sys/netgraph/tty/ng_tty.c,v 1.2 2003/06/17 04:28:51 dillon Exp $ + * $DragonFly: src/sys/netgraph/tty/ng_tty.c,v 1.3 2003/06/23 17:55:46 dillon Exp $ * $Whistle: ng_tty.c,v 1.21 1999/11/01 09:24:52 julian Exp $ */ @@ -127,7 +127,7 @@ static int ngt_close(struct tty *tp, int flag); static int ngt_read(struct tty *tp, struct uio *uio, int flag); static int ngt_write(struct tty *tp, struct uio *uio, int flag); static int ngt_tioctl(struct tty *tp, - u_long cmd, caddr_t data, int flag, struct proc *); + u_long cmd, caddr_t data, int flag, d_thread_t *td); static int ngt_input(int c, struct tty *tp); static int ngt_start(struct tty *tp); @@ -197,7 +197,7 @@ ngt_open(dev_t dev, struct tty *tp) int s, error; /* Super-user only */ - if ((error = suser(p))) + if ((error = suser_xxx(p->p_ucred, 0))) return (error); s = splnet(); (void) spltty(); /* XXX is this necessary? */ @@ -312,7 +312,7 @@ ngt_write(struct tty *tp, struct uio *uio, int flag) * We implement the NGIOCGINFO ioctl() defined in ng_message.h. */ static int -ngt_tioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p) +ngt_tioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, d_thread_t *td) { const sc_p sc = (sc_p) tp->t_sc; int s, error = 0; diff --git a/sys/netinet/in.c b/sys/netinet/in.c index b5167bfb15..79ef4d1266 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -32,7 +32,7 @@ * * @(#)in.c 8.4 (Berkeley) 1/9/95 * $FreeBSD: src/sys/netinet/in.c,v 1.44.2.14 2002/11/08 00:45:50 suz Exp $ - * $DragonFly: src/sys/netinet/in.c,v 1.2 2003/06/17 04:28:51 dillon Exp $ + * $DragonFly: src/sys/netinet/in.c,v 1.3 2003/06/23 17:55:46 dillon Exp $ */ #include "opt_bootp.h" @@ -207,7 +207,7 @@ in_control(so, cmd, data, ifp, p) switch (cmd) { case SIOCALIFADDR: case SIOCDLIFADDR: - if (p && (error = suser(p)) != 0) + if (p && (error = suser_xxx(p->p_ucred, 0)) != 0) return error; /*fall through*/ case SIOCGLIFADDR: @@ -266,7 +266,7 @@ in_control(so, cmd, data, ifp, p) case SIOCSIFADDR: case SIOCSIFNETMASK: case SIOCSIFDSTADDR: - if (p && (error = suser(p)) != 0) + if (p && (error = suser_xxx(p->p_ucred, 0)) != 0) return error; if (ifp == 0) @@ -305,7 +305,7 @@ in_control(so, cmd, data, ifp, p) break; case SIOCSIFBRDADDR: - if (p && (error = suser(p)) != 0) + if (p && (error = suser_xxx(p->p_ucred, 0)) != 0) return error; /* FALLTHROUGH */ diff --git a/sys/netinet/in_gif.c b/sys/netinet/in_gif.c index 95095fa1c6..b80a682776 100644 --- a/sys/netinet/in_gif.c +++ b/sys/netinet/in_gif.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet/in_gif.c,v 1.5.2.11 2003/01/23 21:06:45 sam Exp $ */ -/* $DragonFly: src/sys/netinet/in_gif.c,v 1.2 2003/06/17 04:28:51 dillon Exp $ */ +/* $DragonFly: src/sys/netinet/in_gif.c,v 1.3 2003/06/23 17:55:46 dillon Exp $ */ /* $KAME: in_gif.c,v 1.54 2001/05/14 14:02:16 itojun Exp $ */ /* @@ -72,7 +72,7 @@ static int gif_validate4 __P((const struct ip *, struct gif_softc *, extern struct domain inetdomain; struct protosw in_gif_protosw = { SOCK_RAW, &inetdomain, 0/*IPPROTO_IPV[46]*/, PR_ATOMIC|PR_ADDR, - in_gif_input, rip_output, 0, rip_ctloutput, + in_gif_input, rip_output, 0, rip_ctloutput, 0, 0, 0, 0, 0, &rip_usrreqs diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 523da0da35..4dfbdc1a3b 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -32,7 +32,7 @@ * * @(#)in_pcb.c 8.4 (Berkeley) 5/24/95 * $FreeBSD: src/sys/netinet/in_pcb.c,v 1.59.2.26 2003/01/24 05:11:33 sam Exp $ - * $DragonFly: src/sys/netinet/in_pcb.c,v 1.2 2003/06/17 04:28:51 dillon Exp $ + * $DragonFly: src/sys/netinet/in_pcb.c,v 1.3 2003/06/23 17:55:46 dillon Exp $ */ #include "opt_ipsec.h" @@ -240,9 +240,9 @@ in_pcbbind(inp, nam, p) /* GROSS */ if (ntohs(lport) < IPPORT_RESERVED && p && - suser_xxx(0, p, PRISON_ROOT)) + suser_xxx(p->p_ucred, PRISON_ROOT)) return (EACCES); - if (p && p->p_prison) + if (p && p->p_ucred->cr_prison) prison = 1; if (so->so_cred->cr_uid != 0 && !IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) { @@ -303,7 +303,7 @@ in_pcbbind(inp, nam, p) last = ipport_hilastauto; lastport = &pcbinfo->lasthi; } else if (inp->inp_flags & INP_LOWPORT) { - if (p && (error = suser_xxx(0, p, PRISON_ROOT))) { + if (p && (error = suser_xxx(p->p_ucred, PRISON_ROOT))) { inp->inp_laddr.s_addr = INADDR_ANY; return error; } @@ -512,9 +512,9 @@ in_pcbconnect(inp, nam, p) struct sockaddr_in sa; int error; - if (inp->inp_laddr.s_addr == INADDR_ANY && p->p_prison != NULL) { + if (inp->inp_laddr.s_addr == INADDR_ANY && p->p_ucred->cr_prison != NULL) { bzero(&sa, sizeof (sa)); - sa.sin_addr.s_addr = htonl(p->p_prison->pr_ip); + sa.sin_addr.s_addr = htonl(p->p_ucred->cr_prison->pr_ip); sa.sin_len=sizeof (sa); sa.sin_family = AF_INET; error = in_pcbbind(inp, (struct sockaddr *)&sa, p); @@ -1038,9 +1038,9 @@ in_pcbremlists(inp) int prison_xinpcb(struct proc *p, struct inpcb *inp) { - if (!p->p_prison) + if (!p->p_ucred->cr_prison) return (0); - if (ntohl(inp->inp_laddr.s_addr) == p->p_prison->pr_ip) + if (ntohl(inp->inp_laddr.s_addr) == p->p_ucred->cr_prison->pr_ip) return (0); return (1); } diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 3b56e3b114..cae4dfb198 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/ip_divert.c,v 1.42.2.6 2003/01/23 21:06:45 sam Exp $ - * $DragonFly: src/sys/netinet/ip_divert.c,v 1.2 2003/06/17 04:28:51 dillon Exp $ + * $DragonFly: src/sys/netinet/ip_divert.c,v 1.3 2003/06/23 17:55:46 dillon Exp $ */ #include "opt_inet.h" @@ -344,7 +344,7 @@ div_attach(struct socket *so, int proto, struct proc *p) inp = sotoinpcb(so); if (inp) panic("div_attach"); - if (p && (error = suser(p)) != 0) + if (p && (error = suser_xxx(p->p_ucred, 0)) != 0) return error; error = soreserve(so, div_sendspace, div_recvspace); @@ -486,7 +486,7 @@ div_pcblist(SYSCTL_HANDLER_ARGS) s = splnet(); for (inp = LIST_FIRST(divcbinfo.listhead), i = 0; inp && i < n; inp = LIST_NEXT(inp, inp_list)) { - if (inp->inp_gencnt <= gencnt && !prison_xinpcb(req->p, inp)) + if (inp->inp_gencnt <= gencnt && !prison_xinpcb(req->p, inp))/*YYY*/ inp_list[i++] = inp; } splx(s); diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index f5bd32bbef..0d6b88d75e 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -32,7 +32,7 @@ * * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 * $FreeBSD: src/sys/netinet/raw_ip.c,v 1.64.2.15 2003/01/24 10:52:50 hsu Exp $ - * $DragonFly: src/sys/netinet/raw_ip.c,v 1.2 2003/06/17 04:28:51 dillon Exp $ + * $DragonFly: src/sys/netinet/raw_ip.c,v 1.3 2003/06/23 17:55:46 dillon Exp $ */ #include "opt_inet6.h" @@ -494,7 +494,7 @@ rip_attach(struct socket *so, int proto, struct proc *p) inp = sotoinpcb(so); if (inp) panic("rip_attach"); - if (p && (error = suser(p)) != 0) + if (p && (error = suser_xxx(p->p_ucred, 0)) != 0) return error; error = soreserve(so, rip_sendspace, rip_recvspace); diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index f5478bc740..271365cbca 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -32,7 +32,7 @@ * * @(#)tcp_subr.c 8.2 (Berkeley) 5/24/95 * $FreeBSD: src/sys/netinet/tcp_subr.c,v 1.73.2.31 2003/01/24 05:11:34 sam Exp $ - * $DragonFly: src/sys/netinet/tcp_subr.c,v 1.2 2003/06/17 04:28:51 dillon Exp $ + * $DragonFly: src/sys/netinet/tcp_subr.c,v 1.3 2003/06/23 17:55:46 dillon Exp $ */ #include "opt_compat.h" @@ -931,7 +931,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS) struct inpcb *inp; int error, s; - error = suser(req->p); + error = suser_xxx(req->p->p_ucred, 0); if (error) return (error); error = SYSCTL_IN(req, addrs, sizeof(addrs)); @@ -961,7 +961,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) struct inpcb *inp; int error, s, mapped = 0; - error = suser(req->p); + error = suser_xxx(req->p->p_ucred, 0); if (error) return (error); error = SYSCTL_IN(req, addrs, sizeof(addrs)); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 46e9fe5cab..eb90a67320 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -32,7 +32,7 @@ * * @(#)udp_usrreq.c 8.6 (Berkeley) 5/23/95 * $FreeBSD: src/sys/netinet/udp_usrreq.c,v 1.64.2.18 2003/01/24 05:11:34 sam Exp $ - * $DragonFly: src/sys/netinet/udp_usrreq.c,v 1.2 2003/06/17 04:28:51 dillon Exp $ + * $DragonFly: src/sys/netinet/udp_usrreq.c,v 1.3 2003/06/23 17:55:46 dillon Exp $ */ #include "opt_ipsec.h" @@ -650,7 +650,7 @@ udp_getcred(SYSCTL_HANDLER_ARGS) struct inpcb *inp; int error, s; - error = suser(req->p); + error = suser_xxx(req->p->p_ucred, 0); if (error) return (error); error = SYSCTL_IN(req, addrs, sizeof(addrs)); @@ -859,7 +859,7 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct proc *p) return EISCONN; error = 0; s = splnet(); - if (inp->inp_laddr.s_addr == INADDR_ANY && p->p_prison != NULL) + if (inp->inp_laddr.s_addr == INADDR_ANY && p->p_ucred->cr_prison != NULL) error = in_pcbbind(inp, NULL, p); if (error == 0) { sin = (struct sockaddr_in *)nam; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index c79c1bb449..42cc082cf3 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/in6.c,v 1.7.2.9 2002/04/28 05:40:26 suz Exp $ */ -/* $DragonFly: src/sys/netinet6/in6.c,v 1.2 2003/06/17 04:28:52 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/in6.c,v 1.3 2003/06/23 17:55:46 dillon Exp $ */ /* $KAME: in6.c,v 1.259 2002/01/21 11:37:50 keiichi Exp $ */ /* @@ -377,7 +377,7 @@ in6_control(so, cmd, data, ifp, p) int privileged; privileged = 0; - if (p == NULL || !suser(p)) + if (p == NULL || !suser_xxx(p->p_ucred, 0)) privileged++; switch (cmd) { diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index ae54ab037f..e512618c5d 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/in6_pcb.c,v 1.10.2.9 2003/01/24 05:11:35 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/in6_pcb.c,v 1.2 2003/06/17 04:28:52 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/in6_pcb.c,v 1.3 2003/06/23 17:55:46 dillon Exp $ */ /* $KAME: in6_pcb.c,v 1.31 2001/05/21 05:45:10 jinmei Exp $ */ /* @@ -191,7 +191,7 @@ in6_pcbbind(inp, nam, p) /* GROSS */ if (ntohs(lport) < IPV6PORT_RESERVED && p && - suser_xxx(0, p, PRISON_ROOT)) + suser_xxx(p->p_ucred, PRISON_ROOT)) return(EACCES); if (so->so_cred->cr_uid != 0 && !IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) { diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 99019bd4c3..fdaecef08c 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/in6_src.c,v 1.1.2.3 2002/02/26 18:02:06 ume Exp $ */ -/* $DragonFly: src/sys/netinet6/in6_src.c,v 1.2 2003/06/17 04:28:52 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/in6_src.c,v 1.3 2003/06/23 17:55:47 dillon Exp $ */ /* $KAME: in6_src.c,v 1.37 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -354,7 +354,7 @@ in6_pcbsetport(laddr, inp, p) last = ipport_hilastauto; lastport = &pcbinfo->lasthi; } else if (inp->inp_flags & INP_LOWPORT) { - if (p && (error = suser(p))) + if (p && (error = suser_xxx(p->p_ucred, 0))) return error; first = ipport_lowfirstauto; /* 1023 */ last = ipport_lowlastauto; /* 600 */ diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index b032bf1bd7..38950edae8 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ip6_input.c,v 1.11.2.15 2003/01/24 05:11:35 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/ip6_input.c,v 1.2 2003/06/17 04:28:52 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/ip6_input.c,v 1.3 2003/06/23 17:55:47 dillon Exp $ */ /* $KAME: ip6_input.c,v 1.259 2002/01/21 04:58:09 jinmei Exp $ */ /* @@ -1135,7 +1135,7 @@ ip6_savecontrol(in6p, mp, ip6, m) int rthdr_exist = 0; - if (p && !suser(p)) + if (p && !suser_xxx(p->p_ucred, 0)) privileged++; #ifdef SO_TIMESTAMP diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index e0006c6d6c..4494d3e413 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/ip6_output.c,v 1.13.2.18 2003/01/24 05:11:35 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/ip6_output.c,v 1.2 2003/06/17 04:28:52 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/ip6_output.c,v 1.3 2003/06/23 17:55:47 dillon Exp $ */ /* $KAME: ip6_output.c,v 1.279 2002/01/26 06:12:30 jinmei Exp $ */ /* @@ -112,6 +112,7 @@ #include +struct ip; extern int (*fr_checkp) __P((struct ip *, int, struct ifnet *, int, struct mbuf **)); static MALLOC_DEFINE(M_IPMOPTS, "ip6_moptions", "internet multicast options"); @@ -1329,7 +1330,7 @@ ip6_ctloutput(so, sopt) } error = optval = 0; - privileged = (p == 0 || suser(p)) ? 0 : 1; + privileged = (p == 0 || suser_xxx(p->p_ucred, 0)) ? 0 : 1; if (level == IPPROTO_IPV6) { switch (op) { @@ -1777,7 +1778,7 @@ ip6_pcbopts(pktopt, m, so, sopt) } /* set options specified by user. */ - if (p && !suser(p)) + if (p && !suser_xxx(p->p_ucred, 0)) priv = 1; if ((error = ip6_setpktoptions(m, opt, priv, 1)) != 0) { ip6_clearpktopts(opt, 1, -1); /* XXX: discard all options */ @@ -2034,7 +2035,7 @@ ip6_setmoptions(optname, im6op, m) * all multicast addresses. Only super user is allowed * to do this. */ - if (suser(p)) + if (suser_xxx(p->p_ucred, 0)) { error = EACCES; break; @@ -2141,7 +2142,7 @@ ip6_setmoptions(optname, im6op, m) } mreq = mtod(m, struct ipv6_mreq *); if (IN6_IS_ADDR_UNSPECIFIED(&mreq->ipv6mr_multiaddr)) { - if (suser(p)) { + if (suser_xxx(p->p_ucred, 0)) { error = EACCES; break; } diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 422cf419f4..cc957fc63a 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet6/raw_ip6.c,v 1.7.2.7 2003/01/24 05:11:35 sam Exp $ - * $DragonFly: src/sys/netinet6/raw_ip6.c,v 1.2 2003/06/17 04:28:53 dillon Exp $ + * $DragonFly: src/sys/netinet6/raw_ip6.c,v 1.3 2003/06/23 17:55:47 dillon Exp $ */ /* @@ -562,7 +562,7 @@ rip6_attach(struct socket *so, int proto, struct proc *p) inp = sotoinpcb(so); if (inp) panic("rip6_attach"); - if (p && (error = suser(p)) != 0) + if (p && (error = suser_xxx(p->p_ucred, 0)) != 0) return error; error = soreserve(so, rip_sendspace, rip_recvspace); diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c index 2d326ef0e8..93b23b823e 100644 --- a/sys/netinet6/udp6_output.c +++ b/sys/netinet6/udp6_output.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/udp6_output.c,v 1.1.2.6 2003/01/23 21:06:47 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/udp6_output.c,v 1.2 2003/06/17 04:28:53 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/udp6_output.c,v 1.3 2003/06/23 17:55:47 dillon Exp $ */ /* $KAME: udp6_output.c,v 1.31 2001/05/21 16:39:15 jinmei Exp $ */ /* @@ -142,7 +142,7 @@ udp6_output(in6p, m, addr6, control, p) struct sockaddr_in6 tmp; priv = 0; - if (p && !suser(p)) + if (p && !suser_xxx(p->p_ucred, 0)) priv = 1; if (control) { if ((error = ip6_setpktoptions(control, &opt, priv, 0)) != 0) diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 2bb507e09c..fa128b1147 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/netinet6/udp6_usrreq.c,v 1.6.2.13 2003/01/24 05:11:35 sam Exp $ */ -/* $DragonFly: src/sys/netinet6/udp6_usrreq.c,v 1.2 2003/06/17 04:28:53 dillon Exp $ */ +/* $DragonFly: src/sys/netinet6/udp6_usrreq.c,v 1.3 2003/06/23 17:55:47 dillon Exp $ */ /* $KAME: udp6_usrreq.c,v 1.27 2001/05/21 05:45:10 jinmei Exp $ */ /* @@ -494,7 +494,7 @@ udp6_getcred(SYSCTL_HANDLER_ARGS) struct inpcb *inp; int error, s; - error = suser(req->p); + error = suser_xxx(req->p->p_ucred, 0); if (error) return (error); diff --git a/sys/netproto/ncp/ncp_subr.h b/sys/netproto/ncp/ncp_subr.h index 1dd3f3f006..bee2ed0b33 100644 --- a/sys/netproto/ncp/ncp_subr.h +++ b/sys/netproto/ncp/ncp_subr.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netncp/ncp_subr.h,v 1.3 2000/01/14 19:54:39 bde Exp $ - * $DragonFly: src/sys/netproto/ncp/ncp_subr.h,v 1.2 2003/06/17 04:28:53 dillon Exp $ + * $DragonFly: src/sys/netproto/ncp/ncp_subr.h,v 1.3 2003/06/23 17:55:47 dillon Exp $ */ #ifndef _NETNCP_NCP_SUBR_H_ #define _NETNCP_NCP_SUBR_H_ @@ -84,7 +84,7 @@ #define checkbad(fn) {error=(fn);if(error) goto bad;} -#define ncp_suser(cred) suser_xxx(cred, NULL, 0) +#define ncp_suser(cred) suser_xxx(cred, 0) #define ncp_isowner(conn,cred) ((cred)->cr_uid == (conn)->nc_owner->cr_uid) diff --git a/sys/netproto/smb/smb_dev.c b/sys/netproto/smb/smb_dev.c index ec5779ccec..beb40c42c4 100644 --- a/sys/netproto/smb/smb_dev.c +++ b/sys/netproto/smb/smb_dev.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_dev.c,v 1.2.2.1 2001/05/22 08:32:33 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_dev.c,v 1.2 2003/06/17 04:28:54 dillon Exp $ + * $DragonFly: src/sys/netproto/smb/smb_dev.c,v 1.3 2003/06/23 17:55:47 dillon Exp $ */ #include #include @@ -105,12 +105,15 @@ static struct cdevsw nsmb_cdevsw = { static int -nsmb_dev_open(dev_t dev, int oflags, int devtype, struct proc *p) +nsmb_dev_open(dev_t dev, int oflags, int devtype, d_thread_t *td) { + struct proc *p = td->td_proc; struct smb_dev *sdp; - struct ucred *cred = p->p_ucred; + struct ucred *cred; int s; + KKASSERT(p != NULL); + cred = p->p_ucred; sdp = SMB_GETDEV(dev); if (sdp && (sdp->sd_flags & NSMBFL_OPEN)) return EBUSY; @@ -139,8 +142,9 @@ nsmb_dev_open(dev_t dev, int oflags, int devtype, struct proc *p) } static int -nsmb_dev_close(dev_t dev, int flag, int fmt, struct proc *p) +nsmb_dev_close(dev_t dev, int flag, int fmt, d_thread_t *td) { + struct proc *p = td->td_proc; struct smb_dev *sdp; struct smb_vc *vcp; struct smb_share *ssp; @@ -173,8 +177,9 @@ nsmb_dev_close(dev_t dev, int flag, int fmt, struct proc *p) static int -nsmb_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) +nsmb_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, d_thread_t *td) { + struct proc *p = td->td_proc; struct smb_dev *sdp; struct smb_vc *vcp; struct smb_share *ssp; @@ -329,7 +334,7 @@ nsmb_dev_write(dev_t dev, struct uio *uio, int flag) } static int -nsmb_dev_poll(dev_t dev, int events, struct proc *p) +nsmb_dev_poll(dev_t dev, int events, d_thread_t *td) { return ENODEV; } diff --git a/sys/netproto/smb/smb_subr.c b/sys/netproto/smb/smb_subr.c index 3e5b18f601..58b7cb0a4f 100644 --- a/sys/netproto/smb/smb_subr.c +++ b/sys/netproto/smb/smb_subr.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_subr.c,v 1.1.2.2 2001/09/03 08:55:11 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_subr.c,v 1.3 2003/06/22 04:30:43 dillon Exp $ + * $DragonFly: src/sys/netproto/smb/smb_subr.c,v 1.4 2003/06/23 17:55:47 dillon Exp $ */ #include #include @@ -366,7 +366,7 @@ smb_checksmp(void) name[0] = CTL_HW; name[1] = HW_NCPU; - error = kernel_sysctl(curproc, name, 2, &ncpu, &olen, NULL, 0, &plen); + error = kernel_sysctl(name, 2, &ncpu, &olen, NULL, 0, &plen); if (error) return error; #ifndef SMP diff --git a/sys/netproto/smb/smb_subr.h b/sys/netproto/smb/smb_subr.h index 8a4527d71c..30d135898c 100644 --- a/sys/netproto/smb/smb_subr.h +++ b/sys/netproto/smb/smb_subr.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_subr.h,v 1.1.2.1 2001/05/22 08:32:34 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_subr.h,v 1.2 2003/06/17 04:28:54 dillon Exp $ + * $DragonFly: src/sys/netproto/smb/smb_subr.h,v 1.3 2003/06/23 17:55:47 dillon Exp $ */ #ifndef _NETSMB_SMB_SUBR_H_ #define _NETSMB_SMB_SUBR_H_ @@ -75,7 +75,7 @@ void m_dumpm(struct mbuf *m); SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \ SIGISMEMBER(set, SIGQUIT)) -#define smb_suser(cred) suser_xxx(cred, NULL, 0) +#define smb_suser(cred) suser_xxx(cred, 0) #include diff --git a/sys/platform/pc32/apm/apm.c b/sys/platform/pc32/apm/apm.c index 0745940ae3..685f97b3f7 100644 --- a/sys/platform/pc32/apm/apm.c +++ b/sys/platform/pc32/apm/apm.c @@ -16,7 +16,7 @@ * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * * $FreeBSD: src/sys/i386/apm/apm.c,v 1.114.2.5 2002/11/02 04:41:50 iwasaki Exp $ - * $DragonFly: src/sys/platform/pc32/apm/apm.c,v 1.2 2003/06/17 04:28:34 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/apm/apm.c,v 1.3 2003/06/23 17:55:37 dillon Exp $ */ #include @@ -1123,7 +1123,7 @@ apm_attach(device_t dev) } static int -apmopen(dev_t dev, int flag, int fmt, struct proc *p) +apmopen(dev_t dev, int flag, int fmt, d_thread_t *td) { struct apm_softc *sc = &apm_softc; int ctl = APMDEV(dev); @@ -1151,7 +1151,7 @@ apmopen(dev_t dev, int flag, int fmt, struct proc *p) } static int -apmclose(dev_t dev, int flag, int fmt, struct proc *p) +apmclose(dev_t dev, int flag, int fmt, d_thread_t *td) { struct apm_softc *sc = &apm_softc; int ctl = APMDEV(dev); @@ -1174,7 +1174,7 @@ apmclose(dev_t dev, int flag, int fmt, struct proc *p) } static int -apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) +apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td) { struct apm_softc *sc = &apm_softc; struct apm_bios_arg *args; @@ -1358,7 +1358,7 @@ apmwrite(dev_t dev, struct uio *uio, int ioflag) } static int -apmpoll(dev_t dev, int events, struct proc *p) +apmpoll(dev_t dev, int events, d_thread_t *td) { struct apm_softc *sc = &apm_softc; int revents = 0; @@ -1367,7 +1367,7 @@ apmpoll(dev_t dev, int events, struct proc *p) if (sc->event_count) { revents |= events & (POLLIN | POLLRDNORM); } else { - selrecord(p, &sc->sc_rsel); + selrecord(td, &sc->sc_rsel); } } diff --git a/sys/platform/pc32/i386/genassym.c b/sys/platform/pc32/i386/genassym.c index 6e98700ef5..fa7658f5e1 100644 --- a/sys/platform/pc32/i386/genassym.c +++ b/sys/platform/pc32/i386/genassym.c @@ -35,7 +35,7 @@ * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $ - * $DragonFly: src/sys/platform/pc32/i386/genassym.c,v 1.10 2003/06/21 17:31:08 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/genassym.c,v 1.11 2003/06/23 17:55:38 dillon Exp $ */ #include "opt_user_ldt.h" @@ -198,7 +198,7 @@ ASSYM(GD_CURRENTLDT, offsetof(struct globaldata, gd_currentldt)); #endif #ifdef SMP -ASSYM(GD_CPU, offsetof(struct globaldata, gd_cpuid)); +ASSYM(GD_CPU, offsetof(struct globaldata, gd_cpu)); ASSYM(GD_CPU_LOCKID, offsetof(struct globaldata, gd_cpu_lockid)); ASSYM(GD_OTHER_CPUS, offsetof(struct globaldata, gd_other_cpus)); ASSYM(GD_SS_EFLAGS, offsetof(struct globaldata, gd_ss_eflags)); diff --git a/sys/platform/pc32/i386/machdep.c b/sys/platform/pc32/i386/machdep.c index 3347bbf4f7..18922042e9 100644 --- a/sys/platform/pc32/i386/machdep.c +++ b/sys/platform/pc32/i386/machdep.c @@ -36,7 +36,7 @@ * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.385.2.30 2003/05/31 08:48:05 alc Exp $ - * $DragonFly: src/sys/platform/pc32/i386/machdep.c,v 1.10 2003/06/22 08:54:18 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/machdep.c,v 1.11 2003/06/23 17:55:38 dillon Exp $ */ #include "apm.h" @@ -720,6 +720,8 @@ sendsig(catcher, sig, mask, code) } /* + * osigreturn_args(struct osigcontext *sigcntxp) + * * System call to cleanup state after a signal * has been taken. Reset signal mask and * stack state from context left by sendsig (above). @@ -732,14 +734,11 @@ sendsig(catcher, sig, mask, code) #define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) int -osigreturn(p, uap) - struct proc *p; - struct osigreturn_args /* { - struct osigcontext *sigcntxp; - } */ *uap; +osigreturn(struct osigreturn_args *uap) { - register struct osigcontext *scp; - register struct trapframe *regs = p->p_md.md_regs; + struct proc *p = curproc; + struct osigcontext *scp; + struct trapframe *regs = p->p_md.md_regs; int eflags; scp = uap->sigcntxp; @@ -837,13 +836,13 @@ osigreturn(p, uap) return(EJUSTRETURN); } +/* + * sigreturn(ucontext_t *sigcntxp) + */ int -sigreturn(p, uap) - struct proc *p; - struct sigreturn_args /* { - ucontext_t *sigcntxp; - } */ *uap; +sigreturn(struct sigreturn_args *uap) { + struct proc *p = curproc; struct trapframe *regs; ucontext_t *ucp; int cs, eflags; @@ -853,7 +852,7 @@ sigreturn(p, uap) if (!useracc((caddr_t)ucp, sizeof(struct osigcontext), VM_PROT_READ)) return (EFAULT); if (((struct osigcontext *)ucp)->sc_trapno == 0x01d516) - return (osigreturn(p, (struct osigreturn_args *)uap)); + return (osigreturn((struct osigreturn_args *)uap)); /* * Since ucp is not an osigcontext but a ucontext_t, we have to @@ -2434,7 +2433,7 @@ set_dbregs(p, dbregs) * from within kernel mode? */ - if (suser(p) != 0) { + if (suser_xxx(p->p_ucred, 0) != 0) { if (dbregs->dr7 & 0x3) { /* dr0 is enabled */ if (dbregs->dr0 >= VM_MAXUSER_ADDRESS) diff --git a/sys/platform/pc32/i386/mem.c b/sys/platform/pc32/i386/mem.c index 5492119fda..755311440c 100644 --- a/sys/platform/pc32/i386/mem.c +++ b/sys/platform/pc32/i386/mem.c @@ -39,7 +39,7 @@ * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 * $FreeBSD: src/sys/i386/i386/mem.c,v 1.79.2.9 2003/01/04 22:58:01 njl Exp $ - * $DragonFly: src/sys/platform/pc32/i386/Attic/mem.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/Attic/mem.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ /* @@ -101,19 +101,17 @@ static struct random_softc random_softc[16]; static caddr_t zbuf; MALLOC_DEFINE(M_MEMDESC, "memdesc", "memory range descriptors"); -static int mem_ioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); -static int random_ioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); +static int mem_ioctl __P((dev_t, u_long, caddr_t, int, struct thread *)); +static int random_ioctl __P((dev_t, u_long, caddr_t, int, struct thread *)); struct mem_range_softc mem_range_softc; static int -mmclose(dev, flags, fmt, p) - dev_t dev; - int flags; - int fmt; - struct proc *p; +mmclose(dev_t dev, int flags, int fmt, struct thread *td) { + struct proc *p = td->td_proc; + switch (minor(dev)) { case 14: p->p_md.md_regs->tf_eflags &= ~PSL_IOPL; @@ -125,13 +123,10 @@ mmclose(dev, flags, fmt, p) } static int -mmopen(dev, flags, fmt, p) - dev_t dev; - int flags; - int fmt; - struct proc *p; +mmopen(dev_t dev, int flags, int fmt, struct thread *td) { int error; + struct proc *p = td->td_proc; switch (minor(dev)) { case 0: @@ -140,7 +135,7 @@ mmopen(dev, flags, fmt, p) return (EPERM); break; case 14: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); if (securelevel > 0) @@ -329,20 +324,15 @@ memmmap(dev_t dev, vm_offset_t offset, int nprot) } static int -mmioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { switch (minor(dev)) { case 0: - return mem_ioctl(dev, cmd, data, flags, p); + return mem_ioctl(dev, cmd, data, flags, td); case 3: case 4: - return random_ioctl(dev, cmd, data, flags, p); + return random_ioctl(dev, cmd, data, flags, td); } return (ENODEV); } @@ -354,12 +344,7 @@ mmioctl(dev, cmd, data, flags, p) * and mem_range_attr_set. */ static int -mem_ioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +mem_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { int nd, error = 0; struct mem_range_op *mo = (struct mem_range_op *)data; @@ -453,13 +438,9 @@ mem_range_AP_init(void) #endif static int -random_ioctl(dev, cmd, data, flags, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flags; - struct proc *p; +random_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct thread *td) { + struct proc *p = td->td_proc; static intrmask_t interrupt_allowed; intrmask_t interrupt_mask; int error, intr; @@ -490,7 +471,7 @@ random_ioctl(dev, cmd, data, flags, p) case FIONBIO: break; case MEM_SETIRQ: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); if (intr < 0 || intr >= 16) @@ -507,7 +488,7 @@ random_ioctl(dev, cmd, data, flags, p) enable_intr(); break; case MEM_CLEARIRQ: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); if (intr < 0 || intr >= 16) @@ -521,7 +502,7 @@ random_ioctl(dev, cmd, data, flags, p) enable_intr(); break; case MEM_RETURNIRQ: - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error != 0) return (error); *(u_int16_t *)data = interrupt_allowed; @@ -531,17 +512,14 @@ random_ioctl(dev, cmd, data, flags, p) } int -mmpoll(dev, events, p) - dev_t dev; - int events; - struct proc *p; +mmpoll(dev_t dev, int events, struct thread *td) { switch (minor(dev)) { case 3: /* /dev/random */ - return random_poll(dev, events, p); + return random_poll(dev, events, td); case 4: /* /dev/urandom */ default: - return seltrue(dev, events, p); + return seltrue(dev, events, td); } } diff --git a/sys/platform/pc32/i386/perfmon.c b/sys/platform/pc32/i386/perfmon.c index 2ac7a8d8a9..b70ad6499a 100644 --- a/sys/platform/pc32/i386/perfmon.c +++ b/sys/platform/pc32/i386/perfmon.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/perfmon.c,v 1.21 1999/09/25 18:24:04 phk Exp $ - * $DragonFly: src/sys/platform/pc32/i386/perfmon.c,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/perfmon.c,v 1.3 2003/06/23 17:55:38 dillon Exp $ */ #include @@ -284,7 +284,7 @@ static int writer; static int writerpmc; static int -perfmon_open(dev_t dev, int flags, int fmt, struct proc *p) +perfmon_open(dev_t dev, int flags, int fmt, struct thread *td) { if (!perfmon_cpuok) return ENXIO; @@ -301,7 +301,7 @@ perfmon_open(dev_t dev, int flags, int fmt, struct proc *p) } static int -perfmon_close(dev_t dev, int flags, int fmt, struct proc *p) +perfmon_close(dev_t dev, int flags, int fmt, struct thread *td) { if (flags & FWRITE) { int i; @@ -316,7 +316,7 @@ perfmon_close(dev_t dev, int flags, int fmt, struct proc *p) } static int -perfmon_ioctl(dev_t dev, u_long cmd, caddr_t param, int flags, struct proc *p) +perfmon_ioctl(dev_t dev, u_long cmd, caddr_t param, int flags, struct thread *td) { struct pmc *pmc; struct pmc_data *pmcd; diff --git a/sys/platform/pc32/i386/sys_machdep.c b/sys/platform/pc32/i386/sys_machdep.c index 46e8144bd8..21088fc56a 100644 --- a/sys/platform/pc32/i386/sys_machdep.c +++ b/sys/platform/pc32/i386/sys_machdep.c @@ -32,7 +32,7 @@ * * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 * $FreeBSD: src/sys/i386/i386/sys_machdep.c,v 1.47.2.3 2002/10/07 17:20:00 jhb Exp $ - * $DragonFly: src/sys/platform/pc32/i386/sys_machdep.c,v 1.3 2003/06/18 18:29:55 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/sys_machdep.c,v 1.4 2003/06/23 17:55:38 dillon Exp $ * */ @@ -77,18 +77,14 @@ static int i386_get_ioperm __P((struct proc *, char *)); static int i386_set_ioperm __P((struct proc *, char *)); int i386_extend_pcb __P((struct proc *)); -#ifndef _SYS_SYSPROTO_H_ -struct sysarch_args { - int op; - char *parms; -}; -#endif +/* + * sysarch_args(int op, char *params) + */ int -sysarch(p, uap) - struct proc *p; - register struct sysarch_args *uap; +sysarch(struct sysarch_args *uap) { + struct proc *p = curproc; int error = 0; switch(uap->op) { @@ -178,7 +174,7 @@ i386_set_ioperm(p, args) if ((error = copyin(args, &ua, sizeof(struct i386_ioperm_args))) != 0) return (error); - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); if (securelevel > 0) return (EPERM); diff --git a/sys/platform/pc32/i386/trap.c b/sys/platform/pc32/i386/trap.c index b8875fdc1f..4a63124918 100644 --- a/sys/platform/pc32/i386/trap.c +++ b/sys/platform/pc32/i386/trap.c @@ -36,7 +36,7 @@ * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 * $FreeBSD: src/sys/i386/i386/trap.c,v 1.147.2.11 2003/02/27 19:09:59 luoqi Exp $ - * $DragonFly: src/sys/platform/pc32/i386/trap.c,v 1.5 2003/06/22 08:54:18 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/trap.c,v 1.6 2003/06/23 17:55:38 dillon Exp $ */ /* @@ -93,6 +93,7 @@ #include #include +#include #include "isa.h" #include "npx.h" @@ -1089,12 +1090,12 @@ syscall2(frame) #endif /* - * handle atomicy by looping since interrupts are enabled and the - * MP lock is not held. + * access non-atomic field from critical section. p_sticks is + * updated by the clock interrupt. */ + crit_enter(); sticks = ((volatile struct proc *)p)->p_sticks; - while (sticks != ((volatile struct proc *)p)->p_sticks) - sticks = ((volatile struct proc *)p)->p_sticks; + crit_exit(); p->p_md.md_regs = &frame; params = (caddr_t)frame.tf_esp + sizeof(int); @@ -1177,7 +1178,7 @@ syscall2(frame) STOPEVENT(p, S_SCE, narg); /* MP aware */ - error = (*callp->sy_call)(p, args); + error = (*callp->sy_call)(args); /* * MP SAFE (we may or may not have the MP lock at this point) diff --git a/sys/platform/pc32/i386/vm86.c b/sys/platform/pc32/i386/vm86.c index 245a02b7b4..8a6564d72f 100644 --- a/sys/platform/pc32/i386/vm86.c +++ b/sys/platform/pc32/i386/vm86.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/i386/vm86.c,v 1.31.2.2 2001/10/05 06:18:55 peter Exp $ - * $DragonFly: src/sys/platform/pc32/i386/vm86.c,v 1.3 2003/06/18 18:29:55 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/i386/vm86.c,v 1.4 2003/06/23 17:55:38 dillon Exp $ */ #include @@ -705,7 +705,7 @@ vm86_sysarch(p, args) case VM86_INTCALL: { struct vm86_intcall_args sa; - if ((error = suser(p))) + if ((error = suser_xxx(p->p_ucred, 0))) return (error); if ((error = copyin(ua.sub_args, &sa, sizeof(sa)))) return (error); diff --git a/sys/platform/vkernel/i386/genassym.c b/sys/platform/vkernel/i386/genassym.c index 5463f259a4..113661fa91 100644 --- a/sys/platform/vkernel/i386/genassym.c +++ b/sys/platform/vkernel/i386/genassym.c @@ -35,7 +35,7 @@ * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 * $FreeBSD: src/sys/i386/i386/genassym.c,v 1.86.2.3 2002/03/03 05:42:49 nyan Exp $ - * $DragonFly: src/sys/platform/vkernel/i386/genassym.c,v 1.10 2003/06/21 17:31:08 dillon Exp $ + * $DragonFly: src/sys/platform/vkernel/i386/genassym.c,v 1.11 2003/06/23 17:55:38 dillon Exp $ */ #include "opt_user_ldt.h" @@ -198,7 +198,7 @@ ASSYM(GD_CURRENTLDT, offsetof(struct globaldata, gd_currentldt)); #endif #ifdef SMP -ASSYM(GD_CPU, offsetof(struct globaldata, gd_cpuid)); +ASSYM(GD_CPU, offsetof(struct globaldata, gd_cpu)); ASSYM(GD_CPU_LOCKID, offsetof(struct globaldata, gd_cpu_lockid)); ASSYM(GD_OTHER_CPUS, offsetof(struct globaldata, gd_other_cpus)); ASSYM(GD_SS_EFLAGS, offsetof(struct globaldata, gd_ss_eflags)); diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 90e9e5f5a5..e108a3303f 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -37,7 +37,7 @@ * * @(#)conf.h 8.5 (Berkeley) 1/9/95 * $FreeBSD: src/sys/sys/conf.h,v 1.103.2.6 2002/03/11 01:14:55 dd Exp $ - * $DragonFly: src/sys/sys/conf.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/conf.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ */ #ifndef _SYS_CONF_H_ @@ -117,20 +117,22 @@ struct knote; * not use d_thread_t. */ -typedef struct proc d_thread_t; +struct thread; +struct lwkt_wait; -typedef int d_open_t __P((dev_t dev, int oflags, int devtype, d_thread_t *p)); -typedef int d_close_t __P((dev_t dev, int fflag, int devtype, d_thread_t *p)); +typedef struct thread d_thread_t; +typedef int d_open_t __P((dev_t dev, int oflags, int devtype, d_thread_t *td)); +typedef int d_close_t __P((dev_t dev, int fflag, int devtype, d_thread_t *td)); typedef void d_strategy_t __P((struct buf *bp)); typedef int d_parms_t __P((dev_t dev, struct specinfo *sinfo, int ctl)); typedef int d_ioctl_t __P((dev_t dev, u_long cmd, caddr_t data, - int fflag, d_thread_t *p)); + int fflag, d_thread_t *td)); typedef int d_dump_t __P((dev_t dev)); typedef int d_psize_t __P((dev_t dev)); typedef int d_read_t __P((dev_t dev, struct uio *uio, int ioflag)); typedef int d_write_t __P((dev_t dev, struct uio *uio, int ioflag)); -typedef int d_poll_t __P((dev_t dev, int events, d_thread_t *p)); +typedef int d_poll_t __P((dev_t dev, int events, d_thread_t *td)); typedef int d_kqfilter_t __P((dev_t dev, struct knote *kn)); typedef int d_mmap_t __P((dev_t dev, vm_offset_t offset, int nprot)); @@ -139,7 +141,7 @@ typedef int l_close_t __P((struct tty *tp, int flag)); typedef int l_read_t __P((struct tty *tp, struct uio *uio, int flag)); typedef int l_write_t __P((struct tty *tp, struct uio *uio, int flag)); typedef int l_ioctl_t __P((struct tty *tp, u_long cmd, caddr_t data, - int flag, d_thread_t *p)); + int flag, d_thread_t *td)); typedef int l_rint_t __P((int c, struct tty *tp)); typedef int l_start_t __P((struct tty *tp)); typedef int l_modem_t __P((struct tty *tp, int flag)); diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 52a1160556..3ab7d83e36 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -32,7 +32,7 @@ * * @(#)filedesc.h 8.1 (Berkeley) 6/2/93 * $FreeBSD: src/sys/sys/filedesc.h,v 1.19.2.5 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/sys/filedesc.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/filedesc.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ */ #ifndef _SYS_FILEDESC_H_ @@ -153,7 +153,7 @@ SLIST_HEAD(sigiolst, sigio); /* * Kernel global variables and routines. */ -int dupfdopen __P((struct proc *, struct filedesc *, int, int, int, int)); +int dupfdopen __P((struct filedesc *, int, int, int, int)); int fdalloc __P((struct proc *p, int want, int *result)); int fdavail __P((struct proc *p, int n)); int falloc __P((struct proc *p, struct file **resultfp, int *resultfd)); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 82e7949229..9de0222733 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -37,7 +37,7 @@ * * @(#)proc.h 8.15 (Berkeley) 5/19/95 * $FreeBSD: src/sys/sys/proc.h,v 1.99.2.9 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/sys/proc.h,v 1.12 2003/06/22 17:39:46 dillon Exp $ + * $DragonFly: src/sys/sys/proc.h,v 1.13 2003/06/23 17:55:50 dillon Exp $ */ #ifndef _SYS_PROC_H_ @@ -120,7 +120,7 @@ struct proc { LIST_ENTRY(proc) p_list; /* List of all processes. */ /* substructures: */ - struct pcred *p_cred; /* Process owner's identity. */ + struct ucred *p_ucred; /* Process owner's identity. */ struct filedesc *p_fd; /* Ptr to open files structure. */ struct filedesc_to_leader *p_fdtol; /* Ptr to tracking node */ struct pstats *p_stats; /* Accounting/statistics (PROC ONLY). */ @@ -134,8 +134,6 @@ struct proc { #define p_sigacts p_procsig->ps_sigacts #define p_sigignore p_procsig->ps_sigignore #define p_sigcatch p_procsig->ps_sigcatch - -#define p_ucred p_cred->pc_ucred #define p_rlimit p_limit->pl_rlimit int p_flag; /* P_* flags. */ @@ -224,7 +222,6 @@ struct proc { struct sysentvec *p_sysent; /* System call dispatch information. */ struct rtprio p_rtprio; /* Realtime priority. */ - struct prison *p_prison; struct pargs *p_args; /* End area that is copied on creation. */ #define p_endcopy p_addr @@ -293,24 +290,6 @@ struct proc { #define P_INEXEC 0x8000000 /* Process is in execve(). */ #define P_EXITINTERLOCK 0x10000000 /* Reaping process exit interlock */ -/* - * MOVE TO ucred.h? - * - * Shareable process credentials (always resident). This includes a reference - * to the current user credentials as well as real and saved ids that may be - * used to change ids. - */ -struct pcred { - struct ucred *pc_ucred; /* Current credentials. */ - uid_t p_ruid; /* Real user id. */ - uid_t p_svuid; /* Saved effective user id. */ - gid_t p_rgid; /* Real group id. */ - gid_t p_svgid; /* Saved effective group id. */ - int p_refcnt; /* Number of references. */ - struct uidinfo *p_uidinfo; /* Per uid resource consumption */ -}; - - #ifdef _KERNEL #ifdef MALLOC_DECLARE @@ -325,8 +304,8 @@ MALLOC_DECLARE(M_PARGS); /* Handy macro to determine of p1 can mangle p2 */ -#define PRISON_CHECK(p1, p2) \ - ((!(p1)->p_prison) || (p1)->p_prison == (p2)->p_prison) +#define PRISON_CHECK(cr1, cr2) \ + ((!(cr1)->cr_prison) || (cr1)->cr_prison == (cr2)->cr_prison) /* * We use process IDs <= PID_MAX; PID_MAX + 1 must also fit in a pid_t, @@ -427,22 +406,23 @@ int inferior __P((struct proc *p)); int leavepgrp __P((struct proc *p)); void mi_switch __P((void)); void procinit __P((void)); -int p_trespass __P((struct proc *p1, struct proc *p2)); +int p_trespass __P((struct ucred *cr1, struct ucred *cr2)); void resetpriority __P((struct proc *)); int roundrobin_interval __P((void)); void schedclock __P((struct proc *)); void setrunnable __P((struct proc *)); void setrunqueue __P((struct proc *)); void sleepinit __P((void)); -int suser __P((struct proc *)); -int suser_xxx __P((struct ucred *cred, struct proc *proc, int flag)); +int suser __P((void)); +int suser_proc __P((struct proc *p)); +int suser_xxx __P((struct ucred *cred, int flag)); void remrunqueue __P((struct proc *)); void cpu_heavy_switch __P((struct thread *)); void cpu_lwkt_switch __P((struct thread *)); void unsleep __P((struct proc *)); void cpu_exit __P((struct proc *)) __dead2; -void exit1 __P((struct proc *, int)) __dead2; +void exit1 __P((int)) __dead2; void cpu_fork __P((struct proc *, struct proc *, int)); void cpu_set_fork_handler __P((struct proc *, void (*)(void *), void *)); int fork1 __P((struct proc *, int, struct proc **)); @@ -450,7 +430,7 @@ void start_forked_proc __P((struct proc *, struct proc *)); int trace_req __P((struct proc *)); void cpu_wait __P((struct proc *)); int cpu_coredump __P((struct proc *, struct vnode *, struct ucred *)); -void setsugid __P((struct proc *p)); +void setsugid __P((void)); void faultin __P((struct proc *p)); struct proc * chooseproc __P((void)); diff --git a/sys/sys/random.h b/sys/sys/random.h index 09d3b455ad..bb632aa917 100644 --- a/sys/sys/random.h +++ b/sys/sys/random.h @@ -2,7 +2,7 @@ * random.h -- A strong random number generator * * $FreeBSD: src/sys/sys/random.h,v 1.19.2.2 2002/09/17 17:11:54 sam Exp $ - * $DragonFly: src/sys/sys/random.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/random.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ * * Version 0.95, last modified 18-Oct-95 * @@ -85,8 +85,8 @@ u_int read_random_unlimited(void *buf, u_int size); #ifdef notused u_int write_random(const char *buf, u_int nbytes); #endif -struct proc; -int random_poll(dev_t dev, int events, struct proc *p); +struct thread; +int random_poll(dev_t dev, int events, struct thread *td); #endif /* _KERNEL */ diff --git a/sys/sys/select.h b/sys/sys/select.h index 059a4a137d..0243eb6669 100644 --- a/sys/sys/select.h +++ b/sys/sys/select.h @@ -32,7 +32,7 @@ * * @(#)select.h 8.2 (Berkeley) 1/4/94 * $FreeBSD: src/sys/sys/select.h,v 1.6.2.1 2000/05/05 03:50:02 jlemon Exp $ - * $DragonFly: src/sys/sys/select.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/select.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ */ #ifndef _SYS_SELECT_H_ @@ -52,9 +52,9 @@ struct selinfo { #define SI_COLL 0x0001 /* collision occurred */ #ifdef _KERNEL -struct proc; +struct thread; -void selrecord __P((struct proc *selector, struct selinfo *)); +void selrecord __P((struct thread *selector, struct selinfo *)); void selwakeup __P((struct selinfo *)); #endif diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h index 3a56044464..7bc098aee6 100644 --- a/sys/sys/signalvar.h +++ b/sys/sys/signalvar.h @@ -32,7 +32,7 @@ * * @(#)signalvar.h 8.6 (Berkeley) 2/19/95 * $FreeBSD: src/sys/sys/signalvar.h,v 1.34.2.1 2000/05/16 06:58:05 dillon Exp $ - * $DragonFly: src/sys/sys/signalvar.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/signalvar.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ */ #ifndef _SYS_SIGNALVAR_H_ /* tmp for user.h */ @@ -208,7 +208,6 @@ void pgsigio __P((struct sigio *, int signum, int checkctty)); void pgsignal __P((struct pgrp *pgrp, int sig, int checkctty)); void postsig __P((int sig)); void psignal __P((struct proc *p, int sig)); -void sigexit __P((struct proc *p, int signum)); void siginit __P((struct proc *p)); void trapsignal __P((struct proc *p, int sig, u_long code)); int __cursig __P((struct proc *p)); @@ -217,6 +216,7 @@ int __cursig __P((struct proc *p)); * Machine-dependent functions: */ void sendsig __P((sig_t action, int sig, sigset_t *retmask, u_long code)); +void sigexit __P((struct proc *p, int sig)); /* * Inline functions: diff --git a/sys/sys/syscall-hide.h b/sys/sys/syscall-hide.h index ef25f6485b..dd2e000365 100644 --- a/sys/sys/syscall-hide.h +++ b/sys/sys/syscall-hide.h @@ -2,8 +2,8 @@ * System call hiders. * * DO NOT EDIT-- this file is automatically generated. - * $DragonFly: src/sys/sys/syscall-hide.h,v 1.2 2003/06/17 04:28:59 dillon Exp $ - * created from TurtleBSD: src/sys/kern/syscalls.master,v 1.1 2003/06/16 06:26:15 dillon Exp + * $DragonFly: src/sys/sys/syscall-hide.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ + * created from TurtleBSD: src/sys/kern/syscalls.master,v 1.2 2003/06/17 04:28:41 dillon Exp */ HIDE_POSIX(fork) diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index b010a69322..a31edc8082 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -2,8 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $DragonFly: src/sys/sys/syscall.h,v 1.2 2003/06/17 04:28:59 dillon Exp $ - * created from TurtleBSD: src/sys/kern/syscalls.master,v 1.1 2003/06/16 06:26:15 dillon Exp + * $DragonFly: src/sys/sys/syscall.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ + * created from TurtleBSD: src/sys/kern/syscalls.master,v 1.2 2003/06/17 04:28:41 dillon Exp */ #define SYS_syscall 0 diff --git a/sys/sys/syscall.mk b/sys/sys/syscall.mk index 75dc9a6d12..05c1ef791b 100644 --- a/sys/sys/syscall.mk +++ b/sys/sys/syscall.mk @@ -1,7 +1,7 @@ # TurtleBSD system call names. # DO NOT EDIT-- this file is automatically generated. -# $DragonFly: src/sys/sys/syscall.mk,v 1.2 2003/06/17 04:28:59 dillon Exp $ -# created from TurtleBSD: src/sys/kern/syscalls.master,v 1.1 2003/06/16 06:26:15 dillon Exp +# $DragonFly: src/sys/sys/syscall.mk,v 1.3 2003/06/23 17:55:50 dillon Exp $ +# created from TurtleBSD: src/sys/kern/syscalls.master,v 1.2 2003/06/17 04:28:41 dillon Exp MIASM = \ syscall.o \ exit.o \ diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 0afc52a0b7..c5f19746ca 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -35,7 +35,7 @@ * * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 * $FreeBSD: src/sys/sys/sysctl.h,v 1.81.2.10 2003/05/01 22:48:09 trhodes Exp $ - * $DragonFly: src/sys/sys/sysctl.h,v 1.2 2003/06/17 04:28:59 dillon Exp $ + * $DragonFly: src/sys/sys/sysctl.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ */ #ifndef _SYS_SYSCTL_H_ @@ -584,13 +584,13 @@ int sysctl_ctx_entry_del(struct sysctl_ctx_list *clist, void sysctl_register_set(struct linker_set *lsp); void sysctl_unregister_set(struct linker_set *lsp); -int kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old, +int kernel_sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval); -int kernel_sysctlbyname(struct proc *p, char *name, +int kernel_sysctlbyname(char *name, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval); -int userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, +int userland_sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen, size_t *retval); int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 3ce0491a72..5b7a8374c7 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/sys/sysent.h,v 1.27.2.5 2002/03/17 11:08:38 alfred Exp $ - * $DragonFly: src/sys/sys/sysent.h,v 1.2 2003/06/17 04:28:59 dillon Exp $ + * $DragonFly: src/sys/sys/sysent.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ */ #ifndef _SYS_SYSENT_H_ @@ -39,7 +39,7 @@ struct proc; -typedef int sy_call_t __P((struct proc *, void *)); +typedef int sy_call_t __P((void *)); struct sysent { /* system call table */ int sy_narg; /* number of arguments */ diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index fff496c7b9..2551873e40 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -2,8 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $DragonFly: src/sys/sys/sysproto.h,v 1.2 2003/06/17 04:28:59 dillon Exp $ - * created from TurtleBSD: src/sys/kern/syscalls.master,v 1.1 2003/06/16 06:26:15 dillon Exp + * $DragonFly: src/sys/sys/sysproto.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ + * created from TurtleBSD: src/sys/kern/syscalls.master,v 1.2 2003/06/17 04:28:41 dillon Exp */ #ifndef _SYS_SYSPROTO_H_ @@ -13,8 +13,6 @@ #include -struct proc; - #define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ 0 : sizeof(register_t) - sizeof(t)) @@ -1021,237 +1019,237 @@ struct sendfile_args { off_t * sbytes; char sbytes_[PAD_(off_t *)]; int flags; char flags_[PAD_(int)]; }; -int nosys __P((struct proc *, struct nosys_args *)); -void sys_exit __P((struct proc *, struct sys_exit_args *)); -int fork __P((struct proc *, struct fork_args *)); -int read __P((struct proc *, struct read_args *)); -int write __P((struct proc *, struct write_args *)); -int open __P((struct proc *, struct open_args *)); -int close __P((struct proc *, struct close_args *)); -int wait4 __P((struct proc *, struct wait_args *)); -int link __P((struct proc *, struct link_args *)); -int unlink __P((struct proc *, struct unlink_args *)); -int chdir __P((struct proc *, struct chdir_args *)); -int fchdir __P((struct proc *, struct fchdir_args *)); -int mknod __P((struct proc *, struct mknod_args *)); -int chmod __P((struct proc *, struct chmod_args *)); -int chown __P((struct proc *, struct chown_args *)); -int obreak __P((struct proc *, struct obreak_args *)); -int getfsstat __P((struct proc *, struct getfsstat_args *)); -int getpid __P((struct proc *, struct getpid_args *)); -int mount __P((struct proc *, struct mount_args *)); -int unmount __P((struct proc *, struct unmount_args *)); -int setuid __P((struct proc *, struct setuid_args *)); -int getuid __P((struct proc *, struct getuid_args *)); -int geteuid __P((struct proc *, struct geteuid_args *)); -int ptrace __P((struct proc *, struct ptrace_args *)); -int recvmsg __P((struct proc *, struct recvmsg_args *)); -int sendmsg __P((struct proc *, struct sendmsg_args *)); -int recvfrom __P((struct proc *, struct recvfrom_args *)); -int accept __P((struct proc *, struct accept_args *)); -int getpeername __P((struct proc *, struct getpeername_args *)); -int getsockname __P((struct proc *, struct getsockname_args *)); -int access __P((struct proc *, struct access_args *)); -int chflags __P((struct proc *, struct chflags_args *)); -int fchflags __P((struct proc *, struct fchflags_args *)); -int sync __P((struct proc *, struct sync_args *)); -int kill __P((struct proc *, struct kill_args *)); -int getppid __P((struct proc *, struct getppid_args *)); -int dup __P((struct proc *, struct dup_args *)); -int pipe __P((struct proc *, struct pipe_args *)); -int getegid __P((struct proc *, struct getegid_args *)); -int profil __P((struct proc *, struct profil_args *)); -int ktrace __P((struct proc *, struct ktrace_args *)); -int getgid __P((struct proc *, struct getgid_args *)); -int getlogin __P((struct proc *, struct getlogin_args *)); -int setlogin __P((struct proc *, struct setlogin_args *)); -int acct __P((struct proc *, struct acct_args *)); -int sigaltstack __P((struct proc *, struct sigaltstack_args *)); -int ioctl __P((struct proc *, struct ioctl_args *)); -int reboot __P((struct proc *, struct reboot_args *)); -int revoke __P((struct proc *, struct revoke_args *)); -int symlink __P((struct proc *, struct symlink_args *)); -int readlink __P((struct proc *, struct readlink_args *)); -int execve __P((struct proc *, struct execve_args *)); -int umask __P((struct proc *, struct umask_args *)); -int chroot __P((struct proc *, struct chroot_args *)); -int msync __P((struct proc *, struct msync_args *)); -int vfork __P((struct proc *, struct vfork_args *)); -int sbrk __P((struct proc *, struct sbrk_args *)); -int sstk __P((struct proc *, struct sstk_args *)); -int ovadvise __P((struct proc *, struct ovadvise_args *)); -int munmap __P((struct proc *, struct munmap_args *)); -int mprotect __P((struct proc *, struct mprotect_args *)); -int madvise __P((struct proc *, struct madvise_args *)); -int mincore __P((struct proc *, struct mincore_args *)); -int getgroups __P((struct proc *, struct getgroups_args *)); -int setgroups __P((struct proc *, struct setgroups_args *)); -int getpgrp __P((struct proc *, struct getpgrp_args *)); -int setpgid __P((struct proc *, struct setpgid_args *)); -int setitimer __P((struct proc *, struct setitimer_args *)); -int swapon __P((struct proc *, struct swapon_args *)); -int getitimer __P((struct proc *, struct getitimer_args *)); -int getdtablesize __P((struct proc *, struct getdtablesize_args *)); -int dup2 __P((struct proc *, struct dup2_args *)); -int fcntl __P((struct proc *, struct fcntl_args *)); -int select __P((struct proc *, struct select_args *)); -int fsync __P((struct proc *, struct fsync_args *)); -int setpriority __P((struct proc *, struct setpriority_args *)); -int socket __P((struct proc *, struct socket_args *)); -int connect __P((struct proc *, struct connect_args *)); -int getpriority __P((struct proc *, struct getpriority_args *)); -int bind __P((struct proc *, struct bind_args *)); -int setsockopt __P((struct proc *, struct setsockopt_args *)); -int listen __P((struct proc *, struct listen_args *)); -int gettimeofday __P((struct proc *, struct gettimeofday_args *)); -int getrusage __P((struct proc *, struct getrusage_args *)); -int getsockopt __P((struct proc *, struct getsockopt_args *)); -int readv __P((struct proc *, struct readv_args *)); -int writev __P((struct proc *, struct writev_args *)); -int settimeofday __P((struct proc *, struct settimeofday_args *)); -int fchown __P((struct proc *, struct fchown_args *)); -int fchmod __P((struct proc *, struct fchmod_args *)); -int setreuid __P((struct proc *, struct setreuid_args *)); -int setregid __P((struct proc *, struct setregid_args *)); -int rename __P((struct proc *, struct rename_args *)); -int flock __P((struct proc *, struct flock_args *)); -int mkfifo __P((struct proc *, struct mkfifo_args *)); -int sendto __P((struct proc *, struct sendto_args *)); -int shutdown __P((struct proc *, struct shutdown_args *)); -int socketpair __P((struct proc *, struct socketpair_args *)); -int mkdir __P((struct proc *, struct mkdir_args *)); -int rmdir __P((struct proc *, struct rmdir_args *)); -int utimes __P((struct proc *, struct utimes_args *)); -int adjtime __P((struct proc *, struct adjtime_args *)); -int setsid __P((struct proc *, struct setsid_args *)); -int quotactl __P((struct proc *, struct quotactl_args *)); -int nfssvc __P((struct proc *, struct nfssvc_args *)); -int statfs __P((struct proc *, struct statfs_args *)); -int fstatfs __P((struct proc *, struct fstatfs_args *)); -int getfh __P((struct proc *, struct getfh_args *)); -int getdomainname __P((struct proc *, struct getdomainname_args *)); -int setdomainname __P((struct proc *, struct setdomainname_args *)); -int uname __P((struct proc *, struct uname_args *)); -int sysarch __P((struct proc *, struct sysarch_args *)); -int rtprio __P((struct proc *, struct rtprio_args *)); -int semsys __P((struct proc *, struct semsys_args *)); -int msgsys __P((struct proc *, struct msgsys_args *)); -int shmsys __P((struct proc *, struct shmsys_args *)); -int pread __P((struct proc *, struct pread_args *)); -int pwrite __P((struct proc *, struct pwrite_args *)); -int ntp_adjtime __P((struct proc *, struct ntp_adjtime_args *)); -int setgid __P((struct proc *, struct setgid_args *)); -int setegid __P((struct proc *, struct setegid_args *)); -int seteuid __P((struct proc *, struct seteuid_args *)); -int stat __P((struct proc *, struct stat_args *)); -int fstat __P((struct proc *, struct fstat_args *)); -int lstat __P((struct proc *, struct lstat_args *)); -int pathconf __P((struct proc *, struct pathconf_args *)); -int fpathconf __P((struct proc *, struct fpathconf_args *)); -int getrlimit __P((struct proc *, struct __getrlimit_args *)); -int setrlimit __P((struct proc *, struct __setrlimit_args *)); -int getdirentries __P((struct proc *, struct getdirentries_args *)); -int mmap __P((struct proc *, struct mmap_args *)); -int lseek __P((struct proc *, struct lseek_args *)); -int truncate __P((struct proc *, struct truncate_args *)); -int ftruncate __P((struct proc *, struct ftruncate_args *)); -int __sysctl __P((struct proc *, struct sysctl_args *)); -int mlock __P((struct proc *, struct mlock_args *)); -int munlock __P((struct proc *, struct munlock_args *)); -int undelete __P((struct proc *, struct undelete_args *)); -int futimes __P((struct proc *, struct futimes_args *)); -int getpgid __P((struct proc *, struct getpgid_args *)); -int poll __P((struct proc *, struct poll_args *)); -int lkmnosys __P((struct proc *, struct nosys_args *)); -int __semctl __P((struct proc *, struct __semctl_args *)); -int semget __P((struct proc *, struct semget_args *)); -int semop __P((struct proc *, struct semop_args *)); -int msgctl __P((struct proc *, struct msgctl_args *)); -int msgget __P((struct proc *, struct msgget_args *)); -int msgsnd __P((struct proc *, struct msgsnd_args *)); -int msgrcv __P((struct proc *, struct msgrcv_args *)); -int shmat __P((struct proc *, struct shmat_args *)); -int shmctl __P((struct proc *, struct shmctl_args *)); -int shmdt __P((struct proc *, struct shmdt_args *)); -int shmget __P((struct proc *, struct shmget_args *)); -int clock_gettime __P((struct proc *, struct clock_gettime_args *)); -int clock_settime __P((struct proc *, struct clock_settime_args *)); -int clock_getres __P((struct proc *, struct clock_getres_args *)); -int nanosleep __P((struct proc *, struct nanosleep_args *)); -int minherit __P((struct proc *, struct minherit_args *)); -int rfork __P((struct proc *, struct rfork_args *)); -int openbsd_poll __P((struct proc *, struct openbsd_poll_args *)); -int issetugid __P((struct proc *, struct issetugid_args *)); -int lchown __P((struct proc *, struct lchown_args *)); -int getdents __P((struct proc *, struct getdents_args *)); -int lchmod __P((struct proc *, struct lchmod_args *)); -int lutimes __P((struct proc *, struct lutimes_args *)); -int nstat __P((struct proc *, struct nstat_args *)); -int nfstat __P((struct proc *, struct nfstat_args *)); -int nlstat __P((struct proc *, struct nlstat_args *)); -int fhstatfs __P((struct proc *, struct fhstatfs_args *)); -int fhopen __P((struct proc *, struct fhopen_args *)); -int fhstat __P((struct proc *, struct fhstat_args *)); -int modnext __P((struct proc *, struct modnext_args *)); -int modstat __P((struct proc *, struct modstat_args *)); -int modfnext __P((struct proc *, struct modfnext_args *)); -int modfind __P((struct proc *, struct modfind_args *)); -int kldload __P((struct proc *, struct kldload_args *)); -int kldunload __P((struct proc *, struct kldunload_args *)); -int kldfind __P((struct proc *, struct kldfind_args *)); -int kldnext __P((struct proc *, struct kldnext_args *)); -int kldstat __P((struct proc *, struct kldstat_args *)); -int kldfirstmod __P((struct proc *, struct kldfirstmod_args *)); -int getsid __P((struct proc *, struct getsid_args *)); -int setresuid __P((struct proc *, struct setresuid_args *)); -int setresgid __P((struct proc *, struct setresgid_args *)); -int aio_return __P((struct proc *, struct aio_return_args *)); -int aio_suspend __P((struct proc *, struct aio_suspend_args *)); -int aio_cancel __P((struct proc *, struct aio_cancel_args *)); -int aio_error __P((struct proc *, struct aio_error_args *)); -int aio_read __P((struct proc *, struct aio_read_args *)); -int aio_write __P((struct proc *, struct aio_write_args *)); -int lio_listio __P((struct proc *, struct lio_listio_args *)); -int yield __P((struct proc *, struct yield_args *)); -int thr_sleep __P((struct proc *, struct thr_sleep_args *)); -int thr_wakeup __P((struct proc *, struct thr_wakeup_args *)); -int mlockall __P((struct proc *, struct mlockall_args *)); -int munlockall __P((struct proc *, struct munlockall_args *)); -int __getcwd __P((struct proc *, struct __getcwd_args *)); -int sched_setparam __P((struct proc *, struct sched_setparam_args *)); -int sched_getparam __P((struct proc *, struct sched_getparam_args *)); -int sched_setscheduler __P((struct proc *, struct sched_setscheduler_args *)); -int sched_getscheduler __P((struct proc *, struct sched_getscheduler_args *)); -int sched_yield __P((struct proc *, struct sched_yield_args *)); -int sched_get_priority_max __P((struct proc *, struct sched_get_priority_max_args *)); -int sched_get_priority_min __P((struct proc *, struct sched_get_priority_min_args *)); -int sched_rr_get_interval __P((struct proc *, struct sched_rr_get_interval_args *)); -int utrace __P((struct proc *, struct utrace_args *)); -int kldsym __P((struct proc *, struct kldsym_args *)); -int jail __P((struct proc *, struct jail_args *)); -int sigprocmask __P((struct proc *, struct sigprocmask_args *)); -int sigsuspend __P((struct proc *, struct sigsuspend_args *)); -int sigaction __P((struct proc *, struct sigaction_args *)); -int sigpending __P((struct proc *, struct sigpending_args *)); -int sigreturn __P((struct proc *, struct sigreturn_args *)); -int __acl_get_file __P((struct proc *, struct __acl_get_file_args *)); -int __acl_set_file __P((struct proc *, struct __acl_set_file_args *)); -int __acl_get_fd __P((struct proc *, struct __acl_get_fd_args *)); -int __acl_set_fd __P((struct proc *, struct __acl_set_fd_args *)); -int __acl_delete_file __P((struct proc *, struct __acl_delete_file_args *)); -int __acl_delete_fd __P((struct proc *, struct __acl_delete_fd_args *)); -int __acl_aclcheck_file __P((struct proc *, struct __acl_aclcheck_file_args *)); -int __acl_aclcheck_fd __P((struct proc *, struct __acl_aclcheck_fd_args *)); -int extattrctl __P((struct proc *, struct extattrctl_args *)); -int extattr_set_file __P((struct proc *, struct extattr_set_file_args *)); -int extattr_get_file __P((struct proc *, struct extattr_get_file_args *)); -int extattr_delete_file __P((struct proc *, struct extattr_delete_file_args *)); -int aio_waitcomplete __P((struct proc *, struct aio_waitcomplete_args *)); -int getresuid __P((struct proc *, struct getresuid_args *)); -int getresgid __P((struct proc *, struct getresgid_args *)); -int kqueue __P((struct proc *, struct kqueue_args *)); -int kevent __P((struct proc *, struct kevent_args *)); -int sendfile __P((struct proc *, struct sendfile_args *)); +int nosys __P((struct nosys_args *)); +void sys_exit __P((struct sys_exit_args *)); +int fork __P((struct fork_args *)); +int read __P((struct read_args *)); +int write __P((struct write_args *)); +int open __P((struct open_args *)); +int close __P((struct close_args *)); +int wait4 __P((struct wait_args *)); +int link __P((struct link_args *)); +int unlink __P((struct unlink_args *)); +int chdir __P((struct chdir_args *)); +int fchdir __P((struct fchdir_args *)); +int mknod __P((struct mknod_args *)); +int chmod __P((struct chmod_args *)); +int chown __P((struct chown_args *)); +int obreak __P((struct obreak_args *)); +int getfsstat __P((struct getfsstat_args *)); +int getpid __P((struct getpid_args *)); +int mount __P((struct mount_args *)); +int unmount __P((struct unmount_args *)); +int setuid __P((struct setuid_args *)); +int getuid __P((struct getuid_args *)); +int geteuid __P((struct geteuid_args *)); +int ptrace __P((struct ptrace_args *)); +int recvmsg __P((struct recvmsg_args *)); +int sendmsg __P((struct sendmsg_args *)); +int recvfrom __P((struct recvfrom_args *)); +int accept __P((struct accept_args *)); +int getpeername __P((struct getpeername_args *)); +int getsockname __P((struct getsockname_args *)); +int access __P((struct access_args *)); +int chflags __P((struct chflags_args *)); +int fchflags __P((struct fchflags_args *)); +int sync __P((struct sync_args *)); +int kill __P((struct kill_args *)); +int getppid __P((struct getppid_args *)); +int dup __P((struct dup_args *)); +int pipe __P((struct pipe_args *)); +int getegid __P((struct getegid_args *)); +int profil __P((struct profil_args *)); +int ktrace __P((struct ktrace_args *)); +int getgid __P((struct getgid_args *)); +int getlogin __P((struct getlogin_args *)); +int setlogin __P((struct setlogin_args *)); +int acct __P((struct acct_args *)); +int sigaltstack __P((struct sigaltstack_args *)); +int ioctl __P((struct ioctl_args *)); +int reboot __P((struct reboot_args *)); +int revoke __P((struct revoke_args *)); +int symlink __P((struct symlink_args *)); +int readlink __P((struct readlink_args *)); +int execve __P((struct execve_args *)); +int umask __P((struct umask_args *)); +int chroot __P((struct chroot_args *)); +int msync __P((struct msync_args *)); +int vfork __P((struct vfork_args *)); +int sbrk __P((struct sbrk_args *)); +int sstk __P((struct sstk_args *)); +int ovadvise __P((struct ovadvise_args *)); +int munmap __P((struct munmap_args *)); +int mprotect __P((struct mprotect_args *)); +int madvise __P((struct madvise_args *)); +int mincore __P((struct mincore_args *)); +int getgroups __P((struct getgroups_args *)); +int setgroups __P((struct setgroups_args *)); +int getpgrp __P((struct getpgrp_args *)); +int setpgid __P((struct setpgid_args *)); +int setitimer __P((struct setitimer_args *)); +int swapon __P((struct swapon_args *)); +int getitimer __P((struct getitimer_args *)); +int getdtablesize __P((struct getdtablesize_args *)); +int dup2 __P((struct dup2_args *)); +int fcntl __P((struct fcntl_args *)); +int select __P((struct select_args *)); +int fsync __P((struct fsync_args *)); +int setpriority __P((struct setpriority_args *)); +int socket __P((struct socket_args *)); +int connect __P((struct connect_args *)); +int getpriority __P((struct getpriority_args *)); +int bind __P((struct bind_args *)); +int setsockopt __P((struct setsockopt_args *)); +int listen __P((struct listen_args *)); +int gettimeofday __P((struct gettimeofday_args *)); +int getrusage __P((struct getrusage_args *)); +int getsockopt __P((struct getsockopt_args *)); +int readv __P((struct readv_args *)); +int writev __P((struct writev_args *)); +int settimeofday __P((struct settimeofday_args *)); +int fchown __P((struct fchown_args *)); +int fchmod __P((struct fchmod_args *)); +int setreuid __P((struct setreuid_args *)); +int setregid __P((struct setregid_args *)); +int rename __P((struct rename_args *)); +int flock __P((struct flock_args *)); +int mkfifo __P((struct mkfifo_args *)); +int sendto __P((struct sendto_args *)); +int shutdown __P((struct shutdown_args *)); +int socketpair __P((struct socketpair_args *)); +int mkdir __P((struct mkdir_args *)); +int rmdir __P((struct rmdir_args *)); +int utimes __P((struct utimes_args *)); +int adjtime __P((struct adjtime_args *)); +int setsid __P((struct setsid_args *)); +int quotactl __P((struct quotactl_args *)); +int nfssvc __P((struct nfssvc_args *)); +int statfs __P((struct statfs_args *)); +int fstatfs __P((struct fstatfs_args *)); +int getfh __P((struct getfh_args *)); +int getdomainname __P((struct getdomainname_args *)); +int setdomainname __P((struct setdomainname_args *)); +int uname __P((struct uname_args *)); +int sysarch __P((struct sysarch_args *)); +int rtprio __P((struct rtprio_args *)); +int semsys __P((struct semsys_args *)); +int msgsys __P((struct msgsys_args *)); +int shmsys __P((struct shmsys_args *)); +int pread __P((struct pread_args *)); +int pwrite __P((struct pwrite_args *)); +int ntp_adjtime __P((struct ntp_adjtime_args *)); +int setgid __P((struct setgid_args *)); +int setegid __P((struct setegid_args *)); +int seteuid __P((struct seteuid_args *)); +int stat __P((struct stat_args *)); +int fstat __P((struct fstat_args *)); +int lstat __P((struct lstat_args *)); +int pathconf __P((struct pathconf_args *)); +int fpathconf __P((struct fpathconf_args *)); +int getrlimit __P((struct __getrlimit_args *)); +int setrlimit __P((struct __setrlimit_args *)); +int getdirentries __P((struct getdirentries_args *)); +int mmap __P((struct mmap_args *)); +int lseek __P((struct lseek_args *)); +int truncate __P((struct truncate_args *)); +int ftruncate __P((struct ftruncate_args *)); +int __sysctl __P((struct sysctl_args *)); +int mlock __P((struct mlock_args *)); +int munlock __P((struct munlock_args *)); +int undelete __P((struct undelete_args *)); +int futimes __P((struct futimes_args *)); +int getpgid __P((struct getpgid_args *)); +int poll __P((struct poll_args *)); +int lkmnosys __P((struct nosys_args *)); +int __semctl __P((struct __semctl_args *)); +int semget __P((struct semget_args *)); +int semop __P((struct semop_args *)); +int msgctl __P((struct msgctl_args *)); +int msgget __P((struct msgget_args *)); +int msgsnd __P((struct msgsnd_args *)); +int msgrcv __P((struct msgrcv_args *)); +int shmat __P((struct shmat_args *)); +int shmctl __P((struct shmctl_args *)); +int shmdt __P((struct shmdt_args *)); +int shmget __P((struct shmget_args *)); +int clock_gettime __P((struct clock_gettime_args *)); +int clock_settime __P((struct clock_settime_args *)); +int clock_getres __P((struct clock_getres_args *)); +int nanosleep __P((struct nanosleep_args *)); +int minherit __P((struct minherit_args *)); +int rfork __P((struct rfork_args *)); +int openbsd_poll __P((struct openbsd_poll_args *)); +int issetugid __P((struct issetugid_args *)); +int lchown __P((struct lchown_args *)); +int getdents __P((struct getdents_args *)); +int lchmod __P((struct lchmod_args *)); +int lutimes __P((struct lutimes_args *)); +int nstat __P((struct nstat_args *)); +int nfstat __P((struct nfstat_args *)); +int nlstat __P((struct nlstat_args *)); +int fhstatfs __P((struct fhstatfs_args *)); +int fhopen __P((struct fhopen_args *)); +int fhstat __P((struct fhstat_args *)); +int modnext __P((struct modnext_args *)); +int modstat __P((struct modstat_args *)); +int modfnext __P((struct modfnext_args *)); +int modfind __P((struct modfind_args *)); +int kldload __P((struct kldload_args *)); +int kldunload __P((struct kldunload_args *)); +int kldfind __P((struct kldfind_args *)); +int kldnext __P((struct kldnext_args *)); +int kldstat __P((struct kldstat_args *)); +int kldfirstmod __P((struct kldfirstmod_args *)); +int getsid __P((struct getsid_args *)); +int setresuid __P((struct setresuid_args *)); +int setresgid __P((struct setresgid_args *)); +int aio_return __P((struct aio_return_args *)); +int aio_suspend __P((struct aio_suspend_args *)); +int aio_cancel __P((struct aio_cancel_args *)); +int aio_error __P((struct aio_error_args *)); +int aio_read __P((struct aio_read_args *)); +int aio_write __P((struct aio_write_args *)); +int lio_listio __P((struct lio_listio_args *)); +int yield __P((struct yield_args *)); +int thr_sleep __P((struct thr_sleep_args *)); +int thr_wakeup __P((struct thr_wakeup_args *)); +int mlockall __P((struct mlockall_args *)); +int munlockall __P((struct munlockall_args *)); +int __getcwd __P((struct __getcwd_args *)); +int sched_setparam __P((struct sched_setparam_args *)); +int sched_getparam __P((struct sched_getparam_args *)); +int sched_setscheduler __P((struct sched_setscheduler_args *)); +int sched_getscheduler __P((struct sched_getscheduler_args *)); +int sched_yield __P((struct sched_yield_args *)); +int sched_get_priority_max __P((struct sched_get_priority_max_args *)); +int sched_get_priority_min __P((struct sched_get_priority_min_args *)); +int sched_rr_get_interval __P((struct sched_rr_get_interval_args *)); +int utrace __P((struct utrace_args *)); +int kldsym __P((struct kldsym_args *)); +int jail __P((struct jail_args *)); +int sigprocmask __P((struct sigprocmask_args *)); +int sigsuspend __P((struct sigsuspend_args *)); +int sigaction __P((struct sigaction_args *)); +int sigpending __P((struct sigpending_args *)); +int sigreturn __P((struct sigreturn_args *)); +int __acl_get_file __P((struct __acl_get_file_args *)); +int __acl_set_file __P((struct __acl_set_file_args *)); +int __acl_get_fd __P((struct __acl_get_fd_args *)); +int __acl_set_fd __P((struct __acl_set_fd_args *)); +int __acl_delete_file __P((struct __acl_delete_file_args *)); +int __acl_delete_fd __P((struct __acl_delete_fd_args *)); +int __acl_aclcheck_file __P((struct __acl_aclcheck_file_args *)); +int __acl_aclcheck_fd __P((struct __acl_aclcheck_fd_args *)); +int extattrctl __P((struct extattrctl_args *)); +int extattr_set_file __P((struct extattr_set_file_args *)); +int extattr_get_file __P((struct extattr_get_file_args *)); +int extattr_delete_file __P((struct extattr_delete_file_args *)); +int aio_waitcomplete __P((struct aio_waitcomplete_args *)); +int getresuid __P((struct getresuid_args *)); +int getresgid __P((struct getresgid_args *)); +int kqueue __P((struct kqueue_args *)); +int kevent __P((struct kevent_args *)); +int sendfile __P((struct sendfile_args *)); #ifdef COMPAT_43 @@ -1393,44 +1391,44 @@ struct osendfile_args { off_t * sbytes; char sbytes_[PAD_(off_t *)]; int flags; char flags_[PAD_(int)]; }; -int ocreat __P((struct proc *, struct ocreat_args *)); -int olseek __P((struct proc *, struct olseek_args *)); -int ostat __P((struct proc *, struct ostat_args *)); -int olstat __P((struct proc *, struct olstat_args *)); -int osigaction __P((struct proc *, struct osigaction_args *)); -int osigprocmask __P((struct proc *, struct osigprocmask_args *)); -int osigpending __P((struct proc *, struct osigpending_args *)); -int ofstat __P((struct proc *, struct ofstat_args *)); -int ogetkerninfo __P((struct proc *, struct getkerninfo_args *)); -int ogetpagesize __P((struct proc *, struct getpagesize_args *)); -int ommap __P((struct proc *, struct ommap_args *)); -int owait __P((struct proc *, struct owait_args *)); -int ogethostname __P((struct proc *, struct gethostname_args *)); -int osethostname __P((struct proc *, struct sethostname_args *)); -int oaccept __P((struct proc *, struct accept_args *)); -int osend __P((struct proc *, struct osend_args *)); -int orecv __P((struct proc *, struct orecv_args *)); -int osigreturn __P((struct proc *, struct osigreturn_args *)); -int osigvec __P((struct proc *, struct osigvec_args *)); -int osigblock __P((struct proc *, struct osigblock_args *)); -int osigsetmask __P((struct proc *, struct osigsetmask_args *)); -int osigsuspend __P((struct proc *, struct osigsuspend_args *)); -int osigstack __P((struct proc *, struct osigstack_args *)); -int orecvmsg __P((struct proc *, struct orecvmsg_args *)); -int osendmsg __P((struct proc *, struct osendmsg_args *)); -int orecvfrom __P((struct proc *, struct recvfrom_args *)); -int otruncate __P((struct proc *, struct otruncate_args *)); -int oftruncate __P((struct proc *, struct oftruncate_args *)); -int ogetpeername __P((struct proc *, struct ogetpeername_args *)); -int ogethostid __P((struct proc *, struct ogethostid_args *)); -int osethostid __P((struct proc *, struct osethostid_args *)); -int ogetrlimit __P((struct proc *, struct ogetrlimit_args *)); -int osetrlimit __P((struct proc *, struct osetrlimit_args *)); -int okillpg __P((struct proc *, struct okillpg_args *)); -int oquota __P((struct proc *, struct oquota_args *)); -int ogetsockname __P((struct proc *, struct getsockname_args *)); -int ogetdirentries __P((struct proc *, struct ogetdirentries_args *)); -int osendfile __P((struct proc *, struct osendfile_args *)); +int ocreat __P((struct ocreat_args *)); +int olseek __P((struct olseek_args *)); +int ostat __P((struct ostat_args *)); +int olstat __P((struct olstat_args *)); +int osigaction __P((struct osigaction_args *)); +int osigprocmask __P((struct osigprocmask_args *)); +int osigpending __P((struct osigpending_args *)); +int ofstat __P((struct ofstat_args *)); +int ogetkerninfo __P((struct getkerninfo_args *)); +int ogetpagesize __P((struct getpagesize_args *)); +int ommap __P((struct ommap_args *)); +int owait __P((struct owait_args *)); +int ogethostname __P((struct gethostname_args *)); +int osethostname __P((struct sethostname_args *)); +int oaccept __P((struct accept_args *)); +int osend __P((struct osend_args *)); +int orecv __P((struct orecv_args *)); +int osigreturn __P((struct osigreturn_args *)); +int osigvec __P((struct osigvec_args *)); +int osigblock __P((struct osigblock_args *)); +int osigsetmask __P((struct osigsetmask_args *)); +int osigsuspend __P((struct osigsuspend_args *)); +int osigstack __P((struct osigstack_args *)); +int orecvmsg __P((struct orecvmsg_args *)); +int osendmsg __P((struct osendmsg_args *)); +int orecvfrom __P((struct recvfrom_args *)); +int otruncate __P((struct otruncate_args *)); +int oftruncate __P((struct oftruncate_args *)); +int ogetpeername __P((struct ogetpeername_args *)); +int ogethostid __P((struct ogethostid_args *)); +int osethostid __P((struct osethostid_args *)); +int ogetrlimit __P((struct ogetrlimit_args *)); +int osetrlimit __P((struct osetrlimit_args *)); +int okillpg __P((struct okillpg_args *)); +int oquota __P((struct oquota_args *)); +int ogetsockname __P((struct getsockname_args *)); +int ogetdirentries __P((struct ogetdirentries_args *)); +int osendfile __P((struct osendfile_args *)); #endif /* COMPAT_43 */ diff --git a/sys/sys/systm.h b/sys/sys/systm.h index e9c0040e53..656ca943b7 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -37,7 +37,7 @@ * * @(#)systm.h 8.7 (Berkeley) 3/29/95 * $FreeBSD: src/sys/sys/systm.h,v 1.111.2.18 2002/12/17 18:04:02 sam Exp $ - * $DragonFly: src/sys/sys/systm.h,v 1.4 2003/06/21 07:54:57 dillon Exp $ + * $DragonFly: src/sys/sys/systm.h,v 1.5 2003/06/23 17:55:50 dillon Exp $ */ #ifndef _SYS_SYSTM_H_ @@ -79,6 +79,7 @@ extern int maxusers; /* system tune hint */ #ifdef INVARIANTS /* The option is always available */ #define KASSERT(exp,msg) do { if (!(exp)) panic msg; } while (0) +#define KKASSERT(exp) if (!(exp)) panic("assertion: " #exp " in " __FUNCTION__) #define SPLASSERT(level, msg) __CONCAT(__CONCAT(spl,level),assert)(msg) #define CONDSPLASSERT(cond, level, msg) do { \ if (cond) \ @@ -86,6 +87,7 @@ extern int maxusers; /* system tune hint */ } while (0) #else #define KASSERT(exp,msg) +#define KKASSERT(exp) #define SPLASSERT(level, msg) #define CONDSPLASSERT(cond, level, msg) #endif @@ -102,6 +104,7 @@ struct timeval; struct tty; struct uio; struct globaldata; +struct thread; void Debugger __P((const char *msg)); void mi_gdinit __P((struct globaldata *gd, int cpu)); @@ -109,7 +112,7 @@ int dumpstatus __P((vm_offset_t addr, off_t count)); int nullop __P((void)); int eopnotsupp __P((void)); int einval __P((void)); -int seltrue __P((dev_t dev, int which, struct proc *p)); +int seltrue __P((dev_t dev, int which, struct thread *td)); int ureadc __P((int, struct uio *)); void *hashinit __P((int count, struct malloc_type *type, u_long *hashmask)); void *phashinit __P((int count, struct malloc_type *type, u_long *nentries)); diff --git a/sys/sys/tty.h b/sys/sys/tty.h index d31919775e..e758845060 100644 --- a/sys/sys/tty.h +++ b/sys/sys/tty.h @@ -37,7 +37,7 @@ * * @(#)tty.h 8.6 (Berkeley) 1/21/94 * $FreeBSD: src/sys/sys/tty.h,v 1.53.2.1 2001/02/26 04:23:21 jlemon Exp $ - * $DragonFly: src/sys/sys/tty.h,v 1.2 2003/06/17 04:28:59 dillon Exp $ + * $DragonFly: src/sys/sys/tty.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ */ #ifndef _SYS_TTY_H_ @@ -263,7 +263,7 @@ int ttylclose __P((struct tty *tp, int flag)); struct tty *ttymalloc __P((struct tty *tp)); int ttymodem __P((struct tty *tp, int flag)); int ttyopen __P((dev_t device, struct tty *tp)); -int ttypoll __P((dev_t dev, int events, struct proc *p)); +int ttypoll __P((dev_t dev, int events, struct thread *td)); int ttykqfilter __P((dev_t dev, struct knote *kn)); int ttyread __P((dev_t dev, struct uio *uio, int flag)); void ttyregister __P((struct tty *tp)); diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h index db9148a7c5..5fd333045e 100644 --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -32,12 +32,14 @@ * * @(#)ucred.h 8.4 (Berkeley) 1/9/95 * $FreeBSD: src/sys/sys/ucred.h,v 1.14.2.5 2002/03/09 05:20:25 dd Exp $ - * $DragonFly: src/sys/sys/ucred.h,v 1.2 2003/06/17 04:28:59 dillon Exp $ + * $DragonFly: src/sys/sys/ucred.h,v 1.3 2003/06/23 17:55:50 dillon Exp $ */ #ifndef _SYS_UCRED_H_ #define _SYS_UCRED_H_ +struct prison; + /* * Credentials. * @@ -50,6 +52,13 @@ struct ucred { short cr_ngroups; /* number of groups */ gid_t cr_groups[NGROUPS]; /* groups */ struct uidinfo *cr_uidinfo; /* per uid resource consumption */ + struct uidinfo *cr_ruidinfo; /* per ruid resource consumption */ + struct prison *cr_prison; /* prison info */ + uid_t cr_ruid; /* Real user id. */ + uid_t cr_svuid; /* Saved effective user id. */ + gid_t cr_rgid; /* Real group id. */ + gid_t cr_svgid; /* Saved effective group id. */ + int cr_refcnt; /* Number of references. */ }; #define cr_gid cr_groups[0] #define NOCRED ((struct ucred *)0) /* no credential available */ @@ -73,8 +82,8 @@ struct xucred { struct proc; -void change_euid __P((struct proc *p, uid_t euid)); -void change_ruid __P((struct proc *p, uid_t ruid)); +void change_euid __P((uid_t euid)); +void change_ruid __P((uid_t ruid)); struct ucred *crcopy __P((struct ucred *cr)); struct ucred *crdup __P((struct ucred *cr)); void crfree __P((struct ucred *cr)); diff --git a/sys/sys/user.h b/sys/sys/user.h index e1bb7270e4..8a6ce96ba1 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -32,7 +32,7 @@ * * @(#)user.h 8.2 (Berkeley) 9/23/93 * $FreeBSD: src/sys/sys/user.h,v 1.24.2.1 2001/10/11 08:20:18 peter Exp $ - * $DragonFly: src/sys/sys/user.h,v 1.3 2003/06/18 18:30:11 dillon Exp $ + * $DragonFly: src/sys/sys/user.h,v 1.4 2003/06/23 17:55:50 dillon Exp $ */ #ifndef _SYS_USER_H_ @@ -68,7 +68,6 @@ struct kinfo_proc { struct eproc { struct proc *e_paddr; /* address of proc */ struct session *e_sess; /* session pointer */ - struct pcred e_pcred; /* process credentials */ struct ucred e_ucred; /* current credentials */ struct procsig e_procsig; /* shared signal structure */ struct vmspace e_vm; /* address space */ diff --git a/sys/vfs/coda/coda_psdev.c b/sys/vfs/coda/coda_psdev.c index bd921fa4e1..b52cbb1006 100644 --- a/sys/vfs/coda/coda_psdev.c +++ b/sys/vfs/coda/coda_psdev.c @@ -28,7 +28,7 @@ * * @(#) src/sys/coda/coda_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * $FreeBSD: src/sys/coda/coda_psdev.c,v 1.13 1999/09/29 15:03:46 marcel Exp $ - * $DragonFly: src/sys/vfs/coda/Attic/coda_psdev.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/vfs/coda/Attic/coda_psdev.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ * */ @@ -116,11 +116,7 @@ vcodaattach(n) } int -vc_nb_open(dev, flag, mode, p) - dev_t dev; - int flag; - int mode; - struct proc *p; /* NetBSD only */ +vc_nb_open(dev_t dev, int flag, int mode, d_thread_t *td) { register struct vcomm *vcp; @@ -148,19 +144,19 @@ vc_nb_open(dev, flag, mode, p) } int -vc_nb_close (dev, flag, mode, p) - dev_t dev; - int flag; - int mode; - struct proc *p; +vc_nb_close (dev_t dev, int flag, int mode, d_thread_t *td) { - register struct vcomm *vcp; - register struct vmsg *vmp, *nvmp = NULL; + struct vcomm *vcp; + struct vmsg *vmp, *nvmp = NULL; struct coda_mntinfo *mi; + struct proc *p; int err; ENTRY; + p = td->td_proc; + KKASSERT(p != NULL); + if (minor(dev) >= NVCODA || minor(dev) < 0) return(ENXIO); @@ -386,12 +382,7 @@ vc_nb_write(dev, uiop, flag) } int -vc_nb_ioctl(dev, cmd, addr, flag, p) - dev_t dev; - u_long cmd; - caddr_t addr; - int flag; - struct proc *p; +vc_nb_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td) { ENTRY; @@ -440,10 +431,7 @@ vc_nb_ioctl(dev, cmd, addr, flag, p) } int -vc_nb_poll(dev, events, p) - dev_t dev; - int events; - struct proc *p; +vc_nb_poll(dev_t dev, int events, d_thread_t *td) { register struct vcomm *vcp; int event_msk = 0; @@ -462,7 +450,7 @@ vc_nb_poll(dev, events, p) if (!EMPTY(vcp->vc_requests)) return(events & (POLLIN|POLLRDNORM)); - selrecord(p, &(vcp->vc_selproc)); + selrecord(td, &(vcp->vc_selproc)); return(0); } diff --git a/sys/vfs/coda/coda_psdev.h b/sys/vfs/coda/coda_psdev.h index 547211f6cd..fa92e3c957 100644 --- a/sys/vfs/coda/coda_psdev.h +++ b/sys/vfs/coda/coda_psdev.h @@ -28,13 +28,13 @@ * * @(#) src/sys/coda/coda_psdev.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * $FreeBSD: src/sys/coda/coda_psdev.h,v 1.2 1999/08/28 00:40:55 peter Exp $ - * $DragonFly: src/sys/vfs/coda/Attic/coda_psdev.h,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/vfs/coda/Attic/coda_psdev.h,v 1.3 2003/06/23 17:55:26 dillon Exp $ * */ -int vc_nb_open(dev_t dev, int flag, int mode, struct proc *p); -int vc_nb_close (dev_t dev, int flag, int mode, struct proc *p); +int vc_nb_open(dev_t dev, int flag, int mode, d_thread_t *td); +int vc_nb_close (dev_t dev, int flag, int mode, d_thread_t *td); int vc_nb_read(dev_t dev, struct uio *uiop, int flag); int vc_nb_write(dev_t dev, struct uio *uiop, int flag); -int vc_nb_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p); -int vc_nb_poll(dev_t dev, int events, struct proc *p); +int vc_nb_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td); +int vc_nb_poll(dev_t dev, int events, d_thread_t *td); diff --git a/sys/vfs/coda/coda_vfsops.c b/sys/vfs/coda/coda_vfsops.c index 92f06f3442..8c46281f20 100644 --- a/sys/vfs/coda/coda_vfsops.c +++ b/sys/vfs/coda/coda_vfsops.c @@ -28,7 +28,7 @@ * * @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $ * $FreeBSD: src/sys/coda/coda_vfsops.c,v 1.24.2.1 2001/07/26 20:36:45 iedowse Exp $ - * $DragonFly: src/sys/vfs/coda/Attic/coda_vfsops.c,v 1.2 2003/06/17 04:28:19 dillon Exp $ + * $DragonFly: src/sys/vfs/coda/Attic/coda_vfsops.c,v 1.3 2003/06/23 17:55:26 dillon Exp $ * */ @@ -85,7 +85,7 @@ struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE]; #define MRAK_INT_GEN(op) (coda_vfsopstats[op].gen_intrn++) extern int coda_nc_initialized; /* Set if cache has been initialized */ -extern int vc_nb_open __P((dev_t, int, int, struct proc *)); +extern int vc_nb_open __P((dev_t, int, int, d_thread_t *)); int coda_vfsopstats_init(void) diff --git a/sys/vfs/fdesc/fdesc_vnops.c b/sys/vfs/fdesc/fdesc_vnops.c index c64c37ec73..bac9d4a500 100644 --- a/sys/vfs/fdesc/fdesc_vnops.c +++ b/sys/vfs/fdesc/fdesc_vnops.c @@ -36,7 +36,7 @@ * @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94 * * $FreeBSD: src/sys/miscfs/fdesc/fdesc_vnops.c,v 1.47.2.1 2001/10/22 22:49:26 chris Exp $ - * $DragonFly: src/sys/vfs/fdesc/fdesc_vnops.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/vfs/fdesc/fdesc_vnops.c,v 1.3 2003/06/23 17:55:43 dillon Exp $ */ /* @@ -485,7 +485,7 @@ fdesc_poll(ap) struct proc *a_p; } */ *ap; { - return seltrue(0, ap->a_events, ap->a_p); + return seltrue(0, ap->a_events, ap->a_p->p_thread); } static int diff --git a/sys/vfs/isofs/cd9660/cd9660_vfsops.c b/sys/vfs/isofs/cd9660/cd9660_vfsops.c index 8053ee87d4..4849457ac2 100644 --- a/sys/vfs/isofs/cd9660/cd9660_vfsops.c +++ b/sys/vfs/isofs/cd9660/cd9660_vfsops.c @@ -37,7 +37,7 @@ * * @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95 * $FreeBSD: src/sys/isofs/cd9660/cd9660_vfsops.c,v 1.74.2.7 2002/04/08 09:39:29 bde Exp $ - * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vfsops.c,v 1.2 2003/06/17 04:28:41 dillon Exp $ + * $DragonFly: src/sys/vfs/isofs/cd9660/cd9660_vfsops.c,v 1.3 2003/06/23 17:55:41 dillon Exp $ */ #include @@ -125,13 +125,13 @@ iso_get_ssector(dev, p) if (ioctlp == NULL) return 0; - if (ioctlp(dev, CDIOREADTOCHEADER, (caddr_t)&h, FREAD, p) != 0) + if (ioctlp(dev, CDIOREADTOCHEADER, (caddr_t)&h, FREAD, p->p_thread) != 0) return 0; for (i = h.ending_track; i >= 0; i--) { t.address_format = CD_LBA_FORMAT; t.track = i; - if (ioctlp(dev, CDIOREADTOCENTRY, (caddr_t)&t, FREAD, p) != 0) + if (ioctlp(dev, CDIOREADTOCENTRY, (caddr_t)&t, FREAD, p->p_thread) != 0) return 0; if ((t.entry.control & 4) != 0) /* found a data track */ @@ -241,7 +241,7 @@ cd9660_mount(mp, path, data, ndp, p) vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); error = VOP_ACCESS(devvp, accessmode, p->p_ucred, p); if (error) - error = suser(p); + error = suser(); if (error) { vput(devvp); return (error); diff --git a/sys/vfs/mfs/mfs_vnops.c b/sys/vfs/mfs/mfs_vnops.c index ff599c7afa..56ed0218ce 100644 --- a/sys/vfs/mfs/mfs_vnops.c +++ b/sys/vfs/mfs/mfs_vnops.c @@ -32,7 +32,7 @@ * * @(#)mfs_vnops.c 8.11 (Berkeley) 5/22/95 * $FreeBSD: src/sys/ufs/mfs/mfs_vnops.c,v 1.47.2.1 2001/05/22 02:06:43 bp Exp $ - * $DragonFly: src/sys/vfs/mfs/mfs_vnops.c,v 1.3 2003/06/19 01:55:08 dillon Exp $ + * $DragonFly: src/sys/vfs/mfs/mfs_vnops.c,v 1.4 2003/06/23 17:55:51 dillon Exp $ */ #include @@ -265,7 +265,7 @@ mfs_doio(bp, mfsp) uap.addr = base; uap.len = bytes; uap.behav = MADV_FREE; - madvise(curproc, &uap); + madvise(&uap); } } bp->b_error = 0; diff --git a/sys/vfs/msdosfs/msdosfs_vnops.c b/sys/vfs/msdosfs/msdosfs_vnops.c index 08f0f79c8c..be1601e82c 100644 --- a/sys/vfs/msdosfs/msdosfs_vnops.c +++ b/sys/vfs/msdosfs/msdosfs_vnops.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/msdosfs/msdosfs_vnops.c,v 1.95.2.4 2003/06/13 15:05:47 trhodes Exp $ */ -/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vnops.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ */ +/* $DragonFly: src/sys/vfs/msdosfs/msdosfs_vnops.c,v 1.4 2003/06/23 17:55:45 dillon Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.68 1998/02/10 14:10:04 mrg Exp $ */ /*- @@ -430,7 +430,7 @@ msdosfs_setattr(ap) if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); if (cred->cr_uid != pmp->pm_uid && - (error = suser_xxx(cred, ap->a_p, PRISON_ROOT))) + (error = suser_xxx(cred, PRISON_ROOT))) return (error); /* * We are very inconsistent about handling unsupported @@ -471,7 +471,7 @@ msdosfs_setattr(ap) gid = pmp->pm_gid; if ((cred->cr_uid != pmp->pm_uid || uid != pmp->pm_uid || (gid != pmp->pm_gid && !groupmember(gid, cred))) && - (error = suser_xxx(cred, ap->a_p, PRISON_ROOT))) + (error = suser_xxx(cred, PRISON_ROOT))) return error; if (uid != pmp->pm_uid || gid != pmp->pm_gid) return EINVAL; @@ -503,7 +503,7 @@ msdosfs_setattr(ap) if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); if (cred->cr_uid != pmp->pm_uid && - (error = suser_xxx(cred, ap->a_p, PRISON_ROOT)) && + (error = suser_xxx(cred, PRISON_ROOT)) && ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || (error = VOP_ACCESS(ap->a_vp, VWRITE, cred, ap->a_p)))) return (error); @@ -532,7 +532,7 @@ msdosfs_setattr(ap) if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); if (cred->cr_uid != pmp->pm_uid && - (error = suser_xxx(cred, ap->a_p, PRISON_ROOT))) + (error = suser_xxx(cred, PRISON_ROOT))) return (error); if (vp->v_type != VDIR) { /* We ignore the read and execute bits. */ diff --git a/sys/vfs/nfs/nfs_serv.c b/sys/vfs/nfs/nfs_serv.c index 3e5838e66c..0e6fbe41fc 100644 --- a/sys/vfs/nfs/nfs_serv.c +++ b/sys/vfs/nfs/nfs_serv.c @@ -35,7 +35,7 @@ * * @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95 * $FreeBSD: src/sys/nfs/nfs_serv.c,v 1.93.2.6 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.3 2003/06/19 01:55:07 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.4 2003/06/23 17:55:48 dillon Exp $ */ /* @@ -1760,7 +1760,7 @@ nfsrv_create(nfsd, slp, procp, mrq) if (vap->va_type == VCHR && rdev == 0xffffffff) vap->va_type = VFIFO; if (vap->va_type != VFIFO && - (error = suser_xxx(cred, 0, 0))) { + (error = suser_xxx(cred, 0))) { goto nfsmreply0; } vap->va_rdev = rdev; @@ -1965,7 +1965,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq) if (error) NDFREE(&nd, NDF_ONLY_PNBUF); } else { - if (vtyp != VFIFO && (error = suser_xxx(cred, 0, 0))) + if (vtyp != VFIFO && (error = suser_xxx(cred, 0))) goto out; nqsrv_getl(nd.ni_dvp, ND_WRITE); diff --git a/sys/vfs/nfs/nfs_syscalls.c b/sys/vfs/nfs/nfs_syscalls.c index 8caa6203ff..aca18bacae 100644 --- a/sys/vfs/nfs/nfs_syscalls.c +++ b/sys/vfs/nfs/nfs_syscalls.c @@ -35,7 +35,7 @@ * * @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_syscalls.c,v 1.58.2.1 2000/11/26 02:30:06 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_syscalls.c,v 1.2 2003/06/17 04:28:54 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_syscalls.c,v 1.3 2003/06/23 17:55:48 dillon Exp $ */ #include @@ -122,22 +122,16 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, gatherdelay_v3, CTLFLAG_RW, &nfsrvw_procrastinate #endif /* NFS_NOSERVER */ /* + * nfssvc_args(int flag, caddr_t argp) + * * Nfs server psuedo system call for the nfsd's * Based on the flag value it either: * - adds a socket to the selection list * - remains in the kernel as an nfsd * - remains in the kernel as an nfsiod */ -#ifndef _SYS_SYSPROTO_H_ -struct nfssvc_args { - int flag; - caddr_t argp; -}; -#endif int -nfssvc(p, uap) - struct proc *p; - register struct nfssvc_args *uap; +nfssvc(struct nfssvc_args *uap) { #ifndef NFS_NOSERVER struct nameidata nd; @@ -152,11 +146,12 @@ nfssvc(p, uap) struct nfsmount *nmp; #endif /* NFS_NOSERVER */ int error; + struct proc *p = curproc; /* * Must be super user */ - error = suser(p); + error = suser(); if(error) return (error); while (nfssvc_sockhead_flag & SLP_INIT) { diff --git a/sys/vfs/nwfs/nwfs_vfsops.c b/sys/vfs/nwfs/nwfs_vfsops.c index fe6bf8ea50..85ce7be0ed 100644 --- a/sys/vfs/nwfs/nwfs_vfsops.c +++ b/sys/vfs/nwfs/nwfs_vfsops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_vfsops.c,v 1.6.2.6 2001/10/25 19:18:54 dillon Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_vfsops.c,v 1.2 2003/06/17 04:28:54 dillon Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_vfsops.c,v 1.3 2003/06/23 17:55:48 dillon Exp $ */ #include "opt_ncp.h" #ifndef NCP @@ -395,7 +395,7 @@ nwfs_init(struct vfsconf *vfsp) name[0] = CTL_HW; name[1] = HW_NCPU; - error = kernel_sysctl(curproc, name, 2, &ncpu, &olen, NULL, 0, &plen); + error = kernel_sysctl(name, 2, &ncpu, &olen, NULL, 0, &plen); if (error == 0 && ncpu > 1) printf("warning: nwfs module compiled without SMP support."); #endif diff --git a/sys/vfs/portal/portal_vnops.c b/sys/vfs/portal/portal_vnops.c index fea4069635..e99c01add3 100644 --- a/sys/vfs/portal/portal_vnops.c +++ b/sys/vfs/portal/portal_vnops.c @@ -36,7 +36,7 @@ * @(#)portal_vnops.c 8.14 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/miscfs/portal/portal_vnops.c,v 1.38 1999/12/21 06:29:00 chris Exp $ - * $DragonFly: src/sys/vfs/portal/portal_vnops.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/vfs/portal/portal_vnops.c,v 1.3 2003/06/23 17:55:43 dillon Exp $ */ /* @@ -87,7 +87,7 @@ portal_closefd(p, fd) struct close_args ua; ua.fd = fd; - error = close(p, &ua); + error = close(&ua); /* * We should never get an error, and there isn't anything * we could do if we got one, so just print a message. diff --git a/sys/vfs/procfs/procfs.h b/sys/vfs/procfs/procfs.h index 32d1935492..632642c61e 100644 --- a/sys/vfs/procfs/procfs.h +++ b/sys/vfs/procfs/procfs.h @@ -38,7 +38,7 @@ * * From: * $FreeBSD: src/sys/miscfs/procfs/procfs.h,v 1.32.2.3 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs.h,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs.h,v 1.3 2003/06/23 17:55:44 dillon Exp $ */ /* @@ -95,11 +95,11 @@ struct pfsnode { ((((pid)+1) << 4) + ((int) (type)))) #define CHECKIO(p1, p2) \ - ((((p1)->p_cred->pc_ucred->cr_uid == (p2)->p_cred->p_ruid) && \ - ((p1)->p_cred->p_ruid == (p2)->p_cred->p_ruid) && \ - ((p1)->p_cred->p_svuid == (p2)->p_cred->p_ruid) && \ + ((((p1)->p_ucred->cr_uid == (p2)->p_ucred->cr_ruid) && \ + ((p1)->p_ucred->cr_ruid == (p2)->p_ucred->cr_ruid) && \ + ((p1)->p_ucred->cr_svuid == (p2)->p_ucred->cr_ruid) && \ ((p2)->p_flag & (P_SUGID|P_INEXEC)) == 0) || \ - (suser_xxx((p1)->p_cred->pc_ucred, (p1), PRISON_ROOT) == 0)) + (suser_xxx((p1)->p_ucred, PRISON_ROOT) == 0)) /* * Convert between pfsnode vnode diff --git a/sys/vfs/procfs/procfs_ctl.c b/sys/vfs/procfs/procfs_ctl.c index 57ed5aabf5..ff2659f904 100644 --- a/sys/vfs/procfs/procfs_ctl.c +++ b/sys/vfs/procfs/procfs_ctl.c @@ -38,7 +38,7 @@ * * From: * $FreeBSD: src/sys/miscfs/procfs/procfs_ctl.c,v 1.20.2.2 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_ctl.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_ctl.c,v 1.3 2003/06/23 17:55:44 dillon Exp $ */ #include @@ -124,7 +124,7 @@ procfs_control(curp, p, op) if (securelevel > 0 && p->p_pid == 1) return (EPERM); - if (!CHECKIO(curp, p) || p_trespass(curp, p)) + if (!CHECKIO(curp, p) || p_trespass(curp->p_ucred, p->p_ucred)) return (EPERM); } diff --git a/sys/vfs/procfs/procfs_dbregs.c b/sys/vfs/procfs/procfs_dbregs.c index 7748a0a288..ccc5bf2209 100644 --- a/sys/vfs/procfs/procfs_dbregs.c +++ b/sys/vfs/procfs/procfs_dbregs.c @@ -41,7 +41,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/miscfs/procfs/procfs_dbregs.c,v 1.4.2.3 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_dbregs.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_dbregs.c,v 1.3 2003/06/23 17:55:44 dillon Exp $ */ #include @@ -66,7 +66,7 @@ procfs_dodbregs(curp, p, pfs, uio) /* Can't trace a process that's currently exec'ing. */ if ((p->p_flag & P_INEXEC) != 0) return EAGAIN; - if (!CHECKIO(curp, p) || p_trespass(curp, p)) + if (!CHECKIO(curp, p) || p_trespass(curp->p_ucred, p->p_ucred)) return (EPERM); kl = sizeof(r); kv = (char *) &r; diff --git a/sys/vfs/procfs/procfs_fpregs.c b/sys/vfs/procfs/procfs_fpregs.c index 3af4627c5e..2d8a240031 100644 --- a/sys/vfs/procfs/procfs_fpregs.c +++ b/sys/vfs/procfs/procfs_fpregs.c @@ -38,7 +38,7 @@ * * From: * $FreeBSD: src/sys/miscfs/procfs/procfs_fpregs.c,v 1.11.2.3 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_fpregs.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_fpregs.c,v 1.3 2003/06/23 17:55:44 dillon Exp $ */ #include @@ -63,7 +63,7 @@ procfs_dofpregs(curp, p, pfs, uio) /* Can't trace a process that's currently exec'ing. */ if ((p->p_flag & P_INEXEC) != 0) return EAGAIN; - if (!CHECKIO(curp, p) || p_trespass(curp, p)) + if (!CHECKIO(curp, p) || p_trespass(curp->p_ucred, p->p_ucred)) return EPERM; kl = sizeof(r); kv = (char *) &r; diff --git a/sys/vfs/procfs/procfs_mem.c b/sys/vfs/procfs/procfs_mem.c index 3220ed678f..b8779e7a22 100644 --- a/sys/vfs/procfs/procfs_mem.c +++ b/sys/vfs/procfs/procfs_mem.c @@ -38,7 +38,7 @@ * @(#)procfs_mem.c 8.5 (Berkeley) 6/15/94 * * $FreeBSD: src/sys/miscfs/procfs/procfs_mem.c,v 1.46.2.3 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_mem.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_mem.c,v 1.3 2003/06/23 17:55:44 dillon Exp $ */ /* @@ -248,7 +248,7 @@ procfs_domem(curp, p, pfs, uio) /* Can't trace a process that's currently exec'ing. */ if ((p->p_flag & P_INEXEC) != 0) return EAGAIN; - if (!CHECKIO(curp, p) || p_trespass(curp, p)) + if (!CHECKIO(curp, p) || p_trespass(curp->p_ucred, p->p_ucred)) return EPERM; return (procfs_rwmem(curp, p, uio)); diff --git a/sys/vfs/procfs/procfs_regs.c b/sys/vfs/procfs/procfs_regs.c index 337f611e30..1b7d123331 100644 --- a/sys/vfs/procfs/procfs_regs.c +++ b/sys/vfs/procfs/procfs_regs.c @@ -38,7 +38,7 @@ * * From: * $FreeBSD: src/sys/miscfs/procfs/procfs_regs.c,v 1.10.2.3 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_regs.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_regs.c,v 1.3 2003/06/23 17:55:44 dillon Exp $ */ #include @@ -64,7 +64,7 @@ procfs_doregs(curp, p, pfs, uio) /* Can't trace a process that's currently exec'ing. */ if ((p->p_flag & P_INEXEC) != 0) return EAGAIN; - if (!CHECKIO(curp, p) || p_trespass(curp, p)) + if (!CHECKIO(curp, p) || p_trespass(curp->p_ucred, p->p_ucred)) return EPERM; kl = sizeof(r); kv = (char *) &r; diff --git a/sys/vfs/procfs/procfs_status.c b/sys/vfs/procfs/procfs_status.c index cad5fc3094..831bbea24d 100644 --- a/sys/vfs/procfs/procfs_status.c +++ b/sys/vfs/procfs/procfs_status.c @@ -38,7 +38,7 @@ * * From: * $FreeBSD: src/sys/miscfs/procfs/procfs_status.c,v 1.20.2.4 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_status.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_status.c,v 1.3 2003/06/23 17:55:44 dillon Exp $ */ #include @@ -145,11 +145,11 @@ procfs_dostatus(curp, p, pfs, uio) ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " %lu %lu %lu", (u_long)cr->cr_uid, - (u_long)p->p_cred->p_ruid, - (u_long)p->p_cred->p_rgid); + (u_long)p->p_ucred->cr_ruid, + (u_long)p->p_ucred->cr_rgid); DOCHECK(); - /* egid (p->p_cred->p_svgid) is equal to cr_ngroups[0] + /* egid (p->p_ucred->cr_svgid) is equal to cr_ngroups[0] see also getegid(2) in /sys/kern/kern_prot.c */ for (i = 0; i < cr->cr_ngroups; i++) { @@ -158,9 +158,9 @@ procfs_dostatus(curp, p, pfs, uio) DOCHECK(); } - if (p->p_prison) + if (p->p_ucred->cr_prison) ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, - " %s", p->p_prison->pr_host); + " %s", p->p_ucred->cr_prison->pr_host); else ps += snprintf(ps, psbuf + sizeof(psbuf) - ps, " -"); DOCHECK(); @@ -213,8 +213,8 @@ procfs_docmdline(curp, p, pfs, uio) if (p->p_args && (ps_argsopen || (CHECKIO(curp, p) && - (p->p_flag & P_INEXEC) == 0 && - !p_trespass(curp, p)))) { + (p->p_flag & P_INEXEC) == 0 && !p_trespass(curp->p_ucred, p->p_ucred))) + ) { bp = p->p_args->ar_args; buflen = p->p_args->ar_length; buf = 0; diff --git a/sys/vfs/procfs/procfs_vnops.c b/sys/vfs/procfs/procfs_vnops.c index 675ee06d03..f7079f9763 100644 --- a/sys/vfs/procfs/procfs_vnops.c +++ b/sys/vfs/procfs/procfs_vnops.c @@ -37,7 +37,7 @@ * @(#)procfs_vnops.c 8.18 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/miscfs/procfs/procfs_vnops.c,v 1.76.2.7 2002/01/22 17:22:59 nectar Exp $ - * $DragonFly: src/sys/vfs/procfs/procfs_vnops.c,v 1.2 2003/06/17 04:28:42 dillon Exp $ + * $DragonFly: src/sys/vfs/procfs/procfs_vnops.c,v 1.3 2003/06/23 17:55:44 dillon Exp $ */ /* @@ -139,7 +139,7 @@ procfs_open(ap) p2 = PFIND(pfs->pfs_pid); if (p2 == NULL) return (ENOENT); - if (pfs->pfs_pid && !PRISON_CHECK(ap->a_p, p2)) + if (pfs->pfs_pid && !PRISON_CHECK(ap->a_cred, p2->p_ucred)) return (ENOENT); switch (pfs->pfs_type) { @@ -152,7 +152,7 @@ procfs_open(ap) /* Can't trace a process that's currently exec'ing. */ if ((p2->p_flag & P_INEXEC) != 0) return EAGAIN; - if (!CHECKIO(p1, p2) || p_trespass(p1, p2)) + if (!CHECKIO(p1, p2) || p_trespass(ap->a_cred, p2->p_ucred)) return (EPERM); if (ap->a_mode & FWRITE) @@ -246,7 +246,7 @@ procfs_ioctl(ap) /* Can't trace a process that's currently exec'ing. */ if ((procp->p_flag & P_INEXEC) != 0) return EAGAIN; - if (!CHECKIO(p, procp) || p_trespass(p, procp)) + if (!CHECKIO(p, procp) || p_trespass(ap->a_cred, procp->p_ucred)) return EPERM; switch (ap->a_command) { @@ -263,7 +263,7 @@ procfs_ioctl(ap) */ #define NFLAGS (PF_ISUGID) flags = (unsigned char)*(unsigned int*)ap->a_data; - if (flags & NFLAGS && (error = suser(p))) + if (flags & NFLAGS && (error = suser_xxx(ap->a_cred, 0))) return error; procp->p_pfsflags = flags; break; @@ -444,8 +444,7 @@ procfs_getattr(ap) default: procp = PFIND(pfs->pfs_pid); - if (procp == NULL || procp->p_cred == NULL || - procp->p_ucred == NULL) + if (procp == NULL || procp->p_ucred == NULL) return (ENOENT); } @@ -828,7 +827,7 @@ procfs_readdir(ap) p = PFIND(pfs->pfs_pid); if (p == NULL) break; - if (!PRISON_CHECK(curproc, p)) + if (!PRISON_CHECK(ap->a_cred, p->p_ucred)) break; for (pt = &proc_targets[i]; @@ -891,11 +890,11 @@ procfs_readdir(ap) p = p->p_list.le_next; if (!p) goto done; - if (!PRISON_CHECK(curproc, p)) + if (!PRISON_CHECK(ap->a_cred, p->p_ucred)) continue; pcnt++; } - while (!PRISON_CHECK(curproc, p)) { + while (!PRISON_CHECK(ap->a_cred, p->p_ucred)) { p = p->p_list.le_next; if (!p) goto done; @@ -963,8 +962,7 @@ procfs_readlink(ap) */ case Pfile: procp = PFIND(pfs->pfs_pid); - if (procp == NULL || procp->p_cred == NULL || - procp->p_ucred == NULL) { + if (procp == NULL || procp->p_ucred == NULL) { printf("procfs_readlink: pid %d disappeared\n", pfs->pfs_pid); return (uiomove("unknown", sizeof("unknown") - 1, diff --git a/sys/vfs/smbfs/smbfs_vnops.c b/sys/vfs/smbfs/smbfs_vnops.c index c08fb7de73..af4ad48aad 100644 --- a/sys/vfs/smbfs/smbfs_vnops.c +++ b/sys/vfs/smbfs/smbfs_vnops.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_vnops.c,v 1.2.2.8 2003/04/04 08:57:23 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_vnops.c,v 1.2 2003/06/17 04:28:33 dillon Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_vnops.c,v 1.3 2003/06/23 17:55:37 dillon Exp $ */ #include #include @@ -409,7 +409,7 @@ smbfs_setattr(ap) atime = &vap->va_atime; if (mtime != atime) { if (ap->a_cred->cr_uid != VTOSMBFS(vp)->sm_args.uid && - (error = suser_xxx(ap->a_cred, ap->a_p, PRISON_ROOT)) && + (error = suser_xxx(ap->a_cred, PRISON_ROOT)) && ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || (error = VOP_ACCESS(vp, VWRITE, ap->a_cred, ap->a_p)))) return (error); diff --git a/sys/vfs/specfs/spec_vnops.c b/sys/vfs/specfs/spec_vnops.c index 0b479528b2..9ad1550524 100644 --- a/sys/vfs/specfs/spec_vnops.c +++ b/sys/vfs/specfs/spec_vnops.c @@ -32,7 +32,7 @@ * * @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95 * $FreeBSD: src/sys/miscfs/specfs/spec_vnops.c,v 1.131.2.4 2001/02/26 04:23:20 jlemon Exp $ - * $DragonFly: src/sys/vfs/specfs/spec_vnops.c,v 1.3 2003/06/19 01:55:06 dillon Exp $ + * $DragonFly: src/sys/vfs/specfs/spec_vnops.c,v 1.4 2003/06/23 17:55:44 dillon Exp $ */ #include @@ -193,7 +193,7 @@ spec_open(ap) vp->v_flag |= VISTTY; VOP_UNLOCK(vp, 0, p); - error = (*dsw->d_open)(dev, ap->a_mode, S_IFCHR, p); + error = (*dsw->d_open)(dev, ap->a_mode, S_IFCHR, p->p_thread); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); if (error) @@ -307,7 +307,7 @@ spec_ioctl(ap) dev = ap->a_vp->v_rdev; return ((*devsw(dev)->d_ioctl)(dev, ap->a_command, - ap->a_data, ap->a_fflag, ap->a_p)); + ap->a_data, ap->a_fflag, ap->a_p->p_thread)); } /* ARGSUSED */ @@ -323,7 +323,7 @@ spec_poll(ap) dev_t dev; dev = ap->a_vp->v_rdev; - return (*devsw(dev)->d_poll)(dev, ap->a_events, ap->a_p); + return (*devsw(dev)->d_poll)(dev, ap->a_events, ap->a_p->p_thread); } /* ARGSUSED */ @@ -591,7 +591,7 @@ spec_close(ap) } else if (vcount(vp) > 1) { return (0); } - return (devsw(dev)->d_close(dev, ap->a_fflag, S_IFCHR, p)); + return (devsw(dev)->d_close(dev, ap->a_fflag, S_IFCHR, p->p_thread)); } /* diff --git a/sys/vfs/ufs/ufs_vnops.c b/sys/vfs/ufs/ufs_vnops.c index 3e72e569ec..97807ad25f 100644 --- a/sys/vfs/ufs/ufs_vnops.c +++ b/sys/vfs/ufs/ufs_vnops.c @@ -37,7 +37,7 @@ * * @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95 * $FreeBSD: src/sys/ufs/ufs/ufs_vnops.c,v 1.131.2.8 2003/01/02 17:26:19 bde Exp $ - * $DragonFly: src/sys/vfs/ufs/ufs_vnops.c,v 1.2 2003/06/17 04:29:00 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ufs_vnops.c,v 1.3 2003/06/23 17:55:51 dillon Exp $ */ #include "opt_quota.h" @@ -459,9 +459,9 @@ ufs_setattr(ap) if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); if (cred->cr_uid != ip->i_uid && - (error = suser_xxx(cred, p, PRISON_ROOT))) + (error = suser_xxx(cred, PRISON_ROOT))) return (error); - if ((cred->cr_uid == 0) && (p->p_prison == NULL)) { + if ((cred->cr_uid == 0) && (cred->cr_prison == NULL)) { if ((ip->i_flags & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) && securelevel > 0) @@ -515,7 +515,7 @@ ufs_setattr(ap) if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); if (cred->cr_uid != ip->i_uid && - (error = suser_xxx(cred, p, PRISON_ROOT)) && + (error = suser_xxx(cred, PRISON_ROOT)) && ((vap->va_vaflags & VA_UTIMES_NULL) == 0 || (error = VOP_ACCESS(vp, VWRITE, cred, p)))) return (error); @@ -561,7 +561,7 @@ ufs_chmod(vp, mode, cred, p) int error; if (cred->cr_uid != ip->i_uid) { - error = suser_xxx(cred, p, PRISON_ROOT); + error = suser_xxx(cred, PRISON_ROOT); if (error) return (error); } @@ -609,7 +609,7 @@ ufs_chown(vp, uid, gid, cred, p) */ if ((cred->cr_uid != ip->i_uid || uid != ip->i_uid || (gid != ip->i_gid && !groupmember((gid_t)gid, cred))) && - (error = suser_xxx(cred, p, PRISON_ROOT))) + (error = suser_xxx(cred, PRISON_ROOT))) return (error); ogid = ip->i_gid; ouid = ip->i_uid; @@ -2135,8 +2135,9 @@ ufs_makeinode(mode, dvp, vpp, cnp) if (DOINGSOFTDEP(tvp)) softdep_change_linkcnt(ip); if ((ip->i_mode & ISGID) && !groupmember(ip->i_gid, cnp->cn_cred) && - suser_xxx(cnp->cn_cred, 0, 0)) + suser_xxx(cnp->cn_cred, 0)) { ip->i_mode &= ~ISGID; + } if (cnp->cn_flags & ISWHITEOUT) ip->i_flags |= UF_OPAQUE; diff --git a/sys/vfs/umapfs/umap_vfsops.c b/sys/vfs/umapfs/umap_vfsops.c index f0c0de24a8..97e362fb34 100644 --- a/sys/vfs/umapfs/umap_vfsops.c +++ b/sys/vfs/umapfs/umap_vfsops.c @@ -36,7 +36,7 @@ * @(#)umap_vfsops.c 8.8 (Berkeley) 5/14/95 * * $FreeBSD: src/sys/miscfs/umapfs/umap_vfsops.c,v 1.31.2.2 2001/09/11 09:49:53 kris Exp $ - * $DragonFly: src/sys/vfs/umapfs/Attic/umap_vfsops.c,v 1.2 2003/06/17 04:28:43 dillon Exp $ + * $DragonFly: src/sys/vfs/umapfs/Attic/umap_vfsops.c,v 1.3 2003/06/23 17:55:44 dillon Exp $ */ /* @@ -104,7 +104,7 @@ umapfs_mount(mp, path, data, ndp, p) /* * Only for root */ - if ((error = suser(p)) != 0) + if ((error = suser_xxx(p->p_ucred, 0)) != 0) return (error); #ifdef DEBUG diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 311fd1f851..6a33ecab6e 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -39,7 +39,7 @@ * * @(#)vm_mmap.c 8.4 (Berkeley) 1/12/94 * $FreeBSD: src/sys/vm/vm_mmap.c,v 1.108.2.6 2002/07/02 20:06:19 dillon Exp $ - * $DragonFly: src/sys/vm/vm_mmap.c,v 1.2 2003/06/17 04:29:00 dillon Exp $ + * $DragonFly: src/sys/vm/vm_mmap.c,v 1.3 2003/06/23 17:55:51 dillon Exp $ */ /* @@ -109,46 +109,33 @@ vmmapentry_rsrc_init(dummy) /* ARGSUSED */ int -sbrk(p, uap) - struct proc *p; - struct sbrk_args *uap; +sbrk(struct sbrk_args *uap) { - /* Not yet implemented */ return (EOPNOTSUPP); } -#ifndef _SYS_SYSPROTO_H_ -struct sstk_args { - int incr; -}; -#endif - +/* + * sstk_args(int incr) + */ /* ARGSUSED */ int -sstk(p, uap) - struct proc *p; - struct sstk_args *uap; +sstk(struct sstk_args *uap) { - /* Not yet implemented */ return (EOPNOTSUPP); } #if defined(COMPAT_43) || defined(COMPAT_SUNOS) -#ifndef _SYS_SYSPROTO_H_ -struct getpagesize_args { - int dummy; -}; -#endif +/* + * getpagesize_args(int dummy) + */ /* ARGSUSED */ int -ogetpagesize(p, uap) - struct proc *p; - struct getpagesize_args *uap; +ogetpagesize(struct getpagesize_args *uap) { - + struct proc *p = curproc; p->p_retval[0] = PAGE_SIZE; return (0); } @@ -156,6 +143,9 @@ ogetpagesize(p, uap) /* + * mmap_args(void *addr, size_t len, int prot, int flags, int fd, + * long pad, off_t pos) + * * Memory Map (mmap) system call. Note that the file offset * and address are allowed to be NOT page aligned, though if * the MAP_FIXED flag it set, both must have the same remainder @@ -172,25 +162,13 @@ ogetpagesize(p, uap) * is maintained as long as you do not write directly to the underlying * character device. */ -#ifndef _SYS_SYSPROTO_H_ -struct mmap_args { - void *addr; - size_t len; - int prot; - int flags; - int fd; - long pad; - off_t pos; -}; -#endif int -mmap(p, uap) - struct proc *p; - register struct mmap_args *uap; +mmap(struct mmap_args *uap) { - register struct filedesc *fdp = p->p_fd; - register struct file *fp = NULL; + struct proc *p = curproc; + struct filedesc *fdp = p->p_fd; + struct file *fp = NULL; struct vnode *vp; vm_offset_t addr; vm_size_t size, pageoff; @@ -337,7 +315,7 @@ mmap(p, uap) if (securelevel >= 1) disablexworkaround = 1; else - disablexworkaround = suser(p); + disablexworkaround = suser_xxx(p->p_ucred, 0); if (vp->v_type == VCHR && disablexworkaround && (flags & (MAP_PRIVATE|MAP_COPY))) { error = EINVAL; @@ -418,20 +396,11 @@ done: } #ifdef COMPAT_43 -#ifndef _SYS_SYSPROTO_H_ -struct ommap_args { - caddr_t addr; - int len; - int prot; - int flags; - int fd; - long pos; -}; -#endif +/* + * ommap_args(caddr_t addr, int len, int prot, int flags, int fd, long pos) + */ int -ommap(p, uap) - struct proc *p; - register struct ommap_args *uap; +ommap(struct ommap_args *uap) { struct mmap_args nargs; static const char cvtbsdprot[8] = { @@ -469,23 +438,18 @@ ommap(p, uap) nargs.flags |= MAP_INHERIT; nargs.fd = uap->fd; nargs.pos = uap->pos; - return (mmap(p, &nargs)); + return (mmap(&nargs)); } #endif /* COMPAT_43 */ -#ifndef _SYS_SYSPROTO_H_ -struct msync_args { - void *addr; - int len; - int flags; -}; -#endif +/* + * msync_args(void *addr, int len, int flags) + */ int -msync(p, uap) - struct proc *p; - struct msync_args *uap; +msync(struct msync_args *uap) { + struct proc *p = curproc; vm_offset_t addr; vm_size_t size, pageoff; int flags; @@ -547,17 +511,13 @@ msync(p, uap) return (0); } -#ifndef _SYS_SYSPROTO_H_ -struct munmap_args { - void *addr; - size_t len; -}; -#endif +/* + * munmap_args(void *addr, size_t len) + */ int -munmap(p, uap) - register struct proc *p; - register struct munmap_args *uap; +munmap(struct munmap_args *uap) { + struct proc *p = curproc; vm_offset_t addr; vm_size_t size, pageoff; vm_map_t map; @@ -609,18 +569,13 @@ munmapfd(p, fd) } #endif -#ifndef _SYS_SYSPROTO_H_ -struct mprotect_args { - const void *addr; - size_t len; - int prot; -}; -#endif +/* + * mprotect_args(const void *addr, size_t len, int prot) + */ int -mprotect(p, uap) - struct proc *p; - struct mprotect_args *uap; +mprotect(struct mprotect_args *uap) { + struct proc *p = curproc; vm_offset_t addr; vm_size_t size, pageoff; register vm_prot_t prot; @@ -650,18 +605,13 @@ mprotect(p, uap) return (EINVAL); } -#ifndef _SYS_SYSPROTO_H_ -struct minherit_args { - void *addr; - size_t len; - int inherit; -}; -#endif +/* + * minherit_args(void *addr, size_t len, int inherit) + */ int -minherit(p, uap) - struct proc *p; - struct minherit_args *uap; +minherit(struct minherit_args *uap) { + struct proc *p = curproc; vm_offset_t addr; vm_size_t size, pageoff; register vm_inherit_t inherit; @@ -687,20 +637,14 @@ minherit(p, uap) return (EINVAL); } -#ifndef _SYS_SYSPROTO_H_ -struct madvise_args { - void *addr; - size_t len; - int behav; -}; -#endif - +/* + * madvise_args(void *addr, size_t len, int behav) + */ /* ARGSUSED */ int -madvise(p, uap) - struct proc *p; - struct madvise_args *uap; +madvise(struct madvise_args *uap) { + struct proc *p = curproc; vm_offset_t start, end; /* @@ -734,20 +678,14 @@ madvise(p, uap) return (0); } -#ifndef _SYS_SYSPROTO_H_ -struct mincore_args { - const void *addr; - size_t len; - char *vec; -}; -#endif - +/* + * mincore_args(const void *addr, size_t len, char *vec) + */ /* ARGSUSED */ int -mincore(p, uap) - struct proc *p; - struct mincore_args *uap; +mincore(struct mincore_args *uap) { + struct proc *p = curproc; vm_offset_t addr, first_addr; vm_offset_t end, cend; pmap_t pmap; @@ -925,20 +863,16 @@ RestartScan: return (0); } -#ifndef _SYS_SYSPROTO_H_ -struct mlock_args { - const void *addr; - size_t len; -}; -#endif +/* + * mlock_args(const void *addr, size_t len) + */ int -mlock(p, uap) - struct proc *p; - struct mlock_args *uap; +mlock(struct mlock_args *uap) { vm_offset_t addr; vm_size_t size, pageoff; int error; + struct proc *p = curproc; addr = (vm_offset_t) uap->addr; size = uap->len; @@ -960,7 +894,7 @@ mlock(p, uap) p->p_rlimit[RLIMIT_MEMLOCK].rlim_cur) return (ENOMEM); #else - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) return (error); #endif @@ -969,48 +903,34 @@ mlock(p, uap) return (error == KERN_SUCCESS ? 0 : ENOMEM); } -#ifndef _SYS_SYSPROTO_H_ -struct mlockall_args { - int how; -}; -#endif - +/* + * mlockall_args(int how) + */ int -mlockall(p, uap) - struct proc *p; - struct mlockall_args *uap; +mlockall(struct mlockall_args *uap) { return 0; } -#ifndef _SYS_SYSPROTO_H_ -struct mlockall_args { - int how; -}; -#endif - +/* + * mlockall_args(int how) + */ int -munlockall(p, uap) - struct proc *p; - struct munlockall_args *uap; +munlockall(struct munlockall_args *uap) { return 0; } -#ifndef _SYS_SYSPROTO_H_ -struct munlock_args { - const void *addr; - size_t len; -}; -#endif +/* + * munlock_args(const void *addr, size_t len) + */ int -munlock(p, uap) - struct proc *p; - struct munlock_args *uap; +munlock(struct munlock_args *uap) { vm_offset_t addr; vm_size_t size, pageoff; int error; + struct proc *p = curproc; addr = (vm_offset_t) uap->addr; size = uap->len; @@ -1025,7 +945,7 @@ munlock(p, uap) return (EINVAL); #ifndef pmap_wired_count - error = suser(p); + error = suser(); if (error) return (error); #endif diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index a33c71a959..04f6c11b10 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -32,7 +32,7 @@ * * @(#)vm_swap.c 8.5 (Berkeley) 2/17/94 * $FreeBSD: src/sys/vm/vm_swap.c,v 1.96.2.2 2001/10/14 18:46:47 iedowse Exp $ - * $DragonFly: src/sys/vm/vm_swap.c,v 1.2 2003/06/17 04:29:00 dillon Exp $ + * $DragonFly: src/sys/vm/vm_swap.c,v 1.3 2003/06/23 17:55:51 dillon Exp $ */ #include "opt_swap.h" @@ -171,28 +171,23 @@ static struct vnodeopv_desc swapdev_vnodeop_opv_desc = VNODEOP_SET(swapdev_vnodeop_opv_desc); /* + * swapon_args(char *name) + * * System call swapon(name) enables swapping on device name, * which must be in the swdevsw. Return EBUSY * if already swapping on this device. */ -#ifndef _SYS_SYSPROTO_H_ -struct swapon_args { - char *name; -}; -#endif - /* ARGSUSED */ int -swapon(p, uap) - struct proc *p; - struct swapon_args *uap; +swapon(struct swapon_args *uap) { + struct proc *p = curproc; struct vattr attr; register struct vnode *vp; struct nameidata nd; int error; - error = suser(p); + error = suser_xxx(p->p_ucred, 0); if (error) return (error); diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c index 00b7bdb078..627019279b 100644 --- a/sys/vm/vm_unix.c +++ b/sys/vm/vm_unix.c @@ -39,7 +39,7 @@ * * @(#)vm_unix.c 8.1 (Berkeley) 6/11/93 * $FreeBSD: src/sys/vm/vm_unix.c,v 1.24.2.2 2002/07/02 20:06:19 dillon Exp $ - * $DragonFly: src/sys/vm/vm_unix.c,v 1.2 2003/06/17 04:29:00 dillon Exp $ + * $DragonFly: src/sys/vm/vm_unix.c,v 1.3 2003/06/23 17:55:51 dillon Exp $ */ /* @@ -56,19 +56,15 @@ #include #include -#ifndef _SYS_SYSPROTO_H_ -struct obreak_args { - char *nsize; -}; -#endif - +/* + * obreak_args(char *nsize) + */ /* ARGSUSED */ int -obreak(p, uap) - struct proc *p; - struct obreak_args *uap; +obreak(struct obreak_args *uap) { - register struct vmspace *vm = p->p_vmspace; + struct proc *p = curproc; + struct vmspace *vm = p->p_vmspace; vm_offset_t new, old, base; int rv; @@ -116,18 +112,12 @@ obreak(p, uap) return (0); } -#ifndef _SYS_SYSPROTO_H_ -struct ovadvise_args { - int anom; -}; -#endif - +/* + * ovadvise_args(int anom) + */ /* ARGSUSED */ int -ovadvise(p, uap) - struct proc *p; - struct ovadvise_args *uap; +ovadvise(struct ovadvise_args *uap) { - return (EINVAL); } -- 2.41.0