xref: /netbsd-src/sys/compat/netbsd32/netbsd32_compat_09.c (revision 3b01aba77a7a698587faaae455bbfe740923c1f5)
1 /*	$NetBSD: netbsd32_compat_09.c,v 1.6 2000/11/30 19:19:43 jdolecek Exp $	*/
2 
3 /*
4  * Copyright (c) 1998 Matthew R. Green
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. The name of the author may not be used to endorse or promote products
16  *    derived from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGE.
29  */
30 
31 #include <sys/param.h>
32 #include <sys/systm.h>
33 #include <sys/mount.h>
34 #include <sys/syscallargs.h>
35 
36 #include <sys/time.h>
37 #include <uvm/uvm_extern.h>
38 #include <sys/sysctl.h>
39 
40 #include <compat/netbsd32/netbsd32.h>
41 #include <compat/netbsd32/netbsd32_syscallargs.h>
42 
43 int
44 compat_09_netbsd32_ogetdomainname(p, v, retval)
45 	struct proc *p;
46 	void *v;
47 	register_t *retval;
48 {
49 	struct compat_09_netbsd32_ogetdomainname_args /* {
50 		syscallarg(netbsd32_charp) domainname;
51 		syscallarg(int) len;
52 	} */ *uap = v;
53 	int name;
54 	size_t sz;
55 
56 	name = KERN_DOMAINNAME;
57 	sz = SCARG(uap, len);
58 	return (kern_sysctl(&name, 1, (char *)(u_long)SCARG(uap, domainname), &sz, 0, 0, p));
59 }
60 
61 int
62 compat_09_netbsd32_osetdomainname(p, v, retval)
63 	struct proc *p;
64 	void *v;
65 	register_t *retval;
66 {
67 	struct compat_09_netbsd32_osetdomainname_args /* {
68 		syscallarg(netbsd32_charp) domainname;
69 		syscallarg(int) len;
70 	} */ *uap = v;
71 	int name;
72 	int error;
73 
74 	if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
75 		return (error);
76 	name = KERN_DOMAINNAME;
77 	return (kern_sysctl(&name, 1, 0, 0, (char *)(u_long)SCARG(uap, domainname),
78 			    SCARG(uap, len), p));
79 }
80 
81 int
82 compat_09_netbsd32_uname(p, v, retval)
83 	struct proc *p;
84 	void *v;
85 	register_t *retval;
86 {
87 	struct compat_09_netbsd32_uname_args /* {
88 		syscallarg(netbsd32_outsnamep_t) name;
89 	} */ *uap = v;
90 	struct compat_09_sys_uname_args ua;
91 
92 	NETBSD32TOP_UAP(name, struct outsname);
93 	return (compat_09_sys_uname(p, &ua, retval));
94 }
95