xref: /original-bsd/sys/kern/kern_xxx.c (revision f51da917)
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.2 (Berkeley) 11/14/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 	int error;
65 
66 	if (error = suser(p->p_ucred, &p->p_acflag))
67 		return (error);
68 	name = KERN_HOSTNAME;
69 	return (kern_sysctl(&name, 1, 0, 0, uap->hostname, uap->len));
70 }
71 
72 extern long hostid;
73 
74 struct gethostid_args {
75 	int	dummy;
76 };
77 /* ARGSUSED */
78 ogethostid(p, uap, retval)
79 	struct proc *p;
80 	struct gethostid_args *uap;
81 	int *retval;
82 {
83 
84 	*(long *)retval = hostid;
85 	return (0);
86 }
87 #endif /* COMPAT_43 || COMPAT_SUNOS */
88 
89 #ifdef COMPAT_43
90 struct sethostid_args {
91 	long	hostid;
92 };
93 /* ARGSUSED */
94 osethostid(p, uap, retval)
95 	struct proc *p;
96 	struct sethostid_args *uap;
97 	int *retval;
98 {
99 	int error;
100 
101 	if (error = suser(p->p_ucred, &p->p_acflag))
102 		return (error);
103 	hostid = uap->hostid;
104 	return (0);
105 }
106 
107 oquota()
108 {
109 
110 	return (ENOSYS);
111 }
112 #endif /* COMPAT_43 */
113