new argument passing conventions. minor type size cleanup.
authorChris G. Demetriou <cgd@ucbvax.Berkeley.EDU>
Wed, 15 Feb 1995 02:31:55 +0000 (18:31 -0800)
committerChris G. Demetriou <cgd@ucbvax.Berkeley.EDU>
Wed, 15 Feb 1995 02:31:55 +0000 (18:31 -0800)
SCCS-vsn: sys/kern/kern_descrip.c 8.8
SCCS-vsn: sys/kern/kern_fork.c 8.8
SCCS-vsn: sys/kern/kern_proc.c 8.7
SCCS-vsn: sys/kern/kern_subr.c 8.4
SCCS-vsn: sys/kern/kern_synch.c 8.8
SCCS-vsn: sys/kern/kern_time.c 8.3
SCCS-vsn: sys/kern/kern_xxx.c 8.3

usr/src/sys/kern/kern_descrip.c
usr/src/sys/kern/kern_fork.c
usr/src/sys/kern/kern_proc.c
usr/src/sys/kern/kern_subr.c
usr/src/sys/kern/kern_synch.c
usr/src/sys/kern/kern_time.c
usr/src/sys/kern/kern_xxx.c

index 1a31016..5b0920f 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_descrip.c      8.7 (Berkeley) %G%
+ *     @(#)kern_descrip.c      8.8 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -29,6 +29,9 @@
 #include <sys/unistd.h>
 #include <sys/resourcevar.h>
 
 #include <sys/unistd.h>
 #include <sys/resourcevar.h>
 
+#include <sys/mount.h>
+#include <sys/syscallargs.h>
+
 /*
  * Descriptor management.
  */
 /*
  * Descriptor management.
  */
@@ -38,14 +41,12 @@ int nfiles;                 /* actual number of open files */
 /*
  * System calls on descriptors.
  */
 /*
  * System calls on descriptors.
  */
-struct getdtablesize_args {
-       int     dummy;
-};
 /* ARGSUSED */
 /* ARGSUSED */
+int
 getdtablesize(p, uap, retval)
        struct proc *p;
 getdtablesize(p, uap, retval)
        struct proc *p;
-       struct getdtablesize_args *uap;
-       int *retval;
+       void *uap;
+       register_t *retval;
 {
 
        *retval = min((int)p->p_rlimit[RLIMIT_NOFILE].rlim_cur, maxfiles);
 {
 
        *retval = min((int)p->p_rlimit[RLIMIT_NOFILE].rlim_cur, maxfiles);
@@ -55,24 +56,27 @@ getdtablesize(p, uap, retval)
 /*
  * Duplicate a file descriptor.
  */
 /*
  * Duplicate a file descriptor.
  */
-struct dup_args {
-       u_int   fd;
-};
 /* ARGSUSED */
 /* ARGSUSED */
+int
 dup(p, uap, retval)
        struct proc *p;
 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;
 
 {
        register struct filedesc *fdp;
        u_int old;
        int new, error;
 
-       old = uap->fd;
+       old = SCARG(uap, fd);
        /*
         * XXX Compatibility
         */
        /*
         * 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)
 
        fdp = p->p_fd;
        if (old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL)
@@ -85,18 +89,18 @@ dup(p, uap, retval)
 /*
  * Duplicate a file descriptor to a particular value.
  */
 /*
  * Duplicate a file descriptor to a particular value.
  */
-struct dup2_args {
-       u_int   from;
-       u_int   to;
-};
 /* ARGSUSED */
 /* ARGSUSED */
+int
 dup2(p, uap, retval)
        struct proc *p;
 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 struct filedesc *fdp = p->p_fd;
-       register u_int old = uap->from, new = uap->to;
+       register int old = SCARG(uap, from), new = SCARG(uap, to);
        int i, error;
 
        if (old >= fdp->fd_nfiles ||
        int i, error;
 
        if (old >= fdp->fd_nfiles ||
@@ -127,17 +131,18 @@ dup2(p, uap, retval)
 /*
  * The file control system call.
  */
 /*
  * The file control system call.
  */
-struct fcntl_args {
-       int     fd;
-       int     cmd;
-       int     arg;
-};
 /* ARGSUSED */
 /* ARGSUSED */
+int
 fcntl(p, uap, retval)
        struct proc *p;
 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(void *) arg;
+       } */ *uap;
+       register_t *retval;
 {
 {
+       int fd = SCARG(uap, fd);
        register struct filedesc *fdp = p->p_fd;
        register struct file *fp;
        register char *pop;
        register struct filedesc *fdp = p->p_fd;
        register struct file *fp;
        register char *pop;
@@ -146,27 +151,27 @@ fcntl(p, uap, retval)
        struct flock fl;
        u_int newmin;
 
        struct flock fl;
        u_int newmin;
 
-       if ((unsigned)uap->fd >= fdp->fd_nfiles ||
-           (fp = fdp->fd_ofiles[uap->fd]) == NULL)
+       if ((u_int)fd >= fdp->fd_nfiles ||
+           (fp = fdp->fd_ofiles[fd]) == NULL)
                return (EBADF);
                return (EBADF);
-       pop = &fdp->fd_ofileflags[uap->fd];
-       switch (uap->cmd) {
+       pop = &fdp->fd_ofileflags[fd];
+       switch (SCARG(uap, cmd)) {
 
        case F_DUPFD:
 
        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);
                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, fd, i, retval));
 
        case F_GETFD:
                *retval = *pop & 1;
                return (0);
 
        case F_SETFD:
 
        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:
                return (0);
 
        case F_GETFL:
@@ -175,7 +180,7 @@ fcntl(p, uap, retval)
 
        case F_SETFL:
                fp->f_flag &= ~FCNTLFLAGS;
 
        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)
                tmp = fp->f_flag & FNONBLOCK;
                error = (*fp->f_ops->fo_ioctl)(fp, FIONBIO, (caddr_t)&tmp, p);
                if (error)
@@ -195,25 +200,26 @@ fcntl(p, uap, retval)
                        return (0);
                }
                error = (*fp->f_ops->fo_ioctl)
                        return (0);
                }
                error = (*fp->f_ops->fo_ioctl)
-                       (fp, (int)TIOCGPGRP, (caddr_t)retval, p);
+                       (fp, TIOCGPGRP, (caddr_t)retval, p);
                *retval = -*retval;
                return (error);
 
        case F_SETOWN:
                if (fp->f_type == DTYPE_SOCKET) {
                *retval = -*retval;
                return (error);
 
        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);
                }
                        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 {
                } else {
-                       struct proc *p1 = pfind(uap->arg);
+                       struct proc *p1 = pfind((long)SCARG(uap, arg));
                        if (p1 == 0)
                                return (ESRCH);
                        if (p1 == 0)
                                return (ESRCH);
-                       uap->arg = p1->p_pgrp->pg_id;
+                       SCARG(uap, arg) = (void *)(long)p1->p_pgrp->pg_id;
                }
                return ((*fp->f_ops->fo_ioctl)
                }
                return ((*fp->f_ops->fo_ioctl)
-                       (fp, (int)TIOCSPGRP, (caddr_t)&uap->arg, p));
+                       (fp, TIOCSPGRP, (caddr_t)&SCARG(uap, arg), p));
 
        case F_SETLKW:
                flg |= F_WAIT;
 
        case F_SETLKW:
                flg |= F_WAIT;
@@ -224,7 +230,8 @@ fcntl(p, uap, retval)
                        return (EBADF);
                vp = (struct vnode *)fp->f_data;
                /* Copy in the lock structure */
                        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)
                if (error)
                        return (error);
                if (fl.l_whence == SEEK_CUR)
