Deleted Added
full compact
kern_xxx.c (12200) kern_xxx.c (12221)
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)kern_xxx.c 8.2 (Berkeley) 11/14/93
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)kern_xxx.c 8.2 (Berkeley) 11/14/93
34 * $Id: kern_xxx.c,v 1.15 1995/11/09 20:22:12 phk Exp $
34 * $Id: kern_xxx.c,v 1.16 1995/11/11 01:04:42 bde Exp $
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/sysproto.h>
39#include <sys/kernel.h>
40#include <sys/proc.h>
41#include <sys/reboot.h>
42#include <vm/vm.h>
43#include <sys/sysctl.h>
44#include <sys/utsname.h>
45#include <sys/signalvar.h>
46
47/* This implements a "TEXT_SET" for cleanup functions */
48
49static void
50dummy_cleanup() {}
51TEXT_SET(cleanup_set, dummy_cleanup);
52
53typedef void (*cleanup_func_t)(void);
54extern const struct linker_set cleanup_set;
55static const cleanup_func_t *cleanups =
56 (const cleanup_func_t *)&cleanup_set.ls_items[0];
57
40#include <sys/kernel.h>
41#include <sys/proc.h>
42#include <sys/reboot.h>
43#include <vm/vm.h>
44#include <sys/sysctl.h>
45#include <sys/utsname.h>
46#include <sys/signalvar.h>
47
48/* This implements a "TEXT_SET" for cleanup functions */
49
50static void
51dummy_cleanup() {}
52TEXT_SET(cleanup_set, dummy_cleanup);
53
54typedef void (*cleanup_func_t)(void);
55extern const struct linker_set cleanup_set;
56static const cleanup_func_t *cleanups =
57 (const cleanup_func_t *)&cleanup_set.ls_items[0];
58
59#ifndef _SYS_SYSPROTO_H_
58struct reboot_args {
59 int opt;
60};
60struct reboot_args {
61 int opt;
62};
63#endif
61/* ARGSUSED */
62int
63reboot(p, uap, retval)
64 struct proc *p;
65 struct reboot_args *uap;
66 int *retval;
67{
68 int error;

--- 9 unchanged lines hidden (view full) ---

78 }
79
80 boot(uap->opt);
81 return (0);
82}
83
84#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
85
64/* ARGSUSED */
65int
66reboot(p, uap, retval)
67 struct proc *p;
68 struct reboot_args *uap;
69 int *retval;
70{
71 int error;

--- 9 unchanged lines hidden (view full) ---

81 }
82
83 boot(uap->opt);
84 return (0);
85}
86
87#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
88
89#ifndef _SYS_SYSPROTO_H_
86struct gethostname_args {
87 char *hostname;
88 u_int len;
89};
90struct gethostname_args {
91 char *hostname;
92 u_int len;
93};
94#endif
90/* ARGSUSED */
91int
92ogethostname(p, uap, retval)
93 struct proc *p;
94 struct gethostname_args *uap;
95 int *retval;
96{
97 int name[2];
98
99 name[0] = CTL_KERN;
100 name[1] = KERN_HOSTNAME;
101 return (userland_sysctl(p, name, 2, uap->hostname, &uap->len,
102 1, 0, 0, 0));
103}
104
95/* ARGSUSED */
96int
97ogethostname(p, uap, retval)
98 struct proc *p;
99 struct gethostname_args *uap;
100 int *retval;
101{
102 int name[2];
103
104 name[0] = CTL_KERN;
105 name[1] = KERN_HOSTNAME;
106 return (userland_sysctl(p, name, 2, uap->hostname, &uap->len,
107 1, 0, 0, 0));
108}
109
110#ifndef _SYS_SYSPROTO_H_
105struct sethostname_args {
106 char *hostname;
107 u_int len;
108};
111struct sethostname_args {
112 char *hostname;
113 u_int len;
114};
115#endif
109/* ARGSUSED */
110int
111osethostname(p, uap, retval)
112 struct proc *p;
113 register struct sethostname_args *uap;
114 int *retval;
115{
116 int name[2];
117 int error;
118
119 name[0] = CTL_KERN;
120 name[1] = KERN_HOSTNAME;
121 if ((error = suser(p->p_ucred, &p->p_acflag)))
122 return (error);
123 return (userland_sysctl(p, name, 2, 0, 0, 0,
124 uap->hostname, uap->len, 0));
125}
126
116/* ARGSUSED */
117int
118osethostname(p, uap, retval)
119 struct proc *p;
120 register struct sethostname_args *uap;
121 int *retval;
122{
123 int name[2];
124 int error;
125
126 name[0] = CTL_KERN;
127 name[1] = KERN_HOSTNAME;
128 if ((error = suser(p->p_ucred, &p->p_acflag)))
129 return (error);
130 return (userland_sysctl(p, name, 2, 0, 0, 0,
131 uap->hostname, uap->len, 0));
132}
133
134#ifndef _SYS_SYSPROTO_H_
127struct ogethostid_args {
128 int dummy;
129};
135struct ogethostid_args {
136 int dummy;
137};
138#endif
130/* ARGSUSED */
131int
132ogethostid(p, uap, retval)
133 struct proc *p;
134 struct ogethostid_args *uap;
135 int *retval;
136{
137
138 *(long *)retval = hostid;
139 return (0);
140}
141#endif /* COMPAT_43 || COMPAT_SUNOS */
142
143#ifdef COMPAT_43
139/* ARGSUSED */
140int
141ogethostid(p, uap, retval)
142 struct proc *p;
143 struct ogethostid_args *uap;
144 int *retval;
145{
146
147 *(long *)retval = hostid;
148 return (0);
149}
150#endif /* COMPAT_43 || COMPAT_SUNOS */
151
152#ifdef COMPAT_43
153#ifndef _SYS_SYSPROTO_H_
144struct osethostid_args {
145 long hostid;
146};
154struct osethostid_args {
155 long hostid;
156};
157#endif
147/* ARGSUSED */
148int
149osethostid(p, uap, retval)
150 struct proc *p;
151 struct osethostid_args *uap;
152 int *retval;
153{
154 int error;

--- 24 unchanged lines hidden (view full) ---

179 } else {
180 /* No init(8) running, so simply reboot */
181 boot(RB_NOSYNC);
182 }
183 return;
184}
185
186
158/* ARGSUSED */
159int
160osethostid(p, uap, retval)
161 struct proc *p;
162 struct osethostid_args *uap;
163 int *retval;
164{
165 int error;

--- 24 unchanged lines hidden (view full) ---

190 } else {
191 /* No init(8) running, so simply reboot */
192 boot(RB_NOSYNC);
193 }
194 return;
195}
196
197
198#ifndef _SYS_SYSPROTO_H_
187struct uname_args {
188 struct utsname *name;
189};
199struct uname_args {
200 struct utsname *name;
201};
202#endif
190
191/* ARGSUSED */
192int
193uname(p, uap, retval)
194 struct proc *p;
195 struct uname_args *uap;
196 int *retval;
197{

--- 50 unchanged lines hidden (view full) ---

248 rtval = userland_sysctl(p, name, 2, uap->name->machine, &len,
249 1, 0, 0, 0);
250 if( rtval) return rtval;
251 subyte( uap->name->machine + sizeof(uap->name->machine) - 1, 0);
252
253 return 0;
254}
255
203
204/* ARGSUSED */
205int
206uname(p, uap, retval)
207 struct proc *p;
208 struct uname_args *uap;
209 int *retval;
210{

--- 50 unchanged lines hidden (view full) ---

261 rtval = userland_sysctl(p, name, 2, uap->name->machine, &len,
262 1, 0, 0, 0);
263 if( rtval) return rtval;
264 subyte( uap->name->machine + sizeof(uap->name->machine) - 1, 0);
265
266 return 0;
267}
268
269#ifndef _SYS_SYSPROTO_H_
256struct getdomainname_args {
257 char *domainname;
258 u_int len;
259};
260
270struct getdomainname_args {
271 char *domainname;
272 u_int len;
273};
274
275#endif
261/* ARGSUSED */
262int
263getdomainname(p, uap, retval)
264 struct proc *p;
265 struct getdomainname_args *uap;
266 int *retval;
267{
268 if (uap->len > domainnamelen + 1)
269 uap->len = domainnamelen + 1;
270 return (copyout((caddr_t)domainname, (caddr_t)uap->domainname, uap->len));
271}
272
276/* ARGSUSED */
277int
278getdomainname(p, uap, retval)
279 struct proc *p;
280 struct getdomainname_args *uap;
281 int *retval;
282{
283 if (uap->len > domainnamelen + 1)
284 uap->len = domainnamelen + 1;
285 return (copyout((caddr_t)domainname, (caddr_t)uap->domainname, uap->len));
286}
287
288#ifndef _SYS_SYSPROTO_H_
273struct setdomainname_args {
274 char *domainname;
275 u_int len;
276};
289struct setdomainname_args {
290 char *domainname;
291 u_int len;
292};
293#endif
277
278/* ARGSUSED */
279int
280setdomainname(p, uap, retval)
281 struct proc *p;
282 struct setdomainname_args *uap;
283 int *retval;
284{

--- 12 unchanged lines hidden ---
294
295/* ARGSUSED */
296int
297setdomainname(p, uap, retval)
298 struct proc *p;
299 struct setdomainname_args *uap;
300 int *retval;
301{

--- 12 unchanged lines hidden ---