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