xref: /original-bsd/sys/kern/kern_xxx.c (revision 3705696b)
1 /*
2  * Copyright (c) 1982, 1986, 1989, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)kern_xxx.c	8.1 (Berkeley) 06/10/93
8  */
9 
10 #include <sys/param.h>
11 #include <sys/systm.h>
12 #include <sys/kernel.h>
13 #include <sys/proc.h>
14 #include <sys/reboot.h>
15 #include <vm/vm.h>
16 #include <sys/sysctl.h>
17 
18 struct reboot_args {
19 	int	opt;
20 };
21 /* ARGSUSED */
22 reboot(p, uap, retval)
23 	struct proc *p;
24 	struct reboot_args *uap;
25 	int *retval;
26 {
27 	int error;
28 
29 	if (error = suser(p->p_ucred, &p->p_acflag))
30 		return (error);
31 	boot(uap->opt);
32 	return (0);
33 }
34 
35 #if defined(COMPAT_43) || defined(COMPAT_SUNOS)
36 
37 struct gethostname_args {
38 	char	*hostname;
39 	u_int	len;
40 };
41 /* ARGSUSED */
42 ogethostname(p, uap, retval)
43 	struct proc *p;
44 	struct gethostname_args *uap;
45 	int *retval;
46 {
47 	int name;
48 
49 	name = KERN_HOSTNAME;
50 	return (kern_sysctl(&name, 1, uap->hostname, &uap->len, 0, 0));
51 }
52 
53 struct sethostname_args {
54 	char	*hostname;
55 	u_int	len;
56 };
57 /* ARGSUSED */
58 osethostname(p, uap, retval)
59 	struct proc *p;
60 	register struct sethostname_args *uap;
61 	int *retval;
62 {
63 	int name;
64 
65 	name = KERN_HOSTNAME;
66 	return (kern_sysctl(&name, 1, 0, 0, uap->hostname, uap->len));
67 }
68 
69 extern long hostid;
70 
71 struct gethostid_args {
72 	int	dummy;
73 };
74 /* ARGSUSED */
75 ogethostid(p, uap, retval)
76 	struct proc *p;
77 	struct gethostid_args *uap;
78 	int *retval;
79 {
80 
81 	*(long *)retval = hostid;
82 	return (0);
83 }
84 #endif /* COMPAT_43 || COMPAT_SUNOS */
85 
86 #ifdef COMPAT_43
87 struct sethostid_args {
88 	long	hostid;
89 };
90 /* ARGSUSED */
91 osethostid(p, uap, retval)
92 	struct proc *p;
93 	struct sethostid_args *uap;
94 	int *retval;
95 {
96 	int error;
97 
98 	if (error = suser(p->p_ucred, &p->p_acflag))
99 		return (error);
100 	hostid = uap->hostid;
101 	return (0);
102 }
103 
104 oquota()
105 {
106 
107 	return (ENOSYS);
108 }
109 #endif /* COMPAT_43 */
110