xref: /original-bsd/sys/kern/kern_xxx.c (revision d9657196)
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.23 (Berkeley) 04/05/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 #if defined(COMPAT_43) || defined(COMPAT_SUNOS)
35 
36 struct gethostname_args {
37 	char	*hostname;
38 	u_int	len;
39 };
40 /* ARGSUSED */
41 ogethostname(p, uap, retval)
42 	struct proc *p;
43 	struct gethostname_args *uap;
44 	int *retval;
45 {
46 	int name;
47 
48 	name = KERN_HOSTNAME;
49 	return (kern_sysctl(&name, 1, uap->hostname, &uap->len, 0, 0));
50 }
51 
52 struct sethostname_args {
53 	char	*hostname;
54 	u_int	len;
55 };
56 /* ARGSUSED */
57 osethostname(p, uap, retval)
58 	struct proc *p;
59 	register struct sethostname_args *uap;
60 	int *retval;
61 {
62 	int name;
63 
64 	name = KERN_HOSTNAME;
65 	return (kern_sysctl(&name, 1, 0, 0, uap->hostname, uap->len));
66 }
67 
68 extern long hostid;
69 
70 struct gethostid_args {
71 	int	dummy;
72 };
73 /* ARGSUSED */
74 ogethostid(p, uap, retval)
75 	struct proc *p;
76 	struct gethostid_args *uap;
77 	int *retval;
78 {
79 
80 	*(long *)retval = hostid;
81 	return (0);
82 }
83 #endif /* COMPAT_43 || COMPAT_SUNOS */
84 
85 #ifdef COMPAT_43
86 struct sethostid_args {
87 	long	hostid;
88 };
89 /* ARGSUSED */
90 osethostid(p, uap, retval)
91 	struct proc *p;
92 	struct sethostid_args *uap;
93 	int *retval;
94 {
95 	int error;
96 
97 	if (error = suser(p->p_ucred, &p->p_acflag))
98 		return (error);
99 	hostid = uap->hostid;
100 	return (0);
101 }
102 
103 oquota()
104 {
105 
106 	return (ENOSYS);
107 }
108 #endif /* COMPAT_43 */
109