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 | |
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')
56 files changed, 1821 insertions, 1788 deletions
diff --git a/sys/alpha/alpha/sys_machdep.c b/sys/alpha/alpha/sys_machdep.c index e2e23ec..b88feae 100644 --- a/sys/alpha/alpha/sys_machdep.c +++ b/sys/alpha/alpha/sys_machdep.c @@ -76,7 +76,7 @@ sysarch(td, uap) { int error = 0; - switch(uap->op) { + switch(SCARG(uap,op)) { case ALPHA_SETHAE: error = alpha_sethae(td, uap->parms); break; diff --git a/sys/alpha/osf1/osf1_misc.c b/sys/alpha/osf1/osf1_misc.c index dc75d55..603747e 100644 --- a/sys/alpha/osf1/osf1_misc.c +++ b/sys/alpha/osf1/osf1_misc.c @@ -249,9 +249,9 @@ osf1_open(td, uap) sg = stackgap_init(); CHECKALTEXIST(td, &sg, uap->path); - a.path = uap->path; - a.flags = uap->flags; /* XXX translate */ - a.mode = uap->mode; + SCARG(&a, path) = SCARG(uap, path); + SCARG(&a, flags) = SCARG(uap, flags); /* XXX translate */ + SCARG(&a, mode) = SCARG(uap, mode); return open(td, &a); } @@ -396,16 +396,16 @@ osf1_getrlimit(td, uap) syscallarg(struct rlimit *) rlp; } */ a; - if (uap->which >= OSF1_RLIMIT_NLIMITS) + if (SCARG(uap, which) >= OSF1_RLIMIT_NLIMITS) return (EINVAL); - if (uap->which <= OSF1_RLIMIT_LASTCOMMON) - a.which = uap->which; - else if (uap->which == OSF1_RLIMIT_NOFILE) - a.which = RLIMIT_NOFILE; + if (SCARG(uap, which) <= OSF1_RLIMIT_LASTCOMMON) + SCARG(&a, which) = SCARG(uap, which); + else if (SCARG(uap, which) == OSF1_RLIMIT_NOFILE) + SCARG(&a, which) = RLIMIT_NOFILE; else return (0); - a.rlp = (struct rlimit *)uap->rlp; + SCARG(&a, rlp) = (struct rlimit *)SCARG(uap, rlp); return getrlimit(td, &a); } @@ -421,16 +421,16 @@ osf1_setrlimit(td, uap) syscallarg(struct rlimit *) rlp; } */ a; - if (uap->which >= OSF1_RLIMIT_NLIMITS) + if (SCARG(uap, which) >= OSF1_RLIMIT_NLIMITS) return (EINVAL); - if (uap->which <= OSF1_RLIMIT_LASTCOMMON) - a.which = uap->which; - else if (uap->which == OSF1_RLIMIT_NOFILE) - a.which = RLIMIT_NOFILE; + if (SCARG(uap, which) <= OSF1_RLIMIT_LASTCOMMON) + SCARG(&a, which) = SCARG(uap, which); + else if (SCARG(uap, which) == OSF1_RLIMIT_NOFILE) + SCARG(&a, which) = RLIMIT_NOFILE; else return (0); - a.rlp = (struct rlimit *)uap->rlp; + SCARG(&a, rlp) = (struct rlimit *)SCARG(uap, rlp); return setrlimit(td, &a); } @@ -476,14 +476,14 @@ osf1_mmap(td, uap) GIANT_REQUIRED; - a.addr = uap->addr; - a.len = uap->len; - a.prot = uap->prot; - a.fd = uap->fd; - a.pad = 0; - a.pos = uap->pos; + SCARG(&a, addr) = SCARG(uap, addr); + SCARG(&a, len) = SCARG(uap, len); + SCARG(&a, prot) = SCARG(uap, prot); + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, pad) = 0; + SCARG(&a, pos) = SCARG(uap, pos); - a.flags = 0; + SCARG(&a, flags) = 0; /* * OSF/1's mmap, unlike FreeBSD's, does its best to map memory at the @@ -493,8 +493,8 @@ osf1_mmap(td, uap) * close to where they've requested as possible. */ - if (uap->addr != NULL) - addr = round_page((vm_offset_t)a.addr); + if (SCARG(uap, addr) != NULL) + addr = round_page((vm_offset_t)SCARG(&a,addr)); else /* * Try to use the apparent OSF/1 default placement of 0x10000 for @@ -502,55 +502,55 @@ osf1_mmap(td, uap) * SEGV'ing. */ addr = round_page((vm_offset_t)0x10000UL); - len = (vm_offset_t)a.len; + len = (vm_offset_t)SCARG(&a, len); map = &td->td_proc->p_vmspace->vm_map; if (!vm_map_findspace(map, addr, len, &newaddr)) { - a.addr = (caddr_t) newaddr; - a.flags |= (MAP_FIXED); + SCARG(&a,addr) = (caddr_t) newaddr; + SCARG(&a, flags) |= (MAP_FIXED); } #ifdef DEBUG else uprintf("osf1_mmap:vm_map_findspace failed for: %p 0x%lx\n", (caddr_t)addr, len); #endif - if (uap->flags & OSF1_MAP_SHARED) - a.flags |= MAP_SHARED; - if (uap->flags & OSF1_MAP_PRIVATE) - a.flags |= MAP_PRIVATE; + if (SCARG(uap, flags) & OSF1_MAP_SHARED) + SCARG(&a, flags) |= MAP_SHARED; + if (SCARG(uap, flags) & OSF1_MAP_PRIVATE) + SCARG(&a, flags) |= MAP_PRIVATE; - switch (uap->flags & OSF1_MAP_TYPE) { + switch (SCARG(uap, flags) & OSF1_MAP_TYPE) { case OSF1_MAP_ANONYMOUS: - a.flags |= MAP_ANON; + SCARG(&a, flags) |= MAP_ANON; break; case OSF1_MAP_FILE: - a.flags |= MAP_FILE; + SCARG(&a, flags) |= MAP_FILE; break; default: return (EINVAL); } - if (uap->flags & OSF1_MAP_FIXED) - a.flags |= MAP_FIXED; - if (uap->flags & OSF1_MAP_HASSEMAPHORE) - a.flags |= MAP_HASSEMAPHORE; - if (uap->flags & OSF1_MAP_INHERIT) + if (SCARG(uap, flags) & OSF1_MAP_FIXED) + SCARG(&a, flags) |= MAP_FIXED; + if (SCARG(uap, flags) & OSF1_MAP_HASSEMAPHORE) + SCARG(&a, flags) |= MAP_HASSEMAPHORE; + if (SCARG(uap, flags) & OSF1_MAP_INHERIT) return (EINVAL); - if (uap->flags & OSF1_MAP_UNALIGNED) + if (SCARG(uap, flags) & OSF1_MAP_UNALIGNED) return (EINVAL); /* * Emulate an osf/1 bug: Apparently, mmap'ed segments are always * readable even if the user doesn't or in PROT_READ. This causes * some buggy programs to segv. */ - a.prot |= PROT_READ; + SCARG(&a, prot) |= PROT_READ; retval = mmap(td, &a); #ifdef DEBUG uprintf( "\nosf1_mmap: addr=%p (%p), len = 0x%lx, prot=0x%x, fd=%d, pad=0, pos=0x%lx", - uap->addr, a.addr,uap->len, uap->prot, - uap->fd, uap->pos); - printf(" flags = 0x%x\n",uap->flags); + SCARG(uap, addr), SCARG(&a, addr),SCARG(uap, len), SCARG(uap, prot), + SCARG(uap, fd), SCARG(uap, pos)); + printf(" flags = 0x%x\n",SCARG(uap, flags)); #endif return (retval); } @@ -562,15 +562,15 @@ osf1_msync(td, uap) { struct msync_args a; - a.addr = uap->addr; - a.len = uap->len; + a.addr = SCARG(uap, addr); + a.len = SCARG(uap, len); a.flags = 0; - if(uap->flags & OSF1_MS_ASYNC) - a.flags |= MS_ASYNC; - if(uap->flags & OSF1_MS_SYNC) - a.flags |= MS_SYNC; - if(uap->flags & OSF1_MS_INVALIDATE) - a.flags |= MS_INVALIDATE; + if(SCARG(uap, flags) & OSF1_MS_ASYNC) + SCARG(&a, flags) |= MS_ASYNC; + if(SCARG(uap, flags) & OSF1_MS_SYNC) + SCARG(&a, flags) |= MS_SYNC; + if(SCARG(uap, flags) & OSF1_MS_INVALIDATE) + SCARG(&a, flags) |= MS_INVALIDATE; return(msync(td, &a)); } @@ -615,7 +615,7 @@ osf1_stat(td, uap) CHECKALTEXIST(td, &sg, uap->path); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd))) return (error); error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td); @@ -623,7 +623,7 @@ osf1_stat(td, uap) if (error) return (error); cvtstat2osf1(&sb, &osb); - error = copyout((caddr_t)&osb, (caddr_t)uap->ub, sizeof (osb)); + error = copyout((caddr_t)&osb, (caddr_t)SCARG(uap, ub), sizeof (osb)); return (error); } @@ -646,7 +646,7 @@ osf1_lstat(td, uap) CHECKALTEXIST(td, &sg, uap->path); NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd))) return (error); error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td); @@ -654,7 +654,7 @@ osf1_lstat(td, uap) if (error) return (error); cvtstat2osf1(&sb, &osb); - error = copyout((caddr_t)&osb, (caddr_t)uap->ub, sizeof (osb)); + error = copyout((caddr_t)&osb, (caddr_t)SCARG(uap, ub), sizeof (osb)); return (error); } @@ -678,7 +678,7 @@ osf1_fstat(td, uap) fdrop(fp, td); cvtstat2osf1(&ub, &oub); if (error == 0) - error = copyout((caddr_t)&oub, (caddr_t)uap->sb, + error = copyout((caddr_t)&oub, (caddr_t)SCARG(uap, sb), sizeof (oub)); return (error); } @@ -736,9 +736,9 @@ osf1_mknod(td, uap) sg = stackgap_init(); CHECKALTEXIST(td, &sg, uap->path); - a.path = uap->path; - a.mode = uap->mode; - a.dev = osf2bsd_dev(uap->dev); + SCARG(&a, path) = SCARG(uap, path); + SCARG(&a, mode) = SCARG(uap, mode); + SCARG(&a, dev) = osf2bsd_dev(SCARG(uap, dev)); return mknod(td, &a); #endif @@ -784,32 +784,32 @@ osf1_fcntl(td, uap) error = 0; - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case F_SETFL: - a.fd = uap->fd; - a.cmd = F_SETFL; + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, cmd) = F_SETFL; /* need to translate flags here */ tmp = 0; - if ((long)uap->arg & OSF1_FNONBLOCK) + if ((long)SCARG(uap, arg) & OSF1_FNONBLOCK) tmp |= FNONBLOCK; - if ((long)uap->arg & OSF1_FAPPEND) + if ((long)SCARG(uap, arg) & OSF1_FAPPEND) tmp |= FAPPEND; - if ((long)uap->arg & OSF1_FDEFER) + if ((long)SCARG(uap, arg) & OSF1_FDEFER) tmp |= FDEFER; - if ((long)uap->arg & OSF1_FASYNC) + if ((long)SCARG(uap, arg) & OSF1_FASYNC) tmp |= FASYNC; - if ((long)uap->arg & OSF1_FCREAT) + if ((long)SCARG(uap, arg) & OSF1_FCREAT) tmp |= O_CREAT; - if ((long)uap->arg & OSF1_FTRUNC) + if ((long)SCARG(uap, arg) & OSF1_FTRUNC) tmp |= O_TRUNC; - if ((long)uap->arg & OSF1_FEXCL) + if ((long)SCARG(uap, arg) & OSF1_FEXCL) tmp |= O_EXCL; - if ((long)uap->arg & OSF1_FNDELAY) + if ((long)SCARG(uap, arg) & OSF1_FNDELAY) tmp |= FNDELAY; - if ((long)uap->arg & OSF1_FSYNC) + if ((long)SCARG(uap, arg) & OSF1_FSYNC) tmp |= FFSYNC; - a.arg = tmp; + SCARG(&a, arg) = tmp; error = fcntl(td, &a); break; @@ -892,42 +892,42 @@ osf1_fcntl(td, uap) long tmp; int error; - a.fd = uap->fd; + SCARG(&a, fd) = SCARG(uap, fd); - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case OSF1_F_DUPFD: - a.cmd = F_DUPFD; - a.arg = (long)uap->arg; + SCARG(&a, cmd) = F_DUPFD; + SCARG(&a, arg) = (long)SCARG(uap, arg); break; case OSF1_F_GETFD: - a.cmd = F_GETFD; - a.arg = (long)uap->arg; + SCARG(&a, cmd) = F_GETFD; + SCARG(&a, arg) = (long)SCARG(uap, arg); break; case OSF1_F_SETFD: - a.cmd = F_SETFD; - a.arg = (long)uap->arg; + SCARG(&a, cmd) = F_SETFD; + SCARG(&a, arg) = (long)SCARG(uap, arg); break; case OSF1_F_GETFL: - a.cmd = F_GETFL; - a.arg = (long)uap->arg; /* ignored */ + SCARG(&a, cmd) = F_GETFL; + SCARG(&a, arg) = (long)SCARG(uap, arg); /* ignored */ break; case OSF1_F_SETFL: - a.cmd = F_SETFL; + SCARG(&a, cmd) = F_SETFL; tmp = 0; - if ((long)uap->arg & OSF1_FAPPEND) + if ((long)SCARG(uap, arg) & OSF1_FAPPEND) tmp |= FAPPEND; - if ((long)uap->arg & OSF1_FNONBLOCK) + if ((long)SCARG(uap, arg) & OSF1_FNONBLOCK) tmp |= FNONBLOCK; - if ((long)uap->arg & OSF1_FASYNC) + if ((long)SCARG(uap, arg) & OSF1_FASYNC) tmp |= FASYNC; - if ((long)uap->arg & OSF1_FSYNC) + if ((long)SCARG(uap, arg) & OSF1_FSYNC) tmp |= FFSYNC; - a.arg = tmp; + SCARG(&a, arg) = tmp; break; default: /* XXX other cases */ @@ -939,7 +939,7 @@ osf1_fcntl(td, uap) if (error) return error; - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case OSF1_F_GETFL: /* XXX */ break; @@ -956,12 +956,12 @@ osf1_socket(td, uap) { struct socket_args a; - if (uap->type > AF_LINK) + if (SCARG(uap, type) > AF_LINK) return (EINVAL); /* XXX After AF_LINK, divergence. */ - a.domain = uap->domain; - a.type = uap->type; - a.protocol = uap->protocol; + SCARG(&a, domain) = SCARG(uap, domain); + SCARG(&a, type) = SCARG(uap, type); + SCARG(&a, protocol) = SCARG(uap, protocol); return socket(td, &a); } @@ -974,15 +974,15 @@ osf1_sendto(td, uap) { struct sendto_args a; - if (uap->flags & ~0x7f) /* unsupported flags */ + if (SCARG(uap, flags) & ~0x7f) /* unsupported flags */ return (EINVAL); - a.s = uap->s; - a.buf = uap->buf; - a.len = uap->len; - a.flags = uap->flags; - a.to = (caddr_t)uap->to; - a.tolen = uap->tolen; + SCARG(&a, s) = SCARG(uap, s); + SCARG(&a, buf) = SCARG(uap, buf); + SCARG(&a, len) = SCARG(uap, len); + SCARG(&a, flags) = SCARG(uap, flags); + SCARG(&a, to) = (caddr_t)SCARG(uap, to); + SCARG(&a, tolen) = SCARG(uap, tolen); return sendto(td, &a); } @@ -995,24 +995,24 @@ osf1_reboot(td, uap) { struct reboot_args a; - if (uap->opt & ~OSF1_RB_ALLFLAGS && - uap->opt & (OSF1_RB_ALTBOOT|OSF1_RB_UNIPROC)) + if (SCARG(uap, opt) & ~OSF1_RB_ALLFLAGS && + SCARG(uap, opt) & (OSF1_RB_ALTBOOT|OSF1_RB_UNIPROC)) return (EINVAL); - a.opt = 0; - - if (uap->opt & OSF1_RB_ASKNAME) - a.opt |= RB_ASKNAME; - if (uap->opt & OSF1_RB_SINGLE) - a.opt |= RB_SINGLE; - if (uap->opt & OSF1_RB_NOSYNC) - a.opt |= RB_NOSYNC; - if (uap->opt & OSF1_RB_HALT) - a.opt |= RB_HALT; - if (uap->opt & OSF1_RB_INITNAME) - a.opt |= RB_INITNAME; - if (uap->opt & OSF1_RB_DFLTROOT) - a.opt |= RB_DFLTROOT; + SCARG(&a, opt) = 0; + + if (SCARG(uap, opt) & OSF1_RB_ASKNAME) + SCARG(&a, opt) |= RB_ASKNAME; + if (SCARG(uap, opt) & OSF1_RB_SINGLE) + SCARG(&a, opt) |= RB_SINGLE; + if (SCARG(uap, opt) & OSF1_RB_NOSYNC) + SCARG(&a, opt) |= RB_NOSYNC; + if (SCARG(uap, opt) & OSF1_RB_HALT) + SCARG(&a, opt) |= RB_HALT; + if (SCARG(uap, opt) & OSF1_RB_INITNAME) + SCARG(&a, opt) |= RB_INITNAME; + if (SCARG(uap, opt) & OSF1_RB_DFLTROOT) + SCARG(&a, opt) |= RB_DFLTROOT; return reboot(td, &a); } @@ -1025,10 +1025,10 @@ osf1_lseek(td, uap) { struct lseek_args a; - a.fd = uap->fd; - a.pad = 0; - a.offset = uap->offset; - a.whence = uap->whence; + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, pad) = 0; + SCARG(&a, offset) = SCARG(uap, offset); + SCARG(&a, whence) = SCARG(uap, whence); return lseek(td, &a); } @@ -1060,7 +1060,7 @@ osf1_setuid(td, uap) struct ucred *newcred, *oldcred; p = td->td_proc; - uid = uap->uid; + uid = SCARG(uap, uid); newcred = crget(); uip = uifind(uid); PROC_LOCK(p); @@ -1115,7 +1115,7 @@ osf1_setgid(td, uap) struct ucred *newcred, *oldcred; p = td->td_proc; - gid = uap->gid; + gid = SCARG(uap, gid); newcred = crget(); PROC_LOCK(p); oldcred = p->p_ucred; @@ -1175,28 +1175,28 @@ osf1_readv(td, uap) sg = stackgap_init(); - if (uap->iovcnt > (STACKGAPLEN / sizeof (struct iovec))) + if (SCARG(uap, iovcnt) > (STACKGAPLEN / sizeof (struct iovec))) return (EINVAL); - osize = uap->iovcnt * sizeof (struct osf1_iovec); - nsize = uap->iovcnt * sizeof (struct iovec); + osize = SCARG(uap, iovcnt) * sizeof (struct osf1_iovec); + nsize = SCARG(uap, iovcnt) * sizeof (struct iovec); oio = malloc(osize, M_TEMP, M_WAITOK); nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; - if ((error = copyin(uap->iovp, oio, osize))) + if ((error = copyin(SCARG(uap, iovp), oio, osize))) goto punt; - for (i = 0; i < uap->iovcnt; i++) { + for (i = 0; i < SCARG(uap, iovcnt); i++) { nio[i].iov_base = oio[i].iov_base; nio[i].iov_len = oio[i].iov_len; } - a.fd = uap->fd; - a.iovp = stackgap_alloc(&sg, nsize); - a.iovcnt = uap->iovcnt; + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, iovp) = stackgap_alloc(&sg, nsize); + SCARG(&a, iovcnt) = SCARG(uap, iovcnt); - if ((error = copyout(nio, (caddr_t)a.iovp, nsize))) + if ((error = copyout(nio, (caddr_t)SCARG(&a, iovp), nsize))) goto punt; error = readv(td, &a); @@ -1224,28 +1224,28 @@ osf1_writev(td, uap) sg = stackgap_init(); - if (uap->iovcnt > (STACKGAPLEN / sizeof (struct iovec))) + if (SCARG(uap, iovcnt) > (STACKGAPLEN / sizeof (struct iovec))) return (EINVAL); - osize = uap->iovcnt * sizeof (struct osf1_iovec); - nsize = uap->iovcnt * sizeof (struct iovec); + osize = SCARG(uap, iovcnt) * sizeof (struct osf1_iovec); + nsize = SCARG(uap, iovcnt) * sizeof (struct iovec); oio = malloc(osize, M_TEMP, M_WAITOK); nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; - if ((error = copyin(uap->iovp, oio, osize))) + if ((error = copyin(SCARG(uap, iovp), oio, osize))) goto punt; - for (i = 0; i < uap->iovcnt; i++) { + for (i = 0; i < SCARG(uap, iovcnt); i++) { nio[i].iov_base = oio[i].iov_base; nio[i].iov_len = oio[i].iov_len; } - a.fd = uap->fd; - a.iovp = stackgap_alloc(&sg, nsize); - a.iovcnt = uap->iovcnt; + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, iovp) = stackgap_alloc(&sg, nsize); + SCARG(&a, iovcnt) = SCARG(uap, iovcnt); - if ((error = copyout(nio, (caddr_t)a.iovp, nsize))) + if ((error = copyout(nio, (caddr_t)SCARG(&a, iovp), nsize))) goto punt; error = writev(td, &a); @@ -1270,9 +1270,9 @@ osf1_truncate(td, uap) sg = stackgap_init(); CHECKALTEXIST(td, &sg, uap->path); - a.path = uap->path; - a.pad = 0; - a.length = uap->length; + SCARG(&a, path) = SCARG(uap, path); + SCARG(&a, pad) = 0; + SCARG(&a, length) = SCARG(uap, length); return truncate(td, &a); } @@ -1285,9 +1285,9 @@ osf1_ftruncate(td, uap) { struct ftruncate_args a; - a.fd = uap->fd; - a.pad = 0; - a.length = uap->length; + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, pad) = 0; + SCARG(&a, length) = SCARG(uap, length); return ftruncate(td, &a); } @@ -1400,11 +1400,11 @@ osf1_wait4(td, uap) struct osf1_rusage *orusage, oru; struct rusage *rusage = NULL, ru; - orusage = uap->rusage; + orusage = SCARG(uap, rusage); if (orusage) { sg = stackgap_init(); rusage = stackgap_alloc(&sg, sizeof(struct rusage)); - uap->rusage = (struct osf1_rusage *)rusage; + SCARG(uap, rusage) = (struct osf1_rusage *)rusage; } if ((error = wait4(td, (struct wait_args *)uap))) return error; @@ -1439,11 +1439,11 @@ osf1_execve(td, uap) struct execve_args ap; sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->path); + CHECKALTEXIST(td, &sg, SCARG(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); } @@ -1458,7 +1458,7 @@ osf1_usleep_thread(td, uap) struct osf1_timeval time; struct timeval difftv, endtv, sleeptv, tv; - if ((error = copyin(uap->sleep, &time, sizeof time))) + if ((error = copyin(SCARG(uap, sleep), &time, sizeof time))) return (error); sleeptv.tv_sec = (u_long)time.tv_sec; @@ -1478,7 +1478,7 @@ osf1_usleep_thread(td, uap) tsleep(td, PUSER|PCATCH, "OSF/1", timo); - if (uap->slept != NULL) { + if (SCARG(uap, slept) != NULL) { s = splclock(); microtime(&endtv); timersub(&time, &endtv, &difftv); @@ -1486,7 +1486,7 @@ osf1_usleep_thread(td, uap) if (tv.tv_sec < 0 || tv.tv_usec < 0) tv.tv_sec = tv.tv_usec = 0; TV_CP(difftv, time) - error = copyout(&time, uap->slept, sizeof time); + error = copyout(&time, SCARG(uap, slept), sizeof time); } return (error); } diff --git a/sys/alpha/osf1/osf1_mount.c b/sys/alpha/osf1/osf1_mount.c index 9205f99..0a1347a 100644 --- a/sys/alpha/osf1/osf1_mount.c +++ b/sys/alpha/osf1/osf1_mount.c @@ -127,7 +127,7 @@ osf1_statfs(td, uap) struct osf1_statfs osfs; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd))) return (error); mp = nd.ni_vp->v_mount; @@ -142,8 +142,8 @@ osf1_statfs(td, uap) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; bsd2osf_statfs(sp, &osfs); - return copyout(&osfs, uap->buf, min(sizeof osfs, - uap->len)); + return copyout(&osfs, SCARG(uap, buf), min(sizeof osfs, + SCARG(uap, len))); } int @@ -157,7 +157,7 @@ osf1_fstatfs(td, uap) struct statfs *sp; struct osf1_statfs osfs; - if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp))) + if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp))) return (error); mp = ((struct vnode *)fp->f_data)->v_mount; #ifdef MAC @@ -174,8 +174,8 @@ osf1_fstatfs(td, uap) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; bsd2osf_statfs(sp, &osfs); - return copyout(&osfs, uap->buf, min(sizeof osfs, - uap->len)); + return copyout(&osfs, SCARG(uap, buf), min(sizeof osfs, + SCARG(uap, len))); } int @@ -189,11 +189,11 @@ osf1_getfsstat(td, uap) struct statfs *sp; struct osf1_statfs osfs; - if (uap->flags & ~OSF1_GETFSSTAT_FLAGS) + if (SCARG(uap, flags) & ~OSF1_GETFSSTAT_FLAGS) return (EINVAL); - maxcount = uap->bufsize / sizeof(struct osf1_statfs); - osf_sfsp = (caddr_t)uap->buf; + maxcount = SCARG(uap, bufsize) / sizeof(struct osf1_statfs); + osf_sfsp = (caddr_t)SCARG(uap, buf); for (count = 0, mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { nmp = TAILQ_NEXT(mp, mnt_list); if (osf_sfsp && count < maxcount) { @@ -208,8 +208,8 @@ osf1_getfsstat(td, uap) * fsstat cache. OSF1_MNT_WAIT overrides * OSF1_MNT_NOWAIT. */ - if (((uap->flags & OSF1_MNT_NOWAIT) == 0 || - (uap->flags & OSF1_MNT_WAIT)) && + if (((SCARG(uap, flags) & OSF1_MNT_NOWAIT) == 0 || + (SCARG(uap, flags) & OSF1_MNT_WAIT)) && (error = VFS_STATFS(mp, sp, td))) continue; sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; @@ -236,14 +236,14 @@ osf1_unmount(td, uap) { struct unmount_args a; - a.path = uap->path; + SCARG(&a, path) = SCARG(uap, path); - if (uap->flags & ~OSF1_UNMOUNT_FLAGS) + if (SCARG(uap, flags) & ~OSF1_UNMOUNT_FLAGS) return (EINVAL); - a.flags = 0; - if ((uap->flags & OSF1_MNT_FORCE) && - (uap->flags & OSF1_MNT_NOFORCE) == 0) - a.flags |= MNT_FORCE; + SCARG(&a, flags) = 0; + if ((SCARG(uap, flags) & OSF1_MNT_FORCE) && + (SCARG(uap, flags) & OSF1_MNT_NOFORCE) == 0) + SCARG(&a, flags) |= MNT_FORCE; return unmount(td, &a); } @@ -256,13 +256,13 @@ osf1_mount(td, uap) int error; struct mount_args a; - a.path = uap->path; + SCARG(&a, path) = SCARG(uap, path); - if (uap->flags & ~OSF1_MOUNT_FLAGS) + if (SCARG(uap, flags) & ~OSF1_MOUNT_FLAGS) return (EINVAL); - a.flags = uap->flags; /* XXX - xlate */ + SCARG(&a, flags) = SCARG(uap, flags); /* XXX - xlate */ - switch (uap->type) { + switch (SCARG(uap, type)) { case OSF1_MOUNT_UFS: /* XXX */ return (EINVAL); break; @@ -319,7 +319,7 @@ osf1_mount_mfs(td, osf_argp, bsd_argp) sg = stackgap_init(); - if ((error = copyin(osf_argp->data, &osf_ma, sizeof osf_ma))) + if ((error = copyin(SCARG(osf_argp, data), &osf_ma, sizeof osf_ma))) return error; bzero(&bsd_ma, sizeof bsd_ma); @@ -328,13 +328,13 @@ osf1_mount_mfs(td, osf_argp, bsd_argp) bsd_ma.base = osf_ma.base; bsd_ma.size = osf_ma.size; - bsd_argp->data = stackgap_alloc(&sg, sizeof bsd_ma); - if ((error = copyout(&bsd_ma, bsd_argp->data, sizeof bsd_ma))) + SCARG(bsd_argp, data) = stackgap_alloc(&sg, sizeof bsd_ma); + if ((error = copyout(&bsd_ma, SCARG(bsd_argp, data), sizeof bsd_ma))) return error; len = strlen(mfs_name) + 1; - bsd_argp->type = stackgap_alloc(&sg, len); - if ((error = copyout(mfs_name, (void *)bsd_argp->type, len))) + SCARG(bsd_argp, type) = stackgap_alloc(&sg, len); + if ((error = copyout(mfs_name, (void *)SCARG(bsd_argp, type), len))) return error; #endif return 0; @@ -354,7 +354,7 @@ osf1_mount_nfs(td, osf_argp, bsd_argp) sg = stackgap_init(); - if ((error = copyin(osf_argp->data, &osf_na, sizeof osf_na))) + if ((error = copyin(SCARG(osf_argp, data), &osf_na, sizeof osf_na))) return error; bzero(&bsd_na, sizeof bsd_na); @@ -391,13 +391,13 @@ osf1_mount_nfs(td, osf_argp, bsd_argp) if (osf_na.flags & OSF1_NFSMNT_NOCONN) bsd_na.flags |= NFSMNT_NOCONN; - bsd_argp->data = stackgap_alloc(&sg, sizeof bsd_na); - if ((error = copyout(&bsd_na, bsd_argp->data, sizeof bsd_na))) + SCARG(bsd_argp, data) = stackgap_alloc(&sg, sizeof bsd_na); + if ((error = copyout(&bsd_na, SCARG(bsd_argp, data), sizeof bsd_na))) return error; len = strlen(nfs_name) + 1; - bsd_argp->type = stackgap_alloc(&sg, len); - if ((error = copyout(nfs_name, (void *)bsd_argp->type, len))) + SCARG(bsd_argp, type) = stackgap_alloc(&sg, len); + if ((error = copyout(nfs_name, (void *)SCARG(bsd_argp, type), len))) return error; return 0; diff --git a/sys/alpha/osf1/osf1_signal.c b/sys/alpha/osf1/osf1_signal.c index c5be828..b16c2c8 100644 --- a/sys/alpha/osf1/osf1_signal.c +++ b/sys/alpha/osf1/osf1_signal.c @@ -224,8 +224,8 @@ osf1_sigaction(td, uap) struct sigaction_args sa; sg = stackgap_init(); - nosa = uap->nsa; - oosa = uap->osa; + nosa = SCARG(uap, nsa); + oosa = SCARG(uap, osa); if (osf1_sigdbg && uap->sigtramp) uprintf("osf1_sigaction: trampoline handler at %p\n", uap->sigtramp); @@ -244,9 +244,9 @@ osf1_sigaction(td, uap) } else nbsa = NULL; - sa.sig = uap->signum; - sa.act = nbsa; - sa.oact = obsa; + SCARG(&sa, sig) = SCARG(uap, signum); + SCARG(&sa, act) = nbsa; + SCARG(&sa, oact) = obsa; if ((error = sigaction(td, &sa)) != 0) return error; @@ -274,8 +274,8 @@ osf1_sigaltstack(td, uap) struct sigaltstack_args sa; sg = stackgap_init(); - noss = uap->nss; - ooss = uap->oss; + noss = SCARG(uap, nss); + ooss = SCARG(uap, oss); if (ooss != NULL) obss = stackgap_alloc(&sg, sizeof(struct sigaltstack)); @@ -292,8 +292,8 @@ osf1_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; @@ -321,22 +321,22 @@ osf1_signal(td, uap) p = td->td_proc; sg = stackgap_init(); - signum = OSF1_SIGNO(uap->signum); + signum = OSF1_SIGNO(SCARG(uap, signum)); if (signum <= 0 || signum > OSF1_NSIG) { - if (OSF1_SIGCALL(uap->signum) == OSF1_SIGNAL_MASK || - OSF1_SIGCALL(uap->signum) == OSF1_SIGDEFER_MASK) + if (OSF1_SIGCALL(SCARG(uap, signum)) == OSF1_SIGNAL_MASK || + OSF1_SIGCALL(SCARG(uap, signum)) == OSF1_SIGDEFER_MASK) td->td_retval[0] = -1; return EINVAL; } - switch (OSF1_SIGCALL(uap->signum)) { + switch (OSF1_SIGCALL(SCARG(uap, signum))) { case OSF1_SIGDEFER_MASK: /* * sigset is identical to signal() except * that SIG_HOLD is allowed as * an action. */ - if ((u_long)uap->handler == OSF1_SIG_HOLD) { + if ((u_long)SCARG(uap, handler) == OSF1_SIG_HOLD) { sigset_t mask; sigset_t *bmask; struct sigprocmask_args sa; @@ -344,9 +344,9 @@ osf1_signal(td, uap) bmask = stackgap_alloc(&sg, sizeof(sigset_t)); SIGEMPTYSET(mask); SIGADDSET(mask, signum); - sa.how = SIG_BLOCK; - sa.set = bmask; - sa.oset = NULL; + SCARG(&sa, how) = SIG_BLOCK; + SCARG(&sa, set) = bmask; + SCARG(&sa, oset) = NULL; if ((error = copyout(&mask, bmask, sizeof(mask))) != 0) return (error); return sigprocmask(td, &sa); @@ -360,11 +360,11 @@ osf1_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 = uap->handler; + sa.sa_handler = SCARG(uap, handler); SIGEMPTYSET(sa.sa_mask); sa.sa_flags = 0; #if 0 @@ -394,9 +394,9 @@ osf1_signal(td, uap) bset = stackgap_alloc(&sg, sizeof(sigset_t)); SIGEMPTYSET(set); SIGADDSET(set, signum); - sa.how = SIG_BLOCK; - sa.set = bset; - sa.oset = NULL; + SCARG(&sa, how) = SIG_BLOCK; + SCARG(&sa, set) = bset; + SCARG(&sa, oset) = NULL; if ((error = copyout(&set, bset, sizeof(set))) != 0) return (error); return sigprocmask(td, &sa); @@ -411,9 +411,9 @@ osf1_signal(td, uap) bset = stackgap_alloc(&sg, sizeof(sigset_t)); SIGEMPTYSET(set); SIGADDSET(set, signum); - sa.how = SIG_UNBLOCK; - sa.set = bset; - sa.oset = NULL; + SCARG(&sa, how) = SIG_UNBLOCK; + SCARG(&sa, set) = bset; + SCARG(&sa, oset) = NULL; if ((error = copyout(&set, bset, sizeof(set))) != 0) return (error); return sigprocmask(td, &sa); @@ -426,9 +426,9 @@ osf1_signal(td, uap) 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); @@ -453,7 +453,7 @@ osf1_signal(td, uap) set = p->p_sigmask; PROC_UNLOCK(p); SIGDELSET(set, signum); - sa.sigmask = bmask; + SCARG(&sa, sigmask) = bmask; if ((error = copyout(&set, bmask, sizeof(set))) != 0) return (error); return sigsuspend(td, &sa); @@ -487,7 +487,7 @@ osf1_sigprocmask(td, uap) PROC_LOCK(p); - switch (uap->how) { + switch (SCARG(uap, how)) { case OSF1_SIG_BLOCK: SIGSETOR(p->p_sigmask, bss); SIG_CANTMASK(p->p_sigmask); @@ -532,7 +532,7 @@ osf1_sigpending(td, uap) PROC_UNLOCK(p); bsd_to_osf1_sigset(&bss, &oss); - return copyout(&oss, uap->mask, sizeof(oss)); + return copyout(&oss, SCARG(uap, mask), sizeof(oss)); } int @@ -552,9 +552,9 @@ osf1_sigsuspend(td, uap) sg = stackgap_init(); bmask = stackgap_alloc(&sg, sizeof(sigset_t)); - oss = uap->ss; + oss = SCARG(uap, ss); osf1_to_bsd_sigset(&oss, &bss); - sa.sigmask = bmask; + SCARG(&sa, sigmask) = bmask; if ((error = copyout(&bss, bmask, sizeof(bss))) != 0) return (error); return sigsuspend(td, &sa); @@ -570,8 +570,8 @@ osf1_kill(td, uap) { struct kill_args ka; - ka.pid = uap->pid; - ka.signum = uap->signum; + SCARG(&ka, pid) = SCARG(uap, pid); + SCARG(&ka, signum) = SCARG(uap, signum); return kill(td, &ka); } diff --git a/sys/alpha/osf1/osf1_util.h b/sys/alpha/osf1/osf1_util.h index 2734808..9cbbbfc 100644 --- a/sys/alpha/osf1/osf1_util.h +++ b/sys/alpha/osf1/osf1_util.h @@ -37,6 +37,11 @@ #include <sys/sysent.h> #include <sys/cdefs.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/amd64/ia32/ia32_misc.c b/sys/amd64/ia32/ia32_misc.c index 10eb642..b5dc006 100644 --- a/sys/amd64/ia32/ia32_misc.c +++ b/sys/amd64/ia32/ia32_misc.c @@ -237,11 +237,11 @@ ia32_wait4(struct thread *td, struct ia32_wait4_args *uap) struct rusage32 *rusage32, ru32; struct rusage *rusage = NULL, ru; - rusage32 = uap->rusage; + rusage32 = SCARG(uap, rusage); if (rusage32) { sg = stackgap_init(); rusage = stackgap_alloc(&sg, sizeof(struct rusage)); - uap->rusage = (struct rusage32 *)rusage; + SCARG(uap, rusage) = (struct rusage32 *)rusage; } error = wait4(td, (struct wait_args *)uap); if (error) @@ -304,13 +304,13 @@ ia32_getfsstat(struct thread *td, struct ia32_getfsstat_args *uap) struct statfs *sp = NULL, stat; int maxcount, count, i; - sp32 = uap->buf; - maxcount = uap->bufsize / sizeof(struct statfs32); + sp32 = SCARG(uap, buf); + maxcount = SCARG(uap, bufsize) / sizeof(struct statfs32); if (sp32) { sg = stackgap_init(); sp = stackgap_alloc(&sg, sizeof(struct statfs) * maxcount); - uap->buf = (struct statfs32 *)sp; + SCARG(uap, buf) = (struct statfs32 *)sp; } error = getfsstat(td, (struct getfsstat_args *) uap); if (sp32 && !error) { @@ -364,11 +364,11 @@ ia32_sigaltstack(struct thread *td, struct ia32_sigaltstack_args *uap) struct sigaltstack32 *p32, *op32, s32; struct sigaltstack *p = NULL, *op = NULL, s; - p32 = uap->ss; + p32 = SCARG(uap, ss); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct sigaltstack)); - uap->ss = (struct sigaltstack32 *)p; + SCARG(uap, ss) = (struct sigaltstack32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -379,11 +379,11 @@ ia32_sigaltstack(struct thread *td, struct ia32_sigaltstack_args *uap) if (error) return (error); } - op32 = uap->oss; + op32 = SCARG(uap, oss); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct sigaltstack)); - uap->oss = (struct sigaltstack32 *)op; + SCARG(uap, oss) = (struct sigaltstack32 *)op; } error = sigaltstack(td, (struct sigaltstack_args *) uap); if (error) @@ -411,12 +411,12 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) int count; sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->fname); - ap.fname = uap->fname; + CHECKALTEXIST(td, &sg, SCARG(uap, fname)); + SCARG(&ap, fname) = SCARG(uap, fname); - if (uap->argv) { + if (SCARG(uap, argv)) { count = 0; - p32 = uap->argv; + p32 = SCARG(uap, argv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -424,8 +424,8 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) count++; } while (arg != 0); p = stackgap_alloc(&sg, count * sizeof(char *)); - ap.argv = p; - p32 = uap->argv; + SCARG(&ap, argv) = p; + p32 = SCARG(uap, argv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -433,9 +433,9 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) *p++ = PTRIN(arg); } while (arg != 0); } - if (uap->envv) { + if (SCARG(uap, envv)) { count = 0; - p32 = uap->envv; + p32 = SCARG(uap, envv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -443,8 +443,8 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) count++; } while (arg != 0); p = stackgap_alloc(&sg, count * sizeof(char *)); - ap.envv = p; - p32 = uap->envv; + SCARG(&ap, envv) = p; + p32 = SCARG(uap, envv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -489,10 +489,10 @@ ia32_mmap_partial(struct thread *td, vm_offset_t start, vm_offset_t end, if (fd != -1) { struct pread_args r; - r.fd = fd; - r.buf = (void *) start; - r.nbyte = end - start; - r.offset = pos; + SCARG(&r, fd) = fd; + SCARG(&r, buf) = (void *) start; + SCARG(&r, nbyte) = end - start; + SCARG(&r, offset) = pos; return (pread(td, &r)); } else { while (start < end) { @@ -507,13 +507,13 @@ int ia32_mmap(struct thread *td, struct ia32_mmap_args *uap) { struct mmap_args ap; - vm_offset_t addr = (vm_offset_t) uap->addr; - vm_size_t len = uap->len; - int prot = uap->prot; - int flags = uap->flags; - int fd = uap->fd; - off_t pos = (uap->poslo - | ((off_t)uap->poshi << 32)); + vm_offset_t addr = (vm_offset_t) SCARG(uap, addr); + vm_size_t len = SCARG(uap, len); + int prot = SCARG(uap, prot); + int flags = SCARG(uap, flags); + int fd = SCARG(uap, fd); + off_t pos = (SCARG(uap, poslo) + | ((off_t)SCARG(uap, poshi) << 32)); vm_size_t pageoff; int error; @@ -562,10 +562,10 @@ ia32_mmap(struct thread *td, struct ia32_mmap_args *uap) prot, VM_PROT_ALL, 0); if (rv != KERN_SUCCESS) return (EINVAL); - r.fd = fd; - r.buf = (void *) start; - r.nbyte = end - start; - r.offset = pos; + SCARG(&r, fd) = fd; + SCARG(&r, buf) = (void *) start; + SCARG(&r, nbyte) = end - start; + SCARG(&r, offset) = pos; error = pread(td, &r); if (error) return (error); @@ -585,12 +585,12 @@ ia32_mmap(struct thread *td, struct ia32_mmap_args *uap) len = end - start; } - ap.addr = (void *) addr; - ap.len = len; - ap.prot = prot; - ap.flags = flags; - ap.fd = fd; - ap.pos = pos; + SCARG(&ap, addr) = (void *) addr; + SCARG(&ap, len) = len; + SCARG(&ap, prot) = prot; + SCARG(&ap, flags) = flags; + SCARG(&ap, fd) = fd; + SCARG(&ap, pos) = pos; return (mmap(td, &ap)); } @@ -608,11 +608,11 @@ ia32_setitimer(struct thread *td, struct ia32_setitimer_args *uap) struct itimerval32 *p32, *op32, s32; struct itimerval *p = NULL, *op = NULL, s; - p32 = uap->itv; + p32 = SCARG(uap, itv); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct itimerval)); - uap->itv = (struct itimerval32 *)p; + SCARG(uap, itv) = (struct itimerval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -622,11 +622,11 @@ ia32_setitimer(struct thread *td, struct ia32_setitimer_args *uap) if (error) return (error); } - op32 = uap->oitv; + op32 = SCARG(uap, oitv); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct itimerval)); - uap->oitv = (struct itimerval32 *)op; + SCARG(uap, oitv) = (struct itimerval32 *)op; } error = setitimer(td, (struct setitimer_args *) uap); if (error) @@ -650,11 +650,11 @@ ia32_select(struct thread *td, struct ia32_select_args *uap) struct timeval32 *p32, s32; struct timeval *p = NULL, s; - p32 = uap->tv; + p32 = SCARG(uap, tv); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->tv = (struct timeval32 *)p; + SCARG(uap, tv) = (struct timeval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -678,11 +678,11 @@ ia32_gettimeofday(struct thread *td, struct ia32_gettimeofday_args *uap) struct timeval32 *p32, s32; struct timeval *p = NULL, s; - p32 = uap->tp; + p32 = SCARG(uap, tp); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->tp = (struct timeval32 *)p; + SCARG(uap, tp) = (struct timeval32 *)p; } error = gettimeofday(td, (struct gettimeofday_args *) uap); if (error) @@ -708,11 +708,11 @@ ia32_getrusage(struct thread *td, struct ia32_getrusage_args *uap) struct rusage32 *p32, s32; struct rusage *p = NULL, s; - p32 = uap->rusage; + p32 = SCARG(uap, rusage); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct rusage)); - uap->rusage = (struct rusage32 *)p; + SCARG(uap, rusage) = (struct rusage32 *)p; } error = getrusage(td, (struct getrusage_args *) uap); if (error) @@ -763,28 +763,28 @@ ia32_readv(struct thread *td, struct ia32_readv_args *uap) sg = stackgap_init(); - if (uap->iovcnt > (STACKGAPLEN / sizeof (struct iovec))) + if (SCARG(uap, iovcnt) > (STACKGAPLEN / sizeof (struct iovec))) return (EINVAL); - osize = uap->iovcnt * sizeof (struct iovec32); - nsize = uap->iovcnt * sizeof (struct iovec); + osize = SCARG(uap, iovcnt) * sizeof (struct iovec32); + nsize = SCARG(uap, iovcnt) * sizeof (struct iovec); oio = malloc(osize, M_TEMP, M_WAITOK); nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; - if ((error = copyin(uap->iovp, oio, osize))) + if ((error = copyin(SCARG(uap, iovp), oio, osize))) goto punt; - for (i = 0; i < uap->iovcnt; i++) { + for (i = 0; i < SCARG(uap, iovcnt); i++) { nio[i].iov_base = PTRIN(oio[i].iov_base); nio[i].iov_len = oio[i].iov_len; } - a.fd = uap->fd; - a.iovp = stackgap_alloc(&sg, nsize); - a.iovcnt = uap->iovcnt; + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, iovp) = stackgap_alloc(&sg, nsize); + SCARG(&a, iovcnt) = SCARG(uap, iovcnt); - if ((error = copyout(nio, (caddr_t)a.iovp, nsize))) + if ((error = copyout(nio, (caddr_t)SCARG(&a, iovp), nsize))) goto punt; error = readv(td, &a); @@ -809,28 +809,28 @@ ia32_writev(struct thread *td, struct ia32_writev_args *uap) sg = stackgap_init(); - if (uap->iovcnt > (STACKGAPLEN / sizeof (struct iovec))) + if (SCARG(uap, iovcnt) > (STACKGAPLEN / sizeof (struct iovec))) return (EINVAL); - osize = uap->iovcnt * sizeof (struct iovec32); - nsize = uap->iovcnt * sizeof (struct iovec); + osize = SCARG(uap, iovcnt) * sizeof (struct iovec32); + nsize = SCARG(uap, iovcnt) * sizeof (struct iovec); oio = malloc(osize, M_TEMP, M_WAITOK); nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; - if ((error = copyin(uap->iovp, oio, osize))) + if ((error = copyin(SCARG(uap, iovp), oio, osize))) goto punt; - for (i = 0; i < uap->iovcnt; i++) { + for (i = 0; i < SCARG(uap, iovcnt); i++) { nio[i].iov_base = PTRIN(oio[i].iov_base); nio[i].iov_len = oio[i].iov_len; } - a.fd = uap->fd; - a.iovp = stackgap_alloc(&sg, nsize); - a.iovcnt = uap->iovcnt; + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, iovp) = stackgap_alloc(&sg, nsize); + SCARG(&a, iovcnt) = SCARG(uap, iovcnt); - if ((error = copyout(nio, (caddr_t)a.iovp, nsize))) + if ((error = copyout(nio, (caddr_t)SCARG(&a, iovp), nsize))) goto punt; error = writev(td, &a); @@ -848,11 +848,11 @@ ia32_settimeofday(struct thread *td, struct ia32_settimeofday_args *uap) struct timeval32 *p32, s32; struct timeval *p = NULL, s; - p32 = uap->tv; + p32 = SCARG(uap, tv); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->tv = (struct timeval32 *)p; + SCARG(uap, tv) = (struct timeval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -873,11 +873,11 @@ ia32_utimes(struct thread *td, struct ia32_utimes_args *uap) struct timeval32 *p32, s32[2]; struct timeval *p = NULL, s[2]; - p32 = uap->tptr; + p32 = SCARG(uap, tptr); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, 2*sizeof(struct timeval)); - uap->tptr = (struct timeval32 *)p; + SCARG(uap, tptr) = (struct timeval32 *)p; error = copyin(p32, s32, sizeof(s32)); if (error) return (error); @@ -900,11 +900,11 @@ ia32_adjtime(struct thread *td, struct ia32_adjtime_args *uap) struct timeval32 *p32, *op32, s32; struct timeval *p = NULL, *op = NULL, s; - p32 = uap->delta; + p32 = SCARG(uap, delta); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->delta = (struct timeval32 *)p; + SCARG(uap, delta) = (struct timeval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -914,11 +914,11 @@ ia32_adjtime(struct thread *td, struct ia32_adjtime_args *uap) if (error) return (error); } - op32 = uap->olddelta; + op32 = SCARG(uap, olddelta); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->olddelta = (struct timeval32 *)op; + SCARG(uap, olddelta) = (struct timeval32 *)op; } error = utimes(td, (struct utimes_args *) uap); if (error) @@ -942,11 +942,11 @@ ia32_statfs(struct thread *td, struct ia32_statfs_args *uap) struct statfs32 *p32, s32; struct statfs *p = NULL, s; - p32 = uap->buf; + p32 = SCARG(uap, buf); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct statfs)); - uap->buf = (struct statfs32 *)p; + SCARG(uap, buf) = (struct statfs32 *)p; } error = statfs(td, (struct statfs_args *) uap); if (error) @@ -969,11 +969,11 @@ ia32_fstatfs(struct thread *td, struct ia32_fstatfs_args *uap) struct statfs32 *p32, s32; struct statfs *p = NULL, s; - p32 = uap->buf; + p32 = SCARG(uap, buf); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct statfs)); - uap->buf = (struct statfs32 *)p; + SCARG(uap, buf) = (struct statfs32 *)p; } error = fstatfs(td, (struct fstatfs_args *) uap); if (error) @@ -1020,11 +1020,11 @@ ia32_pread(struct thread *td, struct ia32_pread_args *uap) { struct pread_args ap; - ap.fd = uap->fd; - ap.buf = uap->buf; - ap.nbyte = uap->nbyte; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, buf) = SCARG(uap, buf); + SCARG(&ap, nbyte) = SCARG(uap, nbyte); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); return (pread(td, &ap)); } @@ -1033,11 +1033,11 @@ ia32_pwrite(struct thread *td, struct ia32_pwrite_args *uap) { struct pwrite_args ap; - ap.fd = uap->fd; - ap.buf = uap->buf; - ap.nbyte = uap->nbyte; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, buf) = SCARG(uap, buf); + SCARG(&ap, nbyte) = SCARG(uap, nbyte); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); return (pwrite(td, &ap)); } @@ -1048,10 +1048,10 @@ ia32_lseek(struct thread *td, struct ia32_lseek_args *uap) struct lseek_args ap; off_t pos; - ap.fd = uap->fd; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); - ap.whence = uap->whence; + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); + SCARG(&ap, whence) = SCARG(uap, whence); error = lseek(td, &ap); /* Expand the quad return into two parts for eax and edx */ pos = *(off_t *)(td->td_retval); @@ -1065,9 +1065,9 @@ ia32_truncate(struct thread *td, struct ia32_truncate_args *uap) { struct truncate_args ap; - ap.path = uap->path; - ap.length = (uap->lengthlo - | ((off_t)uap->lengthhi << 32)); + SCARG(&ap, path) = SCARG(uap, path); + SCARG(&ap, length) = (SCARG(uap, lengthlo) + | ((off_t)SCARG(uap, lengthhi) << 32)); return (truncate(td, &ap)); } @@ -1076,9 +1076,9 @@ ia32_ftruncate(struct thread *td, struct ia32_ftruncate_args *uap) { struct ftruncate_args ap; - ap.fd = uap->fd; - ap.length = (uap->lengthlo - | ((off_t)uap->lengthhi << 32)); + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, length) = (SCARG(uap, lengthlo) + | ((off_t)SCARG(uap, lengthhi) << 32)); return (ftruncate(td, &ap)); } @@ -1089,14 +1089,14 @@ freebsd4_ia32_sendfile(struct thread *td, { struct freebsd4_sendfile_args ap; - ap.fd = uap->fd; - ap.s = uap->s; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); - ap.nbytes = uap->nbytes; /* XXX check */ - ap.hdtr = uap->hdtr; /* XXX check */ - ap.sbytes = uap->sbytes; /* XXX FIXME!! */ - ap.flags = uap->flags; + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, s) = SCARG(uap, s); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); + SCARG(&ap, nbytes) = SCARG(uap, nbytes); /* XXX check */ + SCARG(&ap, hdtr) = SCARG(uap, hdtr); /* XXX check */ + SCARG(&ap, sbytes) = SCARG(uap, sbytes); /* XXX FIXME!! */ + SCARG(&ap, flags) = SCARG(uap, flags); return (freebsd4_sendfile(td, &ap)); } #endif @@ -1106,14 +1106,14 @@ ia32_sendfile(struct thread *td, struct ia32_sendfile_args *uap) { struct sendfile_args ap; - ap.fd = uap->fd; - ap.s = uap->s; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); - ap.nbytes = uap->nbytes; /* XXX check */ - ap.hdtr = uap->hdtr; /* XXX check */ - ap.sbytes = uap->sbytes; /* XXX FIXME!! */ - ap.flags = uap->flags; + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, s) = SCARG(uap, s); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); + SCARG(&ap, nbytes) = SCARG(uap, nbytes); /* XXX check */ + SCARG(&ap, hdtr) = SCARG(uap, hdtr); /* XXX check */ + SCARG(&ap, sbytes) = SCARG(uap, sbytes); /* XXX FIXME!! */ + SCARG(&ap, flags) = SCARG(uap, flags); return (sendfile(td, &ap)); } @@ -1163,11 +1163,11 @@ ia32_stat(struct thread *td, struct ia32_stat_args *uap) struct stat32 *p32, s32; struct stat *p = NULL, s; - p32 = uap->ub; + p32 = SCARG(uap, ub); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct stat)); - uap->ub = (struct stat32 *)p; + SCARG(uap, ub) = (struct stat32 *)p; } error = stat(td, (struct stat_args *) uap); if (error) @@ -1190,11 +1190,11 @@ ia32_fstat(struct thread *td, struct ia32_fstat_args *uap) struct stat32 *p32, s32; struct stat *p = NULL, s; - p32 = uap->ub; + p32 = SCARG(uap, ub); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct stat)); - uap->ub = (struct stat32 *)p; + SCARG(uap, ub) = (struct stat32 *)p; } error = fstat(td, (struct fstat_args *) uap); if (error) @@ -1217,11 +1217,11 @@ ia32_lstat(struct thread *td, struct ia32_lstat_args *uap) struct stat32 *p32, s32; struct stat *p = NULL, s; - p32 = uap->ub; + p32 = SCARG(uap, ub); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct stat)); - uap->ub = (struct stat32 *)p; + SCARG(uap, ub) = (struct stat32 *)p; } error = lstat(td, (struct lstat_args *) uap); if (error) @@ -1285,11 +1285,11 @@ ia32_sigaction(struct thread *td, struct ia32_sigaction_args *uap) struct sigaction32 *p32, *op32, s32; struct sigaction *p = NULL, *op = NULL, s; - p32 = uap->act; + p32 = SCARG(uap, act); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct sigaction)); - uap->act = (struct sigaction32 *)p; + SCARG(uap, act) = (struct sigaction32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -1300,11 +1300,11 @@ ia32_sigaction(struct thread *td, struct ia32_sigaction_args *uap) if (error) return (error); } - op32 = uap->oact; + op32 = SCARG(uap, oact); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct sigaction)); - uap->oact = (struct sigaction32 *)op; + SCARG(uap, oact) = (struct sigaction32 *)op; } error = sigaction(td, (struct sigaction_args *) uap); if (error) @@ -1331,11 +1331,11 @@ ia32_xxx(struct thread *td, struct ia32_xxx_args *uap) struct yyy32 *p32, s32; struct yyy *p = NULL, s; - p32 = uap->zzz; + p32 = SCARG(uap, zzz); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct yyy)); - uap->zzz = (struct yyy32 *)p; + SCARG(uap, zzz) = (struct yyy32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); diff --git a/sys/amd64/ia32/ia32_util.h b/sys/amd64/ia32/ia32_util.h index 23f2aba..b9e0a7c 100644 --- a/sys/amd64/ia32/ia32_util.h +++ b/sys/amd64/ia32/ia32_util.h @@ -37,6 +37,11 @@ #include <sys/sysent.h> #include <sys/cdefs.h> + +#ifndef SCARG +#define SCARG(p, x) (p)->x +#endif + struct ia32_ps_strings { u_int32_t ps_argvstr; /* first of 0 or more argument strings */ int ps_nargvstr; /* the number of argument strings */ diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 10eb642..b5dc006 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -237,11 +237,11 @@ ia32_wait4(struct thread *td, struct ia32_wait4_args *uap) struct rusage32 *rusage32, ru32; struct rusage *rusage = NULL, ru; - rusage32 = uap->rusage; + rusage32 = SCARG(uap, rusage); if (rusage32) { sg = stackgap_init(); rusage = stackgap_alloc(&sg, sizeof(struct rusage)); - uap->rusage = (struct rusage32 *)rusage; + SCARG(uap, rusage) = (struct rusage32 *)rusage; } error = wait4(td, (struct wait_args *)uap); if (error) @@ -304,13 +304,13 @@ ia32_getfsstat(struct thread *td, struct ia32_getfsstat_args *uap) struct statfs *sp = NULL, stat; int maxcount, count, i; - sp32 = uap->buf; - maxcount = uap->bufsize / sizeof(struct statfs32); + sp32 = SCARG(uap, buf); + maxcount = SCARG(uap, bufsize) / sizeof(struct statfs32); if (sp32) { sg = stackgap_init(); sp = stackgap_alloc(&sg, sizeof(struct statfs) * maxcount); - uap->buf = (struct statfs32 *)sp; + SCARG(uap, buf) = (struct statfs32 *)sp; } error = getfsstat(td, (struct getfsstat_args *) uap); if (sp32 && !error) { @@ -364,11 +364,11 @@ ia32_sigaltstack(struct thread *td, struct ia32_sigaltstack_args *uap) struct sigaltstack32 *p32, *op32, s32; struct sigaltstack *p = NULL, *op = NULL, s; - p32 = uap->ss; + p32 = SCARG(uap, ss); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct sigaltstack)); - uap->ss = (struct sigaltstack32 *)p; + SCARG(uap, ss) = (struct sigaltstack32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -379,11 +379,11 @@ ia32_sigaltstack(struct thread *td, struct ia32_sigaltstack_args *uap) if (error) return (error); } - op32 = uap->oss; + op32 = SCARG(uap, oss); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct sigaltstack)); - uap->oss = (struct sigaltstack32 *)op; + SCARG(uap, oss) = (struct sigaltstack32 *)op; } error = sigaltstack(td, (struct sigaltstack_args *) uap); if (error) @@ -411,12 +411,12 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) int count; sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->fname); - ap.fname = uap->fname; + CHECKALTEXIST(td, &sg, SCARG(uap, fname)); + SCARG(&ap, fname) = SCARG(uap, fname); - if (uap->argv) { + if (SCARG(uap, argv)) { count = 0; - p32 = uap->argv; + p32 = SCARG(uap, argv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -424,8 +424,8 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) count++; } while (arg != 0); p = stackgap_alloc(&sg, count * sizeof(char *)); - ap.argv = p; - p32 = uap->argv; + SCARG(&ap, argv) = p; + p32 = SCARG(uap, argv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -433,9 +433,9 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) *p++ = PTRIN(arg); } while (arg != 0); } - if (uap->envv) { + if (SCARG(uap, envv)) { count = 0; - p32 = uap->envv; + p32 = SCARG(uap, envv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -443,8 +443,8 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) count++; } while (arg != 0); p = stackgap_alloc(&sg, count * sizeof(char *)); - ap.envv = p; - p32 = uap->envv; + SCARG(&ap, envv) = p; + p32 = SCARG(uap, envv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -489,10 +489,10 @@ ia32_mmap_partial(struct thread *td, vm_offset_t start, vm_offset_t end, if (fd != -1) { struct pread_args r; - r.fd = fd; - r.buf = (void *) start; - r.nbyte = end - start; - r.offset = pos; + SCARG(&r, fd) = fd; + SCARG(&r, buf) = (void *) start; + SCARG(&r, nbyte) = end - start; + SCARG(&r, offset) = pos; return (pread(td, &r)); } else { while (start < end) { @@ -507,13 +507,13 @@ int ia32_mmap(struct thread *td, struct ia32_mmap_args *uap) { struct mmap_args ap; - vm_offset_t addr = (vm_offset_t) uap->addr; - vm_size_t len = uap->len; - int prot = uap->prot; - int flags = uap->flags; - int fd = uap->fd; - off_t pos = (uap->poslo - | ((off_t)uap->poshi << 32)); + vm_offset_t addr = (vm_offset_t) SCARG(uap, addr); + vm_size_t len = SCARG(uap, len); + int prot = SCARG(uap, prot); + int flags = SCARG(uap, flags); + int fd = SCARG(uap, fd); + off_t pos = (SCARG(uap, poslo) + | ((off_t)SCARG(uap, poshi) << 32)); vm_size_t pageoff; int error; @@ -562,10 +562,10 @@ ia32_mmap(struct thread *td, struct ia32_mmap_args *uap) prot, VM_PROT_ALL, 0); if (rv != KERN_SUCCESS) return (EINVAL); - r.fd = fd; - r.buf = (void *) start; - r.nbyte = end - start; - r.offset = pos; + SCARG(&r, fd) = fd; + SCARG(&r, buf) = (void *) start; + SCARG(&r, nbyte) = end - start; + SCARG(&r, offset) = pos; error = pread(td, &r); if (error) return (error); @@ -585,12 +585,12 @@ ia32_mmap(struct thread *td, struct ia32_mmap_args *uap) len = end - start; } - ap.addr = (void *) addr; - ap.len = len; - ap.prot = prot; - ap.flags = flags; - ap.fd = fd; - ap.pos = pos; + SCARG(&ap, addr) = (void *) addr; + SCARG(&ap, len) = len; + SCARG(&ap, prot) = prot; + SCARG(&ap, flags) = flags; + SCARG(&ap, fd) = fd; + SCARG(&ap, pos) = pos; return (mmap(td, &ap)); } @@ -608,11 +608,11 @@ ia32_setitimer(struct thread *td, struct ia32_setitimer_args *uap) struct itimerval32 *p32, *op32, s32; struct itimerval *p = NULL, *op = NULL, s; - p32 = uap->itv; + p32 = SCARG(uap, itv); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct itimerval)); - uap->itv = (struct itimerval32 *)p; + SCARG(uap, itv) = (struct itimerval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -622,11 +622,11 @@ ia32_setitimer(struct thread *td, struct ia32_setitimer_args *uap) if (error) return (error); } - op32 = uap->oitv; + op32 = SCARG(uap, oitv); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct itimerval)); - uap->oitv = (struct itimerval32 *)op; + SCARG(uap, oitv) = (struct itimerval32 *)op; } error = setitimer(td, (struct setitimer_args *) uap); if (error) @@ -650,11 +650,11 @@ ia32_select(struct thread *td, struct ia32_select_args *uap) struct timeval32 *p32, s32; struct timeval *p = NULL, s; - p32 = uap->tv; + p32 = SCARG(uap, tv); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->tv = (struct timeval32 *)p; + SCARG(uap, tv) = (struct timeval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -678,11 +678,11 @@ ia32_gettimeofday(struct thread *td, struct ia32_gettimeofday_args *uap) struct timeval32 *p32, s32; struct timeval *p = NULL, s; - p32 = uap->tp; + p32 = SCARG(uap, tp); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->tp = (struct timeval32 *)p; + SCARG(uap, tp) = (struct timeval32 *)p; } error = gettimeofday(td, (struct gettimeofday_args *) uap); if (error) @@ -708,11 +708,11 @@ ia32_getrusage(struct thread *td, struct ia32_getrusage_args *uap) struct rusage32 *p32, s32; struct rusage *p = NULL, s; - p32 = uap->rusage; + p32 = SCARG(uap, rusage); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct rusage)); - uap->rusage = (struct rusage32 *)p; + SCARG(uap, rusage) = (struct rusage32 *)p; } error = getrusage(td, (struct getrusage_args *) uap); if (error) @@ -763,28 +763,28 @@ ia32_readv(struct thread *td, struct ia32_readv_args *uap) sg = stackgap_init(); - if (uap->iovcnt > (STACKGAPLEN / sizeof (struct iovec))) + if (SCARG(uap, iovcnt) > (STACKGAPLEN / sizeof (struct iovec))) return (EINVAL); - osize = uap->iovcnt * sizeof (struct iovec32); - nsize = uap->iovcnt * sizeof (struct iovec); + osize = SCARG(uap, iovcnt) * sizeof (struct iovec32); + nsize = SCARG(uap, iovcnt) * sizeof (struct iovec); oio = malloc(osize, M_TEMP, M_WAITOK); nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; - if ((error = copyin(uap->iovp, oio, osize))) + if ((error = copyin(SCARG(uap, iovp), oio, osize))) goto punt; - for (i = 0; i < uap->iovcnt; i++) { + for (i = 0; i < SCARG(uap, iovcnt); i++) { nio[i].iov_base = PTRIN(oio[i].iov_base); nio[i].iov_len = oio[i].iov_len; } - a.fd = uap->fd; - a.iovp = stackgap_alloc(&sg, nsize); - a.iovcnt = uap->iovcnt; + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, iovp) = stackgap_alloc(&sg, nsize); + SCARG(&a, iovcnt) = SCARG(uap, iovcnt); - if ((error = copyout(nio, (caddr_t)a.iovp, nsize))) + if ((error = copyout(nio, (caddr_t)SCARG(&a, iovp), nsize))) goto punt; error = readv(td, &a); @@ -809,28 +809,28 @@ ia32_writev(struct thread *td, struct ia32_writev_args *uap) sg = stackgap_init(); - if (uap->iovcnt > (STACKGAPLEN / sizeof (struct iovec))) + if (SCARG(uap, iovcnt) > (STACKGAPLEN / sizeof (struct iovec))) return (EINVAL); - osize = uap->iovcnt * sizeof (struct iovec32); - nsize = uap->iovcnt * sizeof (struct iovec); + osize = SCARG(uap, iovcnt) * sizeof (struct iovec32); + nsize = SCARG(uap, iovcnt) * sizeof (struct iovec); oio = malloc(osize, M_TEMP, M_WAITOK); nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; - if ((error = copyin(uap->iovp, oio, osize))) + if ((error = copyin(SCARG(uap, iovp), oio, osize))) goto punt; - for (i = 0; i < uap->iovcnt; i++) { + for (i = 0; i < SCARG(uap, iovcnt); i++) { nio[i].iov_base = PTRIN(oio[i].iov_base); nio[i].iov_len = oio[i].iov_len; } - a.fd = uap->fd; - a.iovp = stackgap_alloc(&sg, nsize); - a.iovcnt = uap->iovcnt; + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, iovp) = stackgap_alloc(&sg, nsize); + SCARG(&a, iovcnt) = SCARG(uap, iovcnt); - if ((error = copyout(nio, (caddr_t)a.iovp, nsize))) + if ((error = copyout(nio, (caddr_t)SCARG(&a, iovp), nsize))) goto punt; error = writev(td, &a); @@ -848,11 +848,11 @@ ia32_settimeofday(struct thread *td, struct ia32_settimeofday_args *uap) struct timeval32 *p32, s32; struct timeval *p = NULL, s; - p32 = uap->tv; + p32 = SCARG(uap, tv); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->tv = (struct timeval32 *)p; + SCARG(uap, tv) = (struct timeval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -873,11 +873,11 @@ ia32_utimes(struct thread *td, struct ia32_utimes_args *uap) struct timeval32 *p32, s32[2]; struct timeval *p = NULL, s[2]; - p32 = uap->tptr; + p32 = SCARG(uap, tptr); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, 2*sizeof(struct timeval)); - uap->tptr = (struct timeval32 *)p; + SCARG(uap, tptr) = (struct timeval32 *)p; error = copyin(p32, s32, sizeof(s32)); if (error) return (error); @@ -900,11 +900,11 @@ ia32_adjtime(struct thread *td, struct ia32_adjtime_args *uap) struct timeval32 *p32, *op32, s32; struct timeval *p = NULL, *op = NULL, s; - p32 = uap->delta; + p32 = SCARG(uap, delta); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->delta = (struct timeval32 *)p; + SCARG(uap, delta) = (struct timeval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -914,11 +914,11 @@ ia32_adjtime(struct thread *td, struct ia32_adjtime_args *uap) if (error) return (error); } - op32 = uap->olddelta; + op32 = SCARG(uap, olddelta); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->olddelta = (struct timeval32 *)op; + SCARG(uap, olddelta) = (struct timeval32 *)op; } error = utimes(td, (struct utimes_args *) uap); if (error) @@ -942,11 +942,11 @@ ia32_statfs(struct thread *td, struct ia32_statfs_args *uap) struct statfs32 *p32, s32; struct statfs *p = NULL, s; - p32 = uap->buf; + p32 = SCARG(uap, buf); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct statfs)); - uap->buf = (struct statfs32 *)p; + SCARG(uap, buf) = (struct statfs32 *)p; } error = statfs(td, (struct statfs_args *) uap); if (error) @@ -969,11 +969,11 @@ ia32_fstatfs(struct thread *td, struct ia32_fstatfs_args *uap) struct statfs32 *p32, s32; struct statfs *p = NULL, s; - p32 = uap->buf; + p32 = SCARG(uap, buf); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct statfs)); - uap->buf = (struct statfs32 *)p; + SCARG(uap, buf) = (struct statfs32 *)p; } error = fstatfs(td, (struct fstatfs_args *) uap); if (error) @@ -1020,11 +1020,11 @@ ia32_pread(struct thread *td, struct ia32_pread_args *uap) { struct pread_args ap; - ap.fd = uap->fd; - ap.buf = uap->buf; - ap.nbyte = uap->nbyte; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, buf) = SCARG(uap, buf); + SCARG(&ap, nbyte) = SCARG(uap, nbyte); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); return (pread(td, &ap)); } @@ -1033,11 +1033,11 @@ ia32_pwrite(struct thread *td, struct ia32_pwrite_args *uap) { struct pwrite_args ap; - ap.fd = uap->fd; - ap.buf = uap->buf; - ap.nbyte = uap->nbyte; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, buf) = SCARG(uap, buf); + SCARG(&ap, nbyte) = SCARG(uap, nbyte); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); return (pwrite(td, &ap)); } @@ -1048,10 +1048,10 @@ ia32_lseek(struct thread *td, struct ia32_lseek_args *uap) struct lseek_args ap; off_t pos; - ap.fd = uap->fd; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); - ap.whence = uap->whence; + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); + SCARG(&ap, whence) = SCARG(uap, whence); error = lseek(td, &ap); /* Expand the quad return into two parts for eax and edx */ pos = *(off_t *)(td->td_retval); @@ -1065,9 +1065,9 @@ ia32_truncate(struct thread *td, struct ia32_truncate_args *uap) { struct truncate_args ap; - ap.path = uap->path; - ap.length = (uap->lengthlo - | ((off_t)uap->lengthhi << 32)); + SCARG(&ap, path) = SCARG(uap, path); + SCARG(&ap, length) = (SCARG(uap, lengthlo) + | ((off_t)SCARG(uap, lengthhi) << 32)); return (truncate(td, &ap)); } @@ -1076,9 +1076,9 @@ ia32_ftruncate(struct thread *td, struct ia32_ftruncate_args *uap) { struct ftruncate_args ap; - ap.fd = uap->fd; - ap.length = (uap->lengthlo - | ((off_t)uap->lengthhi << 32)); + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, length) = (SCARG(uap, lengthlo) + | ((off_t)SCARG(uap, lengthhi) << 32)); return (ftruncate(td, &ap)); } @@ -1089,14 +1089,14 @@ freebsd4_ia32_sendfile(struct thread *td, { struct freebsd4_sendfile_args ap; - ap.fd = uap->fd; - ap.s = uap->s; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); - ap.nbytes = uap->nbytes; /* XXX check */ - ap.hdtr = uap->hdtr; /* XXX check */ - ap.sbytes = uap->sbytes; /* XXX FIXME!! */ - ap.flags = uap->flags; + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, s) = SCARG(uap, s); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); + SCARG(&ap, nbytes) = SCARG(uap, nbytes); /* XXX check */ + SCARG(&ap, hdtr) = SCARG(uap, hdtr); /* XXX check */ + SCARG(&ap, sbytes) = SCARG(uap, sbytes); /* XXX FIXME!! */ + SCARG(&ap, flags) = SCARG(uap, flags); return (freebsd4_sendfile(td, &ap)); } #endif @@ -1106,14 +1106,14 @@ ia32_sendfile(struct thread *td, struct ia32_sendfile_args *uap) { struct sendfile_args ap; - ap.fd = uap->fd; - ap.s = uap->s; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); - ap.nbytes = uap->nbytes; /* XXX check */ - ap.hdtr = uap->hdtr; /* XXX check */ - ap.sbytes = uap->sbytes; /* XXX FIXME!! */ - ap.flags = uap->flags; + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, s) = SCARG(uap, s); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); + SCARG(&ap, nbytes) = SCARG(uap, nbytes); /* XXX check */ + SCARG(&ap, hdtr) = SCARG(uap, hdtr); /* XXX check */ + SCARG(&ap, sbytes) = SCARG(uap, sbytes); /* XXX FIXME!! */ + SCARG(&ap, flags) = SCARG(uap, flags); return (sendfile(td, &ap)); } @@ -1163,11 +1163,11 @@ ia32_stat(struct thread *td, struct ia32_stat_args *uap) struct stat32 *p32, s32; struct stat *p = NULL, s; - p32 = uap->ub; + p32 = SCARG(uap, ub); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct stat)); - uap->ub = (struct stat32 *)p; + SCARG(uap, ub) = (struct stat32 *)p; } error = stat(td, (struct stat_args *) uap); if (error) @@ -1190,11 +1190,11 @@ ia32_fstat(struct thread *td, struct ia32_fstat_args *uap) struct stat32 *p32, s32; struct stat *p = NULL, s; - p32 = uap->ub; + p32 = SCARG(uap, ub); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct stat)); - uap->ub = (struct stat32 *)p; + SCARG(uap, ub) = (struct stat32 *)p; } error = fstat(td, (struct fstat_args *) uap); if (error) @@ -1217,11 +1217,11 @@ ia32_lstat(struct thread *td, struct ia32_lstat_args *uap) struct stat32 *p32, s32; struct stat *p = NULL, s; - p32 = uap->ub; + p32 = SCARG(uap, ub); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct stat)); - uap->ub = (struct stat32 *)p; + SCARG(uap, ub) = (struct stat32 *)p; } error = lstat(td, (struct lstat_args *) uap); if (error) @@ -1285,11 +1285,11 @@ ia32_sigaction(struct thread *td, struct ia32_sigaction_args *uap) struct sigaction32 *p32, *op32, s32; struct sigaction *p = NULL, *op = NULL, s; - p32 = uap->act; + p32 = SCARG(uap, act); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct sigaction)); - uap->act = (struct sigaction32 *)p; + SCARG(uap, act) = (struct sigaction32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -1300,11 +1300,11 @@ ia32_sigaction(struct thread *td, struct ia32_sigaction_args *uap) if (error) return (error); } - op32 = uap->oact; + op32 = SCARG(uap, oact); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct sigaction)); - uap->oact = (struct sigaction32 *)op; + SCARG(uap, oact) = (struct sigaction32 *)op; } error = sigaction(td, (struct sigaction_args *) uap); if (error) @@ -1331,11 +1331,11 @@ ia32_xxx(struct thread *td, struct ia32_xxx_args *uap) struct yyy32 *p32, s32; struct yyy *p = NULL, s; - p32 = uap->zzz; + p32 = SCARG(uap, zzz); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct yyy)); - uap->zzz = (struct yyy32 *)p; + SCARG(uap, zzz) = (struct yyy32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); diff --git a/sys/compat/freebsd32/freebsd32_util.h b/sys/compat/freebsd32/freebsd32_util.h index 23f2aba..b9e0a7c 100644 --- a/sys/compat/freebsd32/freebsd32_util.h +++ b/sys/compat/freebsd32/freebsd32_util.h @@ -37,6 +37,11 @@ #include <sys/sysent.h> #include <sys/cdefs.h> + +#ifndef SCARG +#define SCARG(p, x) (p)->x +#endif + struct ia32_ps_strings { u_int32_t ps_argvstr; /* first of 0 or more argument strings */ int ps_nargvstr; /* the number of argument strings */ diff --git a/sys/compat/ia32/ia32_util.h b/sys/compat/ia32/ia32_util.h index 23f2aba..b9e0a7c 100644 --- a/sys/compat/ia32/ia32_util.h +++ b/sys/compat/ia32/ia32_util.h @@ -37,6 +37,11 @@ #include <sys/sysent.h> #include <sys/cdefs.h> + +#ifndef SCARG +#define SCARG(p, x) (p)->x +#endif + struct ia32_ps_strings { u_int32_t ps_argvstr; /* first of 0 or more argument strings */ int ps_nargvstr; /* the number of argument strings */ 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); diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index 66ea3fe..41adb1a 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -315,9 +315,9 @@ svr4_ptm_alloc(td) register_t fd = -1; int error; - oa.path = path; - oa.flags = O_RDWR; - oa.mode = 0; + SCARG(&oa, path) = path; + SCARG(&oa, flags) = O_RDWR; + SCARG(&oa, mode) = 0; while (fd == -1) { ptyname[8] = ttyletters[l]; 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"); diff --git a/sys/ia64/ia32/ia32_misc.c b/sys/ia64/ia32/ia32_misc.c index 10eb642..b5dc006 100644 --- a/sys/ia64/ia32/ia32_misc.c +++ b/sys/ia64/ia32/ia32_misc.c @@ -237,11 +237,11 @@ ia32_wait4(struct thread *td, struct ia32_wait4_args *uap) struct rusage32 *rusage32, ru32; struct rusage *rusage = NULL, ru; - rusage32 = uap->rusage; + rusage32 = SCARG(uap, rusage); if (rusage32) { sg = stackgap_init(); rusage = stackgap_alloc(&sg, sizeof(struct rusage)); - uap->rusage = (struct rusage32 *)rusage; + SCARG(uap, rusage) = (struct rusage32 *)rusage; } error = wait4(td, (struct wait_args *)uap); if (error) @@ -304,13 +304,13 @@ ia32_getfsstat(struct thread *td, struct ia32_getfsstat_args *uap) struct statfs *sp = NULL, stat; int maxcount, count, i; - sp32 = uap->buf; - maxcount = uap->bufsize / sizeof(struct statfs32); + sp32 = SCARG(uap, buf); + maxcount = SCARG(uap, bufsize) / sizeof(struct statfs32); if (sp32) { sg = stackgap_init(); sp = stackgap_alloc(&sg, sizeof(struct statfs) * maxcount); - uap->buf = (struct statfs32 *)sp; + SCARG(uap, buf) = (struct statfs32 *)sp; } error = getfsstat(td, (struct getfsstat_args *) uap); if (sp32 && !error) { @@ -364,11 +364,11 @@ ia32_sigaltstack(struct thread *td, struct ia32_sigaltstack_args *uap) struct sigaltstack32 *p32, *op32, s32; struct sigaltstack *p = NULL, *op = NULL, s; - p32 = uap->ss; + p32 = SCARG(uap, ss); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct sigaltstack)); - uap->ss = (struct sigaltstack32 *)p; + SCARG(uap, ss) = (struct sigaltstack32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -379,11 +379,11 @@ ia32_sigaltstack(struct thread *td, struct ia32_sigaltstack_args *uap) if (error) return (error); } - op32 = uap->oss; + op32 = SCARG(uap, oss); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct sigaltstack)); - uap->oss = (struct sigaltstack32 *)op; + SCARG(uap, oss) = (struct sigaltstack32 *)op; } error = sigaltstack(td, (struct sigaltstack_args *) uap); if (error) @@ -411,12 +411,12 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) int count; sg = stackgap_init(); - CHECKALTEXIST(td, &sg, uap->fname); - ap.fname = uap->fname; + CHECKALTEXIST(td, &sg, SCARG(uap, fname)); + SCARG(&ap, fname) = SCARG(uap, fname); - if (uap->argv) { + if (SCARG(uap, argv)) { count = 0; - p32 = uap->argv; + p32 = SCARG(uap, argv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -424,8 +424,8 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) count++; } while (arg != 0); p = stackgap_alloc(&sg, count * sizeof(char *)); - ap.argv = p; - p32 = uap->argv; + SCARG(&ap, argv) = p; + p32 = SCARG(uap, argv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -433,9 +433,9 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) *p++ = PTRIN(arg); } while (arg != 0); } - if (uap->envv) { + if (SCARG(uap, envv)) { count = 0; - p32 = uap->envv; + p32 = SCARG(uap, envv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -443,8 +443,8 @@ ia32_execve(struct thread *td, struct ia32_execve_args *uap) count++; } while (arg != 0); p = stackgap_alloc(&sg, count * sizeof(char *)); - ap.envv = p; - p32 = uap->envv; + SCARG(&ap, envv) = p; + p32 = SCARG(uap, envv); do { error = copyin(p32++, &arg, sizeof(arg)); if (error) @@ -489,10 +489,10 @@ ia32_mmap_partial(struct thread *td, vm_offset_t start, vm_offset_t end, if (fd != -1) { struct pread_args r; - r.fd = fd; - r.buf = (void *) start; - r.nbyte = end - start; - r.offset = pos; + SCARG(&r, fd) = fd; + SCARG(&r, buf) = (void *) start; + SCARG(&r, nbyte) = end - start; + SCARG(&r, offset) = pos; return (pread(td, &r)); } else { while (start < end) { @@ -507,13 +507,13 @@ int ia32_mmap(struct thread *td, struct ia32_mmap_args *uap) { struct mmap_args ap; - vm_offset_t addr = (vm_offset_t) uap->addr; - vm_size_t len = uap->len; - int prot = uap->prot; - int flags = uap->flags; - int fd = uap->fd; - off_t pos = (uap->poslo - | ((off_t)uap->poshi << 32)); + vm_offset_t addr = (vm_offset_t) SCARG(uap, addr); + vm_size_t len = SCARG(uap, len); + int prot = SCARG(uap, prot); + int flags = SCARG(uap, flags); + int fd = SCARG(uap, fd); + off_t pos = (SCARG(uap, poslo) + | ((off_t)SCARG(uap, poshi) << 32)); vm_size_t pageoff; int error; @@ -562,10 +562,10 @@ ia32_mmap(struct thread *td, struct ia32_mmap_args *uap) prot, VM_PROT_ALL, 0); if (rv != KERN_SUCCESS) return (EINVAL); - r.fd = fd; - r.buf = (void *) start; - r.nbyte = end - start; - r.offset = pos; + SCARG(&r, fd) = fd; + SCARG(&r, buf) = (void *) start; + SCARG(&r, nbyte) = end - start; + SCARG(&r, offset) = pos; error = pread(td, &r); if (error) return (error); @@ -585,12 +585,12 @@ ia32_mmap(struct thread *td, struct ia32_mmap_args *uap) len = end - start; } - ap.addr = (void *) addr; - ap.len = len; - ap.prot = prot; - ap.flags = flags; - ap.fd = fd; - ap.pos = pos; + SCARG(&ap, addr) = (void *) addr; + SCARG(&ap, len) = len; + SCARG(&ap, prot) = prot; + SCARG(&ap, flags) = flags; + SCARG(&ap, fd) = fd; + SCARG(&ap, pos) = pos; return (mmap(td, &ap)); } @@ -608,11 +608,11 @@ ia32_setitimer(struct thread *td, struct ia32_setitimer_args *uap) struct itimerval32 *p32, *op32, s32; struct itimerval *p = NULL, *op = NULL, s; - p32 = uap->itv; + p32 = SCARG(uap, itv); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct itimerval)); - uap->itv = (struct itimerval32 *)p; + SCARG(uap, itv) = (struct itimerval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -622,11 +622,11 @@ ia32_setitimer(struct thread *td, struct ia32_setitimer_args *uap) if (error) return (error); } - op32 = uap->oitv; + op32 = SCARG(uap, oitv); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct itimerval)); - uap->oitv = (struct itimerval32 *)op; + SCARG(uap, oitv) = (struct itimerval32 *)op; } error = setitimer(td, (struct setitimer_args *) uap); if (error) @@ -650,11 +650,11 @@ ia32_select(struct thread *td, struct ia32_select_args *uap) struct timeval32 *p32, s32; struct timeval *p = NULL, s; - p32 = uap->tv; + p32 = SCARG(uap, tv); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->tv = (struct timeval32 *)p; + SCARG(uap, tv) = (struct timeval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -678,11 +678,11 @@ ia32_gettimeofday(struct thread *td, struct ia32_gettimeofday_args *uap) struct timeval32 *p32, s32; struct timeval *p = NULL, s; - p32 = uap->tp; + p32 = SCARG(uap, tp); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->tp = (struct timeval32 *)p; + SCARG(uap, tp) = (struct timeval32 *)p; } error = gettimeofday(td, (struct gettimeofday_args *) uap); if (error) @@ -708,11 +708,11 @@ ia32_getrusage(struct thread *td, struct ia32_getrusage_args *uap) struct rusage32 *p32, s32; struct rusage *p = NULL, s; - p32 = uap->rusage; + p32 = SCARG(uap, rusage); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct rusage)); - uap->rusage = (struct rusage32 *)p; + SCARG(uap, rusage) = (struct rusage32 *)p; } error = getrusage(td, (struct getrusage_args *) uap); if (error) @@ -763,28 +763,28 @@ ia32_readv(struct thread *td, struct ia32_readv_args *uap) sg = stackgap_init(); - if (uap->iovcnt > (STACKGAPLEN / sizeof (struct iovec))) + if (SCARG(uap, iovcnt) > (STACKGAPLEN / sizeof (struct iovec))) return (EINVAL); - osize = uap->iovcnt * sizeof (struct iovec32); - nsize = uap->iovcnt * sizeof (struct iovec); + osize = SCARG(uap, iovcnt) * sizeof (struct iovec32); + nsize = SCARG(uap, iovcnt) * sizeof (struct iovec); oio = malloc(osize, M_TEMP, M_WAITOK); nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; - if ((error = copyin(uap->iovp, oio, osize))) + if ((error = copyin(SCARG(uap, iovp), oio, osize))) goto punt; - for (i = 0; i < uap->iovcnt; i++) { + for (i = 0; i < SCARG(uap, iovcnt); i++) { nio[i].iov_base = PTRIN(oio[i].iov_base); nio[i].iov_len = oio[i].iov_len; } - a.fd = uap->fd; - a.iovp = stackgap_alloc(&sg, nsize); - a.iovcnt = uap->iovcnt; + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, iovp) = stackgap_alloc(&sg, nsize); + SCARG(&a, iovcnt) = SCARG(uap, iovcnt); - if ((error = copyout(nio, (caddr_t)a.iovp, nsize))) + if ((error = copyout(nio, (caddr_t)SCARG(&a, iovp), nsize))) goto punt; error = readv(td, &a); @@ -809,28 +809,28 @@ ia32_writev(struct thread *td, struct ia32_writev_args *uap) sg = stackgap_init(); - if (uap->iovcnt > (STACKGAPLEN / sizeof (struct iovec))) + if (SCARG(uap, iovcnt) > (STACKGAPLEN / sizeof (struct iovec))) return (EINVAL); - osize = uap->iovcnt * sizeof (struct iovec32); - nsize = uap->iovcnt * sizeof (struct iovec); + osize = SCARG(uap, iovcnt) * sizeof (struct iovec32); + nsize = SCARG(uap, iovcnt) * sizeof (struct iovec); oio = malloc(osize, M_TEMP, M_WAITOK); nio = malloc(nsize, M_TEMP, M_WAITOK); error = 0; - if ((error = copyin(uap->iovp, oio, osize))) + if ((error = copyin(SCARG(uap, iovp), oio, osize))) goto punt; - for (i = 0; i < uap->iovcnt; i++) { + for (i = 0; i < SCARG(uap, iovcnt); i++) { nio[i].iov_base = PTRIN(oio[i].iov_base); nio[i].iov_len = oio[i].iov_len; } - a.fd = uap->fd; - a.iovp = stackgap_alloc(&sg, nsize); - a.iovcnt = uap->iovcnt; + SCARG(&a, fd) = SCARG(uap, fd); + SCARG(&a, iovp) = stackgap_alloc(&sg, nsize); + SCARG(&a, iovcnt) = SCARG(uap, iovcnt); - if ((error = copyout(nio, (caddr_t)a.iovp, nsize))) + if ((error = copyout(nio, (caddr_t)SCARG(&a, iovp), nsize))) goto punt; error = writev(td, &a); @@ -848,11 +848,11 @@ ia32_settimeofday(struct thread *td, struct ia32_settimeofday_args *uap) struct timeval32 *p32, s32; struct timeval *p = NULL, s; - p32 = uap->tv; + p32 = SCARG(uap, tv); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->tv = (struct timeval32 *)p; + SCARG(uap, tv) = (struct timeval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -873,11 +873,11 @@ ia32_utimes(struct thread *td, struct ia32_utimes_args *uap) struct timeval32 *p32, s32[2]; struct timeval *p = NULL, s[2]; - p32 = uap->tptr; + p32 = SCARG(uap, tptr); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, 2*sizeof(struct timeval)); - uap->tptr = (struct timeval32 *)p; + SCARG(uap, tptr) = (struct timeval32 *)p; error = copyin(p32, s32, sizeof(s32)); if (error) return (error); @@ -900,11 +900,11 @@ ia32_adjtime(struct thread *td, struct ia32_adjtime_args *uap) struct timeval32 *p32, *op32, s32; struct timeval *p = NULL, *op = NULL, s; - p32 = uap->delta; + p32 = SCARG(uap, delta); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->delta = (struct timeval32 *)p; + SCARG(uap, delta) = (struct timeval32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -914,11 +914,11 @@ ia32_adjtime(struct thread *td, struct ia32_adjtime_args *uap) if (error) return (error); } - op32 = uap->olddelta; + op32 = SCARG(uap, olddelta); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct timeval)); - uap->olddelta = (struct timeval32 *)op; + SCARG(uap, olddelta) = (struct timeval32 *)op; } error = utimes(td, (struct utimes_args *) uap); if (error) @@ -942,11 +942,11 @@ ia32_statfs(struct thread *td, struct ia32_statfs_args *uap) struct statfs32 *p32, s32; struct statfs *p = NULL, s; - p32 = uap->buf; + p32 = SCARG(uap, buf); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct statfs)); - uap->buf = (struct statfs32 *)p; + SCARG(uap, buf) = (struct statfs32 *)p; } error = statfs(td, (struct statfs_args *) uap); if (error) @@ -969,11 +969,11 @@ ia32_fstatfs(struct thread *td, struct ia32_fstatfs_args *uap) struct statfs32 *p32, s32; struct statfs *p = NULL, s; - p32 = uap->buf; + p32 = SCARG(uap, buf); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct statfs)); - uap->buf = (struct statfs32 *)p; + SCARG(uap, buf) = (struct statfs32 *)p; } error = fstatfs(td, (struct fstatfs_args *) uap); if (error) @@ -1020,11 +1020,11 @@ ia32_pread(struct thread *td, struct ia32_pread_args *uap) { struct pread_args ap; - ap.fd = uap->fd; - ap.buf = uap->buf; - ap.nbyte = uap->nbyte; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, buf) = SCARG(uap, buf); + SCARG(&ap, nbyte) = SCARG(uap, nbyte); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); return (pread(td, &ap)); } @@ -1033,11 +1033,11 @@ ia32_pwrite(struct thread *td, struct ia32_pwrite_args *uap) { struct pwrite_args ap; - ap.fd = uap->fd; - ap.buf = uap->buf; - ap.nbyte = uap->nbyte; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, buf) = SCARG(uap, buf); + SCARG(&ap, nbyte) = SCARG(uap, nbyte); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); return (pwrite(td, &ap)); } @@ -1048,10 +1048,10 @@ ia32_lseek(struct thread *td, struct ia32_lseek_args *uap) struct lseek_args ap; off_t pos; - ap.fd = uap->fd; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); - ap.whence = uap->whence; + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); + SCARG(&ap, whence) = SCARG(uap, whence); error = lseek(td, &ap); /* Expand the quad return into two parts for eax and edx */ pos = *(off_t *)(td->td_retval); @@ -1065,9 +1065,9 @@ ia32_truncate(struct thread *td, struct ia32_truncate_args *uap) { struct truncate_args ap; - ap.path = uap->path; - ap.length = (uap->lengthlo - | ((off_t)uap->lengthhi << 32)); + SCARG(&ap, path) = SCARG(uap, path); + SCARG(&ap, length) = (SCARG(uap, lengthlo) + | ((off_t)SCARG(uap, lengthhi) << 32)); return (truncate(td, &ap)); } @@ -1076,9 +1076,9 @@ ia32_ftruncate(struct thread *td, struct ia32_ftruncate_args *uap) { struct ftruncate_args ap; - ap.fd = uap->fd; - ap.length = (uap->lengthlo - | ((off_t)uap->lengthhi << 32)); + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, length) = (SCARG(uap, lengthlo) + | ((off_t)SCARG(uap, lengthhi) << 32)); return (ftruncate(td, &ap)); } @@ -1089,14 +1089,14 @@ freebsd4_ia32_sendfile(struct thread *td, { struct freebsd4_sendfile_args ap; - ap.fd = uap->fd; - ap.s = uap->s; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); - ap.nbytes = uap->nbytes; /* XXX check */ - ap.hdtr = uap->hdtr; /* XXX check */ - ap.sbytes = uap->sbytes; /* XXX FIXME!! */ - ap.flags = uap->flags; + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, s) = SCARG(uap, s); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); + SCARG(&ap, nbytes) = SCARG(uap, nbytes); /* XXX check */ + SCARG(&ap, hdtr) = SCARG(uap, hdtr); /* XXX check */ + SCARG(&ap, sbytes) = SCARG(uap, sbytes); /* XXX FIXME!! */ + SCARG(&ap, flags) = SCARG(uap, flags); return (freebsd4_sendfile(td, &ap)); } #endif @@ -1106,14 +1106,14 @@ ia32_sendfile(struct thread *td, struct ia32_sendfile_args *uap) { struct sendfile_args ap; - ap.fd = uap->fd; - ap.s = uap->s; - ap.offset = (uap->offsetlo - | ((off_t)uap->offsethi << 32)); - ap.nbytes = uap->nbytes; /* XXX check */ - ap.hdtr = uap->hdtr; /* XXX check */ - ap.sbytes = uap->sbytes; /* XXX FIXME!! */ - ap.flags = uap->flags; + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, s) = SCARG(uap, s); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); + SCARG(&ap, nbytes) = SCARG(uap, nbytes); /* XXX check */ + SCARG(&ap, hdtr) = SCARG(uap, hdtr); /* XXX check */ + SCARG(&ap, sbytes) = SCARG(uap, sbytes); /* XXX FIXME!! */ + SCARG(&ap, flags) = SCARG(uap, flags); return (sendfile(td, &ap)); } @@ -1163,11 +1163,11 @@ ia32_stat(struct thread *td, struct ia32_stat_args *uap) struct stat32 *p32, s32; struct stat *p = NULL, s; - p32 = uap->ub; + p32 = SCARG(uap, ub); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct stat)); - uap->ub = (struct stat32 *)p; + SCARG(uap, ub) = (struct stat32 *)p; } error = stat(td, (struct stat_args *) uap); if (error) @@ -1190,11 +1190,11 @@ ia32_fstat(struct thread *td, struct ia32_fstat_args *uap) struct stat32 *p32, s32; struct stat *p = NULL, s; - p32 = uap->ub; + p32 = SCARG(uap, ub); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct stat)); - uap->ub = (struct stat32 *)p; + SCARG(uap, ub) = (struct stat32 *)p; } error = fstat(td, (struct fstat_args *) uap); if (error) @@ -1217,11 +1217,11 @@ ia32_lstat(struct thread *td, struct ia32_lstat_args *uap) struct stat32 *p32, s32; struct stat *p = NULL, s; - p32 = uap->ub; + p32 = SCARG(uap, ub); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct stat)); - uap->ub = (struct stat32 *)p; + SCARG(uap, ub) = (struct stat32 *)p; } error = lstat(td, (struct lstat_args *) uap); if (error) @@ -1285,11 +1285,11 @@ ia32_sigaction(struct thread *td, struct ia32_sigaction_args *uap) struct sigaction32 *p32, *op32, s32; struct sigaction *p = NULL, *op = NULL, s; - p32 = uap->act; + p32 = SCARG(uap, act); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct sigaction)); - uap->act = (struct sigaction32 *)p; + SCARG(uap, act) = (struct sigaction32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); @@ -1300,11 +1300,11 @@ ia32_sigaction(struct thread *td, struct ia32_sigaction_args *uap) if (error) return (error); } - op32 = uap->oact; + op32 = SCARG(uap, oact); if (op32) { sg = stackgap_init(); op = stackgap_alloc(&sg, sizeof(struct sigaction)); - uap->oact = (struct sigaction32 *)op; + SCARG(uap, oact) = (struct sigaction32 *)op; } error = sigaction(td, (struct sigaction_args *) uap); if (error) @@ -1331,11 +1331,11 @@ ia32_xxx(struct thread *td, struct ia32_xxx_args *uap) struct yyy32 *p32, s32; struct yyy *p = NULL, s; - p32 = uap->zzz; + p32 = SCARG(uap, zzz); if (p32) { sg = stackgap_init(); p = stackgap_alloc(&sg, sizeof(struct yyy)); - uap->zzz = (struct yyy32 *)p; + SCARG(uap, zzz) = (struct yyy32 *)p; error = copyin(p32, &s32, sizeof(s32)); if (error) return (error); diff --git a/sys/ia64/ia32/ia32_util.h b/sys/ia64/ia32/ia32_util.h index 23f2aba..b9e0a7c 100644 --- a/sys/ia64/ia32/ia32_util.h +++ b/sys/ia64/ia32/ia32_util.h @@ -37,6 +37,11 @@ #include <sys/sysent.h> #include <sys/cdefs.h> + +#ifndef SCARG +#define SCARG(p, x) (p)->x +#endif + struct ia32_ps_strings { u_int32_t ps_argvstr; /* first of 0 or more argument strings */ int ps_nargvstr; /* the number of argument strings */ diff --git a/sys/ia64/ia64/sys_machdep.c b/sys/ia64/ia64/sys_machdep.c index 810b7d1..097dc02 100644 --- a/sys/ia64/ia64/sys_machdep.c +++ b/sys/ia64/ia64/sys_machdep.c @@ -70,7 +70,7 @@ sysarch(td, uap) { int error = 0; - switch(uap->op) { + switch(SCARG(uap,op)) { default: error = EINVAL; break; diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index c2554b6..9188e30 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -139,8 +139,8 @@ acct(td, uap) * If accounting is to be started to a file, open that file for * appending and make sure it's a 'normal'. */ - if (uap->path != NULL) { - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, + if (SCARG(uap, path) != NULL) { + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), td); flags = FWRITE | O_APPEND; error = vn_open(&nd, &flags, 0); @@ -187,7 +187,7 @@ acct(td, uap) crfree(acctcred != NOCRED ? acctcred : savacctcred); acctcred = savacctcred = NOCRED; } - if (uap->path == NULL) { + if (SCARG(uap, path) == NULL) { mtx_unlock(&acct_mtx); goto done2; } diff --git a/sys/kern/kern_acl.c b/sys/kern/kern_acl.c index b194454..2a182cd 100644 --- a/sys/kern/kern_acl.c +++ b/sys/kern/kern_acl.c @@ -689,11 +689,11 @@ __acl_get_file(struct thread *td, struct __acl_get_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_get_acl(td, nd.ni_vp, uap->type, - uap->aclp); + error = vacl_get_acl(td, nd.ni_vp, SCARG(uap, type), + SCARG(uap, aclp)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -712,11 +712,11 @@ __acl_set_file(struct thread *td, struct __acl_set_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_set_acl(td, nd.ni_vp, uap->type, - uap->aclp); + error = vacl_set_acl(td, nd.ni_vp, SCARG(uap, type), + SCARG(uap, aclp)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -735,10 +735,10 @@ __acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_get_acl(td, (struct vnode *)fp->f_data, - uap->type, uap->aclp); + SCARG(uap, type), SCARG(uap, aclp)); fdrop(fp, td); } mtx_unlock(&Giant); @@ -757,10 +757,10 @@ __acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_set_acl(td, (struct vnode *)fp->f_data, - uap->type, uap->aclp); + SCARG(uap, type), SCARG(uap, aclp)); fdrop(fp, td); } mtx_unlock(&Giant); @@ -779,10 +779,10 @@ __acl_delete_file(struct thread *td, struct __acl_delete_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_delete(td, nd.ni_vp, uap->type); + error = vacl_delete(td, nd.ni_vp, SCARG(uap, type)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -801,10 +801,10 @@ __acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_delete(td, (struct vnode *)fp->f_data, - uap->type); + SCARG(uap, type)); fdrop(fp, td); } mtx_unlock(&Giant); @@ -823,11 +823,11 @@ __acl_aclcheck_file(struct thread *td, struct __acl_aclcheck_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_aclcheck(td, nd.ni_vp, uap->type, - uap->aclp); + error = vacl_aclcheck(td, nd.ni_vp, SCARG(uap, type), + SCARG(uap, aclp)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -846,10 +846,10 @@ __acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_aclcheck(td, (struct vnode *)fp->f_data, - uap->type, uap->aclp); + SCARG(uap, type), SCARG(uap, aclp)); fdrop(fp, td); } mtx_unlock(&Giant); diff --git a/sys/kern/kern_environment.c b/sys/kern/kern_environment.c index 6f71739..04f00c3 100644 --- a/sys/kern/kern_environment.c +++ b/sys/kern/kern_environment.c @@ -92,7 +92,7 @@ kenv(td, uap) KASSERT(dynamic_kenv, ("kenv: dynamic_kenv = 0")); error = 0; - if (uap->what == KENV_DUMP) { + if (SCARG(uap, what) == KENV_DUMP) { #ifdef MAC error = mac_check_kenv_dump(td->td_ucred); if (error) @@ -100,7 +100,7 @@ kenv(td, uap) #endif len = 0; /* Return the size if called with a NULL buffer */ - if (uap->value == NULL) { + if (SCARG(uap, value) == NULL) { sx_slock(&kenv_lock); for (i = 0; kenvp[i] != NULL; i++) len += strlen(kenvp[i]) + 1; @@ -110,9 +110,9 @@ kenv(td, uap) } done = 0; sx_slock(&kenv_lock); - for (i = 0; kenvp[i] != NULL && done < uap->len; i++) { - len = min(strlen(kenvp[i]) + 1, uap->len - done); - error = copyout(kenvp[i], uap->value + done, + for (i = 0; kenvp[i] != NULL && done < SCARG(uap, len); i++) { + len = min(strlen(kenvp[i]) + 1, SCARG(uap, len) - done); + error = copyout(kenvp[i], SCARG(uap, value) + done, len); if (error) { sx_sunlock(&kenv_lock); @@ -124,8 +124,8 @@ kenv(td, uap) return (0); } - if ((uap->what == KENV_SET) || - (uap->what == KENV_UNSET)) { + if ((SCARG(uap, what) == KENV_SET) || + (SCARG(uap, what) == KENV_UNSET)) { error = suser(td); if (error) return (error); @@ -133,11 +133,11 @@ kenv(td, uap) name = malloc(KENV_MNAMELEN, M_TEMP, M_WAITOK); - error = copyinstr(uap->name, name, KENV_MNAMELEN, NULL); + error = copyinstr(SCARG(uap, name), name, KENV_MNAMELEN, NULL); if (error) goto done; - switch (uap->what) { + switch (SCARG(uap, what)) { case KENV_GET: #ifdef MAC error = mac_check_kenv_get(td->td_ucred, name); @@ -150,16 +150,16 @@ kenv(td, uap) goto done; } len = strlen(value) + 1; - if (len > uap->len) - len = uap->len; - error = copyout(value, uap->value, len); + if (len > SCARG(uap, len)) + len = SCARG(uap, len); + error = copyout(value, SCARG(uap, value), len); freeenv(value); if (error) goto done; td->td_retval[0] = len; break; case KENV_SET: - len = uap->len; + len = SCARG(uap, len); if (len < 1) { error = EINVAL; goto done; @@ -167,7 +167,7 @@ kenv(td, uap) if (len > KENV_MVALLEN) len = KENV_MVALLEN; value = malloc(len, M_TEMP, M_WAITOK); - error = copyinstr(uap->value, value, len, NULL); + error = copyinstr(SCARG(uap, value), value, len, NULL); if (error) { free(value, M_TEMP); goto done; diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index f387959..eab20b1 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -754,7 +754,7 @@ kldload(struct thread *td, struct kldload_args *uap) goto out; pathname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); - if ((error = copyinstr(uap->file, pathname, MAXPATHLEN, + if ((error = copyinstr(SCARG(uap, file), pathname, MAXPATHLEN, NULL)) != 0) goto out; @@ -800,7 +800,7 @@ kldunload(struct thread *td, struct kldunload_args *uap) if ((error = suser(td)) != 0) goto out; - lf = linker_find_file_by_id(uap->fileid); + lf = linker_find_file_by_id(SCARG(uap, fileid)); if (lf) { KLD_DPF(FILE, ("kldunload: lf->userrefs=%d\n", lf->userrefs)); if (lf->userrefs == 0) { @@ -841,7 +841,7 @@ kldfind(struct thread *td, struct kldfind_args *uap) td->td_retval[0] = -1; pathname = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); - if ((error = copyinstr(uap->file, pathname, MAXPATHLEN, + if ((error = copyinstr(SCARG(uap, file), pathname, MAXPATHLEN, NULL)) != 0) goto out; @@ -875,7 +875,7 @@ kldnext(struct thread *td, struct kldnext_args *uap) mtx_lock(&Giant); - if (uap->fileid == 0) { + if (SCARG(uap, fileid) == 0) { mtx_lock(&kld_mtx); if (TAILQ_FIRST(&linker_files)) td->td_retval[0] = TAILQ_FIRST(&linker_files)->id; @@ -884,7 +884,7 @@ kldnext(struct thread *td, struct kldnext_args *uap) mtx_unlock(&kld_mtx); goto out; } - lf = linker_find_file_by_id(uap->fileid); + lf = linker_find_file_by_id(SCARG(uap, fileid)); if (lf) { if (TAILQ_NEXT(lf, link)) td->td_retval[0] = TAILQ_NEXT(lf, link)->id; @@ -916,12 +916,12 @@ kldstat(struct thread *td, struct kldstat_args *uap) mtx_lock(&Giant); - lf = linker_find_file_by_id(uap->fileid); + lf = linker_find_file_by_id(SCARG(uap, fileid)); if (lf == NULL) { error = ENOENT; goto out; } - stat = uap->stat; + stat = SCARG(uap, stat); /* * Check the version of the user's structure. @@ -970,7 +970,7 @@ kldfirstmod(struct thread *td, struct kldfirstmod_args *uap) #endif mtx_lock(&Giant); - lf = linker_find_file_by_id(uap->fileid); + lf = linker_find_file_by_id(SCARG(uap, fileid)); if (lf) { MOD_SLOCK; mp = TAILQ_FIRST(&lf->modules); @@ -1006,18 +1006,18 @@ kldsym(struct thread *td, struct kldsym_args *uap) mtx_lock(&Giant); - if ((error = copyin(uap->data, &lookup, sizeof(lookup))) != 0) + if ((error = copyin(SCARG(uap, data), &lookup, sizeof(lookup))) != 0) goto out; if (lookup.version != sizeof(lookup) || - uap->cmd != KLDSYM_LOOKUP) { + SCARG(uap, cmd) != KLDSYM_LOOKUP) { error = EINVAL; goto out; } symstr = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); if ((error = copyinstr(lookup.symname, symstr, MAXPATHLEN, NULL)) != 0) goto out; - if (uap->fileid != 0) { - lf = linker_find_file_by_id(uap->fileid); + if (SCARG(uap, fileid) != 0) { + lf = linker_find_file_by_id(SCARG(uap, fileid)); if (lf == NULL) { error = ENOENT; goto out; @@ -1026,7 +1026,7 @@ kldsym(struct thread *td, struct kldsym_args *uap) LINKER_SYMBOL_VALUES(lf, sym, &symval) == 0) { lookup.symvalue = (uintptr_t) symval.value; lookup.symsize = symval.size; - error = copyout(&lookup, uap->data, + error = copyout(&lookup, SCARG(uap, data), sizeof(lookup)); } else error = ENOENT; @@ -1037,7 +1037,7 @@ kldsym(struct thread *td, struct kldsym_args *uap) LINKER_SYMBOL_VALUES(lf, sym, &symval) == 0) { lookup.symvalue = (uintptr_t)symval.value; lookup.symsize = symval.size; - error = copyout(&lookup, uap->data, + error = copyout(&lookup, SCARG(uap, data), sizeof(lookup)); break; } diff --git a/sys/kern/kern_mac.c b/sys/kern/kern_mac.c index 6542a73..257d131 100644 --- a/sys/kern/kern_mac.c +++ b/sys/kern/kern_mac.c @@ -3020,7 +3020,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) struct ucred *tcred; int error; - error = copyin(uap->mac_p, &mac, sizeof(mac)); + error = copyin(SCARG(uap, mac_p), &mac, sizeof(mac)); if (error) return (error); @@ -3203,7 +3203,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3405,7 +3405,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3583,7 +3583,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) char target[MAC_MAX_POLICY_NAME]; int error; - error = copyinstr(uap->policy, target, sizeof(target), NULL); + error = copyinstr(SCARG(uap, policy), target, sizeof(target), NULL); if (error) return (error); @@ -3593,7 +3593,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) if (strcmp(mpc->mpc_name, target) == 0 && mpc->mpc_ops->mpo_syscall != NULL) { error = mpc->mpc_ops->mpo_syscall(td, - uap->call, uap->arg); + SCARG(uap, call), SCARG(uap, arg)); goto out; } } diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c index e39f56a..74a0259 100644 --- a/sys/kern/kern_module.c +++ b/sys/kern/kern_module.c @@ -259,7 +259,7 @@ modnext(struct thread *td, struct modnext_args *uap) td->td_retval[0] = -1; MOD_SLOCK; - if (uap->modid == 0) { + if (SCARG(uap, modid) == 0) { mod = TAILQ_FIRST(&modules); if (mod) td->td_retval[0] = mod->id; @@ -267,7 +267,7 @@ modnext(struct thread *td, struct modnext_args *uap) error = ENOENT; goto done2; } - mod = module_lookupbyid(uap->modid); + mod = module_lookupbyid(SCARG(uap, modid)); if (mod == NULL) { error = ENOENT; goto done2; @@ -293,7 +293,7 @@ modfnext(struct thread *td, struct modfnext_args *uap) td->td_retval[0] = -1; MOD_SLOCK; - mod = module_lookupbyid(uap->modid); + mod = module_lookupbyid(SCARG(uap, modid)); if (mod == NULL) { error = ENOENT; } else { @@ -328,7 +328,7 @@ modstat(struct thread *td, struct modstat_args *uap) char *name; MOD_SLOCK; - mod = module_lookupbyid(uap->modid); + mod = module_lookupbyid(SCARG(uap, modid)); if (mod == NULL) { MOD_SUNLOCK; return (ENOENT); @@ -338,7 +338,7 @@ modstat(struct thread *td, struct modstat_args *uap) name = mod->name; data = mod->data; MOD_SUNLOCK; - stat = uap->stat; + stat = SCARG(uap, stat); /* * Check the version of the user's structure. @@ -380,7 +380,7 @@ modfind(struct thread *td, struct modfind_args *uap) char name[MAXMODNAME]; module_t mod; - if ((error = copyinstr(uap->name, name, sizeof name, 0)) != 0) + if ((error = copyinstr(SCARG(uap, name), name, sizeof name, 0)) != 0) return (error); MOD_SLOCK; diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 27b1fdd..865ee0a 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -159,12 +159,12 @@ clock_gettime(struct thread *td, struct clock_gettime_args *uap) { struct timespec ats; - if (uap->clock_id != CLOCK_REALTIME) + if (SCARG(uap, clock_id) != CLOCK_REALTIME) return (EINVAL); mtx_lock(&Giant); nanotime(&ats); mtx_unlock(&Giant); - return (copyout(&ats, uap->tp, sizeof(ats))); + return (copyout(&ats, SCARG(uap, tp), sizeof(ats))); } #ifndef _SYS_SYSPROTO_H_ @@ -192,9 +192,9 @@ clock_settime(struct thread *td, struct clock_settime_args *uap) #endif if ((error = suser(td)) != 0) return (error); - if (uap->clock_id != CLOCK_REALTIME) + if (SCARG(uap, clock_id) != CLOCK_REALTIME) return (EINVAL); - if ((error = copyin(uap->tp, &ats, sizeof(ats))) != 0) + if ((error = copyin(SCARG(uap, tp), &ats, sizeof(ats))) != 0) return (error); if (ats.tv_nsec < 0 || ats.tv_nsec >= 1000000000) return (EINVAL); @@ -217,10 +217,10 @@ clock_getres(struct thread *td, struct clock_getres_args *uap) struct timespec ts; int error; - if (uap->clock_id != CLOCK_REALTIME) + if (SCARG(uap, clock_id) != CLOCK_REALTIME) return (EINVAL); error = 0; - if (uap->tp) { + if (SCARG(uap, tp)) { ts.tv_sec = 0; /* * Round up the result of the division cheaply by adding 1. @@ -228,7 +228,7 @@ clock_getres(struct thread *td, struct clock_getres_args *uap) * would give 0. Perfect rounding is unimportant. */ ts.tv_nsec = 1000000000 / tc_getfrequency() + 1; - error = copyout(&ts, uap->tp, sizeof(ts)); + error = copyout(&ts, SCARG(uap, tp), sizeof(ts)); } return (error); } @@ -289,23 +289,23 @@ nanosleep(struct thread *td, struct nanosleep_args *uap) struct timespec rmt, rqt; int error; - error = copyin(uap->rqtp, &rqt, sizeof(rqt)); + error = copyin(SCARG(uap, rqtp), &rqt, sizeof(rqt)); if (error) return (error); mtx_lock(&Giant); - if (uap->rmtp) { - if (!useracc((caddr_t)uap->rmtp, sizeof(rmt), + if (SCARG(uap, rmtp)) { + if (!useracc((caddr_t)SCARG(uap, rmtp), sizeof(rmt), VM_PROT_WRITE)) { error = EFAULT; goto done2; } } error = nanosleep1(td, &rqt, &rmt); - if (error && uap->rmtp) { + if (error && SCARG(uap, rmtp)) { int error2; - error2 = copyout(&rmt, uap->rmtp, sizeof(rmt)); + error2 = copyout(&rmt, SCARG(uap, rmtp), sizeof(rmt)); if (error2) /* XXX shouldn't happen, did useracc() above */ error = error2; } diff --git a/sys/kern/subr_acl_posix1e.c b/sys/kern/subr_acl_posix1e.c index b194454..2a182cd 100644 --- a/sys/kern/subr_acl_posix1e.c +++ b/sys/kern/subr_acl_posix1e.c @@ -689,11 +689,11 @@ __acl_get_file(struct thread *td, struct __acl_get_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_get_acl(td, nd.ni_vp, uap->type, - uap->aclp); + error = vacl_get_acl(td, nd.ni_vp, SCARG(uap, type), + SCARG(uap, aclp)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -712,11 +712,11 @@ __acl_set_file(struct thread *td, struct __acl_set_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_set_acl(td, nd.ni_vp, uap->type, - uap->aclp); + error = vacl_set_acl(td, nd.ni_vp, SCARG(uap, type), + SCARG(uap, aclp)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -735,10 +735,10 @@ __acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_get_acl(td, (struct vnode *)fp->f_data, - uap->type, uap->aclp); + SCARG(uap, type), SCARG(uap, aclp)); fdrop(fp, td); } mtx_unlock(&Giant); @@ -757,10 +757,10 @@ __acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_set_acl(td, (struct vnode *)fp->f_data, - uap->type, uap->aclp); + SCARG(uap, type), SCARG(uap, aclp)); fdrop(fp, td); } mtx_unlock(&Giant); @@ -779,10 +779,10 @@ __acl_delete_file(struct thread *td, struct __acl_delete_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_delete(td, nd.ni_vp, uap->type); + error = vacl_delete(td, nd.ni_vp, SCARG(uap, type)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -801,10 +801,10 @@ __acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_delete(td, (struct vnode *)fp->f_data, - uap->type); + SCARG(uap, type)); fdrop(fp, td); } mtx_unlock(&Giant); @@ -823,11 +823,11 @@ __acl_aclcheck_file(struct thread *td, struct __acl_aclcheck_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_aclcheck(td, nd.ni_vp, uap->type, - uap->aclp); + error = vacl_aclcheck(td, nd.ni_vp, SCARG(uap, type), + SCARG(uap, aclp)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -846,10 +846,10 @@ __acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_aclcheck(td, (struct vnode *)fp->f_data, - uap->type, uap->aclp); + SCARG(uap, type), SCARG(uap, aclp)); fdrop(fp, td); } mtx_unlock(&Giant); diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index c26cf47..b74a74b 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -951,7 +951,7 @@ poll(td, uap) u_int ncoll, nfds; size_t ni; - nfds = uap->nfds; + nfds = SCARG(uap, nfds); mtx_lock(&Giant); /* @@ -971,12 +971,12 @@ poll(td, uap) bits = malloc(ni, M_TEMP, M_WAITOK); else bits = smallbits; - error = copyin(uap->fds, bits, ni); + error = copyin(SCARG(uap, fds), bits, ni); if (error) goto done_nosellock; - if (uap->timeout != INFTIM) { - atv.tv_sec = uap->timeout / 1000; - atv.tv_usec = (uap->timeout % 1000) * 1000; + if (SCARG(uap, timeout) != INFTIM) { + atv.tv_sec = SCARG(uap, timeout) / 1000; + atv.tv_usec = (SCARG(uap, timeout) % 1000) * 1000; if (itimerfix(&atv)) { error = EINVAL; goto done_nosellock; @@ -1044,7 +1044,7 @@ done_nosellock: if (error == EWOULDBLOCK) error = 0; if (error == 0) { - error = copyout(bits, uap->fds, ni); + error = copyout(bits, SCARG(uap, fds), ni); if (error) goto out; } diff --git a/sys/kern/vfs_acl.c b/sys/kern/vfs_acl.c index b194454..2a182cd 100644 --- a/sys/kern/vfs_acl.c +++ b/sys/kern/vfs_acl.c @@ -689,11 +689,11 @@ __acl_get_file(struct thread *td, struct __acl_get_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_get_acl(td, nd.ni_vp, uap->type, - uap->aclp); + error = vacl_get_acl(td, nd.ni_vp, SCARG(uap, type), + SCARG(uap, aclp)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -712,11 +712,11 @@ __acl_set_file(struct thread *td, struct __acl_set_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_set_acl(td, nd.ni_vp, uap->type, - uap->aclp); + error = vacl_set_acl(td, nd.ni_vp, SCARG(uap, type), + SCARG(uap, aclp)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -735,10 +735,10 @@ __acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_get_acl(td, (struct vnode *)fp->f_data, - uap->type, uap->aclp); + SCARG(uap, type), SCARG(uap, aclp)); fdrop(fp, td); } mtx_unlock(&Giant); @@ -757,10 +757,10 @@ __acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_set_acl(td, (struct vnode *)fp->f_data, - uap->type, uap->aclp); + SCARG(uap, type), SCARG(uap, aclp)); fdrop(fp, td); } mtx_unlock(&Giant); @@ -779,10 +779,10 @@ __acl_delete_file(struct thread *td, struct __acl_delete_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_delete(td, nd.ni_vp, uap->type); + error = vacl_delete(td, nd.ni_vp, SCARG(uap, type)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -801,10 +801,10 @@ __acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_delete(td, (struct vnode *)fp->f_data, - uap->type); + SCARG(uap, type)); fdrop(fp, td); } mtx_unlock(&Giant); @@ -823,11 +823,11 @@ __acl_aclcheck_file(struct thread *td, struct __acl_aclcheck_file_args *uap) int error; mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); error = namei(&nd); if (error == 0) { - error = vacl_aclcheck(td, nd.ni_vp, uap->type, - uap->aclp); + error = vacl_aclcheck(td, nd.ni_vp, SCARG(uap, type), + SCARG(uap, aclp)); NDFREE(&nd, 0); } mtx_unlock(&Giant); @@ -846,10 +846,10 @@ __acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap) int error; mtx_lock(&Giant); - error = getvnode(td->td_proc->p_fd, uap->filedes, &fp); + error = getvnode(td->td_proc->p_fd, SCARG(uap, filedes), &fp); if (error == 0) { error = vacl_aclcheck(td, (struct vnode *)fp->f_data, - uap->type, uap->aclp); + SCARG(uap, type), SCARG(uap, aclp)); fdrop(fp, td); } mtx_unlock(&Giant); diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 012cc91..8e2d605 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -191,7 +191,7 @@ quotactl(td, uap) if (jailed(td->td_ucred) && !prison_quotas) return (EPERM); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -199,8 +199,8 @@ quotactl(td, uap) vrele(nd.ni_vp); if (error) return (error); - error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, - uap->arg, td); + error = VFS_QUOTACTL(mp, SCARG(uap, cmd), SCARG(uap, uid), + SCARG(uap, arg), td); vn_finished_write(mp); return (error); } @@ -229,7 +229,7 @@ statfs(td, uap) struct nameidata nd; struct statfs sb; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); mp = nd.ni_vp->v_mount; @@ -250,7 +250,7 @@ statfs(td, uap) sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; sp = &sb; } - return (copyout(sp, uap->buf, sizeof(*sp))); + return (copyout(sp, SCARG(uap, buf), sizeof(*sp))); } /* @@ -277,7 +277,7 @@ fstatfs(td, uap) int error; struct statfs sb; - 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; fdrop(fp, td); @@ -298,7 +298,7 @@ fstatfs(td, uap) sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; sp = &sb; } - return (copyout(sp, uap->buf, sizeof(*sp))); + return (copyout(sp, SCARG(uap, buf), sizeof(*sp))); } /* @@ -325,8 +325,8 @@ getfsstat(td, uap) caddr_t sfsp; long count, maxcount, error; - maxcount = uap->bufsize / sizeof(struct statfs); - sfsp = (caddr_t)uap->buf; + maxcount = SCARG(uap, bufsize) / sizeof(struct statfs); + sfsp = (caddr_t)SCARG(uap, buf); count = 0; mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { @@ -347,8 +347,8 @@ getfsstat(td, uap) * refresh the fsstat cache. MNT_NOWAIT or MNT_LAZY * overrides MNT_WAIT. */ - if (((uap->flags & (MNT_LAZY|MNT_NOWAIT)) == 0 || - (uap->flags & MNT_WAIT)) && + if (((SCARG(uap, flags) & (MNT_LAZY|MNT_NOWAIT)) == 0 || + (SCARG(uap, flags) & MNT_WAIT)) && (error = VFS_STATFS(mp, sp, td))) { mtx_lock(&mountlist_mtx); nmp = TAILQ_NEXT(mp, mnt_list); @@ -398,7 +398,7 @@ fchdir(td, uap) struct file *fp; int 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; VREF(vp); @@ -539,7 +539,7 @@ chroot(td, uap) if (error) return (error); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); mtx_lock(&Giant); if ((error = change_dir(&nd, td)) != 0) goto error; @@ -809,9 +809,9 @@ ocreat(td, uap) syscallarg(int) mode; } */ nuap; - nuap.path = uap->path; - nuap.mode = uap->mode; - nuap.flags = O_WRONLY | O_CREAT | O_TRUNC; + SCARG(&nuap, path) = SCARG(uap, path); + SCARG(&nuap, mode) = SCARG(uap, mode); + SCARG(&nuap, flags) = O_WRONLY | O_CREAT | O_TRUNC; return (open(td, &nuap)); } #endif /* COMPAT_43 */ @@ -1176,7 +1176,7 @@ undelete(td, uap) restart: bwillwrite(); NDINIT(&nd, DELETE, LOCKPARENT|DOWHITEOUT, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); error = namei(&nd); if (error) return (error); @@ -1222,7 +1222,7 @@ unlink(td, uap) } */ *uap; { - return (kern_unlink(td, uap->path, UIO_USERSPACE)); + return (kern_unlink(td, SCARG(uap, path), UIO_USERSPACE)); } int @@ -1323,8 +1323,8 @@ lseek(td, uap) } vp = (struct vnode *)fp->f_data; noneg = (vp->v_type != VCHR); - offset = uap->offset; - switch (uap->whence) { + offset = SCARG(uap, offset); + switch (SCARG(uap, whence)) { case L_INCR: if (noneg && (fp->f_offset < 0 || @@ -1386,9 +1386,9 @@ olseek(td, uap) } */ nuap; int error; - nuap.fd = uap->fd; - nuap.offset = uap->offset; - nuap.whence = uap->whence; + SCARG(&nuap, fd) = SCARG(uap, fd); + SCARG(&nuap, offset) = SCARG(uap, offset); + SCARG(&nuap, whence) = SCARG(uap, whence); error = lseek(td, &nuap); return (error); } @@ -1506,12 +1506,12 @@ eaccess(td, uap) int error; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; - error = vn_access(vp, uap->flags, td->td_ucred, td); + error = vn_access(vp, SCARG(uap, flags), td->td_ucred, td); NDFREE(&nd, NDF_ONLY_PNBUF); vput(vp); return (error); @@ -1542,7 +1542,7 @@ ostat(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -1551,7 +1551,7 @@ ostat(td, uap) if (error) return (error); cvtstat(&sb, &osb); - error = copyout(&osb, uap->ub, sizeof (osb)); + error = copyout(&osb, SCARG(uap, ub), sizeof (osb)); return (error); } @@ -1580,7 +1580,7 @@ olstat(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; @@ -1590,7 +1590,7 @@ olstat(td, uap) if (error) return (error); cvtstat(&sb, &osb); - error = copyout(&osb, uap->ub, sizeof (osb)); + error = copyout(&osb, SCARG(uap, ub), sizeof (osb)); return (error); } @@ -1648,10 +1648,10 @@ stat(td, uap) #ifdef LOOKUP_SHARED NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | NOOBJ, - UIO_USERSPACE, uap->path, td); + UIO_USERSPACE, SCARG(uap, path), td); #else NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); #endif if ((error = namei(&nd)) != 0) return (error); @@ -1660,7 +1660,7 @@ stat(td, uap) vput(nd.ni_vp); if (error) return (error); - error = copyout(&sb, uap->ub, sizeof (sb)); + error = copyout(&sb, SCARG(uap, ub), sizeof (sb)); return (error); } @@ -1688,7 +1688,7 @@ lstat(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; @@ -1697,7 +1697,7 @@ lstat(td, uap) vput(vp); if (error) return (error); - error = copyout(&sb, uap->ub, sizeof (sb)); + error = copyout(&sb, SCARG(uap, ub), sizeof (sb)); return (error); } @@ -1753,7 +1753,7 @@ nstat(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -1762,7 +1762,7 @@ nstat(td, uap) if (error) return (error); cvtnstat(&sb, &nsb); - error = copyout(&nsb, uap->ub, sizeof (nsb)); + error = copyout(&nsb, SCARG(uap, ub), sizeof (nsb)); return (error); } @@ -1791,7 +1791,7 @@ nlstat(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; @@ -1801,7 +1801,7 @@ nlstat(td, uap) if (error) return (error); cvtnstat(&sb, &nsb); - error = copyout(&nsb, uap->ub, sizeof (nsb)); + error = copyout(&nsb, SCARG(uap, ub), sizeof (nsb)); return (error); } @@ -1827,7 +1827,7 @@ pathconf(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -1972,11 +1972,11 @@ chflags(td, uap) int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfflags(td, nd.ni_vp, uap->flags); + error = setfflags(td, nd.ni_vp, SCARG(uap, flags)); vrele(nd.ni_vp); return error; } @@ -1995,11 +1995,11 @@ lchflags(td, uap) int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfflags(td, nd.ni_vp, uap->flags); + error = setfflags(td, nd.ni_vp, SCARG(uap, flags)); vrele(nd.ni_vp); return error; } @@ -2025,9 +2025,9 @@ fchflags(td, uap) struct file *fp; 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); - error = setfflags(td, (struct vnode *) fp->f_data, uap->flags); + error = setfflags(td, (struct vnode *) fp->f_data, SCARG(uap, flags)); fdrop(fp, td); return (error); } @@ -2119,11 +2119,11 @@ lchmod(td, uap) int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfmode(td, nd.ni_vp, uap->mode); + error = setfmode(td, nd.ni_vp, SCARG(uap, mode)); vrele(nd.ni_vp); return error; } @@ -2150,10 +2150,10 @@ fchmod(td, uap) struct vnode *vp; 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); vp = (struct vnode *)fp->f_data; - error = setfmode(td, (struct vnode *)fp->f_data, uap->mode); + error = setfmode(td, (struct vnode *)fp->f_data, SCARG(uap, mode)); fdrop(fp, td); return (error); } @@ -2294,11 +2294,11 @@ fchown(td, uap) struct vnode *vp; 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); vp = (struct vnode *)fp->f_data; error = setfown(td, (struct vnode *)fp->f_data, - uap->uid, uap->gid); + SCARG(uap, uid), SCARG(uap, gid)); fdrop(fp, td); return (error); } @@ -2592,7 +2592,7 @@ ftruncate(td, uap) if (uap->length < 0) return(EINVAL); - 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 & FWRITE) == 0) { fdrop(fp, td); @@ -2614,7 +2614,7 @@ ftruncate(td, uap) #endif else if ((error = vn_writechk(vp)) == 0) { VATTR_NULL(&vattr); - vattr.va_size = uap->length; + vattr.va_size = SCARG(uap, length); error = VOP_SETATTR(vp, &vattr, fp->f_cred, td); } VOP_UNLOCK(vp, 0, td); @@ -2648,8 +2648,8 @@ otruncate(td, uap) syscallarg(off_t) length; } */ nuap; - nuap.path = uap->path; - nuap.length = uap->length; + SCARG(&nuap, path) = SCARG(uap, path); + SCARG(&nuap, length) = SCARG(uap, length); return (truncate(td, &nuap)); } @@ -2677,8 +2677,8 @@ oftruncate(td, uap) syscallarg(off_t) length; } */ nuap; - nuap.fd = uap->fd; - nuap.length = uap->length; + SCARG(&nuap, fd) = SCARG(uap, fd); + SCARG(&nuap, length) = SCARG(uap, length); return (ftruncate(td, &nuap)); } #endif /* COMPAT_43 || COMPAT_SUNOS */ @@ -2707,7 +2707,7 @@ fsync(td, uap) GIANT_REQUIRED; - 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); vp = (struct vnode *)fp->f_data; if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) { @@ -3062,9 +3062,9 @@ ogetdirentries(td, uap) long loff; /* XXX arbitrary sanity limit on `count'. */ - if (uap->count > 64 * 1024) + if (SCARG(uap, count) > 64 * 1024) return (EINVAL); - 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); @@ -3076,14 +3076,14 @@ unionread: fdrop(fp, td); return (EINVAL); } - aiov.iov_base = uap->buf; - aiov.iov_len = uap->count; + aiov.iov_base = SCARG(uap, buf); + aiov.iov_len = SCARG(uap, count); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_USERSPACE; auio.uio_td = td; - auio.uio_resid = uap->count; + auio.uio_resid = SCARG(uap, count); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); loff = auio.uio_offset = fp->f_offset; #ifdef MAC @@ -3105,14 +3105,14 @@ unionread: kuio = auio; kuio.uio_iov = &kiov; kuio.uio_segflg = UIO_SYSSPACE; - kiov.iov_len = uap->count; - MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, M_WAITOK); + kiov.iov_len = SCARG(uap, count); + MALLOC(dirbuf, caddr_t, SCARG(uap, count), M_TEMP, M_WAITOK); kiov.iov_base = dirbuf; error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag, NULL, NULL); fp->f_offset = kuio.uio_offset; if (error == 0) { - readcnt = uap->count - kuio.uio_resid; + readcnt = SCARG(uap, count) - kuio.uio_resid; edp = (struct dirent *)&dirbuf[readcnt]; for (dp = (struct dirent *)dirbuf; dp < edp; ) { # if (BYTE_ORDER == LITTLE_ENDIAN) @@ -3150,7 +3150,7 @@ unionread: fdrop(fp, td); return (error); } - if (uap->count == auio.uio_resid) { + if (SCARG(uap, count) == auio.uio_resid) { if (union_dircheckp) { error = union_dircheckp(td, &vp, fp); if (error == -1) @@ -3177,9 +3177,9 @@ unionread: } VOP_UNLOCK(vp, 0, td); } - error = copyout(&loff, uap->basep, sizeof(long)); + error = copyout(&loff, SCARG(uap, basep), sizeof(long)); fdrop(fp, td); - td->td_retval[0] = uap->count - auio.uio_resid; + td->td_retval[0] = SCARG(uap, count) - auio.uio_resid; return (error); } #endif /* COMPAT_43 */ @@ -3212,7 +3212,7 @@ getdirentries(td, uap) long loff; int error, eofflag; - 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); @@ -3224,14 +3224,14 @@ unionread: fdrop(fp, td); return (EINVAL); } - aiov.iov_base = uap->buf; - aiov.iov_len = uap->count; + aiov.iov_base = SCARG(uap, buf); + aiov.iov_len = SCARG(uap, count); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_USERSPACE; auio.uio_td = td; - auio.uio_resid = uap->count; + auio.uio_resid = SCARG(uap, count); /* vn_lock(vp, LK_SHARED | LK_RETRY, td); */ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); loff = auio.uio_offset = fp->f_offset; @@ -3247,7 +3247,7 @@ unionread: fdrop(fp, td); return (error); } - if (uap->count == auio.uio_resid) { + if (SCARG(uap, count) == auio.uio_resid) { if (union_dircheckp) { error = union_dircheckp(td, &vp, fp); if (error == -1) @@ -3274,10 +3274,10 @@ unionread: } VOP_UNLOCK(vp, 0, td); } - if (uap->basep != NULL) { - error = copyout(&loff, uap->basep, sizeof(long)); + if (SCARG(uap, basep) != NULL) { + error = copyout(&loff, SCARG(uap, basep), sizeof(long)); } - td->td_retval[0] = uap->count - auio.uio_resid; + td->td_retval[0] = SCARG(uap, count) - auio.uio_resid; fdrop(fp, td); return (error); } @@ -3327,7 +3327,7 @@ umask(td, uap) FILEDESC_LOCK(td->td_proc->p_fd); fdp = td->td_proc->p_fd; td->td_retval[0] = fdp->fd_cmask; - fdp->fd_cmask = uap->newmask & ALLPERMS; + fdp->fd_cmask = SCARG(uap, newmask) & ALLPERMS; FILEDESC_UNLOCK(td->td_proc->p_fd); return (0); } @@ -3355,7 +3355,7 @@ revoke(td, uap) int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); @@ -3508,11 +3508,11 @@ fhopen(td, uap) if (error) return (error); - fmode = FFLAGS(uap->flags); + fmode = FFLAGS(SCARG(uap, flags)); /* why not allow a non-read/write open for our lockd? */ if (((fmode & (FREAD | FWRITE)) == 0) || (fmode & O_CREAT)) return (EINVAL); - error = copyin(uap->u_fhp, &fhp, sizeof(fhp)); + error = copyin(SCARG(uap,u_fhp), &fhp, sizeof(fhp)); if (error) return(error); /* find the mount point */ @@ -3703,7 +3703,7 @@ fhstat(td, uap) if (error) return (error); - error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t)); + error = copyin(SCARG(uap, u_fhp), &fh, sizeof(fhandle_t)); if (error) return (error); @@ -3715,7 +3715,7 @@ fhstat(td, uap) vput(vp); if (error) return (error); - error = copyout(&sb, uap->sb, sizeof(sb)); + error = copyout(&sb, SCARG(uap, sb), sizeof(sb)); return (error); } @@ -3750,7 +3750,7 @@ fhstatfs(td, uap) if (error) return (error); - if ((error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t))) != 0) + if ((error = copyin(SCARG(uap, u_fhp), &fh, sizeof(fhandle_t))) != 0) return (error); if ((mp = vfs_getvfs(&fh.fh_fsid)) == NULL) @@ -3773,7 +3773,7 @@ fhstatfs(td, uap) sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; sp = &sb; } - return (copyout(sp, uap->buf, sizeof(*sp))); + return (copyout(sp, SCARG(uap, buf), sizeof(*sp))); } /* diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index a98e1a4..58e8434 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -323,7 +323,7 @@ nmount(td, uap) int error; u_int iovlen, iovcnt; - iovcnt = uap->iovcnt; + iovcnt = SCARG(uap, iovcnt); iovlen = iovcnt * sizeof (struct iovec); /* * Check that we have an even number of iovec's @@ -352,7 +352,7 @@ nmount(td, uap) } iov++; } - error = vfs_nmount(td, uap->flags, &auio); + error = vfs_nmount(td, SCARG(uap, flags), &auio); finish: if (needfree != NULL) free(needfree, M_TEMP); @@ -811,12 +811,12 @@ mount(td, uap) * vfs_mount() actually takes a kernel string for `type' and * `path' now, so extract them. */ - error = copyinstr(uap->type, fstype, MFSNAMELEN, NULL); + error = copyinstr(SCARG(uap, type), fstype, MFSNAMELEN, NULL); if (error == 0) - error = copyinstr(uap->path, fspath, MNAMELEN, NULL); + error = copyinstr(SCARG(uap, path), fspath, MNAMELEN, NULL); if (error == 0) - error = vfs_mount(td, fstype, fspath, uap->flags, - uap->data); + error = vfs_mount(td, fstype, fspath, SCARG(uap, flags), + SCARG(uap, data)); free(fstype, M_TEMP); free(fspath, M_TEMP); return (error); @@ -1199,7 +1199,7 @@ unmount(td, uap) struct nameidata nd; 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; @@ -1234,7 +1234,7 @@ unmount(td, uap) return (EINVAL); } vput(vp); - return (dounmount(mp, uap->flags, td)); + return (dounmount(mp, SCARG(uap, flags), td)); } /* diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 012cc91..8e2d605 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -191,7 +191,7 @@ quotactl(td, uap) if (jailed(td->td_ucred) && !prison_quotas) return (EPERM); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -199,8 +199,8 @@ quotactl(td, uap) vrele(nd.ni_vp); if (error) return (error); - error = VFS_QUOTACTL(mp, uap->cmd, uap->uid, - uap->arg, td); + error = VFS_QUOTACTL(mp, SCARG(uap, cmd), SCARG(uap, uid), + SCARG(uap, arg), td); vn_finished_write(mp); return (error); } @@ -229,7 +229,7 @@ statfs(td, uap) struct nameidata nd; struct statfs sb; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); mp = nd.ni_vp->v_mount; @@ -250,7 +250,7 @@ statfs(td, uap) sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; sp = &sb; } - return (copyout(sp, uap->buf, sizeof(*sp))); + return (copyout(sp, SCARG(uap, buf), sizeof(*sp))); } /* @@ -277,7 +277,7 @@ fstatfs(td, uap) int error; struct statfs sb; - 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; fdrop(fp, td); @@ -298,7 +298,7 @@ fstatfs(td, uap) sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; sp = &sb; } - return (copyout(sp, uap->buf, sizeof(*sp))); + return (copyout(sp, SCARG(uap, buf), sizeof(*sp))); } /* @@ -325,8 +325,8 @@ getfsstat(td, uap) caddr_t sfsp; long count, maxcount, error; - maxcount = uap->bufsize / sizeof(struct statfs); - sfsp = (caddr_t)uap->buf; + maxcount = SCARG(uap, bufsize) / sizeof(struct statfs); + sfsp = (caddr_t)SCARG(uap, buf); count = 0; mtx_lock(&mountlist_mtx); for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { @@ -347,8 +347,8 @@ getfsstat(td, uap) * refresh the fsstat cache. MNT_NOWAIT or MNT_LAZY * overrides MNT_WAIT. */ - if (((uap->flags & (MNT_LAZY|MNT_NOWAIT)) == 0 || - (uap->flags & MNT_WAIT)) && + if (((SCARG(uap, flags) & (MNT_LAZY|MNT_NOWAIT)) == 0 || + (SCARG(uap, flags) & MNT_WAIT)) && (error = VFS_STATFS(mp, sp, td))) { mtx_lock(&mountlist_mtx); nmp = TAILQ_NEXT(mp, mnt_list); @@ -398,7 +398,7 @@ fchdir(td, uap) struct file *fp; int 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; VREF(vp); @@ -539,7 +539,7 @@ chroot(td, uap) if (error) return (error); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); mtx_lock(&Giant); if ((error = change_dir(&nd, td)) != 0) goto error; @@ -809,9 +809,9 @@ ocreat(td, uap) syscallarg(int) mode; } */ nuap; - nuap.path = uap->path; - nuap.mode = uap->mode; - nuap.flags = O_WRONLY | O_CREAT | O_TRUNC; + SCARG(&nuap, path) = SCARG(uap, path); + SCARG(&nuap, mode) = SCARG(uap, mode); + SCARG(&nuap, flags) = O_WRONLY | O_CREAT | O_TRUNC; return (open(td, &nuap)); } #endif /* COMPAT_43 */ @@ -1176,7 +1176,7 @@ undelete(td, uap) restart: bwillwrite(); NDINIT(&nd, DELETE, LOCKPARENT|DOWHITEOUT, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); error = namei(&nd); if (error) return (error); @@ -1222,7 +1222,7 @@ unlink(td, uap) } */ *uap; { - return (kern_unlink(td, uap->path, UIO_USERSPACE)); + return (kern_unlink(td, SCARG(uap, path), UIO_USERSPACE)); } int @@ -1323,8 +1323,8 @@ lseek(td, uap) } vp = (struct vnode *)fp->f_data; noneg = (vp->v_type != VCHR); - offset = uap->offset; - switch (uap->whence) { + offset = SCARG(uap, offset); + switch (SCARG(uap, whence)) { case L_INCR: if (noneg && (fp->f_offset < 0 || @@ -1386,9 +1386,9 @@ olseek(td, uap) } */ nuap; int error; - nuap.fd = uap->fd; - nuap.offset = uap->offset; - nuap.whence = uap->whence; + SCARG(&nuap, fd) = SCARG(uap, fd); + SCARG(&nuap, offset) = SCARG(uap, offset); + SCARG(&nuap, whence) = SCARG(uap, whence); error = lseek(td, &nuap); return (error); } @@ -1506,12 +1506,12 @@ eaccess(td, uap) int error; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; - error = vn_access(vp, uap->flags, td->td_ucred, td); + error = vn_access(vp, SCARG(uap, flags), td->td_ucred, td); NDFREE(&nd, NDF_ONLY_PNBUF); vput(vp); return (error); @@ -1542,7 +1542,7 @@ ostat(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -1551,7 +1551,7 @@ ostat(td, uap) if (error) return (error); cvtstat(&sb, &osb); - error = copyout(&osb, uap->ub, sizeof (osb)); + error = copyout(&osb, SCARG(uap, ub), sizeof (osb)); return (error); } @@ -1580,7 +1580,7 @@ olstat(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; @@ -1590,7 +1590,7 @@ olstat(td, uap) if (error) return (error); cvtstat(&sb, &osb); - error = copyout(&osb, uap->ub, sizeof (osb)); + error = copyout(&osb, SCARG(uap, ub), sizeof (osb)); return (error); } @@ -1648,10 +1648,10 @@ stat(td, uap) #ifdef LOOKUP_SHARED NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | NOOBJ, - UIO_USERSPACE, uap->path, td); + UIO_USERSPACE, SCARG(uap, path), td); #else NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); #endif if ((error = namei(&nd)) != 0) return (error); @@ -1660,7 +1660,7 @@ stat(td, uap) vput(nd.ni_vp); if (error) return (error); - error = copyout(&sb, uap->ub, sizeof (sb)); + error = copyout(&sb, SCARG(uap, ub), sizeof (sb)); return (error); } @@ -1688,7 +1688,7 @@ lstat(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; @@ -1697,7 +1697,7 @@ lstat(td, uap) vput(vp); if (error) return (error); - error = copyout(&sb, uap->ub, sizeof (sb)); + error = copyout(&sb, SCARG(uap, ub), sizeof (sb)); return (error); } @@ -1753,7 +1753,7 @@ nstat(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -1762,7 +1762,7 @@ nstat(td, uap) if (error) return (error); cvtnstat(&sb, &nsb); - error = copyout(&nsb, uap->ub, sizeof (nsb)); + error = copyout(&nsb, SCARG(uap, ub), sizeof (nsb)); return (error); } @@ -1791,7 +1791,7 @@ nlstat(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; @@ -1801,7 +1801,7 @@ nlstat(td, uap) if (error) return (error); cvtnstat(&sb, &nsb); - error = copyout(&nsb, uap->ub, sizeof (nsb)); + error = copyout(&nsb, SCARG(uap, ub), sizeof (nsb)); return (error); } @@ -1827,7 +1827,7 @@ pathconf(td, uap) struct nameidata nd; NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, - uap->path, td); + SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); @@ -1972,11 +1972,11 @@ chflags(td, uap) int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfflags(td, nd.ni_vp, uap->flags); + error = setfflags(td, nd.ni_vp, SCARG(uap, flags)); vrele(nd.ni_vp); return error; } @@ -1995,11 +1995,11 @@ lchflags(td, uap) int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfflags(td, nd.ni_vp, uap->flags); + error = setfflags(td, nd.ni_vp, SCARG(uap, flags)); vrele(nd.ni_vp); return error; } @@ -2025,9 +2025,9 @@ fchflags(td, uap) struct file *fp; 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); - error = setfflags(td, (struct vnode *) fp->f_data, uap->flags); + error = setfflags(td, (struct vnode *) fp->f_data, SCARG(uap, flags)); fdrop(fp, td); return (error); } @@ -2119,11 +2119,11 @@ lchmod(td, uap) int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); NDFREE(&nd, NDF_ONLY_PNBUF); - error = setfmode(td, nd.ni_vp, uap->mode); + error = setfmode(td, nd.ni_vp, SCARG(uap, mode)); vrele(nd.ni_vp); return error; } @@ -2150,10 +2150,10 @@ fchmod(td, uap) struct vnode *vp; 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); vp = (struct vnode *)fp->f_data; - error = setfmode(td, (struct vnode *)fp->f_data, uap->mode); + error = setfmode(td, (struct vnode *)fp->f_data, SCARG(uap, mode)); fdrop(fp, td); return (error); } @@ -2294,11 +2294,11 @@ fchown(td, uap) struct vnode *vp; 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); vp = (struct vnode *)fp->f_data; error = setfown(td, (struct vnode *)fp->f_data, - uap->uid, uap->gid); + SCARG(uap, uid), SCARG(uap, gid)); fdrop(fp, td); return (error); } @@ -2592,7 +2592,7 @@ ftruncate(td, uap) if (uap->length < 0) return(EINVAL); - 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 & FWRITE) == 0) { fdrop(fp, td); @@ -2614,7 +2614,7 @@ ftruncate(td, uap) #endif else if ((error = vn_writechk(vp)) == 0) { VATTR_NULL(&vattr); - vattr.va_size = uap->length; + vattr.va_size = SCARG(uap, length); error = VOP_SETATTR(vp, &vattr, fp->f_cred, td); } VOP_UNLOCK(vp, 0, td); @@ -2648,8 +2648,8 @@ otruncate(td, uap) syscallarg(off_t) length; } */ nuap; - nuap.path = uap->path; - nuap.length = uap->length; + SCARG(&nuap, path) = SCARG(uap, path); + SCARG(&nuap, length) = SCARG(uap, length); return (truncate(td, &nuap)); } @@ -2677,8 +2677,8 @@ oftruncate(td, uap) syscallarg(off_t) length; } */ nuap; - nuap.fd = uap->fd; - nuap.length = uap->length; + SCARG(&nuap, fd) = SCARG(uap, fd); + SCARG(&nuap, length) = SCARG(uap, length); return (ftruncate(td, &nuap)); } #endif /* COMPAT_43 || COMPAT_SUNOS */ @@ -2707,7 +2707,7 @@ fsync(td, uap) GIANT_REQUIRED; - 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); vp = (struct vnode *)fp->f_data; if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) { @@ -3062,9 +3062,9 @@ ogetdirentries(td, uap) long loff; /* XXX arbitrary sanity limit on `count'. */ - if (uap->count > 64 * 1024) + if (SCARG(uap, count) > 64 * 1024) return (EINVAL); - 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); @@ -3076,14 +3076,14 @@ unionread: fdrop(fp, td); return (EINVAL); } - aiov.iov_base = uap->buf; - aiov.iov_len = uap->count; + aiov.iov_base = SCARG(uap, buf); + aiov.iov_len = SCARG(uap, count); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_USERSPACE; auio.uio_td = td; - auio.uio_resid = uap->count; + auio.uio_resid = SCARG(uap, count); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); loff = auio.uio_offset = fp->f_offset; #ifdef MAC @@ -3105,14 +3105,14 @@ unionread: kuio = auio; kuio.uio_iov = &kiov; kuio.uio_segflg = UIO_SYSSPACE; - kiov.iov_len = uap->count; - MALLOC(dirbuf, caddr_t, uap->count, M_TEMP, M_WAITOK); + kiov.iov_len = SCARG(uap, count); + MALLOC(dirbuf, caddr_t, SCARG(uap, count), M_TEMP, M_WAITOK); kiov.iov_base = dirbuf; error = VOP_READDIR(vp, &kuio, fp->f_cred, &eofflag, NULL, NULL); fp->f_offset = kuio.uio_offset; if (error == 0) { - readcnt = uap->count - kuio.uio_resid; + readcnt = SCARG(uap, count) - kuio.uio_resid; edp = (struct dirent *)&dirbuf[readcnt]; for (dp = (struct dirent *)dirbuf; dp < edp; ) { # if (BYTE_ORDER == LITTLE_ENDIAN) @@ -3150,7 +3150,7 @@ unionread: fdrop(fp, td); return (error); } - if (uap->count == auio.uio_resid) { + if (SCARG(uap, count) == auio.uio_resid) { if (union_dircheckp) { error = union_dircheckp(td, &vp, fp); if (error == -1) @@ -3177,9 +3177,9 @@ unionread: } VOP_UNLOCK(vp, 0, td); } - error = copyout(&loff, uap->basep, sizeof(long)); + error = copyout(&loff, SCARG(uap, basep), sizeof(long)); fdrop(fp, td); - td->td_retval[0] = uap->count - auio.uio_resid; + td->td_retval[0] = SCARG(uap, count) - auio.uio_resid; return (error); } #endif /* COMPAT_43 */ @@ -3212,7 +3212,7 @@ getdirentries(td, uap) long loff; int error, eofflag; - 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); @@ -3224,14 +3224,14 @@ unionread: fdrop(fp, td); return (EINVAL); } - aiov.iov_base = uap->buf; - aiov.iov_len = uap->count; + aiov.iov_base = SCARG(uap, buf); + aiov.iov_len = SCARG(uap, count); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_USERSPACE; auio.uio_td = td; - auio.uio_resid = uap->count; + auio.uio_resid = SCARG(uap, count); /* vn_lock(vp, LK_SHARED | LK_RETRY, td); */ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); loff = auio.uio_offset = fp->f_offset; @@ -3247,7 +3247,7 @@ unionread: fdrop(fp, td); return (error); } - if (uap->count == auio.uio_resid) { + if (SCARG(uap, count) == auio.uio_resid) { if (union_dircheckp) { error = union_dircheckp(td, &vp, fp); if (error == -1) @@ -3274,10 +3274,10 @@ unionread: } VOP_UNLOCK(vp, 0, td); } - if (uap->basep != NULL) { - error = copyout(&loff, uap->basep, sizeof(long)); + if (SCARG(uap, basep) != NULL) { + error = copyout(&loff, SCARG(uap, basep), sizeof(long)); } - td->td_retval[0] = uap->count - auio.uio_resid; + td->td_retval[0] = SCARG(uap, count) - auio.uio_resid; fdrop(fp, td); return (error); } @@ -3327,7 +3327,7 @@ umask(td, uap) FILEDESC_LOCK(td->td_proc->p_fd); fdp = td->td_proc->p_fd; td->td_retval[0] = fdp->fd_cmask; - fdp->fd_cmask = uap->newmask & ALLPERMS; + fdp->fd_cmask = SCARG(uap, newmask) & ALLPERMS; FILEDESC_UNLOCK(td->td_proc->p_fd); return (0); } @@ -3355,7 +3355,7 @@ revoke(td, uap) int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, SCARG(uap, path), td); if ((error = namei(&nd)) != 0) return (error); @@ -3508,11 +3508,11 @@ fhopen(td, uap) if (error) return (error); - fmode = FFLAGS(uap->flags); + fmode = FFLAGS(SCARG(uap, flags)); /* why not allow a non-read/write open for our lockd? */ if (((fmode & (FREAD | FWRITE)) == 0) || (fmode & O_CREAT)) return (EINVAL); - error = copyin(uap->u_fhp, &fhp, sizeof(fhp)); + error = copyin(SCARG(uap,u_fhp), &fhp, sizeof(fhp)); if (error) return(error); /* find the mount point */ @@ -3703,7 +3703,7 @@ fhstat(td, uap) if (error) return (error); - error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t)); + error = copyin(SCARG(uap, u_fhp), &fh, sizeof(fhandle_t)); if (error) return (error); @@ -3715,7 +3715,7 @@ fhstat(td, uap) vput(vp); if (error) return (error); - error = copyout(&sb, uap->sb, sizeof(sb)); + error = copyout(&sb, SCARG(uap, sb), sizeof(sb)); return (error); } @@ -3750,7 +3750,7 @@ fhstatfs(td, uap) if (error) return (error); - if ((error = copyin(uap->u_fhp, &fh, sizeof(fhandle_t))) != 0) + if ((error = copyin(SCARG(uap, u_fhp), &fh, sizeof(fhandle_t))) != 0) return (error); if ((mp = vfs_getvfs(&fh.fh_fsid)) == NULL) @@ -3773,7 +3773,7 @@ fhstatfs(td, uap) sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; sp = &sb; } - return (copyout(sp, uap->buf, sizeof(*sp))); + return (copyout(sp, SCARG(uap, buf), sizeof(*sp))); } /* diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index 6542a73..257d131 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -3020,7 +3020,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) struct ucred *tcred; int error; - error = copyin(uap->mac_p, &mac, sizeof(mac)); + error = copyin(SCARG(uap, mac_p), &mac, sizeof(mac)); if (error) return (error); @@ -3203,7 +3203,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3405,7 +3405,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3583,7 +3583,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) char target[MAC_MAX_POLICY_NAME]; int error; - error = copyinstr(uap->policy, target, sizeof(target), NULL); + error = copyinstr(SCARG(uap, policy), target, sizeof(target), NULL); if (error) return (error); @@ -3593,7 +3593,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) if (strcmp(mpc->mpc_name, target) == 0 && mpc->mpc_ops->mpo_syscall != NULL) { error = mpc->mpc_ops->mpo_syscall(td, - uap->call, uap->arg); + SCARG(uap, call), SCARG(uap, arg)); goto out; } } diff --git a/sys/security/mac/mac_internal.h b/sys/security/mac/mac_internal.h index 6542a73..257d131 100644 --- a/sys/security/mac/mac_internal.h +++ b/sys/security/mac/mac_internal.h @@ -3020,7 +3020,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) struct ucred *tcred; int error; - error = copyin(uap->mac_p, &mac, sizeof(mac)); + error = copyin(SCARG(uap, mac_p), &mac, sizeof(mac)); if (error) return (error); @@ -3203,7 +3203,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3405,7 +3405,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3583,7 +3583,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) char target[MAC_MAX_POLICY_NAME]; int error; - error = copyinstr(uap->policy, target, sizeof(target), NULL); + error = copyinstr(SCARG(uap, policy), target, sizeof(target), NULL); if (error) return (error); @@ -3593,7 +3593,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) if (strcmp(mpc->mpc_name, target) == 0 && mpc->mpc_ops->mpo_syscall != NULL) { error = mpc->mpc_ops->mpo_syscall(td, - uap->call, uap->arg); + SCARG(uap, call), SCARG(uap, arg)); goto out; } } diff --git a/sys/security/mac/mac_net.c b/sys/security/mac/mac_net.c index 6542a73..257d131 100644 --- a/sys/security/mac/mac_net.c +++ b/sys/security/mac/mac_net.c @@ -3020,7 +3020,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) struct ucred *tcred; int error; - error = copyin(uap->mac_p, &mac, sizeof(mac)); + error = copyin(SCARG(uap, mac_p), &mac, sizeof(mac)); if (error) return (error); @@ -3203,7 +3203,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3405,7 +3405,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3583,7 +3583,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) char target[MAC_MAX_POLICY_NAME]; int error; - error = copyinstr(uap->policy, target, sizeof(target), NULL); + error = copyinstr(SCARG(uap, policy), target, sizeof(target), NULL); if (error) return (error); @@ -3593,7 +3593,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) if (strcmp(mpc->mpc_name, target) == 0 && mpc->mpc_ops->mpo_syscall != NULL) { error = mpc->mpc_ops->mpo_syscall(td, - uap->call, uap->arg); + SCARG(uap, call), SCARG(uap, arg)); goto out; } } diff --git a/sys/security/mac/mac_pipe.c b/sys/security/mac/mac_pipe.c index 6542a73..257d131 100644 --- a/sys/security/mac/mac_pipe.c +++ b/sys/security/mac/mac_pipe.c @@ -3020,7 +3020,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) struct ucred *tcred; int error; - error = copyin(uap->mac_p, &mac, sizeof(mac)); + error = copyin(SCARG(uap, mac_p), &mac, sizeof(mac)); if (error) return (error); @@ -3203,7 +3203,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3405,7 +3405,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3583,7 +3583,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) char target[MAC_MAX_POLICY_NAME]; int error; - error = copyinstr(uap->policy, target, sizeof(target), NULL); + error = copyinstr(SCARG(uap, policy), target, sizeof(target), NULL); if (error) return (error); @@ -3593,7 +3593,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) if (strcmp(mpc->mpc_name, target) == 0 && mpc->mpc_ops->mpo_syscall != NULL) { error = mpc->mpc_ops->mpo_syscall(td, - uap->call, uap->arg); + SCARG(uap, call), SCARG(uap, arg)); goto out; } } diff --git a/sys/security/mac/mac_process.c b/sys/security/mac/mac_process.c index 6542a73..257d131 100644 --- a/sys/security/mac/mac_process.c +++ b/sys/security/mac/mac_process.c @@ -3020,7 +3020,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) struct ucred *tcred; int error; - error = copyin(uap->mac_p, &mac, sizeof(mac)); + error = copyin(SCARG(uap, mac_p), &mac, sizeof(mac)); if (error) return (error); @@ -3203,7 +3203,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3405,7 +3405,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3583,7 +3583,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) char target[MAC_MAX_POLICY_NAME]; int error; - error = copyinstr(uap->policy, target, sizeof(target), NULL); + error = copyinstr(SCARG(uap, policy), target, sizeof(target), NULL); if (error) return (error); @@ -3593,7 +3593,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) if (strcmp(mpc->mpc_name, target) == 0 && mpc->mpc_ops->mpo_syscall != NULL) { error = mpc->mpc_ops->mpo_syscall(td, - uap->call, uap->arg); + SCARG(uap, call), SCARG(uap, arg)); goto out; } } diff --git a/sys/security/mac/mac_syscalls.c b/sys/security/mac/mac_syscalls.c index 6542a73..257d131 100644 --- a/sys/security/mac/mac_syscalls.c +++ b/sys/security/mac/mac_syscalls.c @@ -3020,7 +3020,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) struct ucred *tcred; int error; - error = copyin(uap->mac_p, &mac, sizeof(mac)); + error = copyin(SCARG(uap, mac_p), &mac, sizeof(mac)); if (error) return (error); @@ -3203,7 +3203,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3405,7 +3405,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3583,7 +3583,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) char target[MAC_MAX_POLICY_NAME]; int error; - error = copyinstr(uap->policy, target, sizeof(target), NULL); + error = copyinstr(SCARG(uap, policy), target, sizeof(target), NULL); if (error) return (error); @@ -3593,7 +3593,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) if (strcmp(mpc->mpc_name, target) == 0 && mpc->mpc_ops->mpo_syscall != NULL) { error = mpc->mpc_ops->mpo_syscall(td, - uap->call, uap->arg); + SCARG(uap, call), SCARG(uap, arg)); goto out; } } diff --git a/sys/security/mac/mac_system.c b/sys/security/mac/mac_system.c index 6542a73..257d131 100644 --- a/sys/security/mac/mac_system.c +++ b/sys/security/mac/mac_system.c @@ -3020,7 +3020,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) struct ucred *tcred; int error; - error = copyin(uap->mac_p, &mac, sizeof(mac)); + error = copyin(SCARG(uap, mac_p), &mac, sizeof(mac)); if (error) return (error); @@ -3203,7 +3203,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3405,7 +3405,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3583,7 +3583,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) char target[MAC_MAX_POLICY_NAME]; int error; - error = copyinstr(uap->policy, target, sizeof(target), NULL); + error = copyinstr(SCARG(uap, policy), target, sizeof(target), NULL); if (error) return (error); @@ -3593,7 +3593,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) if (strcmp(mpc->mpc_name, target) == 0 && mpc->mpc_ops->mpo_syscall != NULL) { error = mpc->mpc_ops->mpo_syscall(td, - uap->call, uap->arg); + SCARG(uap, call), SCARG(uap, arg)); goto out; } } diff --git a/sys/security/mac/mac_vfs.c b/sys/security/mac/mac_vfs.c index 6542a73..257d131 100644 --- a/sys/security/mac/mac_vfs.c +++ b/sys/security/mac/mac_vfs.c @@ -3020,7 +3020,7 @@ __mac_get_pid(struct thread *td, struct __mac_get_pid_args *uap) struct ucred *tcred; int error; - error = copyin(uap->mac_p, &mac, sizeof(mac)); + error = copyin(SCARG(uap, mac_p), &mac, sizeof(mac)); if (error) return (error); @@ -3203,7 +3203,7 @@ __mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap) buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO); mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3405,7 +3405,7 @@ __mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap) mtx_lock(&Giant); /* VFS */ - error = fget(td, uap->fd, &fp); + error = fget(td, SCARG(uap, fd), &fp); if (error) goto out; @@ -3583,7 +3583,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) char target[MAC_MAX_POLICY_NAME]; int error; - error = copyinstr(uap->policy, target, sizeof(target), NULL); + error = copyinstr(SCARG(uap, policy), target, sizeof(target), NULL); if (error) return (error); @@ -3593,7 +3593,7 @@ mac_syscall(struct thread *td, struct mac_syscall_args *uap) if (strcmp(mpc->mpc_name, target) == 0 && mpc->mpc_ops->mpo_syscall != NULL) { error = mpc->mpc_ops->mpo_syscall(td, - uap->call, uap->arg); + SCARG(uap, call), SCARG(uap, arg)); goto out; } } diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 7206c6f..bbc6b2f 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -48,6 +48,9 @@ struct sysent { /* system call table */ #define SYF_ARGMASK 0x0000FFFF #define SYF_MPSAFE 0x00010000 +#define SCARG(p,k) ((p)->k) /* get arg from args pointer */ + /* placeholder till we integrate rest of lite2 syscallargs changes XXX */ + struct image_params; struct __sigset; struct trapframe; |