xref: /original-bsd/sys/kern/kern_xxx.c (revision 27393bdf)
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.3 (Berkeley) 02/14/95
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 #include <sys/mount.h>
19 #include <sys/syscallargs.h>
20 
21 /* ARGSUSED */
22 int
23 reboot(p, uap, retval)
24 	struct proc *p;
25 	struct reboot_args /* {
26 		syscallarg(int) opt;
27 	} */ *uap;
28 	register_t *retval;
29 {
30 	int error;
31 
32 	if (error = suser(p->p_ucred, &p->p_acflag))
33 		return (error);
34 	boot(SCARG(uap, opt));
35 	return (0);
36 }
37 
38 #if defined(COMPAT_43) || defined(COMPAT_SUNOS)
39 
40 /* ARGSUSED */
41 int
42 compat_43_gethostname(p, uap, retval)
43 	struct proc *p;
44 	struct compat_43_gethostname_args /* {
45 		syscallarg(char *) hostname;
46 		syscallarg(u_int) len;
47 	} */ *uap;
48 	register_t *retval;
49 {
50 	int name;
51 
52 	name = KERN_HOSTNAME;
53 	return (kern_sysctl(&name, 1, SCARG(uap, hostname), &SCARG(uap, len),
54 	    0, 0));
55 }
56 
57 /* ARGSUSED */
58 int
59 compat_43_sethostname(p, uap, retval)
60 	struct proc *p;
61 	register struct compat_43_sethostname_args /* {
62 		syscallarg(char *) hostname;
63 		syscallarg(u_int) len;
64 	} */ *uap;
65 	register_t *retval;
66 {
67 	int name;
68 	int error;
69 
70 	if (error = suser(p->p_ucred, &p->p_acflag))
71 		return (error);
72 	name = KERN_HOSTNAME;
73 	return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, hostname),
74 	    SCARG(uap, len)));
75 }
76 
77 /* ARGSUSED */
78 int
79 compat_43_gethostid(p, uap, retval)
80 	struct proc *p;
81 	void *uap;
82 	register_t *retval;
83 {
84 
85 	*(int32_t *)retval = hostid;
86 	return (0);
87 }
88 #endif /* COMPAT_43 || COMPAT_SUNOS */
89 
90 #ifdef COMPAT_43
91 /* ARGSUSED */
92 int
93 compat_43_sethostid(p, uap, retval)
94 	struct proc *p;
95 	struct compat_43_sethostid_args /* {
96 		syscallarg(int32_t) hostid;
97 	} */ *uap;
98 	register_t *retval;
99 {
100 	int error;
101 
102 	if (error = suser(p->p_ucred, &p->p_acflag))
103 		return (error);
104 	hostid = SCARG(uap, hostid);
105 	return (0);
106 }
107 
108 int
109 compat_43_quota(p, uap, retval)
110 	struct proc *p;
111 	void *uap;
112 	register_t *retval;
113 {
114 
115 	return (ENOSYS);
116 }
117 #endif /* COMPAT_43 */
118