convert VOP_UNLOCK and vrele into vput's; add proc parameter to union_dircache
[unix-history] / usr / src / sys / kern / kern_xxx.c
index d4c30ca..eb4b48b 100644 (file)
@@ -1,10 +1,10 @@
 /*
 /*
- * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_xxx.c  7.20 (Berkeley) %G%
+ *     @(#)kern_xxx.c  8.3 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
 #include <sys/reboot.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
 #include <sys/reboot.h>
+#include <vm/vm.h>
+#include <sys/sysctl.h>
 
 
-char   hostname[MAXHOSTNAMELEN];
-int    hostnamelen;
-long   hostid;
+#include <sys/mount.h>
+#include <sys/syscallargs.h>
 
 
-struct gethostid_args {
-       int     dummy;
-};
 /* ARGSUSED */
 /* ARGSUSED */
-gethostid(p, uap, retval)
+int
+reboot(p, uap, retval)
        struct proc *p;
        struct proc *p;
-       struct gethostid_args *uap;
-       int *retval;
+       struct reboot_args /* {
+               syscallarg(int) opt;
+       } */ *uap;
+       register_t *retval;
 {
 {
+       int error;
 
 
-       *(long *)retval = hostid;
+       if (error = suser(p->p_ucred, &p->p_acflag))
+               return (error);
+       boot(SCARG(uap, opt));
        return (0);
 }
 
        return (0);
 }
 
-struct sethostid_args {
-       long    hostid;
-};
+#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
+
 /* ARGSUSED */
 /* ARGSUSED */
-sethostid(p, uap, retval)
+int
+compat_43_gethostname(p, uap, retval)
        struct proc *p;
        struct proc *p;
-       struct sethostid_args *uap;
-       int *retval;
+       struct compat_43_gethostname_args /* {
+               syscallarg(char *) hostname;
+               syscallarg(u_int) len;
+       } */ *uap;
+       register_t *retval;
 {
 {
-       int error;
+       int name;
 
 
+       name = KERN_HOSTNAME;
+       return (kern_sysctl(&name, 1, SCARG(uap, hostname), &SCARG(uap, len),
+           0, 0));
 }
 
 }
 
-struct gethostname_args {
-       char    *hostname;
-       u_int   len;
-};
 /* ARGSUSED */
 /* ARGSUSED */
-gethostname(p, uap, retval)
+int
+compat_43_sethostname(p, uap, retval)
        struct proc *p;
        struct proc *p;
-       struct gethostname_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;
 
 
-       if (uap->len > hostnamelen + 1)
-               uap->len = hostnamelen + 1;
-       return (copyout((caddr_t)hostname, (caddr_t)uap->hostname, uap->len));
+       if (error = suser(p->p_ucred, &p->p_acflag))
+               return (error);
+       name = KERN_HOSTNAME;
+       return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, hostname),
+           SCARG(uap, len)));
 }
 
 }
 
-struct sethostname_args {
-       char    *hostname;
-       u_int   len;
-};
 /* ARGSUSED */
 /* ARGSUSED */
-sethostname(p, uap, retval)
+int
+compat_43_gethostid(p, uap, retval)
        struct proc *p;
        struct proc *p;
-       register struct sethostname_args *uap;
-       int *retval;
+       void *uap;
+       register_t *retval;
 {
 {
-       int error;
 
 
-       if (error = suser(p->p_ucred, &p->p_acflag))
-               return (error);
-       if (uap->len > sizeof (hostname) - 1)
-               return (EINVAL);
-       hostnamelen = uap->len;
-       error = copyin((caddr_t)uap->hostname, hostname, uap->len);
-       hostname[hostnamelen] = 0;
-       return (error);
+       *(int32_t *)retval = hostid;
+       return (0);
 }
 }
+#endif /* COMPAT_43 || COMPAT_SUNOS */
 
 
-struct reboot_args {
-       int     opt;
-};
+#ifdef COMPAT_43
 /* ARGSUSED */
 /* ARGSUSED */
-reboot(p, uap, retval)
+int
+compat_43_sethostid(p, uap, retval)
        struct proc *p;
        struct proc *p;
-       struct reboot_args *uap;
-       int *retval;
+       struct compat_43_sethostid_args /* {
+               syscallarg(int32_t) hostid;
+       } */ *uap;
+       register_t *retval;
 {
        int error;
 
 }
 
 {
        int error;
 
 }
 
-#ifdef COMPAT_43
-oquota()
+int
+compat_43_quota(p, uap, retval)
+       struct proc *p;
+       void *uap;
+       register_t *retval;
 {
 
        return (ENOSYS);
 }
 {
 
        return (ENOSYS);
 }
-#endif
+#endif /* COMPAT_43 */