xref: /original-bsd/sys/kern/kern_xxx.c (revision baf24c0d)
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.15 (Berkeley) 08/24/90
8  */
9 
10 #include "param.h"
11 #include "systm.h"
12 #include "user.h"
13 #include "kernel.h"
14 #include "proc.h"
15 #include "reboot.h"
16 
17 /* ARGSUSED */
18 gethostid(p, uap, retval)
19 	struct proc *p;
20 	void *uap;
21 	long *retval;
22 {
23 
24 	*retval = hostid;
25 	return (0);
26 }
27 
28 /* ARGSUSED */
29 sethostid(p, uap, retval)
30 	struct proc *p;
31 	struct args {
32 		long	hostid;
33 	} *uap;
34 	int *retval;
35 {
36 	int error;
37 
38 	if (error = suser(u.u_cred, &u.u_acflag))
39 		return (error);
40 	hostid = uap->hostid;
41 	return (0);
42 }
43 
44 /* ARGSUSED */
45 gethostname(p, uap, retval)
46 	struct proc *p;
47 	struct args {
48 		char	*hostname;
49 		u_int	len;
50 	} *uap;
51 	int *retval;
52 {
53 
54 	if (uap->len > hostnamelen + 1)
55 		uap->len = hostnamelen + 1;
56 	return (copyout((caddr_t)hostname, (caddr_t)uap->hostname, uap->len));
57 }
58 
59 /* ARGSUSED */
60 sethostname(p, uap, retval)
61 	struct proc *p;
62 	register struct args {
63 		char	*hostname;
64 		u_int	len;
65 	} *uap;
66 	int *retval;
67 {
68 	int error;
69 
70 	if (error = suser(u.u_cred, &u.u_acflag))
71 		return (error);
72 	if (uap->len > sizeof (hostname) - 1)
73 		return (EINVAL);
74 	hostnamelen = uap->len;
75 	error = copyin((caddr_t)uap->hostname, hostname, uap->len);
76 	hostname[hostnamelen] = 0;
77 	return (error);
78 }
79 
80 /* ARGSUSED */
81 reboot(p, uap, retval)
82 	struct proc *p;
83 	struct args {
84 		int	opt;
85 	} *uap;
86 	int *retval;
87 {
88 	int error;
89 
90 	if (error = suser(u.u_cred, &u.u_acflag))
91 		return (error);
92 	boot(uap->opt);
93 	return (0);
94 }
95 
96 ovhangup()
97 {
98 
99 	return (EINVAL);
100 }
101 
102 oldquota()
103 {
104 
105 	return (EINVAL);
106 }
107