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