diff options
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/ibcs2/ibcs2_fcntl.c | 86 | ||||
-rw-r--r-- | sys/i386/ibcs2/ibcs2_ioctl.c | 86 | ||||
-rw-r--r-- | sys/i386/ibcs2/ibcs2_ipc.c | 61 | ||||
-rw-r--r-- | sys/i386/ibcs2/ibcs2_misc.c | 252 | ||||
-rw-r--r-- | sys/i386/ibcs2/ibcs2_signal.c | 72 | ||||
-rw-r--r-- | sys/i386/ibcs2/ibcs2_stat.c | 42 | ||||
-rw-r--r-- | sys/i386/ibcs2/ibcs2_sysi86.c | 8 | ||||
-rw-r--r-- | sys/i386/ibcs2/ibcs2_util.h | 4 | ||||
-rw-r--r-- | sys/i386/ibcs2/ibcs2_xenix.c | 32 | ||||
-rw-r--r-- | sys/i386/svr4/svr4_machdep.c | 6 |
10 files changed, 327 insertions, 322 deletions
diff --git a/sys/i386/ibcs2/ibcs2_fcntl.c b/sys/i386/ibcs2/ibcs2_fcntl.c index df93363..6ada6c9 100644 --- a/sys/i386/ibcs2/ibcs2_fcntl.c +++ b/sys/i386/ibcs2/ibcs2_fcntl.c @@ -174,20 +174,20 @@ ibcs2_open(td, uap) struct ibcs2_open_args *uap; { struct proc *p = td->td_proc; - int noctty = uap->flags & IBCS2_O_NOCTTY; + int noctty = SCARG(uap, flags) & IBCS2_O_NOCTTY; int ret; caddr_t sg = stackgap_init(); - uap->flags = cvt_o_flags(uap->flags); - if (uap->flags & O_CREAT) - CHECKALTCREAT(td, &sg, uap->path); + SCARG(uap, flags) = cvt_o_flags(SCARG(uap, flags)); + if (SCARG(uap, flags) & O_CREAT) + CHECKALTCREAT(td, &sg, SCARG(uap, path)); else - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); ret = open(td, (struct open_args *)uap); #ifdef SPX_HACK if (ret == ENXIO) { - if (!strcmp(uap->path, "/compat/ibcs2/dev/spx")) + if (!strcmp(SCARG(uap, path), "/compat/ibcs2/dev/spx")) ret = spx_open(td, uap); } else #endif /* SPX_HACK */ @@ -219,10 +219,10 @@ ibcs2_creat(td, uap) struct open_args cup; caddr_t sg = stackgap_init(); - CHECKALTCREAT(td, &sg, uap->path); - cup.path = uap->path; - cup.mode = uap->mode; - cup.flags = O_WRONLY | O_CREAT | O_TRUNC; + CHECKALTCREAT(td, &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(td, &cup); } @@ -234,9 +234,9 @@ ibcs2_access(td, uap) struct access_args cup; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); - cup.path = uap->path; - cup.flags = uap->flags; + CHECKALTEXIST(td, &sg, SCARG(uap, path)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, flags) = SCARG(uap, flags); return access(td, &cup); } @@ -250,55 +250,55 @@ ibcs2_fcntl(td, uap) struct flock *flp; struct ibcs2_flock ifl; - switch(uap->cmd) { + switch(SCARG(uap, cmd)) { case IBCS2_F_DUPFD: - fa.fd = uap->fd; - fa.cmd = F_DUPFD; - fa.arg = (/* XXX */ int)uap->arg; + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_DUPFD; + SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg); return fcntl(td, &fa); case IBCS2_F_GETFD: - fa.fd = uap->fd; - fa.cmd = F_GETFD; - fa.arg = (/* XXX */ int)uap->arg; + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_GETFD; + SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg); return fcntl(td, &fa); case IBCS2_F_SETFD: - fa.fd = uap->fd; - fa.cmd = F_SETFD; - fa.arg = (/* XXX */ int)uap->arg; + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_SETFD; + SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg); return fcntl(td, &fa); case IBCS2_F_GETFL: - fa.fd = uap->fd; - fa.cmd = F_GETFL; - fa.arg = (/* XXX */ int)uap->arg; + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_GETFL; + SCARG(&fa, arg) = (/* XXX */ int)SCARG(uap, arg); error = fcntl(td, &fa); if (error) return error; td->td_retval[0] = oflags2ioflags(td->td_retval[0]); return error; case IBCS2_F_SETFL: - fa.fd = uap->fd; - fa.cmd = F_SETFL; - fa.arg = (/* XXX */ int) - ioflags2oflags((int)uap->arg); + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_SETFL; + SCARG(&fa, arg) = (/* XXX */ int) + ioflags2oflags((int)SCARG(uap, arg)); return fcntl(td, &fa); case IBCS2_F_GETLK: { caddr_t sg = stackgap_init(); flp = stackgap_alloc(&sg, sizeof(*flp)); - error = copyin((caddr_t)uap->arg, (caddr_t)&ifl, + error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&ifl, ibcs2_flock_len); if (error) return error; cvt_iflock2flock(&ifl, flp); - fa.fd = uap->fd; - fa.cmd = F_GETLK; - fa.arg = (/* XXX */ int)flp; + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_GETLK; + SCARG(&fa, arg) = (/* XXX */ int)flp; error = fcntl(td, &fa); if (error) return error; cvt_flock2iflock(flp, &ifl); - return copyout((caddr_t)&ifl, (caddr_t)uap->arg, + return copyout((caddr_t)&ifl, (caddr_t)SCARG(uap, arg), ibcs2_flock_len); } @@ -306,14 +306,14 @@ ibcs2_fcntl(td, uap) { caddr_t sg = stackgap_init(); flp = stackgap_alloc(&sg, sizeof(*flp)); - error = copyin((caddr_t)uap->arg, (caddr_t)&ifl, + error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&ifl, ibcs2_flock_len); if (error) return error; cvt_iflock2flock(&ifl, flp); - fa.fd = uap->fd; - fa.cmd = F_SETLK; - fa.arg = (/* XXX */ int)flp; + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_SETLK; + SCARG(&fa, arg) = (/* XXX */ int)flp; return fcntl(td, &fa); } @@ -322,14 +322,14 @@ ibcs2_fcntl(td, uap) { caddr_t sg = stackgap_init(); flp = stackgap_alloc(&sg, sizeof(*flp)); - error = copyin((caddr_t)uap->arg, (caddr_t)&ifl, + error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&ifl, ibcs2_flock_len); if (error) return error; cvt_iflock2flock(&ifl, flp); - fa.fd = uap->fd; - fa.cmd = F_SETLKW; - fa.arg = (/* XXX */ int)flp; + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = F_SETLKW; + SCARG(&fa, arg) = (/* XXX */ int)flp; return fcntl(td, &fa); } } diff --git a/sys/i386/ibcs2/ibcs2_ioctl.c b/sys/i386/ibcs2/ibcs2_ioctl.c index 1662b65..dc25012 100644 --- a/sys/i386/ibcs2/ibcs2_ioctl.c +++ b/sys/i386/ibcs2/ibcs2_ioctl.c @@ -346,7 +346,7 @@ ibcs2_ioctl(td, uap) if ((error = fget(td, uap->fd, &fp)) != 0) { DPRINTF(("ibcs2_ioctl(%d): bad fd %d ", p->p_pid, - uap->fd)); + SCARG(uap, fd))); return EBADF; } @@ -356,7 +356,7 @@ ibcs2_ioctl(td, uap) return EBADF; } - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case IBCS2_TCGETA: case IBCS2_XCGETA: case IBCS2_OXCGETA: @@ -370,9 +370,9 @@ ibcs2_ioctl(td, uap) break; btios2stios (&bts, &sts); - if (uap->cmd == IBCS2_TCGETA) { + if (SCARG(uap, cmd) == IBCS2_TCGETA) { stios2stio (&sts, &st); - error = copyout((caddr_t)&st, uap->data, + error = copyout((caddr_t)&st, SCARG(uap, data), sizeof (st)); #ifdef DEBUG_IBCS2 if (error) @@ -381,7 +381,7 @@ ibcs2_ioctl(td, uap) #endif break; } else { - error = copyout((caddr_t)&sts, uap->data, + error = copyout((caddr_t)&sts, SCARG(uap, data), sizeof (sts)); break; } @@ -396,7 +396,7 @@ ibcs2_ioctl(td, uap) struct ibcs2_termios sts; struct ibcs2_termio st; - if ((error = copyin(uap->data, (caddr_t)&st, + if ((error = copyin(SCARG(uap, data), (caddr_t)&st, sizeof(st))) != 0) { DPRINTF(("ibcs2_ioctl(%d): TCSET copyin failed ", p->p_pid)); @@ -407,7 +407,7 @@ ibcs2_ioctl(td, uap) if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bts, td->td_ucred, td)) != 0) { DPRINTF(("ibcs2_ioctl(%d): TCSET ctl failed fd %d ", - p->p_pid, uap->fd)); + p->p_pid, SCARG(uap, fd))); break; } @@ -419,7 +419,7 @@ ibcs2_ioctl(td, uap) stio2stios(&st, &sts); stios2btios(&sts, &bts); - error = fo_ioctl(fp, uap->cmd - IBCS2_TCSETA + TIOCSETA, + error = fo_ioctl(fp, SCARG(uap, cmd) - IBCS2_TCSETA + TIOCSETA, (caddr_t)&bts, td->td_ucred, td); break; } @@ -431,11 +431,11 @@ ibcs2_ioctl(td, uap) struct termios bts; struct ibcs2_termios sts; - if ((error = copyin(uap->data, (caddr_t)&sts, + if ((error = copyin(SCARG(uap, data), (caddr_t)&sts, sizeof (sts))) != 0) break; stios2btios (&sts, &bts); - error = fo_ioctl(fp, uap->cmd - IBCS2_XCSETA + TIOCSETA, + error = fo_ioctl(fp, SCARG(uap, cmd) - IBCS2_XCSETA + TIOCSETA, (caddr_t)&bts, td->td_ucred, td); break; } @@ -447,11 +447,11 @@ ibcs2_ioctl(td, uap) struct termios bts; struct ibcs2_termios sts; - if ((error = copyin(uap->data, (caddr_t)&sts, + if ((error = copyin(SCARG(uap, data), (caddr_t)&sts, sizeof (sts))) != 0) break; stios2btios (&sts, &bts); - error = fo_ioctl(fp, uap->cmd - IBCS2_OXCSETA + TIOCSETA, + error = fo_ioctl(fp, SCARG(uap, cmd) - IBCS2_OXCSETA + TIOCSETA, (caddr_t)&bts, td->td_ucred, td); break; } @@ -463,7 +463,7 @@ ibcs2_ioctl(td, uap) case IBCS2_TCXONC: { - switch ((int)uap->data) { + switch ((int)SCARG(uap, data)) { case 0: case 1: DPRINTF(("ibcs2_ioctl(%d): TCXONC ", p->p_pid)); @@ -488,7 +488,7 @@ ibcs2_ioctl(td, uap) { int arg; - switch ((int)uap->data) { + switch ((int)SCARG(uap, data)) { case 0: arg = FREAD; break; @@ -508,12 +508,12 @@ ibcs2_ioctl(td, uap) } case IBCS2_TIOCGWINSZ: - uap->cmd = TIOCGWINSZ; + SCARG(uap, cmd) = TIOCGWINSZ; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_TIOCSWINSZ: - uap->cmd = TIOCSWINSZ; + SCARG(uap, cmd) = TIOCSWINSZ; error = ioctl(td, (struct ioctl_args *)uap); break; @@ -524,7 +524,7 @@ ibcs2_ioctl(td, uap) PROC_LOCK(p); pg_id = p->p_pgrp->pg_id; PROC_UNLOCK(p); - error = copyout((caddr_t)&pg_id, uap->data, + error = copyout((caddr_t)&pg_id, SCARG(uap, data), sizeof(pg_id)); break; } @@ -533,8 +533,8 @@ ibcs2_ioctl(td, uap) { struct setpgid_args sa; - sa.pid = 0; - sa.pgid = (int)uap->data; + SCARG(&sa, pid) = 0; + SCARG(&sa, pgid) = (int)SCARG(uap, data); error = setpgid(td, &sa); break; } @@ -566,111 +566,111 @@ ibcs2_ioctl(td, uap) p->p_session->s_ttyp->t_winsize.ws_ypixel; SESS_UNLOCK(p->p_session); PROC_UNLOCK(p); - error = copyout((caddr_t)&ibcs2_jwinsize, uap->data, + error = copyout((caddr_t)&ibcs2_jwinsize, SCARG(uap, data), sizeof(ibcs2_jwinsize)); break; } /* keyboard and display ioctl's -- type 'K' */ case IBCS2_KDGKBMODE: /* get keyboard translation mode */ - uap->cmd = KDGKBMODE; -/* printf("ioctl KDGKBMODE = %x\n", uap->cmd);*/ + SCARG(uap, cmd) = KDGKBMODE; +/* printf("ioctl KDGKBMODE = %x\n", SCARG(uap, cmd));*/ error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDSKBMODE: /* set keyboard translation mode */ - uap->cmd = KDSKBMODE; + SCARG(uap, cmd) = KDSKBMODE; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDMKTONE: /* sound tone */ - uap->cmd = KDMKTONE; + SCARG(uap, cmd) = KDMKTONE; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDGETMODE: /* get text/graphics mode */ - uap->cmd = KDGETMODE; + SCARG(uap, cmd) = KDGETMODE; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDSETMODE: /* set text/graphics mode */ - uap->cmd = KDSETMODE; + SCARG(uap, cmd) = KDSETMODE; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDSBORDER: /* set ega color border */ - uap->cmd = KDSBORDER; + SCARG(uap, cmd) = KDSBORDER; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDGKBSTATE: - uap->cmd = KDGKBSTATE; + SCARG(uap, cmd) = KDGKBSTATE; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDSETRAD: - uap->cmd = KDSETRAD; + SCARG(uap, cmd) = KDSETRAD; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDENABIO: /* enable direct I/O to ports */ - uap->cmd = KDENABIO; + SCARG(uap, cmd) = KDENABIO; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDDISABIO: /* disable direct I/O to ports */ - uap->cmd = KDDISABIO; + SCARG(uap, cmd) = KDDISABIO; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KIOCSOUND: /* start sound generation */ - uap->cmd = KIOCSOUND; + SCARG(uap, cmd) = KIOCSOUND; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDGKBTYPE: /* get keyboard type */ - uap->cmd = KDGKBTYPE; + SCARG(uap, cmd) = KDGKBTYPE; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDGETLED: /* get keyboard LED status */ - uap->cmd = KDGETLED; + SCARG(uap, cmd) = KDGETLED; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_KDSETLED: /* set keyboard LED status */ - uap->cmd = KDSETLED; + SCARG(uap, cmd) = KDSETLED; error = ioctl(td, (struct ioctl_args *)uap); break; /* Xenix keyboard and display ioctl's from sys/kd.h -- type 'k' */ case IBCS2_GETFKEY: /* Get function key */ - uap->cmd = GETFKEY; + SCARG(uap, cmd) = GETFKEY; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_SETFKEY: /* Set function key */ - uap->cmd = SETFKEY; + SCARG(uap, cmd) = SETFKEY; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_GIO_SCRNMAP: /* Get screen output map table */ - uap->cmd = GIO_SCRNMAP; + SCARG(uap, cmd) = GIO_SCRNMAP; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_PIO_SCRNMAP: /* Set screen output map table */ - uap->cmd = PIO_SCRNMAP; + SCARG(uap, cmd) = PIO_SCRNMAP; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_GIO_KEYMAP: /* Get keyboard map table */ - uap->cmd = GIO_KEYMAP; + SCARG(uap, cmd) = GIO_KEYMAP; error = ioctl(td, (struct ioctl_args *)uap); break; case IBCS2_PIO_KEYMAP: /* Set keyboard map table */ - uap->cmd = PIO_KEYMAP; + SCARG(uap, cmd) = PIO_KEYMAP; error = ioctl(td, (struct ioctl_args *)uap); break; @@ -681,13 +681,13 @@ ibcs2_ioctl(td, uap) case IBCS2_FIONREAD: case IBCS2_I_NREAD: /* STREAMS */ - uap->cmd = FIONREAD; + SCARG(uap, cmd) = FIONREAD; error = ioctl(td, (struct ioctl_args *)uap); break; default: DPRINTF(("ibcs2_ioctl(%d): unknown cmd 0x%lx ", - td->proc->p_pid, uap->cmd)); + td->proc->p_pid, SCARG(uap, cmd))); error = ENOSYS; break; } diff --git a/sys/i386/ibcs2/ibcs2_ipc.c b/sys/i386/ibcs2/ibcs2_ipc.c index 943658e..cdf8e87 100644 --- a/sys/i386/ibcs2/ibcs2_ipc.c +++ b/sys/i386/ibcs2/ibcs2_ipc.c @@ -106,31 +106,32 @@ ibcs2_msgsys(td, uap) struct thread *td; struct ibcs2_msgsys_args *uap; { - switch (uap->which) { + switch (SCARG(uap, which)) { case 0: /* msgget */ - uap->which = 1; + SCARG(uap, which) = 1; return msgsys(td, (struct msgsys_args *)uap); case 1: { /* msgctl */ int error; struct msgsys_args margs; caddr_t sg = stackgap_init(); - margs.which = 0; - margs.a2 = uap->a2; - margs.a4 = + SCARG(&margs, which) = 0; + SCARG(&margs, a2) = SCARG(uap, a2); + SCARG(&margs, a4) = (int)stackgap_alloc(&sg, sizeof(struct msqid_ds)); - margs.a3 = uap->a3; - switch (margs.a3) { + SCARG(&margs, a3) = SCARG(uap, a3); + switch (SCARG(&margs, a3)) { case IBCS2_IPC_STAT: error = msgsys(td, &margs); if (!error) cvt_msqid2imsqid( - (struct msqid_ds *)margs.a4, - (struct ibcs2_msqid_ds *)uap->a4); + (struct msqid_ds *)SCARG(&margs, a4), + (struct ibcs2_msqid_ds *)SCARG(uap, a4)); return error; case IBCS2_IPC_SET: - cvt_imsqid2msqid((struct ibcs2_msqid_ds *)uap->a4, - (struct msqid_ds *)margs.a4); + cvt_imsqid2msqid((struct ibcs2_msqid_ds *)SCARG(uap, + a4), + (struct msqid_ds *)SCARG(&margs, a4)); return msgsys(td, &margs); case IBCS2_IPC_RMID: return msgsys(td, &margs); @@ -138,10 +139,10 @@ ibcs2_msgsys(td, uap) return EINVAL; } case 2: /* msgrcv */ - uap->which = 3; + SCARG(uap, which) = 3; return msgsys(td, (struct msgsys_args *)uap); case 3: /* msgsnd */ - uap->which = 2; + SCARG(uap, which) = 2; return msgsys(td, (struct msgsys_args *)uap); default: return EINVAL; @@ -238,9 +239,9 @@ ibcs2_semsys(td, uap) { int error; - switch (uap->which) { + switch (SCARG(uap, which)) { case 0: /* semctl */ - switch(uap->a4) { + switch(SCARG(uap, a4)) { case IBCS2_IPC_STAT: { struct ibcs2_semid_ds *isp; @@ -249,14 +250,14 @@ ibcs2_semsys(td, uap) caddr_t sg = stackgap_init(); - ssu = (union semun) uap->a5; + ssu = (union semun) SCARG(uap, a5); sp = stackgap_alloc(&sg, sizeof(struct semid_ds)); sup = stackgap_alloc(&sg, sizeof(union semun)); sup->buf = sp; - uap->a5 = (int)sup; + SCARG(uap, a5) = (int)sup; error = semsys(td, (struct semsys_args *)uap); if (!error) { - uap->a5 = (int)ssu.buf; + SCARG(uap, a5) = (int)ssu.buf; isp = stackgap_alloc(&sg, sizeof(*isp)); cvt_semid2isemid(sp, isp); error = copyout((caddr_t)isp, @@ -273,12 +274,12 @@ ibcs2_semsys(td, uap) isp = stackgap_alloc(&sg, sizeof(*isp)); sp = stackgap_alloc(&sg, sizeof(*sp)); - error = copyin((caddr_t)uap->a5, (caddr_t)isp, + error = copyin((caddr_t)SCARG(uap, a5), (caddr_t)isp, sizeof(*isp)); if (error) return error; cvt_isemid2semid(isp, sp); - uap->a5 = (int)sp; + SCARG(uap, a5) = (int)sp; return semsys(td, (struct semsys_args *)uap); } case IBCS2_SETVAL: @@ -287,8 +288,8 @@ ibcs2_semsys(td, uap) caddr_t sg = stackgap_init(); sp = stackgap_alloc(&sg, sizeof(*sp)); - sp->val = (int) uap->a5; - uap->a5 = (int)sp; + sp->val = (int) SCARG(uap, a5); + SCARG(uap, a5) = (int)sp; return semsys(td, (struct semsys_args *)uap); } } @@ -350,28 +351,28 @@ ibcs2_shmsys(td, uap) { int error; - switch (uap->which) { + switch (SCARG(uap, which)) { case 0: /* shmat */ return shmsys(td, (struct shmsys_args *)uap); case 1: /* shmctl */ - switch(uap->a3) { + switch(SCARG(uap, a3)) { case IBCS2_IPC_STAT: { struct ibcs2_shmid_ds *isp; struct shmid_ds *sp; caddr_t sg = stackgap_init(); - isp = (struct ibcs2_shmid_ds *)uap->a4; + isp = (struct ibcs2_shmid_ds *)SCARG(uap, a4); sp = stackgap_alloc(&sg, sizeof(*sp)); - uap->a4 = (int)sp; + SCARG(uap, a4) = (int)sp; error = shmsys(td, (struct shmsys_args *)uap); if (!error) { - uap->a4 = (int)isp; + SCARG(uap, a4) = (int)isp; isp = stackgap_alloc(&sg, sizeof(*isp)); cvt_shmid2ishmid(sp, isp); error = copyout((caddr_t)isp, - (caddr_t)uap->a4, + (caddr_t)SCARG(uap, a4), sizeof(*isp)); } return error; @@ -384,12 +385,12 @@ ibcs2_shmsys(td, uap) isp = stackgap_alloc(&sg, sizeof(*isp)); sp = stackgap_alloc(&sg, sizeof(*sp)); - error = copyin((caddr_t)uap->a4, (caddr_t)isp, + error = copyin((caddr_t)SCARG(uap, a4), (caddr_t)isp, sizeof(*isp)); if (error) return error; cvt_ishmid2shmid(isp, sp); - uap->a4 = (int)sp; + SCARG(uap, a4) = (int)sp; return shmsys(td, (struct shmsys_args *)uap); } } diff --git a/sys/i386/ibcs2/ibcs2_misc.c b/sys/i386/ibcs2/ibcs2_misc.c index 8b8f536..5892ef7 100644 --- a/sys/i386/ibcs2/ibcs2_misc.c +++ b/sys/i386/ibcs2/ibcs2_misc.c @@ -105,14 +105,14 @@ ibcs2_ulimit(td, uap) #define IBCS2_GETPSIZE 3 #define IBCS2_GETDTABLESIZE 4 - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case IBCS2_GETFSIZE: td->td_retval[0] = td->td_proc->p_rlimit[RLIMIT_FSIZE].rlim_cur; if (td->td_retval[0] == -1) td->td_retval[0] = 0x7fffffff; return 0; case IBCS2_SETFSIZE: /* XXX - fix this */ #ifdef notyet - rl.rlim_cur = uap->newlimit; + rl.rlim_cur = SCARG(uap, newlimit); sra.resource = RLIMIT_FSIZE; sra.rlp = &rl; error = setrlimit(td, &sra); @@ -122,7 +122,7 @@ ibcs2_ulimit(td, uap) DPRINTF(("failed ")); return error; #else - td->td_retval[0] = uap->newlimit; + td->td_retval[0] = SCARG(uap, newlimit); return 0; #endif case IBCS2_GETPSIZE: @@ -148,24 +148,24 @@ ibcs2_wait(td, uap) struct wait_args w4; struct trapframe *tf = td->td_frame; - w4.rusage = NULL; + SCARG(&w4, rusage) = NULL; if ((tf->tf_eflags & (PSL_Z|PSL_PF|PSL_N|PSL_V)) == (PSL_Z|PSL_PF|PSL_N|PSL_V)) { /* waitpid */ - w4.pid = uap->a1; - w4.status = (int *)uap->a2; - w4.options = uap->a3; + SCARG(&w4, pid) = SCARG(uap, a1); + SCARG(&w4, status) = (int *)SCARG(uap, a2); + SCARG(&w4, options) = SCARG(uap, a3); } else { /* wait */ - w4.pid = WAIT_ANY; - w4.status = (int *)uap->a1; - w4.options = 0; + SCARG(&w4, pid) = WAIT_ANY; + SCARG(&w4, status) = (int *)SCARG(uap, a1); + SCARG(&w4, options) = 0; } if ((error = wait4(td, &w4)) != 0) return error; - if (w4.status) { /* this is real iBCS brain-damage */ - error = copyin((caddr_t)w4.status, (caddr_t)&status, - sizeof(w4.status)); + if (SCARG(&w4, status)) { /* this is real iBCS brain-damage */ + error = copyin((caddr_t)SCARG(&w4, status), (caddr_t)&status, + sizeof(SCARG(&w4, status))); if(error) return error; @@ -179,8 +179,8 @@ ibcs2_wait(td, uap) /* record result/status */ td->td_retval[1] = status; - return copyout((caddr_t)&status, (caddr_t)w4.status, - sizeof(w4.status)); + return copyout((caddr_t)&status, (caddr_t)SCARG(&w4, status), + sizeof(SCARG(&w4, status))); } return 0; @@ -194,10 +194,10 @@ ibcs2_execv(td, uap) struct execve_args ea; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); - ea.fname = uap->path; - ea.argv = uap->argp; - ea.envv = NULL; + CHECKALTEXIST(td, &sg, SCARG(uap, path)); + SCARG(&ea, fname) = SCARG(uap, path); + SCARG(&ea, argv) = SCARG(uap, argp); + SCARG(&ea, envv) = NULL; return execve(td, &ea); } @@ -207,7 +207,7 @@ ibcs2_execve(td, uap) struct ibcs2_execve_args *uap; { caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); return execve(td, (struct execve_args *)uap); } @@ -218,8 +218,8 @@ ibcs2_umount(td, uap) { struct unmount_args um; - um.path = uap->name; - um.flags = 0; + SCARG(&um, path) = SCARG(uap, name); + SCARG(&um, flags) = 0; return unmount(td, &um); } @@ -229,7 +229,7 @@ ibcs2_mount(td, uap) struct ibcs2_mount_args *uap; { #ifdef notyet - int oflags = uap->flags, nflags, error; + int oflags = SCARG(uap, flags), nflags, error; char fsname[MFSNAMELEN]; if (oflags & (IBCS2_MS_NOSUB | IBCS2_MS_SYS5)) @@ -243,15 +243,15 @@ ibcs2_mount(td, uap) nflags |= MNT_NOSUID; if (oflags & IBCS2_MS_REMOUNT) nflags |= MNT_UPDATE; - uap->flags = nflags; + SCARG(uap, flags) = nflags; - if (error = copyinstr((caddr_t)uap->type, fsname, sizeof fsname, + if (error = copyinstr((caddr_t)SCARG(uap, type), fsname, sizeof fsname, (u_int *)0)) return (error); if (strcmp(fsname, "4.2") == 0) { - uap->type = (caddr_t)STACK_ALLOC(); - if (error = copyout("ufs", uap->type, sizeof("ufs"))) + SCARG(uap, type) = (caddr_t)STACK_ALLOC(); + if (error = copyout("ufs", SCARG(uap, type), sizeof("ufs"))) return (error); } else if (strcmp(fsname, "nfs") == 0) { struct ibcs2_nfs_args sna; @@ -259,14 +259,14 @@ ibcs2_mount(td, uap) struct nfs_args na; struct sockaddr sa; - if (error = copyin(uap->data, &sna, sizeof sna)) + if (error = copyin(SCARG(uap, data), &sna, sizeof sna)) return (error); if (error = copyin(sna.addr, &sain, sizeof sain)) return (error); bcopy(&sain, &sa, sizeof sa); sa.sa_len = sizeof(sain); - uap->data = (caddr_t)STACK_ALLOC(); - na.addr = (struct sockaddr *)((int)uap->data + sizeof na); + SCARG(uap, data) = (caddr_t)STACK_ALLOC(); + na.addr = (struct sockaddr *)((int)SCARG(uap, data) + sizeof na); na.sotype = SOCK_DGRAM; na.proto = IPPROTO_UDP; na.fh = (nfsv2fh_t *)sna.fh; @@ -279,7 +279,7 @@ ibcs2_mount(td, uap) if (error = copyout(&sa, na.addr, sizeof sa)) return (error); - if (error = copyout(&na, uap->data, sizeof na)) + if (error = copyout(&na, SCARG(uap, data), sizeof na)) return (error); } return (mount(td, uap)); @@ -317,7 +317,7 @@ ibcs2_getdents(td, uap) #define BSD_DIRENT(cp) ((struct dirent *)(cp)) #define IBCS2_RECLEN(reclen) (reclen + sizeof(u_short)) - if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) + if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0) return (error); if ((fp->f_flag & FREAD) == 0) { fdrop(fp, td); @@ -331,7 +331,7 @@ ibcs2_getdents(td, uap) off = fp->f_offset; #define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */ - buflen = max(DIRBLKSIZ, uap->nbytes); + buflen = max(DIRBLKSIZ, SCARG(uap, nbytes)); buflen = min(buflen, MAXBSIZE); buf = malloc(buflen, M_TEMP, M_WAITOK); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); @@ -364,8 +364,8 @@ again: if ((error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, &ncookies, &cookies)) != 0) goto out; inp = buf; - outp = uap->buf; - resid = uap->nbytes; + outp = SCARG(uap, buf); + resid = SCARG(uap, nbytes); if ((len = buflen - auio.uio_resid) <= 0) goto eof; @@ -434,11 +434,11 @@ again: resid -= IBCS2_RECLEN(reclen); } /* if we squished out the whole block, try again */ - if (outp == uap->buf) + if (outp == SCARG(uap, buf)) goto again; fp->f_offset = off; /* update the vnode offset */ eof: - td->td_retval[0] = uap->nbytes - resid; + td->td_retval[0] = SCARG(uap, nbytes) - resid; out: VOP_UNLOCK(vp, 0, td); fdrop(fp, td); @@ -470,7 +470,7 @@ ibcs2_read(td, uap) u_long *cookies = NULL, *cookiep; int ncookies; - if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) { + if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0) { if (error == EINVAL) return read(td, (struct read_args *)uap); else @@ -492,7 +492,7 @@ ibcs2_read(td, uap) DPRINTF(("ibcs2_read: read directory\n")); - buflen = max(DIRBLKSIZ, uap->nbytes); + buflen = max(DIRBLKSIZ, SCARG(uap, nbytes)); buflen = min(buflen, MAXBSIZE); buf = malloc(buflen, M_TEMP, M_WAITOK); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); @@ -527,8 +527,8 @@ again: goto out; } inp = buf; - outp = uap->buf; - resid = uap->nbytes; + outp = SCARG(uap, buf); + resid = SCARG(uap, nbytes); if ((len = buflen - auio.uio_resid) <= 0) goto eof; @@ -599,11 +599,11 @@ again: resid -= sizeof(struct ibcs2_direct); } /* if we squished out the whole block, try again */ - if (outp == uap->buf) + if (outp == SCARG(uap, buf)) goto again; fp->f_offset = off; /* update the vnode offset */ eof: - td->td_retval[0] = uap->nbytes - resid; + td->td_retval[0] = SCARG(uap, nbytes) - resid; out: VOP_UNLOCK(vp, 0, td); fdrop(fp, td); @@ -620,17 +620,17 @@ ibcs2_mknod(td, uap) { caddr_t sg = stackgap_init(); - CHECKALTCREAT(td, &sg, uap->path); - if (S_ISFIFO(uap->mode)) { + CHECKALTCREAT(td, &sg, SCARG(uap, path)); + if (S_ISFIFO(SCARG(uap, mode))) { struct mkfifo_args ap; - ap.path = uap->path; - ap.mode = uap->mode; + SCARG(&ap, path) = SCARG(uap, path); + SCARG(&ap, mode) = SCARG(uap, mode); return mkfifo(td, &ap); } else { struct mknod_args ap; - ap.path = uap->path; - ap.mode = uap->mode; - ap.dev = uap->dev; + SCARG(&ap, path) = SCARG(uap, path); + SCARG(&ap, mode) = SCARG(uap, mode); + SCARG(&ap, dev) = SCARG(uap, dev); return mknod(td, &ap); } } @@ -646,22 +646,22 @@ ibcs2_getgroups(td, uap) gid_t *gp; caddr_t sg = stackgap_init(); - sa.gidsetsize = uap->gidsetsize; - if (uap->gidsetsize) { - sa.gidset = stackgap_alloc(&sg, NGROUPS_MAX * + SCARG(&sa, gidsetsize) = SCARG(uap, gidsetsize); + if (SCARG(uap, gidsetsize)) { + SCARG(&sa, gidset) = stackgap_alloc(&sg, NGROUPS_MAX * sizeof(gid_t *)); - iset = stackgap_alloc(&sg, uap->gidsetsize * + iset = stackgap_alloc(&sg, SCARG(uap, gidsetsize) * sizeof(ibcs2_gid_t)); } if ((error = getgroups(td, &sa)) != 0) return error; - if (uap->gidsetsize == 0) + if (SCARG(uap, gidsetsize) == 0) return 0; - for (i = 0, gp = sa.gidset; i < td->td_retval[0]; i++) + for (i = 0, gp = SCARG(&sa, gidset); i < td->td_retval[0]; i++) iset[i] = (ibcs2_gid_t)*gp++; if (td->td_retval[0] && (error = copyout((caddr_t)iset, - (caddr_t)uap->gidset, + (caddr_t)SCARG(uap, gidset), sizeof(ibcs2_gid_t) * td->td_retval[0]))) return error; return 0; @@ -678,18 +678,18 @@ ibcs2_setgroups(td, uap) gid_t *gp; caddr_t sg = stackgap_init(); - sa.gidsetsize = uap->gidsetsize; - sa.gidset = stackgap_alloc(&sg, sa.gidsetsize * + SCARG(&sa, gidsetsize) = SCARG(uap, gidsetsize); + SCARG(&sa, gidset) = stackgap_alloc(&sg, SCARG(&sa, gidsetsize) * sizeof(gid_t *)); - iset = stackgap_alloc(&sg, sa.gidsetsize * + iset = stackgap_alloc(&sg, SCARG(&sa, gidsetsize) * sizeof(ibcs2_gid_t *)); - if (sa.gidsetsize) { - if ((error = copyin((caddr_t)uap->gidset, (caddr_t)iset, + if (SCARG(&sa, gidsetsize)) { + if ((error = copyin((caddr_t)SCARG(uap, gidset), (caddr_t)iset, sizeof(ibcs2_gid_t *) * - uap->gidsetsize)) != 0) + SCARG(uap, gidsetsize))) != 0) return error; } - for (i = 0, gp = sa.gidset; i < sa.gidsetsize; i++) + for (i = 0, gp = SCARG(&sa, gidset); i < SCARG(&sa, gidsetsize); i++) *gp++ = (gid_t)iset[i]; return setgroups(td, &sa); } @@ -701,7 +701,7 @@ ibcs2_setuid(td, uap) { struct setuid_args sa; - sa.uid = (uid_t)uap->uid; + SCARG(&sa, uid) = (uid_t)SCARG(uap, uid); return setuid(td, &sa); } @@ -712,7 +712,7 @@ ibcs2_setgid(td, uap) { struct setgid_args sa; - sa.gid = (gid_t)uap->gid; + SCARG(&sa, gid) = (gid_t)SCARG(uap, gid); return setgid(td, &sa); } @@ -725,8 +725,8 @@ ibcs2_time(td, uap) microtime(&tv); td->td_retval[0] = tv.tv_sec; - if (uap->tp) - return copyout((caddr_t)&tv.tv_sec, (caddr_t)uap->tp, + if (SCARG(uap, tp)) + return copyout((caddr_t)&tv.tv_sec, (caddr_t)SCARG(uap, tp), sizeof(ibcs2_time_t)); else return 0; @@ -737,7 +737,7 @@ ibcs2_pathconf(td, uap) struct thread *td; struct ibcs2_pathconf_args *uap; { - uap->name++; /* iBCS2 _PC_* defines are offset by one */ + SCARG(uap, name)++; /* iBCS2 _PC_* defines are offset by one */ return pathconf(td, (struct pathconf_args *)uap); } @@ -746,7 +746,7 @@ ibcs2_fpathconf(td, uap) struct thread *td; struct ibcs2_fpathconf_args *uap; { - uap->name++; /* iBCS2 _PC_* defines are offset by one */ + SCARG(uap, name)++; /* iBCS2 _PC_* defines are offset by one */ return fpathconf(td, (struct fpathconf_args *)uap); } @@ -759,7 +759,7 @@ ibcs2_sysconf(td, uap) struct sysctl_args sa; struct __getrlimit_args ga; - switch(uap->name) { + switch(SCARG(uap, name)) { case IBCS2_SC_ARG_MAX: mib[1] = KERN_ARGMAX; break; @@ -768,11 +768,11 @@ ibcs2_sysconf(td, uap) { caddr_t sg = stackgap_init(); - ga.which = RLIMIT_NPROC; - ga.rlp = stackgap_alloc(&sg, sizeof(struct rlimit *)); + SCARG(&ga, which) = RLIMIT_NPROC; + SCARG(&ga, rlp) = stackgap_alloc(&sg, sizeof(struct rlimit *)); if ((error = getrlimit(td, &ga)) != 0) return error; - td->td_retval[0] = ga.rlp->rlim_cur; + td->td_retval[0] = SCARG(&ga, rlp)->rlim_cur; return 0; } @@ -788,11 +788,11 @@ ibcs2_sysconf(td, uap) { caddr_t sg = stackgap_init(); - ga.which = RLIMIT_NOFILE; - ga.rlp = stackgap_alloc(&sg, sizeof(struct rlimit *)); + SCARG(&ga, which) = RLIMIT_NOFILE; + SCARG(&ga, rlp) = stackgap_alloc(&sg, sizeof(struct rlimit *)); if ((error = getrlimit(td, &ga)) != 0) return error; - td->td_retval[0] = ga.rlp->rlim_cur; + td->td_retval[0] = SCARG(&ga, rlp)->rlim_cur; return 0; } @@ -822,12 +822,12 @@ ibcs2_sysconf(td, uap) mib[0] = CTL_KERN; len = sizeof(value); - sa.name = mib; - sa.namelen = 2; - sa.old = &value; - sa.oldlenp = &len; - sa.new = NULL; - sa.newlen = 0; + SCARG(&sa, name) = mib; + SCARG(&sa, namelen) = 2; + SCARG(&sa, old) = &value; + SCARG(&sa, oldlenp) = &len; + SCARG(&sa, new) = NULL; + SCARG(&sa, newlen) = 0; if ((error = __sysctl(td, &sa)) != 0) return error; td->td_retval[0] = value; @@ -847,12 +847,12 @@ ibcs2_alarm(td, uap) itp = stackgap_alloc(&sg, sizeof(*itp)); oitp = stackgap_alloc(&sg, sizeof(*oitp)); timevalclear(&itp->it_interval); - itp->it_value.tv_sec = uap->sec; + itp->it_value.tv_sec = SCARG(uap, sec); itp->it_value.tv_usec = 0; - sa.which = ITIMER_REAL; - sa.itv = itp; - sa.oitv = oitp; + SCARG(&sa, which) = ITIMER_REAL; + SCARG(&sa, itv) = itp; + SCARG(&sa, oitv) = oitp; error = setitimer(td, &sa); if (error) return error; @@ -875,15 +875,15 @@ ibcs2_times(td, uap) struct rusage *ru = stackgap_alloc(&sg, sizeof(*ru)); #define CONVTCK(r) (r.tv_sec * hz + r.tv_usec / (1000000 / hz)) - ga.who = RUSAGE_SELF; - ga.rusage = ru; + SCARG(&ga, who) = RUSAGE_SELF; + SCARG(&ga, rusage) = ru; error = getrusage(td, &ga); if (error) return error; tms.tms_utime = CONVTCK(ru->ru_utime); tms.tms_stime = CONVTCK(ru->ru_stime); - ga.who = RUSAGE_CHILDREN; + SCARG(&ga, who) = RUSAGE_CHILDREN; error = getrusage(td, &ga); if (error) return error; @@ -893,7 +893,7 @@ ibcs2_times(td, uap) microtime(&t); td->td_retval[0] = CONVTCK(t); - return copyout((caddr_t)&tms, (caddr_t)uap->tp, + return copyout((caddr_t)&tms, (caddr_t)SCARG(uap, tp), sizeof(struct tms)); } @@ -906,12 +906,12 @@ ibcs2_stime(td, uap) struct settimeofday_args sa; caddr_t sg = stackgap_init(); - sa.tv = stackgap_alloc(&sg, sizeof(*sa.tv)); - sa.tzp = NULL; - if ((error = copyin((caddr_t)uap->timep, - &(sa.tv->tv_sec), sizeof(long))) != 0) + SCARG(&sa, tv) = stackgap_alloc(&sg, sizeof(*SCARG(&sa, tv))); + SCARG(&sa, tzp) = NULL; + if ((error = copyin((caddr_t)SCARG(uap, timep), + &(SCARG(&sa, tv)->tv_sec), sizeof(long))) != 0) return error; - sa.tv->tv_usec = 0; + SCARG(&sa, tv)->tv_usec = 0; if ((error = settimeofday(td, &sa)) != 0) return EPERM; return 0; @@ -927,24 +927,24 @@ ibcs2_utime(td, uap) struct timeval *tp; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); - sa.path = uap->path; - if (uap->buf) { + CHECKALTEXIST(td, &sg, SCARG(uap, path)); + SCARG(&sa, path) = SCARG(uap, path); + if (SCARG(uap, buf)) { struct ibcs2_utimbuf ubuf; - if ((error = copyin((caddr_t)uap->buf, (caddr_t)&ubuf, + if ((error = copyin((caddr_t)SCARG(uap, buf), (caddr_t)&ubuf, sizeof(ubuf))) != 0) return error; - sa.tptr = stackgap_alloc(&sg, + SCARG(&sa, tptr) = stackgap_alloc(&sg, 2 * sizeof(struct timeval *)); - tp = (struct timeval *)sa.tptr; + tp = (struct timeval *)SCARG(&sa, tptr); tp->tv_sec = ubuf.actime; tp->tv_usec = 0; tp++; tp->tv_sec = ubuf.modtime; tp->tv_usec = 0; } else - sa.tptr = NULL; + SCARG(&sa, tptr) = NULL; return utimes(td, &sa); } @@ -956,9 +956,9 @@ ibcs2_nice(td, uap) int error; struct setpriority_args sa; - sa.which = PRIO_PROCESS; - sa.who = 0; - sa.prio = td->td_ksegrp->kg_nice + uap->incr; + SCARG(&sa, which) = PRIO_PROCESS; + SCARG(&sa, who) = 0; + SCARG(&sa, prio) = td->td_ksegrp->kg_nice + SCARG(uap, incr); if ((error = setpriority(td, &sa)) != 0) return EPERM; td->td_retval[0] = td->td_ksegrp->kg_nice; @@ -975,7 +975,7 @@ ibcs2_pgrpsys(td, uap) struct ibcs2_pgrpsys_args *uap; { struct proc *p = td->td_proc; - switch (uap->type) { + switch (SCARG(uap, type)) { case 0: /* getpgrp */ PROC_LOCK(p); td->td_retval[0] = p->p_pgrp->pg_id; @@ -986,8 +986,8 @@ ibcs2_pgrpsys(td, uap) { struct setpgid_args sa; - sa.pid = 0; - sa.pgid = 0; + SCARG(&sa, pid) = 0; + SCARG(&sa, pgid) = 0; setpgid(td, &sa); PROC_LOCK(p); td->td_retval[0] = p->p_pgrp->pg_id; @@ -999,8 +999,8 @@ ibcs2_pgrpsys(td, uap) { struct setpgid_args sa; - sa.pid = uap->pid; - sa.pgid = uap->pgid; + SCARG(&sa, pid) = SCARG(uap, pid); + SCARG(&sa, pgid) = SCARG(uap, pgid); return setpgid(td, &sa); } @@ -1030,7 +1030,7 @@ ibcs2_plock(td, uap) if ((error = suser(td)) != 0) return EPERM; - switch(uap->cmd) { + switch(SCARG(uap, cmd)) { case IBCS2_UNLOCK: case IBCS2_PROCLOCK: case IBCS2_TEXTLOCK: @@ -1066,10 +1066,10 @@ ibcs2_uadmin(td, uap) if (suser(td)) return EPERM; - switch(uap->cmd) { + switch(SCARG(uap, cmd)) { case SCO_A_REBOOT: case SCO_A_SHUTDOWN: - switch(uap->func) { + switch(SCARG(uap, func)) { struct reboot_args r; case SCO_AD_HALT: case SCO_AD_PWRDOWN: @@ -1101,7 +1101,7 @@ ibcs2_sysfs(td, uap) #define IBCS2_GETFSTYP 2 #define IBCS2_GETNFSTYP 3 - switch(uap->cmd) { + switch(SCARG(uap, cmd)) { case IBCS2_GETFSIND: case IBCS2_GETFSTYP: case IBCS2_GETNFSTYP: @@ -1117,7 +1117,7 @@ ibcs2_unlink(td, uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); return unlink(td, (struct unlink_args *)uap); } @@ -1128,7 +1128,7 @@ ibcs2_chdir(td, uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); return chdir(td, (struct chdir_args *)uap); } @@ -1139,7 +1139,7 @@ ibcs2_chmod(td, uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); return chmod(td, (struct chmod_args *)uap); } @@ -1150,7 +1150,7 @@ ibcs2_chown(td, uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); return chown(td, (struct chown_args *)uap); } @@ -1161,7 +1161,7 @@ ibcs2_rmdir(td, uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); return rmdir(td, (struct rmdir_args *)uap); } @@ -1172,7 +1172,7 @@ ibcs2_mkdir(td, uap) { caddr_t sg = stackgap_init(); - CHECKALTCREAT(td, &sg, uap->path); + CHECKALTCREAT(td, &sg, SCARG(uap, path)); return mkdir(td, (struct mkdir_args *)uap); } @@ -1183,8 +1183,8 @@ ibcs2_symlink(td, uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); - CHECKALTCREAT(td, &sg, uap->link); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); + CHECKALTCREAT(td, &sg, SCARG(uap, link)); return symlink(td, (struct symlink_args *)uap); } @@ -1195,8 +1195,8 @@ ibcs2_rename(td, uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->from); - CHECKALTCREAT(td, &sg, uap->to); + CHECKALTEXIST(td, &sg, SCARG(uap, from)); + CHECKALTCREAT(td, &sg, SCARG(uap, to)); return rename(td, (struct rename_args *)uap); } @@ -1207,6 +1207,6 @@ ibcs2_readlink(td, uap) { caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); return readlink(td, (struct readlink_args *) uap); } diff --git a/sys/i386/ibcs2/ibcs2_signal.c b/sys/i386/ibcs2/ibcs2_signal.c index 3a6082e..0084cbe 100644 --- a/sys/i386/ibcs2/ibcs2_signal.c +++ b/sys/i386/ibcs2/ibcs2_signal.c @@ -199,8 +199,8 @@ ibcs2_sigaction(td, uap) int error; sg = stackgap_init(); - nisa = uap->act; - oisa = uap->oact; + nisa = SCARG(uap, act); + oisa = SCARG(uap, oact); if (oisa != NULL) obsa = stackgap_alloc(&sg, sizeof(struct sigaction)); @@ -217,9 +217,9 @@ ibcs2_sigaction(td, uap) } else nbsa = NULL; - sa.sig = ibcs2_to_bsd_sig[_SIG_IDX(uap->sig)]; - sa.act = nbsa; - sa.oact = obsa; + SCARG(&sa, sig) = ibcs2_to_bsd_sig[_SIG_IDX(SCARG(uap, sig))]; + SCARG(&sa, act) = nbsa; + SCARG(&sa, oact) = obsa; if ((error = sigaction(td, &sa)) != 0) return error; @@ -242,24 +242,24 @@ ibcs2_sigsys(td, uap) { struct proc *p = td->td_proc; struct sigaction sa; - int signum = ibcs2_to_bsd_sig[_SIG_IDX(IBCS2_SIGNO(uap->sig))]; + int signum = ibcs2_to_bsd_sig[_SIG_IDX(IBCS2_SIGNO(SCARG(uap, sig)))]; int error; caddr_t sg = stackgap_init(); if (signum <= 0 || signum >= IBCS2_NSIG) { - if (IBCS2_SIGCALL(uap->sig) == IBCS2_SIGNAL_MASK || - IBCS2_SIGCALL(uap->sig) == IBCS2_SIGSET_MASK) + if (IBCS2_SIGCALL(SCARG(uap, sig)) == IBCS2_SIGNAL_MASK || + IBCS2_SIGCALL(SCARG(uap, sig)) == IBCS2_SIGSET_MASK) td->td_retval[0] = (int)IBCS2_SIG_ERR; return EINVAL; } - switch (IBCS2_SIGCALL(uap->sig)) { + switch (IBCS2_SIGCALL(SCARG(uap, sig))) { case IBCS2_SIGSET_MASK: /* * Check for SIG_HOLD action. * Otherwise, perform signal() except with different sa_flags. */ - if (uap->fp != IBCS2_SIG_HOLD) { + if (SCARG(uap, fp) != IBCS2_SIG_HOLD) { /* add sig to mask before exececuting signal handler */ sa.sa_flags = 0; goto ibcs2_sigset; @@ -273,9 +273,9 @@ ibcs2_sigsys(td, uap) SIGEMPTYSET(mask); SIGADDSET(mask, signum); - sa.how = SIG_BLOCK; - sa.set = &mask; - sa.oset = NULL; + SCARG(&sa, how) = SIG_BLOCK; + SCARG(&sa, set) = &mask; + SCARG(&sa, oset) = NULL; return sigprocmask(td, &sa); } @@ -296,11 +296,11 @@ ibcs2_sigsys(td, uap) ibcs2_sigset: nbsa = stackgap_alloc(&sg, sizeof(struct sigaction)); obsa = stackgap_alloc(&sg, sizeof(struct sigaction)); - sa_args.sig = signum; - sa_args.act = nbsa; - sa_args.oact = obsa; + SCARG(&sa_args, sig) = signum; + SCARG(&sa_args, act) = nbsa; + SCARG(&sa_args, oact) = obsa; - sa.sa_handler = uap->fp; + sa.sa_handler = SCARG(uap, fp); sigemptyset(&sa.sa_mask); #if 0 if (signum != SIGALRM) @@ -321,7 +321,7 @@ ibcs2_sigsys(td, uap) td->td_retval[0] = (int)sa.sa_handler; /* special sigset() check */ - if(IBCS2_SIGCALL(uap->sig) == IBCS2_SIGSET_MASK) { + if(IBCS2_SIGCALL(SCARG(uap, sig)) == IBCS2_SIGSET_MASK) { PROC_LOCK(p); /* check to make sure signal is not blocked */ if(sigismember(&p->p_sigmask, signum)) { @@ -343,9 +343,9 @@ ibcs2_sigsys(td, uap) SIGEMPTYSET(mask); SIGADDSET(mask, signum); - sa.how = SIG_UNBLOCK; - sa.set = &mask; - sa.oset = NULL; + SCARG(&sa, how) = SIG_UNBLOCK; + SCARG(&sa, set) = &mask; + SCARG(&sa, oset) = NULL; return sigprocmask(td, &sa); } @@ -355,9 +355,9 @@ ibcs2_sigsys(td, uap) struct sigaction *bsa; bsa = stackgap_alloc(&sg, sizeof(struct sigaction)); - sa_args.sig = signum; - sa_args.act = bsa; - sa_args.oact = NULL; + SCARG(&sa_args, sig) = signum; + SCARG(&sa_args, act) = bsa; + SCARG(&sa_args, oact) = NULL; sa.sa_handler = SIG_IGN; sigemptyset(&sa.sa_mask); @@ -380,7 +380,7 @@ ibcs2_sigsys(td, uap) mask = p->p_sigmask; PROC_UNLOCK(p); SIGDELSET(mask, signum); - sa.sigmask = &mask; + SCARG(&sa, sigmask) = &mask; return sigsuspend(td, &sa); } @@ -399,27 +399,27 @@ ibcs2_sigprocmask(td, uap) sigset_t bss; int error = 0; - if (uap->oset != NULL) { + if (SCARG(uap, oset) != NULL) { /* Fix the return value first if needed */ PROC_LOCK(p); bsd_to_ibcs2_sigset(&p->p_sigmask, &iss); PROC_UNLOCK(p); - if ((error = copyout(&iss, uap->oset, sizeof(iss))) != 0) + if ((error = copyout(&iss, SCARG(uap, oset), sizeof(iss))) != 0) return error; } - if (uap->set == NULL) + if (SCARG(uap, set) == NULL) /* Just examine */ return 0; - if ((error = copyin(uap->set, &iss, sizeof(iss))) != 0) + if ((error = copyin(SCARG(uap, set), &iss, sizeof(iss))) != 0) return error; ibcs2_to_bsd_sigset(&iss, &bss); PROC_LOCK(p); - switch (uap->how) { + switch (SCARG(uap, how)) { case IBCS2_SIG_BLOCK: SIGSETOR(p->p_sigmask, bss); SIG_CANTMASK(p->p_sigmask); @@ -461,7 +461,7 @@ ibcs2_sigpending(td, uap) PROC_UNLOCK(p); bsd_to_ibcs2_sigset(&bss, &iss); - return copyout(&iss, uap->mask, sizeof(iss)); + return copyout(&iss, SCARG(uap, mask), sizeof(iss)); } int @@ -474,11 +474,11 @@ ibcs2_sigsuspend(td, uap) struct sigsuspend_args sa; int error; - if ((error = copyin(uap->mask, &sss, sizeof(sss))) != 0) + if ((error = copyin(SCARG(uap, mask), &sss, sizeof(sss))) != 0) return error; ibcs2_to_bsd_sigset(&sss, &bss); - sa.sigmask = &bss; + SCARG(&sa, sigmask) = &bss; return sigsuspend(td, &sa); } @@ -494,7 +494,7 @@ ibcs2_pause(td, uap) PROC_LOCK(p); mask = td->td_proc->p_sigmask; PROC_UNLOCK(p); - sa.sigmask = &mask; + SCARG(&sa, sigmask) = &mask; return sigsuspend(td, &sa); } @@ -505,7 +505,7 @@ ibcs2_kill(td, uap) { struct kill_args ka; - ka.pid = uap->pid; - ka.signum = ibcs2_to_bsd_sig[_SIG_IDX(uap->signo)]; + SCARG(&ka, pid) = SCARG(uap, pid); + SCARG(&ka, signum) = ibcs2_to_bsd_sig[_SIG_IDX(SCARG(uap, signo))]; return kill(td, &ka); } diff --git a/sys/i386/ibcs2/ibcs2_stat.c b/sys/i386/ibcs2/ibcs2_stat.c index 7992535..062a5b5 100644 --- a/sys/i386/ibcs2/ibcs2_stat.c +++ b/sys/i386/ibcs2/ibcs2_stat.c @@ -106,8 +106,8 @@ ibcs2_statfs(td, uap) struct nameidata nd; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -117,7 +117,7 @@ ibcs2_statfs(td, uap) if ((error = VFS_STATFS(mp, sp, td)) != 0) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - return cvt_statfs(sp, (caddr_t)uap->buf, uap->len); + return cvt_statfs(sp, (caddr_t)SCARG(uap, buf), SCARG(uap, len)); } int @@ -130,7 +130,7 @@ ibcs2_fstatfs(td, uap) register struct statfs *sp; int error; - if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) + if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0) return (error); mp = ((struct vnode *)fp->f_data)->v_mount; sp = &mp->mnt_stat; @@ -139,7 +139,7 @@ ibcs2_fstatfs(td, uap) if (error != 0) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - return cvt_statfs(sp, (caddr_t)uap->buf, uap->len); + return cvt_statfs(sp, (caddr_t)SCARG(uap, buf), SCARG(uap, len)); } int @@ -153,17 +153,17 @@ ibcs2_stat(td, uap) int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); - cup.path = uap->path; - cup.ub = stackgap_alloc(&sg, sizeof(st)); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(st)); if ((error = stat(td, &cup)) != 0) return error; - if ((error = copyin(cup.ub, &st, sizeof(st))) != 0) + if ((error = copyin(SCARG(&cup, ub), &st, sizeof(st))) != 0) return error; bsd_stat2ibcs_stat(&st, &ibcs2_st); - return copyout((caddr_t)&ibcs2_st, (caddr_t)uap->st, + return copyout((caddr_t)&ibcs2_st, (caddr_t)SCARG(uap, st), ibcs2_stat_len); } @@ -178,17 +178,17 @@ ibcs2_lstat(td, uap) int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); - cup.path = uap->path; - cup.ub = stackgap_alloc(&sg, sizeof(st)); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(st)); if ((error = lstat(td, &cup)) != 0) return error; - if ((error = copyin(cup.ub, &st, sizeof(st))) != 0) + if ((error = copyin(SCARG(&cup, ub), &st, sizeof(st))) != 0) return error; bsd_stat2ibcs_stat(&st, &ibcs2_st); - return copyout((caddr_t)&ibcs2_st, (caddr_t)uap->st, + return copyout((caddr_t)&ibcs2_st, (caddr_t)SCARG(uap, st), ibcs2_stat_len); } @@ -203,16 +203,16 @@ ibcs2_fstat(td, uap) int error; caddr_t sg = stackgap_init(); - cup.fd = uap->fd; - cup.sb = stackgap_alloc(&sg, sizeof(st)); + SCARG(&cup, fd) = SCARG(uap, fd); + SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(st)); if ((error = fstat(td, &cup)) != 0) return error; - if ((error = copyin(cup.sb, &st, sizeof(st))) != 0) + if ((error = copyin(SCARG(&cup, sb), &st, sizeof(st))) != 0) return error; bsd_stat2ibcs_stat(&st, &ibcs2_st); - return copyout((caddr_t)&ibcs2_st, (caddr_t)uap->st, + return copyout((caddr_t)&ibcs2_st, (caddr_t)SCARG(uap, st), ibcs2_stat_len); } @@ -221,7 +221,7 @@ ibcs2_utssys(td, uap) struct thread *td; struct ibcs2_utssys_args *uap; { - switch (uap->flag) { + switch (SCARG(uap, flag)) { case 0: /* uname(2) */ { char machine_name[9], *p; @@ -245,7 +245,7 @@ ibcs2_utssys(td, uap) DPRINTF(("IBCS2 uname: sys=%s rel=%s ver=%s node=%s mach=%s\n", sut.sysname, sut.release, sut.version, sut.nodename, sut.machine)); - return copyout((caddr_t)&sut, (caddr_t)uap->a1, + return copyout((caddr_t)&sut, (caddr_t)SCARG(uap, a1), ibcs2_utsname_len); } diff --git a/sys/i386/ibcs2/ibcs2_sysi86.c b/sys/i386/ibcs2/ibcs2_sysi86.c index a2d94f0..62e1cac 100644 --- a/sys/i386/ibcs2/ibcs2_sysi86.c +++ b/sys/i386/ibcs2/ibcs2_sysi86.c @@ -53,14 +53,14 @@ extern int hw_float; int ibcs2_sysi86(struct thread *td, struct ibcs2_sysi86_args *args) { - switch (args->cmd) { + switch (SCARG(args, cmd)) { case SI86_FPHW: { /* Floating Point information */ int val, error; if (hw_float) val = IBCS2_FP_387; /* FPU hardware */ else val = IBCS2_FP_SW; /* FPU emulator */ - if ((error = copyout(&val, args->arg, sizeof(val))) != 0) + if ((error = copyout(&val, SCARG(args, arg), sizeof(val))) != 0) return error; return 0; } @@ -78,7 +78,7 @@ ibcs2_sysi86(struct thread *td, struct ibcs2_sysi86_args *args) name[0] = CTL_KERN; name[1] = KERN_HOSTNAME; return (userland_sysctl(td, name, 2, 0, 0, 0, - args->arg, 7, 0)); + SCARG(args, arg), 7, 0)); } case SI86_MEM: /* size of physical memory */ @@ -88,7 +88,7 @@ ibcs2_sysi86(struct thread *td, struct ibcs2_sysi86_args *args) default: #ifdef DIAGNOSTIC printf("IBCS2: 'sysi86' function %d(0x%x) " - "not implemented yet\n", args->cmd, args->cmd); + "not implemented yet\n", SCARG(args, cmd), args->cmd); #endif return EINVAL; } diff --git a/sys/i386/ibcs2/ibcs2_util.h b/sys/i386/ibcs2/ibcs2_util.h index 7c26748..a3b7357 100644 --- a/sys/i386/ibcs2/ibcs2_util.h +++ b/sys/i386/ibcs2/ibcs2_util.h @@ -52,6 +52,10 @@ #include <sys/sysent.h> #include <sys/proc.h> +#ifndef SCARG +#define SCARG(p, x) (p)->x +#endif + static __inline caddr_t stackgap_init(void); static __inline void *stackgap_alloc(caddr_t *, size_t); diff --git a/sys/i386/ibcs2/ibcs2_xenix.c b/sys/i386/ibcs2/ibcs2_xenix.c index 9aea547..356161b 100644 --- a/sys/i386/ibcs2/ibcs2_xenix.c +++ b/sys/i386/ibcs2/ibcs2_xenix.c @@ -79,12 +79,12 @@ xenix_rdchk(td, uap) caddr_t sg = stackgap_init(); DPRINTF(("IBCS2: 'xenix rdchk'\n")); - sa.fd = uap->fd; - sa.com = FIONREAD; - sa.data = stackgap_alloc(&sg, sizeof(int)); + SCARG(&sa, fd) = SCARG(uap, fd); + SCARG(&sa, com) = FIONREAD; + SCARG(&sa, data) = stackgap_alloc(&sg, sizeof(int)); if ((error = ioctl(td, &sa)) != 0) return error; - td->td_retval[0] = (*((int*)sa.data)) ? 1 : 0; + td->td_retval[0] = (*((int*)SCARG(&sa, data))) ? 1 : 0; return 0; } @@ -96,9 +96,9 @@ xenix_chsize(td, uap) struct ftruncate_args sa; DPRINTF(("IBCS2: 'xenix chsize'\n")); - sa.fd = uap->fd; - sa.pad = 0; - sa.length = uap->size; + SCARG(&sa, fd) = SCARG(uap, fd); + SCARG(&sa, pad) = 0; + SCARG(&sa, length) = SCARG(uap, size); return ftruncate(td, &sa); } @@ -123,7 +123,7 @@ xenix_ftime(td, uap) itb.timezone = tz.tz_minuteswest; itb.dstflag = tz.tz_dsttime != DST_NONE; - return copyout((caddr_t)&itb, (caddr_t)uap->tp, + return copyout((caddr_t)&itb, (caddr_t)SCARG(uap, tp), sizeof(struct ibcs2_timeb)); } @@ -132,8 +132,8 @@ xenix_nap(struct thread *td, struct xenix_nap_args *uap) { long period; - DPRINTF(("IBCS2: 'xenix nap %d ms'\n", uap->millisec)); - period = (long)uap->millisec / (1000/hz); + DPRINTF(("IBCS2: 'xenix nap %d ms'\n", SCARG(uap, millisec))); + period = (long)SCARG(uap, millisec) / (1000/hz); if (period) while (tsleep(&period, PPAUSE, "nap", period) != EWOULDBLOCK) ; @@ -200,22 +200,22 @@ xenix_eaccess(struct thread *td, struct xenix_eaccess_args *uap) int error, flags; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return error; vp = nd.ni_vp; /* Flags == 0 means only check for existence. */ - if (uap->flags) { + if (SCARG(uap, flags)) { flags = 0; - if (uap->flags & IBCS2_R_OK) + if (SCARG(uap, flags) & IBCS2_R_OK) flags |= VREAD; - if (uap->flags & IBCS2_W_OK) + if (SCARG(uap, flags) & IBCS2_W_OK) flags |= VWRITE; - if (uap->flags & IBCS2_X_OK) + if (SCARG(uap, flags) & IBCS2_X_OK) flags |= VEXEC; if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0) error = VOP_ACCESS(vp, flags, cred, td); diff --git a/sys/i386/svr4/svr4_machdep.c b/sys/i386/svr4/svr4_machdep.c index bf8aecb..c015888 100644 --- a/sys/i386/svr4/svr4_machdep.c +++ b/sys/i386/svr4/svr4_machdep.c @@ -535,7 +535,7 @@ svr4_sys_sysarch(td, v) struct svr4_ssd ssd; union descriptor bsd; - if ((error = copyin(uap->a1, &ssd, + if ((error = copyin(SCARG(uap, a1), &ssd, sizeof(ssd))) != 0) { printf("Cannot copy arg1\n"); return error; @@ -580,8 +580,8 @@ svr4_sys_sysarch(td, v) return error; } - ua.op = I386_SET_LDT; - ua.parms = (char *) sap; + SCARG(&ua, op) = I386_SET_LDT; + SCARG(&ua, parms) = (char *) sap; if ((error = copyout(&bsd, sa.desc, sizeof(bsd))) != 0) { printf("Cannot copyout desc\n"); |