diff options
author | alfred <alfred@FreeBSD.org> | 2002-12-13 22:41:47 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2002-12-13 22:41:47 +0000 |
commit | 4f48184fb2c8948c406b21c3f802b5b281cef957 (patch) | |
tree | a1ef524330ea7e253fb665abea3ddb594cde69fc /sys/compat/svr4 | |
parent | d19b4e039d47537b44233aae83d03b974d29d771 (diff) | |
download | FreeBSD-src-4f48184fb2c8948c406b21c3f802b5b281cef957.zip FreeBSD-src-4f48184fb2c8948c406b21c3f802b5b281cef957.tar.gz |
Backout removal SCARGS, the code freeze is only "selectively" over.
Diffstat (limited to 'sys/compat/svr4')
-rw-r--r-- | sys/compat/svr4/svr4_fcntl.c | 122 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_filio.c | 34 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_ioctl.c | 10 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_ipc.c | 166 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_misc.c | 280 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_resource.c | 16 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_signal.c | 82 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_socket.c | 12 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_stat.c | 148 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_stream.c | 166 |
10 files changed, 518 insertions, 518 deletions
diff --git a/sys/compat/svr4/svr4_fcntl.c b/sys/compat/svr4/svr4_fcntl.c index 60d5edf..fa4ddf2 100644 --- a/sys/compat/svr4/svr4_fcntl.c +++ b/sys/compat/svr4/svr4_fcntl.c @@ -349,8 +349,8 @@ fd_truncate(td, fd, flp) return EINVAL; } - ft.fd = fd; - ft.length = start; + SCARG(&ft, fd) = fd; + SCARG(&ft, length) = start; error = ftruncate(td, &ft); @@ -368,7 +368,7 @@ svr4_sys_open(td, uap) struct open_args cup; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); (&cup)->path = uap->path; (&cup)->flags = svr4_to_bsd_flags(uap->flags); @@ -384,7 +384,7 @@ svr4_sys_open(td, uap) retval = td->td_retval[0]; PROC_LOCK(p); - if (!(cup.flags & O_NOCTTY) && SESS_LEADER(p) && + if (!(SCARG(&cup, flags) & O_NOCTTY) && SESS_LEADER(p) && !(td->td_proc->p_flag & P_CONTROLT)) { #if defined(NOTYET) struct file *fp; @@ -428,11 +428,11 @@ svr4_sys_creat(td, uap) struct open_args cup; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); - cup.path = uap->path; - cup.mode = uap->mode; - cup.flags = O_WRONLY | O_CREAT | O_TRUNC; + 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); } @@ -452,16 +452,16 @@ svr4_sys_llseek(td, uap) { struct lseek_args ap; - ap.fd = uap->fd; + SCARG(&ap, fd) = SCARG(uap, fd); #if BYTE_ORDER == BIG_ENDIAN - ap.offset = (((u_int64_t) uap->offset1) << 32) | - uap->offset2; + SCARG(&ap, offset) = (((u_int64_t) SCARG(uap, offset1)) << 32) | + SCARG(uap, offset2); #else - ap.offset = (((u_int64_t) uap->offset2) << 32) | - uap->offset1; + SCARG(&ap, offset) = (((u_int64_t) SCARG(uap, offset2)) << 32) | + SCARG(uap, offset1); #endif - ap.whence = uap->whence; + SCARG(&ap, whence) = SCARG(uap, whence); return lseek(td, &ap); } @@ -475,12 +475,12 @@ svr4_sys_access(td, uap) int *retval; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); retval = td->td_retval; - cup.path = uap->path; - cup.flags = uap->flags; + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, flags) = SCARG(uap, flags); return access(td, &cup); } @@ -497,10 +497,10 @@ svr4_sys_pread(td, uap) * Just translate the args structure and call the NetBSD * pread(2) system call (offset type is 64-bit in NetBSD). */ - pra.fd = uap->fd; - pra.buf = uap->buf; - pra.nbyte = uap->nbyte; - pra.offset = uap->off; + SCARG(&pra, fd) = SCARG(uap, fd); + SCARG(&pra, buf) = SCARG(uap, buf); + SCARG(&pra, nbyte) = SCARG(uap, nbyte); + SCARG(&pra, offset) = SCARG(uap, off); return pread(td, &pra); } @@ -521,10 +521,10 @@ svr4_sys_pread64(td, v, retval) * Just translate the args structure and call the NetBSD * pread(2) system call (offset type is 64-bit in NetBSD). */ - pra.fd = uap->fd; - pra.buf = uap->buf; - pra.nbyte = uap->nbyte; - pra.offset = uap->off; + SCARG(&pra, fd) = SCARG(uap, fd); + SCARG(&pra, buf) = SCARG(uap, buf); + SCARG(&pra, nbyte) = SCARG(uap, nbyte); + SCARG(&pra, offset) = SCARG(uap, off); return (sys_pread(td, &pra, retval)); } @@ -542,10 +542,10 @@ svr4_sys_pwrite(td, uap) * Just translate the args structure and call the NetBSD * pwrite(2) system call (offset type is 64-bit in NetBSD). */ - pwa.fd = uap->fd; - pwa.buf = uap->buf; - pwa.nbyte = uap->nbyte; - pwa.offset = uap->off; + SCARG(&pwa, fd) = SCARG(uap, fd); + SCARG(&pwa, buf) = SCARG(uap, buf); + SCARG(&pwa, nbyte) = SCARG(uap, nbyte); + SCARG(&pwa, offset) = SCARG(uap, off); return pwrite(td, &pwa); } @@ -565,10 +565,10 @@ svr4_sys_pwrite64(td, v, retval) * Just translate the args structure and call the NetBSD * pwrite(2) system call (offset type is 64-bit in NetBSD). */ - pwa.fd = uap->fd; - pwa.buf = uap->buf; - pwa.nbyte = uap->nbyte; - pwa.offset = uap->off; + SCARG(&pwa, fd) = SCARG(uap, fd); + SCARG(&pwa, buf) = SCARG(uap, buf); + SCARG(&pwa, nbyte) = SCARG(uap, nbyte); + SCARG(&pwa, offset) = SCARG(uap, off); return (sys_pwrite(td, &pwa, retval)); } @@ -585,18 +585,18 @@ svr4_sys_fcntl(td, uap) retval = td->td_retval; - fa.fd = uap->fd; - fa.cmd = svr4_to_bsd_cmd(uap->cmd); + SCARG(&fa, fd) = SCARG(uap, fd); + SCARG(&fa, cmd) = svr4_to_bsd_cmd(SCARG(uap, cmd)); - switch (fa.cmd) { + switch (SCARG(&fa, cmd)) { case F_DUPFD: case F_GETFD: case F_SETFD: - fa.arg = (long) uap->arg; + SCARG(&fa, arg) = (long) SCARG(uap, arg); return fcntl(td, &fa); case F_GETFL: - fa.arg = (long) uap->arg; + SCARG(&fa, arg) = (long) SCARG(uap, arg); error = fcntl(td, &fa); if (error) return error; @@ -612,17 +612,17 @@ svr4_sys_fcntl(td, uap) long cmd; int flags; - DPRINTF(("Setting flags %p\n", uap->arg)); - cmd = fa.cmd; /* save it for a while */ + DPRINTF(("Setting flags %p\n", SCARG(uap, arg))); + cmd = SCARG(&fa, cmd); /* save it for a while */ - fa.cmd = F_GETFL; + SCARG(&fa, cmd) = F_GETFL; if ((error = fcntl(td, &fa)) != 0) return error; flags = *retval; flags &= O_ASYNC; - flags |= svr4_to_bsd_flags((u_long) uap->arg); - fa.cmd = cmd; - fa.arg = (long) flags; + flags |= svr4_to_bsd_flags((u_long) SCARG(uap, arg)); + SCARG(&fa, cmd) = cmd; + SCARG(&fa, arg) = (long) flags; return fcntl(td, &fa); } @@ -635,9 +635,9 @@ svr4_sys_fcntl(td, uap) caddr_t sg = stackgap_init(); flp = stackgap_alloc(&sg, sizeof(struct flock)); - fa.arg = (long) flp; + SCARG(&fa, arg) = (long) flp; - error = copyin(uap->arg, &ifl, sizeof ifl); + error = copyin(SCARG(uap, arg), &ifl, sizeof ifl); if (error) return error; @@ -648,7 +648,7 @@ svr4_sys_fcntl(td, uap) return error; error = fcntl(td, &fa); - if (error || fa.cmd != F_GETLK) + if (error || SCARG(&fa, cmd) != F_GETLK) return error; error = copyin(flp, &fl, sizeof fl); @@ -657,20 +657,20 @@ svr4_sys_fcntl(td, uap) bsd_to_svr4_flock(&fl, &ifl); - return copyout(&ifl, uap->arg, sizeof ifl); + return copyout(&ifl, SCARG(uap, arg), sizeof ifl); } case -1: - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case SVR4_F_DUP2FD: { struct dup2_args du; - du.from = uap->fd; - du.to = (int)uap->arg; + SCARG(&du, from) = SCARG(uap, fd); + SCARG(&du, to) = (int)SCARG(uap, arg); error = dup2(td, &du); if (error) return error; - *retval = du.to; + *retval = SCARG(&du, to); return 0; } @@ -679,12 +679,12 @@ svr4_sys_fcntl(td, uap) struct svr4_flock ifl; struct flock fl; - error = copyin(uap->arg, &ifl, + error = copyin(SCARG(uap, arg), &ifl, sizeof ifl); if (error) return error; svr4_to_bsd_flock(&ifl, &fl); - return fd_truncate(td, uap->fd, &fl); + return fd_truncate(td, SCARG(uap, fd), &fl); } case SVR4_F_GETLK64: @@ -696,9 +696,9 @@ svr4_sys_fcntl(td, uap) caddr_t sg = stackgap_init(); flp = stackgap_alloc(&sg, sizeof(struct flock)); - fa.arg = (long) flp; + SCARG(&fa, arg) = (long) flp; - error = copyin(uap->arg, &ifl, + error = copyin(SCARG(uap, arg), &ifl, sizeof ifl); if (error) return error; @@ -710,7 +710,7 @@ svr4_sys_fcntl(td, uap) return error; error = fcntl(td, &fa); - if (error || fa.cmd != F_GETLK) + if (error || SCARG(&fa, cmd) != F_GETLK) return error; error = copyin(flp, &fl, sizeof fl); @@ -719,7 +719,7 @@ svr4_sys_fcntl(td, uap) bsd_to_svr4_flock64(&fl, &ifl); - return copyout(&ifl, uap->arg, + return copyout(&ifl, SCARG(uap, arg), sizeof ifl); } @@ -728,16 +728,16 @@ svr4_sys_fcntl(td, uap) struct svr4_flock64 ifl; struct flock fl; - error = copyin(uap->arg, &ifl, + error = copyin(SCARG(uap, arg), &ifl, sizeof ifl); if (error) return error; svr4_to_bsd_flock64(&ifl, &fl); - return fd_truncate(td, uap->fd, &fl); + return fd_truncate(td, SCARG(uap, fd), &fl); } case SVR4_F_REVOKE: - return fd_revoke(td, uap->fd); + return fd_revoke(td, SCARG(uap, fd)); default: return ENOSYS; diff --git a/sys/compat/svr4/svr4_filio.c b/sys/compat/svr4/svr4_filio.c index f4b0950..c2bad1d 100644 --- a/sys/compat/svr4/svr4_filio.c +++ b/sys/compat/svr4/svr4_filio.c @@ -63,26 +63,26 @@ svr4_sys_poll(td, uap) int idx = 0, cerr; u_long siz; - pa.fds = uap->fds; - pa.nfds = uap->nfds; - pa.timeout = uap->timeout; + SCARG(&pa, fds) = SCARG(uap, fds); + SCARG(&pa, nfds) = SCARG(uap, nfds); + SCARG(&pa, timeout) = SCARG(uap, timeout); - siz = uap->nfds * sizeof(struct pollfd); + siz = SCARG(uap, nfds) * sizeof(struct pollfd); pfd = (struct pollfd *)malloc(siz, M_TEMP, M_WAITOK); error = poll(td, (struct poll_args *)uap); - if ((cerr = copyin(uap->fds, pfd, siz)) != 0) { + if ((cerr = copyin(SCARG(uap, fds), pfd, siz)) != 0) { error = cerr; goto done; } - for (idx = 0; idx < uap->nfds; idx++) { + for (idx = 0; idx < SCARG(uap, nfds); idx++) { /* POLLWRNORM already equals POLLOUT, so we don't worry about that */ if (pfd[idx].revents & (POLLOUT | POLLWRNORM | POLLWRBAND)) pfd[idx].revents |= (POLLOUT | POLLWRNORM | POLLWRBAND); } - if ((cerr = copyout(pfd, uap->fds, siz)) != 0) { + if ((cerr = copyout(pfd, SCARG(uap, fds), siz)) != 0) { error = cerr; goto done; /* yeah, I know it's the next line, but this way I won't forget to update it if I add more code */ @@ -105,9 +105,9 @@ svr4_sys_read(td, uap) sigset_t sigmask; int rv; - ra.fd = uap->fd; - ra.buf = uap->buf; - ra.nbyte = uap->nbyte; + SCARG(&ra, fd) = SCARG(uap, fd); + SCARG(&ra, buf) = SCARG(uap, buf); + SCARG(&ra, nbyte) = SCARG(uap, nbyte); if (fget(td, uap->fd, &fp) != 0) { DPRINTF(("Something fishy with the user-supplied file descriptor...\n")); @@ -116,9 +116,9 @@ svr4_sys_read(td, uap) if (fp->f_type == DTYPE_SOCKET) { so = (struct socket *)fp->f_data; - DPRINTF(("fd %d is a socket\n", uap->fd)); + DPRINTF(("fd %d is a socket\n", SCARG(uap, fd))); if (so->so_state & SS_ASYNC) { - DPRINTF(("fd %d is an ASYNC socket!\n", uap->fd)); + DPRINTF(("fd %d is an ASYNC socket!\n", SCARG(uap, fd))); } DPRINTF(("Here are its flags: 0x%x\n", so->so_state)); #if defined(GROTTY_READ_HACK) @@ -130,7 +130,7 @@ svr4_sys_read(td, uap) rv = read(td, &ra); DPRINTF(("svr4_read(%d, 0x%0x, %d) = %d\n", - uap->fd, uap->buf, uap->nbyte, rv)); + SCARG(uap, fd), SCARG(uap, buf), SCARG(uap, nbyte), rv)); if (rv == EAGAIN) { DPRINTF(("sigmask = 0x%x\n", td->td_proc->p_sigmask)); DPRINTF(("sigignore = 0x%x\n", td->td_proc->p_sigignore)); @@ -159,14 +159,14 @@ svr4_sys_write(td, uap) struct file *fp; int rv; - wa.fd = uap->fd; - wa.buf = uap->buf; - wa.nbyte = uap->nbyte; + SCARG(&wa, fd) = SCARG(uap, fd); + SCARG(&wa, buf) = SCARG(uap, buf); + SCARG(&wa, nbyte) = SCARG(uap, nbyte); rv = write(td, &wa); DPRINTF(("svr4_write(%d, 0x%0x, %d) = %d\n", - uap->fd, uap->buf, uap->nbyte, rv)); + SCARG(uap, fd), SCARG(uap, buf), SCARG(uap, nbyte), rv)); return(rv); } diff --git a/sys/compat/svr4/svr4_ioctl.c b/sys/compat/svr4/svr4_ioctl.c index cabfcb3..50d28ee 100644 --- a/sys/compat/svr4/svr4_ioctl.c +++ b/sys/compat/svr4/svr4_ioctl.c @@ -94,13 +94,13 @@ svr4_sys_ioctl(td, uap) int num; int argsiz; - svr4_decode_cmd(uap->com, dir, &c, &num, &argsiz); + svr4_decode_cmd(SCARG(uap, com), dir, &c, &num, &argsiz); - DPRINTF(("svr4_ioctl[%lx](%d, _IO%s(%c, %d, %d), %p);\n", uap->com, uap->fd, - dir, c, num, argsiz, uap->data)); + DPRINTF(("svr4_ioctl[%lx](%d, _IO%s(%c, %d, %d), %p);\n", SCARG(uap, com), SCARG(uap, fd), + dir, c, num, argsiz, SCARG(uap, data))); #endif retval = td->td_retval; - cmd = uap->com; + cmd = SCARG(uap, com); if ((error = fget(td, uap->fd, &fp)) != 0) return (error); @@ -161,7 +161,7 @@ svr4_sys_ioctl(td, uap) DPRINTF((">>> OUT: so_state = 0x%x\n", so->so_state)); } #endif - error = (*fun)(fp, td, retval, uap->fd, cmd, uap->data); + error = (*fun)(fp, td, retval, SCARG(uap, fd), cmd, SCARG(uap, data)); fdrop(fp, td); return (error); } diff --git a/sys/compat/svr4/svr4_ipc.c b/sys/compat/svr4/svr4_ipc.c index 28d3321..17caaa5 100644 --- a/sys/compat/svr4/svr4_ipc.c +++ b/sys/compat/svr4/svr4_ipc.c @@ -221,55 +221,55 @@ svr4_semctl(p, v, retval) struct semid_ds bs, *bsp; caddr_t sg = stackgap_init(); - ap.semid = uap->semid; - ap.semnum = uap->semnum; + SCARG(&ap, semid) = SCARG(uap, semid); + SCARG(&ap, semnum) = SCARG(uap, semnum); - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case SVR4_SEM_GETZCNT: case SVR4_SEM_GETNCNT: case SVR4_SEM_GETPID: case SVR4_SEM_GETVAL: - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case SVR4_SEM_GETZCNT: - ap.cmd = GETZCNT; + SCARG(&ap, cmd) = GETZCNT; break; case SVR4_SEM_GETNCNT: - ap.cmd = GETNCNT; + SCARG(&ap, cmd) = GETNCNT; break; case SVR4_SEM_GETPID: - ap.cmd = GETPID; + SCARG(&ap, cmd) = GETPID; break; case SVR4_SEM_GETVAL: - ap.cmd = GETVAL; + SCARG(&ap, cmd) = GETVAL; break; } return sys___semctl(p, &ap, retval); case SVR4_SEM_SETVAL: - error = svr4_setsemun(&sg, &ap.arg, &uap->arg); + error = svr4_setsemun(&sg, &SCARG(&ap, arg), &SCARG(uap, arg)); if (error) return error; - ap.cmd = SETVAL; + SCARG(&ap, cmd) = SETVAL; return sys___semctl(p, &ap, retval); case SVR4_SEM_GETALL: - error = svr4_setsemun(&sg, &ap.arg, &uap->arg); + error = svr4_setsemun(&sg, &SCARG(&ap, arg), &SCARG(uap, arg)); if (error) return error; - ap.cmd = GETVAL; + SCARG(&ap, cmd) = GETVAL; return sys___semctl(p, &ap, retval); case SVR4_SEM_SETALL: - error = svr4_setsemun(&sg, &ap.arg, &uap->arg); + error = svr4_setsemun(&sg, &SCARG(&ap, arg), &SCARG(uap, arg)); if (error) return error; - ap.cmd = SETVAL; + SCARG(&ap, cmd) = SETVAL; return sys___semctl(p, &ap, retval); case SVR4_IPC_STAT: - ap.cmd = IPC_STAT; + SCARG(&ap, cmd) = IPC_STAT; bsp = stackgap_alloc(&sg, sizeof(bs)); - error = svr4_setsemun(&sg, &ap.arg, + error = svr4_setsemun(&sg, &SCARG(&ap, arg), (union semun *)&bsp); if (error) return error; @@ -279,16 +279,16 @@ svr4_semctl(p, v, retval) if (error) return error; bsd_to_svr4_semid_ds(&bs, &ss); - return copyout(&ss, uap->arg.buf, sizeof(ss)); + return copyout(&ss, SCARG(uap, arg).buf, sizeof(ss)); case SVR4_IPC_SET: - ap.cmd = IPC_SET; + SCARG(&ap, cmd) = IPC_SET; bsp = stackgap_alloc(&sg, sizeof(bs)); - error = svr4_setsemun(&sg, &ap.arg, + error = svr4_setsemun(&sg, &SCARG(&ap, arg), (union semun *)&bsp); if (error) return error; - error = copyin(uap->arg.buf, (caddr_t) &ss, sizeof ss); + error = copyin(SCARG(uap, arg).buf, (caddr_t) &ss, sizeof ss); if (error) return error; svr4_to_bsd_semid_ds(&ss, &bs); @@ -298,13 +298,13 @@ svr4_semctl(p, v, retval) return sys___semctl(p, &ap, retval); case SVR4_IPC_RMID: - ap.cmd = IPC_RMID; + SCARG(&ap, cmd) = IPC_RMID; bsp = stackgap_alloc(&sg, sizeof(bs)); - error = svr4_setsemun(&sg, &ap.arg, + error = svr4_setsemun(&sg, &SCARG(&ap, arg), (union semun *)&bsp); if (error) return error; - error = copyin(uap->arg.buf, &ss, sizeof ss); + error = copyin(SCARG(uap, arg).buf, &ss, sizeof ss); if (error) return error; svr4_to_bsd_semid_ds(&ss, &bs); @@ -334,9 +334,9 @@ svr4_semget(p, v, retval) struct svr4_sys_semget_args *uap = v; struct sys_semget_args ap; - ap.key = uap->key; - ap.nsems = uap->nsems; - ap.semflg = uap->semflg; + SCARG(&ap, key) = SCARG(uap, key); + SCARG(&ap, nsems) = SCARG(uap, nsems); + SCARG(&ap, semflg) = SCARG(uap, semflg); return sys_semget(p, &ap, retval); } @@ -357,10 +357,10 @@ svr4_semop(p, v, retval) struct svr4_sys_semop_args *uap = v; struct sys_semop_args ap; - ap.semid = uap->semid; + SCARG(&ap, semid) = SCARG(uap, semid); /* These are the same */ - ap.sops = (struct sembuf *) uap->sops; - ap.nsops = uap->nsops; + SCARG(&ap, sops) = (struct sembuf *) SCARG(uap, sops); + SCARG(&ap, nsops) = SCARG(uap, nsops); return sys_semop(p, &ap, retval); } @@ -373,9 +373,9 @@ svr4_sys_semsys(p, v, retval) { struct svr4_sys_semsys_args *uap = v; - DPRINTF(("svr4_semsys(%d)\n", uap->what)); + DPRINTF(("svr4_semsys(%d)\n", SCARG(uap, what))); - switch (uap->what) { + switch (SCARG(uap, what)) { case SVR4_semctl: return svr4_semctl(p, v, retval); case SVR4_semget: @@ -462,10 +462,10 @@ svr4_msgsnd(p, v, retval) struct svr4_sys_msgsnd_args *uap = v; struct sys_msgsnd_args ap; - ap.msqid = uap->msqid; - ap.msgp = uap->msgp; - ap.msgsz = uap->msgsz; - ap.msgflg = uap->msgflg; + SCARG(&ap, msqid) = SCARG(uap, msqid); + SCARG(&ap, msgp) = SCARG(uap, msgp); + SCARG(&ap, msgsz) = SCARG(uap, msgsz); + SCARG(&ap, msgflg) = SCARG(uap, msgflg); return sys_msgsnd(p, &ap, retval); } @@ -488,11 +488,11 @@ svr4_msgrcv(p, v, retval) struct svr4_sys_msgrcv_args *uap = v; struct sys_msgrcv_args ap; - ap.msqid = uap->msqid; - ap.msgp = uap->msgp; - ap.msgsz = uap->msgsz; - ap.msgtyp = uap->msgtyp; - ap.msgflg = uap->msgflg; + SCARG(&ap, msqid) = SCARG(uap, msqid); + SCARG(&ap, msgp) = SCARG(uap, msgp); + SCARG(&ap, msgsz) = SCARG(uap, msgsz); + SCARG(&ap, msgtyp) = SCARG(uap, msgtyp); + SCARG(&ap, msgflg) = SCARG(uap, msgflg); return sys_msgrcv(p, &ap, retval); } @@ -512,8 +512,8 @@ svr4_msgget(p, v, retval) struct svr4_sys_msgget_args *uap = v; struct sys_msgget_args ap; - ap.key = uap->key; - ap.msgflg = uap->msgflg; + SCARG(&ap, key) = SCARG(uap, key); + SCARG(&ap, msgflg) = SCARG(uap, msgflg); return sys_msgget(p, &ap, retval); } @@ -538,39 +538,39 @@ svr4_msgctl(p, v, retval) struct msqid_ds bs; caddr_t sg = stackgap_init(); - ap.msqid = uap->msqid; - ap.cmd = uap->cmd; - ap.buf = stackgap_alloc(&sg, sizeof(bs)); + SCARG(&ap, msqid) = SCARG(uap, msqid); + SCARG(&ap, cmd) = SCARG(uap, cmd); + SCARG(&ap, buf) = stackgap_alloc(&sg, sizeof(bs)); - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case SVR4_IPC_STAT: - ap.cmd = IPC_STAT; + SCARG(&ap, cmd) = IPC_STAT; if ((error = sys_msgctl(p, &ap, retval)) != 0) return error; - error = copyin(&bs, ap.buf, sizeof bs); + error = copyin(&bs, SCARG(&ap, buf), sizeof bs); if (error) return error; bsd_to_svr4_msqid_ds(&bs, &ss); - return copyout(&ss, uap->buf, sizeof ss); + return copyout(&ss, SCARG(uap, buf), sizeof ss); case SVR4_IPC_SET: - ap.cmd = IPC_SET; - error = copyin(uap->buf, &ss, sizeof ss); + SCARG(&ap, cmd) = IPC_SET; + error = copyin(SCARG(uap, buf), &ss, sizeof ss); if (error) return error; svr4_to_bsd_msqid_ds(&ss, &bs); - error = copyout(&bs, ap.buf, sizeof bs); + error = copyout(&bs, SCARG(&ap, buf), sizeof bs); if (error) return error; return sys_msgctl(p, &ap, retval); case SVR4_IPC_RMID: - ap.cmd = IPC_RMID; - error = copyin(uap->buf, &ss, sizeof ss); + SCARG(&ap, cmd) = IPC_RMID; + error = copyin(SCARG(uap, buf), &ss, sizeof ss); if (error) return error; svr4_to_bsd_msqid_ds(&ss, &bs); - error = copyout(&bs, ap.buf, sizeof bs); + error = copyout(&bs, SCARG(&ap, buf), sizeof bs); if (error) return error; return sys_msgctl(p, &ap, retval); @@ -588,9 +588,9 @@ svr4_sys_msgsys(p, v, retval) { struct svr4_sys_msgsys_args *uap = v; - DPRINTF(("svr4_msgsys(%d)\n", uap->what)); + DPRINTF(("svr4_msgsys(%d)\n", SCARG(uap, what))); - switch (uap->what) { + switch (SCARG(uap, what)) { case SVR4_msgsnd: return svr4_msgsnd(p, v, retval); case SVR4_msgrcv: @@ -660,9 +660,9 @@ svr4_shmat(p, v, retval) struct svr4_sys_shmat_args *uap = v; struct sys_shmat_args ap; - ap.shmid = uap->shmid; - ap.shmaddr = uap->shmaddr; - ap.shmflg = uap->shmflg; + SCARG(&ap, shmid) = SCARG(uap, shmid); + SCARG(&ap, shmaddr) = SCARG(uap, shmaddr); + SCARG(&ap, shmflg) = SCARG(uap, shmflg); return sys_shmat(p, &ap, retval); } @@ -681,7 +681,7 @@ svr4_shmdt(p, v, retval) struct svr4_sys_shmdt_args *uap = v; struct sys_shmdt_args ap; - ap.shmaddr = uap->shmaddr; + SCARG(&ap, shmaddr) = SCARG(uap, shmaddr); return sys_shmdt(p, &ap, retval); } @@ -702,9 +702,9 @@ svr4_shmget(p, v, retval) struct svr4_sys_shmget_args *uap = v; struct sys_shmget_args ap; - ap.key = uap->key; - ap.size = uap->size; - ap.shmflg = uap->shmflg; + SCARG(&ap, key) = SCARG(uap, key); + SCARG(&ap, size) = SCARG(uap, size); + SCARG(&ap, shmflg) = SCARG(uap, shmflg); return sys_shmget(p, &ap, retval); } @@ -729,21 +729,21 @@ svr4_shmctl(p, v, retval) struct shmid_ds bs; struct svr4_shmid_ds ss; - ap.shmid = uap->shmid; + SCARG(&ap, shmid) = SCARG(uap, shmid); - if (uap->buf != NULL) { - ap.buf = stackgap_alloc(&sg, sizeof (struct shmid_ds)); - switch (uap->cmd) { + if (SCARG(uap, buf) != NULL) { + SCARG(&ap, buf) = stackgap_alloc(&sg, sizeof (struct shmid_ds)); + switch (SCARG(uap, cmd)) { case SVR4_IPC_SET: case SVR4_IPC_RMID: case SVR4_SHM_LOCK: case SVR4_SHM_UNLOCK: - error = copyin(uap->buf, (caddr_t) &ss, + error = copyin(SCARG(uap, buf), (caddr_t) &ss, sizeof ss); if (error) return error; svr4_to_bsd_shmid_ds(&ss, &bs); - error = copyout(&bs, ap.buf, sizeof bs); + error = copyout(&bs, SCARG(&ap, buf), sizeof bs); if (error) return error; break; @@ -752,38 +752,38 @@ svr4_shmctl(p, v, retval) } } else - ap.buf = NULL; + SCARG(&ap, buf) = NULL; - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case SVR4_IPC_STAT: - ap.cmd = IPC_STAT; + SCARG(&ap, cmd) = IPC_STAT; if ((error = sys_shmctl(p, &ap, retval)) != 0) return error; - if (uap->buf == NULL) + if (SCARG(uap, buf) == NULL) return 0; - error = copyin(&bs, ap.buf, sizeof bs); + error = copyin(&bs, SCARG(&ap, buf), sizeof bs); if (error) return error; bsd_to_svr4_shmid_ds(&bs, &ss); - return copyout(&ss, uap->buf, sizeof ss); + return copyout(&ss, SCARG(uap, buf), sizeof ss); case SVR4_IPC_SET: - ap.cmd = IPC_SET; + SCARG(&ap, cmd) = IPC_SET; return sys_shmctl(p, &ap, retval); case SVR4_IPC_RMID: case SVR4_SHM_LOCK: case SVR4_SHM_UNLOCK: - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case SVR4_IPC_RMID: - ap.cmd = IPC_RMID; + SCARG(&ap, cmd) = IPC_RMID; break; case SVR4_SHM_LOCK: - ap.cmd = SHM_LOCK; + SCARG(&ap, cmd) = SHM_LOCK; break; case SVR4_SHM_UNLOCK: - ap.cmd = SHM_UNLOCK; + SCARG(&ap, cmd) = SHM_UNLOCK; break; default: return EINVAL; @@ -803,9 +803,9 @@ svr4_sys_shmsys(p, v, retval) { struct svr4_sys_shmsys_args *uap = v; - DPRINTF(("svr4_shmsys(%d)\n", uap->what)); + DPRINTF(("svr4_shmsys(%d)\n", SCARG(uap, what))); - switch (uap->what) { + switch (SCARG(uap, what)) { case SVR4_shmat: return svr4_shmat(p, v, retval); case SVR4_shmdt: diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index d7a30e9..859420d 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -132,25 +132,25 @@ svr4_sys_wait(td, uap) { struct wait_args w4; int error, *retval = td->td_retval, st, sig; - size_t sz = sizeof(*w4.status); + size_t sz = sizeof(*SCARG(&w4, status)); - w4.rusage = NULL; - w4.options = 0; + SCARG(&w4, rusage) = NULL; + SCARG(&w4, options) = 0; - if (uap->status == NULL) { + if (SCARG(uap, status) == NULL) { caddr_t sg = stackgap_init(); - w4.status = stackgap_alloc(&sg, sz); + SCARG(&w4, status) = stackgap_alloc(&sg, sz); } else - w4.status = uap->status; + SCARG(&w4, status) = SCARG(uap, status); - w4.pid = WAIT_ANY; + SCARG(&w4, pid) = WAIT_ANY; if ((error = wait4(td, &w4)) != 0) return error; - if ((error = copyin(w4.status, &st, sizeof(st))) != 0) + if ((error = copyin(SCARG(&w4, status), &st, sizeof(st))) != 0) return error; if (WIFSIGNALED(st)) { @@ -169,8 +169,8 @@ svr4_sys_wait(td, uap) */ retval[1] = st; - if (uap->status) - if ((error = copyout(&st, uap->status, sizeof(st))) != 0) + if (SCARG(uap, status)) + if ((error = copyout(&st, SCARG(uap, status), sizeof(st))) != 0) return error; return 0; @@ -185,11 +185,11 @@ svr4_sys_execv(td, uap) caddr_t sg; sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); - ap.fname = uap->path; - ap.argv = uap->argp; - ap.envv = NULL; + SCARG(&ap, fname) = SCARG(uap, path); + SCARG(&ap, argv) = SCARG(uap, argp); + SCARG(&ap, envv) = NULL; return execve(td, &ap); } @@ -205,9 +205,9 @@ svr4_sys_execve(td, uap) sg = stackgap_init(); CHECKALTEXIST(td, &sg, uap->path); - ap.fname = uap->path; - ap.argv = uap->argp; - ap.envv = uap->envp; + SCARG(&ap, fname) = SCARG(uap, path); + SCARG(&ap, argv) = SCARG(uap, argp); + SCARG(&ap, envv) = SCARG(uap, envp); return execve(td, &ap); } @@ -222,9 +222,9 @@ svr4_sys_time(td, v) struct timeval tv; microtime(&tv); - if (uap->t) - error = copyout(&tv.tv_sec, uap->t, - sizeof(*(uap->t))); + if (SCARG(uap, t)) + error = copyout(&tv.tv_sec, SCARG(uap, t), + sizeof(*(SCARG(uap, t)))); td->td_retval[0] = (int) tv.tv_sec; return error; @@ -261,8 +261,8 @@ svr4_sys_getdents64(td, uap) int ncookies; DPRINTF(("svr4_sys_getdents64(%d, *, %d)\n", - uap->fd, uap->nbytes)); - if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) { + SCARG(uap, fd), SCARG(uap, nbytes))); + if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0) { return (error); } @@ -283,7 +283,7 @@ svr4_sys_getdents64(td, uap) return error; } - nbytes = uap->nbytes; + nbytes = SCARG(uap, nbytes); if (nbytes == 1) { nbytes = sizeof (struct svr4_dirent64); justone = 1; @@ -326,7 +326,7 @@ again: } inp = buf; - outp = (caddr_t) uap->dp; + outp = (caddr_t) SCARG(uap, dp); resid = nbytes; if ((len = buflen - auio.uio_resid) <= 0) { goto eof; @@ -404,7 +404,7 @@ again: break; } - if (outp == (caddr_t) uap->dp) + if (outp == (caddr_t) SCARG(uap, dp)) goto again; fp->f_offset = off; @@ -443,7 +443,7 @@ svr4_sys_getdents(td, uap) u_long *cookiebuf = NULL, *cookie; int ncookies = 0, *retval = td->td_retval; - 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) { @@ -457,7 +457,7 @@ svr4_sys_getdents(td, uap) return (EINVAL); } - buflen = min(MAXBSIZE, uap->nbytes); + buflen = min(MAXBSIZE, SCARG(uap, nbytes)); buf = malloc(buflen, M_TEMP, M_WAITOK); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); off = fp->f_offset; @@ -489,8 +489,8 @@ again: } 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; @@ -534,12 +534,12 @@ again: } /* 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: - *retval = uap->nbytes - resid; + *retval = SCARG(uap, nbytes) - resid; out: VOP_UNLOCK(vp, 0, td); fdrop(fp, td); @@ -563,18 +563,18 @@ svr4_sys_mmap(td, uap) /* * Verify the arguments. */ - if (uap->prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) + if (SCARG(uap, prot) & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) return EINVAL; /* XXX still needed? */ - if (uap->len == 0) + if (SCARG(uap, len) == 0) return EINVAL; - mm.prot = uap->prot; - mm.len = uap->len; - mm.flags = uap->flags & ~_MAP_NEW; - mm.fd = uap->fd; - mm.addr = uap->addr; - mm.pos = uap->pos; + SCARG(&mm, prot) = SCARG(uap, prot); + SCARG(&mm, len) = SCARG(uap, len); + SCARG(&mm, flags) = SCARG(uap, flags) & ~_MAP_NEW; + SCARG(&mm, fd) = SCARG(uap, fd); + SCARG(&mm, addr) = SCARG(uap, addr); + SCARG(&mm, pos) = SCARG(uap, pos); return mmap(td, &mm); } @@ -591,23 +591,23 @@ svr4_sys_mmap64(td, uap) /* * Verify the arguments. */ - if (uap->prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) + if (SCARG(uap, prot) & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) return EINVAL; /* XXX still needed? */ - if (uap->len == 0) + if (SCARG(uap, len) == 0) return EINVAL; - mm.prot = uap->prot; - mm.len = uap->len; - mm.flags = uap->flags & ~_MAP_NEW; - mm.fd = uap->fd; - mm.addr = uap->addr; - mm.pos = uap->pos; + SCARG(&mm, prot) = SCARG(uap, prot); + SCARG(&mm, len) = SCARG(uap, len); + SCARG(&mm, flags) = SCARG(uap, flags) & ~_MAP_NEW; + SCARG(&mm, fd) = SCARG(uap, fd); + SCARG(&mm, addr) = SCARG(uap, addr); + SCARG(&mm, pos) = SCARG(uap, pos); rp = (void *) round_page((vm_offset_t)(td->td_proc->p_vmspace->vm_daddr + maxdsiz)); - if ((mm.flags & MAP_FIXED) == 0 && - mm.addr != 0 && (void *)mm.addr < rp) - mm.addr = rp; + if ((SCARG(&mm, flags) & MAP_FIXED) == 0 && + SCARG(&mm, addr) != 0 && (void *)SCARG(&mm, addr) < rp) + SCARG(&mm, addr) = rp; return mmap(td, &mm); } @@ -625,7 +625,7 @@ svr4_sys_fchroot(td, uap) if ((error = suser(td)) != 0) return error; - if ((error = getvnode(fdp, uap->fd, &fp)) != 0) + if ((error = getvnode(fdp, SCARG(uap, fd), &fp)) != 0) return error; vp = (struct vnode *) fp->f_data; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); @@ -664,14 +664,14 @@ svr4_mknod(td, retval, path, mode, dev) if (S_ISFIFO(mode)) { struct mkfifo_args ap; - ap.path = path; - ap.mode = mode; + SCARG(&ap, path) = path; + SCARG(&ap, mode) = mode; return mkfifo(td, &ap); } else { struct mknod_args ap; - ap.path = path; - ap.mode = mode; - ap.dev = dev; + SCARG(&ap, path) = path; + SCARG(&ap, mode) = mode; + SCARG(&ap, dev) = dev; return mknod(td, &ap); } } @@ -684,8 +684,8 @@ svr4_sys_mknod(td, uap) { int *retval = td->td_retval; return svr4_mknod(td, retval, - uap->path, uap->mode, - (svr4_dev_t)svr4_to_bsd_odev_t(uap->dev)); + SCARG(uap, path), SCARG(uap, mode), + (svr4_dev_t)svr4_to_bsd_odev_t(SCARG(uap, dev))); } @@ -696,8 +696,8 @@ svr4_sys_xmknod(td, uap) { int *retval = td->td_retval; return svr4_mknod(td, retval, - uap->path, uap->mode, - (svr4_dev_t)svr4_to_bsd_dev_t(uap->dev)); + SCARG(uap, path), SCARG(uap, mode), + (svr4_dev_t)svr4_to_bsd_dev_t(SCARG(uap, dev))); } @@ -719,7 +719,7 @@ svr4_sys_sysconfig(td, uap) retval = &(td->td_retval[0]); - switch (uap->name) { + switch (SCARG(uap, name)) { case SVR4_CONFIG_UNUSED: *retval = 0; break; @@ -823,7 +823,7 @@ svr4_sys_break(td, uap) int rv; base = round_page((vm_offset_t) vm->vm_daddr); - ns = (vm_offset_t)uap->nsize; + ns = (vm_offset_t)SCARG(uap, nsize); new = round_page(ns); /* For p_rlimit. */ mtx_assert(&Giant, MA_OWNED); @@ -890,8 +890,8 @@ svr4_sys_times(td, uap) caddr_t sg = stackgap_init(); ru = stackgap_alloc(&sg, sizeof(struct rusage)); - ga.who = RUSAGE_SELF; - ga.rusage = ru; + SCARG(&ga, who) = RUSAGE_SELF; + SCARG(&ga, rusage) = ru; error = getrusage(td, &ga); if (error) @@ -903,7 +903,7 @@ svr4_sys_times(td, uap) tms.tms_utime = timeval_to_clock_t(&r.ru_utime); tms.tms_stime = timeval_to_clock_t(&r.ru_stime); - ga.who = RUSAGE_CHILDREN; + SCARG(&ga, who) = RUSAGE_CHILDREN; error = getrusage(td, &ga); if (error) return error; @@ -917,7 +917,7 @@ svr4_sys_times(td, uap) microtime(&t); *retval = timeval_to_clock_t(&t); - return copyout(&tms, uap->tp, sizeof(tms)); + return copyout(&tms, SCARG(uap, tp), sizeof(tms)); } @@ -928,7 +928,7 @@ svr4_sys_ulimit(td, uap) { int *retval = td->td_retval; - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case SVR4_GFILLIM: /* For p_rlimit below. */ mtx_assert(&Giant, MA_OWNED); @@ -946,7 +946,7 @@ svr4_sys_ulimit(td, uap) struct rlimit *url = (struct rlimit *) stackgap_alloc(&sg, sizeof *url); - krl.rlim_cur = uap->newlimit * 512; + krl.rlim_cur = SCARG(uap, newlimit) * 512; mtx_assert(&Giant, MA_OWNED); krl.rlim_max = td->td_proc->p_rlimit[RLIMIT_FSIZE].rlim_max; @@ -954,8 +954,8 @@ svr4_sys_ulimit(td, uap) if (error) return error; - srl.which = RLIMIT_FSIZE; - srl.rlp = url; + SCARG(&srl, which) = RLIMIT_FSIZE; + SCARG(&srl, rlp) = url; error = setrlimit(td, &srl); if (error) @@ -1020,7 +1020,7 @@ svr4_sys_pgrpsys(td, uap) int *retval = td->td_retval; struct proc *p = td->td_proc; - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case 1: /* setpgrp() */ /* * SVR4 setpgrp() (which takes no arguments) has the @@ -1039,9 +1039,9 @@ svr4_sys_pgrpsys(td, uap) return 0; case 2: /* getsid(pid) */ - if (uap->pid == 0) + if (SCARG(uap, pid) == 0) PROC_LOCK(p); - else if ((p = svr4_pfind(uap->pid)) == NULL) + else if ((p = svr4_pfind(SCARG(uap, pid))) == NULL) return ESRCH; /* * This has already been initialized to the pid of @@ -1056,9 +1056,9 @@ svr4_sys_pgrpsys(td, uap) case 4: /* getpgid(pid) */ - if (uap->pid == 0) + if (SCARG(uap, pid) == 0) PROC_LOCK(p); - else if ((p = svr4_pfind(uap->pid)) == NULL) + else if ((p = svr4_pfind(SCARG(uap, pid))) == NULL) return ESRCH; *retval = (int) p->p_pgrp->pg_id; @@ -1069,8 +1069,8 @@ svr4_sys_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); } @@ -1096,7 +1096,7 @@ svr4_hrtcntl(td, uap, retval) struct svr4_hrtcntl_args *uap; register_t *retval; { - switch (uap->fun) { + switch (SCARG(uap, fun)) { case SVR4_HRT_CNTL_RES: DPRINTF(("htrcntl(RES)\n")); *retval = SVR4_HRT_USEC; @@ -1107,11 +1107,11 @@ svr4_hrtcntl(td, uap, retval) { struct timeval tv; svr4_hrt_time_t t; - if (uap->clk != SVR4_HRT_CLK_STD) { - DPRINTF(("clk == %d\n", uap->clk)); + if (SCARG(uap, clk) != SVR4_HRT_CLK_STD) { + DPRINTF(("clk == %d\n", SCARG(uap, clk))); return EINVAL; } - if (uap->ti == NULL) { + if (SCARG(uap, ti) == NULL) { DPRINTF(("ti NULL\n")); return EINVAL; } @@ -1119,7 +1119,7 @@ svr4_hrtcntl(td, uap, retval) t.h_sec = tv.tv_sec; t.h_rem = tv.tv_usec; t.h_res = SVR4_HRT_USEC; - return copyout(&t, uap->ti, sizeof(t)); + return copyout(&t, SCARG(uap, ti), sizeof(t)); } case SVR4_HRT_CNTL_START: @@ -1130,7 +1130,7 @@ svr4_hrtcntl(td, uap, retval) DPRINTF(("htrcntl(GET)\n")); return ENOSYS; default: - DPRINTF(("Bad htrcntl command %d\n", uap->fun)); + DPRINTF(("Bad htrcntl command %d\n", SCARG(uap, fun))); return ENOSYS; } } @@ -1143,7 +1143,7 @@ svr4_sys_hrtsys(td, uap) { int *retval = td->td_retval; - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case SVR4_HRT_CNTL: return svr4_hrtcntl(td, (struct svr4_hrtcntl_args *) uap, retval); @@ -1161,7 +1161,7 @@ svr4_sys_hrtsys(td, uap) return ENOSYS; default: - DPRINTF(("Bad hrtsys command %d\n", uap->cmd)); + DPRINTF(("Bad hrtsys command %d\n", SCARG(uap, cmd))); return EINVAL; } } @@ -1235,18 +1235,18 @@ svr4_sys_waitsys(td, uap) struct proc *q, *t; - switch (uap->grp) { + switch (SCARG(uap, grp)) { case SVR4_P_PID: break; case SVR4_P_PGID: PROC_LOCK(td->td_proc); - uap->id = -td->td_proc->p_pgid; + SCARG(uap, id) = -td->td_proc->p_pgid; PROC_UNLOCK(td->td_proc); break; case SVR4_P_ALL: - uap->id = WAIT_ANY; + SCARG(uap, id) = WAIT_ANY; break; default: @@ -1254,37 +1254,37 @@ svr4_sys_waitsys(td, uap) } DPRINTF(("waitsys(%d, %d, %p, %x)\n", - uap->grp, uap->id, - uap->info, uap->options)); + SCARG(uap, grp), SCARG(uap, id), + SCARG(uap, info), SCARG(uap, options))); loop: nfound = 0; sx_slock(&proctree_lock); LIST_FOREACH(q, &td->td_proc->p_children, p_sibling) { PROC_LOCK(q); - if (uap->id != WAIT_ANY && - q->p_pid != uap->id && - q->p_pgid != -uap->id) { + if (SCARG(uap, id) != WAIT_ANY && + q->p_pid != SCARG(uap, id) && + q->p_pgid != -SCARG(uap, id)) { PROC_UNLOCK(q); DPRINTF(("pid %d pgid %d != %d\n", q->p_pid, - q->p_pgid, uap->id)); + q->p_pgid, SCARG(uap, id))); continue; } nfound++; mtx_lock_spin(&sched_lock); if ((q->p_state == PRS_ZOMBIE) && - ((uap->options & (SVR4_WEXITED|SVR4_WTRAPPED)))) { + ((SCARG(uap, options) & (SVR4_WEXITED|SVR4_WTRAPPED)))) { mtx_unlock_spin(&sched_lock); PROC_UNLOCK(q); sx_sunlock(&proctree_lock); *retval = 0; DPRINTF(("found %d\n", q->p_pid)); - error = svr4_setinfo(q, q->p_xstat, uap->info); + error = svr4_setinfo(q, q->p_xstat, SCARG(uap, info)); if (error != 0) return error; - if ((uap->options & SVR4_WNOWAIT)) { + if ((SCARG(uap, options) & SVR4_WNOWAIT)) { DPRINTF(("Don't wait\n")); return 0; } @@ -1391,15 +1391,15 @@ loop: /* XXXKSE this needs clarification */ if (P_SHOULDSTOP(q) && ((q->p_flag & P_WAITED) == 0) && (q->p_flag & P_TRACED || - (uap->options & (SVR4_WSTOPPED|SVR4_WCONTINUED)))) { + (SCARG(uap, options) & (SVR4_WSTOPPED|SVR4_WCONTINUED)))) { mtx_unlock_spin(&sched_lock); DPRINTF(("jobcontrol %d\n", q->p_pid)); - if (((uap->options & SVR4_WNOWAIT)) == 0) + if (((SCARG(uap, options) & SVR4_WNOWAIT)) == 0) q->p_flag |= P_WAITED; PROC_UNLOCK(q); *retval = 0; return svr4_setinfo(q, W_STOPCODE(q->p_xstat), - uap->info); + SCARG(uap, info)); } mtx_unlock_spin(&sched_lock); PROC_UNLOCK(q); @@ -1408,9 +1408,9 @@ loop: if (nfound == 0) return ECHILD; - if (uap->options & SVR4_WNOHANG) { + if (SCARG(uap, options) & SVR4_WNOHANG) { *retval = 0; - if ((error = svr4_setinfo(NULL, 0, uap->info)) != 0) + if ((error = svr4_setinfo(NULL, 0, SCARG(uap, info))) != 0) return error; return 0; } @@ -1485,9 +1485,9 @@ svr4_sys_statvfs(td, uap) struct svr4_statvfs sfs; int error; - CHECKALTEXIST(td, &sg, uap->path); - fs_args.path = uap->path; - fs_args.buf = fs; + CHECKALTEXIST(td, &sg, SCARG(uap, path)); + SCARG(&fs_args, path) = SCARG(uap, path); + SCARG(&fs_args, buf) = fs; if ((error = statfs(td, &fs_args)) != 0) return error; @@ -1497,7 +1497,7 @@ svr4_sys_statvfs(td, uap) bsd_statfs_to_svr4_statvfs(&bfs, &sfs); - return copyout(&sfs, uap->fs, sizeof(sfs)); + return copyout(&sfs, SCARG(uap, fs), sizeof(sfs)); } @@ -1513,8 +1513,8 @@ svr4_sys_fstatvfs(td, uap) struct svr4_statvfs sfs; int error; - fs_args.fd = uap->fd; - fs_args.buf = fs; + SCARG(&fs_args, fd) = SCARG(uap, fd); + SCARG(&fs_args, buf) = fs; if ((error = fstatfs(td, &fs_args)) != 0) return error; @@ -1524,7 +1524,7 @@ svr4_sys_fstatvfs(td, uap) bsd_statfs_to_svr4_statvfs(&bfs, &sfs); - return copyout(&sfs, uap->fs, sizeof(sfs)); + return copyout(&sfs, SCARG(uap, fs), sizeof(sfs)); } @@ -1540,9 +1540,9 @@ svr4_sys_statvfs64(td, uap) struct svr4_statvfs64 sfs; int error; - CHECKALTEXIST(td, &sg, uap->path); - fs_args.path = uap->path; - fs_args.buf = fs; + CHECKALTEXIST(td, &sg, SCARG(uap, path)); + SCARG(&fs_args, path) = SCARG(uap, path); + SCARG(&fs_args, buf) = fs; if ((error = statfs(td, &fs_args)) != 0) return error; @@ -1552,7 +1552,7 @@ svr4_sys_statvfs64(td, uap) bsd_statfs_to_svr4_statvfs64(&bfs, &sfs); - return copyout(&sfs, uap->fs, sizeof(sfs)); + return copyout(&sfs, SCARG(uap, fs), sizeof(sfs)); } @@ -1568,8 +1568,8 @@ svr4_sys_fstatvfs64(td, uap) struct svr4_statvfs64 sfs; int error; - fs_args.fd = uap->fd; - fs_args.buf = fs; + SCARG(&fs_args, fd) = SCARG(uap, fd); + SCARG(&fs_args, buf) = fs; if ((error = fstatfs(td, &fs_args)) != 0) return error; @@ -1579,7 +1579,7 @@ svr4_sys_fstatvfs64(td, uap) bsd_statfs_to_svr4_statvfs64(&bfs, &sfs); - return copyout(&sfs, uap->fs, sizeof(sfs)); + return copyout(&sfs, SCARG(uap, fs), sizeof(sfs)); } int @@ -1595,12 +1595,12 @@ svr4_sys_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; @@ -1616,11 +1616,11 @@ svr4_sys_gettimeofday(td, uap) struct thread *td; struct svr4_sys_gettimeofday_args *uap; { - if (uap->tp) { + if (SCARG(uap, tp)) { struct timeval atv; microtime(&atv); - return copyout(&atv, uap->tp, sizeof (atv)); + return copyout(&atv, SCARG(uap, tp), sizeof (atv)); } return 0; @@ -1636,14 +1636,14 @@ svr4_sys_facl(td, uap) retval = td->td_retval; *retval = 0; - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case SVR4_SYS_SETACL: /* We don't support acls on any filesystem */ return ENOSYS; case SVR4_SYS_GETACL: - return copyout(retval, &uap->num, - sizeof(uap->num)); + return copyout(retval, &SCARG(uap, num), + sizeof(SCARG(uap, num))); case SVR4_SYS_GETACLCNT: return 0; @@ -1679,14 +1679,14 @@ svr4_sys_memcntl(td, uap) struct thread *td; struct svr4_sys_memcntl_args *uap; { - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case SVR4_MC_SYNC: { struct msync_args msa; - msa.addr = uap->addr; - msa.len = uap->len; - msa.flags = (int)uap->arg; + SCARG(&msa, addr) = SCARG(uap, addr); + SCARG(&msa, len) = SCARG(uap, len); + SCARG(&msa, flags) = (int)SCARG(uap, arg); return msync(td, &msa); } @@ -1694,9 +1694,9 @@ svr4_sys_memcntl(td, uap) { struct madvise_args maa; - maa.addr = uap->addr; - maa.len = uap->len; - maa.behav = (int)uap->arg; + SCARG(&maa, addr) = SCARG(uap, addr); + SCARG(&maa, len) = SCARG(uap, len); + SCARG(&maa, behav) = (int)SCARG(uap, arg); return madvise(td, &maa); } @@ -1719,9 +1719,9 @@ svr4_sys_nice(td, uap) struct setpriority_args ap; int error; - ap.which = PRIO_PROCESS; - ap.who = 0; - ap.prio = uap->prio; + SCARG(&ap, which) = PRIO_PROCESS; + SCARG(&ap, who) = 0; + SCARG(&ap, prio) = SCARG(uap, prio); if ((error = setpriority(td, &ap)) != 0) return error; @@ -1742,17 +1742,17 @@ svr4_sys_resolvepath(td, uap) int error, *retval = td->td_retval; NDINIT(&nd, LOOKUP, NOFOLLOW | SAVENAME, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return error; - if ((error = copyout(nd.ni_cnd.cn_pnbuf, uap->buf, - uap->bufsiz)) != 0) + if ((error = copyout(nd.ni_cnd.cn_pnbuf, SCARG(uap, buf), + SCARG(uap, bufsiz))) != 0) goto bad; - *retval = strlen(nd.ni_cnd.cn_pnbuf) < uap->bufsiz ? - strlen(nd.ni_cnd.cn_pnbuf) + 1 : uap->bufsiz; + *retval = strlen(nd.ni_cnd.cn_pnbuf) < SCARG(uap, bufsiz) ? + strlen(nd.ni_cnd.cn_pnbuf) + 1 : SCARG(uap, bufsiz); bad: NDFREE(&nd, NDF_ONLY_PNBUF); vput(nd.ni_vp); diff --git a/sys/compat/svr4/svr4_resource.c b/sys/compat/svr4/svr4_resource.c index e9adace..2d7a0ea 100644 --- a/sys/compat/svr4/svr4_resource.c +++ b/sys/compat/svr4/svr4_resource.c @@ -133,7 +133,7 @@ svr4_sys_getrlimit(td, uap) register struct thread *td; struct svr4_sys_getrlimit_args *uap; { - int rl = svr4_to_native_rl(uap->which); + int rl = svr4_to_native_rl(SCARG(uap, which)); struct rlimit blim; struct svr4_rlimit slim; @@ -171,7 +171,7 @@ svr4_sys_getrlimit(td, uap) else slim.rlim_cur = SVR4_RLIM_SAVED_CUR; - return copyout(&slim, uap->rlp, sizeof(*uap->rlp)); + return copyout(&slim, SCARG(uap, rlp), sizeof(*SCARG(uap, rlp))); } @@ -180,7 +180,7 @@ svr4_sys_setrlimit(td, uap) register struct thread *td; struct svr4_sys_setrlimit_args *uap; { - int rl = svr4_to_native_rl(uap->which); + int rl = svr4_to_native_rl(SCARG(uap, which)); struct rlimit blim, *limp; struct svr4_rlimit slim; int error; @@ -192,7 +192,7 @@ svr4_sys_setrlimit(td, uap) mtx_assert(&Giant, MA_OWNED); limp = &td->td_proc->p_rlimit[rl]; - if ((error = copyin(uap->rlp, &slim, sizeof(slim))) != 0) + if ((error = copyin(SCARG(uap, rlp), &slim, sizeof(slim))) != 0) return error; /* @@ -231,7 +231,7 @@ svr4_sys_getrlimit64(td, uap) register struct thread *td; struct svr4_sys_getrlimit64_args *uap; { - int rl = svr4_to_native_rl(uap->which); + int rl = svr4_to_native_rl(SCARG(uap, which)); struct rlimit blim; struct svr4_rlimit64 slim; @@ -269,7 +269,7 @@ svr4_sys_getrlimit64(td, uap) else slim.rlim_cur = SVR4_RLIM64_SAVED_CUR; - return copyout(&slim, uap->rlp, sizeof(*uap->rlp)); + return copyout(&slim, SCARG(uap, rlp), sizeof(*SCARG(uap, rlp))); } @@ -278,7 +278,7 @@ svr4_sys_setrlimit64(td, uap) register struct thread *td; struct svr4_sys_setrlimit64_args *uap; { - int rl = svr4_to_native_rl(uap->which); + int rl = svr4_to_native_rl(SCARG(uap, which)); struct rlimit blim, *limp; struct svr4_rlimit64 slim; int error; @@ -290,7 +290,7 @@ svr4_sys_setrlimit64(td, uap) mtx_assert(&Giant, MA_OWNED); limp = &td->td_proc->p_rlimit[rl]; - if ((error = copyin(uap->rlp, &slim, sizeof(slim))) != 0) + if ((error = copyin(SCARG(uap, rlp), &slim, sizeof(slim))) != 0) return error; /* diff --git a/sys/compat/svr4/svr4_signal.c b/sys/compat/svr4/svr4_signal.c index 3e688e6..fea5317 100644 --- a/sys/compat/svr4/svr4_signal.c +++ b/sys/compat/svr4/svr4_signal.c @@ -269,12 +269,12 @@ svr4_sys_sigaction(td, uap) int error; DPRINTF(("@@@ svr4_sys_sigaction(%d, %d, %d)\n", td->td_proc->p_pid, - uap->signum, - SVR4_SVR42BSD_SIG(uap->signum))); + SCARG(uap, signum), + SVR4_SVR42BSD_SIG(SCARG(uap, signum)))); sg = stackgap_init(); - nisa = uap->nsa; - oisa = uap->osa; + nisa = SCARG(uap, nsa); + oisa = SCARG(uap, osa); if (oisa != NULL) obsa = stackgap_alloc(&sg, sizeof(struct sigaction)); @@ -301,9 +301,9 @@ svr4_sys_sigaction(td, uap) } #endif - sa.sig = SVR4_SVR42BSD_SIG(uap->signum); - sa.act = nbsa; - sa.oact = obsa; + SCARG(&sa, sig) = SVR4_SVR42BSD_SIG(SCARG(uap, signum)); + SCARG(&sa, act) = nbsa; + SCARG(&sa, oact) = obsa; if ((error = sigaction(td, &sa)) != 0) return error; @@ -332,8 +332,8 @@ svr4_sys_sigaltstack(td, uap) retval = td->td_retval; sg = stackgap_init(); - nsss = uap->nss; - osss = uap->oss; + nsss = SCARG(uap, nss); + osss = SCARG(uap, oss); if (osss != NULL) obss = stackgap_alloc(&sg, sizeof(struct sigaltstack)); @@ -350,8 +350,8 @@ svr4_sys_sigaltstack(td, uap) } else nbss = NULL; - sa.ss = nbss; - sa.oss = obss; + SCARG(&sa, ss) = nbss; + SCARG(&sa, oss) = obss; if ((error = sigaltstack(td, &sa)) != 0) return error; @@ -381,13 +381,13 @@ svr4_sys_signal(td, uap) DPRINTF(("@@@ svr4_sys_signal(%d)\n", td->td_proc->p_pid)); - signum = SVR4_SVR42BSD_SIG(SVR4_SIGNO(uap->signum)); + signum = SVR4_SVR42BSD_SIG(SVR4_SIGNO(SCARG(uap, signum))); if (signum <= 0 || signum > SVR4_NSIG) return (EINVAL); - switch (SVR4_SIGCALL(uap->signum)) { + switch (SVR4_SIGCALL(SCARG(uap, signum))) { case SVR4_SIGDEFER_MASK: - if (uap->handler == SVR4_SIG_HOLD) + if (SCARG(uap, handler) == SVR4_SIG_HOLD) goto sighold; /* FALLTHROUGH */ @@ -398,11 +398,11 @@ svr4_sys_signal(td, uap) 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 = (sig_t) uap->handler; + sa.sa_handler = (sig_t) SCARG(uap, handler); SIGEMPTYSET(sa.sa_mask); sa.sa_flags = 0; @@ -432,9 +432,9 @@ sighold: set = stackgap_alloc(&sg, sizeof(sigset_t)); SIGEMPTYSET(*set); SIGADDSET(*set, signum); - sa.how = SIG_BLOCK; - sa.set = set; - sa.oset = NULL; + SCARG(&sa, how) = SIG_BLOCK; + SCARG(&sa, set) = set; + SCARG(&sa, oset) = NULL; return sigprocmask(td, &sa); } @@ -446,9 +446,9 @@ sighold: set = stackgap_alloc(&sg, sizeof(sigset_t)); SIGEMPTYSET(*set); SIGADDSET(*set, signum); - sa.how = SIG_UNBLOCK; - sa.set = set; - sa.oset = NULL; + SCARG(&sa, how) = SIG_UNBLOCK; + SCARG(&sa, set) = set; + SCARG(&sa, oset) = NULL; return sigprocmask(td, &sa); } @@ -458,9 +458,9 @@ sighold: struct sigaction *bsa, sa; 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); @@ -484,7 +484,7 @@ sighold: *set = td->td_proc->p_sigmask; PROC_UNLOCK(td->td_proc); SIGDELSET(*set, signum); - sa.sigmask = set; + SCARG(&sa, sigmask) = set; return sigsuspend(td, &sa); } @@ -504,26 +504,26 @@ svr4_sys_sigprocmask(td, uap) int error = 0, *retval; retval = td->td_retval; - if (uap->oset != NULL) { + if (SCARG(uap, oset) != NULL) { /* Fix the return value first if needed */ PROC_LOCK(td->td_proc); bsd_to_svr4_sigset(&td->td_proc->p_sigmask, &sss); PROC_UNLOCK(td->td_proc); - if ((error = copyout(&sss, uap->oset, sizeof(sss))) != 0) + if ((error = copyout(&sss, SCARG(uap, oset), sizeof(sss))) != 0) return error; } - if (uap->set == NULL) + if (SCARG(uap, set) == NULL) /* Just examine */ return 0; - if ((error = copyin(uap->set, &sss, sizeof(sss))) != 0) + if ((error = copyin(SCARG(uap, set), &sss, sizeof(sss))) != 0) return error; svr4_to_bsd_sigset(&sss, &bss); PROC_LOCK(td->td_proc); - switch (uap->how) { + switch (SCARG(uap, how)) { case SVR4_SIG_BLOCK: SIGSETOR(td->td_proc->p_sigmask, bss); SIG_CANTMASK(td->td_proc->p_sigmask); @@ -560,9 +560,9 @@ svr4_sys_sigpending(td, uap) DPRINTF(("@@@ svr4_sys_sigpending(%d)\n", td->td_proc->p_pid)); retval = td->td_retval; - switch (uap->what) { + switch (SCARG(uap, what)) { case 1: /* sigpending */ - if (uap->mask == NULL) + if (SCARG(uap, mask) == NULL) return 0; PROC_LOCK(td->td_proc); bss = td->td_proc->p_siglist; @@ -586,7 +586,7 @@ svr4_sys_sigpending(td, uap) return EINVAL; } - return copyout(&sss, uap->mask, sizeof(sss)); + return copyout(&sss, SCARG(uap, mask), sizeof(sss)); } int @@ -600,13 +600,13 @@ svr4_sys_sigsuspend(td, uap) int error; caddr_t sg = stackgap_init(); - if ((error = copyin(uap->ss, &sss, sizeof(sss))) != 0) + if ((error = copyin(SCARG(uap, ss), &sss, sizeof(sss))) != 0) return error; bss = stackgap_alloc(&sg, sizeof(sigset_t)); svr4_to_bsd_sigset(&sss, bss); - sa.sigmask = bss; + SCARG(&sa, sigmask) = bss; return sigsuspend(td, &sa); } @@ -618,8 +618,8 @@ svr4_sys_kill(td, uap) { struct kill_args ka; - ka.pid = uap->pid; - ka.signum = SVR4_SVR42BSD_SIG(uap->signum); + SCARG(&ka, pid) = SCARG(uap, pid); + SCARG(&ka, signum) = SVR4_SVR42BSD_SIG(SCARG(uap, signum)); return kill(td, &ka); } @@ -671,6 +671,6 @@ svr4_sys_pause(td, uap) { struct sigsuspend_args bsa; - bsa.sigmask = &td->td_proc->p_sigmask; + SCARG(&bsa, sigmask) = &td->td_proc->p_sigmask; return sigsuspend(td, &bsa); } diff --git a/sys/compat/svr4/svr4_socket.c b/sys/compat/svr4/svr4_socket.c index bea6306..b4f2b55 100644 --- a/sys/compat/svr4/svr4_socket.c +++ b/sys/compat/svr4/svr4_socket.c @@ -166,25 +166,25 @@ svr4_sys_socket(td, uap) struct thread *td; struct svr4_sys_socket_args *uap; { - switch (uap->type) { + switch (SCARG(uap, type)) { case SVR4_SOCK_DGRAM: - uap->type = SOCK_DGRAM; + SCARG(uap, type) = SOCK_DGRAM; break; case SVR4_SOCK_STREAM: - uap->type = SOCK_STREAM; + SCARG(uap, type) = SOCK_STREAM; break; case SVR4_SOCK_RAW: - uap->type = SOCK_RAW; + SCARG(uap, type) = SOCK_RAW; break; case SVR4_SOCK_RDM: - uap->type = SOCK_RDM; + SCARG(uap, type) = SOCK_RDM; break; case SVR4_SOCK_SEQPACKET: - uap->type = SOCK_SEQPACKET; + SCARG(uap, type) = SOCK_SEQPACKET; break; default: return EINVAL; diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c index 51576b9..351c6c7 100644 --- a/sys/compat/svr4/svr4_stat.c +++ b/sys/compat/svr4/svr4_stat.c @@ -164,24 +164,24 @@ svr4_sys_stat(td, uap) int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); - cup.path = uap->path; - cup.ub = stackgap_alloc(&sg, sizeof(struct stat)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); 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_to_svr4_stat(&st, &svr4_st); if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(td, uap->path, &st); + (void) svr4_add_socket(td, SCARG(uap, path), &st); - if ((error = copyout(&svr4_st, uap->ub, sizeof svr4_st)) != 0) + if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0) return error; return 0; @@ -199,23 +199,23 @@ svr4_sys_lstat(td, uap) int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); - cup.path = uap->path; - cup.ub = stackgap_alloc(&sg, sizeof(struct stat)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); 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_to_svr4_stat(&st, &svr4_st); if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(td, uap->path, &st); + (void) svr4_add_socket(td, SCARG(uap, path), &st); - if ((error = copyout(&svr4_st, uap->ub, sizeof svr4_st)) != 0) + if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0) return error; return 0; @@ -233,18 +233,18 @@ svr4_sys_fstat(td, uap) int error; caddr_t sg = stackgap_init(); - cup.fd = uap->fd; - cup.sb = stackgap_alloc(&sg, sizeof(struct stat)); + SCARG(&cup, fd) = SCARG(uap, fd); + SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat)); 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_to_svr4_stat(&st, &svr4_st); - if ((error = copyout(&svr4_st, uap->sb, sizeof svr4_st)) != 0) + if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0) return error; return 0; @@ -262,25 +262,25 @@ svr4_sys_xstat(td, uap) int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); - cup.path = uap->path; - cup.ub = stackgap_alloc(&sg, sizeof(struct stat)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); 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_to_svr4_xstat(&st, &svr4_st); #if defined(SOCKET_NOTYET) if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(td, uap->path, &st); + (void) svr4_add_socket(td, SCARG(uap, path), &st); #endif - if ((error = copyout(&svr4_st, uap->ub, sizeof svr4_st)) != 0) + if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0) return error; return 0; @@ -296,24 +296,24 @@ svr4_sys_lxstat(td, uap) struct lstat_args cup; int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); - cup.path = uap->path; - cup.ub = stackgap_alloc(&sg, sizeof(struct stat)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); 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_to_svr4_xstat(&st, &svr4_st); #if defined(SOCKET_NOTYET) if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(td, uap->path, &st); + (void) svr4_add_socket(td, SCARG(uap, path), &st); #endif - if ((error = copyout(&svr4_st, uap->ub, sizeof svr4_st)) != 0) + if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0) return error; return 0; @@ -332,18 +332,18 @@ svr4_sys_fxstat(td, uap) caddr_t sg = stackgap_init(); - cup.fd = uap->fd; - cup.sb = stackgap_alloc(&sg, sizeof(struct stat)); + SCARG(&cup, fd) = SCARG(uap, fd); + SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat)); 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_to_svr4_xstat(&st, &svr4_st); - if ((error = copyout(&svr4_st, uap->sb, sizeof svr4_st)) != 0) + if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0) return error; return 0; @@ -360,23 +360,23 @@ svr4_sys_stat64(td, uap) int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); - cup.path = uap->path; - cup.ub = stackgap_alloc(&sg, sizeof(struct stat)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); 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_to_svr4_stat64(&st, &svr4_st); if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(td, uap->path, &st); + (void) svr4_add_socket(td, SCARG(uap, path), &st); - if ((error = copyout(&svr4_st, uap->sb, sizeof svr4_st)) != 0) + if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0) return error; return 0; @@ -394,23 +394,23 @@ svr4_sys_lstat64(td, uap) int error; caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, (char *) uap->path); + CHECKALTEXIST(td, &sg, (char *) SCARG(uap, path)); - cup.path = uap->path; - cup.ub = stackgap_alloc(&sg, sizeof(struct stat)); + SCARG(&cup, path) = SCARG(uap, path); + SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); if ((error = lstat(td, (struct lstat_args *)&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_to_svr4_stat64(&st, &svr4_st); if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(td, uap->path, &st); + (void) svr4_add_socket(td, SCARG(uap, path), &st); - if ((error = copyout(&svr4_st, uap->sb, sizeof svr4_st)) != 0) + if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0) return error; return 0; @@ -428,18 +428,18 @@ svr4_sys_fstat64(td, uap) int error; caddr_t sg = stackgap_init(); - cup.fd = uap->fd; - cup.sb = stackgap_alloc(&sg, sizeof(struct stat)); + SCARG(&cup, fd) = SCARG(uap, fd); + SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat)); 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_to_svr4_stat64(&st, &svr4_st); - if ((error = copyout(&svr4_st, uap->sb, sizeof svr4_st)) != 0) + if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0) return error; return 0; @@ -460,7 +460,7 @@ svr4_ustat(td, uap) * XXX: should set f_tfree and f_tinode at least * How do we translate dev -> fstat? (and then to svr4_ustat) */ - if ((error = copyout(&us, uap->name, sizeof us)) != 0) + if ((error = copyout(&us, SCARG(uap, name), sizeof us)) != 0) return (error); return 0; @@ -483,7 +483,7 @@ svr4_sys_uname(td, uap) strlcpy(sut.version, version, sizeof(sut.version)); strlcpy(sut.machine, machine, sizeof(sut.machine)); - return copyout((caddr_t) &sut, (caddr_t) uap->name, + return copyout((caddr_t) &sut, (caddr_t) SCARG(uap, name), sizeof(struct svr4_utsname)); } @@ -499,9 +499,9 @@ svr4_sys_systeminfo(td, uap) char buf[1]; /* XXX NetBSD uses 256, but that seems like awfully excessive kstack usage for an empty string... */ - u_int rlen = uap->len; + u_int rlen = SCARG(uap, len); - switch (uap->what) { + switch (SCARG(uap, what)) { case SVR4_SI_SYSNAME: str = ostype; break; @@ -554,13 +554,13 @@ svr4_sys_systeminfo(td, uap) if ((error = suser(td)) != 0) return error; name = KERN_HOSTNAME; - return kern_sysctl(&name, 1, 0, 0, uap->buf, rlen, td); + return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen, td); case SVR4_SI_SET_SRPC_DOMAIN: if ((error = suser(td)) != 0) return error; name = KERN_NISDOMAINNAME; - return kern_sysctl(&name, 1, 0, 0, uap->buf, rlen, td); + return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen, td); #else case SVR4_SI_SET_HOSTNAME: case SVR4_SI_SET_SRPC_DOMAIN: @@ -570,7 +570,7 @@ svr4_sys_systeminfo(td, uap) return 0; default: - DPRINTF(("Bad systeminfo command %d\n", uap->what)); + DPRINTF(("Bad systeminfo command %d\n", SCARG(uap, what))); return ENOSYS; } @@ -579,13 +579,13 @@ svr4_sys_systeminfo(td, uap) if (len > rlen) len = rlen; - if (uap->buf) { - error = copyout(str, uap->buf, len); + if (SCARG(uap, buf)) { + error = copyout(str, SCARG(uap, buf), len); if (error) return error; /* make sure we are NULL terminated */ buf[0] = '\0'; - error = copyout(buf, &(uap->buf[len - 1]), 1); + error = copyout(buf, &(SCARG(uap, buf)[len - 1]), 1); } else error = 0; @@ -602,19 +602,19 @@ svr4_sys_utssys(td, uap) register struct thread *td; struct svr4_sys_utssys_args *uap; { - switch (uap->sel) { + switch (SCARG(uap, sel)) { case 0: /* uname(2) */ { struct svr4_sys_uname_args ua; - ua.name = uap->a1; + SCARG(&ua, name) = SCARG(uap, a1); return svr4_sys_uname(td, &ua); } case 2: /* ustat(2) */ { struct svr4_ustat_args ua; - ua.dev = (svr4_dev_t) uap->a2; - ua.name = uap->a1; + SCARG(&ua, dev) = (svr4_dev_t) SCARG(uap, a2); + SCARG(&ua, name) = SCARG(uap, a1); return svr4_ustat(td, &ua); } @@ -640,10 +640,10 @@ svr4_sys_utime(td, uap) caddr_t sg = stackgap_init(); void *ttp; - CHECKALTEXIST(td, &sg, uap->path); - ap.path = uap->path; - if (uap->ubuf != NULL) { - if ((error = copyin(uap->ubuf, &ub, sizeof(ub))) != 0) + CHECKALTEXIST(td, &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) return error; tbuf[0].tv_sec = ub.actime; tbuf[0].tv_usec = 0; @@ -653,10 +653,10 @@ svr4_sys_utime(td, uap) error = copyout(tbuf, ttp, sizeof(tbuf)); if (error) return error; - ap.tptr = ttp; + SCARG(&ap, tptr) = ttp; } else - ap.tptr = NULL; + SCARG(&ap, tptr) = NULL; return utimes(td, &ap); } @@ -667,7 +667,7 @@ svr4_sys_utimes(td, uap) struct svr4_sys_utimes_args *uap; { caddr_t sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); return utimes(td, (struct utimes_args *)uap); } @@ -728,11 +728,11 @@ svr4_sys_pathconf(td, uap) caddr_t sg = stackgap_init(); register_t *retval = td->td_retval; - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(uap, path)); - uap->name = svr4_to_bsd_pathconf(uap->name); + SCARG(uap, name) = svr4_to_bsd_pathconf(SCARG(uap, name)); - switch (uap->name) { + switch (SCARG(uap, name)) { case -1: *retval = -1; return EINVAL; @@ -752,9 +752,9 @@ svr4_sys_fpathconf(td, uap) { register_t *retval = td->td_retval; - uap->name = svr4_to_bsd_pathconf(uap->name); + SCARG(uap, name) = svr4_to_bsd_pathconf(SCARG(uap, name)); - switch (uap->name) { + switch (SCARG(uap, name)) { case -1: *retval = -1; return EINVAL; diff --git a/sys/compat/svr4/svr4_stream.c b/sys/compat/svr4/svr4_stream.c index ea75ba7..468bcae 100644 --- a/sys/compat/svr4/svr4_stream.c +++ b/sys/compat/svr4/svr4_stream.c @@ -524,17 +524,17 @@ clean_pipe(td, path) void *tpath; tpath = stackgap_alloc(&sg, l); - la.ub = stackgap_alloc(&sg, sizeof(struct stat)); + SCARG(&la, ub) = stackgap_alloc(&sg, sizeof(struct stat)); if ((error = copyout(path, tpath, l)) != 0) return error; - la.path = tpath; + SCARG(&la, path) = tpath; if ((error = lstat(td, &la)) != 0) return 0; - if ((error = copyin(la.ub, &st, sizeof(st))) != 0) + if ((error = copyin(SCARG(&la, ub), &st, sizeof(st))) != 0) return 0; /* @@ -546,7 +546,7 @@ clean_pipe(td, path) if ((st.st_mode & ALLPERMS) != 0) return 0; - ua.path = la.path; + SCARG(&ua, path) = SCARG(&la, path); if ((error = unlink(td, &ua)) != 0) { DPRINTF(("clean_pipe: unlink failed %d\n", error)); @@ -773,9 +773,9 @@ si_listen(fp, fd, ioc, td) /* * We are making assumptions again... */ - la.s = fd; + SCARG(&la, s) = fd; DPRINTF(("SI_LISTEN: fileno %d backlog = %d\n", fd, 5)); - la.backlog = 5; + SCARG(&la, backlog) = 5; if ((error = listen(td, &la)) != 0) { DPRINTF(("SI_LISTEN: listen failed %d\n", error)); @@ -880,16 +880,16 @@ si_shutdown(fp, fd, ioc, td) int error; struct shutdown_args ap; - if (ioc->len != sizeof(ap.how)) { + if (ioc->len != sizeof(SCARG(&ap, how))) { DPRINTF(("SI_SHUTDOWN: Wrong size %d != %d\n", - sizeof(ap.how), ioc->len)); + sizeof(SCARG(&ap, how)), ioc->len)); return EINVAL; } - if ((error = copyin(ioc->buf, &ap.how, ioc->len)) != 0) + if ((error = copyin(ioc->buf, &SCARG(&ap, how), ioc->len)) != 0) return error; - ap.s = fd; + SCARG(&ap, s) = fd; return shutdown(td, &ap); } @@ -1066,10 +1066,10 @@ ti_bind(fp, fd, ioc, td) if ((error = copyout(skp, sup, sasize)) != 0) return error; - ba.s = fd; + SCARG(&ba, s) = fd; DPRINTF(("TI_BIND: fileno %d\n", fd)); - ba.name = (void *) sup; - ba.namelen = sasize; + SCARG(&ba, name) = (void *) sup; + SCARG(&ba, namelen) = sasize; if ((error = bind(td, &ba)) != 0) { DPRINTF(("TI_BIND: bind failed %d\n", error)); @@ -1186,9 +1186,9 @@ svr4_stream_ti_ioctl(fp, td, retval, fd, cmd, dat) DPRINTF(("TI_GETMYNAME\n")); { struct getsockname_args ap; - ap.fdes = fd; - ap.asa = sup; - ap.alen = lenp; + SCARG(&ap, fdes) = fd; + SCARG(&ap, asa) = sup; + SCARG(&ap, alen) = lenp; if ((error = getsockname(td, &ap)) != 0) { DPRINTF(("ti_ioctl: getsockname error\n")); return error; @@ -1200,9 +1200,9 @@ svr4_stream_ti_ioctl(fp, td, retval, fd, cmd, dat) DPRINTF(("TI_GETPEERNAME\n")); { struct getpeername_args ap; - ap.fdes = fd; - ap.asa = sup; - ap.alen = lenp; + SCARG(&ap, fdes) = fd; + SCARG(&ap, asa) = sup; + SCARG(&ap, alen) = lenp; if ((error = getpeername(td, &ap)) != 0) { DPRINTF(("ti_ioctl: getpeername error\n")); return error; @@ -1334,8 +1334,8 @@ i_fdinsert(fp, td, retval, fd, cmd, dat) return error; } - d2p.from = st->s_afd; - d2p.to = fdi.fd; + SCARG(&d2p, from) = st->s_afd; + SCARG(&d2p, to) = fdi.fd; if ((error = dup2(td, &d2p)) != 0) { DPRINTF(("fdinsert: dup2(%d, %d) failed %d\n", @@ -1343,7 +1343,7 @@ i_fdinsert(fp, td, retval, fd, cmd, dat) return error; } - clp.fd = st->s_afd; + SCARG(&clp, fd) = st->s_afd; if ((error = close(td, &clp)) != 0) { DPRINTF(("fdinsert: close(%d) failed %d\n", @@ -1376,8 +1376,8 @@ _i_bind_rsvd(fp, td, retval, fd, cmd, dat) * ``reserve'' it. I don't know how this get reserved inside * the kernel, but we are going to create it nevertheless. */ - ap.path = dat; - ap.mode = S_IFIFO; + SCARG(&ap, path) = dat; + SCARG(&ap, mode) = S_IFIFO; return mkfifo(td, &ap); } @@ -1397,7 +1397,7 @@ _i_rele_rsvd(fp, td, retval, fd, cmd, dat) * This is a supposed to be a kernel and library only ioctl. * I guess it is supposed to release the socket. */ - ap.path = dat; + SCARG(&ap, path) = dat; return unlink(td, &ap); } @@ -1473,8 +1473,8 @@ i_setsig(fp, td, retval, fd, cmd, dat) return EINVAL; } /* get old status flags */ - fa.fd = fd; - fa.cmd = F_GETFL; + SCARG(&fa, fd) = fd; + SCARG(&fa, cmd) = F_GETFL; if ((error = fcntl(td, &fa)) != 0) return error; @@ -1502,8 +1502,8 @@ i_setsig(fp, td, retval, fd, cmd, dat) /* set the new flags, if changed */ if (flags != oflags) { - fa.cmd = F_SETFL; - fa.arg = (long) flags; + SCARG(&fa, cmd) = F_SETFL; + SCARG(&fa, arg) = (long) flags; if ((error = fcntl(td, &fa)) != 0) return error; flags = td->td_retval[0]; @@ -1511,8 +1511,8 @@ i_setsig(fp, td, retval, fd, cmd, dat) /* set up SIGIO receiver if needed */ if (dat != NULL) { - fa.cmd = F_SETOWN; - fa.arg = (long) td->td_proc->p_pid; + SCARG(&fa, cmd) = F_SETOWN; + SCARG(&fa, arg) = (long) td->td_proc->p_pid; return fcntl(td, &fa); } return 0; @@ -1760,14 +1760,14 @@ svr4_do_putmsg(td, uap, fp) retval = td->td_retval; #ifdef DEBUG_SVR4 - show_msg(">putmsg", uap->fd, uap->ctl, - uap->dat, uap->flags); + show_msg(">putmsg", SCARG(uap, fd), SCARG(uap, ctl), + SCARG(uap, dat), SCARG(uap, flags)); #endif /* DEBUG_SVR4 */ FILE_LOCK_ASSERT(fp, MA_NOTOWNED); - if (uap->ctl != NULL) { - if ((error = copyin(uap->ctl, &ctl, sizeof(ctl))) != 0) { + if (SCARG(uap, ctl) != NULL) { + if ((error = copyin(SCARG(uap, ctl), &ctl, sizeof(ctl))) != 0) { #ifdef DEBUG_SVR4 uprintf("putmsg: copyin(): %d\n", error); #endif @@ -1777,8 +1777,8 @@ svr4_do_putmsg(td, uap, fp) else ctl.len = -1; - if (uap->dat != NULL) { - if ((error = copyin(uap->dat, &dat, sizeof(dat))) != 0) { + if (SCARG(uap, dat) != NULL) { + if ((error = copyin(SCARG(uap, dat), &dat, sizeof(dat))) != 0) { #ifdef DEBUG_SVR4 uprintf("putmsg: copyin(): %d (2)\n", error); #endif @@ -1820,9 +1820,9 @@ svr4_do_putmsg(td, uap, fp) * is how it works. newton@atdot.dotat.org XXX */ DPRINTF(("sending expedited data ??\n")); - wa.fd = uap->fd; - wa.buf = dat.buf; - wa.nbyte = dat.len; + SCARG(&wa, fd) = SCARG(uap, fd); + SCARG(&wa, buf) = dat.buf; + SCARG(&wa, nbyte) = dat.len; return write(td, &wa); } DPRINTF(("putmsg: Invalid inet length %ld\n", sc.len)); @@ -1872,9 +1872,9 @@ svr4_do_putmsg(td, uap, fp) { struct connect_args co; - co.s = uap->fd; - co.name = (void *) sup; - co.namelen = (int) sasize; + SCARG(&co, s) = SCARG(uap, fd); + SCARG(&co, name) = (void *) sup; + SCARG(&co, namelen) = (int) sasize; return connect(td, &co); } @@ -1896,8 +1896,8 @@ svr4_do_putmsg(td, uap, fp) error = so->so_proto->pr_usrreqs->pru_sosend(so, 0, uio, 0, 0, 0, uio->uio_td); #endif - error = svr4_sendit(td, uap->fd, &msg, - uap->flags); + error = svr4_sendit(td, SCARG(uap, fd), &msg, + SCARG(uap, flags)); DPRINTF(("sendto_request error: %d\n", error)); *retval = 0; return error; @@ -1957,12 +1957,12 @@ svr4_do_getmsg(td, uap, fp) memset(&sc, 0, sizeof(sc)); #ifdef DEBUG_SVR4 - show_msg(">getmsg", uap->fd, uap->ctl, - uap->dat, 0); + show_msg(">getmsg", SCARG(uap, fd), SCARG(uap, ctl), + SCARG(uap, dat), 0); #endif /* DEBUG_SVR4 */ - if (uap->ctl != NULL) { - if ((error = copyin(uap->ctl, &ctl, sizeof(ctl))) != 0) + if (SCARG(uap, ctl) != NULL) { + if ((error = copyin(SCARG(uap, ctl), &ctl, sizeof(ctl))) != 0) return error; } else { @@ -1970,8 +1970,8 @@ svr4_do_getmsg(td, uap, fp) ctl.maxlen = 0; } - if (uap->dat != NULL) { - if ((error = copyin(uap->dat, &dat, sizeof(dat))) != 0) + if (SCARG(uap, dat) != NULL) { + if ((error = copyin(SCARG(uap, dat), &dat, sizeof(dat))) != 0) return error; } else { @@ -2040,9 +2040,9 @@ svr4_do_getmsg(td, uap, fp) * a connect verification. */ - ga.fdes = uap->fd; - ga.asa = (void *) sup; - ga.alen = flen; + SCARG(&ga, fdes) = SCARG(uap, fd); + SCARG(&ga, asa) = (void *) sup; + SCARG(&ga, alen) = flen; if ((error = getpeername(td, &ga)) != 0) { DPRINTF(("getmsg: getpeername failed %d\n", error)); @@ -2099,9 +2099,9 @@ svr4_do_getmsg(td, uap, fp) /* * We are after a listen, so we try to accept... */ - aa.s = uap->fd; - aa.name = (void *) sup; - aa.anamelen = flen; + SCARG(&aa, s) = SCARG(uap, fd); + SCARG(&aa, name) = (void *) sup; + SCARG(&aa, anamelen) = flen; if ((error = accept(td, &aa)) != 0) { DPRINTF(("getmsg: accept failed %d\n", error)); @@ -2174,7 +2174,7 @@ svr4_do_getmsg(td, uap, fp) aiov.iov_len = dat.maxlen; msg.msg_flags = 0; - error = svr4_recvit(td, uap->fd, &msg, (caddr_t) flen); + error = svr4_recvit(td, SCARG(uap, fd), &msg, (caddr_t) flen); if (error) { DPRINTF(("getmsg: recvit failed %d\n", error)); @@ -2222,9 +2222,9 @@ svr4_do_getmsg(td, uap, fp) * appropriately (or inappropriately :-) * -- newton@atdot.dotat.org XXX */ - ra.fd = uap->fd; - ra.buf = dat.buf; - ra.nbyte = dat.maxlen; + SCARG(&ra, fd) = SCARG(uap, fd); + SCARG(&ra, buf) = dat.buf; + SCARG(&ra, nbyte) = dat.maxlen; if ((error = read(td, &ra)) != 0) { return error; } @@ -2237,30 +2237,30 @@ svr4_do_getmsg(td, uap, fp) return EINVAL; } - if (uap->ctl) { + if (SCARG(uap, ctl)) { if (ctl.len != -1) if ((error = copyout(&sc, ctl.buf, ctl.len)) != 0) return error; - if ((error = copyout(&ctl, uap->ctl, sizeof(ctl))) != 0) + if ((error = copyout(&ctl, SCARG(uap, ctl), sizeof(ctl))) != 0) return error; } - if (uap->dat) { - if ((error = copyout(&dat, uap->dat, sizeof(dat))) != 0) + if (SCARG(uap, dat)) { + if ((error = copyout(&dat, SCARG(uap, dat), sizeof(dat))) != 0) return error; } - if (uap->flags) { /* XXX: Need translation */ - if ((error = copyout(&fl, uap->flags, sizeof(fl))) != 0) + if (SCARG(uap, flags)) { /* XXX: Need translation */ + if ((error = copyout(&fl, SCARG(uap, flags), sizeof(fl))) != 0) return error; } *retval = 0; #ifdef DEBUG_SVR4 - show_msg("<getmsg", uap->fd, uap->ctl, - uap->dat, fl); + show_msg("<getmsg", SCARG(uap, fd), SCARG(uap, ctl), + SCARG(uap, dat), fl); #endif /* DEBUG_SVR4 */ return error; } @@ -2270,10 +2270,10 @@ int svr4_sys_send(td, uap) struct svr4_sys_send_args *uap; { struct osend_args osa; - osa.s = uap->s; - osa.buf = uap->buf; - osa.len = uap->len; - osa.flags = uap->flags; + 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(td, &osa); } @@ -2282,10 +2282,10 @@ int svr4_sys_recv(td, uap) struct svr4_sys_recv_args *uap; { struct orecv_args ora; - ora.s = uap->s; - ora.buf = uap->buf; - ora.len = uap->len; - ora.flags = uap->flags; + 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(td, &ora); } @@ -2300,12 +2300,12 @@ svr4_sys_sendto(td, uap) { struct sendto_args sa; - sa.s = uap->s; - sa.buf = uap->buf; - sa.len = uap->len; - sa.flags = uap->flags; - sa.to = (caddr_t)uap->to; - sa.tolen = uap->tolen; + SCARG(&sa, s) = SCARG(uap, s); + SCARG(&sa, buf) = SCARG(uap, buf); + SCARG(&sa, len) = SCARG(uap, len); + SCARG(&sa, flags) = SCARG(uap, flags); + SCARG(&sa, to) = (caddr_t)SCARG(uap, to); + SCARG(&sa, tolen) = SCARG(uap, tolen); DPRINTF(("calling sendto()\n")); return sendto(td, &sa); |