summaryrefslogtreecommitdiffstats
path: root/sys/alpha
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-12-13 22:41:47 +0000
committeralfred <alfred@FreeBSD.org>2002-12-13 22:41:47 +0000
commit4f48184fb2c8948c406b21c3f802b5b281cef957 (patch)
treea1ef524330ea7e253fb665abea3ddb594cde69fc /sys/alpha
parentd19b4e039d47537b44233aae83d03b974d29d771 (diff)
downloadFreeBSD-src-4f48184fb2c8948c406b21c3f802b5b281cef957.zip
FreeBSD-src-4f48184fb2c8948c406b21c3f802b5b281cef957.tar.gz
Backout removal SCARGS, the code freeze is only "selectively" over.
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/sys_machdep.c2
-rw-r--r--sys/alpha/osf1/osf1_misc.c312
-rw-r--r--sys/alpha/osf1/osf1_mount.c62
-rw-r--r--sys/alpha/osf1/osf1_signal.c74
-rw-r--r--sys/alpha/osf1/osf1_util.h5
5 files changed, 230 insertions, 225 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);
OpenPOWER on IntegriCloud