xref: /original-bsd/sys/kern/kern_xxx.c (revision 5656414f)
1 /*
2  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)kern_xxx.c	7.12 (Berkeley) 06/21/90
18  */
19 
20 #include "param.h"
21 #include "systm.h"
22 #include "syscontext.h"
23 #include "kernel.h"
24 #include "proc.h"
25 #include "reboot.h"
26 
27 /* ARGSUSED */
28 gethostid(p, uap, retval)
29 	struct proc *p;
30 	void *uap;
31 	long *retval;
32 {
33 
34 	*retval = hostid;
35 	RETURN (0);
36 }
37 
38 sethostid(p, uap, retval)
39 	struct proc *p;
40 	struct args {
41 		long	hostid;
42 	} *uap;
43 	int *retval;
44 {
45 	int error;
46 
47 	if (error = suser(u.u_cred, &u.u_acflag))
48 		RETURN (error);
49 	hostid = uap->hostid;
50 	RETURN (0);
51 }
52 
53 /* ARGSUSED */
54 gethostname(p, uap, retval)
55 	struct proc *p;
56 	struct args {
57 		char	*hostname;
58 		u_int	len;
59 	} *uap;
60 	int *retval;
61 {
62 
63 	if (uap->len > hostnamelen + 1)
64 		uap->len = hostnamelen + 1;
65 	RETURN (copyout((caddr_t)hostname, (caddr_t)uap->hostname, uap->len));
66 }
67 
68 /* ARGSUSED */
69 sethostname(p, uap, retval)
70 	struct proc *p;
71 	register struct args {
72 		char	*hostname;
73 		u_int	len;
74 	} *uap;
75 	int *retval;
76 {
77 	int error;
78 
79 	if (error = suser(u.u_cred, &u.u_acflag))
80 		RETURN (error);
81 	if (uap->len > sizeof (hostname) - 1)
82 		RETURN (EINVAL);
83 	hostnamelen = uap->len;
84 	error = copyin((caddr_t)uap->hostname, hostname, uap->len);
85 	hostname[hostnamelen] = 0;
86 	RETURN (error);
87 }
88 
89 /* ARGSUSED */
90 reboot(p, uap, retval)
91 	struct proc *p;
92 	struct args {
93 		int	opt;
94 	} *uap;
95 	int *retval;
96 {
97 	int error;
98 
99 	if (error = suser(u.u_cred, &u.u_acflag))
100 		RETURN (error);
101 	boot(uap->opt);
102 	RETURN (0);
103 }
104 
105 ovhangup()
106 {
107 
108 	RETURN (EINVAL);
109 }
110 
111 oldquota()
112 {
113 
114 	RETURN (EINVAL);
115 }
116