diff --git a/sys/adosfs/advnops.c b/sys/adosfs/advnops.c index 9bb0642b4079..7d5141a9c82d 100644 --- a/sys/adosfs/advnops.c +++ b/sys/adosfs/advnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: advnops.c,v 1.11 1994/10/06 18:41:26 chopps Exp $ */ +/* $NetBSD: advnops.c,v 1.12 1994/10/20 04:24:00 cgd Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -879,7 +879,7 @@ adosfs_pathconf(sp) struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; - int *a_retval; + register_t *a_retval; } */ *sp; { diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index 385593696e68..2fb8278f0e64 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_vnops.c,v 1.15 1994/08/19 11:36:56 mycroft Exp $ */ +/* $NetBSD: cd9660_vnops.c,v 1.16 1994/10/20 04:26:20 cgd Exp $ */ /*- * Copyright (c) 1994 @@ -957,7 +957,7 @@ cd9660_pathconf(ap) struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; - int *a_retval; + register_t *a_retval; } */ *ap; { diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 205180d1f478..a710c80e617d 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.67 1994/10/18 06:28:06 cgd Exp $ */ +/* $NetBSD: init_main.c,v 1.68 1994/10/20 04:22:35 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993 @@ -62,6 +62,8 @@ #include #include +#include + #include #include @@ -105,7 +107,8 @@ main(framep) register struct filedesc0 *fdp; register struct pdevinit *pdev; register int i; - int s, rval[2]; + int s; + register_t rval[2]; extern int (*mountroot) __P((void)); extern struct pdevinit pdevinit[]; extern void roundrobin __P((void *)); @@ -334,8 +337,13 @@ start_init(p, framep) void *framep; { vm_offset_t addr; - struct execve_args args; - int options, i, retval[2], error; + struct execve_args /* { + syscallarg(char *) path; + syscallarg(char * *) argp; + syscallarg(char * *) envp; + } */ args; + int options, i, error; + register_t retval[2]; char flags[4], *flagsp; char **pathp, *path, *ucp, **uap, *arg0, *arg1; @@ -409,7 +417,7 @@ start_init(p, framep) /* * Move out the arg pointers. */ - uap = (char **)((int)ucp & ~(NBPW-1)); + uap = (char **)(ALIGN(ucp) - sizeof(char **)); (void)suword((caddr_t)--uap, 0); /* terminator */ if (options != 0) (void)suword((caddr_t)--uap, (long)arg1); @@ -418,9 +426,9 @@ start_init(p, framep) /* * Point at the arguments. */ - args.path = arg0; - args.argp = uap; - args.envp = NULL; + SCARG(&args, path) = arg0; + SCARG(&args, argp) = uap; + SCARG(&args, envp) = NULL; /* * Now try to exec the program. If can't for any reason diff --git a/sys/kern/init_sysent.c b/sys/kern/init_sysent.c index a8d5aa71688b..32cc3cdb2587 100644 --- a/sys/kern/init_sysent.c +++ b/sys/kern/init_sysent.c @@ -2,14 +2,14 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * created from: NetBSD syscalls.master,v 1.22 1994/06/29 06:33:10 + * created from NetBSD: syscalls.master,v 1.22 1994/06/29 06:33:10 cgd Exp */ #include #include - -int nosys(); - +#include +#include +#include int nosys(); int exit(); int fork(); @@ -138,16 +138,13 @@ int getfh(); #else #endif int sysarch(); -#ifdef SYSVSEM -int semsys(); +#if defined(SYSVSEM) && !defined(alpha) #else #endif -#ifdef SYSVMSG -int msgsys(); +#if defined(SYSVMSG) && !defined(alpha) #else #endif -#ifdef SYSVSHM -int shmsys(); +#if defined(SYSVSHM) && !defined(alpha) #else #endif int setgid(); @@ -189,60 +186,96 @@ int lkmnosys(); int lkmnosys(); #else /* !LKM */ #endif /* !LKM */ +#ifdef SYSVSEM +int __semctl(); +int semget(); +int semop(); +int semconfig(); +#else +#endif +#ifdef SYSVMSG +int msgctl(); +int msgget(); +int msgsnd(); +int msgrcv(); +#else +#endif +#ifdef SYSVSHM +int shmat(); +int shmctl(); +int shmdt(); +int shmget(); +#else +#endif #ifdef COMPAT_43 -#define compat(n, name) n, __CONCAT(o,name) +#define compat_43(func) __CONCAT(compat_43_,func) -int ocreat(); -int olseek(); -int ostat(); -int olstat(); +int compat_43(creat)(); +int compat_43(lseek)(); +int compat_43(stat)(); +int compat_43(lstat)(); #ifdef KTRACE #else #endif -int ofstat(); -int ogetkerninfo(); -int ogetpagesize(); -int ommap(); -int owait(); -int ogethostname(); -int osethostname(); -int ogetdtablesize(); -int oaccept(); -int osend(); -int orecv(); -int osigvec(); -int osigblock(); -int osigsetmask(); -int osigstack(); -int orecvmsg(); -int osendmsg(); +int compat_43(fstat)(); +int compat_43(getkerninfo)(); +int compat_43(getpagesize)(); +int compat_43(mmap)(); +int compat_43(wait)(); +int compat_43(gethostname)(); +int compat_43(sethostname)(); +int compat_43(getdtablesize)(); +int compat_43(accept)(); +int compat_43(send)(); +int compat_43(recv)(); +int compat_43(sigvec)(); +int compat_43(sigblock)(); +int compat_43(sigsetmask)(); +int compat_43(sigstack)(); +int compat_43(recvmsg)(); +int compat_43(sendmsg)(); #ifdef TRACE #else #endif #ifdef vax #else #endif -int orecvfrom(); -int osetreuid(); -int osetregid(); -int otruncate(); -int oftruncate(); -int ogetpeername(); -int ogethostid(); -int osethostid(); -int ogetrlimit(); -int osetrlimit(); -int okillpg(); -int oquota(); -int ogetsockname(); +int compat_43(recvfrom)(); +int compat_43(setreuid)(); +int compat_43(setregid)(); +int compat_43(truncate)(); +int compat_43(ftruncate)(); +int compat_43(getpeername)(); +int compat_43(gethostid)(); +int compat_43(sethostid)(); +int compat_43(getrlimit)(); +int compat_43(setrlimit)(); +int compat_43(killpg)(); +int compat_43(quota)(); +int compat_43(getsockname)(); #if defined(NFSCLIENT) || defined(NFSSERVER) #else #endif -int ogetdirentries(); +int compat_43(getdirentries)(); #ifdef NFSCLIENT #else #endif +#if defined(SYSVSEM) && !defined(alpha) +#else +#endif +#if defined(SYSVMSG) && !defined(alpha) +#else +#endif +#if defined(SYSVSHM) && !defined(alpha) +#else +#endif +#ifdef LFS +#else +#endif +#ifdef LKM +#else /* !LKM */ +#endif /* !LKM */ #ifdef SYSVSEM #else #endif @@ -252,302 +285,687 @@ int ogetdirentries(); #ifdef SYSVSHM #else #endif -#ifdef LFS -#else -#endif -#ifdef LKM -#else /* !LKM */ -#endif /* !LKM */ #else /* COMPAT_43 */ -#define compat(n, name) 0, nosys +#define compat_43(func) nosys #endif /* COMPAT_43 */ #ifdef COMPAT_09 -#define ncompat(n, name) n, __CONCAT(o,name) +#define compat_09(func) __CONCAT(compat_09_,func) -int ogetdomainname(); -int osetdomainname(); -int ouname(); - -#else /* COMPAT_43 */ -#define ncompat(n, name) 0, nosys -#endif /* COMPAT_43 */ - -struct sysent sysent[] = { - { 0, nosys }, /* 0 = syscall */ - { 1, exit }, /* 1 = exit */ - { 0, fork }, /* 2 = fork */ - { 3, read }, /* 3 = read */ - { 3, write }, /* 4 = write */ - { 3, open }, /* 5 = open */ - { 1, close }, /* 6 = close */ - { 4, wait4 }, /* 7 = wait4 */ - { compat(2,creat) }, /* 8 = old creat */ - { 2, link }, /* 9 = link */ - { 1, unlink }, /* 10 = unlink */ - { 0, nosys }, /* 11 = obsolete execv */ - { 1, chdir }, /* 12 = chdir */ - { 1, fchdir }, /* 13 = fchdir */ - { 3, mknod }, /* 14 = mknod */ - { 2, chmod }, /* 15 = chmod */ - { 3, chown }, /* 16 = chown */ - { 1, obreak }, /* 17 = break */ - { 3, getfsstat }, /* 18 = getfsstat */ - { compat(3,lseek) }, /* 19 = old lseek */ - { 0, getpid }, /* 20 = getpid */ - { 4, mount }, /* 21 = mount */ - { 2, unmount }, /* 22 = unmount */ - { 1, setuid }, /* 23 = setuid */ - { 0, getuid }, /* 24 = getuid */ - { 0, geteuid }, /* 25 = geteuid */ - { 4, ptrace }, /* 26 = ptrace */ - { 3, recvmsg }, /* 27 = recvmsg */ - { 3, sendmsg }, /* 28 = sendmsg */ - { 6, recvfrom }, /* 29 = recvfrom */ - { 3, accept }, /* 30 = accept */ - { 3, getpeername }, /* 31 = getpeername */ - { 3, getsockname }, /* 32 = getsockname */ - { 2, access }, /* 33 = access */ - { 2, chflags }, /* 34 = chflags */ - { 2, fchflags }, /* 35 = fchflags */ - { 0, sync }, /* 36 = sync */ - { 2, kill }, /* 37 = kill */ - { compat(2,stat) }, /* 38 = old stat */ - { 0, getppid }, /* 39 = getppid */ - { compat(2,lstat) }, /* 40 = old lstat */ - { 2, dup }, /* 41 = dup */ - { 0, pipe }, /* 42 = pipe */ - { 0, getegid }, /* 43 = getegid */ - { 4, profil }, /* 44 = profil */ #ifdef KTRACE - { 4, ktrace }, /* 45 = ktrace */ #else - { 0, nosys }, /* 45 = ktrace */ #endif - { 3, sigaction }, /* 46 = sigaction */ - { 0, getgid }, /* 47 = getgid */ - { 2, sigprocmask }, /* 48 = sigprocmask */ - { 2, getlogin }, /* 49 = getlogin */ - { 1, setlogin }, /* 50 = setlogin */ - { 1, acct }, /* 51 = acct */ - { 0, sigpending }, /* 52 = sigpending */ - { 2, sigaltstack }, /* 53 = sigaltstack */ - { 3, ioctl }, /* 54 = ioctl */ - { 1, reboot }, /* 55 = reboot */ - { 1, revoke }, /* 56 = revoke */ - { 2, symlink }, /* 57 = symlink */ - { 3, readlink }, /* 58 = readlink */ - { 3, execve }, /* 59 = execve */ - { 1, umask }, /* 60 = umask */ - { 1, chroot }, /* 61 = chroot */ - { compat(2,fstat) }, /* 62 = old fstat */ - { compat(4,getkerninfo) }, /* 63 = old getkerninfo */ - { compat(0,getpagesize) }, /* 64 = old getpagesize */ - { 2, msync }, /* 65 = msync */ - { 0, vfork }, /* 66 = vfork */ - { 0, nosys }, /* 67 = obsolete vread */ - { 0, nosys }, /* 68 = obsolete vwrite */ - { 1, sbrk }, /* 69 = sbrk */ - { 1, sstk }, /* 70 = sstk */ - { compat(7,mmap) }, /* 71 = old mmap */ - { 1, ovadvise }, /* 72 = vadvise */ - { 2, munmap }, /* 73 = munmap */ - { 3, mprotect }, /* 74 = mprotect */ - { 3, madvise }, /* 75 = madvise */ - { 0, nosys }, /* 76 = obsolete vhangup */ - { 0, nosys }, /* 77 = obsolete vlimit */ - { 3, mincore }, /* 78 = mincore */ - { 2, getgroups }, /* 79 = getgroups */ - { 2, setgroups }, /* 80 = setgroups */ - { 0, getpgrp }, /* 81 = getpgrp */ - { 2, setpgid }, /* 82 = setpgid */ - { 3, setitimer }, /* 83 = setitimer */ - { compat(0,wait) }, /* 84 = old wait */ - { 1, swapon }, /* 85 = swapon */ - { 2, getitimer }, /* 86 = getitimer */ - { compat(2,gethostname) }, /* 87 = old gethostname */ - { compat(2,sethostname) }, /* 88 = old sethostname */ - { compat(0,getdtablesize) }, /* 89 = old getdtablesize */ - { 2, dup2 }, /* 90 = dup2 */ - { 0, nosys }, /* 91 = getdopt */ - { 3, fcntl }, /* 92 = fcntl */ - { 5, select }, /* 93 = select */ - { 0, nosys }, /* 94 = setdopt */ - { 1, fsync }, /* 95 = fsync */ - { 3, setpriority }, /* 96 = setpriority */ - { 3, socket }, /* 97 = socket */ - { 3, connect }, /* 98 = connect */ - { compat(3,accept) }, /* 99 = old accept */ - { 2, getpriority }, /* 100 = getpriority */ - { compat(4,send) }, /* 101 = old send */ - { compat(4,recv) }, /* 102 = old recv */ - { 1, sigreturn }, /* 103 = sigreturn */ - { 3, bind }, /* 104 = bind */ - { 5, setsockopt }, /* 105 = setsockopt */ - { 2, listen }, /* 106 = listen */ - { 0, nosys }, /* 107 = obsolete vtimes */ - { compat(3,sigvec) }, /* 108 = old sigvec */ - { compat(1,sigblock) }, /* 109 = old sigblock */ - { compat(1,sigsetmask) }, /* 110 = old sigsetmask */ - { 1, sigsuspend }, /* 111 = sigsuspend */ - { compat(2,sigstack) }, /* 112 = old sigstack */ - { compat(3,recvmsg) }, /* 113 = old recvmsg */ - { compat(3,sendmsg) }, /* 114 = old sendmsg */ #ifdef TRACE - { 2, vtrace }, /* 115 = vtrace */ #else - { 0, nosys }, /* 115 = obsolete vtrace */ #endif - { 2, gettimeofday }, /* 116 = gettimeofday */ - { 2, getrusage }, /* 117 = getrusage */ - { 5, getsockopt }, /* 118 = getsockopt */ #ifdef vax - { 1, resuba }, /* 119 = resuba */ #else - { 0, nosys }, /* 119 = nosys */ #endif - { 3, readv }, /* 120 = readv */ - { 3, writev }, /* 121 = writev */ - { 2, settimeofday }, /* 122 = settimeofday */ - { 3, fchown }, /* 123 = fchown */ - { 2, fchmod }, /* 124 = fchmod */ - { compat(6,recvfrom) }, /* 125 = old recvfrom */ - { compat(2,setreuid) }, /* 126 = old setreuid */ - { compat(2,setregid) }, /* 127 = old setregid */ - { 2, rename }, /* 128 = rename */ - { compat(2,truncate) }, /* 129 = old truncate */ - { compat(2,ftruncate) }, /* 130 = old ftruncate */ - { 2, flock }, /* 131 = flock */ - { 2, mkfifo }, /* 132 = mkfifo */ - { 6, sendto }, /* 133 = sendto */ - { 2, shutdown }, /* 134 = shutdown */ - { 5, socketpair }, /* 135 = socketpair */ - { 2, mkdir }, /* 136 = mkdir */ - { 1, rmdir }, /* 137 = rmdir */ - { 2, utimes }, /* 138 = utimes */ - { 0, nosys }, /* 139 = obsolete 4.2 sigreturn */ - { 2, adjtime }, /* 140 = adjtime */ - { compat(3,getpeername) }, /* 141 = old getpeername */ - { compat(0,gethostid) }, /* 142 = old gethostid */ - { compat(1,sethostid) }, /* 143 = old sethostid */ - { compat(2,getrlimit) }, /* 144 = old getrlimit */ - { compat(2,setrlimit) }, /* 145 = old setrlimit */ - { compat(2,killpg) }, /* 146 = old killpg */ - { 0, setsid }, /* 147 = setsid */ - { 4, quotactl }, /* 148 = quotactl */ - { compat(4,quota) }, /* 149 = old quota */ - { compat(3,getsockname) }, /* 150 = old getsockname */ - { 0, nosys }, /* 151 = nosys */ - { 0, nosys }, /* 152 = nosys */ - { 0, nosys }, /* 153 = nosys */ - { 0, nosys }, /* 154 = nosys */ #if defined(NFSCLIENT) || defined(NFSSERVER) - { 2, nfssvc }, /* 155 = nfssvc */ #else - { 0, nosys }, /* 155 = nosys */ #endif - { compat(4,getdirentries) }, /* 156 = old getdirentries */ - { 2, statfs }, /* 157 = statfs */ - { 2, fstatfs }, /* 158 = fstatfs */ - { 0, nosys }, /* 159 = nosys */ - { 0, nosys }, /* 160 = nosys */ #ifdef NFSCLIENT - { 2, getfh }, /* 161 = getfh */ #else - { 0, nosys }, /* 161 = nosys */ #endif - { ncompat(2,getdomainname) }, /* 162 = old getdomainname */ - { ncompat(2,setdomainname) }, /* 163 = old setdomainname */ - { ncompat(1,uname) }, /* 164 = old uname */ - { 2, sysarch }, /* 165 = sysarch */ - { 0, nosys }, /* 166 = nosys */ - { 0, nosys }, /* 167 = nosys */ - { 0, nosys }, /* 168 = nosys */ -#ifdef SYSVSEM - { 5, semsys }, /* 169 = semsys */ +int compat_09(getdomainname)(); +int compat_09(setdomainname)(); +int compat_09(uname)(); +#if defined(SYSVSEM) && !defined(alpha) +#else +#endif +#if defined(SYSVMSG) && !defined(alpha) +#else +#endif +#if defined(SYSVSHM) && !defined(alpha) +#else +#endif +#ifdef LFS +#else +#endif +#ifdef LKM +#else /* !LKM */ +#endif /* !LKM */ +#ifdef SYSVSEM #else - { 0, nosys }, /* 169 = nosys */ #endif #ifdef SYSVMSG - { 6, msgsys }, /* 170 = msgsys */ #else - { 0, nosys }, /* 170 = nosys */ #endif #ifdef SYSVSHM - { 4, shmsys }, /* 171 = shmsys */ #else - { 0, nosys }, /* 171 = nosys */ #endif - { 0, nosys }, /* 172 = nosys */ - { 0, nosys }, /* 173 = nosys */ - { 0, nosys }, /* 174 = nosys */ - { 0, nosys }, /* 175 = nosys */ - { 0, nosys }, /* 176 = nosys */ - { 0, nosys }, /* 177 = nosys */ - { 0, nosys }, /* 178 = nosys */ - { 0, nosys }, /* 179 = nosys */ - { 0, nosys }, /* 180 = nosys */ - { 1, setgid }, /* 181 = setgid */ - { 1, setegid }, /* 182 = setegid */ - { 1, seteuid }, /* 183 = seteuid */ + +#else /* COMPAT_09 */ +#define compat_09(func) nosys +#endif /* COMPAT_09 */ + + +#ifdef COMPAT_10 +#define compat_10(func) __CONCAT(compat_10_,func) + +#ifdef KTRACE +#else +#endif +#ifdef TRACE +#else +#endif +#ifdef vax +#else +#endif +#if defined(NFSCLIENT) || defined(NFSSERVER) +#else +#endif +#ifdef NFSCLIENT +#else +#endif +#if defined(SYSVSEM) && !defined(alpha) +int compat_10(semsys)(); +#else +#endif +#if defined(SYSVMSG) && !defined(alpha) +int compat_10(msgsys)(); +#else +#endif +#if defined(SYSVSHM) && !defined(alpha) +int compat_10(shmsys)(); +#else +#endif #ifdef LFS - { 3, lfs_bmapv }, /* 184 = lfs_bmapv */ - { 3, lfs_markv }, /* 185 = lfs_markv */ - { 2, lfs_segclean }, /* 186 = lfs_segclean */ - { 2, lfs_segwait }, /* 187 = lfs_segwait */ #else - { 0, nosys }, /* 184 = nosys */ - { 0, nosys }, /* 185 = nosys */ - { 0, nosys }, /* 186 = nosys */ - { 0, nosys }, /* 187 = nosys */ #endif - { 2, stat }, /* 188 = stat */ - { 2, fstat }, /* 189 = fstat */ - { 2, lstat }, /* 190 = lstat */ - { 2, pathconf }, /* 191 = pathconf */ - { 2, fpathconf }, /* 192 = fpathconf */ - { 0, nosys }, /* 193 = nosys */ - { 2, getrlimit }, /* 194 = getrlimit */ - { 2, setrlimit }, /* 195 = setrlimit */ - { 4, getdirentries }, /* 196 = getdirentries */ - { 8, mmap }, /* 197 = mmap */ - { 0, nosys }, /* 198 = __syscall */ - { 5, lseek }, /* 199 = lseek */ - { 4, truncate }, /* 200 = truncate */ - { 4, ftruncate }, /* 201 = ftruncate */ - { 6, __sysctl }, /* 202 = __sysctl */ - { 2, mlock }, /* 203 = mlock */ - { 2, munlock }, /* 204 = munlock */ - { 0, nosys }, /* 205 = nosys */ - { 0, nosys }, /* 206 = nosys */ - { 0, nosys }, /* 207 = nosys */ - { 0, nosys }, /* 208 = nosys */ - { 0, nosys }, /* 209 = nosys */ #ifdef LKM - { 0, lkmnosys }, /* 210 = lkmnosys */ - { 0, lkmnosys }, /* 211 = lkmnosys */ - { 0, lkmnosys }, /* 212 = lkmnosys */ - { 0, lkmnosys }, /* 213 = lkmnosys */ - { 0, lkmnosys }, /* 214 = lkmnosys */ - { 0, lkmnosys }, /* 215 = lkmnosys */ - { 0, lkmnosys }, /* 216 = lkmnosys */ - { 0, lkmnosys }, /* 217 = lkmnosys */ - { 0, lkmnosys }, /* 218 = lkmnosys */ - { 0, lkmnosys }, /* 219 = lkmnosys */ #else /* !LKM */ - { 0, nosys }, /* 210 = nosys */ - { 0, nosys }, /* 211 = nosys */ - { 0, nosys }, /* 212 = nosys */ - { 0, nosys }, /* 213 = nosys */ - { 0, nosys }, /* 214 = nosys */ - { 0, nosys }, /* 215 = nosys */ - { 0, nosys }, /* 216 = nosys */ - { 0, nosys }, /* 217 = nosys */ - { 0, nosys }, /* 218 = nosys */ - { 0, nosys }, /* 219 = nosys */ #endif /* !LKM */ +#ifdef SYSVSEM +#else +#endif +#ifdef SYSVMSG +#else +#endif +#ifdef SYSVSHM +#else +#endif + +#else /* COMPAT_10 */ +#define compat_10(func) nosys +#endif /* COMPAT_10 */ + +#define s(type) sizeof(type) + +struct sysent sysent[] = { + { 0, 0, + nosys }, /* 0 = syscall */ + { 1, s(struct exit_args), + exit }, /* 1 = exit */ + { 0, 0, + fork }, /* 2 = fork */ + { 3, s(struct read_args), + read }, /* 3 = read */ + { 3, s(struct write_args), + write }, /* 4 = write */ + { 3, s(struct open_args), + open }, /* 5 = open */ + { 1, s(struct close_args), + close }, /* 6 = close */ + { 4, s(struct wait4_args), + wait4 }, /* 7 = wait4 */ + { 2, s(struct compat_43_creat_args), + compat_43(creat) }, /* 8 = compat_43 creat */ + { 2, s(struct link_args), + link }, /* 9 = link */ + { 1, s(struct unlink_args), + unlink }, /* 10 = unlink */ + { 0, 0, + nosys }, /* 11 = obsolete execv */ + { 1, s(struct chdir_args), + chdir }, /* 12 = chdir */ + { 1, s(struct fchdir_args), + fchdir }, /* 13 = fchdir */ + { 3, s(struct mknod_args), + mknod }, /* 14 = mknod */ + { 2, s(struct chmod_args), + chmod }, /* 15 = chmod */ + { 3, s(struct chown_args), + chown }, /* 16 = chown */ + { 1, s(struct obreak_args), + obreak }, /* 17 = break */ + { 3, s(struct getfsstat_args), + getfsstat }, /* 18 = getfsstat */ + { 3, s(struct compat_43_lseek_args), + compat_43(lseek) }, /* 19 = compat_43 lseek */ + { 0, 0, + getpid }, /* 20 = getpid */ + { 4, s(struct mount_args), + mount }, /* 21 = mount */ + { 2, s(struct unmount_args), + unmount }, /* 22 = unmount */ + { 1, s(struct setuid_args), + setuid }, /* 23 = setuid */ + { 0, 0, + getuid }, /* 24 = getuid */ + { 0, 0, + geteuid }, /* 25 = geteuid */ + { 4, s(struct ptrace_args), + ptrace }, /* 26 = ptrace */ + { 3, s(struct recvmsg_args), + recvmsg }, /* 27 = recvmsg */ + { 3, s(struct sendmsg_args), + sendmsg }, /* 28 = sendmsg */ + { 6, s(struct recvfrom_args), + recvfrom }, /* 29 = recvfrom */ + { 3, s(struct accept_args), + accept }, /* 30 = accept */ + { 3, s(struct getpeername_args), + getpeername }, /* 31 = getpeername */ + { 3, s(struct getsockname_args), + getsockname }, /* 32 = getsockname */ + { 2, s(struct access_args), + access }, /* 33 = access */ + { 2, s(struct chflags_args), + chflags }, /* 34 = chflags */ + { 2, s(struct fchflags_args), + fchflags }, /* 35 = fchflags */ + { 0, 0, + sync }, /* 36 = sync */ + { 2, s(struct kill_args), + kill }, /* 37 = kill */ + { 2, s(struct compat_43_stat_args), + compat_43(stat) }, /* 38 = compat_43 stat */ + { 0, 0, + getppid }, /* 39 = getppid */ + { 2, s(struct compat_43_lstat_args), + compat_43(lstat) }, /* 40 = compat_43 lstat */ + { 1, s(struct dup_args), + dup }, /* 41 = dup */ + { 0, 0, + pipe }, /* 42 = pipe */ + { 0, 0, + getegid }, /* 43 = getegid */ + { 4, s(struct profil_args), + profil }, /* 44 = profil */ +#ifdef KTRACE + { 4, s(struct ktrace_args), + ktrace }, /* 45 = ktrace */ +#else + { 0, 0, + nosys }, /* 45 = unimplemented ktrace */ +#endif + { 3, s(struct sigaction_args), + sigaction }, /* 46 = sigaction */ + { 0, 0, + getgid }, /* 47 = getgid */ + { 2, s(struct sigprocmask_args), + sigprocmask }, /* 48 = sigprocmask */ + { 2, s(struct getlogin_args), + getlogin }, /* 49 = getlogin */ + { 1, s(struct setlogin_args), + setlogin }, /* 50 = setlogin */ + { 1, s(struct acct_args), + acct }, /* 51 = acct */ + { 0, 0, + sigpending }, /* 52 = sigpending */ + { 2, s(struct sigaltstack_args), + sigaltstack }, /* 53 = sigaltstack */ + { 3, s(struct ioctl_args), + ioctl }, /* 54 = ioctl */ + { 1, s(struct reboot_args), + reboot }, /* 55 = reboot */ + { 1, s(struct revoke_args), + revoke }, /* 56 = revoke */ + { 2, s(struct symlink_args), + symlink }, /* 57 = symlink */ + { 3, s(struct readlink_args), + readlink }, /* 58 = readlink */ + { 3, s(struct execve_args), + execve }, /* 59 = execve */ + { 1, s(struct umask_args), + umask }, /* 60 = umask */ + { 1, s(struct chroot_args), + chroot }, /* 61 = chroot */ + { 2, s(struct compat_43_fstat_args), + compat_43(fstat) }, /* 62 = compat_43 fstat */ + { 4, s(struct compat_43_getkerninfo_args), + compat_43(getkerninfo) }, /* 63 = compat_43 getkerninfo */ + { 0, 0, + compat_43(getpagesize) }, /* 64 = compat_43 getpagesize */ + { 2, s(struct msync_args), + msync }, /* 65 = msync */ + { 0, 0, + vfork }, /* 66 = vfork */ + { 0, 0, + nosys }, /* 67 = obsolete vread */ + { 0, 0, + nosys }, /* 68 = obsolete vwrite */ + { 1, s(struct sbrk_args), + sbrk }, /* 69 = sbrk */ + { 1, s(struct sstk_args), + sstk }, /* 70 = sstk */ + { 6, s(struct compat_43_mmap_args), + compat_43(mmap) }, /* 71 = compat_43 mmap */ + { 1, s(struct ovadvise_args), + ovadvise }, /* 72 = vadvise */ + { 2, s(struct munmap_args), + munmap }, /* 73 = munmap */ + { 3, s(struct mprotect_args), + mprotect }, /* 74 = mprotect */ + { 3, s(struct madvise_args), + madvise }, /* 75 = madvise */ + { 0, 0, + nosys }, /* 76 = obsolete vhangup */ + { 0, 0, + nosys }, /* 77 = obsolete vlimit */ + { 3, s(struct mincore_args), + mincore }, /* 78 = mincore */ + { 2, s(struct getgroups_args), + getgroups }, /* 79 = getgroups */ + { 2, s(struct setgroups_args), + setgroups }, /* 80 = setgroups */ + { 0, 0, + getpgrp }, /* 81 = getpgrp */ + { 2, s(struct setpgid_args), + setpgid }, /* 82 = setpgid */ + { 3, s(struct setitimer_args), + setitimer }, /* 83 = setitimer */ + { 0, 0, + compat_43(wait) }, /* 84 = compat_43 wait */ + { 1, s(struct swapon_args), + swapon }, /* 85 = swapon */ + { 2, s(struct getitimer_args), + getitimer }, /* 86 = getitimer */ + { 2, s(struct compat_43_gethostname_args), + compat_43(gethostname) }, /* 87 = compat_43 gethostname */ + { 2, s(struct compat_43_sethostname_args), + compat_43(sethostname) }, /* 88 = compat_43 sethostname */ + { 0, 0, + compat_43(getdtablesize) }, /* 89 = compat_43 getdtablesize */ + { 2, s(struct dup2_args), + dup2 }, /* 90 = dup2 */ + { 0, 0, + nosys }, /* 91 = unimplemented getdopt */ + { 3, s(struct fcntl_args), + fcntl }, /* 92 = fcntl */ + { 5, s(struct select_args), + select }, /* 93 = select */ + { 0, 0, + nosys }, /* 94 = unimplemented setdopt */ + { 1, s(struct fsync_args), + fsync }, /* 95 = fsync */ + { 3, s(struct setpriority_args), + setpriority }, /* 96 = setpriority */ + { 3, s(struct socket_args), + socket }, /* 97 = socket */ + { 3, s(struct connect_args), + connect }, /* 98 = connect */ + { 3, s(struct compat_43_accept_args), + compat_43(accept) }, /* 99 = compat_43 accept */ + { 2, s(struct getpriority_args), + getpriority }, /* 100 = getpriority */ + { 4, s(struct compat_43_send_args), + compat_43(send) }, /* 101 = compat_43 send */ + { 4, s(struct compat_43_recv_args), + compat_43(recv) }, /* 102 = compat_43 recv */ + { 1, s(struct sigreturn_args), + sigreturn }, /* 103 = sigreturn */ + { 3, s(struct bind_args), + bind }, /* 104 = bind */ + { 5, s(struct setsockopt_args), + setsockopt }, /* 105 = setsockopt */ + { 2, s(struct listen_args), + listen }, /* 106 = listen */ + { 0, 0, + nosys }, /* 107 = obsolete vtimes */ + { 3, s(struct compat_43_sigvec_args), + compat_43(sigvec) }, /* 108 = compat_43 sigvec */ + { 1, s(struct compat_43_sigblock_args), + compat_43(sigblock) }, /* 109 = compat_43 sigblock */ + { 1, s(struct compat_43_sigsetmask_args), + compat_43(sigsetmask) }, /* 110 = compat_43 sigsetmask */ + { 1, s(struct sigsuspend_args), + sigsuspend }, /* 111 = sigsuspend */ + { 2, s(struct compat_43_sigstack_args), + compat_43(sigstack) }, /* 112 = compat_43 sigstack */ + { 3, s(struct compat_43_recvmsg_args), + compat_43(recvmsg) }, /* 113 = compat_43 recvmsg */ + { 3, s(struct compat_43_sendmsg_args), + compat_43(sendmsg) }, /* 114 = compat_43 sendmsg */ +#ifdef TRACE + { 2, s(struct vtrace_args), + vtrace }, /* 115 = vtrace */ +#else + { 0, 0, + nosys }, /* 115 = obsolete vtrace */ +#endif + { 2, s(struct gettimeofday_args), + gettimeofday }, /* 116 = gettimeofday */ + { 2, s(struct getrusage_args), + getrusage }, /* 117 = getrusage */ + { 5, s(struct getsockopt_args), + getsockopt }, /* 118 = getsockopt */ +#ifdef vax + { 1, s(struct resuba_args), + resuba }, /* 119 = resuba */ +#else + { 0, 0, + nosys }, /* 119 = unimplemented resuba */ +#endif + { 3, s(struct readv_args), + readv }, /* 120 = readv */ + { 3, s(struct writev_args), + writev }, /* 121 = writev */ + { 2, s(struct settimeofday_args), + settimeofday }, /* 122 = settimeofday */ + { 3, s(struct fchown_args), + fchown }, /* 123 = fchown */ + { 2, s(struct fchmod_args), + fchmod }, /* 124 = fchmod */ + { 6, s(struct compat_43_recvfrom_args), + compat_43(recvfrom) }, /* 125 = compat_43 recvfrom */ + { 2, s(struct compat_43_setreuid_args), + compat_43(setreuid) }, /* 126 = compat_43 setreuid */ + { 2, s(struct compat_43_setregid_args), + compat_43(setregid) }, /* 127 = compat_43 setregid */ + { 2, s(struct rename_args), + rename }, /* 128 = rename */ + { 2, s(struct compat_43_truncate_args), + compat_43(truncate) }, /* 129 = compat_43 truncate */ + { 2, s(struct compat_43_ftruncate_args), + compat_43(ftruncate) }, /* 130 = compat_43 ftruncate */ + { 2, s(struct flock_args), + flock }, /* 131 = flock */ + { 2, s(struct mkfifo_args), + mkfifo }, /* 132 = mkfifo */ + { 6, s(struct sendto_args), + sendto }, /* 133 = sendto */ + { 2, s(struct shutdown_args), + shutdown }, /* 134 = shutdown */ + { 4, s(struct socketpair_args), + socketpair }, /* 135 = socketpair */ + { 2, s(struct mkdir_args), + mkdir }, /* 136 = mkdir */ + { 1, s(struct rmdir_args), + rmdir }, /* 137 = rmdir */ + { 2, s(struct utimes_args), + utimes }, /* 138 = utimes */ + { 0, 0, + nosys }, /* 139 = obsolete 4.2 sigreturn */ + { 2, s(struct adjtime_args), + adjtime }, /* 140 = adjtime */ + { 3, s(struct compat_43_getpeername_args), + compat_43(getpeername) }, /* 141 = compat_43 getpeername */ + { 0, 0, + compat_43(gethostid) }, /* 142 = compat_43 gethostid */ + { 1, s(struct compat_43_sethostid_args), + compat_43(sethostid) }, /* 143 = compat_43 sethostid */ + { 2, s(struct compat_43_getrlimit_args), + compat_43(getrlimit) }, /* 144 = compat_43 getrlimit */ + { 2, s(struct compat_43_setrlimit_args), + compat_43(setrlimit) }, /* 145 = compat_43 setrlimit */ + { 2, s(struct compat_43_killpg_args), + compat_43(killpg) }, /* 146 = compat_43 killpg */ + { 0, 0, + setsid }, /* 147 = setsid */ + { 4, s(struct quotactl_args), + quotactl }, /* 148 = quotactl */ + { 0, 0, + compat_43(quota) }, /* 149 = compat_43 quota */ + { 3, s(struct compat_43_getsockname_args), + compat_43(getsockname) }, /* 150 = compat_43 getsockname */ + { 0, 0, + nosys }, /* 151 = unimplemented */ + { 0, 0, + nosys }, /* 152 = unimplemented */ + { 0, 0, + nosys }, /* 153 = unimplemented */ + { 0, 0, + nosys }, /* 154 = unimplemented */ +#if defined(NFSCLIENT) || defined(NFSSERVER) + { 2, s(struct nfssvc_args), + nfssvc }, /* 155 = nfssvc */ +#else + { 0, 0, + nosys }, /* 155 = unimplemented */ +#endif + { 4, s(struct compat_43_getdirentries_args), + compat_43(getdirentries) }, /* 156 = compat_43 getdirentries */ + { 2, s(struct statfs_args), + statfs }, /* 157 = statfs */ + { 2, s(struct fstatfs_args), + fstatfs }, /* 158 = fstatfs */ + { 0, 0, + nosys }, /* 159 = unimplemented */ + { 0, 0, + nosys }, /* 160 = unimplemented */ +#ifdef NFSCLIENT + { 2, s(struct getfh_args), + getfh }, /* 161 = getfh */ +#else + { 0, 0, + nosys }, /* 161 = unimplemented getfh */ +#endif + { 2, s(struct compat_09_getdomainname_args), + compat_09(getdomainname) }, /* 162 = compat_09 getdomainname */ + { 2, s(struct compat_09_setdomainname_args), + compat_09(setdomainname) }, /* 163 = compat_09 setdomainname */ + { 1, s(struct compat_09_uname_args), + compat_09(uname) }, /* 164 = compat_09 uname */ + { 2, s(struct sysarch_args), + sysarch }, /* 165 = sysarch */ + { 0, 0, + nosys }, /* 166 = unimplemented */ + { 0, 0, + nosys }, /* 167 = unimplemented */ + { 0, 0, + nosys }, /* 168 = unimplemented */ +#if defined(SYSVSEM) && !defined(alpha) + { 5, s(struct compat_10_semsys_args), + compat_10(semsys) }, /* 169 = compat_10 semsys */ +#else + { 0, 0, + nosys }, /* 169 = unimplemented 1.0 semsys */ +#endif +#if defined(SYSVMSG) && !defined(alpha) + { 6, s(struct compat_10_msgsys_args), + compat_10(msgsys) }, /* 170 = compat_10 msgsys */ +#else + { 0, 0, + nosys }, /* 170 = unimplemented 1.0 msgsys */ +#endif +#if defined(SYSVSHM) && !defined(alpha) + { 4, s(struct compat_10_shmsys_args), + compat_10(shmsys) }, /* 171 = compat_10 shmsys */ +#else + { 0, 0, + nosys }, /* 171 = unimplemented 1.0 shmsys */ +#endif + { 0, 0, + nosys }, /* 172 = unimplemented */ + { 0, 0, + nosys }, /* 173 = unimplemented */ + { 0, 0, + nosys }, /* 174 = unimplemented */ + { 0, 0, + nosys }, /* 175 = unimplemented */ + { 0, 0, + nosys }, /* 176 = unimplemented */ + { 0, 0, + nosys }, /* 177 = unimplemented */ + { 0, 0, + nosys }, /* 178 = unimplemented */ + { 0, 0, + nosys }, /* 179 = unimplemented */ + { 0, 0, + nosys }, /* 180 = unimplemented */ + { 1, s(struct setgid_args), + setgid }, /* 181 = setgid */ + { 1, s(struct setegid_args), + setegid }, /* 182 = setegid */ + { 1, s(struct seteuid_args), + seteuid }, /* 183 = seteuid */ +#ifdef LFS + { 3, s(struct lfs_bmapv_args), + lfs_bmapv }, /* 184 = lfs_bmapv */ + { 3, s(struct lfs_markv_args), + lfs_markv }, /* 185 = lfs_markv */ + { 2, s(struct lfs_segclean_args), + lfs_segclean }, /* 186 = lfs_segclean */ + { 2, s(struct lfs_segwait_args), + lfs_segwait }, /* 187 = lfs_segwait */ +#else + { 0, 0, + nosys }, /* 184 = unimplemented */ + { 0, 0, + nosys }, /* 185 = unimplemented */ + { 0, 0, + nosys }, /* 186 = unimplemented */ + { 0, 0, + nosys }, /* 187 = unimplemented */ +#endif + { 2, s(struct stat_args), + stat }, /* 188 = stat */ + { 2, s(struct fstat_args), + fstat }, /* 189 = fstat */ + { 2, s(struct lstat_args), + lstat }, /* 190 = lstat */ + { 2, s(struct pathconf_args), + pathconf }, /* 191 = pathconf */ + { 2, s(struct fpathconf_args), + fpathconf }, /* 192 = fpathconf */ + { 0, 0, + nosys }, /* 193 = unimplemented */ + { 2, s(struct getrlimit_args), + getrlimit }, /* 194 = getrlimit */ + { 2, s(struct setrlimit_args), + setrlimit }, /* 195 = setrlimit */ + { 4, s(struct getdirentries_args), + getdirentries }, /* 196 = getdirentries */ + { 7, s(struct mmap_args), + mmap }, /* 197 = mmap */ + { 0, 0, + nosys }, /* 198 = __syscall */ + { 4, s(struct lseek_args), + lseek }, /* 199 = lseek */ + { 3, s(struct truncate_args), + truncate }, /* 200 = truncate */ + { 3, s(struct ftruncate_args), + ftruncate }, /* 201 = ftruncate */ + { 6, s(struct __sysctl_args), + __sysctl }, /* 202 = __sysctl */ + { 2, s(struct mlock_args), + mlock }, /* 203 = mlock */ + { 2, s(struct munlock_args), + munlock }, /* 204 = munlock */ + { 0, 0, + nosys }, /* 205 = unimplemented */ + { 0, 0, + nosys }, /* 206 = unimplemented */ + { 0, 0, + nosys }, /* 207 = unimplemented */ + { 0, 0, + nosys }, /* 208 = unimplemented */ + { 0, 0, + nosys }, /* 209 = unimplemented */ +#ifdef LKM + { 0, 0, + lkmnosys }, /* 210 = lkmnosys */ + { 0, 0, + lkmnosys }, /* 211 = lkmnosys */ + { 0, 0, + lkmnosys }, /* 212 = lkmnosys */ + { 0, 0, + lkmnosys }, /* 213 = lkmnosys */ + { 0, 0, + lkmnosys }, /* 214 = lkmnosys */ + { 0, 0, + lkmnosys }, /* 215 = lkmnosys */ + { 0, 0, + lkmnosys }, /* 216 = lkmnosys */ + { 0, 0, + lkmnosys }, /* 217 = lkmnosys */ + { 0, 0, + lkmnosys }, /* 218 = lkmnosys */ + { 0, 0, + lkmnosys }, /* 219 = lkmnosys */ +#else /* !LKM */ + { 0, 0, + nosys }, /* 210 = unimplemented */ + { 0, 0, + nosys }, /* 211 = unimplemented */ + { 0, 0, + nosys }, /* 212 = unimplemented */ + { 0, 0, + nosys }, /* 213 = unimplemented */ + { 0, 0, + nosys }, /* 214 = unimplemented */ + { 0, 0, + nosys }, /* 215 = unimplemented */ + { 0, 0, + nosys }, /* 216 = unimplemented */ + { 0, 0, + nosys }, /* 217 = unimplemented */ + { 0, 0, + nosys }, /* 218 = unimplemented */ + { 0, 0, + nosys }, /* 219 = unimplemented */ +#endif /* !LKM */ +#ifdef SYSVSEM + { 4, s(struct __semctl_args), + __semctl }, /* 220 = __semctl */ + { 3, s(struct semget_args), + semget }, /* 221 = semget */ + { 3, s(struct semop_args), + semop }, /* 222 = semop */ + { 1, s(struct semconfig_args), + semconfig }, /* 223 = semconfig */ +#else + { 0, 0, + nosys }, /* 220 = unimplemented semctl */ + { 0, 0, + nosys }, /* 221 = unimplemented semget */ + { 0, 0, + nosys }, /* 222 = unimplemented semop */ + { 0, 0, + nosys }, /* 223 = unimplemented semconfig */ +#endif +#ifdef SYSVMSG + { 3, s(struct msgctl_args), + msgctl }, /* 224 = msgctl */ + { 2, s(struct msgget_args), + msgget }, /* 225 = msgget */ + { 4, s(struct msgsnd_args), + msgsnd }, /* 226 = msgsnd */ + { 5, s(struct msgrcv_args), + msgrcv }, /* 227 = msgrcv */ +#else + { 0, 0, + nosys }, /* 224 = unimplemented msgctl */ + { 0, 0, + nosys }, /* 225 = unimplemented msgget */ + { 0, 0, + nosys }, /* 226 = unimplemented msgsnd */ + { 0, 0, + nosys }, /* 227 = unimplemented msgrcv */ +#endif +#ifdef SYSVSHM + { 3, s(struct shmat_args), + shmat }, /* 228 = shmat */ + { 3, s(struct shmctl_args), + shmctl }, /* 229 = shmctl */ + { 1, s(struct shmdt_args), + shmdt }, /* 230 = shmdt */ + { 3, s(struct shmget_args), + shmget }, /* 231 = shmget */ +#else + { 0, 0, + nosys }, /* 228 = unimplemented shmat */ + { 0, 0, + nosys }, /* 229 = unimplemented shmctl */ + { 0, 0, + nosys }, /* 230 = unimplemented shmdt */ + { 0, 0, + nosys }, /* 231 = unimplemented shmget */ +#endif }; -int nsysent = sizeof(sysent) / sizeof(sysent[0]); +int nsysent= sizeof(sysent) / sizeof(sysent[0]); diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c index 16a0c49c1108..5136abf14954 100644 --- a/sys/kern/kern_acct.c +++ b/sys/kern/kern_acct.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_acct.c,v 1.32 1994/07/04 20:43:06 mycroft Exp $ */ +/* $NetBSD: kern_acct.c,v 1.33 1994/10/20 04:22:39 cgd Exp $ */ /*- * Copyright (c) 1994 Christopher G. Demetriou @@ -42,6 +42,7 @@ */ #include +#include #include #include #include @@ -55,6 +56,8 @@ #include #include +#include + /* * The routines implemented in this file are described in: * Leffler, et al.: The Design and Implementation of the 4.3BSD @@ -91,13 +94,12 @@ int acctchkfreq = 15; /* frequency (in seconds) to check space */ * Accounting system call. Written based on the specification and * previous implementation done by Mark Tinguely. */ -struct acct_args { - char *path; -}; acct(p, uap, retval) struct proc *p; - struct acct_args *uap; - int *retval; + struct acct_args /* { + syscallarg(char *) path; + } */ *uap; + register_t *retval; { struct nameidata nd; int error; @@ -110,8 +112,9 @@ acct(p, uap, retval) * If accounting is to be started to a file, open that file for * writing and make sure it's a 'normal'. */ - if (uap->path != NULL) { - NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, p); + if (SCARG(uap, path) != NULL) { + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), + p); if (error = vn_open(&nd, FWRITE, 0)) return (error); VOP_UNLOCK(nd.ni_vp); @@ -131,7 +134,7 @@ acct(p, uap, retval) p->p_ucred, p); acctp = savacctp = NULLVP; } - if (uap->path == NULL) + if (SCARG(uap, path) == NULL) return (error); /* diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index a2d8b512be55..bfa065bc6b0c 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_descrip.c,v 1.24 1994/08/30 03:05:32 mycroft Exp $ */ +/* $NetBSD: kern_descrip.c,v 1.25 1994/10/20 04:22:41 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 @@ -57,6 +57,9 @@ #include #include +#include +#include + /* * Descriptor management. */ @@ -69,10 +72,10 @@ int nfiles; /* actual number of open files */ #if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_ULTRIX) || defined(COMPAT_HPUX) /* ARGSUSED */ -ogetdtablesize(p, uap, retval) +compat_43_getdtablesize(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { *retval = min((int)p->p_rlimit[RLIMIT_NOFILE].rlim_cur, maxfiles); @@ -83,24 +86,26 @@ ogetdtablesize(p, uap, retval) /* * Duplicate a file descriptor. */ -struct dup_args { - u_int fd; -}; /* ARGSUSED */ dup(p, uap, retval) struct proc *p; - struct dup_args *uap; - int *retval; + struct dup_args /* { + syscallarg(u_int) fd; + } */ *uap; + register_t *retval; { register struct filedesc *fdp; u_int old; int new, error; - old = uap->fd; + old = SCARG(uap, fd); /* * XXX Compatibility */ - if (old &~ 077) { uap->fd &= 077; return (dup2(p, uap, retval)); } + if (old &~ 077) { + SCARG(uap, fd) &= 077; + return (dup2(p, uap, retval)); + } fdp = p->p_fd; if (old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL) @@ -113,18 +118,17 @@ dup(p, uap, retval) /* * Duplicate a file descriptor to a particular value. */ -struct dup2_args { - u_int from; - u_int to; -}; /* ARGSUSED */ dup2(p, uap, retval) struct proc *p; - struct dup2_args *uap; - int *retval; + struct dup2_args /* { + syscallarg(u_int) from; + syscallarg(u_int) to; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; - register u_int old = uap->from, new = uap->to; + register u_int old = SCARG(uap, from), new = SCARG(uap, to); int i, error; if (old >= fdp->fd_nfiles || @@ -155,16 +159,15 @@ dup2(p, uap, retval) /* * The file control system call. */ -struct fcntl_args { - int fd; - int cmd; - int arg; -}; /* ARGSUSED */ fcntl(p, uap, retval) struct proc *p; - register struct fcntl_args *uap; - int *retval; + register struct fcntl_args /* { + syscallarg(int) fd; + syscallarg(int) cmd; + syscallarg(int) arg; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; register struct file *fp; @@ -174,27 +177,27 @@ fcntl(p, uap, retval) struct flock fl; u_int newmin; - if ((unsigned)uap->fd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL) + if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) return (EBADF); - pop = &fdp->fd_ofileflags[uap->fd]; - switch (uap->cmd) { + pop = &fdp->fd_ofileflags[SCARG(uap, fd)]; + switch (SCARG(uap, cmd)) { case F_DUPFD: - newmin = uap->arg; + newmin = (long)SCARG(uap, arg); if (newmin >= p->p_rlimit[RLIMIT_NOFILE].rlim_cur || newmin >= maxfiles) return (EINVAL); if (error = fdalloc(p, newmin, &i)) return (error); - return (finishdup(fdp, uap->fd, i, retval)); + return (finishdup(fdp, SCARG(uap, fd), i, retval)); case F_GETFD: *retval = *pop & 1; return (0); case F_SETFD: - *pop = (*pop &~ 1) | (uap->arg & 1); + *pop = (*pop &~ 1) | ((long)SCARG(uap, arg) & 1); return (0); case F_GETFL: @@ -203,7 +206,7 @@ fcntl(p, uap, retval) case F_SETFL: fp->f_flag &= ~FCNTLFLAGS; - fp->f_flag |= FFLAGS(uap->arg) & FCNTLFLAGS; + fp->f_flag |= FFLAGS((long)SCARG(uap, arg)) & FCNTLFLAGS; tmp = fp->f_flag & FNONBLOCK; error = (*fp->f_ops->fo_ioctl)(fp, FIONBIO, (caddr_t)&tmp, p); if (error) @@ -229,19 +232,20 @@ fcntl(p, uap, retval) case F_SETOWN: if (fp->f_type == DTYPE_SOCKET) { - ((struct socket *)fp->f_data)->so_pgid = uap->arg; + ((struct socket *)fp->f_data)->so_pgid = + (long)SCARG(uap, arg); return (0); } - if (uap->arg <= 0) { - uap->arg = -uap->arg; + if ((long)SCARG(uap, arg) <= 0) { + SCARG(uap, arg) = (void *)(-(long)SCARG(uap, arg)); } else { - struct proc *p1 = pfind(uap->arg); + struct proc *p1 = pfind((long)SCARG(uap, arg)); if (p1 == 0) return (ESRCH); - uap->arg = p1->p_pgrp->pg_id; + SCARG(uap, arg) = (void *)p1->p_pgrp->pg_id; } return ((*fp->f_ops->fo_ioctl) - (fp, (int)TIOCSPGRP, (caddr_t)&uap->arg, p)); + (fp, (int)TIOCSPGRP, (caddr_t)&SCARG(uap, arg), p)); case F_SETLKW: flg |= F_WAIT; @@ -252,7 +256,8 @@ fcntl(p, uap, retval) return (EBADF); vp = (struct vnode *)fp->f_data; /* Copy in the lock structure */ - error = copyin((caddr_t)uap->arg, (caddr_t)&fl, sizeof (fl)); + error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&fl, + sizeof (fl)); if (error) return (error); if (fl.l_whence == SEEK_CUR) @@ -284,14 +289,16 @@ fcntl(p, uap, retval) return (EBADF); vp = (struct vnode *)fp->f_data; /* Copy in the lock structure */ - error = copyin((caddr_t)uap->arg, (caddr_t)&fl, sizeof (fl)); + error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&fl, + sizeof (fl)); if (error) return (error); if (fl.l_whence == SEEK_CUR) fl.l_start += fp->f_offset; if (error = VOP_ADVLOCK(vp, (caddr_t)p, F_GETLK, &fl, F_POSIX)) return (error); - return (copyout((caddr_t)&fl, (caddr_t)uap->arg, sizeof (fl))); + return (copyout((caddr_t)&fl, (caddr_t)SCARG(uap, arg), + sizeof (fl))); default: return (EINVAL); @@ -305,7 +312,8 @@ fcntl(p, uap, retval) int finishdup(fdp, old, new, retval) register struct filedesc *fdp; - register int old, new, *retval; + register int old, new; + register_t *retval; { register struct file *fp; @@ -322,18 +330,17 @@ finishdup(fdp, old, new, retval) /* * Close a file descriptor. */ -struct close_args { - int fd; -}; /* ARGSUSED */ close(p, uap, retval) struct proc *p; - struct close_args *uap; - int *retval; + struct close_args /* { + syscallarg(int) fd; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; register struct file *fp; - register int fd = uap->fd; + register int fd = SCARG(uap, fd); register u_char *pf; if ((unsigned)fd >= fdp->fd_nfiles || @@ -355,15 +362,14 @@ close(p, uap, retval) /* * Return status information about a file descriptor. */ -struct ofstat_args { - int fd; - struct ostat *sb; -}; /* ARGSUSED */ -ofstat(p, uap, retval) +compat_43_fstat(p, uap, retval) struct proc *p; - register struct ofstat_args *uap; - int *retval; + register struct compat_43_fstat_args /* { + syscallarg(int) fd; + syscallarg(struct ostat *) sb; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; register struct file *fp; @@ -371,8 +377,8 @@ ofstat(p, uap, retval) struct ostat oub; int error; - if ((unsigned)uap->fd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL) + if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) return (EBADF); switch (fp->f_type) { @@ -390,7 +396,8 @@ ofstat(p, uap, retval) } cvtstat(&ub, &oub); if (error == 0) - error = copyout((caddr_t)&oub, (caddr_t)uap->sb, sizeof (oub)); + error = copyout((caddr_t)&oub, (caddr_t)SCARG(uap, sb), + sizeof (oub)); return (error); } #endif /* COMPAT_43 || COMPAT_SUNOS || COMPAT_IBCS2 */ @@ -398,23 +405,22 @@ ofstat(p, uap, retval) /* * Return status information about a file descriptor. */ -struct fstat_args { - int fd; - struct stat *sb; -}; /* ARGSUSED */ fstat(p, uap, retval) struct proc *p; - register struct fstat_args *uap; - int *retval; + register struct fstat_args /* { + syscallarg(int) fd; + syscallarg(struct stat *) sb; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; register struct file *fp; struct stat ub; int error; - if ((unsigned)uap->fd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL) + if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) return (EBADF); switch (fp->f_type) { @@ -431,34 +437,34 @@ fstat(p, uap, retval) /*NOTREACHED*/ } if (error == 0) - error = copyout((caddr_t)&ub, (caddr_t)uap->sb, sizeof (ub)); + error = copyout((caddr_t)&ub, (caddr_t)SCARG(uap, sb), + sizeof (ub)); return (error); } /* * Return pathconf information about a file descriptor. */ -struct fpathconf_args { - int fd; - int name; -}; /* ARGSUSED */ fpathconf(p, uap, retval) struct proc *p; - register struct fpathconf_args *uap; - int *retval; + register struct fpathconf_args /* { + syscallarg(int) fd; + syscallarg(int) name; + } */ *uap; + register_t *retval; { struct filedesc *fdp = p->p_fd; struct file *fp; struct vnode *vp; - if ((unsigned)uap->fd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL) + if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) return (EBADF); switch (fp->f_type) { case DTYPE_SOCKET: - if (uap->name != _PC_PIPE_BUF) + if (SCARG(uap, name) != _PC_PIPE_BUF) return (EINVAL); *retval = PIPE_BUF; return (0); @@ -466,7 +472,7 @@ fpathconf(p, uap, retval) case DTYPE_VNODE: vp = (struct vnode *)fp->f_data; #ifdef notyet - return (VOP_PATHCONF(vp, uap->name, retval)); + return (VOP_PATHCONF(vp, SCARG(uap, name), retval)); #else return (ENOSYS); #endif @@ -792,23 +798,22 @@ closef(fp, p) * Just attempt to get a record lock of the requested type on * the entire file (l_whence = SEEK_SET, l_start = 0, l_len = 0). */ -struct flock_args { - int fd; - int how; -}; /* ARGSUSED */ flock(p, uap, retval) struct proc *p; - register struct flock_args *uap; - int *retval; + register struct flock_args /* { + syscallarg(int) fd; + syscallarg(int) how; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; register struct file *fp; struct vnode *vp; struct flock lf; - if ((unsigned)uap->fd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL) + if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) return (EBADF); if (fp->f_type != DTYPE_VNODE) return (EOPNOTSUPP); @@ -816,19 +821,19 @@ flock(p, uap, retval) lf.l_whence = SEEK_SET; lf.l_start = 0; lf.l_len = 0; - if (uap->how & LOCK_UN) { + if (SCARG(uap, how) & LOCK_UN) { lf.l_type = F_UNLCK; fp->f_flag &= ~FHASLOCK; return (VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK)); } - if (uap->how & LOCK_EX) + if (SCARG(uap, how) & LOCK_EX) lf.l_type = F_WRLCK; - else if (uap->how & LOCK_SH) + else if (SCARG(uap, how) & LOCK_SH) lf.l_type = F_RDLCK; else return (EBADF); fp->f_flag |= FHASLOCK; - if (uap->how & LOCK_NB) + if (SCARG(uap, how) & LOCK_NB) return (VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, F_FLOCK)); return (VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, F_FLOCK|F_WAIT)); } diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 7ce88816c140..81ca808a28bc 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.55 1994/06/29 06:32:24 cgd Exp $ */ +/* $NetBSD: kern_exec.c,v 1.56 1994/10/20 04:22:43 cgd Exp $ */ /*- * Copyright (C) 1993, 1994 Christopher G. Demetriou @@ -51,6 +51,8 @@ #include #include +#include + #include #include @@ -201,8 +203,12 @@ bad1: /* ARGSUSED */ execve(p, uap, retval) register struct proc *p; - register struct execve_args *uap; - int *retval; + register struct execve_args /* { + syscallarg(char *) path; + syscallarg(char * *) argp; + syscallarg(char * *) envp; + } */ *uap; + register_t *retval; { int error, i; struct exec_package pack; @@ -230,12 +236,12 @@ execve(p, uap, retval) } /* init the namei data to point the file user's program name */ - NDINIT(&nid, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, p); + NDINIT(&nid, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p); /* * initialize the fields of the exec package. */ - pack.ep_name = uap->path; + pack.ep_name = SCARG(uap, path); MALLOC(pack.ep_hdr, void *, exec_maxhdrsz, M_EXEC, M_WAITOK); pack.ep_hdrlen = exec_maxhdrsz; pack.ep_hdrvalid = 0; @@ -281,7 +287,7 @@ execve(p, uap, retval) } /* Now get argv & environment */ - if (!(cpp = uap->argp)) { + if (!(cpp = SCARG(uap, argp))) { error = EINVAL; goto bad; } @@ -306,7 +312,7 @@ execve(p, uap, retval) } envc = 0; - if (cpp = uap->envp) { /* environment need not be there */ + if (cpp = SCARG(uap, envp)) { /* environment need not be there */ while (1) { len = argp + ARG_MAX - dp; if (error = copyin(cpp, &sp, sizeof(sp))) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index e087cc09aa6b..bc209bb9d420 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exit.c,v 1.25 1994/08/30 03:05:33 mycroft Exp $ */ +/* $NetBSD: kern_exit.c,v 1.26 1994/10/20 04:22:45 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 @@ -59,6 +59,9 @@ #include #include +#include +#include + #include #ifdef COMPAT_43 #include @@ -75,17 +78,16 @@ __dead void exit1 __P((struct proc *, int)); * exit -- * Death of process. */ -struct exit_args { - int rval; -}; __dead void exit(p, uap, retval) struct proc *p; - struct exit_args *uap; + struct exit_args /* { + syscallarg(int) rval; + } */ *uap; int *retval; { - exit1(p, W_EXITCODE(uap->rval, 0)); + exit1(p, W_EXITCODE(SCARG(uap, rval), 0)); /* NOTREACHED */ } @@ -270,16 +272,6 @@ exit1(p, rv) cpu_exit(p); } -struct wait_args { - int pid; - int *status; - int options; - struct rusage *rusage; -#ifdef COMPAT_43 - int compat; /* pseudo */ -#endif -}; - #ifdef COMPAT_43 #ifdef m68k #include @@ -288,85 +280,106 @@ struct wait_args { #define GETPS(rp) (rp)[PS] #endif -owait(p, uap, retval) +compat_43_wait(p, uap, retval) struct proc *p; - register struct wait_args *uap; + void *uap; int *retval; { + struct wait4_args /* { + syscallarg(int) pid; + syscallarg(int *) status; + syscallarg(int) options; + syscallarg(struct rusage *) rusage; + } */ a; #ifdef PSL_ALLCC if ((GETPS(p->p_md.md_regs) & PSL_ALLCC) != PSL_ALLCC) { - uap->options = 0; - uap->rusage = NULL; + SCARG(&a, options) = 0; + SCARG(&a, rusage) = NULL; } else { - uap->options = p->p_md.md_regs[R0]; - uap->rusage = (struct rusage *)p->p_md.md_regs[R1]; + SCARG(&a, options) = p->p_md.md_regs[R0]; + SCARG(&a, rusage) = (struct rusage *)p->p_md.md_regs[R1]; } #else - uap->options = 0; - uap->rusage = NULL; + SCARG(&a, options) = 0; + SCARG(&a, rusage) = NULL; #endif - uap->pid = WAIT_ANY; - uap->status = NULL; - uap->compat = 1; - return (wait1(p, uap, retval)); + SCARG(&a, pid) = WAIT_ANY; + SCARG(&a, status) = NULL; + return (wait1(p, &a, retval, 1)); } wait4(p, uap, retval) struct proc *p; - struct wait_args *uap; + struct wait4_args /* { + syscallarg(int) pid; + syscallarg(int *) status; + syscallarg(int) options; + syscallarg(struct rusage *) rusage; + } */ *uap; int *retval; { - uap->compat = 0; - return (wait1(p, uap, retval)); + return (wait1(p, uap, retval, 0)); } #else #define wait1 wait4 #endif int -wait1(q, uap, retval) +wait1(q, uap, retval, compat) register struct proc *q; - register struct wait_args *uap; - int retval[]; + register struct wait4_args /* { + syscallarg(int) pid; + syscallarg(int *) status; + syscallarg(int) options; + syscallarg(struct rusage *) rusage; + } */ *uap; + register_t *retval; +#ifdef COMPAT_43 + int compat; +#endif { register int nfound; register struct proc *p, *t; int status, error; #ifdef COMPAT_09 - uap->pid = (short) uap->pid; + SCARG(uap, pid) = (short)SCARG(uap, pid); #endif - if (uap->pid == 0) - uap->pid = -q->p_pgid; + if (SCARG(uap, pid) == 0) + SCARG(uap, pid) = -q->p_pgid; #ifdef notyet - if (uap->options &~ (WUNTRACED|WNOHANG)) + if (SCARG(uap, options) &~ (WUNTRACED|WNOHANG)) return (EINVAL); #endif loop: nfound = 0; for (p = q->p_children.lh_first; p != 0; p = p->p_sibling.le_next) { - if (uap->pid != WAIT_ANY && - p->p_pid != uap->pid && p->p_pgid != -uap->pid) + if (SCARG(uap, pid) != WAIT_ANY && + p->p_pid != SCARG(uap, pid) && + p->p_pgid != -SCARG(uap, pid)) continue; nfound++; if (p->p_stat == SZOMB) { retval[0] = p->p_pid; #ifdef COMPAT_43 - if (uap->compat) + if (compat) retval[1] = p->p_xstat; else #endif - if (uap->status) { + if (SCARG(uap, status)) { status = p->p_xstat; /* convert to int */ if (error = copyout((caddr_t)&status, - (caddr_t)uap->status, sizeof(status))) + (caddr_t)SCARG(uap, status), + sizeof(status))) return (error); } - if (uap->rusage && (error = copyout((caddr_t)p->p_ru, - (caddr_t)uap->rusage, sizeof (struct rusage)))) + if (SCARG(uap, rusage) && + (error = copyout((caddr_t)p->p_ru, + (caddr_t)SCARG(uap, rusage), + sizeof (struct rusage)))) return (error); /* * If we got the child via a ptrace 'attach', @@ -421,19 +434,20 @@ loop: return (0); } if (p->p_stat == SSTOP && (p->p_flag & P_WAITED) == 0 && - (p->p_flag & P_TRACED || uap->options & WUNTRACED)) { + (p->p_flag & P_TRACED || SCARG(uap, options) & WUNTRACED)) { p->p_flag |= P_WAITED; retval[0] = p->p_pid; #ifdef COMPAT_43 - if (uap->compat) { + if (compat) { retval[1] = W_STOPCODE(p->p_xstat); error = 0; } else #endif - if (uap->status) { + if (SCARG(uap, status)) { status = W_STOPCODE(p->p_xstat); error = copyout((caddr_t)&status, - (caddr_t)uap->status, sizeof(status)); + (caddr_t)SCARG(uap, status), + sizeof(status)); } else error = 0; return (error); @@ -441,7 +455,7 @@ loop: } if (nfound == 0) return (ECHILD); - if (uap->options & WNOHANG) { + if (SCARG(uap, options) & WNOHANG) { retval[0] = 0; return (0); } diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 81270e4f0a3a..c684b1fc2af7 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_fork.c,v 1.21 1994/08/30 06:16:25 mycroft Exp $ */ +/* $NetBSD: kern_fork.c,v 1.22 1994/10/20 04:22:47 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 @@ -57,7 +57,7 @@ fork(p, uap, retval) struct proc *p; void *uap; - int retval[]; + register_t *retval; { return (fork1(p, 0, retval)); @@ -67,7 +67,7 @@ fork(p, uap, retval) vfork(p, uap, retval) struct proc *p; void *uap; - int retval[]; + register_t *retval; { return (fork1(p, 1, retval)); @@ -77,7 +77,8 @@ int nprocs = 1; /* process 0 */ fork1(p1, isvfork, retval) register struct proc *p1; - int isvfork, retval[]; + int isvfork; + register_t *retval; { register struct proc *p2; register uid_t uid; diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index a285cee1f5b5..74233504616e 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_ktrace.c,v 1.12 1994/08/30 03:05:37 mycroft Exp $ */ +/* $NetBSD: kern_ktrace.c,v 1.13 1994/10/20 04:22:49 cgd Exp $ */ /* * Copyright (c) 1989, 1993 @@ -38,6 +38,7 @@ #ifdef KTRACE #include +#include #include #include #include @@ -46,6 +47,9 @@ #include #include +#include +#include + struct ktr_header * ktrgetheader(type) int type; @@ -62,13 +66,13 @@ ktrgetheader(type) return (kth); } -ktrsyscall(vp, code, narg, args) +ktrsyscall(vp, code, narg, argsize, args) struct vnode *vp; - int code, narg, args[]; + int code, narg, argsize, args[]; { struct ktr_header *kth; struct ktr_syscall *ktp; - register len = sizeof(struct ktr_syscall) + (narg * sizeof(int)); + register len = sizeof(struct ktr_syscall) + argsize; struct proc *p = curproc; /* XXX */ int *argp, i; @@ -78,7 +82,7 @@ ktrsyscall(vp, code, narg, args) ktp->ktr_code = code; ktp->ktr_narg = narg; argp = (int *)((char *)ktp + sizeof(struct ktr_syscall)); - for (i = 0; i < narg; i++) + for (i = 0; i < (argsize / sizeof *argp); i++) *argp++ = args[i]; kth->ktr_buf = (caddr_t)ktp; kth->ktr_len = len; @@ -217,24 +221,23 @@ ktrcsw(vp, out, user) /* * ktrace system call */ -struct ktrace_args { - char *fname; - int ops; - int facs; - int pid; -}; /* ARGSUSED */ ktrace(curp, uap, retval) struct proc *curp; - register struct ktrace_args *uap; - int *retval; + register struct ktrace_args /* { + syscallarg(char *) fname; + syscallarg(int) ops; + syscallarg(int) facs; + syscallarg(int) pid; + } */ *uap; + register_t *retval; { register struct vnode *vp = NULL; register struct proc *p; struct pgrp *pg; - int facs = uap->facs & ~KTRFAC_ROOT; - int ops = KTROP(uap->ops); - int descend = uap->ops & KTRFLAG_DESCEND; + int facs = SCARG(uap, facs) & ~KTRFAC_ROOT; + int ops = KTROP(SCARG(uap, ops)); + int descend = SCARG(uap, ops) & KTRFLAG_DESCEND; int ret = 0; int error = 0; struct nameidata nd; @@ -244,7 +247,8 @@ ktrace(curp, uap, retval) /* * an operation which requires a file argument. */ - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->fname, curp); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, fname), + curp); if (error = vn_open(&nd, FREAD|FWRITE, 0)) { curp->p_traceflag &= ~KTRFAC_ACTIVE; return (error); @@ -284,11 +288,11 @@ ktrace(curp, uap, retval) /* * do it */ - if (uap->pid < 0) { + if (SCARG(uap, pid) < 0) { /* * by process group */ - pg = pgfind(-uap->pid); + pg = pgfind(-SCARG(uap, pid)); if (pg == NULL) { error = ESRCH; goto done; @@ -303,7 +307,7 @@ ktrace(curp, uap, retval) /* * by pid */ - p = pfind(uap->pid); + p = pfind(SCARG(uap, pid)); if (p == NULL) { error = ESRCH; goto done; diff --git a/sys/kern/kern_lkm.c b/sys/kern/kern_lkm.c index 60ae6c3d5f3c..073caa4709c9 100644 --- a/sys/kern/kern_lkm.c +++ b/sys/kern/kern_lkm.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_lkm.c,v 1.19 1994/09/22 02:22:42 mycroft Exp $ */ +/* $NetBSD: kern_lkm.c,v 1.20 1994/10/20 04:22:50 cgd Exp $ */ /* * Copyright (c) 1994 Christopher G. Demetriou @@ -437,10 +437,13 @@ lkmioctl(dev, cmd, data, flag) * Place holder for system call slots reserved for loadable modules. */ int -lkmnosys() +lkmnosys(p, uap, retval) + struct proc *p; + void *uap; + register_t *retval; { - return (nosys()); + return (nosys(p, uap, retval)); } /* diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 54fc96cacbbf..02e8444f0c1e 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_prot.c,v 1.18 1994/09/19 07:52:57 mycroft Exp $ */ +/* $NetBSD: kern_prot.c,v 1.19 1994/10/20 04:22:52 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1990, 1991, 1993 @@ -53,11 +53,14 @@ #include #include +#include +#include + /* ARGSUSED */ getpid(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { *retval = p->p_pid; @@ -71,7 +74,7 @@ getpid(p, uap, retval) getppid(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { *retval = p->p_pptr->p_pid; @@ -82,7 +85,7 @@ getppid(p, uap, retval) getpgrp(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { *retval = p->p_pgrp->pg_id; @@ -93,7 +96,7 @@ getpgrp(p, uap, retval) getuid(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { *retval = p->p_cred->p_ruid; @@ -107,7 +110,7 @@ getuid(p, uap, retval) geteuid(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { *retval = p->p_ucred->cr_uid; @@ -118,7 +121,7 @@ geteuid(p, uap, retval) getgid(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { *retval = p->p_cred->p_rgid; @@ -137,27 +140,26 @@ getgid(p, uap, retval) getegid(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { *retval = p->p_ucred->cr_groups[0]; return (0); } -struct getgroups_args { - u_int gidsetsize; - gid_t *gidset; -}; getgroups(p, uap, retval) struct proc *p; - register struct getgroups_args *uap; - int *retval; + register struct getgroups_args /* { + syscallarg(u_int) gidsetsize; + syscallarg(gid_t *) gidset; + } */ *uap; + register_t *retval; { register struct pcred *pc = p->p_cred; register u_int ngrp; int error; - if ((ngrp = uap->gidsetsize) == 0) { + if ((ngrp = SCARG(uap, gidsetsize)) == 0) { *retval = pc->pc_ucred->cr_ngroups; return (0); } @@ -165,7 +167,7 @@ getgroups(p, uap, retval) return (EINVAL); ngrp = pc->pc_ucred->cr_ngroups; if (error = copyout((caddr_t)pc->pc_ucred->cr_groups, - (caddr_t)uap->gidset, ngrp * sizeof(gid_t))) + (caddr_t)SCARG(uap, gidset), ngrp * sizeof(gid_t))) return (error); *retval = ngrp; return (0); @@ -175,7 +177,7 @@ getgroups(p, uap, retval) setsid(p, uap, retval) register struct proc *p; void *uap; - int *retval; + register_t *retval; { if (p->p_pgid == p->p_pid || pgfind(p->p_pid)) { @@ -200,26 +202,25 @@ setsid(p, uap, retval) * there must exist some pid in same session having pgid (EPERM) * pid must not be session leader (EPERM) */ -struct setpgid_args { - int pid; /* target process id */ - int pgid; /* target pgrp id */ -}; /* ARGSUSED */ setpgid(curp, uap, retval) struct proc *curp; - register struct setpgid_args *uap; - int *retval; + register struct setpgid_args /* { + syscallarg(int) pid; + syscallarg(int) pgid; + } */ *uap; + register_t *retval; { register struct proc *targp; /* target process */ register struct pgrp *pgrp; /* target pgrp */ #ifdef COMPAT_09 - uap->pid = (short) uap->pid; /* XXX */ - uap->pgid = (short) uap->pgid; /* XXX */ + SCARG(uap, pid) = (short) SCARG(uap, pid); /* XXX */ + SCARG(uap, pgid) = (short) SCARG(uap, pgid); /* XXX */ #endif - if (uap->pid != 0 && uap->pid != curp->p_pid) { - if ((targp = pfind(uap->pid)) == 0 || !inferior(targp)) + if (SCARG(uap, pid) != 0 && SCARG(uap, pid) != curp->p_pid) { + if ((targp = pfind(SCARG(uap, pid))) == 0 || !inferior(targp)) return (ESRCH); if (targp->p_session != curp->p_session) return (EPERM); @@ -229,32 +230,31 @@ setpgid(curp, uap, retval) targp = curp; if (SESS_LEADER(targp)) return (EPERM); - if (uap->pgid == 0) - uap->pgid = targp->p_pid; - else if (uap->pgid != targp->p_pid) - if ((pgrp = pgfind(uap->pgid)) == 0 || + if (SCARG(uap, pgid) == 0) + SCARG(uap, pgid) = targp->p_pid; + else if (SCARG(uap, pgid) != targp->p_pid) + if ((pgrp = pgfind(SCARG(uap, pgid))) == 0 || pgrp->pg_session != curp->p_session) return (EPERM); - return (enterpgrp(targp, uap->pgid, 0)); + return (enterpgrp(targp, SCARG(uap, pgid), 0)); } -struct setuid_args { - uid_t uid; -}; /* ARGSUSED */ setuid(p, uap, retval) struct proc *p; - struct setuid_args *uap; - int *retval; + struct setuid_args /* { + syscallarg(uid_t) uid; + } */ *uap; + register_t *retval; { register struct pcred *pc = p->p_cred; register uid_t uid; int error; #ifdef COMPAT_09 /* XXX */ - uid = (u_short)uap->uid; + uid = (u_short)SCARG(uap, uid); #else - uid = uap->uid; + uid = SCARG(uap, uid); #endif if (uid != pc->p_ruid && (error = suser(pc->pc_ucred, &p->p_acflag))) @@ -274,23 +274,22 @@ setuid(p, uap, retval) return (0); } -struct seteuid_args { - uid_t euid; -}; /* ARGSUSED */ seteuid(p, uap, retval) struct proc *p; - struct seteuid_args *uap; - int *retval; + struct seteuid_args /* { + syscallarg(uid_t) euid; + } */ *uap; + register_t *retval; { register struct pcred *pc = p->p_cred; register uid_t euid; int error; #ifdef COMPAT_09 /* XXX */ - euid = (u_short)uap->euid; + euid = (u_short)SCARG(uap, euid); #else - euid = uap->euid; + euid = SCARG(uap, euid); #endif if (euid != pc->p_ruid && euid != pc->p_svuid && (error = suser(pc->pc_ucred, &p->p_acflag))) @@ -305,23 +304,22 @@ seteuid(p, uap, retval) return (0); } -struct setgid_args { - gid_t gid; -}; /* ARGSUSED */ setgid(p, uap, retval) struct proc *p; - struct setgid_args *uap; - int *retval; + struct setgid_args /* { + syscallarg(gid_t) gid; + } */ *uap; + register_t *retval; { register struct pcred *pc = p->p_cred; register gid_t gid; int error; #ifdef COMPAT_09 /* XXX */ - gid = (u_short)uap->gid; + gid = (u_short)SCARG(uap, gid); #else - gid = uap->gid; + gid = SCARG(uap, gid); #endif if (gid != pc->p_rgid && (error = suser(pc->pc_ucred, &p->p_acflag))) return (error); @@ -333,23 +331,22 @@ setgid(p, uap, retval) return (0); } -struct setegid_args { - gid_t egid; -}; /* ARGSUSED */ setegid(p, uap, retval) struct proc *p; - struct setegid_args *uap; - int *retval; + struct setegid_args /* { + syscallarg(gid_t) egid; + } */ *uap; + register_t *retval; { register struct pcred *pc = p->p_cred; register gid_t egid; int error; #ifdef COMPAT_09 /* XXX */ - egid = (u_short)uap->egid; + egid = (u_short)SCARG(uap, egid); #else - egid = uap->egid; + egid = SCARG(uap, egid); #endif if (egid != pc->p_rgid && egid != pc->p_svgid && (error = suser(pc->pc_ucred, &p->p_acflag))) @@ -360,15 +357,14 @@ setegid(p, uap, retval) return (0); } -struct setgroups_args { - u_int gidsetsize; - gid_t *gidset; -}; /* ARGSUSED */ setgroups(p, uap, retval) struct proc *p; - struct setgroups_args *uap; - int *retval; + struct setgroups_args /* { + syscallarg(u_int) gidsetsize; + syscallarg(gid_t *) gidset; + } */ *uap; + register_t *retval; { register struct pcred *pc = p->p_cred; register u_int ngrp; @@ -376,11 +372,11 @@ setgroups(p, uap, retval) if (error = suser(pc->pc_ucred, &p->p_acflag)) return (error); - ngrp = uap->gidsetsize; + ngrp = SCARG(uap, gidsetsize); if (ngrp < 1 || ngrp > NGROUPS) return (EINVAL); pc->pc_ucred = crcopy(pc->pc_ucred); - if (error = copyin((caddr_t)uap->gidset, + if (error = copyin((caddr_t)SCARG(uap, gidset), (caddr_t)pc->pc_ucred->cr_groups, ngrp * sizeof(gid_t))) return (error); pc->pc_ucred->cr_ngroups = ngrp; @@ -389,15 +385,14 @@ setgroups(p, uap, retval) } #if defined(COMPAT_43) || defined(COMPAT_SUNOS) -struct setreuid_args { - int ruid; - int euid; -}; /* ARGSUSED */ -osetreuid(p, uap, retval) +compat_43_setreuid(p, uap, retval) register struct proc *p; - struct setreuid_args *uap; - int *retval; + struct compat_43_setreuid_args /* { + syscallarg(int) ruid; + syscallarg(int) euid; + } */ *uap; + register_t *retval; { struct seteuid_args seuidargs; struct setuid_args suidargs; @@ -415,29 +410,28 @@ osetreuid(p, uap, retval) * N, N: call setuid(N). This is correct emulation. * N, M: call setuid(N). This is close to correct emulation. */ - if (uap->ruid == (uid_t)-1) { - if (uap->euid == (uid_t)-1) + if (SCARG(uap, ruid) == (uid_t)-1) { + if (SCARG(uap, euid) == (uid_t)-1) return (0); /* -1, -1 */ - seuidargs.euid = uap->euid; /* -1, N */ + seuidargs.euid = SCARG(uap, euid); /* -1, N */ return (seteuid(p, &seuidargs, retval)); } - if (uap->euid == (uid_t)-1) { - seuidargs.euid = uap->ruid; /* N, -1 */ + if (SCARG(uap, euid) == (uid_t)-1) { + seuidargs.euid = SCARG(uap, ruid); /* N, -1 */ return (seteuid(p, &seuidargs, retval)); } - suidargs.uid = uap->ruid; /* N, N and N, M */ + suidargs.uid = SCARG(uap, ruid); /* N, N and N, M */ return (setuid(p, &suidargs, retval)); } -struct setregid_args { - int rgid; - int egid; -}; /* ARGSUSED */ -osetregid(p, uap, retval) +compat_43_setregid(p, uap, retval) register struct proc *p; - struct setregid_args *uap; - int *retval; + struct compat_43_setregid_args /* { + syscallarg(int) rgid; + syscallarg(int) egid; + } */ *uap; + register_t *retval; { struct setegid_args segidargs; struct setgid_args sgidargs; @@ -445,17 +439,17 @@ osetregid(p, uap, retval) /* * There are five cases, described above in osetreuid() */ - if (uap->rgid == (gid_t)-1) { - if (uap->egid == (gid_t)-1) + if (SCARG(uap, rgid) == (gid_t)-1) { + if (SCARG(uap, egid) == (gid_t)-1) return (0); /* -1, -1 */ - segidargs.egid = uap->egid; /* -1, N */ + segidargs.egid = SCARG(uap, egid); /* -1, N */ return (setegid(p, &segidargs, retval)); } - if (uap->egid == (gid_t)-1) { - segidargs.egid = uap->rgid; /* N, -1 */ + if (SCARG(uap, egid) == (gid_t)-1) { + segidargs.egid = SCARG(uap, rgid); /* N, -1 */ return (setegid(p, &segidargs, retval)); } - sgidargs.gid = uap->rgid; /* N, N and N, M */ + sgidargs.gid = SCARG(uap, rgid); /* N, N and N, M */ return (setgid(p, &sgidargs, retval)); } #endif /* defined(COMPAT_43) || defined(COMPAT_SUNOS) */ @@ -560,40 +554,38 @@ crdup(cr) /* * Get login name, if available. */ -struct getlogin_args { - char *namebuf; - u_int namelen; -}; /* ARGSUSED */ getlogin(p, uap, retval) struct proc *p; - struct getlogin_args *uap; - int *retval; + struct getlogin_args /* { + syscallarg(char *) namebuf; + syscallarg(u_int) namelen; + } */ *uap; + register_t *retval; { - if (uap->namelen > sizeof (p->p_pgrp->pg_session->s_login)) - uap->namelen = sizeof (p->p_pgrp->pg_session->s_login); + if (SCARG(uap, namelen) > sizeof (p->p_pgrp->pg_session->s_login)) + SCARG(uap, namelen) = sizeof (p->p_pgrp->pg_session->s_login); return (copyout((caddr_t) p->p_pgrp->pg_session->s_login, - (caddr_t) uap->namebuf, uap->namelen)); + (caddr_t) SCARG(uap, namebuf), SCARG(uap, namelen))); } /* * Set login name. */ -struct setlogin_args { - char *namebuf; -}; /* ARGSUSED */ setlogin(p, uap, retval) struct proc *p; - struct setlogin_args *uap; - int *retval; + struct setlogin_args /* { + syscallarg(char *) namebuf; + } */ *uap; + register_t *retval; { int error; if (error = suser(p->p_ucred, &p->p_acflag)) return (error); - error = copyinstr((caddr_t) uap->namebuf, + error = copyinstr((caddr_t) SCARG(uap, namebuf), (caddr_t) p->p_pgrp->pg_session->s_login, sizeof (p->p_pgrp->pg_session->s_login) - 1, (u_int *)0); if (error == ENAMETOOLONG) diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 64bb456bbc07..927959c6877e 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_resource.c,v 1.21 1994/08/30 03:05:40 mycroft Exp $ */ +/* $NetBSD: kern_resource.c,v 1.22 1994/10/20 04:22:54 cgd Exp $ */ /*- * Copyright (c) 1982, 1986, 1991, 1993 @@ -41,37 +41,40 @@ */ #include +#include #include #include #include #include #include +#include +#include + #include /* * Resource controls and accounting. */ -struct getpriority_args { - int which; - int who; -}; getpriority(curp, uap, retval) struct proc *curp; - register struct getpriority_args *uap; - int *retval; + register struct getpriority_args /* { + syscallarg(int) which; + syscallarg(int) who; + } */ *uap; + register_t *retval; { register struct proc *p; register int low = PRIO_MAX + 1; - switch (uap->which) { + switch (SCARG(uap, which)) { case PRIO_PROCESS: - if (uap->who == 0) + if (SCARG(uap, who) == 0) p = curp; else - p = pfind(uap->who); + p = pfind(SCARG(uap, who)); if (p == 0) break; low = p->p_nice; @@ -80,9 +83,9 @@ getpriority(curp, uap, retval) case PRIO_PGRP: { register struct pgrp *pg; - if (uap->who == 0) + if (SCARG(uap, who) == 0) pg = curp->p_pgrp; - else if ((pg = pgfind(uap->who)) == NULL) + else if ((pg = pgfind(SCARG(uap, who))) == NULL) break; for (p = pg->pg_members.lh_first; p != 0; p = p->p_pglist.le_next) { if (p->p_nice < low) @@ -92,10 +95,11 @@ getpriority(curp, uap, retval) } case PRIO_USER: - if (uap->who == 0) - uap->who = curp->p_ucred->cr_uid; + if (SCARG(uap, who) == 0) + SCARG(uap, who) = curp->p_ucred->cr_uid; for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) - if (p->p_ucred->cr_uid == uap->who && p->p_nice < low) + if (p->p_ucred->cr_uid == SCARG(uap, who) && + p->p_nice < low) low = p->p_nice; break; @@ -108,53 +112,53 @@ getpriority(curp, uap, retval) return (0); } -struct setpriority_args { - int which; - int who; - int prio; -}; /* ARGSUSED */ setpriority(curp, uap, retval) struct proc *curp; - register struct setpriority_args *uap; - int *retval; + register struct setpriority_args /* { + syscallarg(int) which; + syscallarg(int) who; + syscallarg(int) prio; + } */ *uap; + register_t *retval; { register struct proc *p; int found = 0, error = 0; - switch (uap->which) { + switch (SCARG(uap, which)) { case PRIO_PROCESS: - if (uap->who == 0) + if (SCARG(uap, who) == 0) p = curp; else - p = pfind(uap->who); + p = pfind(SCARG(uap, who)); if (p == 0) break; - error = donice(curp, p, uap->prio); + error = donice(curp, p, SCARG(uap, prio)); found++; break; case PRIO_PGRP: { register struct pgrp *pg; - if (uap->who == 0) + if (SCARG(uap, who) == 0) pg = curp->p_pgrp; - else if ((pg = pgfind(uap->who)) == NULL) + else if ((pg = pgfind(SCARG(uap, who))) == NULL) break; - for (p = pg->pg_members.lh_first; p != 0; p = p->p_pglist.le_next) { - error = donice(curp, p, uap->prio); + for (p = pg->pg_members.lh_first; p != 0; + p = p->p_pglist.le_next) { + error = donice(curp, p, SCARG(uap, prio)); found++; } break; } case PRIO_USER: - if (uap->who == 0) - uap->who = curp->p_ucred->cr_uid; + if (SCARG(uap, who) == 0) + SCARG(uap, who) = curp->p_ucred->cr_uid; for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) - if (p->p_ucred->cr_uid == uap->who) { - error = donice(curp, p, uap->prio); + if (p->p_ucred->cr_uid == SCARG(uap, who)) { + error = donice(curp, p, SCARG(uap, prio)); found++; } break; @@ -189,69 +193,67 @@ donice(curp, chgp, n) } #if defined(COMPAT_43) || defined(COMPAT_SUNOS) -struct osetrlimit_args { - u_int which; - struct orlimit *lim; -}; /* ARGSUSED */ -osetrlimit(p, uap, retval) +compat_43_setrlimit(p, uap, retval) struct proc *p; - struct osetrlimit_args *uap; - int *retval; + struct compat_43_setrlimit_args /* { + syscallarg(u_int) which; + syscallarg(struct ogetrlimit *) rlp; + } */ *uap; + register_t *retval; { struct orlimit olim; struct rlimit lim; int error; - if (error = - copyin((caddr_t)uap->lim, (caddr_t)&olim, sizeof (struct orlimit))) + if (error = copyin((caddr_t)SCARG(uap, rlp), (caddr_t)&olim, + sizeof (struct orlimit))) return (error); lim.rlim_cur = olim.rlim_cur; lim.rlim_max = olim.rlim_max; - return (dosetrlimit(p, uap->which, &lim)); + return (dosetrlimit(p, SCARG(uap, which), &lim)); } -struct ogetrlimit_args { - u_int which; - struct orlimit *rlp; -}; /* ARGSUSED */ -ogetrlimit(p, uap, retval) +compat_43_getrlimit(p, uap, retval) struct proc *p; - register struct ogetrlimit_args *uap; - int *retval; + register struct compat_43_getrlimit_args /* { + syscallarg(u_int) which; + syscallarg(struct ogetrlimit *) rlp; + } */ *uap; + register_t *retval; { struct orlimit olim; - if (uap->which >= RLIM_NLIMITS) + if (SCARG(uap, which) >= RLIM_NLIMITS) return (EINVAL); - olim.rlim_cur = p->p_rlimit[uap->which].rlim_cur; + olim.rlim_cur = p->p_rlimit[SCARG(uap, which)].rlim_cur; if (olim.rlim_cur == -1) olim.rlim_cur = 0x7fffffff; - olim.rlim_max = p->p_rlimit[uap->which].rlim_max; + olim.rlim_max = p->p_rlimit[SCARG(uap, which)].rlim_max; if (olim.rlim_max == -1) olim.rlim_max = 0x7fffffff; - return (copyout((caddr_t)&olim, (caddr_t)uap->rlp, sizeof(olim))); + return (copyout((caddr_t)&olim, (caddr_t)SCARG(uap, rlp), + sizeof(olim))); } #endif /* COMPAT_43 || COMPAT_SUNOS */ -struct setrlimit_args { - u_int which; - struct rlimit *lim; -}; /* ARGSUSED */ setrlimit(p, uap, retval) struct proc *p; - register struct setrlimit_args *uap; - int *retval; + register struct setrlimit_args /* { + syscallarg(u_int) which; + syscallarg(struct rlimit *) rlp; + } */ *uap; + register_t *retval; { struct rlimit alim; int error; - if (error = - copyin((caddr_t)uap->lim, (caddr_t)&alim, sizeof (struct rlimit))) + if (error = copyin((caddr_t)SCARG(uap, rlp), (caddr_t)&alim, + sizeof (struct rlimit))) return (error); - return (dosetrlimit(p, uap->which, &alim)); + return (dosetrlimit(p, SCARG(uap, which), &alim)); } int @@ -338,21 +340,20 @@ dosetrlimit(p, which, limp) return (0); } -struct getrlimit_args { - u_int which; - struct rlimit *rlp; -}; /* ARGSUSED */ getrlimit(p, uap, retval) struct proc *p; - register struct getrlimit_args *uap; - int *retval; + register struct getrlimit_args /* { + syscallarg(u_int) which; + syscallarg(struct rlimit *) rlp; + } */ *uap; + register_t *retval; { - if (uap->which >= RLIM_NLIMITS) + if (SCARG(uap, which) >= RLIM_NLIMITS) return (EINVAL); - return (copyout((caddr_t)&p->p_rlimit[uap->which], (caddr_t)uap->rlp, - sizeof (struct rlimit))); + return (copyout((caddr_t)&p->p_rlimit[SCARG(uap, which)], + (caddr_t)SCARG(uap, rlp), sizeof (struct rlimit))); } /* @@ -411,19 +412,18 @@ calcru(p, up, sp, ip) } } -struct getrusage_args { - int who; - struct rusage *rusage; -}; /* ARGSUSED */ getrusage(p, uap, retval) register struct proc *p; - register struct getrusage_args *uap; - int *retval; + register struct getrusage_args /* { + syscallarg(int) who; + syscallarg(struct rusage *) rusage; + } */ *uap; + register_t *retval; { register struct rusage *rup; - switch (uap->who) { + switch (SCARG(uap, who)) { case RUSAGE_SELF: rup = &p->p_stats->p_ru; @@ -437,7 +437,7 @@ getrusage(p, uap, retval) default: return (EINVAL); } - return (copyout((caddr_t)rup, (caddr_t)uap->rusage, + return (copyout((caddr_t)rup, (caddr_t)SCARG(uap, rusage), sizeof (struct rusage))); } diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 242606deff24..c4dc93240eae 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sig.c,v 1.31 1994/08/30 03:05:42 mycroft Exp $ */ +/* $NetBSD: kern_sig.c,v 1.32 1994/10/20 04:22:56 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 @@ -60,6 +60,9 @@ #include #include +#include +#include + #include #include @@ -78,16 +81,15 @@ void stop __P((struct proc *p)); (pc)->pc_ucred->cr_uid == (q)->p_ucred->cr_uid || \ ((signum) == SIGCONT && (q)->p_session == (p)->p_session)) -struct sigaction_args { - int signum; - struct sigaction *nsa; - struct sigaction *osa; -}; /* ARGSUSED */ sigaction(p, uap, retval) struct proc *p; - register struct sigaction_args *uap; - int *retval; + register struct sigaction_args /* { + syscallarg(int) signum; + syscallarg(struct sigaction *) nsa; + syscallarg(struct sigaction *) osa; + } */ *uap; + register_t *retval; { struct sigaction vec; register struct sigaction *sa; @@ -95,12 +97,12 @@ sigaction(p, uap, retval) register int signum; int bit, error; - signum = uap->signum; + signum = SCARG(uap, signum); if (signum <= 0 || signum >= NSIG || signum == SIGKILL || signum == SIGSTOP) return (EINVAL); sa = &vec; - if (uap->osa) { + if (SCARG(uap, osa)) { sa->sa_handler = ps->ps_sigact[signum]; sa->sa_mask = ps->ps_catchmask[signum]; bit = sigmask(signum); @@ -111,12 +113,12 @@ sigaction(p, uap, retval) sa->sa_flags |= SA_RESTART; if (p->p_flag & P_NOCLDSTOP) sa->sa_flags |= SA_NOCLDSTOP; - if (error = copyout((caddr_t)sa, (caddr_t)uap->osa, + if (error = copyout((caddr_t)sa, (caddr_t)SCARG(uap, osa), sizeof (vec))) return (error); } - if (uap->nsa) { - if (error = copyin((caddr_t)uap->nsa, (caddr_t)sa, + if (SCARG(uap, nsa)) { + if (error = copyin((caddr_t)SCARG(uap, nsa), (caddr_t)sa, sizeof (vec))) return (error); setsigvec(p, signum, sa); @@ -238,31 +240,30 @@ execsigs(p) * and return old mask as return value; * the library stub does the rest. */ -struct sigprocmask_args { - int how; - sigset_t mask; -}; sigprocmask(p, uap, retval) register struct proc *p; - struct sigprocmask_args *uap; - int *retval; + struct sigprocmask_args /* { + syscallarg(int) how; + syscallarg(sigset_t) mask; + } */ *uap; + register_t *retval; { int error = 0; *retval = p->p_sigmask; (void) splhigh(); - switch (uap->how) { + switch (SCARG(uap, how)) { case SIG_BLOCK: - p->p_sigmask |= uap->mask &~ sigcantmask; + p->p_sigmask |= SCARG(uap, mask) &~ sigcantmask; break; case SIG_UNBLOCK: - p->p_sigmask &= ~uap->mask; + p->p_sigmask &= ~SCARG(uap, mask); break; case SIG_SETMASK: - p->p_sigmask = uap->mask &~ sigcantmask; + p->p_sigmask = SCARG(uap, mask) &~ sigcantmask; break; default: @@ -277,7 +278,7 @@ sigprocmask(p, uap, retval) sigpending(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { *retval = p->p_siglist; @@ -288,16 +289,15 @@ sigpending(p, uap, retval) /* * Generalized interface signal handler, 4.3-compatible. */ -struct osigvec_args { - int signum; - struct sigvec *nsv; - struct sigvec *osv; -}; /* ARGSUSED */ -osigvec(p, uap, retval) +compat_43_sigvec(p, uap, retval) struct proc *p; - register struct osigvec_args *uap; - int *retval; + register struct compat_43_sigvec_args /* { + syscallarg(int) signum; + syscallarg(struct sigvec *) nsv; + syscallarg(struct sigvec *) osv; + } */ *uap; + register_t *retval; { struct sigvec vec; register struct sigacts *ps = p->p_sigacts; @@ -305,12 +305,12 @@ osigvec(p, uap, retval) register int signum; int bit, error; - signum = uap->signum; + signum = SCARG(uap, signum); if (signum <= 0 || signum >= NSIG || signum == SIGKILL || signum == SIGSTOP) return (EINVAL); sv = &vec; - if (uap->osv) { + if (SCARG(uap, osv)) { *(sig_t *)&sv->sv_handler = ps->ps_sigact[signum]; sv->sv_mask = ps->ps_catchmask[signum]; bit = sigmask(signum); @@ -324,12 +324,12 @@ osigvec(p, uap, retval) #endif if (p->p_flag & P_NOCLDSTOP) sv->sv_flags |= SA_NOCLDSTOP; - if (error = copyout((caddr_t)sv, (caddr_t)uap->osv, + if (error = copyout((caddr_t)sv, (caddr_t)SCARG(uap, osv), sizeof (vec))) return (error); } - if (uap->nsv) { - if (error = copyin((caddr_t)uap->nsv, (caddr_t)sv, + if (SCARG(uap, nsv)) { + if (error = copyin((caddr_t)SCARG(uap, nsv), (caddr_t)sv, sizeof (vec))) return (error); #ifdef COMPAT_SUNOS @@ -350,35 +350,33 @@ osigvec(p, uap, retval) return (0); } -struct osigblock_args { - int mask; -}; -osigblock(p, uap, retval) +compat_43_sigblock(p, uap, retval) register struct proc *p; - struct osigblock_args *uap; - int *retval; + struct compat_43_sigblock_args /* { + syscallarg(int) mask; + } */ *uap; + register_t *retval; { (void) splhigh(); *retval = p->p_sigmask; - p->p_sigmask |= uap->mask &~ sigcantmask; + p->p_sigmask |= SCARG(uap, mask) &~ sigcantmask; (void) spl0(); return (0); } -struct osigsetmask_args { - int mask; -}; int -osigsetmask(p, uap, retval) +compat_43_sigsetmask(p, uap, retval) struct proc *p; - struct osigsetmask_args *uap; - int *retval; + struct compat_43_sigsetmask_args /* { + syscallarg(int) mask; + } */ *uap; + register_t *retval; { (void) splhigh(); *retval = p->p_sigmask; - p->p_sigmask = uap->mask &~ sigcantmask; + p->p_sigmask = SCARG(uap, mask) &~ sigcantmask; (void) spl0(); return (0); } @@ -389,15 +387,14 @@ osigsetmask(p, uap, retval) * in the meantime. Note nonstandard calling convention: * libc stub passes mask, not pointer, to save a copyin. */ -struct sigsuspend_args { - sigset_t mask; -}; /* ARGSUSED */ int sigsuspend(p, uap, retval) register struct proc *p; - struct sigsuspend_args *uap; - int *retval; + struct sigsuspend_args /* { + syscallarg(int) mask; + } */ *uap; + register_t *retval; { register struct sigacts *ps = p->p_sigacts; @@ -410,24 +407,24 @@ sigsuspend(p, uap, retval) */ ps->ps_oldmask = p->p_sigmask; ps->ps_flags |= SAS_OLDMASK; - p->p_sigmask = uap->mask &~ sigcantmask; + p->p_sigmask = SCARG(uap, mask) &~ sigcantmask; while (tsleep((caddr_t) ps, PPAUSE|PCATCH, "pause", 0) == 0) /* void */; /* always return EINTR rather than ERESTART... */ return (EINTR); } -#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_HPUX) -struct osigstack_args { - struct sigstack *nss; - struct sigstack *oss; -}; +#if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_HPUX) || \ + defined(COMPAT_OSF1) /* ARGSUSED */ int -osigstack(p, uap, retval) +compat_43_sigstack(p, uap, retval) struct proc *p; - register struct osigstack_args *uap; - int *retval; + register struct compat_43_sigstack_args /* { + syscallarg(struct sigstack *) nss; + syscallarg(struct sigstack *) oss; + } */ *uap; + register_t *retval; { struct sigstack ss; struct sigacts *psp; @@ -436,11 +433,11 @@ osigstack(p, uap, retval) psp = p->p_sigacts; ss.ss_sp = psp->ps_sigstk.ss_base; ss.ss_onstack = psp->ps_sigstk.ss_flags & SA_ONSTACK; - if (uap->oss && (error = copyout((caddr_t)&ss, (caddr_t)uap->oss, - sizeof (struct sigstack)))) + if (SCARG(uap, oss) && (error = copyout((caddr_t)&ss, + (caddr_t)SCARG(uap, oss), sizeof (struct sigstack)))) return (error); - if (uap->nss && (error = copyin((caddr_t)uap->nss, (caddr_t)&ss, - sizeof (ss))) == 0) { + if (SCARG(uap, nss) && (error = copyin((caddr_t)SCARG(uap, nss), + (caddr_t)&ss, sizeof (ss))) == 0) { psp->ps_sigstk.ss_base = ss.ss_sp; psp->ps_sigstk.ss_size = 0; psp->ps_sigstk.ss_flags |= ss.ss_onstack & SA_ONSTACK; @@ -450,15 +447,14 @@ osigstack(p, uap, retval) } #endif /* COMPAT_43 || COMPAT_SUNOS || COMPAT_HPUX */ -struct sigaltstack_args { - struct sigaltstack *nss; - struct sigaltstack *oss; -}; /* ARGSUSED */ sigaltstack(p, uap, retval) struct proc *p; - register struct sigaltstack_args *uap; - int *retval; + register struct sigaltstack_args /* { + syscallarg(struct sigaltstack *) nss; + syscallarg(struct sigaltstack *) oss; + } */ *uap; + register_t *retval; { struct sigacts *psp; struct sigaltstack ss; @@ -467,12 +463,13 @@ sigaltstack(p, uap, retval) psp = p->p_sigacts; if ((psp->ps_flags & SAS_ALTSTACK) == 0) psp->ps_sigstk.ss_flags |= SA_DISABLE; - if (uap->oss && (error = copyout((caddr_t)&psp->ps_sigstk, - (caddr_t)uap->oss, sizeof (struct sigaltstack)))) + if (SCARG(uap, oss) && (error = copyout((caddr_t)&psp->ps_sigstk, + (caddr_t)SCARG(uap, oss), sizeof (struct sigaltstack)))) return (error); - if (uap->nss == 0) + if (SCARG(uap, nss) == 0) return (0); - if (error = copyin((caddr_t)uap->nss, (caddr_t)&ss, sizeof (ss))) + if (error = copyin((caddr_t)SCARG(uap, nss), (caddr_t)&ss, + sizeof (ss))) return (error); if (ss.ss_flags & SA_DISABLE) { if (psp->ps_sigstk.ss_flags & SA_ONSTACK) @@ -488,66 +485,64 @@ sigaltstack(p, uap, retval) return (0); } -struct kill_args { - pid_t pid; - int signum; -}; /* ARGSUSED */ int kill(cp, uap, retval) register struct proc *cp; - register struct kill_args *uap; - int *retval; + register struct kill_args /* { + syscallarg(int) pid; + syscallarg(int) signum; + } */ *uap; + register_t *retval; { register struct proc *p; register struct pcred *pc = cp->p_cred; #ifdef COMPAT_09 - uap->pid = (short) uap->pid; + SCARG(uap, pid) = (short) SCARG(uap, pid); #endif - if ((u_int)uap->signum >= NSIG) + if ((u_int)SCARG(uap, signum) >= NSIG) return (EINVAL); - if (uap->pid > 0) { + if (SCARG(uap, pid) > 0) { /* kill single process */ - if ((p = pfind(uap->pid)) == NULL) + if ((p = pfind(SCARG(uap, pid))) == NULL) return (ESRCH); - if (!CANSIGNAL(cp, pc, p, uap->signum)) + if (!CANSIGNAL(cp, pc, p, SCARG(uap, signum))) return (EPERM); - if (uap->signum) - psignal(p, uap->signum); + if (SCARG(uap, signum)) + psignal(p, SCARG(uap, signum)); return (0); } - switch (uap->pid) { + switch (SCARG(uap, pid)) { case -1: /* broadcast signal */ - return (killpg1(cp, uap->signum, 0, 1)); + return (killpg1(cp, SCARG(uap, signum), 0, 1)); case 0: /* signal own process group */ - return (killpg1(cp, uap->signum, 0, 0)); + return (killpg1(cp, SCARG(uap, signum), 0, 0)); default: /* negative explicit process group */ - return (killpg1(cp, uap->signum, -uap->pid, 0)); + return (killpg1(cp, SCARG(uap, signum), -SCARG(uap, pid), 0)); } /* NOTREACHED */ } #if defined(COMPAT_43) || defined(COMPAT_SUNOS) -struct okillpg_args { - int pgid; - int signum; -}; /* ARGSUSED */ -okillpg(p, uap, retval) +compat_43_killpg(p, uap, retval) struct proc *p; - register struct okillpg_args *uap; - int *retval; + register struct compat_43_killpg_args /* { + syscallarg(int) pgid; + syscallarg(int) signum; + } */ *uap; + register_t *retval; { #ifdef COMPAT_09 - uap->pgid = (short) uap->pgid; + SCARG(uap, pgid) = (short) SCARG(uap, pgid); #endif - if ((u_int)uap->signum >= NSIG) + if ((u_int)SCARG(uap, signum) >= NSIG) return (EINVAL); - return (killpg1(p, uap->signum, uap->pgid, 0)); + return (killpg1(p, SCARG(uap, signum), SCARG(uap, pgid), 0)); } #endif /* COMPAT_43 || COMPAT_SUNOS */ @@ -1255,7 +1250,7 @@ int nosys(p, args, retval) struct proc *p; void *args; - int *retval; + register_t *retval; { psignal(p, SIGSYS); diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 6d02ab6a5f5c..03d8aa4bf062 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sysctl.c,v 1.4 1994/09/16 23:57:22 deraadt Exp $ */ +/* $NetBSD: kern_sysctl.c,v 1.5 1994/10/20 04:22:57 cgd Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -56,6 +56,9 @@ #include #include +#include +#include + sysctlfn kern_sysctl; sysctlfn hw_sysctl; #ifdef DEBUG @@ -75,34 +78,34 @@ static struct sysctl_lock { int sl_locked; } memlock; -struct sysctl_args { - int *name; - u_int namelen; - void *old; - size_t *oldlenp; - void *new; - size_t newlen; -}; - int __sysctl(p, uap, retval) struct proc *p; - register struct sysctl_args *uap; - int *retval; + register struct __sysctl_args /* { + syscallarg(int *) name; + syscallarg(u_int) namelen; + syscallarg(void *) old; + syscallarg(size_t *) oldlenp; + syscallarg(void *) new; + syscallarg(size_t) newlen; + } */ *uap; + register_t *retval; { int error, dolock = 1; u_int savelen, oldlen = 0; sysctlfn *fn; int name[CTL_MAXNAME]; - if (uap->new != NULL && (error = suser(p->p_ucred, &p->p_acflag))) + if (SCARG(uap, new) != NULL && + (error = suser(p->p_ucred, &p->p_acflag))) return (error); /* * all top-level sysctl names are non-terminal */ - if (uap->namelen > CTL_MAXNAME || uap->namelen < 2) + if (SCARG(uap, namelen) > CTL_MAXNAME || SCARG(uap, namelen) < 2) return (EINVAL); - if (error = copyin(uap->name, &name, uap->namelen * sizeof(int))) + if (error = + copyin(SCARG(uap, name), &name, SCARG(uap, namelen) * sizeof(int))) return (error); switch (name[0]) { @@ -137,11 +140,11 @@ __sysctl(p, uap, retval) return (EOPNOTSUPP); } - if (uap->oldlenp && - (error = copyin(uap->oldlenp, &oldlen, sizeof(oldlen)))) + if (SCARG(uap, oldlenp) && + (error = copyin(SCARG(uap, oldlenp), &oldlen, sizeof(oldlen)))) return (error); - if (uap->old != NULL) { - if (!useracc(uap->old, oldlen, B_WRITE)) + if (SCARG(uap, old) != NULL) { + if (!useracc(SCARG(uap, old), oldlen, B_WRITE)) return (EFAULT); while (memlock.sl_lock) { memlock.sl_want = 1; @@ -150,14 +153,14 @@ __sysctl(p, uap, retval) } memlock.sl_lock = 1; if (dolock) - vslock(uap->old, oldlen); + vslock(SCARG(uap, old), oldlen); savelen = oldlen; } - error = (*fn)(name + 1, uap->namelen - 1, uap->old, &oldlen, - uap->new, uap->newlen, p); - if (uap->old != NULL) { + error = (*fn)(name + 1, SCARG(uap, namelen) - 1, SCARG(uap, old), + &oldlen, SCARG(uap, new), SCARG(uap, newlen), p); + if (SCARG(uap, old) != NULL) { if (dolock) - vsunlock(uap->old, savelen, B_WRITE); + vsunlock(SCARG(uap, old), savelen, B_WRITE); memlock.sl_lock = 0; if (memlock.sl_want) { memlock.sl_want = 0; @@ -166,8 +169,8 @@ __sysctl(p, uap, retval) } if (error) return (error); - if (uap->oldlenp) - error = copyout(&oldlen, uap->oldlenp, sizeof(oldlen)); + if (SCARG(uap, oldlenp)) + error = copyout(&oldlen, SCARG(uap, oldlenp), sizeof(oldlen)); *retval = oldlen; return (0); } @@ -717,66 +720,71 @@ fill_eproc(p, ep) #define KINFO_LOADAVG (5<<8) #define KINFO_CLOCKRATE (6<<8) -struct getkerninfo_args { - int op; - char *where; - int *size; - int arg; -}; - -ogetkerninfo(p, uap, retval) +compat_43_getkerninfo(p, uap, retval) struct proc *p; - register struct getkerninfo_args *uap; - int *retval; + register struct compat_43_getkerninfo_args /* { + syscallarg(int) op; + syscallarg(char *) where; + syscallarg(int *) size; + syscallarg(int) arg; + } */ *uap; + register_t *retval; { int error, name[5]; u_int size; - if (uap->size && - (error = copyin((caddr_t)uap->size, (caddr_t)&size, sizeof(size)))) + if (SCARG(uap, size) && (error = copyin((caddr_t)SCARG(uap, size), + (caddr_t)&size, sizeof(size)))) return (error); - switch (uap->op & 0xff00) { + switch (SCARG(uap, op) & 0xff00) { case KINFO_RT: name[0] = PF_ROUTE; name[1] = 0; - name[2] = (uap->op & 0xff0000) >> 16; - name[3] = uap->op & 0xff; - name[4] = uap->arg; - error = net_sysctl(name, 5, uap->where, &size, NULL, 0, p); + name[2] = (SCARG(uap, op) & 0xff0000) >> 16; + name[3] = SCARG(uap, op) & 0xff; + name[4] = SCARG(uap, arg); + error = + net_sysctl(name, 5, SCARG(uap, where), &size, NULL, 0, p); break; case KINFO_VNODE: name[0] = KERN_VNODE; - error = kern_sysctl(name, 1, uap->where, &size, NULL, 0, p); + error = + kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p); break; case KINFO_PROC: name[0] = KERN_PROC; - name[1] = uap->op & 0xff; - name[2] = uap->arg; - error = kern_sysctl(name, 3, uap->where, &size, NULL, 0, p); + name[1] = SCARG(uap, op) & 0xff; + name[2] = SCARG(uap, arg); + error = + kern_sysctl(name, 3, SCARG(uap, where), &size, NULL, 0, p); break; case KINFO_FILE: name[0] = KERN_FILE; - error = kern_sysctl(name, 1, uap->where, &size, NULL, 0, p); + error = + kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p); break; case KINFO_METER: name[0] = VM_METER; - error = vm_sysctl(name, 1, uap->where, &size, NULL, 0, p); + error = + vm_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p); break; case KINFO_LOADAVG: name[0] = VM_LOADAVG; - error = vm_sysctl(name, 1, uap->where, &size, NULL, 0, p); + error = + vm_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p); break; case KINFO_CLOCKRATE: name[0] = KERN_CLOCKRATE; - error = kern_sysctl(name, 1, uap->where, &size, NULL, 0, p); + error = + kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p); break; default: @@ -785,8 +793,8 @@ ogetkerninfo(p, uap, retval) if (error) return (error); *retval = size; - if (uap->size) - error = copyout((caddr_t)&size, (caddr_t)uap->size, + if (SCARG(uap, size)) + error = copyout((caddr_t)&size, (caddr_t)SCARG(uap, size), sizeof(size)); return (error); } diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 9ee9c5100d1e..e5a0e1c17307 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_time.c,v 1.10 1994/09/18 21:49:07 mycroft Exp $ */ +/* $NetBSD: kern_time.c,v 1.11 1994/10/20 04:22:59 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -42,6 +42,9 @@ #include #include +#include +#include + #include /* @@ -54,42 +57,40 @@ * timers when they expire. */ -struct gettimeofday_args { - struct timeval *tp; - struct timezone *tzp; -}; /* ARGSUSED */ int gettimeofday(p, uap, retval) struct proc *p; - register struct gettimeofday_args *uap; - int *retval; + register struct gettimeofday_args /* { + syscallarg(struct timeval *) tp; + syscallarg(struct timezone *) tzp; + } */ *uap; + register_t *retval; { struct timeval atv; int error = 0; - if (uap->tp) { + if (SCARG(uap, tp)) { microtime(&atv); - if (error = copyout((caddr_t)&atv, (caddr_t)uap->tp, + if (error = copyout((caddr_t)&atv, (caddr_t)SCARG(uap, tp), sizeof (atv))) return (error); } - if (uap->tzp) - error = copyout((caddr_t)&tz, (caddr_t)uap->tzp, + if (SCARG(uap, tzp)) + error = copyout((caddr_t)&tz, (caddr_t)SCARG(uap, tzp), sizeof (tz)); return (error); } -struct settimeofday_args { - struct timeval *tv; - struct timezone *tzp; -}; /* ARGSUSED */ int settimeofday(p, uap, retval) struct proc *p; - struct settimeofday_args *uap; - int *retval; + struct settimeofday_args /* { + syscallarg(struct timeval *) tv; + syscallarg(struct timezone *) tzp; + } */ *uap; + register_t *retval; { struct timeval atv, delta; struct timezone atz; @@ -98,13 +99,13 @@ settimeofday(p, uap, retval) if (error = suser(p->p_ucred, &p->p_acflag)) return (error); /* Verify all parameters before changing time. */ - if (uap->tv && - (error = copyin((caddr_t)uap->tv, (caddr_t)&atv, sizeof(atv)))) + if (SCARG(uap, tv) && (error = copyin((caddr_t)SCARG(uap, tv), + (caddr_t)&atv, sizeof(atv)))) return (error); - if (uap->tzp && - (error = copyin((caddr_t)uap->tzp, (caddr_t)&atz, sizeof(atz)))) + if (SCARG(uap, tzp) && (error = copyin((caddr_t)SCARG(uap, tzp), + (caddr_t)&atz, sizeof(atz)))) return (error); - if (uap->tv) { + if (SCARG(uap, tv)) { /* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */ s = splclock(); /* nb. delta.tv_usec may be < 0, but this is OK here */ @@ -120,7 +121,7 @@ settimeofday(p, uap, retval) splx(s); resettodr(); } - if (uap->tzp) + if (SCARG(uap, tzp)) tz = atz; return (0); } @@ -129,16 +130,15 @@ int tickdelta; /* current clock skew, us. per tick */ long timedelta; /* unapplied time correction, us. */ long bigadj = 1000000; /* use 10x skew above bigadj us. */ -struct adjtime_args { - struct timeval *delta; - struct timeval *olddelta; -}; /* ARGSUSED */ int adjtime(p, uap, retval) struct proc *p; - register struct adjtime_args *uap; - int *retval; + register struct adjtime_args /* { + syscallarg(struct timeval *) delta; + syscallarg(struct timeval *) olddelta; + } */ *uap; + register_t *retval; { struct timeval atv; register long ndelta, ntickdelta, odelta; @@ -146,8 +146,8 @@ adjtime(p, uap, retval) if (error = suser(p->p_ucred, &p->p_acflag)) return (error); - if (error = - copyin((caddr_t)uap->delta, (caddr_t)&atv, sizeof(struct timeval))) + if (error = copyin((caddr_t)SCARG(uap, delta), (caddr_t)&atv, + sizeof(struct timeval))) return (error); /* @@ -178,10 +178,10 @@ adjtime(p, uap, retval) tickdelta = ntickdelta; splx(s); - if (uap->olddelta) { + if (SCARG(uap, olddelta)) { atv.tv_sec = odelta / 1000000; atv.tv_usec = odelta % 1000000; - (void) copyout((caddr_t)&atv, (caddr_t)uap->olddelta, + (void) copyout((caddr_t)&atv, (caddr_t)SCARG(uap, olddelta), sizeof(struct timeval)); } return (0); @@ -208,24 +208,23 @@ adjtime(p, uap, retval) * real time timers .it_interval. Rather, we compute the next time in * absolute time the timer should go off. */ -struct getitimer_args { - u_int which; - struct itimerval *itv; -}; /* ARGSUSED */ int getitimer(p, uap, retval) struct proc *p; - register struct getitimer_args *uap; - int *retval; + register struct getitimer_args /* { + syscallarg(u_int) which; + syscallarg(struct itimerval *) itv; + } */ *uap; + register_t *retval; { struct itimerval aitv; int s; - if (uap->which > ITIMER_PROF) + if (SCARG(uap, which) > ITIMER_PROF) return (EINVAL); s = splclock(); - if (uap->which == ITIMER_REAL) { + if (SCARG(uap, which) == ITIMER_REAL) { /* * Convert from absoulte to relative time in .it_value * part of real time timer. If time for real time timer @@ -240,41 +239,42 @@ getitimer(p, uap, retval) timevalsub(&aitv.it_value, (struct timeval *)&time); } else - aitv = p->p_stats->p_timer[uap->which]; + aitv = p->p_stats->p_timer[SCARG(uap, which)]; splx(s); - return (copyout((caddr_t)&aitv, (caddr_t)uap->itv, + return (copyout((caddr_t)&aitv, (caddr_t)SCARG(uap, itv), sizeof (struct itimerval))); } -struct setitimer_args { - u_int which; - struct itimerval *itv, *oitv; -}; /* ARGSUSED */ int setitimer(p, uap, retval) struct proc *p; - register struct setitimer_args *uap; - int *retval; + register struct setitimer_args /* { + syscallarg(u_int) which; + syscallarg(struct itimerval *) itv; + syscallarg(struct itimerval *) oitv; + } */ *uap; + register_t *retval; { struct itimerval aitv; register struct itimerval *itvp; int s, error; - if (uap->which > ITIMER_PROF) + if (SCARG(uap, which) > ITIMER_PROF) return (EINVAL); - itvp = uap->itv; + itvp = SCARG(uap, itv); if (itvp && (error = copyin((caddr_t)itvp, (caddr_t)&aitv, sizeof(struct itimerval)))) return (error); - if ((uap->itv = uap->oitv) && (error = getitimer(p, uap, retval))) + if ((SCARG(uap, itv) = SCARG(uap, oitv)) && + (error = getitimer(p, uap, retval))) return (error); if (itvp == 0) return (0); if (itimerfix(&aitv.it_value) || itimerfix(&aitv.it_interval)) return (EINVAL); s = splclock(); - if (uap->which == ITIMER_REAL) { + if (SCARG(uap, which) == ITIMER_REAL) { untimeout(realitexpire, p); if (timerisset(&aitv.it_value)) { timevaladd(&aitv.it_value, (struct timeval *)&time); @@ -282,7 +282,7 @@ setitimer(p, uap, retval) } p->p_realtimer = aitv; } else - p->p_stats->p_timer[uap->which] = aitv; + p->p_stats->p_timer[SCARG(uap, which)] = aitv; splx(s); return (0); } diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index f3a7dc87a573..4645cd6f0c87 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_xxx.c,v 1.18 1994/06/29 06:32:50 cgd Exp $ */ +/* $NetBSD: kern_xxx.c,v 1.19 1994/10/20 04:23:01 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -43,53 +43,51 @@ #include #include -struct reboot_args { - int opt; -}; +#include +#include + /* ARGSUSED */ int reboot(p, uap, retval) struct proc *p; - struct reboot_args *uap; - int *retval; + struct reboot_args /* { + syscallarg(int) opt; + } */ *uap; + register_t *retval; { int error; if (error = suser(p->p_ucred, &p->p_acflag)) return (error); - boot(uap->opt); + boot(SCARG(uap, opt)); return (0); } #if defined(COMPAT_43) || defined(COMPAT_SUNOS) -struct ogethostname_args { - char *hostname; - u_int len; -}; /* ARGSUSED */ int -ogethostname(p, uap, retval) +compat_43_gethostname(p, uap, retval) struct proc *p; - struct ogethostname_args *uap; - int *retval; + struct compat_43_gethostname_args /* { + syscallarg(char *) hostname; + syscallarg(u_int) len; + } */ *uap; + register_t *retval; { int name; name = KERN_HOSTNAME; - return (kern_sysctl(&name, 1, uap->hostname, &uap->len, 0, 0)); + return (kern_sysctl(&name, 1, SCARG(uap, hostname), &SCARG(uap, len), + 0, 0)); } -struct osethostname_args { - char *hostname; - u_int len; -}; /* ARGSUSED */ int -osethostname(p, uap, retval) +compat_43_sethostname(p, uap, retval) struct proc *p; - register struct osethostname_args *uap; - int *retval; + register struct compat_43_sethostname_args *uap; + register_t *retval; { int name; int error; @@ -97,43 +95,46 @@ osethostname(p, uap, retval) if (error = suser(p->p_ucred, &p->p_acflag)) return (error); name = KERN_HOSTNAME; - return (kern_sysctl(&name, 1, 0, 0, uap->hostname, uap->len)); + return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, hostname), + SCARG(uap, len))); } /* ARGSUSED */ int -ogethostid(p, uap, retval) +compat_43_gethostid(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { - *(long *)retval = hostid; + *(int32_t *)retval = hostid; return (0); } #endif /* COMPAT_43 || COMPAT_SUNOS */ #ifdef COMPAT_43 -struct osethostid_args { - long hostid; -}; /* ARGSUSED */ int -osethostid(p, uap, retval) +compat_43_sethostid(p, uap, retval) struct proc *p; - struct osethostid_args *uap; - int *retval; + struct compat_43_sethostid_args /* { + syscallarg(int32_t) hostid; + } */ *uap; + register_t *retval; { int error; if (error = suser(p->p_ucred, &p->p_acflag)) return (error); - hostid = uap->hostid; + hostid = SCARG(uap, hostid); return (0); } int -oquota() +compat_43_quota(p, uap, retval) + struct proc *p; + void *uap; + register_t *retval; { return (ENOSYS); @@ -141,33 +142,32 @@ oquota() #endif /* COMPAT_43 */ #if defined(COMPAT_09) || defined(COMPAT_SUNOS) || defined(COMPAT_HPUX) -struct ogetdomainname_args { - char *domainname; - u_int len; -}; /* ARGSUSED */ int -ogetdomainname(p, uap, retval) +compat_09_getdomainname(p, uap, retval) struct proc *p; - struct ogetdomainname_args *uap; - int *retval; + struct compat_09_getdomainname_args /* { + syscallarg(char *) domainname; + syscallarg(int) len; + } */ *uap; + register_t *retval; { int name; name = KERN_DOMAINNAME; - return (kern_sysctl(&name, 1, uap->domainname, &uap->len, 0, 0)); + return (kern_sysctl(&name, 1, SCARG(uap, domainname), + &SCARG(uap, len), 0, 0)); } -struct osetdomainname_args { - char *domainname; - u_int len; -}; /* ARGSUSED */ int -osetdomainname(p, uap, retval) +compat_09_setdomainname(p, uap, retval) struct proc *p; - struct osetdomainname_args *uap; - int *retval; + struct compat_09_setdomainname_args /* { + syscallarg(char *) domainname; + syscallarg(int) len; + } */ *uap; + register_t *retval; { int name; int error; @@ -175,7 +175,8 @@ osetdomainname(p, uap, retval) if (error = suser(p->p_ucred, &p->p_acflag)) return (error); name = KERN_DOMAINNAME; - return (kern_sysctl(&name, 1, 0, 0, uap->domainname, uap->len)); + return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, domainname), + SCARG(uap, len))); } #endif /* COMPAT_09 || COMPAT_SUNOS || COMPAT_HPUX */ @@ -188,15 +189,14 @@ struct outsname { char machine[32]; }; -struct ouname_args { - struct outsname *name; -}; /* ARGSUSED */ int -ouname(p, uap, retval) +compat_09_uname(p, uap, retval) struct proc *p; - struct ouname_args *uap; - int *retval; + struct compat_09_uname_args /* { + syscallarg(struct outsname *) name; + } */ *uap; + register_t *retval; { struct outsname outsname; char *cp, *dp, *ep; @@ -217,50 +217,119 @@ ouname(p, uap, retval) *dp++ = *cp; *dp = '\0'; strncpy(outsname.machine, MACHINE, sizeof(outsname.machine)); - return (copyout((caddr_t)&outsname, (caddr_t)uap->name, + return (copyout((caddr_t)&outsname, (caddr_t)SCARG(uap, name), sizeof(struct outsname))); } #endif /* COMPAT_09 */ #ifdef SYSCALL_DEBUG -int scdebug = 1; /* XXX */ +#define SCDEBUG_CALLS 0x0001 /* show calls */ +#define SCDEBUG_RETURNS 0x0002 /* show returns */ +#define SCDEBUG_ALL 0x0004 /* even syscalls that are implemented */ +#define SCDEBUG_SHOWARGS 0x0008 /* show arguments to calls */ + +int scdebug = SCDEBUG_CALLS|SCDEBUG_RETURNS|SCDEBUG_SHOWARGS; + +extern int nsysent; +extern char *syscallnames[]; + +#ifdef COMPAT_OSF1 +extern int nosf1_sysent; +extern struct sysent osf1_sysent[]; +extern char *osf1_syscallnames[]; +#endif /* COMPAT_OSF1 */ + +static struct os_syscall { + char *name; + int *nsysent; + struct sysent *sysent; + char **syscallnames; +} os_syscall[] = { + { "NetBSD", &nsysent, sysent, syscallnames }, + { 0 }, + { 0 }, + { 0 }, + { 0 }, + { 0 }, +#ifdef COMPAT_OSF1 + { "OSF/1", &nosf1_sysent, osf1_sysent, osf1_syscallnames }, +#else + { NULL, }, +#endif +}; void -scdebug_call(p, code, narg, args) +scdebug_call(p, code, args) struct proc *p; - int code, narg, *args; + int code; + register_t *args; { + struct os_syscall *os; + struct sysent *sy; int i; - if (!scdebug) + if (!(scdebug & SCDEBUG_CALLS)) return; - printf("proc %d: syscall ", p->p_pid); - if (code < 0 || code >= nsysent) { +#ifdef DIAGNOSTIC + if (p->p_emul > sizeof os_syscall/sizeof os_syscall[0] || + os_syscall[p->p_emul].name == NULL) + panic("bogus p_emul"); +#endif + + os = &os_syscall[p->p_emul]; + sy = &os->sysent[code]; + if (!(scdebug & SCDEBUG_ALL || code < 0 || code >= *os->nsysent || + sy->sy_call == nosys)) + return; + + printf("proc %d (%s): %s syscall ", p->p_pid, p->p_comm, os->name); + if (code < 0 || code >= *os->nsysent) { printf("OUT OF RANGE (%d)", code); code = 0; } else printf("%d", code); - printf(" called: %s(", syscallnames[code]); - for (i = 0; i < narg; i++) - printf("0x%x, ", args[i]); - printf(")\n"); + printf(" called: %s", os->syscallnames[code]); + if (scdebug & SCDEBUG_SHOWARGS) { + printf("("); + for (i = 0; i < sy->sy_argsize / sizeof(register_t); i++) + printf("%s0x%lx", i == 0 ? "" : ", ", (long)args[i]); + printf(")"); + } + printf("\n"); } void scdebug_ret(p, code, error, retval) struct proc *p; - int code, error, retval; + int code, error; + register_t *retval; { - if (!scdebug) + struct os_syscall *os; + struct sysent *sy; + + if (!(scdebug & SCDEBUG_RETURNS)) return; - printf("proc %d: syscall ", p->p_pid); - if (code < 0 || code >= nsysent) { +#ifdef DIAGNOSTIC + if (p->p_emul > sizeof os_syscall/sizeof os_syscall[0] || + os_syscall[p->p_emul].name == NULL) + panic("bogus p_emul"); +#endif + + os = &os_syscall[p->p_emul]; + sy = &os->sysent[code]; + if (!(scdebug & SCDEBUG_ALL || code < 0 || code >= *os->nsysent || + sy->sy_call == nosys)) + return; + + printf("proc %d (%s): %s syscall ", p->p_pid, p->p_comm, os->name); + if (code < 0 || code >= *os->nsysent) { printf("OUT OF RANGE (%d)", code); code = 0; } else printf("%d", code); - printf(" return: error = %d, retval = %d\n", error, retval); + printf(" return: error = %d, retval = 0x%lx,0x%lx\n", error, + (long)retval[0], (long)retval[1]); } #endif /* SYSCALL_DEBUG */ diff --git a/sys/kern/makesyscalls.sh b/sys/kern/makesyscalls.sh index accd0744f52d..0a8d9839179c 100644 --- a/sys/kern/makesyscalls.sh +++ b/sys/kern/makesyscalls.sh @@ -1,196 +1,364 @@ #! /bin/sh - -# $NetBSD: makesyscalls.sh,v 1.10 1994/06/30 16:43:01 cgd Exp $ +# $NetBSD: makesyscalls.sh,v 1.11 1994/10/20 04:23:02 cgd Exp $ # # @(#)makesyscalls.sh 8.1 (Berkeley) 6/10/93 set -e -# name of compat option: -compat=COMPAT_43 -ncompat=COMPAT_09 - -# output files: -sysnames="syscalls.c" -syshdr="../sys/syscall.h" -syssw="init_sysent.c" - -# tmp files: -sysdcl="sysent.dcl" -syscompat="sysent.compat" -sysncompat="sysent.ncompat" -sysent="sysent.switch" - -trap "rm $sysdcl $syscompat $sysncompat $sysent" 0 - case $# in - 0) echo "Usage: $0 input-file" 1>&2 + 2) ;; + *) echo "Usage: $0 config-file input-file" 1>&2 exit 1 ;; esac -awk < $1 " - BEGIN { - sysdcl = \"$sysdcl\" - syscompat = \"$syscompat\" - sysncompat = \"$sysncompat\" - sysent = \"$sysent\" - sysnames = \"$sysnames\" - syshdr = \"$syshdr\" - compat = \"$compat\" - ncompat = \"$ncompat\" - infile = \"$1\" - "' +# source the config file. +. $1 - printf "/*\n * System call switch table.\n *\n" > sysdcl - printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysdcl +# the config file sets the following variables: +# sysnames the syscall names file +# sysnumhdr the syscall numbers file +# syssw the syscall switch file +# sysarghdr the syscall argument struct definitions +# compatopts those syscall types that are for 'compat' syscalls +# switchname the name for the 'struct sysent' we define +# namesname the name for the 'char *[]' we define +# constprefix the prefix for the system call constants +# +# NOTE THAT THIS makesyscalls.sh DOES NOT SUPPORT 'LIBCOMPAT'. - printf "\n#ifdef %s\n", compat > syscompat - printf "#define compat(n, name) n, __CONCAT(o,name)\n\n" > syscompat +# tmp files: +sysdcl="sysent.dcl" +syscompat_pref="sysent." +sysent="sysent.switch" - printf "\n#ifdef %s\n", ncompat > sysncompat - printf "#define ncompat(n, name) n, __CONCAT(o,name)\n\n" > sysncompat +syscompat_files="" +for file in $compatopts; do + syscompat_files="$syscompat_files $syscompat_pref$file" +done - printf "/*\n * System call names.\n *\n" > sysnames - printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames +trap "rm $sysdcl $syscompat_files $sysent" 0 - printf "/*\n * System call numbers.\n *\n" > syshdr - printf " * DO NOT EDIT-- this file is automatically generated.\n" > syshdr - } - NR == 1 { - printf " * created from: NetBSD %s %s %s %s\n */\n\n",$2,$3,$4,$5 > sysdcl - printf "#include \n" > sysdcl - printf "#include \n\n" > sysdcl - printf "int\tnosys();\n\n" > sysdcl +# Awk program (must support nawk extensions) +# Use "awk" at Berkeley, "nawk" or "gawk" elsewhere. +awk=${AWK:-awk} - printf "struct sysent sysent[] = {\n" > sysent +# Does this awk have a "toupper" function? (i.e. is it GNU awk) +isgawk=`$awk 'BEGIN { print toupper("true"); exit; }' 2>/dev/null` - printf " * created from: NetBSD %s %s %s %s\n */\n\n",$2,$3,$4,$5 > sysnames - printf "char *syscallnames[] = {\n" > sysnames +# If this awk does not define "toupper" then define our own. +if [ "$isgawk" = TRUE ] ; then + # GNU awk provides it. + toupper= +else + # Provide our own toupper() + toupper=' +function toupper(str) { + _toupper_cmd = "echo "str" |tr a-z A-Z" + _toupper_cmd | getline _toupper_str; + close(_toupper_cmd); + return _toupper_str; +}' +fi - printf " * created from: NetBSD %s %s %s %s\n */\n\n",$2,$3,$4,$5 > syshdr - next - } - NF == 0 || $1 ~ /^;/ { - next - } - $1 ~ /^#[ ]*if/ { - print > sysent - print > sysdcl - print > syscompat - print > sysnames - savesyscall = syscall - next - } - $1 ~ /^#[ ]*else/ { - print > sysent - print > sysdcl - print > syscompat - print > sysnames - syscall = savesyscall - next - } - $1 ~ /^#/ { - print > sysent - print > sysdcl - print > syscompat - print > sysnames - next - } - syscall != $1 { - printf "%s: line %d: syscall number out of sync at %d\n", \ - infile, NR, syscall - printf "line is:\n" - print - exit 1 - } - { comment = $4 - for (i = 5; i <= NF; i++) - comment = comment " " $i - if (NF < 5) - $5 = $4 - } - $2 == "STD" || $2 == "NODEF" { - printf("int\t%s();\n", $4) > sysdcl - printf("\t{ %d, %s },\t\t\t/* %d = %s */\n", \ - $3, $4, syscall, $5) > sysent - printf("\t\"%s\",\t\t\t/* %d = %s */\n", \ - $5, syscall, $5) > sysnames - if ($2 == "STD") - printf("#define\tSYS_%s\t%d\n", \ - $5, syscall) > syshdr - syscall++ - next - } - $2 == "COMPAT" { - printf("int\to%s();\n", $4) > syscompat - printf("\t{ compat(%d,%s) },\t\t/* %d = old %s */\n", \ - $3, $4, syscall, $5) > sysent - printf("\t\"old.%s\",\t\t/* %d = old %s */\n", \ - $5, syscall, $5) > sysnames - printf("\t\t\t\t/* %d is old %s */\n", \ - syscall, comment) > syshdr - syscall++ - next - } - $2 == "NCOMPAT" { - printf("int\to%s();\n", $4) > sysncompat - printf("\t{ ncompat(%d,%s) },\t\t/* %d = old %s */\n", \ - $3, $4, syscall, $5) > sysent - printf("\t\"old.%s\",\t\t/* %d = old %s */\n", \ - $5, syscall, $5) > sysnames - printf("\t\t\t\t/* %d is old %s */\n", \ - syscall, comment) > syshdr - syscall++ - next - } - $2 == "LIBCOMPAT" { - printf("int\to%s();\n", $4) > syscompat - printf("\t{ compat(%d,%s) },\t\t/* %d = old %s */\n", \ - $3, $4, syscall, $5) > sysent - printf("\t\"old.%s\",\t\t/* %d = old %s */\n", \ - $5, syscall, $5) > sysnames - printf("#define\tSYS_%s\t%d\t/* compatibility; still used by libc */\n", \ - $5, syscall) > syshdr - syscall++ - next - } - $2 == "OBSOL" { - printf("\t{ 0, nosys },\t\t\t/* %d = obsolete %s */\n", \ - syscall, comment) > sysent - printf("\t\"obs_%s\",\t\t\t/* %d = obsolete %s */\n", \ - $4, syscall, comment) > sysnames - printf("\t\t\t\t/* %d is obsolete %s */\n", \ - syscall, comment) > syshdr - syscall++ - next - } - $2 == "UNIMPL" { - printf("\t{ 0, nosys },\t\t\t/* %d = %s */\n", \ - syscall, comment) > sysent - printf("\t\"#%d\",\t\t\t/* %d = %s */\n", \ - syscall, syscall, comment) > sysnames - syscall++ - next - } - { - printf "%s: line %d: unrecognized keyword %s\n", infile, NR, $2 - exit 1 - } - END { - printf("\n#else /* %s */\n", compat) > syscompat - printf("#define compat(n, name) 0, nosys\n") > syscompat - printf("#endif /* %s */\n\n", compat) > syscompat +# before handing it off to awk, make a few adjustments: +# (1) insert spaces around {, }, (, ), *, and commas. +# (2) get rid of any and all dollar signs (so that rcs id use safe) +# +# The awk script will deal with blank lines and lines that +# start with the comment character (';'). - printf("\n#else /* %s */\n", compat) > sysncompat - printf("#define ncompat(n, name) 0, nosys\n") > sysncompat - printf("#endif /* %s */\n\n", compat) > sysncompat +sed -e ' +s/\$//g +:join + /\\$/{a\ - printf("};\n\n") > sysent - printf("int\tnsysent = sizeof(sysent) / sizeof(sysent[0]);\n") > sysent + N + s/\\\n// + b join + } +2,${ + /^#/!s/\([{}()*,]\)/ \1 /g +} +' < $2 | $awk " +$toupper +BEGIN { + sysnames = \"$sysnames\" + sysnumhdr = \"$sysnumhdr\" + sysarghdr = \"$sysarghdr\" + switchname = \"$switchname\" + namesname = \"$namesname\" + constprefix = \"$constprefix\" - printf("};\n") > sysnames - } ' + sysdcl = \"$sysdcl\" + syscompat_pref = \"$syscompat_pref\" + sysent = \"$sysent\" + infile = \"$2\" -cat $sysdcl $syscompat $sysncompat $sysent >$syssw + compatopts = \"$compatopts\" + "' + + printf "/*\n * System call switch table.\n *\n" > sysdcl + printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysdcl + + ncompat = split(compatopts,compat) + for (i = 1; i <= ncompat; i++) { + compat_upper[i] = toupper(compat[i]) + compat_file[i] = sprintf("%s%s", syscompat_pref, compat[i]) + + printf "\n#ifdef %s\n", compat_upper[i] > compat_file[i] + printf "#define %s(func) __CONCAT(%s_,func)\n\n", \ + compat[i], compat[i] > compat_file[i] + } + + printf "/*\n * System call names.\n *\n" > sysnames + printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames + + printf "/*\n * System call numbers.\n *\n" > sysnumhdr + printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnumhdr + + printf "/*\n * System call numbers.\n *\n" > sysarghdr + printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysarghdr +} +NR == 1 { + printf " * created from%s\n */\n\n", $0 > sysdcl + + printf "#define\ts(type)\tsizeof(type)\n\n" > sysent + printf "struct sysent %s[] = {\n",switchname > sysent + + printf " * created from%s\n */\n\n", $0 > sysnames + printf "char *%s[] = {\n",namesname > sysnames + + printf " * created from%s\n */\n\n", $0 > sysnumhdr + + printf " * created from%s\n */\n\n", $0 > sysarghdr + printf "#define\tsyscallarg(x)\tunion { x datum; register_t pad; }\n" \ + > sysarghdr + next +} +NF == 0 || $1 ~ /^;/ { + next +} +$1 ~ /^#[ ]*include/ { + print > sysdcl + next +} +$1 ~ /^#[ ]*if/ { + print > sysent + print > sysdcl + for (i = 1; i <= ncompat; i++) + print > compat_file[i] + print > sysnames + savesyscall = syscall + next +} +$1 ~ /^#[ ]*else/ { + print > sysent + print > sysdcl + for (i = 1; i <= ncompat; i++) + print > compat_file[i] + print > sysnames + syscall = savesyscall + next +} +$1 ~ /^#/ { + print > sysent + print > sysdcl + for (i = 1; i <= ncompat; i++) + print > compat_file[i] + print > sysnames + next +} +syscall != $1 { + printf "%s: line %d: syscall number out of sync at %d\n", \ + infile, NR, syscall + printf "line is:\n" + print + exit 1 +} +function parserr(was, wanted) { + printf "%s: line %d: unexpected %s (expected %s)\n", \ + infile, NR, was, wanted + exit 1 +} +function parseline() { + f=3 # toss number and type + if ($NF != "}") { + funcalias=$NF + end=NF-1 + } else { + funcalias="" + end=NF + } + if ($f != "{") + parserr($f, "{") + f++ + if ($end != "}") + parserr($end, "}") + end-- + if ($end != ";") + parserr($end, ";") + end-- + if ($end != ")") + parserr($end, ")") + end-- + + f++ # toss return type + + funcname=$f + if (funcalias == "") + funcalias=funcname + f++ + + if ($f != "(") + parserr($f, ")") + f++ + + argc= 0; + if (f == end) { + if ($f != "void") + parserr($f, "argument definition") + return + } + + while (f <= end) { + argc++ + argtype[argc]="" + while (f < end && $(f+1) != ",") { + if (argtype[argc] != "") + argtype[argc] = argtype[argc]" "; + argtype[argc] = argtype[argc]$f; + f++ + } + if (argtype[argc] == "") + parserr($f, "argument definition") + argname[argc]=$f; + f += 2; # skip name, and any comma + } +} +function putent(nodefs, declfile, compatwrap) { + # output syscall declaration for switch table + if (compatwrap == "") + printf("int\t%s();\n", funcname) > declfile + else + printf("int\t%s(%s)();\n", compatwrap, funcname) > declfile + + # output syscall switch entry +# printf("\t{ { %d", argc) > sysent +# for (i = 1; i <= argc; i++) { +# if (i == 5) # wrap the line +# printf(",\n\t ") > sysent +# else +# printf(", ") > sysent +# printf("s(%s)", argtypenospc[i]) > sysent +# } + printf("\t{ %d, ", argc) > sysent + if (argc == 0) + printf("0") > sysent + else if (compatwrap == "") + printf("s(struct %s_args)", funcname) > sysent + else + printf("s(struct %s_%s_args)", compatwrap, funcname) > sysent + if (compatwrap == "") + wfn = sprintf("%s", funcname); + else + wfn = sprintf("%s(%s)", compatwrap, funcname); + printf(",\n\t %s },", wfn) > sysent + for (i = 0; i < (33 - length(wfn)) / 8; i++) + printf("\t") > sysent + if (compatwrap == "") + printf("/* %d = %s */\n", syscall, funcalias) > sysent + else + printf("/* %d = %s %s */\n", syscall, compatwrap, + funcalias) > sysent + + # output syscall name for names table + if (compatwrap == "") + printf("\t\"%s\",\t\t\t/* %d = %s */\n", funcalias, syscall, + funcalias) > sysnames + else + printf("\t\"%s_%s\",\t/* %d = %s %s */\n", compatwrap, + funcalias, syscall, compatwrap, funcalias) > sysnames + + # output syscall number of header, if appropriate + if (nodefs == "" || nodefs == "NOARGS") + printf("#define\t%s%s\t%d\n", constprefix, funcalias, + syscall) > sysnumhdr + else if (nodefs != "NODEF") + printf("\t\t\t\t/* %d is %s %s */\n", syscall, + compatwrap, funcalias) > sysnumhdr + + # output syscall argument structure, if it has arguments + if (argc != 0 && nodefs != "NOARGS") { + if (compatwrap == "") + printf("\nstruct %s_args {\n", funcname) > sysarghdr + else + printf("\nstruct %s_%s_args {\n", compatwrap, + funcname) > sysarghdr + for (i = 1; i <= argc; i++) + printf("\tsyscallarg(%s) %s;\n", argtype[i], + argname[i]) > sysarghdr + printf("};\n") > sysarghdr + } +} +$2 == "STD" { + parseline() + putent("", sysdcl, "") + syscall++ + next +} +$2 == "NODEF" || $2 == "NOARGS" { + parseline() + putent($2, sysdcl, "") + syscall++ + next +} +$2 == "OBSOL" || $2 == "UNIMPL" { + if ($2 == "OBSOL") + comment="obsolete" + else + comment="unimplemented" + for (i = 3; i <= NF; i++) + comment=comment " " $i + + printf("\t{ 0, 0,\n\t nosys },\t\t\t\t/* %d = %s */\n", \ + syscall, comment) > sysent + printf("\t\"#%d (%s)\",\t\t/* %d = %s */\n", \ + syscall, comment, syscall, comment) > sysnames + if ($2 != "UNIMPL") + printf("\t\t\t\t/* %d is %s */\n", syscall, comment) > sysnumhdr + syscall++ + next +} +{ + for (i = 1; i <= ncompat; i++) { + if ($2 == compat_upper[i]) { + parseline(); + putent("COMMENT", compat_file[i], compat[i]) + syscall++ + next + } + } + printf "%s: line %d: unrecognized keyword %s\n", infile, NR, $2 + exit 1 +} +END { + printf "\n#undef\tsyscallarg\n" > sysarghdr + + for (i = 1; i <= ncompat; i++) { + printf("\n#else /* %s */\n", compat_upper[i]) > compat_file[i] + printf("#define %s(func) nosys\n", compat[i]) > \ + compat_file[i] + printf("#endif /* %s */\n\n", compat_upper[i]) > compat_file[i] + } + + printf("};\n\n") > sysent + printf("int\tn%s= sizeof(%s) / sizeof(%s[0]);\n", switchname, + switchname, switchname) > sysent + + printf("};\n") > sysnames +} ' + +cat $sysdcl $syscompat_files $sysent > $syssw #chmod 444 $sysnames $syshdr $syssw diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c index 7795aa69acb7..a73b14cf160b 100644 --- a/sys/kern/subr_prof.c +++ b/sys/kern/subr_prof.c @@ -1,4 +1,4 @@ -/* $NetBSD: subr_prof.c,v 1.3 1994/06/29 06:33:01 cgd Exp $ */ +/* $NetBSD: subr_prof.c,v 1.4 1994/10/20 04:23:04 cgd Exp $ */ /*- * Copyright (c) 1982, 1986, 1993 @@ -40,6 +40,10 @@ #include #include #include + +#include +#include + #include #ifdef GPROF @@ -141,24 +145,23 @@ sysctl_doprof(name, namelen, oldp, oldlenp, newp, newlen, p) * The scale factor is a fixed point number with 16 bits of fraction, so that * 1.0 is represented as 0x10000. A scale factor of 0 turns off profiling. */ -struct profil_args { - caddr_t samples; - u_int size; - u_int offset; - u_int scale; -}; /* ARGSUSED */ profil(p, uap, retval) struct proc *p; - register struct profil_args *uap; - int *retval; + register struct profil_args /* { + syscallarg(caddr_t) samples; + syscallarg(u_int) size; + syscallarg(u_int) offset; + syscallarg(u_int) scale; + } */ *uap; + register_t *retval; { register struct uprof *upp; int s; - if (uap->scale > (1 << 16)) + if (SCARG(uap, scale) > (1 << 16)) return (EINVAL); - if (uap->scale == 0) { + if (SCARG(uap, scale) == 0) { stopprofclock(p); return (0); } @@ -166,10 +169,10 @@ profil(p, uap, retval) /* Block profile interrupts while changing state. */ s = splstatclock(); - upp->pr_off = uap->offset; - upp->pr_scale = uap->scale; - upp->pr_base = uap->samples; - upp->pr_size = uap->size; + upp->pr_off = SCARG(uap, offset); + upp->pr_scale = SCARG(uap, scale); + upp->pr_base = SCARG(uap, samples); + upp->pr_size = SCARG(uap, size); startprofclock(p); splx(s); diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 4a9420a3ca5d..ddbc6abdcc96 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_generic.c,v 1.15 1994/06/29 06:33:05 cgd Exp $ */ +/* $NetBSD: sys_generic.c,v 1.16 1994/10/20 04:23:05 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -55,19 +55,21 @@ #include #endif +#include +#include + /* * Read system call. */ -struct read_args { - int fd; - char *buf; - u_int nbyte; -}; /* ARGSUSED */ read(p, uap, retval) struct proc *p; - register struct read_args *uap; - int *retval; + register struct read_args /* { + syscallarg(int) fd; + syscallarg(char *) buf; + syscallarg(u_int) nbyte; + } */ *uap; + register_t *retval; { register struct file *fp; register struct filedesc *fdp = p->p_fd; @@ -78,15 +80,15 @@ read(p, uap, retval) struct iovec ktriov; #endif - if (((u_int)uap->fd) >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL || + if (((u_int)SCARG(uap, fd)) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL || (fp->f_flag & FREAD) == 0) return (EBADF); - aiov.iov_base = (caddr_t)uap->buf; - aiov.iov_len = uap->nbyte; + aiov.iov_base = (caddr_t)SCARG(uap, buf); + aiov.iov_len = SCARG(uap, nbyte); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; - auio.uio_resid = uap->nbyte; + auio.uio_resid = SCARG(uap, nbyte); auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_USERSPACE; auio.uio_procp = p; @@ -99,7 +101,7 @@ read(p, uap, retval) if (KTRPOINT(p, KTR_GENIO)) ktriov = aiov; #endif - cnt = uap->nbyte; + cnt = SCARG(uap, nbyte); if (error = (*fp->f_ops->fo_read)(fp, &auio, fp->f_cred)) if (auio.uio_resid != cnt && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) @@ -107,7 +109,8 @@ read(p, uap, retval) cnt -= auio.uio_resid; #ifdef KTRACE if (KTRPOINT(p, KTR_GENIO) && error == 0) - ktrgenio(p->p_tracep, uap->fd, UIO_READ, &ktriov, cnt, error); + ktrgenio(p->p_tracep, SCARG(uap, fd), UIO_READ, &ktriov, + cnt, error); #endif *retval = cnt; return (error); @@ -116,15 +119,14 @@ read(p, uap, retval) /* * Scatter read system call. */ -struct readv_args { - int fdes; - struct iovec *iovp; - u_int iovcnt; -}; readv(p, uap, retval) struct proc *p; - register struct readv_args *uap; - int *retval; + register struct readv_args /* { + syscallarg(int) fd; + syscallarg(struct iovec *) iovp; + syscallarg(u_int) iovcnt; + } */ *uap; + register_t *retval; { register struct file *fp; register struct filedesc *fdp = p->p_fd; @@ -138,14 +140,14 @@ readv(p, uap, retval) struct iovec *ktriov = NULL; #endif - if (((u_int)uap->fdes) >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fdes]) == NULL || + if (((u_int)SCARG(uap, fd)) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL || (fp->f_flag & FREAD) == 0) return (EBADF); /* note: can't use iovlen until iovcnt is validated */ - iovlen = uap->iovcnt * sizeof (struct iovec); - if (uap->iovcnt > UIO_SMALLIOV) { - if (uap->iovcnt > UIO_MAXIOV) + iovlen = SCARG(uap, iovcnt) * sizeof (struct iovec); + if (SCARG(uap, iovcnt) > UIO_SMALLIOV) { + if (SCARG(uap, iovcnt) > UIO_MAXIOV) return (EINVAL); MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK); needfree = iov; @@ -154,14 +156,14 @@ readv(p, uap, retval) needfree = NULL; } auio.uio_iov = iov; - auio.uio_iovcnt = uap->iovcnt; + auio.uio_iovcnt = SCARG(uap, iovcnt); auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_USERSPACE; auio.uio_procp = p; - if (error = copyin((caddr_t)uap->iovp, (caddr_t)iov, iovlen)) + if (error = copyin((caddr_t)SCARG(uap, iovp), (caddr_t)iov, iovlen)) goto done; auio.uio_resid = 0; - for (i = 0; i < uap->iovcnt; i++) { + for (i = 0; i < SCARG(uap, iovcnt); i++) { if (iov->iov_len < 0) { error = EINVAL; goto done; @@ -191,7 +193,7 @@ readv(p, uap, retval) #ifdef KTRACE if (ktriov != NULL) { if (error == 0) - ktrgenio(p->p_tracep, uap->fdes, UIO_READ, ktriov, + ktrgenio(p->p_tracep, SCARG(uap, fd), UIO_READ, ktriov, cnt, error); FREE(ktriov, M_TEMP); } @@ -206,15 +208,14 @@ done: /* * Write system call */ -struct write_args { - int fd; - char *buf; - u_int nbyte; -}; write(p, uap, retval) struct proc *p; - register struct write_args *uap; - int *retval; + register struct write_args /* { + syscallarg(int) fd; + syscallarg(char *) buf; + syscallarg(u_int) nbyte; + } */ *uap; + register_t *retval; { register struct file *fp; register struct filedesc *fdp = p->p_fd; @@ -225,15 +226,15 @@ write(p, uap, retval) struct iovec ktriov; #endif - if (((u_int)uap->fd) >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL || + if (((u_int)SCARG(uap, fd)) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL || (fp->f_flag & FWRITE) == 0) return (EBADF); - aiov.iov_base = (caddr_t)uap->buf; - aiov.iov_len = uap->nbyte; + aiov.iov_base = (caddr_t)SCARG(uap, buf); + aiov.iov_len = SCARG(uap, nbyte); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; - auio.uio_resid = uap->nbyte; + auio.uio_resid = SCARG(uap, nbyte); auio.uio_rw = UIO_WRITE; auio.uio_segflg = UIO_USERSPACE; auio.uio_procp = p; @@ -246,7 +247,7 @@ write(p, uap, retval) if (KTRPOINT(p, KTR_GENIO)) ktriov = aiov; #endif - cnt = uap->nbyte; + cnt = SCARG(uap, nbyte); if (error = (*fp->f_ops->fo_write)(fp, &auio, fp->f_cred)) { if (auio.uio_resid != cnt && (error == ERESTART || error == EINTR || error == EWOULDBLOCK)) @@ -257,7 +258,7 @@ write(p, uap, retval) cnt -= auio.uio_resid; #ifdef KTRACE if (KTRPOINT(p, KTR_GENIO) && error == 0) - ktrgenio(p->p_tracep, uap->fd, UIO_WRITE, + ktrgenio(p->p_tracep, SCARG(uap, fd), UIO_WRITE, &ktriov, cnt, error); #endif *retval = cnt; @@ -267,15 +268,14 @@ write(p, uap, retval) /* * Gather write system call */ -struct writev_args { - int fd; - struct iovec *iovp; - u_int iovcnt; -}; writev(p, uap, retval) struct proc *p; - register struct writev_args *uap; - int *retval; + register struct writev_args /* { + syscallarg(int) fd; + syscallarg(struct iovec *) iovp; + syscallarg(u_int) iovcnt; + } */ *uap; + register_t *retval; { register struct file *fp; register struct filedesc *fdp = p->p_fd; @@ -289,14 +289,14 @@ writev(p, uap, retval) struct iovec *ktriov = NULL; #endif - if (((u_int)uap->fd) >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL || + if (((u_int)SCARG(uap, fd)) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL || (fp->f_flag & FWRITE) == 0) return (EBADF); /* note: can't use iovlen until iovcnt is validated */ - iovlen = uap->iovcnt * sizeof (struct iovec); - if (uap->iovcnt > UIO_SMALLIOV) { - if (uap->iovcnt > UIO_MAXIOV) + iovlen = SCARG(uap, iovcnt) * sizeof (struct iovec); + if (SCARG(uap, iovcnt) > UIO_SMALLIOV) { + if (SCARG(uap, iovcnt) > UIO_MAXIOV) return (EINVAL); MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK); needfree = iov; @@ -305,14 +305,14 @@ writev(p, uap, retval) needfree = NULL; } auio.uio_iov = iov; - auio.uio_iovcnt = uap->iovcnt; + auio.uio_iovcnt = SCARG(uap, iovcnt); auio.uio_rw = UIO_WRITE; auio.uio_segflg = UIO_USERSPACE; auio.uio_procp = p; - if (error = copyin((caddr_t)uap->iovp, (caddr_t)iov, iovlen)) + if (error = copyin((caddr_t)SCARG(uap, iovp), (caddr_t)iov, iovlen)) goto done; auio.uio_resid = 0; - for (i = 0; i < uap->iovcnt; i++) { + for (i = 0; i < SCARG(uap, iovcnt); i++) { if (iov->iov_len < 0) { error = EINVAL; goto done; @@ -345,7 +345,7 @@ writev(p, uap, retval) #ifdef KTRACE if (ktriov != NULL) { if (error == 0) - ktrgenio(p->p_tracep, uap->fd, UIO_WRITE, + ktrgenio(p->p_tracep, SCARG(uap, fd), UIO_WRITE, ktriov, cnt, error); FREE(ktriov, M_TEMP); } @@ -360,16 +360,15 @@ done: /* * Ioctl system call */ -struct ioctl_args { - int fd; - int com; - caddr_t data; -}; /* ARGSUSED */ ioctl(p, uap, retval) struct proc *p; - register struct ioctl_args *uap; - int *retval; + register struct ioctl_args /* { + syscallarg(int) fd; + syscallarg(int) com; + syscallarg(caddr_t) data; + } */ *uap; + register_t *retval; { register struct file *fp; register struct filedesc *fdp; @@ -381,19 +380,19 @@ ioctl(p, uap, retval) char stkbuf[STK_PARAMS]; fdp = p->p_fd; - if ((u_int)uap->fd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL) + if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) return (EBADF); if ((fp->f_flag & (FREAD | FWRITE)) == 0) return (EBADF); - switch (com = uap->com) { + switch (com = SCARG(uap, com)) { case FIONCLEX: - fdp->fd_ofileflags[uap->fd] &= ~UF_EXCLOSE; + fdp->fd_ofileflags[SCARG(uap, fd)] &= ~UF_EXCLOSE; return (0); case FIOCLEX: - fdp->fd_ofileflags[uap->fd] |= UF_EXCLOSE; + fdp->fd_ofileflags[SCARG(uap, fd)] |= UF_EXCLOSE; return (0); } @@ -412,14 +411,14 @@ ioctl(p, uap, retval) data = stkbuf; if (com&IOC_IN) { if (size) { - error = copyin(uap->data, data, (u_int)size); + error = copyin(SCARG(uap, data), data, (u_int)size); if (error) { if (memp) free(memp, M_IOCTLOPS); return (error); } } else - *(caddr_t *)data = uap->data; + *(caddr_t *)data = SCARG(uap, data); } else if ((com&IOC_OUT) && size) /* * Zero the buffer so the user always @@ -427,7 +426,7 @@ ioctl(p, uap, retval) */ bzero(data, size); else if (com&IOC_VOID) - *(caddr_t *)data = uap->data; + *(caddr_t *)data = SCARG(uap, data); switch (com) { @@ -485,7 +484,7 @@ ioctl(p, uap, retval) * already set and checked above. */ if (error == 0 && (com&IOC_OUT) && size) - error = copyout(data, uap->data, (u_int)size); + error = copyout(data, SCARG(uap, data), (u_int)size); break; } if (memp) @@ -498,15 +497,16 @@ int selwait, nselcoll; /* * Select system call. */ -struct select_args { - u_int nd; - fd_set *in, *ou, *ex; - struct timeval *tv; -}; select(p, uap, retval) register struct proc *p; - register struct select_args *uap; - int *retval; + register struct select_args /* { + syscallarg(u_int) nd; + syscallarg(fd_set *) in; + syscallarg(fd_set *) ou; + syscallarg(fd_set *) ex; + syscallarg(struct timeval *) tv; + } */ *uap; + register_t *retval; { fd_set ibits[3], obits[3]; struct timeval atv; @@ -515,23 +515,25 @@ select(p, uap, retval) bzero((caddr_t)ibits, sizeof(ibits)); bzero((caddr_t)obits, sizeof(obits)); - if (uap->nd > FD_SETSIZE) + if (SCARG(uap, nd) > FD_SETSIZE) return (EINVAL); - if (uap->nd > p->p_fd->fd_nfiles) - uap->nd = p->p_fd->fd_nfiles; /* forgiving; slightly wrong */ - ni = howmany(uap->nd, NFDBITS) * sizeof(fd_mask); + if (SCARG(uap, nd) > p->p_fd->fd_nfiles) { + /* forgiving; slightly wrong */ + SCARG(uap, nd) = p->p_fd->fd_nfiles; + } + ni = howmany(SCARG(uap, nd), NFDBITS) * sizeof(fd_mask); #define getbits(name, x) \ - if (uap->name && \ - (error = copyin((caddr_t)uap->name, (caddr_t)&ibits[x], ni))) \ + if (SCARG(uap, name) && (error = copyin((caddr_t)SCARG(uap, name), \ + (caddr_t)&ibits[x], ni))) \ goto done; getbits(in, 0); getbits(ou, 1); getbits(ex, 2); #undef getbits - if (uap->tv) { - error = copyin((caddr_t)uap->tv, (caddr_t)&atv, + if (SCARG(uap, tv)) { + error = copyin((caddr_t)SCARG(uap, tv), (caddr_t)&atv, sizeof (atv)); if (error) goto done; @@ -553,12 +555,12 @@ select(p, uap, retval) retry: ncoll = nselcoll; p->p_flag |= P_SELECT; - error = selscan(p, ibits, obits, uap->nd, retval); + error = selscan(p, ibits, obits, SCARG(uap, nd), retval); if (error || *retval) goto done; s = splhigh(); /* this should be timercmp(&time, &atv, >=) */ - if (uap->tv && (time.tv_sec > atv.tv_sec || + if (SCARG(uap, tv) && (time.tv_sec > atv.tv_sec || time.tv_sec == atv.tv_sec && time.tv_usec >= atv.tv_usec)) { splx(s); goto done; @@ -580,8 +582,8 @@ done: if (error == EWOULDBLOCK) error = 0; #define putbits(name, x) \ - if (uap->name && \ - (error2 = copyout((caddr_t)&obits[x], (caddr_t)uap->name, ni))) \ + if (SCARG(uap, name) && (error2 = copyout((caddr_t)&obits[x], \ + (caddr_t)SCARG(uap, name), ni))) \ error = error2; if (error == 0) { int error2; @@ -597,7 +599,8 @@ done: selscan(p, ibits, obits, nfd, retval) struct proc *p; fd_set *ibits, *obits; - int nfd, *retval; + int nfd; + register_t *retval; { register struct filedesc *fdp = p->p_fd; register int msk, i, j, fd; diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 943d8a358d2c..87b4ba24f8db 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys_process.c,v 1.41 1994/09/24 07:17:18 mycroft Exp $ */ +/* $NetBSD: sys_process.c,v 1.42 1994/10/20 04:23:08 cgd Exp $ */ /*- * Copyright (c) 1994 Christopher G. Demetriou. All rights reserved. @@ -53,12 +53,16 @@ */ #include +#include #include #include #include #include #include +#include +#include + #include /* Macros to clear/set/test flags. */ @@ -69,16 +73,16 @@ /* * Process debugging system call. */ -struct ptrace_args { - int req; - pid_t pid; - caddr_t addr; - int data; -}; +int ptrace(p, uap, retval) struct proc *p; - struct ptrace_args *uap; - int *retval; + struct ptrace_args /* { + syscallarg(int) req; + syscallarg(pid_t) pid; + syscallarg(caddr_t) addr; + syscallarg(int) data; + } */ *uap; + register_t *retval; { struct proc *t; /* target process */ struct uio uio; @@ -86,16 +90,16 @@ ptrace(p, uap, retval) int error, step, write; /* "A foolish consistency..." XXX */ - if (uap->req == PT_TRACE_ME) + if (SCARG(uap, req) == PT_TRACE_ME) t = p; else { /* Find the process we're supposed to be operating on. */ - if ((t = pfind(uap->pid)) == NULL) + if ((t = pfind(SCARG(uap, pid))) == NULL) return (ESRCH); } /* Make sure we can operate on it. */ - switch (uap->req) { + switch (SCARG(uap, req)) { case PT_TRACE_ME: /* Saying that you're being traced is always legal. */ break; @@ -179,7 +183,7 @@ ptrace(p, uap, retval) step = write = 0; *retval = 0; - switch (uap->req) { + switch (SCARG(uap, req)) { case PT_TRACE_ME: /* Just set the trace flag. */ SET(t->p_flag, P_TRACED); @@ -191,11 +195,12 @@ ptrace(p, uap, retval) case PT_READ_I: /* XXX no seperate I and D spaces */ case PT_READ_D: /* write = 0 done above. */ - iov.iov_base = write ? (caddr_t)&uap->data : (caddr_t)retval; + iov.iov_base = + write ? (caddr_t)&SCARG(uap, data) : (caddr_t)retval; iov.iov_len = sizeof(int); uio.uio_iov = &iov; uio.uio_iovcnt = 1; - uio.uio_offset = (off_t)uap->addr; + uio.uio_offset = (off_t)SCARG(uap, addr); uio.uio_resid = sizeof(int); uio.uio_segflg = UIO_SYSSPACE; uio.uio_rw = write ? UIO_WRITE : UIO_READ; @@ -210,11 +215,11 @@ ptrace(p, uap, retval) * almost worthless. Additionally, we _always_ require * that the address be int-aligned. */ - if ((u_long)uap->addr > USPACE - sizeof(int) || + if ((u_long)SCARG(uap, addr) > USPACE - sizeof(int) || #ifdef m68k /* XXX */ - ((u_long)uap->addr & 1) != 0) + ((u_long)SCARG(uap, addr) & 1) != 0) #else /* !m68k XXX */ - ((u_long)uap->addr & (sizeof(int) - 1)) != 0) + ((u_long)SCARG(uap, addr) & (sizeof(int) - 1)) != 0) #endif /* !m68k XXX */ return (EINVAL); @@ -226,7 +231,8 @@ ptrace(p, uap, retval) fill_eproc(t, &t->p_addr->u_kproc.kp_eproc); /* Finally, pull the appropriate int out of the user area. */ - *retval = *(int *)((caddr_t)t->p_addr + (u_long)uap->addr); + *retval = + *(int *)((caddr_t)t->p_addr + (u_long)SCARG(uap, addr)); return (0); case PT_WRITE_U: @@ -235,16 +241,17 @@ ptrace(p, uap, retval) * reading it. Don't bother filling in the eproc, because * it won't be used for anything anyway. */ - if ((u_long)uap->addr > USPACE - sizeof(int) || + if ((u_long)SCARG(uap, addr) > USPACE - sizeof(int) || #ifdef m68k /* XXX */ - ((u_long)uap->addr & 1) != 0) + ((u_long)SCARG(uap, addr) & 1) != 0) #else /* !m68k XXX */ - ((u_long)uap->addr & (sizeof(int) - 1)) != 0) + ((u_long)SCARG(uap, addr) & (sizeof(int) - 1)) != 0) #endif /* !m68k XXX */ return (EINVAL); /* And write the data. */ - *(int *)((caddr_t)t->p_addr + (u_long)uap->addr) = uap->data; + *(int *)((caddr_t)t->p_addr + (u_long)SCARG(uap, addr)) = + SCARG(uap, data); return (0); #ifdef PT_STEP @@ -271,8 +278,8 @@ ptrace(p, uap, retval) */ /* step = 0 done above. */ - /* Check that uap->data is a valid signal number or zero. */ - if (uap->data < 0 || uap->data >= NSIG) + /* Check that the data is a valid signal number or zero. */ + if (SCARG(uap, data) < 0 || SCARG(uap, data) >= NSIG) return (EINVAL); /* @@ -282,19 +289,19 @@ ptrace(p, uap, retval) return (error); /* If the address paramter is not (int *)1, set the pc. */ - if ((int *)uap->addr != (int *)1) - if (error = process_set_pc(t, uap->addr)) + if ((int *)SCARG(uap, addr) != (int *)1) + if (error = process_set_pc(t, SCARG(uap, addr))) return (error); /* Finally, deliver the requested signal (or none). */ sendsig: - t->p_xstat = uap->data; + t->p_xstat = SCARG(uap, data); setrunnable(t); return (0); case PT_KILL: /* just send the process a KILL signal. */ - uap->data = SIGKILL; + SCARG(uap, data) = SIGKILL; goto sendsig; /* in PT_CONTINUE, above. */ case PT_ATTACH: @@ -342,10 +349,10 @@ sendsig: /* and deliver any signal requested by tracer. */ if (t->p_stat == SSTOP) { - t->p_xstat = uap->data; - setrunnable(t); - } else if (uap->data) - psignal(t, uap->data); + t->p_xstat = SCARG(uap, data); + setrunnable(t); + } else if (SCARG(uap, data)) + psignal(t, SCARG(uap, data)); return (0); @@ -361,7 +368,7 @@ sendsig: if (!procfs_validregs(t)) return (EINVAL); else { - iov.iov_base = uap->addr; + iov.iov_base = SCARG(uap, addr); iov.iov_len = sizeof(struct reg); uio.uio_iov = &iov; uio.uio_iovcnt = 1; @@ -386,7 +393,7 @@ sendsig: if (!procfs_validfpregs(t)) return (EINVAL); else { - iov.iov_base = uap->addr; + iov.iov_base = SCARG(uap, addr); iov.iov_len = sizeof(struct fpreg); uio.uio_iov = &iov; uio.uio_iovcnt = 1; diff --git a/sys/kern/syscalls.c b/sys/kern/syscalls.c index 00cbdfbaedeb..0fafc04cbf16 100644 --- a/sys/kern/syscalls.c +++ b/sys/kern/syscalls.c @@ -2,7 +2,7 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * created from: NetBSD syscalls.master,v 1.22 1994/06/29 06:33:10 + * created from NetBSD: syscalls.master,v 1.22 1994/06/29 06:33:10 cgd Exp */ char *syscallnames[] = { @@ -14,10 +14,10 @@ char *syscallnames[] = { "open", /* 5 = open */ "close", /* 6 = close */ "wait4", /* 7 = wait4 */ - "old.creat", /* 8 = old creat */ + "compat_43_creat", /* 8 = compat_43 creat */ "link", /* 9 = link */ "unlink", /* 10 = unlink */ - "obs_execv", /* 11 = obsolete execv */ + "#11 (obsolete execv)", /* 11 = obsolete execv */ "chdir", /* 12 = chdir */ "fchdir", /* 13 = fchdir */ "mknod", /* 14 = mknod */ @@ -25,7 +25,7 @@ char *syscallnames[] = { "chown", /* 16 = chown */ "break", /* 17 = break */ "getfsstat", /* 18 = getfsstat */ - "old.lseek", /* 19 = old lseek */ + "compat_43_lseek", /* 19 = compat_43 lseek */ "getpid", /* 20 = getpid */ "mount", /* 21 = mount */ "unmount", /* 22 = unmount */ @@ -44,9 +44,9 @@ char *syscallnames[] = { "fchflags", /* 35 = fchflags */ "sync", /* 36 = sync */ "kill", /* 37 = kill */ - "old.stat", /* 38 = old stat */ + "compat_43_stat", /* 38 = compat_43 stat */ "getppid", /* 39 = getppid */ - "old.lstat", /* 40 = old lstat */ + "compat_43_lstat", /* 40 = compat_43 lstat */ "dup", /* 41 = dup */ "pipe", /* 42 = pipe */ "getegid", /* 43 = getegid */ @@ -54,7 +54,7 @@ char *syscallnames[] = { #ifdef KTRACE "ktrace", /* 45 = ktrace */ #else - "#45", /* 45 = ktrace */ + "#45 (unimplemented ktrace)", /* 45 = unimplemented ktrace */ #endif "sigaction", /* 46 = sigaction */ "getgid", /* 47 = getgid */ @@ -72,63 +72,63 @@ char *syscallnames[] = { "execve", /* 59 = execve */ "umask", /* 60 = umask */ "chroot", /* 61 = chroot */ - "old.fstat", /* 62 = old fstat */ - "old.getkerninfo", /* 63 = old getkerninfo */ - "old.getpagesize", /* 64 = old getpagesize */ + "compat_43_fstat", /* 62 = compat_43 fstat */ + "compat_43_getkerninfo", /* 63 = compat_43 getkerninfo */ + "compat_43_getpagesize", /* 64 = compat_43 getpagesize */ "msync", /* 65 = msync */ "vfork", /* 66 = vfork */ - "obs_vread", /* 67 = obsolete vread */ - "obs_vwrite", /* 68 = obsolete vwrite */ + "#67 (obsolete vread)", /* 67 = obsolete vread */ + "#68 (obsolete vwrite)", /* 68 = obsolete vwrite */ "sbrk", /* 69 = sbrk */ "sstk", /* 70 = sstk */ - "old.mmap", /* 71 = old mmap */ + "compat_43_mmap", /* 71 = compat_43 mmap */ "vadvise", /* 72 = vadvise */ "munmap", /* 73 = munmap */ "mprotect", /* 74 = mprotect */ "madvise", /* 75 = madvise */ - "obs_vhangup", /* 76 = obsolete vhangup */ - "obs_vlimit", /* 77 = obsolete vlimit */ + "#76 (obsolete vhangup)", /* 76 = obsolete vhangup */ + "#77 (obsolete vlimit)", /* 77 = obsolete vlimit */ "mincore", /* 78 = mincore */ "getgroups", /* 79 = getgroups */ "setgroups", /* 80 = setgroups */ "getpgrp", /* 81 = getpgrp */ "setpgid", /* 82 = setpgid */ "setitimer", /* 83 = setitimer */ - "old.wait", /* 84 = old wait */ + "compat_43_wait", /* 84 = compat_43 wait */ "swapon", /* 85 = swapon */ "getitimer", /* 86 = getitimer */ - "old.gethostname", /* 87 = old gethostname */ - "old.sethostname", /* 88 = old sethostname */ - "old.getdtablesize", /* 89 = old getdtablesize */ + "compat_43_gethostname", /* 87 = compat_43 gethostname */ + "compat_43_sethostname", /* 88 = compat_43 sethostname */ + "compat_43_getdtablesize", /* 89 = compat_43 getdtablesize */ "dup2", /* 90 = dup2 */ - "#91", /* 91 = getdopt */ + "#91 (unimplemented getdopt)", /* 91 = unimplemented getdopt */ "fcntl", /* 92 = fcntl */ "select", /* 93 = select */ - "#94", /* 94 = setdopt */ + "#94 (unimplemented setdopt)", /* 94 = unimplemented setdopt */ "fsync", /* 95 = fsync */ "setpriority", /* 96 = setpriority */ "socket", /* 97 = socket */ "connect", /* 98 = connect */ - "old.accept", /* 99 = old accept */ + "compat_43_accept", /* 99 = compat_43 accept */ "getpriority", /* 100 = getpriority */ - "old.send", /* 101 = old send */ - "old.recv", /* 102 = old recv */ + "compat_43_send", /* 101 = compat_43 send */ + "compat_43_recv", /* 102 = compat_43 recv */ "sigreturn", /* 103 = sigreturn */ "bind", /* 104 = bind */ "setsockopt", /* 105 = setsockopt */ "listen", /* 106 = listen */ - "obs_vtimes", /* 107 = obsolete vtimes */ - "old.sigvec", /* 108 = old sigvec */ - "old.sigblock", /* 109 = old sigblock */ - "old.sigsetmask", /* 110 = old sigsetmask */ + "#107 (obsolete vtimes)", /* 107 = obsolete vtimes */ + "compat_43_sigvec", /* 108 = compat_43 sigvec */ + "compat_43_sigblock", /* 109 = compat_43 sigblock */ + "compat_43_sigsetmask", /* 110 = compat_43 sigsetmask */ "sigsuspend", /* 111 = sigsuspend */ - "old.sigstack", /* 112 = old sigstack */ - "old.recvmsg", /* 113 = old recvmsg */ - "old.sendmsg", /* 114 = old sendmsg */ + "compat_43_sigstack", /* 112 = compat_43 sigstack */ + "compat_43_recvmsg", /* 113 = compat_43 recvmsg */ + "compat_43_sendmsg", /* 114 = compat_43 sendmsg */ #ifdef TRACE "vtrace", /* 115 = vtrace */ #else - "obs_vtrace", /* 115 = obsolete vtrace */ + "#115 (obsolete vtrace)", /* 115 = obsolete vtrace */ #endif "gettimeofday", /* 116 = gettimeofday */ "getrusage", /* 117 = getrusage */ @@ -136,19 +136,19 @@ char *syscallnames[] = { #ifdef vax "resuba", /* 119 = resuba */ #else - "#119", /* 119 = nosys */ + "#119 (unimplemented resuba)", /* 119 = unimplemented resuba */ #endif "readv", /* 120 = readv */ "writev", /* 121 = writev */ "settimeofday", /* 122 = settimeofday */ "fchown", /* 123 = fchown */ "fchmod", /* 124 = fchmod */ - "old.recvfrom", /* 125 = old recvfrom */ - "old.setreuid", /* 126 = old setreuid */ - "old.setregid", /* 127 = old setregid */ + "compat_43_recvfrom", /* 125 = compat_43 recvfrom */ + "compat_43_setreuid", /* 126 = compat_43 setreuid */ + "compat_43_setregid", /* 127 = compat_43 setregid */ "rename", /* 128 = rename */ - "old.truncate", /* 129 = old truncate */ - "old.ftruncate", /* 130 = old ftruncate */ + "compat_43_truncate", /* 129 = compat_43 truncate */ + "compat_43_ftruncate", /* 130 = compat_43 ftruncate */ "flock", /* 131 = flock */ "mkfifo", /* 132 = mkfifo */ "sendto", /* 133 = sendto */ @@ -157,68 +157,68 @@ char *syscallnames[] = { "mkdir", /* 136 = mkdir */ "rmdir", /* 137 = rmdir */ "utimes", /* 138 = utimes */ - "obs_4.2", /* 139 = obsolete 4.2 sigreturn */ + "#139 (obsolete 4.2 sigreturn)", /* 139 = obsolete 4.2 sigreturn */ "adjtime", /* 140 = adjtime */ - "old.getpeername", /* 141 = old getpeername */ - "old.gethostid", /* 142 = old gethostid */ - "old.sethostid", /* 143 = old sethostid */ - "old.getrlimit", /* 144 = old getrlimit */ - "old.setrlimit", /* 145 = old setrlimit */ - "old.killpg", /* 146 = old killpg */ + "compat_43_getpeername", /* 141 = compat_43 getpeername */ + "compat_43_gethostid", /* 142 = compat_43 gethostid */ + "compat_43_sethostid", /* 143 = compat_43 sethostid */ + "compat_43_getrlimit", /* 144 = compat_43 getrlimit */ + "compat_43_setrlimit", /* 145 = compat_43 setrlimit */ + "compat_43_killpg", /* 146 = compat_43 killpg */ "setsid", /* 147 = setsid */ "quotactl", /* 148 = quotactl */ - "old.quota", /* 149 = old quota */ - "old.getsockname", /* 150 = old getsockname */ - "#151", /* 151 = nosys */ - "#152", /* 152 = nosys */ - "#153", /* 153 = nosys */ - "#154", /* 154 = nosys */ + "compat_43_quota", /* 149 = compat_43 quota */ + "compat_43_getsockname", /* 150 = compat_43 getsockname */ + "#151 (unimplemented)", /* 151 = unimplemented */ + "#152 (unimplemented)", /* 152 = unimplemented */ + "#153 (unimplemented)", /* 153 = unimplemented */ + "#154 (unimplemented)", /* 154 = unimplemented */ #if defined(NFSCLIENT) || defined(NFSSERVER) "nfssvc", /* 155 = nfssvc */ #else - "#155", /* 155 = nosys */ + "#155 (unimplemented)", /* 155 = unimplemented */ #endif - "old.getdirentries", /* 156 = old getdirentries */ + "compat_43_getdirentries", /* 156 = compat_43 getdirentries */ "statfs", /* 157 = statfs */ "fstatfs", /* 158 = fstatfs */ - "#159", /* 159 = nosys */ - "#160", /* 160 = nosys */ + "#159 (unimplemented)", /* 159 = unimplemented */ + "#160 (unimplemented)", /* 160 = unimplemented */ #ifdef NFSCLIENT "getfh", /* 161 = getfh */ #else - "#161", /* 161 = nosys */ + "#161 (unimplemented getfh)", /* 161 = unimplemented getfh */ #endif - "old.getdomainname", /* 162 = old getdomainname */ - "old.setdomainname", /* 163 = old setdomainname */ - "old.uname", /* 164 = old uname */ + "compat_09_getdomainname", /* 162 = compat_09 getdomainname */ + "compat_09_setdomainname", /* 163 = compat_09 setdomainname */ + "compat_09_uname", /* 164 = compat_09 uname */ "sysarch", /* 165 = sysarch */ - "#166", /* 166 = nosys */ - "#167", /* 167 = nosys */ - "#168", /* 168 = nosys */ -#ifdef SYSVSEM - "semsys", /* 169 = semsys */ + "#166 (unimplemented)", /* 166 = unimplemented */ + "#167 (unimplemented)", /* 167 = unimplemented */ + "#168 (unimplemented)", /* 168 = unimplemented */ +#if defined(SYSVSEM) && !defined(alpha) + "compat_10_semsys", /* 169 = compat_10 semsys */ #else - "#169", /* 169 = nosys */ + "#169 (unimplemented 1.0 semsys)", /* 169 = unimplemented 1.0 semsys */ #endif -#ifdef SYSVMSG - "msgsys", /* 170 = msgsys */ +#if defined(SYSVMSG) && !defined(alpha) + "compat_10_msgsys", /* 170 = compat_10 msgsys */ #else - "#170", /* 170 = nosys */ + "#170 (unimplemented 1.0 msgsys)", /* 170 = unimplemented 1.0 msgsys */ #endif -#ifdef SYSVSHM - "shmsys", /* 171 = shmsys */ +#if defined(SYSVSHM) && !defined(alpha) + "compat_10_shmsys", /* 171 = compat_10 shmsys */ #else - "#171", /* 171 = nosys */ + "#171 (unimplemented 1.0 shmsys)", /* 171 = unimplemented 1.0 shmsys */ #endif - "#172", /* 172 = nosys */ - "#173", /* 173 = nosys */ - "#174", /* 174 = nosys */ - "#175", /* 175 = nosys */ - "#176", /* 176 = nosys */ - "#177", /* 177 = nosys */ - "#178", /* 178 = nosys */ - "#179", /* 179 = nosys */ - "#180", /* 180 = nosys */ + "#172 (unimplemented)", /* 172 = unimplemented */ + "#173 (unimplemented)", /* 173 = unimplemented */ + "#174 (unimplemented)", /* 174 = unimplemented */ + "#175 (unimplemented)", /* 175 = unimplemented */ + "#176 (unimplemented)", /* 176 = unimplemented */ + "#177 (unimplemented)", /* 177 = unimplemented */ + "#178 (unimplemented)", /* 178 = unimplemented */ + "#179 (unimplemented)", /* 179 = unimplemented */ + "#180 (unimplemented)", /* 180 = unimplemented */ "setgid", /* 181 = setgid */ "setegid", /* 182 = setegid */ "seteuid", /* 183 = seteuid */ @@ -228,17 +228,17 @@ char *syscallnames[] = { "lfs_segclean", /* 186 = lfs_segclean */ "lfs_segwait", /* 187 = lfs_segwait */ #else - "#184", /* 184 = nosys */ - "#185", /* 185 = nosys */ - "#186", /* 186 = nosys */ - "#187", /* 187 = nosys */ + "#184 (unimplemented)", /* 184 = unimplemented */ + "#185 (unimplemented)", /* 185 = unimplemented */ + "#186 (unimplemented)", /* 186 = unimplemented */ + "#187 (unimplemented)", /* 187 = unimplemented */ #endif "stat", /* 188 = stat */ "fstat", /* 189 = fstat */ "lstat", /* 190 = lstat */ "pathconf", /* 191 = pathconf */ "fpathconf", /* 192 = fpathconf */ - "#193", /* 193 = nosys */ + "#193 (unimplemented)", /* 193 = unimplemented */ "getrlimit", /* 194 = getrlimit */ "setrlimit", /* 195 = setrlimit */ "getdirentries", /* 196 = getdirentries */ @@ -250,11 +250,11 @@ char *syscallnames[] = { "__sysctl", /* 202 = __sysctl */ "mlock", /* 203 = mlock */ "munlock", /* 204 = munlock */ - "#205", /* 205 = nosys */ - "#206", /* 206 = nosys */ - "#207", /* 207 = nosys */ - "#208", /* 208 = nosys */ - "#209", /* 209 = nosys */ + "#205 (unimplemented)", /* 205 = unimplemented */ + "#206 (unimplemented)", /* 206 = unimplemented */ + "#207 (unimplemented)", /* 207 = unimplemented */ + "#208 (unimplemented)", /* 208 = unimplemented */ + "#209 (unimplemented)", /* 209 = unimplemented */ #ifdef LKM "lkmnosys", /* 210 = lkmnosys */ "lkmnosys", /* 211 = lkmnosys */ @@ -267,15 +267,48 @@ char *syscallnames[] = { "lkmnosys", /* 218 = lkmnosys */ "lkmnosys", /* 219 = lkmnosys */ #else /* !LKM */ - "#210", /* 210 = nosys */ - "#211", /* 211 = nosys */ - "#212", /* 212 = nosys */ - "#213", /* 213 = nosys */ - "#214", /* 214 = nosys */ - "#215", /* 215 = nosys */ - "#216", /* 216 = nosys */ - "#217", /* 217 = nosys */ - "#218", /* 218 = nosys */ - "#219", /* 219 = nosys */ + "#210 (unimplemented)", /* 210 = unimplemented */ + "#211 (unimplemented)", /* 211 = unimplemented */ + "#212 (unimplemented)", /* 212 = unimplemented */ + "#213 (unimplemented)", /* 213 = unimplemented */ + "#214 (unimplemented)", /* 214 = unimplemented */ + "#215 (unimplemented)", /* 215 = unimplemented */ + "#216 (unimplemented)", /* 216 = unimplemented */ + "#217 (unimplemented)", /* 217 = unimplemented */ + "#218 (unimplemented)", /* 218 = unimplemented */ + "#219 (unimplemented)", /* 219 = unimplemented */ #endif /* !LKM */ +#ifdef SYSVSEM + "__semctl", /* 220 = __semctl */ + "semget", /* 221 = semget */ + "semop", /* 222 = semop */ + "semconfig", /* 223 = semconfig */ +#else + "#220 (unimplemented semctl)", /* 220 = unimplemented semctl */ + "#221 (unimplemented semget)", /* 221 = unimplemented semget */ + "#222 (unimplemented semop)", /* 222 = unimplemented semop */ + "#223 (unimplemented semconfig)", /* 223 = unimplemented semconfig */ +#endif +#ifdef SYSVMSG + "msgctl", /* 224 = msgctl */ + "msgget", /* 225 = msgget */ + "msgsnd", /* 226 = msgsnd */ + "msgrcv", /* 227 = msgrcv */ +#else + "#224 (unimplemented msgctl)", /* 224 = unimplemented msgctl */ + "#225 (unimplemented msgget)", /* 225 = unimplemented msgget */ + "#226 (unimplemented msgsnd)", /* 226 = unimplemented msgsnd */ + "#227 (unimplemented msgrcv)", /* 227 = unimplemented msgrcv */ +#endif +#ifdef SYSVSHM + "shmat", /* 228 = shmat */ + "shmctl", /* 229 = shmctl */ + "shmdt", /* 230 = shmdt */ + "shmget", /* 231 = shmget */ +#else + "#228 (unimplemented shmat)", /* 228 = unimplemented shmat */ + "#229 (unimplemented shmctl)", /* 229 = unimplemented shmctl */ + "#230 (unimplemented shmdt)", /* 230 = unimplemented shmdt */ + "#231 (unimplemented shmget)", /* 231 = unimplemented shmget */ +#endif }; diff --git a/sys/kern/syscalls.conf b/sys/kern/syscalls.conf new file mode 100644 index 000000000000..0682ce7ee8f6 --- /dev/null +++ b/sys/kern/syscalls.conf @@ -0,0 +1,12 @@ +# $Id: syscalls.conf,v 1.1 1994/10/20 04:23:11 cgd Exp $ + +sysnames="syscalls.c" +sysnumhdr="../sys/syscall.h" +syssw="init_sysent.c" +sysarghdr="../sys/syscallargs.h" +compatopts="compat_43 compat_09 compat_10" +libcompatopts="" + +switchname="sysent" +namesname="syscallnames" +constprefix="SYS_" diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 55bf37ecb15c..27c89f6dd87c 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -1,26 +1,40 @@ - $NetBSD: syscalls.master,v 1.22 1994/06/29 06:33:10 cgd Exp $ + $NetBSD: syscalls.master,v 1.23 1994/10/20 04:23:12 cgd Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 -; System call name/number master file. -; Processed to created init_sysent.c, syscalls.c and syscall.h. -; Columns: number type nargs name altname/comments +; NetBSD system call name/number "master" file. +; (See syscalls.conf to see what it is processed into.) +; +; Fields: number type [type-dependent ...] ; number system call number, must be in order -; type one of STD, OBSOL, UNIMPL, NODEF, COMPAT, NCOMPAT, LIBCOMPAT -; nargs number of arguments -; name name of syscall routine -; altname name of system call if different -; for UNIMPL/OBSOL, name continues with comments - +; type one of STD, OBSOL, UNIMPL, NODEF, NOARGS, or one of +; the copatibility options defined in syscalls.conf. +; ; types: ; STD always included -; COMPAT included on COMPAT #ifdef -; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h -; OBSOL obsolete, not included in system, only specifies name -; NODEF do everything except include in syscall.h -; NCOMPAT included on NetBSD COMPAT #ifdef -; UNIMPL not implemented, placeholder only - +; OBSOL obsolete, not included in system +; UNIMP unimplemented, not included in system +; NODEF included, but don't define the syscall number +; NOARGS included, but don't define the syscall args structure +; +; The compat options are defined in the syscalls.conf file, and the +; compat option name is prefixed to the syscall name. Other than +; that, they're like NODEF (for 'compat' options), or STD (for +; 'libcompat' options). +; +; The type-dependent arguments are as follows: +; For STD, NODEF, NOARGS, and compat syscalls: +; { pseudo-proto } [alias] +; For other syscalls: +; [comment] +; ; #ifdef's, etc. may be included, and are copied to the output files. +; #include's are copied to the syscall switch definition file only. + +#include +#include +#include +#include +#include ; Reserved/unimplemented system calls in the range 0-150 inclusive ; are reserved for use in future Berkeley releases. @@ -28,285 +42,362 @@ ; redistributions should be placed in the reserved range at the end ; of the current calls. -0 STD 0 nosys syscall -1 STD 1 exit -2 STD 0 fork -3 STD 3 read -4 STD 3 write -5 STD 3 open -6 STD 1 close -7 STD 4 wait4 -8 COMPAT 2 creat -9 STD 2 link -10 STD 1 unlink -11 OBSOL 2 execv -12 STD 1 chdir -13 STD 1 fchdir -14 STD 3 mknod -15 STD 2 chmod -16 STD 3 chown -17 STD 1 obreak break -18 STD 3 getfsstat -19 COMPAT 3 lseek -20 STD 0 getpid -21 STD 4 mount -22 STD 2 unmount -23 STD 1 setuid -24 STD 0 getuid -25 STD 0 geteuid -26 STD 4 ptrace -27 STD 3 recvmsg -28 STD 3 sendmsg -29 STD 6 recvfrom -30 STD 3 accept -31 STD 3 getpeername -32 STD 3 getsockname -33 STD 2 access -34 STD 2 chflags -35 STD 2 fchflags -36 STD 0 sync -37 STD 2 kill -38 COMPAT 2 stat -39 STD 0 getppid -40 COMPAT 2 lstat -41 STD 2 dup -42 STD 0 pipe -43 STD 0 getegid -44 STD 4 profil +0 STD { int nosys(void); } syscall +1 STD { int exit(int rval); } +2 STD { int fork(void); } +3 STD { int read(int fd, char *buf, u_int nbyte); } +4 STD { int write(int fd, char *buf, u_int nbyte); } +5 STD { int open(char *path, int flags, int mode); } +6 STD { int close(int fd); } +7 STD { int wait4(int pid, int *status, int options, \ + struct rusage *rusage); } +8 COMPAT_43 { int creat(char *path, int mode); } +9 STD { int link(char *path, char *link); } +10 STD { int unlink(char *path); } +11 OBSOL execv +12 STD { int chdir(char *path); } +13 STD { int fchdir(int fd); } +14 STD { int mknod(char *path, int mode, int dev); } +15 STD { int chmod(char *path, int mode); } +16 STD { int chown(char *path, int uid, int gid); } +17 STD { int obreak(char *nsize); } break +18 STD { int getfsstat(struct statfs *buf, long bufsize, \ + int flags); } +19 COMPAT_43 { long lseek(int fd, long offset, int whence); } +20 STD { pid_t getpid(void); } +21 STD { int mount(char *type, char *path, int flags, \ + caddr_t data); } +22 STD { int unmount(char *path, int flags); } +23 STD { int setuid(uid_t uid); } +24 STD { uid_t getuid(void); } +25 STD { uid_t geteuid(void); } +26 STD { int ptrace(int req, pid_t pid, caddr_t addr, \ + int data); } +27 STD { int recvmsg(int s, struct msghdr *msg, int flags); } +28 STD { int sendmsg(int s, caddr_t msg, int flags); } +29 STD { int recvfrom(int s, caddr_t buf, size_t len, \ + int flags, caddr_t from, int *fromlenaddr); } +30 STD { int accept(int s, caddr_t name, int *anamelen); } +31 STD { int getpeername(int fdes, caddr_t asa, int *alen); } +32 STD { int getsockname(int fdes, caddr_t asa, int *alen); } +33 STD { int access(char *path, int flags); } +34 STD { int chflags(char *path, int flags); } +35 STD { int fchflags(int fd, int flags); } +36 STD { int sync(void); } +37 STD { int kill(int pid, int signum); } +38 COMPAT_43 { int stat(char *path, struct ostat *ub); } +39 STD { pid_t getppid(void); } +40 COMPAT_43 { int lstat(char *path, struct ostat *ub); } +41 STD { int dup(u_int fd); } +42 STD { int pipe(void); } +43 STD { gid_t getegid(void); } +44 STD { int profil(caddr_t samples, u_int size, \ + u_int offset, u_int scale); } #ifdef KTRACE -45 STD 4 ktrace +45 STD { int ktrace(char *fname, int ops, int facs, \ + int pid); } #else -45 UNIMPL 0 ktrace +45 UNIMPL ktrace #endif -46 STD 3 sigaction -47 STD 0 getgid -48 STD 2 sigprocmask -49 STD 2 getlogin -50 STD 1 setlogin -51 STD 1 acct -52 STD 0 sigpending -53 STD 2 sigaltstack -54 STD 3 ioctl -55 STD 1 reboot -56 STD 1 revoke -57 STD 2 symlink -58 STD 3 readlink -59 STD 3 execve -60 STD 1 umask -61 STD 1 chroot -62 COMPAT 2 fstat -63 COMPAT 4 getkerninfo -64 COMPAT 0 getpagesize -65 STD 2 msync -66 STD 0 vfork -67 OBSOL 0 vread -68 OBSOL 0 vwrite -69 STD 1 sbrk -70 STD 1 sstk -71 COMPAT 7 mmap -72 STD 1 ovadvise vadvise -73 STD 2 munmap -74 STD 3 mprotect -75 STD 3 madvise -76 OBSOL 0 vhangup -77 OBSOL 0 vlimit -78 STD 3 mincore -79 STD 2 getgroups -80 STD 2 setgroups -81 STD 0 getpgrp -82 STD 2 setpgid -83 STD 3 setitimer -84 COMPAT 0 wait -85 STD 1 swapon -86 STD 2 getitimer -87 COMPAT 2 gethostname -88 COMPAT 2 sethostname -89 COMPAT 0 getdtablesize -90 STD 2 dup2 -91 UNIMPL 2 getdopt -92 STD 3 fcntl -93 STD 5 select -94 UNIMPL 2 setdopt -95 STD 1 fsync -96 STD 3 setpriority -97 STD 3 socket -98 STD 3 connect -99 COMPAT 3 accept -100 STD 2 getpriority -101 COMPAT 4 send -102 COMPAT 4 recv -103 STD 1 sigreturn -104 STD 3 bind -105 STD 5 setsockopt -106 STD 2 listen -107 OBSOL 0 vtimes -108 COMPAT 3 sigvec -109 COMPAT 1 sigblock -110 COMPAT 1 sigsetmask -111 STD 1 sigsuspend -112 COMPAT 2 sigstack -113 COMPAT 3 recvmsg -114 COMPAT 3 sendmsg +46 STD { int sigaction(int signum, struct sigaction *nsa, \ + struct sigaction *osa); } +47 STD { gid_t getgid(void); } +48 STD { int sigprocmask(int how, sigset_t mask); } +49 STD { int getlogin(char *namebuf, u_int namelen); } +50 STD { int setlogin(char *namebuf); } +51 STD { int acct(char *path); } +52 STD { int sigpending(void); } +53 STD { int sigaltstack(struct sigaltstack *nss, \ + struct sigaltstack *oss); } +54 STD { int ioctl(int fd, u_long com, caddr_t data); } +55 STD { int reboot(int opt); } +56 STD { int revoke(char *path); } +57 STD { int symlink(char *path, char *link); } +58 STD { int readlink(char *path, char *buf, int count); } +59 STD { int execve(char *path, char **argp, char **envp); } +60 STD { int umask(int newmask); } +61 STD { int chroot(char *path); } +62 COMPAT_43 { int fstat(int fd, struct ostat *sb); } +63 COMPAT_43 { int getkerninfo(int op, char *where, int *size, \ + int arg); } +64 COMPAT_43 { int getpagesize(void); } +65 STD { int msync(caddr_t addr, int len); } +66 STD { int vfork(void); } +67 OBSOL vread +68 OBSOL vwrite +69 STD { int sbrk(int incr); } +70 STD { int sstk(int incr); } +71 COMPAT_43 { int mmap(caddr_t addr, int len, int prot, \ + int flags, int fd, long pos); } +72 STD { int ovadvise(int anom); } vadvise +73 STD { int munmap(caddr_t addr, int len); } +74 STD { int mprotect(caddr_t addr, int len, int prot); } +75 STD { int madvise(caddr_t addr, int len, int behav); } +76 OBSOL vhangup +77 OBSOL vlimit +78 STD { int mincore(caddr_t addr, int len, char *vec); } +79 STD { int getgroups(u_int gidsetsize, gid_t *gidset); } +80 STD { int setgroups(u_int gidsetsize, gid_t *gidset); } +81 STD { int getpgrp(void); } +82 STD { int setpgid(int pid, int pgid); } +83 STD { int setitimer(u_int which, struct itimerval *itv, \ + struct itimerval *oitv); } +84 COMPAT_43 { int wait(void); } +85 STD { int swapon(char *name); } +86 STD { int getitimer(u_int which, struct itimerval *itv); } +87 COMPAT_43 { int gethostname(char *hostname, u_int len); } +88 COMPAT_43 { int sethostname(char *hostname, u_int len); } +89 COMPAT_43 { int getdtablesize(void); } +90 STD { int dup2(u_int from, u_int to); } +91 UNIMPL getdopt +92 STD { int fcntl(int fd, int cmd, void *arg); } +93 STD { int select(u_int nd, fd_set *in, fd_set *ou, \ + fd_set *ex, struct timeval *tv); } +94 UNIMPL setdopt +95 STD { int fsync(int fd); } +96 STD { int setpriority(int which, int who, int prio); } +97 STD { int socket(int domain, int type, int protocol); } +98 STD { int connect(int s, caddr_t name, int namelen); } +99 COMPAT_43 { int accept(int s, caddr_t name, int *anamelen); } +100 STD { int getpriority(int which, int who); } +101 COMPAT_43 { int send(int s, caddr_t buf, int len, int flags); } +102 COMPAT_43 { int recv(int s, caddr_t buf, int len, int flags); } +103 STD { int sigreturn(struct sigcontext *sigcntxp); } +104 STD { int bind(int s, caddr_t name, int namelen); } +105 STD { int setsockopt(int s, int level, int name, \ + caddr_t val, int valsize); } +106 STD { int listen(int s, int backlog); } +107 OBSOL vtimes +108 COMPAT_43 { int sigvec(int signum, struct sigvec *nsv, \ + struct sigvec *osv); } +109 COMPAT_43 { int sigblock(int mask); } +110 COMPAT_43 { int sigsetmask(int mask); } +111 STD { int sigsuspend(int mask); } +112 COMPAT_43 { int sigstack(struct sigstack *nss, \ + struct sigstack *oss); } +113 COMPAT_43 { int recvmsg(int s, struct omsghdr *msg, int flags); } +114 COMPAT_43 { int sendmsg(int s, caddr_t msg, int flags); } #ifdef TRACE -115 STD 2 vtrace +115 STD { int vtrace(int request, int value); } #else -115 OBSOL 2 vtrace +115 OBSOL vtrace #endif -116 STD 2 gettimeofday -117 STD 2 getrusage -118 STD 5 getsockopt +116 STD { int gettimeofday(struct timeval *tp, \ + struct timezone *tzp); } +117 STD { int getrusage(int who, struct rusage *rusage); } +118 STD { int getsockopt(int s, int level, int name, \ + caddr_t val, int *avalsize); } #ifdef vax -119 STD 1 resuba +119 STD { int resuba(int value); } #else -119 UNIMPL 0 nosys +119 UNIMPL resuba #endif -120 STD 3 readv -121 STD 3 writev -122 STD 2 settimeofday -123 STD 3 fchown -124 STD 2 fchmod -125 COMPAT 6 recvfrom -126 COMPAT 2 setreuid -127 COMPAT 2 setregid -128 STD 2 rename -129 COMPAT 2 truncate -130 COMPAT 2 ftruncate -131 STD 2 flock -132 STD 2 mkfifo -133 STD 6 sendto -134 STD 2 shutdown -135 STD 5 socketpair -136 STD 2 mkdir -137 STD 1 rmdir -138 STD 2 utimes -139 OBSOL 0 4.2 sigreturn -140 STD 2 adjtime -141 COMPAT 3 getpeername -142 COMPAT 0 gethostid -143 COMPAT 1 sethostid -144 COMPAT 2 getrlimit -145 COMPAT 2 setrlimit -146 COMPAT 2 killpg -147 STD 0 setsid -148 STD 4 quotactl -149 COMPAT 4 quota -150 COMPAT 3 getsockname +120 STD { int readv(int fd, struct iovec *iovp, u_int iovcnt); } +121 STD { int writev(int fd, struct iovec *iovp, \ + u_int iovcnt); } +122 STD { int settimeofday(struct timeval *tv, \ + struct timezone *tzp); } +123 STD { int fchown(int fd, int uid, int gid); } +124 STD { int fchmod(int fd, int mode); } +125 COMPAT_43 { int recvfrom(int s, caddr_t buf, size_t len, \ + int flags, caddr_t from, int *fromlenaddr); } +126 COMPAT_43 { int setreuid(int ruid, int euid); } +127 COMPAT_43 { int setregid(int rgid, int egid); } +128 STD { int rename(char *from, char *to); } +129 COMPAT_43 { int truncate(char *path, long length); } +130 COMPAT_43 { int ftruncate(int fd, long length); } +131 STD { int flock(int fd, int how); } +132 STD { int mkfifo(char *path, int mode); } +133 STD { int sendto(int s, caddr_t buf, size_t len, \ + int flags, caddr_t to, int tolen); } +134 STD { int shutdown(int s, int how); } +135 STD { int socketpair(int domain, int type, int protocol, \ + int *rsv); } +136 STD { int mkdir(char *path, int mode); } +137 STD { int rmdir(char *path); } +138 STD { int utimes(char *path, struct timeval *tptr); } +139 OBSOL 4.2 sigreturn +140 STD { int adjtime(struct timeval *delta, \ + struct timeval *olddelta); } +141 COMPAT_43 { int getpeername(int fdes, caddr_t asa, int *alen); } +142 COMPAT_43 { int32_t gethostid(void); } +143 COMPAT_43 { int sethostid(int32_t hostid); } +144 COMPAT_43 { int getrlimit(u_int which, struct ogetrlimit *rlp); } +145 COMPAT_43 { int setrlimit(u_int which, struct ogetrlimit *rlp); } +146 COMPAT_43 { int killpg(int pgid, int signum); } +147 STD { int setsid(void); } +148 STD { int quotactl(char *path, int cmd, int uid, \ + caddr_t arg); } +149 COMPAT_43 { int quota(void); } +150 COMPAT_43 { int getsockname(int fdec, caddr_t asa, int *alen); } ; Syscalls 151-180 inclusive are reserved for vendor-specific ; system calls. (This includes various calls added for compatibity ; with other Unix variants.) ; Some of these calls are now supported by BSD... -151 UNIMPL 0 nosys -152 UNIMPL 0 nosys -153 UNIMPL 0 nosys -154 UNIMPL 0 nosys +151 UNIMPL +152 UNIMPL +153 UNIMPL +154 UNIMPL #if defined(NFSCLIENT) || defined(NFSSERVER) -155 STD 2 nfssvc +155 STD { int nfssvc(int flag, caddr_t argp); } #else -155 UNIMPL 0 nosys +155 UNIMPL #endif -156 COMPAT 4 getdirentries -157 STD 2 statfs -158 STD 2 fstatfs -159 UNIMPL 0 nosys -160 UNIMPL 0 nosys +156 COMPAT_43 { int getdirentries(int fd, char *buf, u_int count, \ + long *basep); } +157 STD { int statfs(char *path, struct statfs *buf); } +158 STD { int fstatfs(int fd, struct statfs *buf); } +159 UNIMPL +160 UNIMPL #ifdef NFSCLIENT -161 STD 2 getfh +161 STD { int getfh(char *fname, fhandle_t *fhp); } #else -161 UNIMPL 0 nosys +161 UNIMPL getfh #endif -162 NCOMPAT 2 getdomainname -163 NCOMPAT 2 setdomainname -164 NCOMPAT 1 uname -165 STD 2 sysarch -166 UNIMPL 0 nosys -167 UNIMPL 0 nosys -168 UNIMPL 0 nosys -#ifdef SYSVSEM -169 STD 5 semsys +162 COMPAT_09 { int getdomainname(char *domainname, int len); } +163 COMPAT_09 { int setdomainname(char *domainname, int len); } +164 COMPAT_09 { int uname(struct outsname *name); } +165 STD { int sysarch(int op, char *parms); } +166 UNIMPL +167 UNIMPL +168 UNIMPL +; XXX more generally, never on machines where sizeof(void *) != sizeof(int) +#if defined(SYSVSEM) && !defined(alpha) +169 COMPAT_10 { int semsys(int which, int a2, int a3, int a4, \ + int a5); } #else -169 UNIMPL 0 nosys +169 UNIMPL 1.0 semsys #endif -#ifdef SYSVMSG -170 STD 6 msgsys +; XXX more generally, never on machines where sizeof(void *) != sizeof(int) +#if defined(SYSVMSG) && !defined(alpha) +170 COMPAT_10 { int msgsys(int which, int a2, int a3, int a4, \ + int a5, int a6); } #else -170 UNIMPL 0 nosys +170 UNIMPL 1.0 msgsys #endif -#ifdef SYSVSHM -171 STD 4 shmsys +; XXX more generally, never on machines where sizeof(void *) != sizeof(int) +#if defined(SYSVSHM) && !defined(alpha) +171 COMPAT_10 { int shmsys(int which, int a2, int a3, int a4); } #else -171 UNIMPL 0 nosys +171 UNIMPL 1.0 shmsys #endif -172 UNIMPL 0 nosys -173 UNIMPL 0 nosys -174 UNIMPL 0 nosys -175 UNIMPL 0 nosys -176 UNIMPL 0 nosys -177 UNIMPL 0 nosys -178 UNIMPL 0 nosys -179 UNIMPL 0 nosys -180 UNIMPL 0 nosys +172 UNIMPL +173 UNIMPL +174 UNIMPL +175 UNIMPL +176 UNIMPL +177 UNIMPL +178 UNIMPL +179 UNIMPL +180 UNIMPL ; Syscalls 180-199 are used by/reserved for BSD -181 STD 1 setgid -182 STD 1 setegid -183 STD 1 seteuid +181 STD { int setgid(gid_t gid); } +182 STD { int setegid(gid_t egid); } +183 STD { int seteuid(uid_t euid); } #ifdef LFS -184 STD 3 lfs_bmapv -185 STD 3 lfs_markv -186 STD 2 lfs_segclean -187 STD 2 lfs_segwait +184 STD { int lfs_bmapv(fsid_t *fsidp, \ + struct block_info *blkiov, int blkcnt); } +185 STD { int lfs_markv(fsid_t *fsidp, \ + struct block_info *blkiov, int blkcnt); } +186 STD { int lfs_segclean(fsid_t *fsidp, u_long segment); } +187 STD { int lfs_segwait(fsid_t *fsidp, struct timeval *tv); } #else -184 UNIMPL 0 nosys -185 UNIMPL 0 nosys -186 UNIMPL 0 nosys -187 UNIMPL 0 nosys +184 UNIMPL +185 UNIMPL +186 UNIMPL +187 UNIMPL #endif -188 STD 2 stat -189 STD 2 fstat -190 STD 2 lstat -191 STD 2 pathconf -192 STD 2 fpathconf -193 UNIMPL 0 nosys -194 STD 2 getrlimit -195 STD 2 setrlimit -196 STD 4 getdirentries -197 STD 8 mmap -198 STD 0 nosys __syscall -199 STD 5 lseek -200 STD 4 truncate -201 STD 4 ftruncate -202 STD 6 __sysctl -203 STD 2 mlock -204 STD 2 munlock -205 UNIMPL 0 nosys -206 UNIMPL 0 nosys -207 UNIMPL 0 nosys -208 UNIMPL 0 nosys -209 UNIMPL 0 nosys +188 STD { int stat(char *path, struct stat *ub); } +189 STD { int fstat(int fd, struct stat *sb); } +190 STD { int lstat(char *path, struct stat *ub); } +191 STD { int pathconf(char *path, int name); } +192 STD { int fpathconf(int fd, int name); } +193 UNIMPL +194 STD { int getrlimit(u_int which, struct rlimit *rlp); } +195 STD { int setrlimit(u_int which, struct rlimit *rlp); } +196 STD { int getdirentries(int fd, char *buf, u_int count, \ + long *basep); } +197 STD { caddr_t mmap(caddr_t addr, size_t len, int prot, \ + int flags, int fd, long pad, off_t pos); } +198 STD { int nosys(void); } __syscall +199 STD { off_t lseek(int fd, int pad, off_t offset, \ + int whence); } +200 STD { int truncate(char *path, int pad, off_t length); } +201 STD { int ftruncate(int fd, int pad, off_t length); } +202 STD { int __sysctl(int *name, u_int namelen, void *old, \ + size_t *oldlenp, void *new, size_t newlen); } +203 STD { int mlock(caddr_t addr, size_t len); } +204 STD { int munlock(caddr_t addr, size_t len); } +205 UNIMPL +206 UNIMPL +207 UNIMPL +208 UNIMPL +209 UNIMPL ; ; Syscalls 210-219 are reserved for dynamically loaded syscalls ; #ifdef LKM -210 NODEF 0 lkmnosys -211 NODEF 0 lkmnosys -212 NODEF 0 lkmnosys -213 NODEF 0 lkmnosys -214 NODEF 0 lkmnosys -215 NODEF 0 lkmnosys -216 NODEF 0 lkmnosys -217 NODEF 0 lkmnosys -218 NODEF 0 lkmnosys -219 NODEF 0 lkmnosys +210 NODEF { int lkmnosys(void); } +211 NODEF { int lkmnosys(void); } +212 NODEF { int lkmnosys(void); } +213 NODEF { int lkmnosys(void); } +214 NODEF { int lkmnosys(void); } +215 NODEF { int lkmnosys(void); } +216 NODEF { int lkmnosys(void); } +217 NODEF { int lkmnosys(void); } +218 NODEF { int lkmnosys(void); } +219 NODEF { int lkmnosys(void); } #else /* !LKM */ -210 UNIMPL 0 nosys -211 UNIMPL 0 nosys -212 UNIMPL 0 nosys -213 UNIMPL 0 nosys -214 UNIMPL 0 nosys -215 UNIMPL 0 nosys -216 UNIMPL 0 nosys -217 UNIMPL 0 nosys -218 UNIMPL 0 nosys -219 UNIMPL 0 nosys +210 UNIMPL +211 UNIMPL +212 UNIMPL +213 UNIMPL +214 UNIMPL +215 UNIMPL +216 UNIMPL +217 UNIMPL +218 UNIMPL +219 UNIMPL #endif /* !LKM */ +; System calls 220-240 are reserved for use by NetBSD +#ifdef SYSVSEM +220 STD { int __semctl(int semid, int semnum, int cmd, \ + union semun *arg); } +221 STD { int semget(key_t key, int nsems, int semflg); } +222 STD { int semop(int semid, struct sembuf *sops, \ + u_int nsops); } +223 STD { int semconfig(int flag); } +#else +220 UNIMPL semctl +221 UNIMPL semget +222 UNIMPL semop +223 UNIMPL semconfig +#endif +#ifdef SYSVMSG +224 STD { int msgctl(int msqid, int cmd, \ + struct msqid_ds *buf); } +225 STD { int msgget(key_t key, int msgflg); } +226 STD { int msgsnd(int msqid, void *msgp, size_t msgsz, \ + int msgflg); } +227 STD { int msgrcv(int msqid, void *msgp, size_t msgsz, \ + long msgtyp, int msgflg); } +#else +224 UNIMPL msgctl +225 UNIMPL msgget +226 UNIMPL msgsnd +227 UNIMPL msgrcv +#endif +#ifdef SYSVSHM +228 STD { int shmat(int shmid, void *shmaddr, int shmflg); } +229 STD { int shmctl(int shmid, int cmd, \ + struct shmid_ds *buf); } +230 STD { int shmdt(void *shmaddr); } +231 STD { int shmget(key_t key, int size, int shmflg); } +#else +228 UNIMPL shmat +229 UNIMPL shmctl +230 UNIMPL shmdt +231 UNIMPL shmget +#endif diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index 7a3c45522299..9fe0a7e05231 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -1,4 +1,4 @@ -/* $NetBSD: sysv_msg.c,v 1.9 1994/06/29 06:33:13 cgd Exp $ */ +/* $NetBSD: sysv_msg.c,v 1.10 1994/10/20 04:23:15 cgd Exp $ */ /* * Implementation of SVID messages @@ -26,13 +26,12 @@ #include #include +#include +#include + #define MSG_DEBUG #undef MSG_DEBUG_OK -static int msgctl(), msgget(), msgsnd(), msgrcv(); - -int (*msgcalls[])() = { msgctl, msgget, msgsnd, msgrcv }; - int nfree_msgmaps; /* # of free map entries */ short free_msgmaps; /* head of linked list of free map entries */ struct msg *free_msghdrs; /* list of free msg headers */ @@ -94,26 +93,6 @@ msginit() } } -/* - * Entry point for all MSG calls - */ - -struct msgsys_args { - u_int which; -}; - -int -msgsys(p, uap, retval) - struct caller *p; - struct msgsys_args *uap; - int *retval; -{ - - if (uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0])) - return (EINVAL); - return ((*msgcalls[uap->which])(p, &uap[1], retval)); -} - static void msg_freehdr(msghdr) struct msg *msghdr; @@ -138,21 +117,19 @@ msg_freehdr(msghdr) free_msghdrs = msghdr; } -struct msgctl_args { - int msqid; - int cmd; - struct msqid_ds *user_msqptr; -}; - int msgctl(p, uap, retval) struct proc *p; - register struct msgctl_args *uap; - int *retval; + register struct msgctl_args /* { + syscallarg(int) msqid; + syscallarg(int) cmd; + syscallarg(struct msqid_ds *) buf; + } */ *uap; + register_t *retval; { - int msqid = uap->msqid; - int cmd = uap->cmd; - struct msqid_ds *user_msqptr = uap->user_msqptr; + int msqid = SCARG(uap, msqid); + int cmd = SCARG(uap, cmd); + struct msqid_ds *user_msqptr = SCARG(uap, buf); struct ucred *cred = p->p_ucred; int i, rval, eval; struct msqid_ds msqbuf; @@ -180,7 +157,7 @@ msgctl(p, uap, retval) #endif return(EINVAL); } - if (msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) { + if (msqptr->msg_perm.seq != IPCID_TO_SEQ(SCARG(uap, msqid))) { #ifdef MSG_DEBUG_OK printf("wrong sequence number\n"); #endif @@ -273,20 +250,18 @@ msgctl(p, uap, retval) return(eval); } -struct msgget_args { - key_t key; - int msgflg; -}; - int msgget(p, uap, retval) struct proc *p; - register struct msgget_args *uap; - int *retval; + register struct msgget_args /* { + syscallarg(key_t) key; + syscallarg(int) msgflg; + } */ *uap; + register_t *retval; { int msqid, eval; - int key = uap->key; - int msgflg = uap->msgflg; + int key = SCARG(uap, key); + int msgflg = SCARG(uap, msgflg); struct ucred *cred = p->p_ucred; register struct msqid_ds *msqptr; @@ -378,23 +353,21 @@ found: return(0); } -struct msgsnd_args { - int msqid; - void *user_msgp; - size_t msgsz; - int msgflg; -}; - int msgsnd(p, uap, retval) struct proc *p; - register struct msgsnd_args *uap; - int *retval; + register struct msgsnd_args /* { + syscallarg(int) msqid; + syscallarg(void *) msgp; + syscallarg(size_t) msgsz; + syscallarg(int) msgflg; + } */ *uap; + register_t *retval; { - int msqid = uap->msqid; - void *user_msgp = uap->user_msgp; - size_t msgsz = uap->msgsz; - int msgflg = uap->msgflg; + int msqid = SCARG(uap, msqid); + char *user_msgp = SCARG(uap, msgp); + size_t msgsz = SCARG(uap, msgsz); + int msgflg = SCARG(uap, msgflg); int segs_needed, eval; struct ucred *cred = p->p_ucred; register struct msqid_ds *msqptr; @@ -423,7 +396,7 @@ msgsnd(p, uap, retval) #endif return(EINVAL); } - if (msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) { + if (msqptr->msg_perm.seq != IPCID_TO_SEQ(SCARG(uap, msqid))) { #ifdef MSG_DEBUG_OK printf("wrong sequence number\n"); #endif @@ -712,25 +685,23 @@ msgsnd(p, uap, retval) return(0); } -struct msgrcv_args { - int msqid; - void *msgp; - size_t msgsz; - long msgtyp; - int msgflg; -}; - int msgrcv(p, uap, retval) struct proc *p; - register struct msgrcv_args *uap; - int *retval; + register struct msgrcv_args /* { + syscallarg(int) msqid; + syscallarg(void *) msgp; + syscallarg(size_t) msgsz; + syscallarg(long) msgtyp; + syscallarg(int) msgflg; + } */ *uap; + register_t *retval; { - int msqid = uap->msqid; - void *user_msgp = uap->msgp; - size_t msgsz = uap->msgsz; - long msgtyp = uap->msgtyp; - int msgflg = uap->msgflg; + int msqid = SCARG(uap, msqid); + char *user_msgp = SCARG(uap, msgp); + size_t msgsz = SCARG(uap, msgsz); + long msgtyp = SCARG(uap, msgtyp); + int msgflg = SCARG(uap, msgflg); size_t len; struct ucred *cred = p->p_ucred; register struct msqid_ds *msqptr; @@ -760,7 +731,7 @@ msgrcv(p, uap, retval) #endif return(EINVAL); } - if (msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) { + if (msqptr->msg_perm.seq != IPCID_TO_SEQ(SCARG(uap, msqid))) { #ifdef MSG_DEBUG_OK printf("wrong sequence number\n"); #endif @@ -910,7 +881,7 @@ msgrcv(p, uap, retval) */ if (msqptr->msg_qbytes == 0 || - msqptr->msg_perm.seq != IPCID_TO_SEQ(uap->msqid)) { + msqptr->msg_perm.seq != IPCID_TO_SEQ(SCARG(uap, msqid))) { #ifdef MSG_DEBUG_OK printf("msqid deleted\n"); #endif @@ -1004,3 +975,74 @@ msgrcv(p, uap, retval) *retval = msgsz; return(0); } + +#if defined(COMPAT_10) && !defined(alpha) +int +compat_10_msgsys(p, uap, retval) + struct caller *p; + struct compat_10_msgsys_args /* { + syscallarg(int) which; + syscallarg(int) a2; + syscallarg(int) a3; + syscallarg(int) a4; + syscallarg(int) a5; + syscallarg(int) a6; + } */ *uap; + register_t *retval; +{ + struct msgctl_args { + syscallarg(int) msqid; + syscallarg(int) cmd; + syscallarg(struct msqid_ds *) buf; + } msgctl_args; + struct msgget_args { + syscallarg(key_t) key; + syscallarg(int) msgflg; + } msgget_args; + struct msgsnd_args { + syscallarg(int) msqid; + syscallarg(void *) msgp; + syscallarg(size_t) msgsz; + syscallarg(int) msgflg; + } msgsnd_args; + struct msgrcv_args { + syscallarg(int) msqid; + syscallarg(void *) msgp; + syscallarg(size_t) msgsz; + syscallarg(long) msgtyp; + syscallarg(int) msgflg; + } msgrcv_args; + + switch (SCARG(uap, which)) { + case 0: /* msgctl()*/ + SCARG(&msgctl_args, msqid) = SCARG(uap, a2); + SCARG(&msgctl_args, cmd) = SCARG(uap, a3); + SCARG(&msgctl_args, buf) = + (struct msqid_ds *)SCARG(uap, a4); + return (msgctl(p, &msgctl_args, retval)); + + case 1: /* msgget() */ + SCARG(&msgctl_args, key) = SCARG(uap, a2); + SCARG(&msgctl_args, msgflg) = SCARG(uap, a3); + return (msgget(p, &msgget_args, retval)); + + case 2: /* msgsnd() */ + SCARG(&msgsnd_args, msqid) = SCARG(uap, a2); + SCARG(&msgsnd_args, msgp) = (void *)SCARG(uap, a3); + SCARG(&msgsnd_args, msgsz) = SCARG(uap, a4); + SCARG(&msgsnd_args, msgflg) = SCARG(uap, a5); + return (msgget(p, &msgget_args, retval)); + + case 3: /* msgrcv() */ + SCARG(&msgsnd_args, msqid) = SCARG(uap, a2); + SCARG(&msgsnd_args, msgp) = (void *)SCARG(uap, a3); + SCARG(&msgsnd_args, msgsz) = SCARG(uap, a4); + SCARG(&msgsnd_args, msgtyp) = SCARG(uap, a5); + SCARG(&msgsnd_args, msgflg) = SCARG(uap, a6); + return (msgget(p, &msgget_args, retval)); + + default: + return (EINVAL); + } +} +#endif /* defined(COMPAT_10) && !defined(alpha) */ diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index 92c50b48d6cc..197eeb59c6ad 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1,4 +1,4 @@ -/* $NetBSD: sysv_sem.c,v 1.9 1994/06/29 06:33:15 cgd Exp $ */ +/* $NetBSD: sysv_sem.c,v 1.10 1994/10/20 04:23:17 cgd Exp $ */ /* * Implementation of SVID semaphores @@ -15,8 +15,9 @@ #include #include -static int semctl(), semget(), semop(), semconfig(); -int (*semcalls[])() = { semctl, semget, semop, semconfig }; +#include +#include + int semtot = 0; static struct proc *semlock_holder = NULL; @@ -43,29 +44,6 @@ seminit() semu_list = NULL; } -/* - * Entry point for all SEM calls - */ - -struct semsys_args { - u_int which; -}; - -int -semsys(p, uap, retval) - struct proc *p; - struct semsys_args *uap; - int *retval; -{ - - while (semlock_holder != NULL && semlock_holder != p) - sleep((caddr_t)&semlock_holder, (PZERO - 4)); - - if (uap->which >= sizeof(semcalls)/sizeof(semcalls[0])) - return (EINVAL); - return ((*semcalls[uap->which])(p, &uap[1], retval)); -} - /* * Lock or unlock the entire semaphore facility. * @@ -81,19 +59,17 @@ semsys(p, uap, retval) * in /dev/kmem. */ -struct semconfig_args { - semconfig_ctl_t flag; -}; - int semconfig(p, uap, retval) struct proc *p; - struct semconfig_args *uap; - int *retval; + struct semconfig_args /* { + syscallarg(int) flag; + } */ *uap; + register_t *retval; { int eval = 0; - switch (uap->flag) { + switch (SCARG(uap, flag)) { case SEM_CONFIG_FREEZE: semlock_holder = p; break; @@ -104,8 +80,9 @@ semconfig(p, uap, retval) break; default: - printf("semconfig: unknown flag parameter value (%d) - ignored\n", - uap->flag); + printf( + "semconfig: unknown flag parameter value (%d) - ignored\n", + SCARG(uap, flag)); eval = EINVAL; break; } @@ -283,23 +260,21 @@ semundo_clear(semid, semnum) } } -struct semctl_args { - int semid; - int semnum; - int cmd; - union semun *arg; -}; - int -semctl(p, uap, retval) +__semctl(p, uap, retval) struct proc *p; - register struct semctl_args *uap; - int *retval; + register struct __semctl_args /* { + syscallarg(int) semid; + syscallarg(int) semnum; + syscallarg(int) cmd; + syscallarg(union semun *) arg; + } */ *uap; + register_t *retval; { - int semid = uap->semid; - int semnum = uap->semnum; - int cmd = uap->cmd; - union semun *arg = uap->arg; + int semid = SCARG(uap, semid); + int semnum = SCARG(uap, semnum); + int cmd = SCARG(uap, cmd); + union semun *arg = SCARG(uap, arg); union semun real_arg; struct ucred *cred = p->p_ucred; int i, rval, eval; @@ -316,7 +291,7 @@ semctl(p, uap, retval) semaptr = &sema[semid]; if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0 || - semaptr->sem_perm.seq != IPCID_TO_SEQ(uap->semid)) + semaptr->sem_perm.seq != IPCID_TO_SEQ(SCARG(uap, semid))) return(EINVAL); eval = 0; @@ -447,22 +422,20 @@ semctl(p, uap, retval) return(eval); } -struct semget_args { - key_t key; - int nsems; - int semflg; -}; - int semget(p, uap, retval) struct proc *p; - register struct semget_args *uap; - int *retval; + register struct semget_args /* { + syscallarg(key_t) key; + syscallarg(int) nsems; + syscallarg(int) semflg; + } */ *uap; + register_t *retval; { int semid, eval; - int key = uap->key; - int nsems = uap->nsems; - int semflg = uap->semflg; + int key = SCARG(uap, key); + int nsems = SCARG(uap, nsems); + int semflg = SCARG(uap, semflg); struct ucred *cred = p->p_ucred; #ifdef SEM_DEBUG @@ -560,20 +533,18 @@ found: return(0); } -struct semop_args { - int semid; - struct sembuf *sops; - int nsops; -}; - int semop(p, uap, retval) struct proc *p; - register struct semop_args *uap; - int *retval; + register struct semop_args /* { + syscallarg(int) semid; + syscallarg(struct sembuf *) sops; + syscallarg(u_int) nsops; + } */ *uap; + register_t *retval; { - int semid = uap->semid; - int nsops = uap->nsops; + int semid = SCARG(uap, semid); + int nsops = SCARG(uap, nsops); struct sembuf sops[MAX_SOPS]; register struct semid_ds *semaptr; register struct sembuf *sopptr; @@ -595,7 +566,7 @@ semop(p, uap, retval) semaptr = &sema[semid]; if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0) return(EINVAL); - if (semaptr->sem_perm.seq != IPCID_TO_SEQ(uap->semid)) + if (semaptr->sem_perm.seq != IPCID_TO_SEQ(SCARG(uap, semid))) return(EINVAL); if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_W))) { @@ -612,10 +583,11 @@ semop(p, uap, retval) return(E2BIG); } - if ((eval = copyin(uap->sops, &sops, nsops * sizeof(sops[0]))) != 0) { + if ((eval = copyin(SCARG(uap, sops), sops, nsops * sizeof(sops[0]))) + != 0) { #ifdef SEM_DEBUG printf("eval = %d from copyin(%08x, %08x, %d)\n", eval, - uap->sops, &sops, nsops * sizeof(sops[0])); + SCARG(uap, sops), &sops, nsops * sizeof(sops[0])); #endif return(eval); } @@ -728,7 +700,7 @@ semop(p, uap, retval) * Make sure that the semaphore still exists */ if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0 || - semaptr->sem_perm.seq != IPCID_TO_SEQ(uap->semid)) { + semaptr->sem_perm.seq != IPCID_TO_SEQ(SCARG(uap, semid))) { /* The man page says to return EIDRM. */ /* Unfortunately, BSD doesn't define that code! */ #ifdef EIDRM @@ -937,3 +909,69 @@ unlock: wakeup((caddr_t)&semlock_holder); } } + +#if defined(COMPAT_10) && !defined(alpha) +int +compat_10_semsys(p, uap, retval) + struct proc *p; + struct compat_10_semsys_args /* { + syscallarg(int) which; + syscallarg(int) a2; + syscallarg(int) a3; + syscallarg(int) a4; + syscallarg(int) a5; + } */ *uap; + register_t *retval; +{ + struct __semctl_args /* { + syscallarg(int) semid; + syscallarg(int) semnum; + syscallarg(int) cmd; + syscallarg(union semun *) arg; + } */ __semctl_args; + struct semget_args /* { + syscallarg(key_t) key; + syscallarg(int) nsems; + syscallarg(int) semflg; + } */ semget_args; + struct semop_args /* { + syscallarg(int) semid; + syscallarg(struct sembuf *) sops; + syscallarg(u_int) nsops; + } */ semop_args; + struct semconfig_args /* { + syscallarg(int) flag; + } */ semconfig_args; + + while (semlock_holder != NULL && semlock_holder != p) + sleep((caddr_t)&semlock_holder, (PZERO - 4)); + + switch (SCARG(uap, which)) { + case 0: /* __semctl() */ + SCARG(&__semctl_args, semid) = SCARG(uap, a2); + SCARG(&__semctl_args, semnum) = SCARG(uap, a3); + SCARG(&__semctl_args, cmd) = SCARG(uap, a4); + SCARG(&__semctl_args, arg) = (union semun *)SCARG(uap, a5); + return (__semctl(p, &__semctl_args, retval)); + + case 1: /* semget() */ + SCARG(&semget_args, key) = SCARG(uap, a2); + SCARG(&semget_args, nsems) = SCARG(uap, a3); + SCARG(&semget_args, semflg) = SCARG(uap, a4); + return (semget(p, &semget_args, retval)); + + case 2: /* semop() */ + SCARG(&semop_args, semid) = SCARG(uap, a2); + SCARG(&semop_args, sops) = (struct sembuf *)SCARG(uap, a3); + SCARG(&semop_args, nsops) = SCARG(uap, a4); + return (semop(p, &semop_args, retval)); + + case 3: /* semconfig() */ + SCARG(&semconfig_args, flag) = SCARG(uap, a2); + return (semconfig(p, &semconfig_args, retval)); + + default: + return (EINVAL); + } +} +#endif /* defined(COMPAT_10) && !defined(alpha) */ diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 8e7df78c1f2f..2d5ffd172d6c 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $NetBSD: sysv_shm.c,v 1.25 1994/08/31 21:47:36 mycroft Exp $ */ +/* $NetBSD: sysv_shm.c,v 1.26 1994/10/20 04:23:19 cgd Exp $ */ /* * Copyright (c) 1994 Adam Glass and Charles Hannum. All rights reserved. @@ -42,6 +42,9 @@ #include #include +#include +#include + #include #include #include @@ -60,9 +63,6 @@ * per proc array of 'struct shmmap_state' */ -int shmat(), shmctl(), shmdt(), shmget(); -int (*shmcalls[])() = { shmat, shmctl, shmdt, shmget }; - #define SHMSEG_FREE 0x0200 #define SHMSEG_REMOVED 0x0400 #define SHMSEG_ALLOCATED 0x0800 @@ -158,14 +158,13 @@ shm_delete_mapping(p, shmmap_s) return 0; } -struct shmdt_args { - void *shmaddr; -}; int shmdt(p, uap, retval) struct proc *p; - struct shmdt_args *uap; - int *retval; + struct shmdt_args /* { + syscallarg(void *) shmaddr; + } */ *uap; + register_t *retval; { struct shmmap_state *shmmap_s; int i; @@ -173,23 +172,22 @@ shmdt(p, uap, retval) shmmap_s = (struct shmmap_state *)p->p_vmspace->vm_shm; for (i = 0; i < shminfo.shmseg; i++, shmmap_s++) if (shmmap_s->shmid != -1 && - shmmap_s->va == (vm_offset_t)uap->shmaddr) + shmmap_s->va == (vm_offset_t)SCARG(uap, shmaddr)) break; if (i == shminfo.shmseg) return EINVAL; return shm_delete_mapping(p, shmmap_s); } -struct shmat_args { - int shmid; - void *shmaddr; - int shmflg; -}; int shmat(p, uap, retval) struct proc *p; - struct shmat_args *uap; - int *retval; + struct shmat_args /* { + syscallarg(int) shmid; + syscallarg(void *) shmaddr; + syscallarg(int) shmflag; + } */ *uap; + register_t *retval; { int error, i, flags; struct ucred *cred = p->p_ucred; @@ -207,11 +205,11 @@ shmat(p, uap, retval) shmmap_s[i].shmid = -1; p->p_vmspace->vm_shm = (caddr_t)shmmap_s; } - shmseg = shm_find_segment_by_shmid(uap->shmid); + shmseg = shm_find_segment_by_shmid(SCARG(uap, shmid)); if (shmseg == NULL) return EINVAL; if (error = ipcperm(cred, &shmseg->shm_perm, - (uap->shmflg & SHM_RDONLY) ? IPC_R : IPC_R|IPC_W)) + (SCARG(uap, shmflg) & SHM_RDONLY) ? IPC_R : IPC_R|IPC_W)) return error; for (i = 0; i < shminfo.shmseg; i++) { if (shmmap_s->shmid == -1) @@ -222,15 +220,16 @@ shmat(p, uap, retval) return EMFILE; size = (shmseg->shm_segsz + CLOFSET) & ~CLOFSET; prot = VM_PROT_READ; - if ((uap->shmflg & SHM_RDONLY) == 0) + if ((SCARG(uap, shmflg) & SHM_RDONLY) == 0) prot |= VM_PROT_WRITE; flags = MAP_ANON | MAP_SHARED; - if (uap->shmaddr) { + if (SCARG(uap, shmaddr)) { flags |= MAP_FIXED; - if (uap->shmflg & SHM_RND) - attach_va = (vm_offset_t)uap->shmaddr & ~(SHMLBA-1); - else if (((vm_offset_t)uap->shmaddr & (SHMLBA-1)) == 0) - attach_va = (vm_offset_t)uap->shmaddr; + if (SCARG(uap, shmflg) & SHM_RND) + attach_va = + (vm_offset_t)SCARG(uap, shmaddr) & ~(SHMLBA-1); + else if (((vm_offset_t)SCARG(uap, shmaddr) & (SHMLBA-1)) == 0) + attach_va = (vm_offset_t)SCARG(uap, shmaddr); else return EINVAL; } else { @@ -238,11 +237,11 @@ shmat(p, uap, retval) attach_va = round_page(p->p_vmspace->vm_daddr + MAXDSIZ); } error = vm_mmap(&p->p_vmspace->vm_map, &attach_va, size, prot, - VM_PROT_DEFAULT, flags, (caddr_t) uap->shmid, 0); + VM_PROT_DEFAULT, flags, (caddr_t)(long)SCARG(uap, shmid), 0); if (error) return error; shmmap_s->va = attach_va; - shmmap_s->shmid = uap->shmid; + shmmap_s->shmid = SCARG(uap, shmid); shmseg->shm_lpid = p->p_pid; shmseg->shm_atime = time.tv_sec; shmseg->shm_nattch++; @@ -250,36 +249,37 @@ shmat(p, uap, retval) return 0; } -struct shmctl_args { - int shmid; - int cmd; - struct shmat_ds *ubuf; -}; int shmctl(p, uap, retval) struct proc *p; - struct shmctl_args *uap; - int *retval; + struct shmctl_args /* { + syscallarg(int) shmid; + syscallarg(int) cmd; + syscallarg(struct shmid_ds *) buf; + } */ *uap; + register_t *retval; { int error, segnum; struct ucred *cred = p->p_ucred; struct shmid_ds inbuf; struct shmid_ds *shmseg; - shmseg = shm_find_segment_by_shmid(uap->shmid); + shmseg = shm_find_segment_by_shmid(SCARG(uap, shmid)); if (shmseg == NULL) return EINVAL; - switch (uap->cmd) { + switch (SCARG(uap, cmd)) { case IPC_STAT: if (error = ipcperm(cred, &shmseg->shm_perm, IPC_R)) return error; - if (error = copyout((caddr_t)shmseg, uap->ubuf, sizeof(inbuf))) + if (error = copyout((caddr_t)shmseg, SCARG(uap, buf), + sizeof(inbuf))) return error; break; case IPC_SET: if (error = ipcperm(cred, &shmseg->shm_perm, IPC_M)) return error; - if (error = copyin(uap->ubuf, (caddr_t)&inbuf, sizeof(inbuf))) + if (error = copyin(SCARG(uap, buf), (caddr_t)&inbuf, + sizeof(inbuf))) return error; shmseg->shm_perm.uid = inbuf.shm_perm.uid; shmseg->shm_perm.gid = inbuf.shm_perm.gid; @@ -295,7 +295,7 @@ shmctl(p, uap, retval) shmseg->shm_perm.mode |= SHMSEG_REMOVED; if (shmseg->shm_nattch <= 0) { shm_deallocate_segment(shmseg); - shm_last_free = IPCID_TO_IX(uap->shmid); + shm_last_free = IPCID_TO_IX(SCARG(uap, shmid)); } break; #if 0 @@ -308,18 +308,17 @@ shmctl(p, uap, retval) return 0; } -struct shmget_args { - key_t key; - size_t size; - int shmflg; -}; static int shmget_existing(p, uap, mode, segnum, retval) struct proc *p; - struct shmget_args *uap; + struct shmget_args /* { + syscallarg(key_t) key; + syscallarg(int) size; + syscallarg(int) shmflag; + } */ *uap; int mode; int segnum; - int *retval; + register_t *retval; { struct shmid_ds *shmseg; struct ucred *cred = p->p_ucred; @@ -340,9 +339,10 @@ shmget_existing(p, uap, mode, segnum, retval) } if (error = ipcperm(cred, &shmseg->shm_perm, mode)) return error; - if (uap->size && uap->size > shmseg->shm_segsz) + if (SCARG(uap, size) && SCARG(uap, size) > shmseg->shm_segsz) return EINVAL; - if (uap->shmflg & (IPC_CREAT | IPC_EXCL) == (IPC_CREAT | IPC_EXCL)) + if (SCARG(uap, shmflg) & (IPC_CREAT | IPC_EXCL) == + (IPC_CREAT | IPC_EXCL)) return EEXIST; *retval = IXSEQ_TO_IPCID(segnum, shmseg->shm_perm); return 0; @@ -351,20 +351,25 @@ shmget_existing(p, uap, mode, segnum, retval) static int shmget_allocate_segment(p, uap, mode, retval) struct proc *p; - struct shmget_args *uap; + struct shmget_args /* { + syscallarg(key_t) key; + syscallarg(int) size; + syscallarg(int) shmflag; + } */ *uap; int mode; - int *retval; + register_t *retval; { int i, segnum, result, shmid, size; struct ucred *cred = p->p_ucred; struct shmid_ds *shmseg; struct shm_handle *shm_handle; - if (uap->size < shminfo.shmmin || uap->size > shminfo.shmmax) + if (SCARG(uap, size) < shminfo.shmmin || + SCARG(uap, size) > shminfo.shmmax) return EINVAL; if (shm_nused >= shminfo.shmmni) /* any shmids left? */ return ENOSPC; - size = (uap->size + CLOFSET) & ~CLOFSET; + size = (SCARG(uap, size) + CLOFSET) & ~CLOFSET; if (shm_committed + btoc(size) > shminfo.shmall) return ENOMEM; if (shm_last_free < 0) { @@ -384,13 +389,13 @@ shmget_allocate_segment(p, uap, mode, retval) * so that noone else tries to create the same key. */ shmseg->shm_perm.mode = SHMSEG_ALLOCATED | SHMSEG_REMOVED; - shmseg->shm_perm.key = uap->key; + shmseg->shm_perm.key = SCARG(uap, key); shmseg->shm_perm.seq = (shmseg->shm_perm.seq + 1) & 0x7fff; shm_handle = (struct shm_handle *) malloc(sizeof(struct shm_handle), M_SHM, M_WAITOK); shmid = IXSEQ_TO_IPCID(segnum, shmseg->shm_perm); result = vm_mmap(sysvshm_map, &shm_handle->kva, size, VM_PROT_ALL, - VM_PROT_DEFAULT, MAP_ANON, (caddr_t) shmid, 0); + VM_PROT_DEFAULT, MAP_ANON, (caddr_t)(long)shmid, 0); if (result != KERN_SUCCESS) { shmseg->shm_perm.mode = SHMSEG_FREE; shm_last_free = segnum; @@ -404,7 +409,7 @@ shmget_allocate_segment(p, uap, mode, retval) shmseg->shm_perm.cgid = shmseg->shm_perm.gid = cred->cr_gid; shmseg->shm_perm.mode = (shmseg->shm_perm.mode & SHMSEG_WANTED) | (mode & ACCESSPERMS) | SHMSEG_ALLOCATED; - shmseg->shm_segsz = uap->size; + shmseg->shm_segsz = SCARG(uap, size); shmseg->shm_cpid = p->p_pid; shmseg->shm_lpid = shmseg->shm_nattch = 0; shmseg->shm_atime = shmseg->shm_dtime = 0; @@ -426,43 +431,32 @@ shmget_allocate_segment(p, uap, mode, retval) int shmget(p, uap, retval) struct proc *p; - struct shmget_args *uap; - int *retval; + struct shmget_args /* { + syscallarg(key_t) key; + syscallarg(int) size; + syscallarg(int) shmflag; + } */ *uap; + register_t *retval; { int segnum, mode, error; struct shmid_ds *shmseg; - mode = uap->shmflg & ACCESSPERMS; - if (uap->key != IPC_PRIVATE) { + mode = SCARG(uap, shmflg) & ACCESSPERMS; + if (SCARG(uap, key) != IPC_PRIVATE) { again: - segnum = shm_find_segment_by_key(uap->key); + segnum = shm_find_segment_by_key(SCARG(uap, key)); if (segnum >= 0) { error = shmget_existing(p, uap, mode, segnum, retval); if (error == EAGAIN) goto again; return error; } - if ((uap->shmflg & IPC_CREAT) == 0) + if ((SCARG(uap, shmflg) & IPC_CREAT) == 0) return ENOENT; } return shmget_allocate_segment(p, uap, mode, retval); } -struct shmsys_args { - u_int which; -}; -int -shmsys(p, uap, retval) - struct proc *p; - struct shmsys_args *uap; - int *retval; -{ - - if (uap->which >= sizeof(shmcalls)/sizeof(shmcalls[0])) - return EINVAL; - return ((*shmcalls[uap->which])(p, &uap[1], retval)); -} - void shmfork(p1, p2, isvfork) struct proc *p1, *p2; @@ -516,3 +510,63 @@ shminit() shm_nused = 0; shm_committed = 0; } + +#if defined(COMPAT_10) && !defined(alpha) +int +compat_10_shmsys(p, uap, retval) + struct proc *p; + struct compat_10_shmsys_args /* { + syscallarg(int) which; + syscallarg(int) a2; + syscallarg(int) a3; + syscallarg(int) a4; + } */ *uap; + register_t *retval; +{ + struct shmat_args /* { + syscallarg(int) shmid; + syscallarg(void *) shmaddr; + syscallarg(int) shmflg; + } */ shmat_args; + struct shmctl_args /* { + syscallarg(int) shmid; + syscallarg(int) cmd; + syscallarg(struct shmid_ds *) buf; + } */ shmctl_args; + struct shmdt_args /* { + syscallarg(void *) shmaddr; + } */ shmdt_args; + struct shmget_args /* { + syscallarg(key_t) key; + syscallarg(int) size; + syscallarg(int) shmflg; + } */ shmget_args; + + switch (SCARG(uap, which)) { + case 0: /* shmat() */ + SCARG(&shmat_args, shmid) = SCARG(uap, a2); + SCARG(&shmat_args, shmaddr) = (void *)SCARG(uap, a3); + SCARG(&shmat_args, shmflg) = SCARG(uap, a4); + return (shmat(p, &shmat_args, retval)); + + case 1: /* shmctl() */ + SCARG(&shmctl_args, shmid) = SCARG(uap, a2); + SCARG(&shmctl_args, cmd) = SCARG(uap, a3); + SCARG(&shmctl_args, buf) = (struct shmid_ds *)SCARG(uap, a4); + return (shmctl(p, &shmctl_args, retval)); + + case 2: /* shmdt() */ + SCARG(&shmat_args, shmaddr) = (void *)SCARG(uap, a2); + return (shmdt(p, &shmdt_args, retval)); + + case 3: /* shmget() */ + SCARG(&shmget_args, key) = SCARG(uap, a2); + SCARG(&shmget_args, size) = SCARG(uap, a3); + SCARG(&shmget_args, shmflg) = SCARG(uap, a4); + return (shmget(p, &shmget_args, retval)); + + default: + return (EINVAL); + } +} +#endif /* defined(COMPAT_10) && !defined(alpha) */ diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index be7bd9386e83..000ccc15f010 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_syscalls.c,v 1.8 1994/06/29 06:33:41 cgd Exp $ */ +/* $NetBSD: uipc_syscalls.c,v 1.9 1994/10/20 04:23:21 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1990, 1993 @@ -36,6 +36,7 @@ */ #include +#include #include #include #include @@ -49,6 +50,9 @@ #include #endif +#include +#include + /* * System call interface to the socket abstraction. */ @@ -58,17 +62,15 @@ extern struct fileops socketops; -struct socket_args { - int domain; - int type; - int protocol; -}; - int socket(p, uap, retval) struct proc *p; - register struct socket_args *uap; - int *retval; + register struct socket_args /* { + syscallarg(int) domain; + syscallarg(int) type; + syscallarg(int) protocol; + } */ *uap; + register_t *retval; { struct filedesc *fdp = p->p_fd; struct socket *so; @@ -80,7 +82,8 @@ socket(p, uap, retval) fp->f_flag = FREAD|FWRITE; fp->f_type = DTYPE_SOCKET; fp->f_ops = &socketops; - if (error = socreate(uap->domain, &so, uap->type, uap->protocol)) { + if (error = socreate(SCARG(uap, domain), &so, SCARG(uap, type), + SCARG(uap, protocol))) { fdp->fd_ofiles[fd] = 0; ffree(fp); } else { @@ -90,82 +93,76 @@ socket(p, uap, retval) return (error); } -struct bind_args { - int s; - caddr_t name; - int namelen; -}; - /* ARGSUSED */ int bind(p, uap, retval) struct proc *p; - register struct bind_args *uap; - int *retval; + register struct bind_args /* { + syscallarg(int) s; + syscallarg(caddr_t) name; + syscallarg(int) namelen; + } */ *uap; + register_t *retval; { struct file *fp; struct mbuf *nam; int error; - if (error = getsock(p->p_fd, uap->s, &fp)) + if (error = getsock(p->p_fd, SCARG(uap, s), &fp)) return (error); - if (error = sockargs(&nam, uap->name, uap->namelen, MT_SONAME)) + if (error = sockargs(&nam, SCARG(uap, name), SCARG(uap, namelen), + MT_SONAME)) return (error); error = sobind((struct socket *)fp->f_data, nam); m_freem(nam); return (error); } -struct listen_args { - int s; - int backlog; -}; - /* ARGSUSED */ int listen(p, uap, retval) struct proc *p; - register struct listen_args *uap; - int *retval; + register struct listen_args /* { + syscallarg(int) s; + syscallarg(int) backlog; + } */ *uap; + register_t *retval; { struct file *fp; int error; - if (error = getsock(p->p_fd, uap->s, &fp)) + if (error = getsock(p->p_fd, SCARG(uap, s), &fp)) return (error); - return (solisten((struct socket *)fp->f_data, uap->backlog)); + return (solisten((struct socket *)fp->f_data, SCARG(uap, backlog))); } -struct accept_args { - int s; - caddr_t name; - int *anamelen; -#ifdef COMPAT_OLDSOCK - int compat_43; /* pseudo */ -#endif -}; - #ifdef COMPAT_OLDSOCK int accept(p, uap, retval) struct proc *p; - struct accept_args *uap; - int *retval; + struct accept_args /* { + syscallarg(int) s; + syscallarg(caddr_t) name; + syscallarg(int *) anamelen; + } */ *uap; + register_t *retval; { - uap->compat_43 = 0; - return (accept1(p, uap, retval)); + return (accept1(p, uap, retval, 0)); } int -oaccept(p, uap, retval) +compat_43_accept(p, uap, retval) struct proc *p; - struct accept_args *uap; - int *retval; + struct accept_args /* { + syscallarg(int) s; + syscallarg(caddr_t) name; + syscallarg(int *) anamelen; + } */ *uap; + register_t *retval; { - uap->compat_43 = 1; - return (accept1(p, uap, retval)); + return (accept1(p, uap, retval, 1)); } #else /* COMPAT_OLDSOCK */ @@ -173,20 +170,25 @@ oaccept(p, uap, retval) #endif int -accept1(p, uap, retval) +accept1(p, uap, retval, compat_43) struct proc *p; - register struct accept_args *uap; - int *retval; + register struct accept_args /* { + syscallarg(int) s; + syscallarg(caddr_t) name; + syscallarg(int *) anamelen; + } */ *uap; + register_t *retval; + int compat_43; { struct file *fp; struct mbuf *nam; - int namelen, error, s; + int namelen, error, s, tmpfd; register struct socket *so; - if (uap->name && (error = copyin((caddr_t)uap->anamelen, + if (SCARG(uap, name) && (error = copyin((caddr_t)SCARG(uap, anamelen), (caddr_t)&namelen, sizeof (namelen)))) return (error); - if (error = getsock(p->p_fd, uap->s, &fp)) + if (error = getsock(p->p_fd, SCARG(uap, s), &fp)) return (error); s = splnet(); so = (struct socket *)fp->f_data; @@ -215,10 +217,11 @@ accept1(p, uap, retval) splx(s); return (error); } - if (error = falloc(p, &fp, retval)) { + if (error = falloc(p, &fp, &tmpfd)) { splx(s); return (error); } + *retval = tmpfd; { struct socket *aso = so->so_q; if (soqremque(aso, 1) == 0) panic("accept"); @@ -230,49 +233,49 @@ accept1(p, uap, retval) fp->f_data = (caddr_t)so; nam = m_get(M_WAIT, MT_SONAME); (void) soaccept(so, nam); - if (uap->name) { + if (SCARG(uap, name)) { #ifdef COMPAT_OLDSOCK - if (uap->compat_43) + if (compat_43) mtod(nam, struct osockaddr *)->sa_family = mtod(nam, struct sockaddr *)->sa_family; #endif if (namelen > nam->m_len) namelen = nam->m_len; /* SHOULD COPY OUT A CHAIN HERE */ - if ((error = copyout(mtod(nam, caddr_t), (caddr_t)uap->name, - (u_int)namelen)) == 0) + if ((error = copyout(mtod(nam, caddr_t), + (caddr_t)SCARG(uap, name), (u_int)namelen)) == 0) error = copyout((caddr_t)&namelen, - (caddr_t)uap->anamelen, sizeof (*uap->anamelen)); + (caddr_t)SCARG(uap, anamelen), + sizeof (*SCARG(uap, anamelen))); } m_freem(nam); splx(s); return (error); } -struct connect_args { - int s; - caddr_t name; - int namelen; -}; - /* ARGSUSED */ int connect(p, uap, retval) struct proc *p; - register struct connect_args *uap; - int *retval; + register struct connect_args /* { + syscallarg(int) s; + syscallarg(caddr_t) name; + syscallarg(int) namelen; + } */ *uap; + register_t *retval; { struct file *fp; register struct socket *so; struct mbuf *nam; int error, s; - if (error = getsock(p->p_fd, uap->s, &fp)) + if (error = getsock(p->p_fd, SCARG(uap, s), &fp)) return (error); so = (struct socket *)fp->f_data; if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) return (EALREADY); - if (error = sockargs(&nam, uap->name, uap->namelen, MT_SONAME)) + if (error = sockargs(&nam, SCARG(uap, name), SCARG(uap, namelen), + MT_SONAME)) return (error); error = soconnect(so, nam); if (error) @@ -299,27 +302,27 @@ bad: return (error); } -struct socketpair_args { - int domain; - int type; - int protocol; - int *rsv; -}; - int socketpair(p, uap, retval) struct proc *p; - register struct socketpair_args *uap; - int retval[]; + register struct socketpair_args /* { + syscallarg(int) domain; + syscallarg(int) type; + syscallarg(int) protocol; + syscallarg(int *) rsv; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; struct file *fp1, *fp2; struct socket *so1, *so2; int fd, error, sv[2]; - if (error = socreate(uap->domain, &so1, uap->type, uap->protocol)) + if (error = socreate(SCARG(uap, domain), &so1, SCARG(uap, type), + SCARG(uap, protocol))) return (error); - if (error = socreate(uap->domain, &so2, uap->type, uap->protocol)) + if (error = socreate(SCARG(uap, domain), &so2, SCARG(uap, type), + SCARG(uap, protocol))) goto free1; if (error = falloc(p, &fp1, &fd)) goto free2; @@ -337,14 +340,15 @@ socketpair(p, uap, retval) sv[1] = fd; if (error = soconnect2(so1, so2)) goto free4; - if (uap->type == SOCK_DGRAM) { + if (SCARG(uap, type) == SOCK_DGRAM) { /* * Datagram socket connection is asymmetric. */ if (error = soconnect2(so2, so1)) goto free4; } - error = copyout((caddr_t)sv, (caddr_t)uap->rsv, 2 * sizeof (int)); + error = copyout((caddr_t)sv, (caddr_t)SCARG(uap, rsv), + 2 * sizeof (int)); retval[0] = sv[0]; /* XXX ??? */ retval[1] = sv[1]; /* XXX ??? */ return (error); @@ -361,50 +365,46 @@ free1: return (error); } -struct sendto_args { - int s; - caddr_t buf; - size_t len; - int flags; - caddr_t to; - int tolen; -}; - int sendto(p, uap, retval) struct proc *p; - register struct sendto_args *uap; - int *retval; + register struct sendto_args /* { + syscallarg(int) s; + syscallarg(caddr_t) buf; + syscallarg(size_t) len; + syscallarg(int) flags; + syscallarg(caddr_t) to; + syscallarg(int) tolen; + } */ *uap; + register_t *retval; { struct msghdr msg; struct iovec aiov; - msg.msg_name = uap->to; - msg.msg_namelen = uap->tolen; + msg.msg_name = SCARG(uap, to); + msg.msg_namelen = SCARG(uap, tolen); msg.msg_iov = &aiov; msg.msg_iovlen = 1; msg.msg_control = 0; #ifdef COMPAT_OLDSOCK msg.msg_flags = 0; #endif - aiov.iov_base = uap->buf; - aiov.iov_len = uap->len; - return (sendit(p, uap->s, &msg, uap->flags, retval)); + aiov.iov_base = SCARG(uap, buf); + aiov.iov_len = SCARG(uap, len); + return (sendit(p, SCARG(uap, s), &msg, SCARG(uap, flags), retval)); } #ifdef COMPAT_OLDSOCK -struct osend_args { - int s; - caddr_t buf; - int len; - int flags; -}; - int -osend(p, uap, retval) +compat_43_send(p, uap, retval) struct proc *p; - register struct osend_args *uap; - int *retval; + register struct compat_43_send_args /* { + syscallarg(int) s; + syscallarg(caddr_t) buf; + syscallarg(int) len; + syscallarg(int) flags; + } */ *uap; + register_t *retval; { struct msghdr msg; struct iovec aiov; @@ -413,31 +413,30 @@ osend(p, uap, retval) msg.msg_namelen = 0; msg.msg_iov = &aiov; msg.msg_iovlen = 1; - aiov.iov_base = uap->buf; - aiov.iov_len = uap->len; + aiov.iov_base = SCARG(uap, buf); + aiov.iov_len = SCARG(uap, len); msg.msg_control = 0; msg.msg_flags = 0; - return (sendit(p, uap->s, &msg, uap->flags, retval)); + return (sendit(p, SCARG(uap, s), &msg, SCARG(uap, flags), retval)); } #define MSG_COMPAT 0x8000 -struct osendmsg_args { - int s; - caddr_t msg; - int flags; -}; - int -osendmsg(p, uap, retval) +compat_43_sendmsg(p, uap, retval) struct proc *p; - register struct osendmsg_args *uap; - int *retval; + register struct compat_43_sendmsg_args /* { + syscallarg(int) s; + syscallarg(caddr_t) msg; + syscallarg(int) flags; + } */ *uap; + register_t *retval; { struct msghdr msg; struct iovec aiov[UIO_SMALLIOV], *iov; int error; - if (error = copyin(uap->msg, (caddr_t)&msg, sizeof (struct omsghdr))) + if (error = copyin(SCARG(uap, msg), (caddr_t)&msg, + sizeof (struct omsghdr))) return (error); if ((u_int)msg.msg_iovlen >= UIO_SMALLIOV) { if ((u_int)msg.msg_iovlen >= UIO_MAXIOV) @@ -452,7 +451,7 @@ osendmsg(p, uap, retval) goto done; msg.msg_flags = MSG_COMPAT; msg.msg_iov = iov; - error = sendit(p, uap->s, &msg, uap->flags, retval); + error = sendit(p, SCARG(uap, s), &msg, SCARG(uap, flags), retval); done: if (iov != aiov) FREE(iov, M_IOV); @@ -460,23 +459,21 @@ done: } #endif -struct sendmsg_args { - int s; - caddr_t msg; - int flags; -}; - int sendmsg(p, uap, retval) struct proc *p; - register struct sendmsg_args *uap; - int *retval; + register struct sendmsg_args /* { + syscallarg(int) s; + syscallarg(caddr_t) msg; + syscallarg(int) flags; + } */ *uap; + register_t *retval; { struct msghdr msg; struct iovec aiov[UIO_SMALLIOV], *iov; int error; - if (error = copyin(uap->msg, (caddr_t)&msg, sizeof (msg))) + if (error = copyin(SCARG(uap, msg), (caddr_t)&msg, sizeof (msg))) return (error); if ((u_int)msg.msg_iovlen >= UIO_SMALLIOV) { if ((u_int)msg.msg_iovlen >= UIO_MAXIOV) @@ -494,7 +491,7 @@ sendmsg(p, uap, retval) #ifdef COMPAT_OLDSOCK msg.msg_flags = 0; #endif - error = sendit(p, uap->s, &msg, uap->flags, retval); + error = sendit(p, SCARG(uap, s), &msg, SCARG(uap, flags), retval); done: if (iov != aiov) FREE(iov, M_IOV); @@ -506,7 +503,8 @@ sendit(p, s, mp, flags, retsize) register struct proc *p; int s; register struct msghdr *mp; - int flags, *retsize; + int flags; + register_t *retsize; { struct file *fp; struct uio auio; @@ -603,24 +601,22 @@ bad: return (error); } -struct recvfrom_args { - int s; - caddr_t buf; - size_t len; - int flags; - caddr_t from; - int *fromlenaddr; -}; - #ifdef COMPAT_OLDSOCK int -orecvfrom(p, uap, retval) +compat_43_recvfrom(p, uap, retval) struct proc *p; - struct recvfrom_args *uap; - int *retval; + struct recvfrom_args /* { + syscallarg(int) s; + syscallarg(caddr_t) buf; + syscallarg(size_t) len; + syscallarg(int) flags; + syscallarg(caddr_t) from; + syscallarg(int *) fromlenaddr; + } */ *uap; + register_t *retval; { - uap->flags |= MSG_COMPAT; + SCARG(uap, flags) |= MSG_COMPAT; return (recvfrom(p, uap, retval)); } #endif @@ -628,42 +624,48 @@ orecvfrom(p, uap, retval) int recvfrom(p, uap, retval) struct proc *p; - register struct recvfrom_args *uap; - int *retval; + register struct recvfrom_args /* { + syscallarg(int) s; + syscallarg(caddr_t) buf; + syscallarg(size_t) len; + syscallarg(int) flags; + syscallarg(caddr_t) from; + syscallarg(int *) fromlenaddr; + } */ *uap; + register_t *retval; { struct msghdr msg; struct iovec aiov; int error; - if (uap->fromlenaddr) { - if (error = copyin((caddr_t)uap->fromlenaddr, + if (SCARG(uap, fromlenaddr)) { + if (error = copyin((caddr_t)SCARG(uap, fromlenaddr), (caddr_t)&msg.msg_namelen, sizeof (msg.msg_namelen))) return (error); } else msg.msg_namelen = 0; - msg.msg_name = uap->from; + msg.msg_name = SCARG(uap, from); msg.msg_iov = &aiov; msg.msg_iovlen = 1; - aiov.iov_base = uap->buf; - aiov.iov_len = uap->len; + aiov.iov_base = SCARG(uap, buf); + aiov.iov_len = SCARG(uap, len); msg.msg_control = 0; - msg.msg_flags = uap->flags; - return (recvit(p, uap->s, &msg, (caddr_t)uap->fromlenaddr, retval)); + msg.msg_flags = SCARG(uap, flags); + return (recvit(p, SCARG(uap, s), &msg, + (caddr_t)SCARG(uap, fromlenaddr), retval)); } #ifdef COMPAT_OLDSOCK -struct orecv_args { - int s; - caddr_t buf; - int len; - int flags; -}; - int -orecv(p, uap, retval) +compat_43_recv(p, uap, retval) struct proc *p; - register struct orecv_args *uap; - int *retval; + register struct compat_43_recv_args /* { + syscallarg(int) s; + syscallarg(caddr_t) buf; + syscallarg(int) len; + syscallarg(int) flags; + } */ *uap; + register_t *retval; { struct msghdr msg; struct iovec aiov; @@ -672,11 +674,11 @@ orecv(p, uap, retval) msg.msg_namelen = 0; msg.msg_iov = &aiov; msg.msg_iovlen = 1; - aiov.iov_base = uap->buf; - aiov.iov_len = uap->len; + aiov.iov_base = SCARG(uap, buf); + aiov.iov_len = SCARG(uap, len); msg.msg_control = 0; - msg.msg_flags = uap->flags; - return (recvit(p, uap->s, &msg, (caddr_t)0, retval)); + msg.msg_flags = SCARG(uap, flags); + return (recvit(p, SCARG(uap, s), &msg, (caddr_t)0, retval)); } /* @@ -684,23 +686,21 @@ orecv(p, uap, retval) * overlays the new one, missing only the flags, and with the (old) access * rights where the control fields are now. */ -struct orecvmsg_args { - int s; - struct omsghdr *msg; - int flags; -}; - int -orecvmsg(p, uap, retval) +compat_43_recvmsg(p, uap, retval) struct proc *p; - register struct orecvmsg_args *uap; - int *retval; + register struct compat_43_recvmsg_args /* { + syscallarg(int) s; + syscallarg(struct omsghdr *) msg; + syscallarg(int) flags; + } */ *uap; + register_t *retval; { struct msghdr msg; struct iovec aiov[UIO_SMALLIOV], *iov; int error; - if (error = copyin((caddr_t)uap->msg, (caddr_t)&msg, + if (error = copyin((caddr_t)SCARG(uap, msg), (caddr_t)&msg, sizeof (struct omsghdr))) return (error); if ((u_int)msg.msg_iovlen >= UIO_SMALLIOV) { @@ -711,16 +711,17 @@ orecvmsg(p, uap, retval) M_WAITOK); } else iov = aiov; - msg.msg_flags = uap->flags | MSG_COMPAT; + msg.msg_flags = SCARG(uap, flags) | MSG_COMPAT; if (error = copyin((caddr_t)msg.msg_iov, (caddr_t)iov, (unsigned)(msg.msg_iovlen * sizeof (struct iovec)))) goto done; msg.msg_iov = iov; - error = recvit(p, uap->s, &msg, (caddr_t)&uap->msg->msg_namelen, retval); + error = recvit(p, SCARG(uap, s), &msg, + (caddr_t)&SCARG(uap, msg)->msg_namelen, retval); if (msg.msg_controllen && error == 0) error = copyout((caddr_t)&msg.msg_controllen, - (caddr_t)&uap->msg->msg_accrightslen, sizeof (int)); + (caddr_t)&SCARG(uap, msg)->msg_accrightslen, sizeof (int)); done: if (iov != aiov) FREE(iov, M_IOV); @@ -728,23 +729,22 @@ done: } #endif -struct recvmsg_args { - int s; - struct msghdr *msg; - int flags; -}; - int recvmsg(p, uap, retval) struct proc *p; - register struct recvmsg_args *uap; - int *retval; + register struct recvmsg_args /* { + syscallarg(int) s; + syscallarg(struct msghdr *) msg; + syscallarg(int) flags; + } */ *uap; + register_t *retval; { struct msghdr msg; struct iovec aiov[UIO_SMALLIOV], *uiov, *iov; register int error; - if (error = copyin((caddr_t)uap->msg, (caddr_t)&msg, sizeof (msg))) + if (error = copyin((caddr_t)SCARG(uap, msg), (caddr_t)&msg, + sizeof (msg))) return (error); if ((u_int)msg.msg_iovlen >= UIO_SMALLIOV) { if ((u_int)msg.msg_iovlen >= UIO_MAXIOV) @@ -755,18 +755,19 @@ recvmsg(p, uap, retval) } else iov = aiov; #ifdef COMPAT_OLDSOCK - msg.msg_flags = uap->flags &~ MSG_COMPAT; + msg.msg_flags = SCARG(uap, flags) &~ MSG_COMPAT; #else - msg.msg_flags = uap->flags; + msg.msg_flags = SCARG(uap, flags); #endif uiov = msg.msg_iov; msg.msg_iov = iov; if (error = copyin((caddr_t)uiov, (caddr_t)iov, (unsigned)(msg.msg_iovlen * sizeof (struct iovec)))) goto done; - if ((error = recvit(p, uap->s, &msg, (caddr_t)0, retval)) == 0) { + if ((error = recvit(p, SCARG(uap, s), &msg, (caddr_t)0, retval)) == 0) { msg.msg_iov = uiov; - error = copyout((caddr_t)&msg, (caddr_t)uap->msg, sizeof(msg)); + error = copyout((caddr_t)&msg, (caddr_t)SCARG(uap, msg), + sizeof(msg)); } done: if (iov != aiov) @@ -780,7 +781,7 @@ recvit(p, s, mp, namelenp, retsize) int s; register struct msghdr *mp; caddr_t namelenp; - int *retsize; + register_t *retsize; { struct file *fp; struct uio auio; @@ -905,99 +906,95 @@ out: return (error); } -struct shutdown_args { - int s; - int how; -}; - /* ARGSUSED */ int shutdown(p, uap, retval) struct proc *p; - register struct shutdown_args *uap; - int *retval; + register struct shutdown_args /* { + syscallarg(int) s; + syscallarg(int) how; + } */ *uap; + register_t *retval; { struct file *fp; int error; - if (error = getsock(p->p_fd, uap->s, &fp)) + if (error = getsock(p->p_fd, SCARG(uap, s), &fp)) return (error); - return (soshutdown((struct socket *)fp->f_data, uap->how)); + return (soshutdown((struct socket *)fp->f_data, SCARG(uap, how))); } -struct setsockopt_args { - int s; - int level; - int name; - caddr_t val; - int valsize; -}; - /* ARGSUSED */ int setsockopt(p, uap, retval) struct proc *p; - register struct setsockopt_args *uap; - int *retval; + register struct setsockopt_args /* { + syscallarg(int) s; + syscallarg(int) level; + syscallarg(int) name; + syscallarg(caddr_t) val; + syscallarg(int) valsize; + } */ *uap; + register_t *retval; { struct file *fp; struct mbuf *m = NULL; int error; - if (error = getsock(p->p_fd, uap->s, &fp)) + if (error = getsock(p->p_fd, SCARG(uap, s), &fp)) return (error); - if (uap->valsize > MLEN) + if (SCARG(uap, valsize) > MLEN) return (EINVAL); - if (uap->val) { + if (SCARG(uap, val)) { m = m_get(M_WAIT, MT_SOOPTS); if (m == NULL) return (ENOBUFS); - if (error = copyin(uap->val, mtod(m, caddr_t), - (u_int)uap->valsize)) { + if (error = copyin(SCARG(uap, val), mtod(m, caddr_t), + (u_int)SCARG(uap, valsize))) { (void) m_free(m); return (error); } - m->m_len = uap->valsize; + m->m_len = SCARG(uap, valsize); } - return (sosetopt((struct socket *)fp->f_data, uap->level, - uap->name, m)); + return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + SCARG(uap, name), m)); } -struct getsockopt_args { - int s; - int level; - int name; - caddr_t val; - int *avalsize; -}; - /* ARGSUSED */ int getsockopt(p, uap, retval) struct proc *p; - register struct getsockopt_args *uap; - int *retval; + register struct getsockopt_args /* { + syscallarg(int) s; + syscallarg(int) level; + syscallarg(int) name; + syscallarg(caddr_t) val; + syscallarg(int *) avalsize; + } */ *uap; + register_t *retval; { struct file *fp; struct mbuf *m = NULL; int valsize, error; - if (error = getsock(p->p_fd, uap->s, &fp)) + if (error = getsock(p->p_fd, SCARG(uap, s), &fp)) return (error); - if (uap->val) { - if (error = copyin((caddr_t)uap->avalsize, (caddr_t)&valsize, - sizeof (valsize))) + if (SCARG(uap, val)) { + if (error = copyin((caddr_t)SCARG(uap, avalsize), + (caddr_t)&valsize, sizeof (valsize))) return (error); } else valsize = 0; - if ((error = sogetopt((struct socket *)fp->f_data, uap->level, - uap->name, &m)) == 0 && uap->val && valsize && m != NULL) { + if ((error = sogetopt((struct socket *)fp->f_data, SCARG(uap, level), + SCARG(uap, name), &m)) == 0 && SCARG(uap, val) && valsize && + m != NULL) { if (valsize > m->m_len) valsize = m->m_len; - error = copyout(mtod(m, caddr_t), uap->val, (u_int)valsize); + error = copyout(mtod(m, caddr_t), SCARG(uap, val), + (u_int)valsize); if (error == 0) error = copyout((caddr_t)&valsize, - (caddr_t)uap->avalsize, sizeof (valsize)); + (caddr_t)SCARG(uap, avalsize), sizeof (valsize)); } if (m != NULL) (void) m_free(m); @@ -1009,7 +1006,7 @@ int pipe(p, uap, retval) struct proc *p; struct args *uap; - int retval[]; + register_t *retval; { register struct filedesc *fdp = p->p_fd; struct file *rf, *wf; @@ -1053,36 +1050,33 @@ free1: /* * Get socket name. */ -struct getsockname_args { - int fdes; - caddr_t asa; - int *alen; -#ifdef COMPAT_OLDSOCK - int compat_43; /* pseudo */ -#endif -}; - #ifdef COMPAT_OLDSOCK int getsockname(p, uap, retval) struct proc *p; - struct getsockname_args *uap; - int *retval; + struct getsockname_args /* { + syscallarg(int) fdes; + syscallarg(caddr_t) asa; + syscallarg(int *) alen; + } */ *uap; + register_t *retval; { - uap->compat_43 = 0; - return (getsockname1(p, uap, retval)); + return (getsockname1(p, uap, retval, 0)); } int -ogetsockname(p, uap, retval) +compat_43_getsockname(p, uap, retval) struct proc *p; - struct getsockname_args *uap; - int *retval; + struct getsockname_args /* { + syscallarg(int) fdes; + syscallarg(caddr_t) asa; + syscallarg(int *) alen; + } */ *uap; + register_t *retval; { - uap->compat_43 = 1; - return (getsockname1(p, uap, retval)); + return (getsockname1(p, uap, retval, 1)); } #else /* COMPAT_OLDSOCK */ @@ -1091,19 +1085,25 @@ ogetsockname(p, uap, retval) /* ARGSUSED */ int -getsockname1(p, uap, retval) +getsockname1(p, uap, retval, compat_43) struct proc *p; - register struct getsockname_args *uap; - int *retval; + register struct getsockname_args /* { + syscallarg(int) fdes; + syscallarg(caddr_t) asa; + syscallarg(int *) alen; + } */ *uap; + register_t *retval; + int compat_43; { struct file *fp; register struct socket *so; struct mbuf *m; int len, error; - if (error = getsock(p->p_fd, uap->fdes, &fp)) + if (error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) return (error); - if (error = copyin((caddr_t)uap->alen, (caddr_t)&len, sizeof (len))) + if (error = copyin((caddr_t)SCARG(uap, alen), (caddr_t)&len, + sizeof (len))) return (error); so = (struct socket *)fp->f_data; m = m_getclr(M_WAIT, MT_SONAME); @@ -1114,13 +1114,13 @@ getsockname1(p, uap, retval) if (len > m->m_len) len = m->m_len; #ifdef COMPAT_OLDSOCK - if (uap->compat_43) + if (compat_43) mtod(m, struct osockaddr *)->sa_family = mtod(m, struct sockaddr *)->sa_family; #endif - error = copyout(mtod(m, caddr_t), (caddr_t)uap->asa, (u_int)len); + error = copyout(mtod(m, caddr_t), (caddr_t)SCARG(uap, asa), (u_int)len); if (error == 0) - error = copyout((caddr_t)&len, (caddr_t)uap->alen, + error = copyout((caddr_t)&len, (caddr_t)SCARG(uap, alen), sizeof (len)); bad: m_freem(m); @@ -1130,36 +1130,33 @@ bad: /* * Get name of peer for connected socket. */ -struct getpeername_args { - int fdes; - caddr_t asa; - int *alen; -#ifdef COMPAT_OLDSOCK - int compat_43; /* pseudo */ -#endif -}; - #ifdef COMPAT_OLDSOCK int getpeername(p, uap, retval) struct proc *p; - struct getpeername_args *uap; - int *retval; + struct getpeername_args /* { + syscallarg(int) fdes; + syscallarg(caddr_t) asa; + syscallarg(int *) alen; + } */ *uap; + register_t *retval; { - uap->compat_43 = 0; - return (getpeername1(p, uap, retval)); + return (getpeername1(p, uap, retval, 0)); } int -ogetpeername(p, uap, retval) +compat_43_getpeername(p, uap, retval) struct proc *p; - struct getpeername_args *uap; - int *retval; + struct getpeername_args /* { + syscallarg(int) fdes; + syscallarg(caddr_t) asa; + syscallarg(int *) alen; + } */ *uap; + register_t *retval; { - uap->compat_43 = 1; - return (getpeername1(p, uap, retval)); + return (getpeername1(p, uap, retval, 1)); } #else /* COMPAT_OLDSOCK */ @@ -1168,22 +1165,28 @@ ogetpeername(p, uap, retval) /* ARGSUSED */ int -getpeername1(p, uap, retval) +getpeername1(p, uap, retval, compat_43) struct proc *p; - register struct getpeername_args *uap; - int *retval; + register struct getpeername_args /* { + syscallarg(int) fdes; + syscallarg(caddr_t) asa; + syscallarg(int *) alen; + } */ *uap; + register_t *retval; + int compat_43; { struct file *fp; register struct socket *so; struct mbuf *m; int len, error; - if (error = getsock(p->p_fd, uap->fdes, &fp)) + if (error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) return (error); so = (struct socket *)fp->f_data; if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) return (ENOTCONN); - if (error = copyin((caddr_t)uap->alen, (caddr_t)&len, sizeof (len))) + if (error = + copyin((caddr_t)SCARG(uap, alen), (caddr_t)&len, sizeof (len))) return (error); m = m_getclr(M_WAIT, MT_SONAME); if (m == NULL) @@ -1193,13 +1196,14 @@ getpeername1(p, uap, retval) if (len > m->m_len) len = m->m_len; #ifdef COMPAT_OLDSOCK - if (uap->compat_43) + if (compat_43) mtod(m, struct osockaddr *)->sa_family = mtod(m, struct sockaddr *)->sa_family; #endif - if (error = copyout(mtod(m, caddr_t), (caddr_t)uap->asa, (u_int)len)) + if (error = + copyout(mtod(m, caddr_t), (caddr_t)SCARG(uap, asa), (u_int)len)) goto bad; - error = copyout((caddr_t)&len, (caddr_t)uap->alen, sizeof (len)); + error = copyout((caddr_t)&len, (caddr_t)SCARG(uap, alen), sizeof (len)); bad: m_freem(m); return (error); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index c21007d0a354..cbc7cf486a18 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.34 1994/09/22 02:17:02 mycroft Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.35 1994/10/20 04:23:24 cgd Exp $ */ /* * Copyright (c) 1989, 1993 @@ -54,6 +54,8 @@ #include #include +#include + #include #include @@ -66,17 +68,16 @@ static int change_dir __P((struct nameidata *ndp, struct proc *p)); /* * Mount a file system. */ -struct mount_args { - char *type; - char *path; - int flags; - caddr_t data; -}; /* ARGSUSED */ mount(p, uap, retval) struct proc *p; - register struct mount_args *uap; - int *retval; + register struct mount_args /* { + syscallarg(int) type; + syscallarg(char *) path; + syscallarg(int) flags; + syscallarg(caddr_t) data; + } */ *uap; + register_t *retval; { register struct vnode *vp; register struct mount *mp; @@ -93,11 +94,12 @@ mount(p, uap, retval) /* * Get vnode to be covered */ - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; - if (uap->flags & MNT_UPDATE) { + if (SCARG(uap, flags) & MNT_UPDATE) { if ((vp->v_flag & VROOT) == 0) { vput(vp); return (EINVAL); @@ -108,13 +110,13 @@ mount(p, uap, retval) * We only allow the filesystem to be reloaded if it * is currently mounted read-only. */ - if ((uap->flags & MNT_RELOAD) && + if ((SCARG(uap, flags) & MNT_RELOAD) && ((mp->mnt_flag & MNT_RDONLY) == 0)) { vput(vp); return (EOPNOTSUPP); /* Needs translation */ } mp->mnt_flag |= - uap->flags & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE); + SCARG(uap, flags) & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE); VOP_UNLOCK(vp); goto update; } @@ -124,7 +126,7 @@ mount(p, uap, retval) vput(vp); return (ENOTDIR); } - if (error = copyin(uap->type, fstypename, MFSNAMELEN)) { + if (error = copyin((caddr_t)SCARG(uap, type), fstypename, MFSNAMELEN)) { #ifdef COMPAT_09 goto check_num; #else @@ -140,7 +142,7 @@ mount(p, uap, retval) if (fsindex >= nvfssw) { #ifdef COMPAT_09 check_num: - fsindex = (unsigned long)uap->type; + fsindex = (unsigned long)SCARG(uap, type); if (fsindex >= nvfssw || vfssw[fsindex] == NULL) { vput(vp); return (ENODEV); @@ -177,18 +179,18 @@ update: /* * Set the mount level flags. */ - if (uap->flags & MNT_RDONLY) + if (SCARG(uap, flags) & MNT_RDONLY) mp->mnt_flag |= MNT_RDONLY; else if (mp->mnt_flag & MNT_RDONLY) mp->mnt_flag |= MNT_WANTRDWR; mp->mnt_flag &=~ (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC); - mp->mnt_flag |= uap->flags & (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV | - MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC); + mp->mnt_flag |= SCARG(uap, flags) & (MNT_NOSUID | MNT_NOEXEC | + MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC); /* * Mount the filesystem. */ - error = VFS_MOUNT(mp, uap->path, uap->data, &nd, p); + error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p); if (mp->mnt_flag & MNT_UPDATE) { vrele(vp); if (mp->mnt_flag & MNT_WANTRDWR) @@ -224,22 +226,22 @@ update: * Note: unmount takes a path to the vnode mounted on as argument, * not special file (as before). */ -struct unmount_args { - char *path; - int flags; -}; /* ARGSUSED */ unmount(p, uap, retval) struct proc *p; - register struct unmount_args *uap; - int *retval; + register struct unmount_args /* { + syscallarg(char *) path; + syscallarg(int) flags; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct mount *mp; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; @@ -263,7 +265,7 @@ unmount(p, uap, retval) } mp = vp->v_mount; vput(vp); - return (dounmount(mp, uap->flags, p)); + return (dounmount(mp, SCARG(uap, flags), p)); } /* @@ -319,7 +321,7 @@ struct ctldebug debug0 = { "syncprt", &syncprt }; sync(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { register struct mount *mp, *nmp; int asyncflag; @@ -351,49 +353,48 @@ sync(p, uap, retval) /* * Change filesystem quotas. */ -struct quotactl_args { - char *path; - int cmd; - int uid; - caddr_t arg; -}; /* ARGSUSED */ quotactl(p, uap, retval) struct proc *p; - register struct quotactl_args *uap; - int *retval; + register struct quotactl_args /* { + syscallarg(char *) path; + syscallarg(int) cmd; + syscallarg(int) uid; + syscallarg(caddr_t) arg; + } */ *uap; + register_t *retval; { register struct mount *mp; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); mp = nd.ni_vp->v_mount; vrele(nd.ni_vp); - return (VFS_QUOTACTL(mp, uap->cmd, uap->uid, uap->arg, p)); + return (VFS_QUOTACTL(mp, SCARG(uap, cmd), SCARG(uap, uid), + SCARG(uap, arg), p)); } /* * Get filesystem statistics. */ -struct statfs_args { - char *path; - struct statfs *buf; -}; /* ARGSUSED */ statfs(p, uap, retval) struct proc *p; - register struct statfs_args *uap; - int *retval; + register struct statfs_args /* { + syscallarg(char *) path; + syscallarg(struct statfs *) buf; + } */ *uap; + register_t *retval; { register struct mount *mp; register struct statfs *sp; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); mp = nd.ni_vp->v_mount; @@ -402,57 +403,55 @@ statfs(p, uap, retval) if (error = VFS_STATFS(mp, sp, p)) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - return (copyout((caddr_t)sp, (caddr_t)uap->buf, sizeof(*sp))); + return (copyout((caddr_t)sp, (caddr_t)SCARG(uap, buf), sizeof(*sp))); } /* * Get filesystem statistics. */ -struct fstatfs_args { - int fd; - struct statfs *buf; -}; /* ARGSUSED */ fstatfs(p, uap, retval) struct proc *p; - register struct fstatfs_args *uap; - int *retval; + register struct fstatfs_args /* { + syscallarg(int) fd; + syscallarg(struct statfs *) buf; + } */ *uap; + register_t *retval; { struct file *fp; struct mount *mp; register struct statfs *sp; int error; - if (error = getvnode(p->p_fd, uap->fd, &fp)) + if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); mp = ((struct vnode *)fp->f_data)->v_mount; sp = &mp->mnt_stat; if (error = VFS_STATFS(mp, sp, p)) return (error); sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; - return (copyout((caddr_t)sp, (caddr_t)uap->buf, sizeof(*sp))); + return (copyout((caddr_t)sp, (caddr_t)SCARG(uap, buf), sizeof(*sp))); } /* * Get statistics on all filesystems. */ -struct getfsstat_args { - struct statfs *buf; - long bufsize; - int flags; -}; getfsstat(p, uap, retval) struct proc *p; - register struct getfsstat_args *uap; - int *retval; + register struct getfsstat_args /* { + syscallarg(struct statfs *) buf; + syscallarg(long) bufsize; + syscallarg(int) flags; + } */ *uap; + register_t *retval; { register struct mount *mp, *nmp; register struct statfs *sp; 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); for (count = 0, mp = mountlist.tqh_first; mp != NULL; mp = nmp) { nmp = mp->mnt_list.tqe_next; if (sfsp && count < maxcount && @@ -462,8 +461,8 @@ getfsstat(p, uap, retval) * If MNT_NOWAIT is specified, do not refresh the * fsstat cache. MNT_WAIT overrides MNT_NOWAIT. */ - if (((uap->flags & MNT_NOWAIT) == 0 || - (uap->flags & MNT_WAIT)) && + if (((SCARG(uap, flags) & MNT_NOWAIT) == 0 || + (SCARG(uap, flags) & MNT_WAIT)) && (error = VFS_STATFS(mp, sp, p))) continue; sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; @@ -483,21 +482,20 @@ getfsstat(p, uap, retval) /* * Change current working directory to a given file descriptor. */ -struct fchdir_args { - int fd; -}; /* ARGSUSED */ fchdir(p, uap, retval) struct proc *p; - struct fchdir_args *uap; - int *retval; + struct fchdir_args /* { + syscallarg(int) fd; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; register struct vnode *vp; struct file *fp; int error; - if (error = getvnode(fdp, uap->fd, &fp)) + if (error = getvnode(fdp, SCARG(uap, fd), &fp)) return (error); vp = (struct vnode *)fp->f_data; VOP_LOCK(vp); @@ -517,20 +515,20 @@ fchdir(p, uap, retval) /* * Change current working directory (``.''). */ -struct chdir_args { - char *path; -}; /* ARGSUSED */ chdir(p, uap, retval) struct proc *p; - struct chdir_args *uap; - int *retval; + struct chdir_args /* { + syscallarg(char *) path; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); if (error = change_dir(&nd, p)) return (error); vrele(fdp->fd_cdir); @@ -541,14 +539,13 @@ chdir(p, uap, retval) /* * Change notion of root (``/'') directory. */ -struct chroot_args { - char *path; -}; /* ARGSUSED */ chroot(p, uap, retval) struct proc *p; - struct chroot_args *uap; - int *retval; + struct chroot_args /* { + syscallarg(char *) path; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; int error; @@ -556,7 +553,8 @@ chroot(p, uap, retval) if (error = suser(p->p_ucred, &p->p_acflag)) return (error); - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); if (error = change_dir(&nd, p)) return (error); if (fdp->fd_rdir != NULL) @@ -593,15 +591,14 @@ change_dir(ndp, p) * Check permissions, allocate an open file structure, * and call the device open routine if any. */ -struct open_args { - char *path; - int flags; - int mode; -}; open(p, uap, retval) struct proc *p; - register struct open_args *uap; - int *retval; + register struct open_args /* { + syscallarg(char *) path; + syscallarg(int) flags; + syscallarg(int) mode; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; register struct file *fp; @@ -616,9 +613,9 @@ open(p, uap, retval) if (error = falloc(p, &nfp, &indx)) return (error); fp = nfp; - flags = FFLAGS(uap->flags); - cmode = ((uap->mode &~ fdp->fd_cmask) & ALLPERMS) &~ S_ISTXT; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, p); + flags = FFLAGS(SCARG(uap, flags)); + cmode = ((SCARG(uap, mode) &~ fdp->fd_cmask) & ALLPERMS) &~ S_ISTXT; + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); p->p_dupfd = -indx - 1; /* XXX check for fdopen */ if (error = vn_open(&nd, flags, cmode)) { ffree(fp); @@ -670,20 +667,23 @@ open(p, uap, retval) /* * Create a file. */ -struct ocreat_args { - char *path; - int mode; -}; -ocreat(p, uap, retval) +compat_43_creat(p, uap, retval) struct proc *p; - register struct ocreat_args *uap; - int *retval; + register struct compat_43_creat_args /* { + syscallarg(char *) path; + syscallarg(int) mode; + } */ *uap; + register_t *retval; { - struct open_args openuap; + struct open_args /* { + syscallarg(char *) path; + syscallarg(int) flags; + syscallarg(int) mode; + } */ openuap; - openuap.path = uap->path; - openuap.mode = uap->mode; - openuap.flags = O_WRONLY | O_CREAT | O_TRUNC; + SCARG(&openuap, path) = SCARG(uap, path); + SCARG(&openuap, mode) = SCARG(uap, mode); + SCARG(&openuap, flags) = O_WRONLY | O_CREAT | O_TRUNC; return (open(p, &openuap, retval)); } #endif /* COMPAT_43 */ @@ -691,16 +691,15 @@ ocreat(p, uap, retval) /* * Create a special file. */ -struct mknod_args { - char *path; - int mode; - int dev; -}; /* ARGSUSED */ mknod(p, uap, retval) struct proc *p; - register struct mknod_args *uap; - int *retval; + register struct mknod_args /* { + syscallarg(char *) path; + syscallarg(int) mode; + syscallarg(int) dev; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct vattr vattr; @@ -709,7 +708,7 @@ mknod(p, uap, retval) if (error = suser(p->p_ucred, &p->p_acflag)) return (error); - NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; @@ -718,10 +717,10 @@ mknod(p, uap, retval) goto bad; } VATTR_NULL(&vattr); - vattr.va_mode = (uap->mode & ALLPERMS) &~ p->p_fd->fd_cmask; - vattr.va_rdev = uap->dev; + vattr.va_mode = (SCARG(uap, mode) & ALLPERMS) &~ p->p_fd->fd_cmask; + vattr.va_rdev = SCARG(uap, dev); - switch (uap->mode & S_IFMT) { + switch (SCARG(uap, mode) & S_IFMT) { case S_IFMT: /* used by badsect to flag bad sectors */ vattr.va_type = VBAD; break; @@ -751,15 +750,14 @@ bad: /* * Create a named pipe. */ -struct mkfifo_args { - char *path; - int mode; -}; /* ARGSUSED */ mkfifo(p, uap, retval) struct proc *p; - register struct mkfifo_args *uap; - int *retval; + register struct mkfifo_args /* { + syscallarg(char *) path; + syscallarg(int) mode; + } */ *uap; + register_t *retval; { struct vattr vattr; int error; @@ -768,7 +766,7 @@ mkfifo(p, uap, retval) #ifndef FIFO return (EOPNOTSUPP); #else - NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); if (nd.ni_vp != NULL) { @@ -782,7 +780,7 @@ mkfifo(p, uap, retval) } VATTR_NULL(&vattr); vattr.va_type = VFIFO; - vattr.va_mode = (uap->mode & ALLPERMS) &~ p->p_fd->fd_cmask; + vattr.va_mode = (SCARG(uap, mode) & ALLPERMS) &~ p->p_fd->fd_cmask; LEASE_CHECK(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE); return (VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr)); #endif /* FIFO */ @@ -791,21 +789,20 @@ mkfifo(p, uap, retval) /* * Make a hard file link. */ -struct link_args { - char *path; - char *link; -}; /* ARGSUSED */ link(p, uap, retval) struct proc *p; - register struct link_args *uap; - int *retval; + register struct link_args /* { + syscallarg(char *) path; + syscallarg(char *) link; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct nameidata nd; int error; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; @@ -814,7 +811,7 @@ link(p, uap, retval) goto bad1; nd.ni_cnd.cn_nameiop = CREATE; nd.ni_cnd.cn_flags = LOCKPARENT; - nd.ni_dirp = uap->link; + nd.ni_dirp = SCARG(uap, link); if (error = namei(&nd)) goto bad1; if (nd.ni_vp != NULL) { @@ -842,15 +839,14 @@ bad1: /* * Make a symbolic link. */ -struct symlink_args { - char *path; - char *link; -}; /* ARGSUSED */ symlink(p, uap, retval) struct proc *p; - register struct symlink_args *uap; - int *retval; + register struct symlink_args /* { + syscallarg(char *) path; + syscallarg(char *) link; + } */ *uap; + register_t *retval; { struct vattr vattr; char *path; @@ -858,9 +854,9 @@ symlink(p, uap, retval) struct nameidata nd; MALLOC(path, char *, MAXPATHLEN, M_NAMEI, M_WAITOK); - if (error = copyinstr(uap->path, path, MAXPATHLEN, (u_int*)0)) + if (error = copyinstr(SCARG(uap, path), path, MAXPATHLEN, (u_int*)0)) goto bad; - NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, uap->link, p); + NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, SCARG(uap, link), p); if (error = namei(&nd)) goto bad; if (nd.ni_vp) { @@ -885,20 +881,19 @@ bad: /* * Delete a name from the filesystem. */ -struct unlink_args { - char *path; -}; /* ARGSUSED */ unlink(p, uap, retval) struct proc *p; - struct unlink_args *uap; - int *retval; + struct unlink_args /* { + syscallarg(char *) path; + } */ *uap; + register_t *retval; { register struct vnode *vp; int error; struct nameidata nd; - NDINIT(&nd, DELETE, LOCKPARENT, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, DELETE, LOCKPARENT, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; @@ -931,16 +926,15 @@ bad: /* * Reposition read/write file offset. */ -struct lseek_args { - int fd; - int pad; - off_t offset; - int whence; -}; lseek(p, uap, retval) struct proc *p; - register struct lseek_args *uap; - int *retval; + register struct lseek_args /* { + syscallarg(int) fd; + syscallarg(int) pad; + syscallarg(off_t) offset; + syscallarg(int) whence; + } */ *uap; + register_t *retval; { struct ucred *cred = p->p_ucred; register struct filedesc *fdp = p->p_fd; @@ -948,23 +942,23 @@ lseek(p, uap, retval) struct vattr vattr; int error; - if ((u_int)uap->fd >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL) + if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) return (EBADF); if (fp->f_type != DTYPE_VNODE) return (ESPIPE); - switch (uap->whence) { + switch (SCARG(uap, whence)) { case L_INCR: - fp->f_offset += uap->offset; + fp->f_offset += SCARG(uap, offset); break; case L_XTND: if (error = VOP_GETATTR((struct vnode *)fp->f_data, &vattr, cred, p)) return (error); - fp->f_offset = uap->offset + vattr.va_size; + fp->f_offset = SCARG(uap, offset) + vattr.va_size; break; case L_SET: - fp->f_offset = uap->offset; + fp->f_offset = SCARG(uap, offset); break; default: return (EINVAL); @@ -977,23 +971,27 @@ lseek(p, uap, retval) /* * Reposition read/write file offset. */ -struct olseek_args { - int fd; - long offset; - int whence; -}; -olseek(p, uap, retval) +compat_43_lseek(p, uap, retval) struct proc *p; - register struct olseek_args *uap; - int *retval; + register struct compat_43_lseek_args /* { + syscallarg(int) fd; + syscallarg(long) offset; + syscallarg(int) whence; + } */ *uap; + register_t *retval; { - struct lseek_args nuap; + struct lseek_args /* { + syscallarg(int) fd; + syscallarg(int) pad; + syscallarg(off_t) offset; + syscallarg(int) whence; + } */ nuap; off_t qret; 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(p, &nuap, &qret); *(long *)retval = qret; return (error); @@ -1003,14 +1001,13 @@ olseek(p, uap, retval) /* * Check access permissions. */ -struct access_args { - char *path; - int flags; -}; access(p, uap, retval) struct proc *p; - register struct access_args *uap; - int *retval; + register struct access_args /* { + syscallarg(char *) path; + syscallarg(int) flags; + } */ *uap; + register_t *retval; { register struct ucred *cred = p->p_ucred; register struct vnode *vp; @@ -1021,19 +1018,20 @@ access(p, uap, retval) t_gid = cred->cr_groups[0]; cred->cr_uid = p->p_cred->p_ruid; cred->cr_groups[0] = p->p_cred->p_rgid; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); if (error = namei(&nd)) goto out1; vp = nd.ni_vp; /* Flags == 0 means only check for existence. */ - if (uap->flags) { + if (SCARG(uap, flags)) { flags = 0; - if (uap->flags & R_OK) + if (SCARG(uap, flags) & R_OK) flags |= VREAD; - if (uap->flags & W_OK) + if (SCARG(uap, flags) & W_OK) flags |= VWRITE; - if (uap->flags & X_OK) + if (SCARG(uap, flags) & X_OK) flags |= VEXEC; if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0) error = VOP_ACCESS(vp, flags, cred, p); @@ -1049,22 +1047,22 @@ out1: /* * Get file status; this version follows links. */ -struct ostat_args { - char *path; - struct ostat *ub; -}; /* ARGSUSED */ -ostat(p, uap, retval) +compat_43_stat(p, uap, retval) struct proc *p; - register struct ostat_args *uap; - int *retval; + register struct compat_43_stat_args /* { + syscallarg(char *) path; + syscallarg(struct ostat *) ub; + } */ *uap; + register_t *retval; { struct stat sb; struct ostat osb; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); if (error = namei(&nd)) return (error); error = vn_stat(nd.ni_vp, &sb, p); @@ -1072,29 +1070,29 @@ ostat(p, uap, retval) if (error) return (error); cvtstat(&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); } /* * Get file status; this version does not follow links. */ -struct olstat_args { - char *path; - struct ostat *ub; -}; /* ARGSUSED */ -olstat(p, uap, retval) +compat_43_lstat(p, uap, retval) struct proc *p; - register struct olstat_args *uap; - int *retval; + register struct compat_43_lstat_args /* { + syscallarg(char *) path; + syscallarg(struct ostat *) ub; + } */ *uap; + register_t *retval; { struct stat sb; struct ostat osb; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); if (error = namei(&nd)) return (error); error = vn_stat(nd.ni_vp, &sb, p); @@ -1102,7 +1100,7 @@ olstat(p, uap, retval) if (error) return (error); cvtstat(&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); } @@ -1138,43 +1136,42 @@ cvtstat(st, ost) /* * Get file status; this version follows links. */ -struct stat_args { - char *path; - struct stat *ub; -}; /* ARGSUSED */ stat(p, uap, retval) struct proc *p; - register struct stat_args *uap; - int *retval; + register struct stat_args /* { + syscallarg(char *) path; + syscallarg(struct stat *) ub; + } */ *uap; + register_t *retval; { struct stat sb; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); if (error = namei(&nd)) return (error); error = vn_stat(nd.ni_vp, &sb, p); vput(nd.ni_vp); if (error) return (error); - error = copyout((caddr_t)&sb, (caddr_t)uap->ub, sizeof (sb)); + error = copyout((caddr_t)&sb, (caddr_t)SCARG(uap, ub), sizeof (sb)); return (error); } /* * Get file status; this version does not follow links. */ -struct lstat_args { - char *path; - struct stat *ub; -}; /* ARGSUSED */ lstat(p, uap, retval) struct proc *p; - register struct lstat_args *uap; - int *retval; + register struct lstat_args /* { + syscallarg(char *) path; + syscallarg(struct stat *) ub; + } */ *uap; + register_t *retval; { int error; struct vnode *vp, *dvp; @@ -1182,7 +1179,7 @@ lstat(p, uap, retval) struct nameidata nd; NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | LOCKPARENT, UIO_USERSPACE, - uap->path, p); + SCARG(uap, path), p); if (error = namei(&nd)) return (error); /* @@ -1217,30 +1214,30 @@ lstat(p, uap, retval) sb.st_size = sb1.st_size; sb.st_blocks = sb1.st_blocks; } - error = copyout((caddr_t)&sb, (caddr_t)uap->ub, sizeof (sb)); + error = copyout((caddr_t)&sb, (caddr_t)SCARG(uap, ub), sizeof (sb)); return (error); } /* * Get configurable pathname variables. */ -struct pathconf_args { - char *path; - int name; -}; /* ARGSUSED */ pathconf(p, uap, retval) struct proc *p; - register struct pathconf_args *uap; - int *retval; + register struct pathconf_args /* { + syscallarg(char *) path; + syscallarg(int) name; + } */ *uap; + register_t *retval; { int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); if (error = namei(&nd)) return (error); - error = VOP_PATHCONF(nd.ni_vp, uap->name, retval); + error = VOP_PATHCONF(nd.ni_vp, SCARG(uap, name), retval); vput(nd.ni_vp); return (error); } @@ -1248,16 +1245,15 @@ pathconf(p, uap, retval) /* * Return target name of a symbolic link. */ -struct readlink_args { - char *path; - char *buf; - int count; -}; /* ARGSUSED */ readlink(p, uap, retval) struct proc *p; - register struct readlink_args *uap; - int *retval; + register struct readlink_args /* { + syscallarg(char *) path; + syscallarg(char *) buf; + syscallarg(int) count; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct iovec aiov; @@ -1265,48 +1261,48 @@ readlink(p, uap, retval) int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; if (vp->v_type != VLNK) error = EINVAL; else { - 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_offset = 0; auio.uio_rw = UIO_READ; auio.uio_segflg = UIO_USERSPACE; auio.uio_procp = p; - auio.uio_resid = uap->count; + auio.uio_resid = SCARG(uap, count); error = VOP_READLINK(vp, &auio, p->p_ucred); } vput(vp); - *retval = uap->count - auio.uio_resid; + *retval = SCARG(uap, count) - auio.uio_resid; return (error); } /* * Change flags of a file given a path name. */ -struct chflags_args { - char *path; - int flags; -}; /* ARGSUSED */ chflags(p, uap, retval) struct proc *p; - register struct chflags_args *uap; - int *retval; + register struct chflags_args /* { + syscallarg(char *) path; + syscallarg(int) flags; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct vattr vattr; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; @@ -1316,7 +1312,7 @@ chflags(p, uap, retval) error = EROFS; else { VATTR_NULL(&vattr); - vattr.va_flags = uap->flags; + vattr.va_flags = SCARG(uap, flags); error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); } vput(vp); @@ -1326,22 +1322,21 @@ chflags(p, uap, retval) /* * Change flags of a file given a file descriptor. */ -struct fchflags_args { - int fd; - int flags; -}; /* ARGSUSED */ fchflags(p, uap, retval) struct proc *p; - register struct fchflags_args *uap; - int *retval; + register struct fchflags_args /* { + syscallarg(int) fd; + syscallarg(int) flags; + } */ *uap; + register_t *retval; { struct vattr vattr; struct vnode *vp; struct file *fp; int error; - if (error = getvnode(p->p_fd, uap->fd, &fp)) + if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); vp = (struct vnode *)fp->f_data; LEASE_CHECK(vp, p, p->p_ucred, LEASE_WRITE); @@ -1350,7 +1345,7 @@ fchflags(p, uap, retval) error = EROFS; else { VATTR_NULL(&vattr); - vattr.va_flags = uap->flags; + vattr.va_flags = SCARG(uap, flags); error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); } VOP_UNLOCK(vp); @@ -1360,22 +1355,21 @@ fchflags(p, uap, retval) /* * Change mode of a file given path name. */ -struct chmod_args { - char *path; - int mode; -}; /* ARGSUSED */ chmod(p, uap, retval) struct proc *p; - register struct chmod_args *uap; - int *retval; + register struct chmod_args /* { + syscallarg(char *) path; + syscallarg(int) mode; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct vattr vattr; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; @@ -1385,7 +1379,7 @@ chmod(p, uap, retval) error = EROFS; else { VATTR_NULL(&vattr); - vattr.va_mode = uap->mode & ALLPERMS; + vattr.va_mode = SCARG(uap, mode) & ALLPERMS; error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); } vput(vp); @@ -1395,22 +1389,21 @@ chmod(p, uap, retval) /* * Change mode of a file given a file descriptor. */ -struct fchmod_args { - int fd; - int mode; -}; /* ARGSUSED */ fchmod(p, uap, retval) struct proc *p; - register struct fchmod_args *uap; - int *retval; + register struct fchmod_args /* { + syscallarg(int) fd; + syscallarg(int) mode; + } */ *uap; + register_t *retval; { struct vattr vattr; struct vnode *vp; struct file *fp; int error; - if (error = getvnode(p->p_fd, uap->fd, &fp)) + if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); vp = (struct vnode *)fp->f_data; LEASE_CHECK(vp, p, p->p_ucred, LEASE_WRITE); @@ -1419,7 +1412,7 @@ fchmod(p, uap, retval) error = EROFS; else { VATTR_NULL(&vattr); - vattr.va_mode = uap->mode & ALLPERMS; + vattr.va_mode = SCARG(uap, mode) & ALLPERMS; error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); } VOP_UNLOCK(vp); @@ -1429,23 +1422,22 @@ fchmod(p, uap, retval) /* * Set ownership given a path name. */ -struct chown_args { - char *path; - int uid; - int gid; -}; /* ARGSUSED */ chown(p, uap, retval) struct proc *p; - register struct chown_args *uap; - int *retval; + register struct chown_args /* { + syscallarg(char *) path; + syscallarg(int) uid; + syscallarg(int) gid; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct vattr vattr; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; @@ -1455,8 +1447,8 @@ chown(p, uap, retval) error = EROFS; else { VATTR_NULL(&vattr); - vattr.va_uid = uap->uid; - vattr.va_gid = uap->gid; + vattr.va_uid = SCARG(uap, uid); + vattr.va_gid = SCARG(uap, gid); error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); } vput(vp); @@ -1466,23 +1458,22 @@ chown(p, uap, retval) /* * Set ownership given a file descriptor. */ -struct fchown_args { - int fd; - int uid; - int gid; -}; /* ARGSUSED */ fchown(p, uap, retval) struct proc *p; - register struct fchown_args *uap; - int *retval; + register struct fchown_args /* { + syscallarg(int) fd; + syscallarg(int) uid; + syscallarg(int) gid; + } */ *uap; + register_t *retval; { struct vattr vattr; struct vnode *vp; struct file *fp; int error; - if (error = getvnode(p->p_fd, uap->fd, &fp)) + if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); vp = (struct vnode *)fp->f_data; LEASE_CHECK(vp, p, p->p_ucred, LEASE_WRITE); @@ -1491,8 +1482,8 @@ fchown(p, uap, retval) error = EROFS; else { VATTR_NULL(&vattr); - vattr.va_uid = uap->uid; - vattr.va_gid = uap->gid; + vattr.va_uid = SCARG(uap, uid); + vattr.va_gid = SCARG(uap, gid); error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); } VOP_UNLOCK(vp); @@ -1502,15 +1493,14 @@ fchown(p, uap, retval) /* * Set the access and modification times of a file. */ -struct utimes_args { - char *path; - struct timeval *tptr; -}; /* ARGSUSED */ utimes(p, uap, retval) struct proc *p; - register struct utimes_args *uap; - int *retval; + register struct utimes_args /* { + syscallarg(char *) path; + syscallarg(struct timeval *) tptr; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct timeval tv[2]; @@ -1519,13 +1509,14 @@ utimes(p, uap, retval) struct nameidata nd; VATTR_NULL(&vattr); - if (uap->tptr == NULL) { + if (SCARG(uap, tptr) == NULL) { microtime(&tv[0]); tv[1] = tv[0]; vattr.va_vaflags |= VA_UTIMES_NULL; - } else if (error = copyin((caddr_t)uap->tptr, (caddr_t)tv, sizeof (tv))) + } else if (error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv, + sizeof (tv))) return (error); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; @@ -1547,23 +1538,22 @@ utimes(p, uap, retval) /* * Truncate a file given its path name. */ -struct truncate_args { - char *path; - int pad; - off_t length; -}; /* ARGSUSED */ truncate(p, uap, retval) struct proc *p; - register struct truncate_args *uap; - int *retval; + register struct truncate_args /* { + syscallarg(char *) path; + syscallarg(int) pad; + syscallarg(off_t) length; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct vattr vattr; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; @@ -1574,7 +1564,7 @@ truncate(p, uap, retval) else if ((error = vn_writechk(vp)) == 0 && (error = VOP_ACCESS(vp, VWRITE, p->p_ucred, p)) == 0) { VATTR_NULL(&vattr); - vattr.va_size = uap->length; + vattr.va_size = SCARG(uap, length); error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); } vput(vp); @@ -1584,23 +1574,22 @@ truncate(p, uap, retval) /* * Truncate a file given a file descriptor. */ -struct ftruncate_args { - int fd; - int pad; - off_t length; -}; /* ARGSUSED */ ftruncate(p, uap, retval) struct proc *p; - register struct ftruncate_args *uap; - int *retval; + register struct ftruncate_args /* { + syscallarg(int) fd; + syscallarg(int) pad; + syscallarg(off_t) length; + } */ *uap; + register_t *retval; { struct vattr vattr; struct vnode *vp; struct file *fp; int error; - if (error = getvnode(p->p_fd, uap->fd, &fp)) + if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); if ((fp->f_flag & FWRITE) == 0) return (EINVAL); @@ -1611,7 +1600,7 @@ ftruncate(p, uap, retval) error = EISDIR; 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, p); } VOP_UNLOCK(vp); @@ -1622,40 +1611,38 @@ ftruncate(p, uap, retval) /* * Truncate a file given its path name. */ -struct otruncate_args { - char *path; - long length; -}; /* ARGSUSED */ -otruncate(p, uap, retval) +compat_43_truncate(p, uap, retval) struct proc *p; - register struct otruncate_args *uap; - int *retval; + register struct compat_43_truncate_args /* { + syscallarg(char *) path; + syscallarg(long) length; + } */ *uap; + register_t *retval; { struct truncate_args nuap; - nuap.path = uap->path; - nuap.length = uap->length; + SCARG(&nuap, path) = SCARG(uap, path); + SCARG(&nuap, length) = SCARG(uap, length); return (truncate(p, &nuap, retval)); } /* * Truncate a file given a file descriptor. */ -struct oftruncate_args { - int fd; - long length; -}; /* ARGSUSED */ -oftruncate(p, uap, retval) +compat_43_ftruncate(p, uap, retval) struct proc *p; - register struct oftruncate_args *uap; - int *retval; + register struct compat_43_ftruncate_args /* { + syscallarg(int) fd; + syscallarg(long) length; + } */ *uap; + register_t *retval; { struct ftruncate_args nuap; - nuap.fd = uap->fd; - nuap.length = uap->length; + SCARG(&nuap, fd) = SCARG(uap, fd); + SCARG(&nuap, length) = SCARG(uap, length); return (ftruncate(p, &nuap, retval)); } #endif /* COMPAT_43 || COMPAT_SUNOS */ @@ -1663,20 +1650,19 @@ oftruncate(p, uap, retval) /* * Sync an open file. */ -struct fsync_args { - int fd; -}; /* ARGSUSED */ fsync(p, uap, retval) struct proc *p; - struct fsync_args *uap; - int *retval; + struct fsync_args /* { + syscallarg(int) fd; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct file *fp; int error; - if (error = getvnode(p->p_fd, uap->fd, &fp)) + if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); vp = (struct vnode *)fp->f_data; VOP_LOCK(vp); @@ -1689,27 +1675,26 @@ fsync(p, uap, retval) * Rename files. Source and destination must either both be directories, * or both not be directories. If target is a directory, it must be empty. */ -struct rename_args { - char *from; - char *to; -}; /* ARGSUSED */ rename(p, uap, retval) struct proc *p; - register struct rename_args *uap; - int *retval; + register struct rename_args /* { + syscallarg(char *) from; + syscallarg(char *) to; + } */ *uap; + register_t *retval; { register struct vnode *tvp, *fvp, *tdvp; struct nameidata fromnd, tond; int error; NDINIT(&fromnd, DELETE, WANTPARENT | SAVESTART, UIO_USERSPACE, - uap->from, p); + SCARG(uap, from), p); if (error = namei(&fromnd)) return (error); fvp = fromnd.ni_vp; NDINIT(&tond, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART, - UIO_USERSPACE, uap->to, p); + UIO_USERSPACE, SCARG(uap, to), p); if (error = namei(&tond)) { VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd); vrele(fromnd.ni_dvp); @@ -1774,22 +1759,21 @@ out1: /* * Make a directory file. */ -struct mkdir_args { - char *path; - int mode; -}; /* ARGSUSED */ mkdir(p, uap, retval) struct proc *p; - register struct mkdir_args *uap; - int *retval; + register struct mkdir_args /* { + syscallarg(char *) path; + syscallarg(int) mode; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct vattr vattr; int error; struct nameidata nd; - NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; @@ -1804,7 +1788,7 @@ mkdir(p, uap, retval) } VATTR_NULL(&vattr); vattr.va_type = VDIR; - vattr.va_mode = (uap->mode & ACCESSPERMS) &~ p->p_fd->fd_cmask; + vattr.va_mode = (SCARG(uap, mode) & ACCESSPERMS) &~ p->p_fd->fd_cmask; LEASE_CHECK(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE); error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr); if (!error) @@ -1815,20 +1799,20 @@ mkdir(p, uap, retval) /* * Remove a directory file. */ -struct rmdir_args { - char *path; -}; /* ARGSUSED */ rmdir(p, uap, retval) struct proc *p; - struct rmdir_args *uap; - int *retval; + struct rmdir_args /* { + syscallarg(char *) path; + } */ *uap; + register_t *retval; { register struct vnode *vp; int error; struct nameidata nd; - NDINIT(&nd, DELETE, LOCKPARENT | LOCKLEAF, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, DELETE, LOCKPARENT | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; @@ -1868,16 +1852,15 @@ out: /* * Read a block of directory entries in a file system independent format. */ -struct ogetdirentries_args { - int fd; - char *buf; - u_int count; - long *basep; -}; -ogetdirentries(p, uap, retval) +compat_43_getdirentries(p, uap, retval) struct proc *p; - register struct ogetdirentries_args *uap; - int *retval; + register struct compat_43_getdirentries_args /* { + syscallarg(int) fd; + syscallarg(char *) buf; + syscallarg(u_int) count; + syscallarg(long *) basep; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct file *fp; @@ -1888,7 +1871,7 @@ ogetdirentries(p, uap, retval) int error, eofflag, readcnt; long loff; - if (error = getvnode(p->p_fd, uap->fd, &fp)) + if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); if ((fp->f_flag & FREAD) == 0) return (EBADF); @@ -1896,14 +1879,14 @@ ogetdirentries(p, uap, retval) unionread: if (vp->v_type != VDIR) 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_procp = p; - auio.uio_resid = uap->count; + auio.uio_resid = SCARG(uap, count); VOP_LOCK(vp); loff = auio.uio_offset = fp->f_offset; # if (BYTE_ORDER != LITTLE_ENDIAN) @@ -1917,14 +1900,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, (u_long *)0, 0); 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) @@ -1966,7 +1949,7 @@ unionread: extern int (**union_vnodeop_p)(); extern struct vnode *union_lowervp __P((struct vnode *)); - if ((uap->count == auio.uio_resid) && + if ((SCARG(uap, count) == auio.uio_resid) && (vp->v_op == union_vnodeop_p)) { struct vnode *lvp; @@ -1992,9 +1975,8 @@ unionread: } #endif /* UNION */ - if ((uap->count == auio.uio_resid) && - (vp->v_flag & VROOT) && - (vp->v_mount->mnt_flag & MNT_UNION)) { + if ((SCARG(uap, count) == auio.uio_resid) && + (vp->v_flag & VROOT) && (vp->v_mount->mnt_flag & MNT_UNION)) { struct vnode *tvp = vp; vp = vp->v_mount->mnt_vnodecovered; VREF(vp); @@ -2003,8 +1985,9 @@ unionread: vrele(tvp); goto unionread; } - error = copyout((caddr_t)&loff, (caddr_t)uap->basep, sizeof(long)); - *retval = uap->count - auio.uio_resid; + error = + copyout((caddr_t)&loff, (caddr_t)SCARG(uap, basep), sizeof(long)); + *retval = SCARG(uap, count) - auio.uio_resid; return (error); } #endif /* COMPAT_43 */ @@ -2012,16 +1995,15 @@ unionread: /* * Read a block of directory entries in a file system independent format. */ -struct getdirentries_args { - int fd; - char *buf; - u_int count; - long *basep; -}; getdirentries(p, uap, retval) struct proc *p; - register struct getdirentries_args *uap; - int *retval; + register struct getdirentries_args /* { + syscallarg(int) fd; + syscallarg(char *) buf; + syscallarg(u_int) count; + syscallarg(long *) basep; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct file *fp; @@ -2030,7 +2012,7 @@ getdirentries(p, uap, retval) long loff; int error, eofflag; - if (error = getvnode(p->p_fd, uap->fd, &fp)) + if (error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) return (error); if ((fp->f_flag & FREAD) == 0) return (EBADF); @@ -2038,14 +2020,14 @@ getdirentries(p, uap, retval) unionread: if (vp->v_type != VDIR) 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_procp = p; - auio.uio_resid = uap->count; + auio.uio_resid = SCARG(uap, count); VOP_LOCK(vp); loff = auio.uio_offset = fp->f_offset; error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, (u_long *)0, 0); @@ -2059,7 +2041,7 @@ unionread: extern int (**union_vnodeop_p)(); extern struct vnode *union_lowervp __P((struct vnode *)); - if ((uap->count == auio.uio_resid) && + if ((SCARG(uap, count) == auio.uio_resid) && (vp->v_op == union_vnodeop_p)) { struct vnode *lvp; @@ -2085,9 +2067,8 @@ unionread: } #endif /* UNION */ - if ((uap->count == auio.uio_resid) && - (vp->v_flag & VROOT) && - (vp->v_mount->mnt_flag & MNT_UNION)) { + if ((SCARG(uap, count) == auio.uio_resid) && + (vp->v_flag & VROOT) && (vp->v_mount->mnt_flag & MNT_UNION)) { struct vnode *tvp = vp; vp = vp->v_mount->mnt_vnodecovered; VREF(vp); @@ -2096,28 +2077,28 @@ unionread: vrele(tvp); goto unionread; } - error = copyout((caddr_t)&loff, (caddr_t)uap->basep, sizeof(long)); - *retval = uap->count - auio.uio_resid; + error = copyout((caddr_t)&loff, (caddr_t)SCARG(uap, basep), + sizeof(long)); + *retval = SCARG(uap, count) - auio.uio_resid; return (error); } /* * Set the mode mask for creation of filesystem nodes. */ -struct umask_args { - int newmask; -}; mode_t /* XXX */ umask(p, uap, retval) struct proc *p; - struct umask_args *uap; - int *retval; + struct umask_args /* { + syscallarg(int) newmask; + } */ *uap; + register_t *retval; { register struct filedesc *fdp; fdp = p->p_fd; *retval = fdp->fd_cmask; - fdp->fd_cmask = uap->newmask & ALLPERMS; + fdp->fd_cmask = SCARG(uap, newmask) & ALLPERMS; return (0); } @@ -2125,21 +2106,20 @@ umask(p, uap, retval) * Void all references to file by ripping underlying filesystem * away from vnode. */ -struct revoke_args { - char *path; -}; /* ARGSUSED */ revoke(p, uap, retval) struct proc *p; - register struct revoke_args *uap; - int *retval; + register struct revoke_args /* { + syscallarg(char *) path; + } */ *uap; + register_t *retval; { register struct vnode *vp; struct vattr vattr; int error; struct nameidata nd; - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index 2091fb9b1a64..5eef8245df8f 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -1,4 +1,4 @@ -# $NetBSD: vnode_if.src,v 1.2 1994/06/29 06:34:07 cgd Exp $ +# $NetBSD: vnode_if.src,v 1.3 1994/10/20 04:23:26 cgd Exp $ # # Copyright (c) 1992, 1993 # The Regents of the University of California. All rights reserved. @@ -243,7 +243,7 @@ vop_islocked { vop_pathconf { IN struct vnode *vp; IN int name; - OUT int *retval; + OUT register_t *retval; }; vop_advlock { diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c index 21bb1e877c1e..10346992b5ca 100644 --- a/sys/miscfs/fdesc/fdesc_vnops.c +++ b/sys/miscfs/fdesc/fdesc_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdesc_vnops.c,v 1.17 1994/08/19 11:25:31 mycroft Exp $ */ +/* $NetBSD: fdesc_vnops.c,v 1.18 1994/10/20 04:26:22 cgd Exp $ */ /* * Copyright (c) 1992, 1993 @@ -785,7 +785,7 @@ fdesc_pathconf(ap) struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; - int *a_retval; + register_t *a_retval; } */ *ap; { diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index 93bf9886403b..59d097c1a54f 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: fifo_vnops.c,v 1.9 1994/06/29 06:34:24 cgd Exp $ */ +/* $NetBSD: fifo_vnops.c,v 1.10 1994/10/20 04:26:25 cgd Exp $ */ /* * Copyright (c) 1990, 1993 @@ -439,7 +439,7 @@ fifo_pathconf(ap) struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; - int *a_retval; + register_t *a_retval; } */ *ap; { diff --git a/sys/miscfs/kernfs/kernfs_vnops.c b/sys/miscfs/kernfs/kernfs_vnops.c index a69eb8a1d318..eacb40363639 100644 --- a/sys/miscfs/kernfs/kernfs_vnops.c +++ b/sys/miscfs/kernfs/kernfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: kernfs_vnops.c,v 1.28 1994/07/21 10:22:20 mycroft Exp $ */ +/* $NetBSD: kernfs_vnops.c,v 1.29 1994/10/20 04:26:28 cgd Exp $ */ /* * Copyright (c) 1992, 1993 @@ -618,7 +618,7 @@ kernfs_pathconf(ap) struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; - int *a_retval; + register_t *a_retval; } */ *ap; { diff --git a/sys/miscfs/portal/portal_vnops.c b/sys/miscfs/portal/portal_vnops.c index 1432a44ef303..31d2cda5d7f7 100644 --- a/sys/miscfs/portal/portal_vnops.c +++ b/sys/miscfs/portal/portal_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: portal_vnops.c,v 1.6 1994/06/29 06:34:40 cgd Exp $ */ +/* $NetBSD: portal_vnops.c,v 1.7 1994/10/20 04:26:33 cgd Exp $ */ /* * Copyright (c) 1992, 1993 @@ -529,7 +529,7 @@ portal_pathconf(ap) struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; - int *a_retval; + register_t *a_retval; } */ *ap; { diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c index 17629654ffaf..6d28bbf571e0 100644 --- a/sys/miscfs/procfs/procfs_vnops.c +++ b/sys/miscfs/procfs/procfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_vnops.c,v 1.25 1994/08/30 03:06:42 mycroft Exp $ */ +/* $NetBSD: procfs_vnops.c,v 1.26 1994/10/20 04:26:36 cgd Exp $ */ /* * Copyright (c) 1993 Jan-Simon Pendry @@ -259,7 +259,7 @@ procfs_pathconf(ap) struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; - int *a_retval; + register_t *a_retval; } */ *ap; { diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index 2bb74ac6619c..746b5aebafe5 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: spec_vnops.c,v 1.17 1994/07/16 11:40:56 paulus Exp $ */ +/* $NetBSD: spec_vnops.c,v 1.18 1994/10/20 04:26:38 cgd Exp $ */ /* * Copyright (c) 1989, 1993 @@ -633,7 +633,7 @@ spec_pathconf(ap) struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; - int *a_retval; + register_t *a_retval; } */ *ap; { diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c index 6f2a9e4ba7f7..248d683f093c 100644 --- a/sys/miscfs/union/union_vnops.c +++ b/sys/miscfs/union/union_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: union_vnops.c,v 1.5 1994/08/30 03:01:01 mycroft Exp $ */ +/* $NetBSD: union_vnops.c,v 1.6 1994/10/20 04:26:40 cgd Exp $ */ /* * Copyright (c) 1992, 1993, 1994 The Regents of the University of California. @@ -1391,7 +1391,7 @@ union_pathconf(ap) struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; - int *a_retval; + register_t *a_retval; } */ *ap; { int error; diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index 4fc794ab7869..2f7cbeae6b3c 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_vnops.c,v 1.23 1994/09/28 15:00:31 mycroft Exp $ */ +/* $NetBSD: msdosfs_vnops.c,v 1.24 1994/10/20 04:26:43 cgd Exp $ */ /*- * Copyright (C) 1994 Wolfgang Solfrank. @@ -1780,7 +1780,7 @@ msdosfs_pathconf(ap) struct vop_pathconf_args /* { struct vnode *a_vp; int a_name; - int *a_retval; + register_t *a_retval; } */ *ap; { diff --git a/sys/vm/vm_extern.h b/sys/vm/vm_extern.h index a30e9ac2a7be..56b09c1dfef7 100644 --- a/sys/vm/vm_extern.h +++ b/sys/vm/vm_extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: vm_extern.h,v 1.8 1994/09/16 02:01:49 mycroft Exp $ */ +/* $NetBSD: vm_extern.h,v 1.9 1994/10/20 04:27:30 cgd Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -49,7 +49,7 @@ void chgkprot __P((caddr_t, int, int)); #ifdef KERNEL #ifdef TYPEDEF_FOR_UAP -int ogetpagesize __P((struct proc *p, void *, int *)); +int compat_43_getpagesize __P((struct proc *p, void *, int *)); int madvise __P((struct proc *, void *, int *)); int mincore __P((struct proc *, void *, int *)); int mprotect __P((struct proc *, void *, int *)); diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c index 2718be2a9d10..5003d95092d5 100644 --- a/sys/vm/vm_mmap.c +++ b/sys/vm/vm_mmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_mmap.c,v 1.32 1994/09/16 01:57:57 mycroft Exp $ */ +/* $NetBSD: vm_mmap.c,v 1.33 1994/10/20 04:27:31 cgd Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -56,6 +56,9 @@ #include #include +#include +#include + #include #include @@ -69,30 +72,28 @@ int mmapdebug = 0; #define MDB_MAPIT 0x04 #endif -struct sbrk_args { - int incr; -}; /* ARGSUSED */ int sbrk(p, uap, retval) struct proc *p; - struct sbrk_args *uap; - int *retval; + struct sbrk_args /* { + syscallarg(int) incr; + } */ *uap; + register_t *retval; { /* Not yet implemented */ return (EOPNOTSUPP); } -struct sstk_args { - int incr; -}; /* ARGSUSED */ int sstk(p, uap, retval) struct proc *p; - struct sstk_args *uap; - int *retval; + struct sstk_args /* { + syscallarg(int) incr; + } */ *uap; + register_t *retval; { /* Not yet implemented */ @@ -102,10 +103,10 @@ sstk(p, uap, retval) #if defined(COMPAT_43) || defined(COMPAT_SUNOS) /* ARGSUSED */ int -ogetpagesize(p, uap, retval) +compat_43_getpagesize(p, uap, retval) struct proc *p; void *uap; - int *retval; + register_t *retval; { *retval = PAGE_SIZE; @@ -113,32 +114,29 @@ ogetpagesize(p, uap, retval) } #endif /* COMPAT_43 || COMPAT_SUNOS */ -struct mmap_args { - caddr_t addr; - size_t len; - int prot; - int flags; - int fd; - long pad; - off_t pos; -}; - #ifdef COMPAT_43 -struct ommap_args { - caddr_t addr; - int len; - int prot; - int flags; - int fd; - long pos; -}; int -ommap(p, uap, retval) +compat_43_mmap(p, uap, retval) struct proc *p; - register struct ommap_args *uap; - int *retval; + register struct compat_43_mmap_args /* { + syscallarg(caddr_t) addr; + syscallarg(int) len; + syscallarg(int) prot; + syscallarg(int) flags; + syscallarg(int) fd; + syscallarg(long) pos; + } */ *uap; + register_t *retval; { - struct mmap_args nargs; + struct mmap_args /* { + syscallarg(caddr_t) addr; + syscallarg(size_t) len; + syscallarg(int) prot; + syscallarg(int) flags; + syscallarg(int) fd; + syscallarg(long) pad; + syscallarg(off_t) pos; + } */ nargs; static const char cvtbsdprot[8] = { 0, PROT_EXEC, @@ -155,24 +153,24 @@ ommap(p, uap, retval) #define OMAP_FIXED 0x0100 #define OMAP_INHERIT 0x0800 - nargs.addr = uap->addr; - nargs.len = uap->len; - nargs.prot = cvtbsdprot[uap->prot&0x7]; - nargs.flags = 0; - if (uap->flags & OMAP_ANON) - nargs.flags |= MAP_ANON; - if (uap->flags & OMAP_COPY) - nargs.flags |= MAP_COPY; - if (uap->flags & OMAP_SHARED) - nargs.flags |= MAP_SHARED; + SCARG(&nargs, addr) = SCARG(uap, addr); + SCARG(&nargs, len) = SCARG(uap, len); + SCARG(&nargs, prot) = cvtbsdprot[SCARG(uap, prot)&0x7]; + SCARG(&nargs, flags) = 0; + if (SCARG(uap, flags) & OMAP_ANON) + SCARG(&nargs, flags) |= MAP_ANON; + if (SCARG(uap, flags) & OMAP_COPY) + SCARG(&nargs, flags) |= MAP_COPY; + if (SCARG(uap, flags) & OMAP_SHARED) + SCARG(&nargs, flags) |= MAP_SHARED; else - nargs.flags |= MAP_PRIVATE; - if (uap->flags & OMAP_FIXED) - nargs.flags |= MAP_FIXED; - if (uap->flags & OMAP_INHERIT) - nargs.flags |= MAP_INHERIT; - nargs.fd = uap->fd; - nargs.pos = uap->pos; + SCARG(&nargs, flags) |= MAP_PRIVATE; + if (SCARG(uap, flags) & OMAP_FIXED) + SCARG(&nargs, flags) |= MAP_FIXED; + if (SCARG(uap, flags) & OMAP_INHERIT) + SCARG(&nargs, flags) |= MAP_INHERIT; + SCARG(&nargs, fd) = SCARG(uap, fd); + SCARG(&nargs, pos) = SCARG(uap, pos); return (mmap(p, &nargs, retval)); } #endif @@ -180,8 +178,16 @@ ommap(p, uap, retval) int mmap(p, uap, retval) struct proc *p; - register struct mmap_args *uap; - int *retval; + register struct mmap_args /* { + syscallarg(caddr_t) addr; + syscallarg(size_t) len; + syscallarg(int) prot; + syscallarg(int) flags; + syscallarg(int) fd; + syscallarg(long) pad; + syscallarg(off_t) pos; + } */ *uap; + register_t *retval; { register struct filedesc *fdp = p->p_fd; register struct file *fp; @@ -192,24 +198,25 @@ mmap(p, uap, retval) caddr_t handle; int flags, error; - prot = uap->prot & VM_PROT_ALL; - flags = uap->flags; - pos = uap->pos; + prot = SCARG(uap, prot) & VM_PROT_ALL; + flags = SCARG(uap, flags); + pos = SCARG(uap, pos); #ifdef DEBUG if (mmapdebug & MDB_FOLLOW) printf("mmap(%d): addr %x len %x pro %x flg %x fd %d pos %x\n", - p->p_pid, uap->addr, uap->len, prot, - flags, uap->fd, pos); + p->p_pid, SCARG(uap, addr), SCARG(uap, len), prot, + flags, SCARG(uap, fd), pos); #endif /* * Address (if FIXED) must be page aligned. * Size is implicitly rounded to a page boundary. */ - addr = (vm_offset_t) uap->addr; + addr = (vm_offset_t) SCARG(uap, addr); if (((flags & MAP_FIXED) && (addr & PAGE_MASK)) || - (ssize_t)uap->len < 0 || ((flags & MAP_ANON) && uap->fd != -1)) + (ssize_t)SCARG(uap, len) < 0 || + ((flags & MAP_ANON) && SCARG(uap, fd) != -1)) return (EINVAL); - size = (vm_size_t) round_page(uap->len); + size = (vm_size_t) round_page(SCARG(uap, len)); /* * Check for illegal addresses. Watch out for address wrap... * Note that VM_*_ADDRESS are not constants due to casts (argh). @@ -244,8 +251,8 @@ mmap(p, uap, retval) * Mapping file, get fp for validation. * Obtain vnode and make sure it is of appropriate type. */ - if (((unsigned)uap->fd) >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[uap->fd]) == NULL) + if (((unsigned)SCARG(uap, fd)) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) return (EBADF); if (fp->f_type != DTYPE_VNODE) return (EINVAL); @@ -286,21 +293,20 @@ mmap(p, uap, retval) } } error = vm_mmap(&p->p_vmspace->vm_map, &addr, size, prot, maxprot, - flags, handle, (vm_offset_t)uap->pos); + flags, handle, (vm_offset_t)SCARG(uap, pos)); if (error == 0) - *retval = (int)addr; + *retval = (register_t)addr; return (error); } -struct msync_args { - caddr_t addr; - int len; -}; int msync(p, uap, retval) struct proc *p; - struct msync_args *uap; - int *retval; + struct msync_args /* { + syscallarg(caddr_t) addr; + syscallarg(int) len; + } */ *uap; + register_t *retval; { vm_offset_t addr; vm_size_t size; @@ -311,13 +317,14 @@ msync(p, uap, retval) #ifdef DEBUG if (mmapdebug & (MDB_FOLLOW|MDB_SYNC)) printf("msync(%d): addr %x len %x\n", - p->p_pid, uap->addr, uap->len); + p->p_pid, SCARG(uap, addr), SCARG(uap, len)); #endif - if (((int)uap->addr & PAGE_MASK) || uap->addr + uap->len < uap->addr) + if (((int)SCARG(uap, addr) & PAGE_MASK) || + SCARG(uap, addr) + SCARG(uap, len) < SCARG(uap, addr)) return (EINVAL); map = &p->p_vmspace->vm_map; - addr = (vm_offset_t)uap->addr; - size = (vm_size_t)uap->len; + addr = (vm_offset_t)SCARG(uap, addr); + size = (vm_size_t)SCARG(uap, len); /* * XXX Gak! If size is zero we are supposed to sync "all modified * pages with the region containing addr". Unfortunately, we @@ -370,15 +377,14 @@ msync(p, uap, retval) return (0); } -struct munmap_args { - caddr_t addr; - int len; -}; int munmap(p, uap, retval) register struct proc *p; - register struct munmap_args *uap; - int *retval; + register struct munmap_args /* { + syscallarg(caddr_t) addr; + syscallarg(int) len; + } */ *uap; + register_t *retval; { vm_offset_t addr; vm_size_t size; @@ -387,13 +393,13 @@ munmap(p, uap, retval) #ifdef DEBUG if (mmapdebug & MDB_FOLLOW) printf("munmap(%d): addr %x len %x\n", - p->p_pid, uap->addr, uap->len); + p->p_pid, SCARG(uap, addr), SCARG(uap, len)); #endif - addr = (vm_offset_t) uap->addr; - if ((addr & PAGE_MASK) || uap->len < 0) + addr = (vm_offset_t) SCARG(uap, addr); + if ((addr & PAGE_MASK) || SCARG(uap, len) < 0) return(EINVAL); - size = (vm_size_t) round_page(uap->len); + size = (vm_size_t) round_page(SCARG(uap, len)); if (size == 0) return(0); /* @@ -433,16 +439,15 @@ munmapfd(p, fd) p->p_fd->fd_ofileflags[fd] &= ~UF_MAPPED; } -struct mprotect_args { - caddr_t addr; - int len; - int prot; -}; int mprotect(p, uap, retval) struct proc *p; - struct mprotect_args *uap; - int *retval; + struct mprotect_args /* { + syscallarg(caddr_t) addr; + syscallarg(int) len; + syscallarg(int) prot; + } */ *uap; + register_t *retval; { vm_offset_t addr; vm_size_t size; @@ -450,15 +455,15 @@ mprotect(p, uap, retval) #ifdef DEBUG if (mmapdebug & MDB_FOLLOW) - printf("mprotect(%d): addr %x len %x prot %d\n", - p->p_pid, uap->addr, uap->len, uap->prot); + printf("mprotect(%d): addr %x len %x prot %d\n", p->p_pid, + SCARG(uap, addr), SCARG(uap, len), SCARG(uap, prot)); #endif - addr = (vm_offset_t)uap->addr; - if ((addr & PAGE_MASK) || uap->len < 0) + addr = (vm_offset_t)SCARG(uap, addr); + if ((addr & PAGE_MASK) || SCARG(uap, len) < 0) return(EINVAL); - size = (vm_size_t)uap->len; - prot = uap->prot & VM_PROT_ALL; + size = (vm_size_t)SCARG(uap, len); + prot = SCARG(uap, prot) & VM_PROT_ALL; switch (vm_map_protect(&p->p_vmspace->vm_map, addr, addr+size, prot, FALSE)) { @@ -470,49 +475,46 @@ mprotect(p, uap, retval) return (EINVAL); } -struct madvise_args { - caddr_t addr; - int len; - int behav; -}; /* ARGSUSED */ int madvise(p, uap, retval) struct proc *p; - struct madvise_args *uap; - int *retval; + struct madvise_args /* { + syscallarg(caddr_t) addr; + syscallarg(int) len; + syscallarg(int) behav; + } */ *uap; + register_t *retval; { /* Not yet implemented */ return (EOPNOTSUPP); } -struct mincore_args { - caddr_t addr; - int len; - char *vec; -}; /* ARGSUSED */ int mincore(p, uap, retval) struct proc *p; - struct mincore_args *uap; - int *retval; + struct mincore_args /* { + syscallarg(caddr_t) addr; + syscallarg(int) len; + syscallarg(char *) vec; + } */ *uap; + register_t *retval; { /* Not yet implemented */ return (EOPNOTSUPP); } -struct mlock_args { - caddr_t addr; - size_t len; -}; int mlock(p, uap, retval) struct proc *p; - struct mlock_args *uap; - int *retval; + struct mlock_args /* { + syscallarg(caddr_t) addr; + syscallarg(size_t) len; + } */ *uap; + register_t *retval; { vm_offset_t addr; vm_size_t size; @@ -522,12 +524,13 @@ mlock(p, uap, retval) #ifdef DEBUG if (mmapdebug & MDB_FOLLOW) printf("mlock(%d): addr %x len %x\n", - p->p_pid, uap->addr, uap->len); + p->p_pid, SCARG(uap, addr), SCARG(uap, len)); #endif - addr = (vm_offset_t)uap->addr; - if ((addr & PAGE_MASK) || uap->addr + uap->len < uap->addr) + addr = (vm_offset_t)SCARG(uap, addr); + if ((addr & PAGE_MASK) || + SCARG(uap, addr) + SCARG(uap, len) < SCARG(uap, addr)) return (EINVAL); - size = round_page((vm_size_t)uap->len); + size = round_page((vm_size_t)SCARG(uap, len)); if (atop(size) + cnt.v_wire_count > vm_page_max_wired) return (EAGAIN); #ifdef pmap_wired_count @@ -543,15 +546,14 @@ mlock(p, uap, retval) return (error == KERN_SUCCESS ? 0 : ENOMEM); } -struct munlock_args { - caddr_t addr; - size_t len; -}; int munlock(p, uap, retval) struct proc *p; - struct munlock_args *uap; - int *retval; + struct munlock_args /* { + syscallarg(caddr_t) addr; + syscallarg(size_t) len; + } */ *uap; + register_t *retval; { vm_offset_t addr; vm_size_t size; @@ -560,16 +562,17 @@ munlock(p, uap, retval) #ifdef DEBUG if (mmapdebug & MDB_FOLLOW) printf("munlock(%d): addr %x len %x\n", - p->p_pid, uap->addr, uap->len); + p->p_pid, SCARG(uap, addr), SCARG(uap, len)); #endif - addr = (vm_offset_t)uap->addr; - if ((addr & PAGE_MASK) || uap->addr + uap->len < uap->addr) + addr = (vm_offset_t)SCARG(uap, addr); + if ((addr & PAGE_MASK) || + SCARG(uap, addr) + SCARG(uap, len) < SCARG(uap, addr)) return (EINVAL); #ifndef pmap_wired_count if (error = suser(p->p_ucred, &p->p_acflag)) return (error); #endif - size = round_page((vm_size_t)uap->len); + size = round_page((vm_size_t)SCARG(uap, len)); error = vm_map_pageable(&p->p_vmspace->vm_map, addr, addr+size, TRUE); return (error == KERN_SUCCESS ? 0 : ENOMEM); diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index 7aad8984d06c..494da6b1177c 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_swap.c,v 1.24 1994/07/21 07:12:13 mycroft Exp $ */ +/* $NetBSD: vm_swap.c,v 1.25 1994/10/20 04:27:32 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -46,6 +46,9 @@ #include #include +#include +#include + #include /* @@ -267,15 +270,14 @@ swstrategy(bp) * which must be in the swdevsw. Return EBUSY * if already swapping on this device. */ -struct swapon_args { - char *name; -}; /* ARGSUSED */ int swapon(p, uap, retval) struct proc *p; - struct swapon_args *uap; - int *retval; + struct swapon_args /* { + syscallarg(char *) name; + } */ *uap; + register_t *retval; { register struct vnode *vp; register struct swdevt *sp; @@ -285,7 +287,7 @@ swapon(p, uap, retval) if (error = suser(p->p_ucred, &p->p_acflag)) return (error); - NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->name, p); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, name), p); if (error = namei(&nd)) return (error); vp = nd.ni_vp; diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c index 9d8bff73c3ab..cc65c67a9136 100644 --- a/sys/vm/vm_unix.c +++ b/sys/vm/vm_unix.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_unix.c,v 1.13 1994/06/29 06:48:45 cgd Exp $ */ +/* $NetBSD: vm_unix.c,v 1.14 1994/10/20 04:27:33 cgd Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -52,17 +52,19 @@ #include #include +#include +#include + #include -struct obreak_args { - char *nsiz; -}; /* ARGSUSED */ int obreak(p, uap, retval) struct proc *p; - struct obreak_args *uap; - int *retval; + struct obreak_args /* { + syscallarg(char *) nsize; + } */ *uap; + register_t *retval; { register struct vmspace *vm = p->p_vmspace; vm_offset_t new, old; @@ -70,7 +72,7 @@ obreak(p, uap, retval) register int diff; old = (vm_offset_t)vm->vm_daddr; - new = round_page(uap->nsiz); + new = round_page(SCARG(uap, nsize)); if ((int)(new - old) > p->p_rlimit[RLIMIT_DATA].rlim_cur) return(ENOMEM); old = round_page(old + ctob(vm->vm_dsize)); @@ -126,15 +128,14 @@ grow(p, sp) return (1); } -struct ovadvise_args { - int anom; -}; /* ARGSUSED */ int ovadvise(p, uap, retval) struct proc *p; - struct ovadvise_args *uap; - int *retval; + struct ovadvise_args /* { + syscallarg(int) anom; + } */ *uap; + register_t *retval; { return (EINVAL); diff --git a/sys/vm/vm_user.c b/sys/vm/vm_user.c index b7d6453ec268..26d8730445e9 100644 --- a/sys/vm/vm_user.c +++ b/sys/vm/vm_user.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_user.c,v 1.10 1994/06/29 06:48:46 cgd Exp $ */ +/* $NetBSD: vm_user.c,v 1.11 1994/10/20 04:27:34 cgd Exp $ */ /* * Copyright (c) 1991, 1993 @@ -92,19 +92,21 @@ int svm_allocate(p, uap, retval) struct proc *p; struct svm_allocate_args *uap; - int *retval; + register_t *retval; { vm_offset_t addr; int rv; - uap->map = p->p_map; /* XXX */ + SCARG(uap, map) = p->p_map; /* XXX */ - if (copyin((caddr_t)uap->addr, (caddr_t)&addr, sizeof (addr))) + if (copyin((caddr_t)SCARG(uap, addr), (caddr_t)&addr, sizeof (addr))) rv = KERN_INVALID_ARGUMENT; else - rv = vm_allocate(uap->map, &addr, uap->size, uap->anywhere); + rv = vm_allocate(SCARG(uap, map), &addr, SCARG(uap, size), + SCARG(uap, anywhere)); if (rv == KERN_SUCCESS) { - if (copyout((caddr_t)&addr, (caddr_t)uap->addr, sizeof(addr))) + if (copyout((caddr_t)&addr, (caddr_t)SCARG(uap, addr), + sizeof(addr))) rv = KERN_INVALID_ARGUMENT; } return((int)rv); @@ -120,12 +122,12 @@ int svm_deallocate(p, uap, retval) struct proc *p; struct svm_deallocate_args *uap; - int *retval; + register_t *retval; { int rv; - uap->map = p->p_map; /* XXX */ - rv = vm_deallocate(uap->map, uap->addr, uap->size); + SCARG(uap, map) = p->p_map; /* XXX */ + rv = vm_deallocate(SCARG(uap, map), SCARG(uap, addr), SCARG(uap, size)); return((int)rv); } @@ -140,12 +142,13 @@ int svm_inherit(p, uap, retval) struct proc *p; struct svm_inherit_args *uap; - int *retval; + register_t *retval; { int rv; - uap->map = p->p_map; /* XXX */ - rv = vm_inherit(uap->map, uap->addr, uap->size, uap->inherit); + SCARG(uap, map) = p->p_map; /* XXX */ + rv = vm_inherit(SCARG(uap, map), SCARG(uap, addr), SCARG(uap, size), + SCARG(uap, inherit)); return((int)rv); } @@ -161,12 +164,13 @@ int svm_protect(p, uap, retval) struct proc *p; struct svm_protect_args *uap; - int *retval; + register_t *retval; { int rv; - uap->map = p->p_map; /* XXX */ - rv = vm_protect(uap->map, uap->addr, uap->size, uap->setmax, uap->prot); + SCARG(uap, map) = p->p_map; /* XXX */ + rv = vm_protect(SCARG(uap, map), SCARG(uap, addr), SCARG(uap, size), + SCARG(uap, setmax), SCARG(uap, prot)); return((int)rv); }