@@ -256,14 +263,16 @@ fcntl(p, uap, retval)
                        return (EBADF);
                vp = (struct vnode *)fp->f_data;
                /* Copy in the lock structure */
                        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);
                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);
 
        default:
                return (EINVAL);
@@ -277,7 +286,8 @@ fcntl(p, uap, retval)
 int
 finishdup(fdp, old, new, retval)
        register struct filedesc *fdp;
 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;
 
 {
        register struct file *fp;
 
@@ -294,21 +304,21 @@ finishdup(fdp, old, new, retval)
 /*
  * Close a file descriptor.
  */
 /*
  * Close a file descriptor.
  */
-struct close_args {
-       int     fd;
-};
 /* ARGSUSED */
 /* ARGSUSED */
+int
 close(p, uap, retval)
        struct proc *p;
 close(p, uap, retval)
        struct proc *p;
-       struct close_args *uap;
-       int *retval;
+       struct close_args /* {
+               syscallarg(int) fd;
+       } */ *uap;
+       register_t *retval;
 {
 {
+       int fd = SCARG(uap, fd);
        register struct filedesc *fdp = p->p_fd;
        register struct file *fp;
        register struct filedesc *fdp = p->p_fd;
        register struct file *fp;
-       register int fd = uap->fd;
        register u_char *pf;
 
        register u_char *pf;
 
-       if ((unsigned)fd >= fdp->fd_nfiles ||
+       if ((u_int)fd >= fdp->fd_nfiles ||
            (fp = fdp->fd_ofiles[fd]) == NULL)
                return (EBADF);
        pf = (u_char *)&fdp->fd_ofileflags[fd];
            (fp = fdp->fd_ofiles[fd]) == NULL)
                return (EBADF);
        pf = (u_char *)&fdp->fd_ofileflags[fd];
@@ -327,24 +337,25 @@ close(p, uap, retval)
 /*
  * Return status information about a file descriptor.
  */
 /*
  * Return status information about a file descriptor.
  */
-struct ofstat_args {
-       int     fd;
-       struct  ostat *sb;
-};
 /* ARGSUSED */
 /* ARGSUSED */
-ofstat(p, uap, retval)
+int
+compat_43_fstat(p, uap, retval)
        struct proc *p;
        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;
 {
 {
+       int fd = SCARG(uap, fd);
        register struct filedesc *fdp = p->p_fd;
        register struct file *fp;
        struct stat ub;
        struct ostat oub;
        int error;
 
        register struct filedesc *fdp = p->p_fd;
        register struct file *fp;
        struct stat ub;
        struct ostat oub;
        int error;
 
-       if ((unsigned)uap->fd >= fdp->fd_nfiles ||
-           (fp = fdp->fd_ofiles[uap->fd]) == NULL)
+       if ((u_int)fd >= fdp->fd_nfiles ||
+           (fp = fdp->fd_ofiles[fd]) == NULL)
                return (EBADF);
        switch (fp->f_type) {
 
                return (EBADF);
        switch (fp->f_type) {
 
@@ -362,7 +373,8 @@ ofstat(p, uap, retval)
        }
        cvtstat(&ub, &oub);
        if (error == 0)
        }
        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 */
        return (error);
 }
 #endif /* COMPAT_43 || COMPAT_SUNOS */
@@ -370,23 +382,24 @@ ofstat(p, uap, retval)
 /*
  * Return status information about a file descriptor.
  */
 /*
  * Return status information about a file descriptor.
  */
-struct fstat_args {
-       int     fd;
-       struct  stat *sb;
-};
 /* ARGSUSED */
 /* ARGSUSED */
+int
 fstat(p, uap, retval)
        struct proc *p;
 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;
 {
 {
+       int fd = SCARG(uap, fd);
        register struct filedesc *fdp = p->p_fd;
        register struct file *fp;
        struct stat ub;
        int error;
 
        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 ((u_int)fd >= fdp->fd_nfiles ||
+           (fp = fdp->fd_ofiles[fd]) == NULL)
                return (EBADF);
        switch (fp->f_type) {
 
                return (EBADF);
        switch (fp->f_type) {
 
@@ -403,41 +416,43 @@ fstat(p, uap, retval)
                /*NOTREACHED*/
        }
        if (error == 0)
                /*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.
  */
        return (error);
 }
 
 /*
  * Return pathconf information about a file descriptor.
  */
-struct fpathconf_args {
-       int     fd;
-       int     name;
-};
 /* ARGSUSED */
 /* ARGSUSED */
+int
 fpathconf(p, uap, retval)
        struct proc *p;
 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;
 {
 {
+       int fd = SCARG(uap, fd);
        struct filedesc *fdp = p->p_fd;
        struct file *fp;
        struct vnode *vp;
 
        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 ((u_int)fd >= fdp->fd_nfiles ||
+           (fp = fdp->fd_ofiles[fd]) == NULL)
                return (EBADF);
        switch (fp->f_type) {
 
        case DTYPE_SOCKET:
                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);
 
        case DTYPE_VNODE:
                vp = (struct vnode *)fp->f_data;
                        return (EINVAL);
                *retval = PIPE_BUF;
                return (0);
 
        case DTYPE_VNODE:
                vp = (struct vnode *)fp->f_data;
-               return (VOP_PATHCONF(vp, uap->name, retval));
+               return (VOP_PATHCONF(vp, SCARG(uap, name), retval));
 
        default:
                panic("fpathconf");
 
        default:
                panic("fpathconf");
@@ -450,6 +465,7 @@ fpathconf(p, uap, retval)
  */
 int fdexpand;
 
  */
 int fdexpand;
 
+int
 fdalloc(p, want, result)
        struct proc *p;
        int want;
 fdalloc(p, want, result)
        struct proc *p;
        int want;
@@ -518,6 +534,7 @@ fdalloc(p, want, result)
  * Check to see whether n user file descriptors
  * are available to the process p.
  */
  * Check to see whether n user file descriptors
  * are available to the process p.
  */
+int
 fdavail(p, n)
        struct proc *p;
        register int n;
 fdavail(p, n)
        struct proc *p;
        register int n;
@@ -540,6 +557,7 @@ fdavail(p, n)
  * Create a new open file structure and allocate
  * a file decriptor for the process that refers to it.
  */
  * Create a new open file structure and allocate
  * a file decriptor for the process that refers to it.
  */
+int
 falloc(p, resultfp, resultfd)
        register struct proc *p;
        struct file **resultfp;
 falloc(p, resultfp, resultfd)
        register struct proc *p;
        struct file **resultfp;
@@ -582,6 +600,7 @@ falloc(p, resultfp, resultfd)
 /*
  * Free a file descriptor.
  */
 /*
  * Free a file descriptor.
  */
+void
 ffree(fp)
        register struct file *fp;
 {
 ffree(fp)
        register struct file *fp;
 {
@@ -680,6 +699,7 @@ fdfree(p)
  * Note: p may be NULL when closing a file
  * that was being passed in a message.
  */
  * Note: p may be NULL when closing a file
  * that was being passed in a message.
  */
+int
 closef(fp, p)
        register struct file *fp;
        register struct proc *p;
 closef(fp, p)
        register struct file *fp;
        register struct proc *p;
@@ -732,23 +752,25 @@ 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).
  */
  * 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 */
 /* ARGSUSED */
+int
 flock(p, uap, retval)
        struct proc *p;
 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;
 {
 {
+       int fd = SCARG(uap, fd);
+       int how = SCARG(uap, how);
        register struct filedesc *fdp = p->p_fd;
        register struct file *fp;
        struct vnode *vp;
        struct flock lf;
 
        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 ((u_int)fd >= fdp->fd_nfiles ||
+           (fp = fdp->fd_ofiles[fd]) == NULL)
                return (EBADF);
        if (fp->f_type != DTYPE_VNODE)
                return (EOPNOTSUPP);
                return (EBADF);
        if (fp->f_type != DTYPE_VNODE)
                return (EOPNOTSUPP);
@@ -756,19 +778,19 @@ flock(p, uap, retval)
        lf.l_whence = SEEK_SET;
        lf.l_start = 0;
        lf.l_len = 0;
        lf.l_whence = SEEK_SET;
        lf.l_start = 0;
        lf.l_len = 0;
-       if (uap->how & LOCK_UN) {
+       if (how & LOCK_UN) {
                lf.l_type = F_UNLCK;
                fp->f_flag &= ~FHASLOCK;
                return (VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK));
        }
                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 (how & LOCK_EX)
                lf.l_type = F_WRLCK;
                lf.l_type = F_WRLCK;
-       else if (uap->how & LOCK_SH)
+       else if (how & LOCK_SH)
                lf.l_type = F_RDLCK;
        else
                return (EBADF);
        fp->f_flag |= FHASLOCK;
                lf.l_type = F_RDLCK;
        else
                return (EBADF);
        fp->f_flag |= FHASLOCK;
-       if (uap->how & LOCK_NB)
+       if (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));
 }
                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));
 }
@@ -782,6 +804,7 @@ flock(p, uap, retval)
  * references to this file will be direct to the other driver.
  */
 /* ARGSUSED */
  * references to this file will be direct to the other driver.
  */
 /* ARGSUSED */
+int
 fdopen(dev, mode, type, p)
        dev_t dev;
        int mode, type;
 fdopen(dev, mode, type, p)
        dev_t dev;
        int mode, type;
@@ -803,6 +826,7 @@ fdopen(dev, mode, type, p)
 /*
  * Duplicate the specified descriptor to a free descriptor.
  */
 /*
  * Duplicate the specified descriptor to a free descriptor.
  */
+int
 dupfdopen(fdp, indx, dfd, mode, error)
        register struct filedesc *fdp;
        register int indx, dfd;
 dupfdopen(fdp, indx, dfd, mode, error)
        register struct filedesc *fdp;
        register int indx, dfd;
@@ -811,7 +835,7 @@ dupfdopen(fdp, indx, dfd, mode, error)
 {
        register struct file *wfp;
        struct file *fp;
 {
        register struct file *wfp;
        struct file *fp;
-       
+
        /*
         * If the to-be-dup'd fd number is greater than the allowed number
         * of file descriptors, or the fd to be dup'd has already been
        /*
         * If the to-be-dup'd fd number is greater than the allowed number
         * of file descriptors, or the fd to be dup'd has already been
index af3252a..d4f373d 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_fork.c 8.7 (Berkeley) %G%
+ *     @(#)kern_fork.c 8.8 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
 #include <sys/acct.h>
 #include <sys/ktrace.h>
 
 #include <sys/acct.h>
 #include <sys/ktrace.h>
 
-struct fork_args {
-       int     dummy;
-};
 /* ARGSUSED */
 fork(p, uap, retval)
        struct proc *p;
 /* ARGSUSED */
 fork(p, uap, retval)
        struct proc *p;
-       struct fork_args *uap;
-       int retval[];
+       void *uap;
+       register_t *retval;
 {
 
        return (fork1(p, 0, retval));
 {
 
        return (fork1(p, 0, retval));
@@ -41,8 +38,8 @@ fork(p, uap, retval)
 /* ARGSUSED */
 vfork(p, uap, retval)
        struct proc *p;
 /* ARGSUSED */
 vfork(p, uap, retval)
        struct proc *p;
-       struct fork_args *uap;
-       int retval[];
+       void *uap;
+       register_t *retval;
 {
 
        return (fork1(p, 1, retval));
 {
 
        return (fork1(p, 1, retval));
@@ -52,7 +49,8 @@ int   nprocs = 1;             /* process 0 */
 
 fork1(p1, isvfork, retval)
        register struct proc *p1;
 
 fork1(p1, isvfork, retval)
        register struct proc *p1;
-       int isvfork, retval[];
+       int isvfork;
+       register_t *retval;
 {
        register struct proc *p2;
        register uid_t uid;
 {
        register struct proc *p2;
        register uid_t uid;
@@ -73,6 +71,7 @@ fork1(p1, isvfork, retval)
                tablefull("proc");
                return (EAGAIN);
        }
                tablefull("proc");
                return (EAGAIN);
        }
+
        /*
         * Increment the count of procs running with this uid. Don't allow
         * a nonprivileged user to exceed their current limit.
        /*
         * Increment the count of procs running with this uid. Don't allow
         * a nonprivileged user to exceed their current limit.
@@ -132,7 +131,6 @@ again:
                }
        }
 
                }
        }
 
-
        nprocs++;
        p2 = newproc;
        p2->p_stat = SIDL;                      /* protect against others */
        nprocs++;
        p2 = newproc;
        p2->p_stat = SIDL;                      /* protect against others */
index a07c1b2..670db5f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_proc.c 8.6 (Berkeley) %G%
+ *     @(#)kern_proc.c 8.7 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -144,13 +144,13 @@ pgfind(pgid)
 /*
  * Move p to a new or existing process group (and session)
  */
 /*
  * Move p to a new or existing process group (and session)
  */
+int
 enterpgrp(p, pgid, mksess)
        register struct proc *p;
        pid_t pgid;
        int mksess;
 {
        register struct pgrp *pgrp = pgfind(pgid);
 enterpgrp(p, pgid, mksess)
        register struct proc *p;
        pid_t pgid;
        int mksess;
 {
        register struct pgrp *pgrp = pgfind(pgid);
-       int n;
 
 #ifdef DIAGNOSTIC
        if (pgrp != NULL && mksess)     /* firewalls */
 
 #ifdef DIAGNOSTIC
        if (pgrp != NULL && mksess)     /* firewalls */
@@ -222,6 +222,7 @@ enterpgrp(p, pgid, mksess)
 /*
  * remove process from process group
  */
 /*
  * remove process from process group
  */
+int
 leavepgrp(p)
        register struct proc *p;
 {
 leavepgrp(p)
        register struct proc *p;
 {
index 0a36636..531d00c 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_subr.c 8.3 (Berkeley) %G%
+ *     @(#)kern_subr.c 8.4 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -18,6 +18,7 @@
 #include <sys/malloc.h>
 #include <sys/queue.h>
 
 #include <sys/malloc.h>
 #include <sys/queue.h>
 
+int
 uiomove(cp, n, uio)
        register caddr_t cp;
        register int n;
 uiomove(cp, n, uio)
        register caddr_t cp;
        register int n;
@@ -75,17 +76,20 @@ uiomove(cp, n, uio)
 /*
  * Give next character to user as result of read.
  */
 /*
  * Give next character to user as result of read.
  */
+int
 ureadc(c, uio)
        register int c;
        register struct uio *uio;
 {
        register struct iovec *iov;
 
 ureadc(c, uio)
        register int c;
        register struct uio *uio;
 {
        register struct iovec *iov;
 
+       if (uio->uio_resid <= 0)
+               panic("ureadc: non-positive resid");
 again:
 again:
-       if (uio->uio_iovcnt == 0 || uio->uio_resid == 0)
-               panic("ureadc");
+       if (uio->uio_iovcnt <= 0)
+               panic("ureadc: non-positive iovcnt");
        iov = uio->uio_iov;
        iov = uio->uio_iov;
-       if (iov->iov_len == 0) {
+       if (iov->iov_len <= 0) {
                uio->uio_iovcnt--;
                uio->uio_iov++;
                goto again;
                uio->uio_iovcnt--;
                uio->uio_iov++;
                goto again;
@@ -117,6 +121,7 @@ again:
 /*
  * Get next character written in by user from uio.
  */
 /*
  * Get next character written in by user from uio.
  */
+int
 uwritec(uio)
        struct uio *uio;
 {
 uwritec(uio)
        struct uio *uio;
 {
@@ -127,7 +132,7 @@ uwritec(uio)
                return (-1);
 again:
        if (uio->uio_iovcnt <= 0)
                return (-1);
 again:
        if (uio->uio_iovcnt <= 0)
-               panic("uwritec");
+               panic("uwritec: non-positive iovcnt");
        iov = uio->uio_iov;
        if (iov->iov_len == 0) {
                uio->uio_iov++;
        iov = uio->uio_iov;
        if (iov->iov_len == 0) {
                uio->uio_iov++;
index bdf5338..88002a0 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_synch.c        8.7 (Berkeley) %G%
+ *     @(#)kern_synch.c        8.8 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -223,7 +223,7 @@ updatepri(p)
  * of 2.  Shift right by 8, i.e. drop the bottom 256 worth.
  */
 #define TABLESIZE      128
  * of 2.  Shift right by 8, i.e. drop the bottom 256 worth.
  */
 #define TABLESIZE      128
-#define LOOKUP(x)      (((int)(x) >> 8) & (TABLESIZE - 1))
+#define LOOKUP(x)      (((long)(x) >> 8) & (TABLESIZE - 1))
 struct slpque {
        struct proc *sq_head;
        struct proc **sq_tailp;
 struct slpque {
        struct proc *sq_head;
        struct proc **sq_tailp;
@@ -574,6 +574,7 @@ mi_switch()
  * Initialize the (doubly-linked) run queues
  * to be empty.
  */
  * Initialize the (doubly-linked) run queues
  * to be empty.
  */
+void
 rqinit()
 {
        register int i;
 rqinit()
 {
        register int i;
index 4dc818c..0e797d0 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_time.c 8.2 (Berkeley) %G%
+ *     @(#)kern_time.c 8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -14,6 +14,9 @@
 #include <sys/proc.h>
 #include <sys/vnode.h>
 
 #include <sys/proc.h>
 #include <sys/vnode.h>
 
+#include <sys/mount.h>
+#include <sys/syscallargs.h>
+
 
 /* 
  * Time of day and interval timer support.
 
 /* 
  * Time of day and interval timer support.
  * timers when they expire.
  */
 
  * timers when they expire.
  */
 
-struct gettimeofday_args {
-       struct  timeval *tp;
-       struct  timezone *tzp;
-};
 /* ARGSUSED */
 /* ARGSUSED */
+int
 gettimeofday(p, uap, retval)
        struct proc *p;
 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;
 
 {
        struct timeval atv;
        int error = 0;
 
-       if (uap->tp) {
+       if (SCARG(uap, tp)) {
                microtime(&atv);
                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);
        }
                    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);
 }
 
                    sizeof (tz));
        return (error);
 }
 
-struct settimeofday_args {
-       struct  timeval *tv;
-       struct  timezone *tzp;
-};
 /* ARGSUSED */
 /* ARGSUSED */
+int
 settimeofday(p, uap, retval)
        struct proc *p;
 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;
 {
        struct timeval atv, delta;
        struct timezone atz;
@@ -67,13 +70,13 @@ settimeofday(p, uap, retval)
        if (error = suser(p->p_ucred, &p->p_acflag))
                return (error);
        /* Verify all parameters before changing time. */
        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);
                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);
                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 */
                /* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */
                s = splclock();
                /* nb. delta.tv_usec may be < 0, but this is OK here */
@@ -91,7 +94,7 @@ settimeofday(p, uap, retval)
                splx(s);
                resettodr();
        }
                splx(s);
                resettodr();
        }
-       if (uap->tzp)
+       if (SCARG(uap, tzp))
                tz = atz;
        return (0);
 }
                tz = atz;
        return (0);
 }
@@ -101,15 +104,15 @@ int       tickdelta;                      /* current clock skew, us. per tick */
 long   timedelta;                      /* unapplied time correction, us. */
 long   bigadj = 1000000;               /* use 10x skew above bigadj us. */
 
 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 */
 /* ARGSUSED */
+int
 adjtime(p, uap, retval)
        struct proc *p;
 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;
 {
        struct timeval atv;
        register long ndelta, ntickdelta, odelta;
@@ -117,8 +120,8 @@ adjtime(p, uap, retval)
 
        if (error = suser(p->p_ucred, &p->p_acflag))
                return (error);
 
        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);
 
        /*
                return (error);
 
        /*
@@ -149,10 +152,10 @@ adjtime(p, uap, retval)
        tickdelta = ntickdelta;
        splx(s);
 
        tickdelta = ntickdelta;
        splx(s);
 
-       if (uap->olddelta) {
+       if (SCARG(uap, olddelta)) {
                atv.tv_sec = odelta / 1000000;
                atv.tv_usec = odelta % 1000000;
                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);
                    sizeof(struct timeval));
        }
        return (0);
@@ -179,25 +182,25 @@ adjtime(p, uap, retval)
  * real time timers .it_interval.  Rather, we compute the next time in
  * absolute time the timer should go off.
  */
  * 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 */
 /* ARGSUSED */
+int
 getitimer(p, uap, retval)
        struct proc *p;
 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;
 
 {
        struct itimerval aitv;
        int s;
 
-       if (uap->which > ITIMER_PROF)
+       if (SCARG(uap, which) > ITIMER_PROF)
                return (EINVAL);
        s = splclock();
                return (EINVAL);
        s = splclock();
-       if (uap->which == ITIMER_REAL) {
+       if (SCARG(uap, which) == ITIMER_REAL) {
                /*
                /*
-                * Convert from absoulte to relative time in .it_value
+                * Convert from absolute to relative time in .it_value
                 * part of real time timer.  If time for real time timer
                 * has passed return 0, else return difference between
                 * current time and time for the timer to go off.
                 * part of real time timer.  If time for real time timer
                 * has passed return 0, else return difference between
                 * current time and time for the timer to go off.
@@ -210,40 +213,42 @@ getitimer(p, uap, retval)
                                timevalsub(&aitv.it_value,
                                    (struct timeval *)&time);
        } else
                                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);
        splx(s);
-       return (copyout((caddr_t)&aitv, (caddr_t)uap->itv,
+       return (copyout((caddr_t)&aitv, (caddr_t)SCARG(uap, itv),
            sizeof (struct itimerval)));
 }
 
            sizeof (struct itimerval)));
 }
 
-struct setitimer_args {
-       u_int   which;
-       struct  itimerval *itv, *oitv;
-};
 /* ARGSUSED */
 /* ARGSUSED */
+int
 setitimer(p, uap, retval)
        struct proc *p;
 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;
 
 {
        struct itimerval aitv;
        register struct itimerval *itvp;
        int s, error;
 
-       if (uap->which > ITIMER_PROF)
+       if (SCARG(uap, which) > ITIMER_PROF)
                return (EINVAL);
                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 (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();
                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, (caddr_t)p);
                if (timerisset(&aitv.it_value)) {
                        timevaladd(&aitv.it_value, (struct timeval *)&time);
                untimeout(realitexpire, (caddr_t)p);
                if (timerisset(&aitv.it_value)) {
                        timevaladd(&aitv.it_value, (struct timeval *)&time);
@@ -251,7 +256,7 @@ setitimer(p, uap, retval)
                }
                p->p_realtimer = aitv;
        } else
                }
                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);
 }
        splx(s);
        return (0);
 }
@@ -297,6 +302,7 @@ realitexpire(arg)
  * fix it to have at least minimal value (i.e. if it is less
  * than the resolution of the clock, round it up.)
  */
  * fix it to have at least minimal value (i.e. if it is less
  * than the resolution of the clock, round it up.)
  */
+int
 itimerfix(tv)
        struct timeval *tv;
 {
 itimerfix(tv)
        struct timeval *tv;
 {
@@ -319,6 +325,7 @@ itimerfix(tv)
  * that it is called in a context where the timers
  * on which it is operating cannot change in value.
  */
  * that it is called in a context where the timers
  * on which it is operating cannot change in value.
  */
+int
 itimerdecr(itp, usec)
        register struct itimerval *itp;
        int usec;
 itimerdecr(itp, usec)
        register struct itimerval *itp;
        int usec;
index 4703638..eb4b48b 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_xxx.c  8.2 (Berkeley) %G%
+ *     @(#)kern_xxx.c  8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
 #include <vm/vm.h>
 #include <sys/sysctl.h>
 
 #include <vm/vm.h>
 #include <sys/sysctl.h>
 
-struct reboot_args {
-       int     opt;
-};
+#include <sys/mount.h>
+#include <sys/syscallargs.h>
+
 /* ARGSUSED */
 /* ARGSUSED */
+int
 reboot(p, uap, retval)
        struct proc *p;
 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);
 {
        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)
 
        return (0);
 }
 
 #if defined(COMPAT_43) || defined(COMPAT_SUNOS)
 
-struct gethostname_args {
-       char    *hostname;
-       u_int   len;
-};
 /* ARGSUSED */
 /* ARGSUSED */
-ogethostname(p, uap, retval)
+int
+compat_43_gethostname(p, uap, retval)
        struct proc *p;
        struct proc *p;
-       struct gethostname_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;
 {
        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 sethostname_args {
-       char    *hostname;
-       u_int   len;
-};
 /* ARGSUSED */
 /* ARGSUSED */
-osethostname(p, uap, retval)
+int
+compat_43_sethostname(p, uap, retval)
        struct proc *p;
        struct proc *p;
-       register struct sethostname_args *uap;
-       int *retval;
+       register struct compat_43_sethostname_args /* {
+               syscallarg(char *) hostname;
+               syscallarg(u_int) len;
+       } */ *uap;
+       register_t *retval;
 {
        int name;
        int error;
 {
        int name;
        int error;
@@ -66,41 +70,42 @@ osethostname(p, uap, retval)
        if (error = suser(p->p_ucred, &p->p_acflag))
                return (error);
        name = KERN_HOSTNAME;
        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)));
 }
 
 }
 
-extern long hostid;
-
-struct gethostid_args {
-       int     dummy;
-};
 /* ARGSUSED */
 /* ARGSUSED */
-ogethostid(p, uap, retval)
+int
+compat_43_gethostid(p, uap, retval)
        struct proc *p;
        struct proc *p;
-       struct gethostid_args *uap;
-       int *retval;
+       void *uap;
+       register_t *retval;
 {
 
 {
 
-       *(long *)retval = hostid;
+       *(int32_t *)retval = hostid;
        return (0);
 }
 #endif /* COMPAT_43 || COMPAT_SUNOS */
 
 #ifdef COMPAT_43
        return (0);
 }
 #endif /* COMPAT_43 || COMPAT_SUNOS */
 
 #ifdef COMPAT_43
-struct sethostid_args {
-       long    hostid;
-};
 /* ARGSUSED */
 /* ARGSUSED */
-osethostid(p, uap, retval)
+int
+compat_43_sethostid(p, uap, retval)
        struct proc *p;
        struct proc *p;
-       struct sethostid_args *uap;
-       int *retval;
+       struct compat_43_sethostid_args /* {
+               syscallarg(int32_t) hostid;
+       } */ *uap;
+       register_t *retval;
 {
        int error;
 
 }
 
 {
        int error;
 
 }
 
-oquota()
+int
+compat_43_quota(p, uap, retval)
+       struct proc *p;
+       void *uap;
+       register_t *retval;
 {
 
        return (ENOSYS);
 {
 
        return (ENOSYS);