Mon Dec 24 20:44:39 2018 UTC ()
move rlimit and quota code into their own modules.

(netbsd32_netbsd.c should have only simple shims.  anything more
than copying arguments from one args struct to the other should
not be placed in this file.  still a couple more to move out.)


(mrg)
diff -r1.39 -r1.40 src/sys/compat/netbsd32/files.netbsd32
diff -r1.220 -r1.221 src/sys/compat/netbsd32/netbsd32_netbsd.c
diff -r0 -r1.1 src/sys/compat/netbsd32/netbsd32_quota.c
diff -r0 -r1.1 src/sys/compat/netbsd32/netbsd32_rlimit.c

cvs diff -r1.39 -r1.40 src/sys/compat/netbsd32/files.netbsd32 (switch to unified diff)

--- src/sys/compat/netbsd32/files.netbsd32 2016/10/19 09:44:01 1.39
+++ src/sys/compat/netbsd32/files.netbsd32 2018/12/24 20:44:39 1.40
@@ -1,46 +1,48 @@ @@ -1,46 +1,48 @@
1# $NetBSD: files.netbsd32,v 1.39 2016/10/19 09:44:01 skrll Exp $ 1# $NetBSD: files.netbsd32,v 1.40 2018/12/24 20:44:39 mrg Exp $
2# 2#
3# config file description for machine-independent netbsd32 compat code. 3# config file description for machine-independent netbsd32 compat code.
4# included by ports that need it. 4# included by ports that need it.
5 5
6# ports should define any machine-specific files they need in their 6# ports should define any machine-specific files they need in their
7# own file lists. 7# own file lists.
8 8
9define compat_netbsd32 9define compat_netbsd32
10file compat/netbsd32/netbsd32_core.c compat_netbsd32 & coredump 10file compat/netbsd32/netbsd32_core.c compat_netbsd32 & coredump
11file compat/netbsd32/netbsd32_exec_elf32.c compat_netbsd32 & exec_elf32 11file compat/netbsd32/netbsd32_exec_elf32.c compat_netbsd32 & exec_elf32
12file compat/netbsd32/netbsd32_exec_aout.c compat_netbsd32 & exec_aout 12file compat/netbsd32/netbsd32_exec_aout.c compat_netbsd32 & exec_aout
13file compat/netbsd32/netbsd32_netbsd.c compat_netbsd32 13file compat/netbsd32/netbsd32_netbsd.c compat_netbsd32
14file compat/netbsd32/netbsd32_event.c compat_netbsd32 14file compat/netbsd32/netbsd32_event.c compat_netbsd32
15file compat/netbsd32/netbsd32_execve.c compat_netbsd32 15file compat/netbsd32/netbsd32_execve.c compat_netbsd32
16file compat/netbsd32/netbsd32_fs.c compat_netbsd32 16file compat/netbsd32/netbsd32_fs.c compat_netbsd32
17file compat/netbsd32/netbsd32_ioctl.c compat_netbsd32 17file compat/netbsd32/netbsd32_ioctl.c compat_netbsd32
18file compat/netbsd32/netbsd32_ipc.c compat_netbsd32 18file compat/netbsd32/netbsd32_ipc.c compat_netbsd32
19file compat/netbsd32/netbsd32_lwp.c compat_netbsd32 19file compat/netbsd32/netbsd32_lwp.c compat_netbsd32
20file compat/netbsd32/netbsd32_module.c compat_netbsd32 20file compat/netbsd32/netbsd32_module.c compat_netbsd32
21file compat/netbsd32/netbsd32_mod.c compat_netbsd32 21file compat/netbsd32/netbsd32_mod.c compat_netbsd32
22file compat/netbsd32/netbsd32_mqueue.c compat_netbsd32 & mqueue 22file compat/netbsd32/netbsd32_mqueue.c compat_netbsd32 & mqueue
23file compat/netbsd32/netbsd32_nfssvc.c compat_netbsd32 & nfsserver 23file compat/netbsd32/netbsd32_nfssvc.c compat_netbsd32 & nfsserver
24file compat/netbsd32/netbsd32_ptrace.c compat_netbsd32 & ptrace 24file compat/netbsd32/netbsd32_ptrace.c compat_netbsd32 & ptrace
 25file compat/netbsd32/netbsd32_rlimit.c compat_netbsd32
 26file compat/netbsd32/netbsd32_quota.c compat_netbsd32 & quota
25file compat/netbsd32/netbsd32_select.c compat_netbsd32 27file compat/netbsd32/netbsd32_select.c compat_netbsd32
26file compat/netbsd32/netbsd32_sem.c compat_netbsd32 28file compat/netbsd32/netbsd32_sem.c compat_netbsd32
27file compat/netbsd32/netbsd32_signal.c compat_netbsd32 29file compat/netbsd32/netbsd32_signal.c compat_netbsd32
28file compat/netbsd32/netbsd32_socket.c compat_netbsd32 30file compat/netbsd32/netbsd32_socket.c compat_netbsd32
29file compat/netbsd32/netbsd32_sysctl.c compat_netbsd32 31file compat/netbsd32/netbsd32_sysctl.c compat_netbsd32
30file compat/netbsd32/netbsd32_time.c compat_netbsd32 32file compat/netbsd32/netbsd32_time.c compat_netbsd32
31file compat/netbsd32/netbsd32_wait.c compat_netbsd32 33file compat/netbsd32/netbsd32_wait.c compat_netbsd32
32file compat/netbsd32/netbsd32_sysent.c compat_netbsd32 34file compat/netbsd32/netbsd32_sysent.c compat_netbsd32
33file compat/netbsd32/netbsd32_syscalls.c compat_netbsd32 & syscall_debug 35file compat/netbsd32/netbsd32_syscalls.c compat_netbsd32 & syscall_debug
34 36
35file compat/netbsd32/netbsd32_compat_09.c compat_netbsd32 & (compat_09 | compat_sunos) 37file compat/netbsd32/netbsd32_compat_09.c compat_netbsd32 & (compat_09 | compat_sunos)
36file compat/netbsd32/netbsd32_compat_10.c compat_netbsd32 & (compat_10 | compat_sunos) 38file compat/netbsd32/netbsd32_compat_10.c compat_netbsd32 & (compat_10 | compat_sunos)
37file compat/netbsd32/netbsd32_compat_12.c compat_netbsd32 & (compat_12 | compat_sunos) 39file compat/netbsd32/netbsd32_compat_12.c compat_netbsd32 & (compat_12 | compat_sunos)
38file compat/netbsd32/netbsd32_compat_13.c compat_netbsd32 & compat_13 40file compat/netbsd32/netbsd32_compat_13.c compat_netbsd32 & compat_13
39file compat/netbsd32/netbsd32_compat_14.c compat_netbsd32 & compat_14 41file compat/netbsd32/netbsd32_compat_14.c compat_netbsd32 & compat_14
40file compat/netbsd32/netbsd32_compat_20.c compat_netbsd32 & compat_20 42file compat/netbsd32/netbsd32_compat_20.c compat_netbsd32 & compat_20
41file compat/netbsd32/netbsd32_compat_30.c compat_netbsd32 & compat_30 43file compat/netbsd32/netbsd32_compat_30.c compat_netbsd32 & compat_30
42file compat/netbsd32/netbsd32_compat_43.c compat_netbsd32 & (compat_43 | compat_sunos | compat_linux32) 44file compat/netbsd32/netbsd32_compat_43.c compat_netbsd32 & (compat_43 | compat_sunos | compat_linux32)
43file compat/netbsd32/netbsd32_compat_50.c compat_netbsd32 & compat_50 45file compat/netbsd32/netbsd32_compat_50.c compat_netbsd32 & compat_50
44file compat/netbsd32/netbsd32_compat_50_sysv.c compat_netbsd32 & compat_50 & 46file compat/netbsd32/netbsd32_compat_50_sysv.c compat_netbsd32 & compat_50 &
45 (sysvmsg | sysvsem | sysvshm) 47 (sysvmsg | sysvsem | sysvshm)
46file compat/netbsd32/netbsd32_compat_60.c compat_netbsd32 & compat_60 48file compat/netbsd32/netbsd32_compat_60.c compat_netbsd32 & compat_60

cvs diff -r1.220 -r1.221 src/sys/compat/netbsd32/netbsd32_netbsd.c (switch to unified diff)

--- src/sys/compat/netbsd32/netbsd32_netbsd.c 2018/12/24 20:39:17 1.220
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c 2018/12/24 20:44:39 1.221
@@ -1,2992 +1,2793 @@ @@ -1,2992 +1,2793 @@
1/* $NetBSD: netbsd32_netbsd.c,v 1.220 2018/12/24 20:39:17 mrg Exp $ */ 1/* $NetBSD: netbsd32_netbsd.c,v 1.221 2018/12/24 20:44:39 mrg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green 4 * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.220 2018/12/24 20:39:17 mrg Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.221 2018/12/24 20:44:39 mrg Exp $");
 31
 32/*
 33 * below are all the standard NetBSD system calls, in the 32bit
 34 * environment, with the necessary conversions to 64bit before calling
 35 * the real syscall. anything that needs special attention is handled
 36 * elsewhere - this file should only contain structure assignment and
 37 * calls to the original function.
 38 */
31 39
32/* 40/*
33 * below are all the standard NetBSD system calls, in the 32bit 41 * below are all the standard NetBSD system calls, in the 32bit
34 * environment, with the necessary conversions to 64bit before calling 42 * environment, with the necessary conversions to 64bit before calling
35 * the real syscall. anything that needs special attention is handled 43 * the real syscall. anything that needs special attention is handled
36 * elsewhere - this file should only contain structure assignment and 44 * elsewhere - this file should only contain structure assignment and
37 * calls to the original function. 45 * calls to the original function.
38 */ 46 */
39 47
40#if defined(_KERNEL_OPT) 48#if defined(_KERNEL_OPT)
41#include "opt_ddb.h" 49#include "opt_ddb.h"
42#include "opt_ntp.h" 50#include "opt_ntp.h"
43#include "opt_ktrace.h" 51#include "opt_ktrace.h"
44#include "opt_compat_netbsd.h" 52#include "opt_compat_netbsd.h"
45#include "opt_compat_43.h" 53#include "opt_compat_43.h"
46#include "opt_sysv.h" 54#include "opt_sysv.h"
47#include "opt_syscall_debug.h" 55#include "opt_syscall_debug.h"
48#endif 56#endif
49 57
50#include <sys/param.h> 58#include <sys/param.h>
51#include <sys/systm.h> 59#include <sys/systm.h>
52#include <sys/kernel.h> 60#include <sys/kernel.h>
53#include <sys/mount.h> 61#include <sys/mount.h>
54#include <sys/socket.h> 62#include <sys/socket.h>
55#include <sys/sockio.h> 63#include <sys/sockio.h>
56#include <sys/socketvar.h> 64#include <sys/socketvar.h>
57#include <sys/mbuf.h> 65#include <sys/mbuf.h>
58#include <sys/mman.h> 66#include <sys/mman.h>
59#include <sys/stat.h> 67#include <sys/stat.h>
60#include <sys/swap.h> 68#include <sys/swap.h>
61#include <sys/time.h> 69#include <sys/time.h>
62#include <sys/signalvar.h> 70#include <sys/signalvar.h>
63#include <sys/ptrace.h> 71#include <sys/ptrace.h>
64#include <sys/ktrace.h> 72#include <sys/ktrace.h>
65#include <sys/trace.h> 73#include <sys/trace.h>
66#include <sys/resourcevar.h> 74#include <sys/resourcevar.h>
67#include <sys/pool.h> 75#include <sys/pool.h>
68#include <sys/vnode.h> 76#include <sys/vnode.h>
69#include <sys/file.h> 77#include <sys/file.h>
70#include <sys/filedesc.h> 78#include <sys/filedesc.h>
71#include <sys/namei.h> 79#include <sys/namei.h>
72#include <sys/dirent.h> 80#include <sys/dirent.h>
73#include <sys/quotactl.h> 81#include <sys/quotactl.h>
74#include <sys/kauth.h> 82#include <sys/kauth.h>
75#include <sys/vfs_syscalls.h> 83#include <sys/vfs_syscalls.h>
76 84
77#include <uvm/uvm_extern.h> 85#include <uvm/uvm_extern.h>
78#include <uvm/uvm_swap.h> 86#include <uvm/uvm_swap.h>
79 87
80#include <sys/syscallargs.h> 88#include <sys/syscallargs.h>
81#include <sys/proc.h> 89#include <sys/proc.h>
82#include <sys/acct.h> 90#include <sys/acct.h>
83#include <sys/exec.h> 91#include <sys/exec.h>
84 92
85#include <net/if.h> 93#include <net/if.h>
86 94
87#include <compat/netbsd32/netbsd32.h> 95#include <compat/netbsd32/netbsd32.h>
88#include <compat/netbsd32/netbsd32_exec.h> 96#include <compat/netbsd32/netbsd32_exec.h>
89#include <compat/netbsd32/netbsd32_syscall.h> 97#include <compat/netbsd32/netbsd32_syscall.h>
90#include <compat/netbsd32/netbsd32_syscallargs.h> 98#include <compat/netbsd32/netbsd32_syscallargs.h>
91#include <compat/netbsd32/netbsd32_conv.h> 99#include <compat/netbsd32/netbsd32_conv.h>
92 100
93#include <compat/sys/mman.h> 101#include <compat/sys/mman.h>
94 102
95#if defined(DDB) 103#if defined(DDB)
96#include <ddb/ddbvar.h> 104#include <ddb/ddbvar.h>
97#endif 105#endif
98 106
99extern struct sysent netbsd32_sysent[]; 107extern struct sysent netbsd32_sysent[];
100extern const uint32_t netbsd32_sysent_nomodbits[]; 108extern const uint32_t netbsd32_sysent_nomodbits[];
101#ifdef SYSCALL_DEBUG 109#ifdef SYSCALL_DEBUG
102extern const char * const netbsd32_syscallnames[]; 110extern const char * const netbsd32_syscallnames[];
103#endif 111#endif
104#ifdef __HAVE_SYSCALL_INTERN 112#ifdef __HAVE_SYSCALL_INTERN
105void netbsd32_syscall_intern(struct proc *); 113void netbsd32_syscall_intern(struct proc *);
106#else 114#else
107void syscall(void); 115void syscall(void);
108#endif 116#endif
109 117
110#define LIMITCHECK(a, b) ((a) != RLIM_INFINITY && (a) > (b)) 118#define LIMITCHECK(a, b) ((a) != RLIM_INFINITY && (a) > (b))
111 119
112#ifdef COMPAT_16 120#ifdef COMPAT_16
113extern char netbsd32_sigcode[], netbsd32_esigcode[]; 121extern char netbsd32_sigcode[], netbsd32_esigcode[];
114struct uvm_object *emul_netbsd32_object; 122struct uvm_object *emul_netbsd32_object;
115#endif 123#endif
116 124
117extern struct sysctlnode netbsd32_sysctl_root; 125extern struct sysctlnode netbsd32_sysctl_root;
118 126
119#ifdef MODULAR 127#ifdef MODULAR
120#include <compat/netbsd32/netbsd32_syscalls_autoload.c> 128#include <compat/netbsd32/netbsd32_syscalls_autoload.c>
121#endif 129#endif
122 130
123struct emul emul_netbsd32 = { 131struct emul emul_netbsd32 = {
124 .e_name = "netbsd32", 132 .e_name = "netbsd32",
125 .e_path = "/emul/netbsd32", 133 .e_path = "/emul/netbsd32",
126#ifndef __HAVE_MINIMAL_EMUL 134#ifndef __HAVE_MINIMAL_EMUL
127 .e_flags = 0, 135 .e_flags = 0,
128 .e_errno = NULL, 136 .e_errno = NULL,
129 .e_nosys = NETBSD32_SYS_netbsd32_syscall, 137 .e_nosys = NETBSD32_SYS_netbsd32_syscall,
130 .e_nsysent = NETBSD32_SYS_NSYSENT, 138 .e_nsysent = NETBSD32_SYS_NSYSENT,
131#endif 139#endif
132 .e_sysent = netbsd32_sysent, 140 .e_sysent = netbsd32_sysent,
133 .e_nomodbits = netbsd32_sysent_nomodbits, 141 .e_nomodbits = netbsd32_sysent_nomodbits,
134#ifdef SYSCALL_DEBUG 142#ifdef SYSCALL_DEBUG
135 .e_syscallnames = netbsd32_syscallnames, 143 .e_syscallnames = netbsd32_syscallnames,
136#else 144#else
137 .e_syscallnames = NULL, 145 .e_syscallnames = NULL,
138#endif 146#endif
139#ifdef MODULAR 147#ifdef MODULAR
140 .e_sc_autoload = netbsd32_syscalls_autoload, 148 .e_sc_autoload = netbsd32_syscalls_autoload,
141#endif 149#endif
142 .e_sendsig = netbsd32_sendsig, 150 .e_sendsig = netbsd32_sendsig,
143 .e_trapsignal = trapsignal, 151 .e_trapsignal = trapsignal,
144#ifdef COMPAT_16 152#ifdef COMPAT_16
145 .e_sigcode = netbsd32_sigcode, 153 .e_sigcode = netbsd32_sigcode,
146 .e_esigcode = netbsd32_esigcode, 154 .e_esigcode = netbsd32_esigcode,
147 .e_sigobject = &emul_netbsd32_object, 155 .e_sigobject = &emul_netbsd32_object,
148#else 156#else
149 .e_sigcode = NULL, 157 .e_sigcode = NULL,
150 .e_esigcode = NULL, 158 .e_esigcode = NULL,
151 .e_sigobject = NULL, 159 .e_sigobject = NULL,
152#endif 160#endif
153 .e_setregs = netbsd32_setregs, 161 .e_setregs = netbsd32_setregs,
154 .e_proc_exec = NULL, 162 .e_proc_exec = NULL,
155 .e_proc_fork = NULL, 163 .e_proc_fork = NULL,
156 .e_proc_exit = NULL, 164 .e_proc_exit = NULL,
157 .e_lwp_fork = NULL, 165 .e_lwp_fork = NULL,
158 .e_lwp_exit = NULL, 166 .e_lwp_exit = NULL,
159#ifdef __HAVE_SYSCALL_INTERN 167#ifdef __HAVE_SYSCALL_INTERN
160 .e_syscall_intern = netbsd32_syscall_intern, 168 .e_syscall_intern = netbsd32_syscall_intern,
161#else 169#else
162 .e_syscall = syscall, 170 .e_syscall = syscall,
163#endif 171#endif
164 .e_sysctlovly = &netbsd32_sysctl_root, 172 .e_sysctlovly = &netbsd32_sysctl_root,
165 .e_vm_default_addr = netbsd32_vm_default_addr, 173 .e_vm_default_addr = netbsd32_vm_default_addr,
166 .e_usertrap = NULL, 174 .e_usertrap = NULL,
167 .e_ucsize = sizeof(ucontext32_t), 175 .e_ucsize = sizeof(ucontext32_t),
168 .e_startlwp = startlwp32, 176 .e_startlwp = startlwp32,
169#ifdef notyet 177#ifdef notyet
170 .e_ktrpsig = netbsd32_ktrpsig, 178 .e_ktrpsig = netbsd32_ktrpsig,
171#else 179#else
172 .e_ktrpsig = NULL, 180 .e_ktrpsig = NULL,
173#endif 181#endif
174}; 182};
175 183
176int 184int
177netbsd32_exit(struct lwp *l, const struct netbsd32_exit_args *uap, register_t *retval) 185netbsd32_exit(struct lwp *l, const struct netbsd32_exit_args *uap, register_t *retval)
178{ 186{
179 /* { 187 /* {
180 syscallarg(int) rval; 188 syscallarg(int) rval;
181 } */ 189 } */
182 struct sys_exit_args ua; 190 struct sys_exit_args ua;
183 191
184 NETBSD32TO64_UAP(rval); 192 NETBSD32TO64_UAP(rval);
185 return sys_exit(l, &ua, retval); 193 return sys_exit(l, &ua, retval);
186} 194}
187 195
188int 196int
189netbsd32_read(struct lwp *l, const struct netbsd32_read_args *uap, register_t *retval) 197netbsd32_read(struct lwp *l, const struct netbsd32_read_args *uap, register_t *retval)
190{ 198{
191 /* { 199 /* {
192 syscallarg(int) fd; 200 syscallarg(int) fd;
193 syscallarg(netbsd32_voidp) buf; 201 syscallarg(netbsd32_voidp) buf;
194 syscallarg(netbsd32_size_t) nbyte; 202 syscallarg(netbsd32_size_t) nbyte;
195 } */ 203 } */
196 struct sys_read_args ua; 204 struct sys_read_args ua;
197 205
198 NETBSD32TO64_UAP(fd); 206 NETBSD32TO64_UAP(fd);
199 NETBSD32TOP_UAP(buf, void *); 207 NETBSD32TOP_UAP(buf, void *);
200 NETBSD32TOX_UAP(nbyte, size_t); 208 NETBSD32TOX_UAP(nbyte, size_t);
201 return sys_read(l, &ua, retval); 209 return sys_read(l, &ua, retval);
202} 210}
203 211
204int 212int
205netbsd32_write(struct lwp *l, const struct netbsd32_write_args *uap, register_t *retval) 213netbsd32_write(struct lwp *l, const struct netbsd32_write_args *uap, register_t *retval)
206{ 214{
207 /* { 215 /* {
208 syscallarg(int) fd; 216 syscallarg(int) fd;
209 syscallarg(const netbsd32_voidp) buf; 217 syscallarg(const netbsd32_voidp) buf;
210 syscallarg(netbsd32_size_t) nbyte; 218 syscallarg(netbsd32_size_t) nbyte;
211 } */ 219 } */
212 struct sys_write_args ua; 220 struct sys_write_args ua;
213 221
214 NETBSD32TO64_UAP(fd); 222 NETBSD32TO64_UAP(fd);
215 NETBSD32TOP_UAP(buf, void *); 223 NETBSD32TOP_UAP(buf, void *);
216 NETBSD32TOX_UAP(nbyte, size_t); 224 NETBSD32TOX_UAP(nbyte, size_t);
217 return sys_write(l, &ua, retval); 225 return sys_write(l, &ua, retval);
218} 226}
219 227
220int 228int
221netbsd32_close(struct lwp *l, const struct netbsd32_close_args *uap, register_t *retval) 229netbsd32_close(struct lwp *l, const struct netbsd32_close_args *uap, register_t *retval)
222{ 230{
223 /* { 231 /* {
224 syscallarg(int) fd; 232 syscallarg(int) fd;
225 } */ 233 } */
226 struct sys_close_args ua; 234 struct sys_close_args ua;
227 235
228 NETBSD32TO64_UAP(fd); 236 NETBSD32TO64_UAP(fd);
229 return sys_close(l, &ua, retval); 237 return sys_close(l, &ua, retval);
230} 238}
231 239
232int 240int
233netbsd32_open(struct lwp *l, const struct netbsd32_open_args *uap, register_t *retval) 241netbsd32_open(struct lwp *l, const struct netbsd32_open_args *uap, register_t *retval)
234{ 242{
235 /* { 243 /* {
236 syscallarg(const netbsd32_charp) path; 244 syscallarg(const netbsd32_charp) path;
237 syscallarg(int) flags; 245 syscallarg(int) flags;
238 syscallarg(mode_t) mode; 246 syscallarg(mode_t) mode;
239 } */ 247 } */
240 struct sys_open_args ua; 248 struct sys_open_args ua;
241 249
242 NETBSD32TOP_UAP(path, const char); 250 NETBSD32TOP_UAP(path, const char);
243 NETBSD32TO64_UAP(flags); 251 NETBSD32TO64_UAP(flags);
244 NETBSD32TO64_UAP(mode); 252 NETBSD32TO64_UAP(mode);
245 253
246 return sys_open(l, &ua, retval); 254 return sys_open(l, &ua, retval);
247} 255}
248 256
249int 257int
250netbsd32_link(struct lwp *l, const struct netbsd32_link_args *uap, register_t *retval) 258netbsd32_link(struct lwp *l, const struct netbsd32_link_args *uap, register_t *retval)
251{ 259{
252 /* { 260 /* {
253 syscallarg(const netbsd32_charp) path; 261 syscallarg(const netbsd32_charp) path;
254 syscallarg(const netbsd32_charp) link; 262 syscallarg(const netbsd32_charp) link;
255 } */ 263 } */
256 struct sys_link_args ua; 264 struct sys_link_args ua;
257 265
258 NETBSD32TOP_UAP(path, const char); 266 NETBSD32TOP_UAP(path, const char);
259 NETBSD32TOP_UAP(link, const char); 267 NETBSD32TOP_UAP(link, const char);
260 return sys_link(l, &ua, retval); 268 return sys_link(l, &ua, retval);
261} 269}
262 270
263int 271int
264netbsd32_unlink(struct lwp *l, const struct netbsd32_unlink_args *uap, register_t *retval) 272netbsd32_unlink(struct lwp *l, const struct netbsd32_unlink_args *uap, register_t *retval)
265{ 273{
266 /* { 274 /* {
267 syscallarg(const netbsd32_charp) path; 275 syscallarg(const netbsd32_charp) path;
268 } */ 276 } */
269 struct sys_unlink_args ua; 277 struct sys_unlink_args ua;
270 278
271 NETBSD32TOP_UAP(path, const char); 279 NETBSD32TOP_UAP(path, const char);
272 280
273 return sys_unlink(l, &ua, retval); 281 return sys_unlink(l, &ua, retval);
274} 282}
275 283
276int 284int
277netbsd32_chdir(struct lwp *l, const struct netbsd32_chdir_args *uap, register_t *retval) 285netbsd32_chdir(struct lwp *l, const struct netbsd32_chdir_args *uap, register_t *retval)
278{ 286{
279 /* { 287 /* {
280 syscallarg(const netbsd32_charp) path; 288 syscallarg(const netbsd32_charp) path;
281 } */ 289 } */
282 struct sys_chdir_args ua; 290 struct sys_chdir_args ua;
283 291
284 NETBSD32TOP_UAP(path, const char); 292 NETBSD32TOP_UAP(path, const char);
285 293
286 return sys_chdir(l, &ua, retval); 294 return sys_chdir(l, &ua, retval);
287} 295}
288 296
289int 297int
290netbsd32_fchdir(struct lwp *l, const struct netbsd32_fchdir_args *uap, register_t *retval) 298netbsd32_fchdir(struct lwp *l, const struct netbsd32_fchdir_args *uap, register_t *retval)
291{ 299{
292 /* { 300 /* {
293 syscallarg(int) fd; 301 syscallarg(int) fd;
294 } */ 302 } */
295 struct sys_fchdir_args ua; 303 struct sys_fchdir_args ua;
296 304
297 NETBSD32TO64_UAP(fd); 305 NETBSD32TO64_UAP(fd);
298 306
299 return sys_fchdir(l, &ua, retval); 307 return sys_fchdir(l, &ua, retval);
300} 308}
301 309
302int 310int
303netbsd32___mknod50(struct lwp *l, const struct netbsd32___mknod50_args *uap, register_t *retval) 311netbsd32___mknod50(struct lwp *l, const struct netbsd32___mknod50_args *uap, register_t *retval)
304{ 312{
305 /* { 313 /* {
306 syscallarg(const netbsd32_charp) path; 314 syscallarg(const netbsd32_charp) path;
307 syscallarg(mode_t) mode; 315 syscallarg(mode_t) mode;
308 syscallarg(netbsd32_dev_t) dev; 316 syscallarg(netbsd32_dev_t) dev;
309 } */ 317 } */
310 318
311 return do_sys_mknod(l, SCARG_P32(uap, path), SCARG(uap, mode), 319 return do_sys_mknod(l, SCARG_P32(uap, path), SCARG(uap, mode),
312 SCARG(uap, dev), retval, UIO_USERSPACE); 320 SCARG(uap, dev), retval, UIO_USERSPACE);
313} 321}
314 322
315int 323int
316netbsd32_chmod(struct lwp *l, const struct netbsd32_chmod_args *uap, register_t *retval) 324netbsd32_chmod(struct lwp *l, const struct netbsd32_chmod_args *uap, register_t *retval)
317{ 325{
318 /* { 326 /* {
319 syscallarg(const netbsd32_charp) path; 327 syscallarg(const netbsd32_charp) path;
320 syscallarg(mode_t) mode; 328 syscallarg(mode_t) mode;
321 } */ 329 } */
322 struct sys_chmod_args ua; 330 struct sys_chmod_args ua;
323 331
324 NETBSD32TOP_UAP(path, const char); 332 NETBSD32TOP_UAP(path, const char);
325 NETBSD32TO64_UAP(mode); 333 NETBSD32TO64_UAP(mode);
326 334
327 return sys_chmod(l, &ua, retval); 335 return sys_chmod(l, &ua, retval);
328} 336}
329 337
330int 338int
331netbsd32_chown(struct lwp *l, const struct netbsd32_chown_args *uap, register_t *retval) 339netbsd32_chown(struct lwp *l, const struct netbsd32_chown_args *uap, register_t *retval)
332{ 340{
333 /* { 341 /* {
334 syscallarg(const netbsd32_charp) path; 342 syscallarg(const netbsd32_charp) path;
335 syscallarg(uid_t) uid; 343 syscallarg(uid_t) uid;
336 syscallarg(gid_t) gid; 344 syscallarg(gid_t) gid;
337 } */ 345 } */
338 struct sys_chown_args ua; 346 struct sys_chown_args ua;
339 347
340 NETBSD32TOP_UAP(path, const char); 348 NETBSD32TOP_UAP(path, const char);
341 NETBSD32TO64_UAP(uid); 349 NETBSD32TO64_UAP(uid);
342 NETBSD32TO64_UAP(gid); 350 NETBSD32TO64_UAP(gid);
343 351
344 return sys_chown(l, &ua, retval); 352 return sys_chown(l, &ua, retval);
345} 353}
346 354
347int 355int
348netbsd32_break(struct lwp *l, const struct netbsd32_break_args *uap, register_t *retval) 356netbsd32_break(struct lwp *l, const struct netbsd32_break_args *uap, register_t *retval)
349{ 357{
350 /* { 358 /* {
351 syscallarg(netbsd32_charp) nsize; 359 syscallarg(netbsd32_charp) nsize;
352 } */ 360 } */
353 struct sys_obreak_args ua; 361 struct sys_obreak_args ua;
354 362
355 NETBSD32TOP_UAP(nsize, char); 363 NETBSD32TOP_UAP(nsize, char);
356 364
357 return sys_obreak(l, &ua, retval); 365 return sys_obreak(l, &ua, retval);
358} 366}
359 367
360// XXX move into compat_40 368// XXX move into compat_40
361int 369int
362netbsd32_mount(struct lwp *l, const struct netbsd32_mount_args *uap, register_t *retval) 370netbsd32_mount(struct lwp *l, const struct netbsd32_mount_args *uap, register_t *retval)
363{ 371{
364#ifdef COMPAT_40 372#ifdef COMPAT_40
365 /* { 373 /* {
366 syscallarg(const netbsd32_charp) type; 374 syscallarg(const netbsd32_charp) type;
367 syscallarg(const netbsd32_charp) path; 375 syscallarg(const netbsd32_charp) path;
368 syscallarg(int) flags; 376 syscallarg(int) flags;
369 syscallarg(netbsd32_voidp) data; 377 syscallarg(netbsd32_voidp) data;
370 } */ 378 } */
371 struct compat_40_sys_mount_args ua; 379 struct compat_40_sys_mount_args ua;
372 380
373 NETBSD32TOP_UAP(type, const char); 381 NETBSD32TOP_UAP(type, const char);
374 NETBSD32TOP_UAP(path, const char); 382 NETBSD32TOP_UAP(path, const char);
375 NETBSD32TO64_UAP(flags); 383 NETBSD32TO64_UAP(flags);
376 NETBSD32TOP_UAP(data, void); 384 NETBSD32TOP_UAP(data, void);
377 385
378 return compat_40_sys_mount(l, &ua, retval); 386 return compat_40_sys_mount(l, &ua, retval);
379#else 387#else
380 return ENOSYS; 388 return ENOSYS;
381#endif 389#endif
382} 390}
383 391
384int 392int
385netbsd32_unmount(struct lwp *l, const struct netbsd32_unmount_args *uap, register_t *retval) 393netbsd32_unmount(struct lwp *l, const struct netbsd32_unmount_args *uap, register_t *retval)
386{ 394{
387 /* { 395 /* {
388 syscallarg(const netbsd32_charp) path; 396 syscallarg(const netbsd32_charp) path;
389 syscallarg(int) flags; 397 syscallarg(int) flags;
390 } */ 398 } */
391 struct sys_unmount_args ua; 399 struct sys_unmount_args ua;
392 400
393 NETBSD32TOP_UAP(path, const char); 401 NETBSD32TOP_UAP(path, const char);
394 NETBSD32TO64_UAP(flags); 402 NETBSD32TO64_UAP(flags);
395 403
396 return sys_unmount(l, &ua, retval); 404 return sys_unmount(l, &ua, retval);
397} 405}
398 406
399int 407int
400netbsd32_setuid(struct lwp *l, const struct netbsd32_setuid_args *uap, register_t *retval) 408netbsd32_setuid(struct lwp *l, const struct netbsd32_setuid_args *uap, register_t *retval)
401{ 409{
402 /* { 410 /* {
403 syscallarg(uid_t) uid; 411 syscallarg(uid_t) uid;
404 } */ 412 } */
405 struct sys_setuid_args ua; 413 struct sys_setuid_args ua;
406 414
407 NETBSD32TO64_UAP(uid); 415 NETBSD32TO64_UAP(uid);
408 416
409 return sys_setuid(l, &ua, retval); 417 return sys_setuid(l, &ua, retval);
410} 418}
411 419
412int 420int
413netbsd32_accept(struct lwp *l, const struct netbsd32_accept_args *uap, register_t *retval) 421netbsd32_accept(struct lwp *l, const struct netbsd32_accept_args *uap, register_t *retval)
414{ 422{
415 /* { 423 /* {
416 syscallarg(int) s; 424 syscallarg(int) s;
417 syscallarg(netbsd32_sockaddrp_t) name; 425 syscallarg(netbsd32_sockaddrp_t) name;
418 syscallarg(netbsd32_intp) anamelen; 426 syscallarg(netbsd32_intp) anamelen;
419 } */ 427 } */
420 struct sys_accept_args ua; 428 struct sys_accept_args ua;
421 429
422 NETBSD32TO64_UAP(s); 430 NETBSD32TO64_UAP(s);
423 NETBSD32TOP_UAP(name, struct sockaddr); 431 NETBSD32TOP_UAP(name, struct sockaddr);
424 NETBSD32TOP_UAP(anamelen, socklen_t); 432 NETBSD32TOP_UAP(anamelen, socklen_t);
425 433
426 return sys_accept(l, &ua, retval); 434 return sys_accept(l, &ua, retval);
427} 435}
428 436
429int 437int
430netbsd32_getpeername(struct lwp *l, const struct netbsd32_getpeername_args *uap, register_t *retval) 438netbsd32_getpeername(struct lwp *l, const struct netbsd32_getpeername_args *uap, register_t *retval)
431{ 439{
432 /* { 440 /* {
433 syscallarg(int) fdes; 441 syscallarg(int) fdes;
434 syscallarg(netbsd32_sockaddrp_t) asa; 442 syscallarg(netbsd32_sockaddrp_t) asa;
435 syscallarg(netbsd32_intp) alen; 443 syscallarg(netbsd32_intp) alen;
436 } */ 444 } */
437 struct sys_getpeername_args ua; 445 struct sys_getpeername_args ua;
438 446
439 NETBSD32TO64_UAP(fdes); 447 NETBSD32TO64_UAP(fdes);
440 NETBSD32TOP_UAP(asa, struct sockaddr); 448 NETBSD32TOP_UAP(asa, struct sockaddr);
441 NETBSD32TOP_UAP(alen, socklen_t); 449 NETBSD32TOP_UAP(alen, socklen_t);
442/* NB: do the protocol specific sockaddrs need to be converted? */ 450/* NB: do the protocol specific sockaddrs need to be converted? */
443 451
444 return sys_getpeername(l, &ua, retval); 452 return sys_getpeername(l, &ua, retval);
445} 453}
446 454
447int 455int
448netbsd32_getsockname(struct lwp *l, const struct netbsd32_getsockname_args *uap, register_t *retval) 456netbsd32_getsockname(struct lwp *l, const struct netbsd32_getsockname_args *uap, register_t *retval)
449{ 457{
450 /* { 458 /* {
451 syscallarg(int) fdes; 459 syscallarg(int) fdes;
452 syscallarg(netbsd32_sockaddrp_t) asa; 460 syscallarg(netbsd32_sockaddrp_t) asa;
453 syscallarg(netbsd32_intp) alen; 461 syscallarg(netbsd32_intp) alen;
454 } */ 462 } */
455 struct sys_getsockname_args ua; 463 struct sys_getsockname_args ua;
456 464
457 NETBSD32TO64_UAP(fdes); 465 NETBSD32TO64_UAP(fdes);
458 NETBSD32TOP_UAP(asa, struct sockaddr); 466 NETBSD32TOP_UAP(asa, struct sockaddr);
459 NETBSD32TOP_UAP(alen, socklen_t); 467 NETBSD32TOP_UAP(alen, socklen_t);
460 468
461 return sys_getsockname(l, &ua, retval); 469 return sys_getsockname(l, &ua, retval);
462} 470}
463 471
464int 472int
465netbsd32_access(struct lwp *l, const struct netbsd32_access_args *uap, register_t *retval) 473netbsd32_access(struct lwp *l, const struct netbsd32_access_args *uap, register_t *retval)
466{ 474{
467 /* { 475 /* {
468 syscallarg(const netbsd32_charp) path; 476 syscallarg(const netbsd32_charp) path;
469 syscallarg(int) flags; 477 syscallarg(int) flags;
470 } */ 478 } */
471 struct sys_access_args ua; 479 struct sys_access_args ua;
472 480
473 NETBSD32TOP_UAP(path, const char); 481 NETBSD32TOP_UAP(path, const char);
474 NETBSD32TO64_UAP(flags); 482 NETBSD32TO64_UAP(flags);
475 483
476 return sys_access(l, &ua, retval); 484 return sys_access(l, &ua, retval);
477} 485}
478 486
479int 487int
480netbsd32_chflags(struct lwp *l, const struct netbsd32_chflags_args *uap, register_t *retval) 488netbsd32_chflags(struct lwp *l, const struct netbsd32_chflags_args *uap, register_t *retval)
481{ 489{
482 /* { 490 /* {
483 syscallarg(const netbsd32_charp) path; 491 syscallarg(const netbsd32_charp) path;
484 syscallarg(netbsd32_u_long) flags; 492 syscallarg(netbsd32_u_long) flags;
485 } */ 493 } */
486 struct sys_chflags_args ua; 494 struct sys_chflags_args ua;
487 495
488 NETBSD32TOP_UAP(path, const char); 496 NETBSD32TOP_UAP(path, const char);
489 NETBSD32TO64_UAP(flags); 497 NETBSD32TO64_UAP(flags);
490 498
491 return sys_chflags(l, &ua, retval); 499 return sys_chflags(l, &ua, retval);
492} 500}
493 501
494int 502int
495netbsd32_fchflags(struct lwp *l, const struct netbsd32_fchflags_args *uap, register_t *retval) 503netbsd32_fchflags(struct lwp *l, const struct netbsd32_fchflags_args *uap, register_t *retval)
496{ 504{
497 /* { 505 /* {
498 syscallarg(int) fd; 506 syscallarg(int) fd;
499 syscallarg(netbsd32_u_long) flags; 507 syscallarg(netbsd32_u_long) flags;
500 } */ 508 } */
501 struct sys_fchflags_args ua; 509 struct sys_fchflags_args ua;
502 510
503 NETBSD32TO64_UAP(fd); 511 NETBSD32TO64_UAP(fd);
504 NETBSD32TO64_UAP(flags); 512 NETBSD32TO64_UAP(flags);
505 513
506 return sys_fchflags(l, &ua, retval); 514 return sys_fchflags(l, &ua, retval);
507} 515}
508 516
509int 517int
510netbsd32_lchflags(struct lwp *l, const struct netbsd32_lchflags_args *uap, register_t *retval) 518netbsd32_lchflags(struct lwp *l, const struct netbsd32_lchflags_args *uap, register_t *retval)
511{ 519{
512 /* { 520 /* {
513 syscallarg(const char *) path; 521 syscallarg(const char *) path;
514 syscallarg(netbsd32_u_long) flags; 522 syscallarg(netbsd32_u_long) flags;
515 } */ 523 } */
516 struct sys_lchflags_args ua; 524 struct sys_lchflags_args ua;
517 525
518 NETBSD32TOP_UAP(path, const char); 526 NETBSD32TOP_UAP(path, const char);
519 NETBSD32TO64_UAP(flags); 527 NETBSD32TO64_UAP(flags);
520 528
521 return sys_lchflags(l, &ua, retval); 529 return sys_lchflags(l, &ua, retval);
522} 530}
523 531
524int 532int
525netbsd32_kill(struct lwp *l, const struct netbsd32_kill_args *uap, register_t *retval) 533netbsd32_kill(struct lwp *l, const struct netbsd32_kill_args *uap, register_t *retval)
526{ 534{
527 /* { 535 /* {
528 syscallarg(int) pid; 536 syscallarg(int) pid;
529 syscallarg(int) signum; 537 syscallarg(int) signum;
530 } */ 538 } */
531 struct sys_kill_args ua; 539 struct sys_kill_args ua;
532 540
533 NETBSD32TO64_UAP(pid); 541 NETBSD32TO64_UAP(pid);
534 NETBSD32TO64_UAP(signum); 542 NETBSD32TO64_UAP(signum);
535 543
536 return sys_kill(l, &ua, retval); 544 return sys_kill(l, &ua, retval);
537} 545}
538 546
539int 547int
540netbsd32_dup(struct lwp *l, const struct netbsd32_dup_args *uap, register_t *retval) 548netbsd32_dup(struct lwp *l, const struct netbsd32_dup_args *uap, register_t *retval)
541{ 549{
542 /* { 550 /* {
543 syscallarg(int) fd; 551 syscallarg(int) fd;
544 } */ 552 } */
545 struct sys_dup_args ua; 553 struct sys_dup_args ua;
546 554
547 NETBSD32TO64_UAP(fd); 555 NETBSD32TO64_UAP(fd);
548 556
549 return sys_dup(l, &ua, retval); 557 return sys_dup(l, &ua, retval);
550} 558}
551 559
552int 560int
553netbsd32_profil(struct lwp *l, const struct netbsd32_profil_args *uap, register_t *retval) 561netbsd32_profil(struct lwp *l, const struct netbsd32_profil_args *uap, register_t *retval)
554{ 562{
555 /* { 563 /* {
556 syscallarg(netbsd32_voidp) samples; 564 syscallarg(netbsd32_voidp) samples;
557 syscallarg(netbsd32_size_t) size; 565 syscallarg(netbsd32_size_t) size;
558 syscallarg(netbsd32_u_long) offset; 566 syscallarg(netbsd32_u_long) offset;
559 syscallarg(u_int) scale; 567 syscallarg(u_int) scale;
560 } */ 568 } */
561 struct sys_profil_args ua; 569 struct sys_profil_args ua;
562 570
563 NETBSD32TOP_UAP(samples, void *); 571 NETBSD32TOP_UAP(samples, void *);
564 NETBSD32TOX_UAP(size, size_t); 572 NETBSD32TOX_UAP(size, size_t);
565 NETBSD32TOX_UAP(offset, u_long); 573 NETBSD32TOX_UAP(offset, u_long);
566 NETBSD32TO64_UAP(scale); 574 NETBSD32TO64_UAP(scale);
567 575
568 return sys_profil(l, &ua, retval); 576 return sys_profil(l, &ua, retval);
569} 577}
570 578
571int 579int
572netbsd32_ktrace(struct lwp *l, const struct netbsd32_ktrace_args *uap, register_t *retval) 580netbsd32_ktrace(struct lwp *l, const struct netbsd32_ktrace_args *uap, register_t *retval)
573{ 581{
574 /* { 582 /* {
575 syscallarg(const netbsd32_charp) fname; 583 syscallarg(const netbsd32_charp) fname;
576 syscallarg(int) ops; 584 syscallarg(int) ops;
577 syscallarg(int) facs; 585 syscallarg(int) facs;
578 syscallarg(int) pid; 586 syscallarg(int) pid;
579 } */ 587 } */
580 struct sys_ktrace_args ua; 588 struct sys_ktrace_args ua;
581 589
582 NETBSD32TOP_UAP(fname, const char); 590 NETBSD32TOP_UAP(fname, const char);
583 NETBSD32TO64_UAP(ops); 591 NETBSD32TO64_UAP(ops);
584 NETBSD32TO64_UAP(facs); 592 NETBSD32TO64_UAP(facs);
585 NETBSD32TO64_UAP(pid); 593 NETBSD32TO64_UAP(pid);
586 594
587 return sys_ktrace(l, &ua, retval); 595 return sys_ktrace(l, &ua, retval);
588} 596}
589 597
590int 598int
591netbsd32_utrace(struct lwp *l, const struct netbsd32_utrace_args *uap, register_t *retval) 599netbsd32_utrace(struct lwp *l, const struct netbsd32_utrace_args *uap, register_t *retval)
592{ 600{
593 /* { 601 /* {
594 syscallarg(const netbsd32_charp) label; 602 syscallarg(const netbsd32_charp) label;
595 syscallarg(netbsd32_voidp) addr; 603 syscallarg(netbsd32_voidp) addr;
596 syscallarg(netbsd32_size_t) len; 604 syscallarg(netbsd32_size_t) len;
597 } */ 605 } */
598 struct sys_utrace_args ua; 606 struct sys_utrace_args ua;
599 607
600 NETBSD32TOP_UAP(label, const char); 608 NETBSD32TOP_UAP(label, const char);
601 NETBSD32TOP_UAP(addr, void); 609 NETBSD32TOP_UAP(addr, void);
602 NETBSD32TO64_UAP(len); 610 NETBSD32TO64_UAP(len);
603 611
604 return sys_utrace(l, &ua, retval); 612 return sys_utrace(l, &ua, retval);
605} 613}
606 614
607int 615int
608netbsd32___getlogin(struct lwp *l, const struct netbsd32___getlogin_args *uap, register_t *retval) 616netbsd32___getlogin(struct lwp *l, const struct netbsd32___getlogin_args *uap, register_t *retval)
609{ 617{
610 /* { 618 /* {
611 syscallarg(netbsd32_charp) namebuf; 619 syscallarg(netbsd32_charp) namebuf;
612 syscallarg(u_int) namelen; 620 syscallarg(u_int) namelen;
613 } */ 621 } */
614 struct sys___getlogin_args ua; 622 struct sys___getlogin_args ua;
615 623
616 NETBSD32TOP_UAP(namebuf, char); 624 NETBSD32TOP_UAP(namebuf, char);
617 NETBSD32TO64_UAP(namelen); 625 NETBSD32TO64_UAP(namelen);
618 626
619 return sys___getlogin(l, &ua, retval); 627 return sys___getlogin(l, &ua, retval);
620} 628}
621 629
622int 630int
623netbsd32_setlogin(struct lwp *l, const struct netbsd32_setlogin_args *uap, register_t *retval) 631netbsd32_setlogin(struct lwp *l, const struct netbsd32_setlogin_args *uap, register_t *retval)
624{ 632{
625 /* { 633 /* {
626 syscallarg(const netbsd32_charp) namebuf; 634 syscallarg(const netbsd32_charp) namebuf;
627 } */ 635 } */
628 struct sys___setlogin_args ua; 636 struct sys___setlogin_args ua;
629 637
630 NETBSD32TOP_UAP(namebuf, char); 638 NETBSD32TOP_UAP(namebuf, char);
631 639
632 return sys___setlogin(l, &ua, retval); 640 return sys___setlogin(l, &ua, retval);
633} 641}
634 642
635int 643int
636netbsd32_acct(struct lwp *l, const struct netbsd32_acct_args *uap, register_t *retval) 644netbsd32_acct(struct lwp *l, const struct netbsd32_acct_args *uap, register_t *retval)
637{ 645{
638 /* { 646 /* {
639 syscallarg(const netbsd32_charp) path; 647 syscallarg(const netbsd32_charp) path;
640 } */ 648 } */
641 struct sys_acct_args ua; 649 struct sys_acct_args ua;
642 650
643 NETBSD32TOP_UAP(path, const char); 651 NETBSD32TOP_UAP(path, const char);
644 652
645 return sys_acct(l, &ua, retval); 653 return sys_acct(l, &ua, retval);
646} 654}
647 655
648int 656int
649netbsd32_revoke(struct lwp *l, const struct netbsd32_revoke_args *uap, register_t *retval) 657netbsd32_revoke(struct lwp *l, const struct netbsd32_revoke_args *uap, register_t *retval)
650{ 658{
651 /* { 659 /* {
652 syscallarg(const netbsd32_charp) path; 660 syscallarg(const netbsd32_charp) path;
653 } */ 661 } */
654 struct sys_revoke_args ua; 662 struct sys_revoke_args ua;
655 663
656 NETBSD32TOP_UAP(path, const char); 664 NETBSD32TOP_UAP(path, const char);
657 665
658 return sys_revoke(l, &ua, retval); 666 return sys_revoke(l, &ua, retval);
659} 667}
660 668
661int 669int
662netbsd32_symlink(struct lwp *l, const struct netbsd32_symlink_args *uap, register_t *retval) 670netbsd32_symlink(struct lwp *l, const struct netbsd32_symlink_args *uap, register_t *retval)
663{ 671{
664 /* { 672 /* {
665 syscallarg(const netbsd32_charp) path; 673 syscallarg(const netbsd32_charp) path;
666 syscallarg(const netbsd32_charp) link; 674 syscallarg(const netbsd32_charp) link;
667 } */ 675 } */
668 struct sys_symlink_args ua; 676 struct sys_symlink_args ua;
669 677
670 NETBSD32TOP_UAP(path, const char); 678 NETBSD32TOP_UAP(path, const char);
671 NETBSD32TOP_UAP(link, const char); 679 NETBSD32TOP_UAP(link, const char);
672 680
673 return sys_symlink(l, &ua, retval); 681 return sys_symlink(l, &ua, retval);
674} 682}
675 683
676int 684int
677netbsd32_readlink(struct lwp *l, const struct netbsd32_readlink_args *uap, register_t *retval) 685netbsd32_readlink(struct lwp *l, const struct netbsd32_readlink_args *uap, register_t *retval)
678{ 686{
679 /* { 687 /* {
680 syscallarg(const netbsd32_charp) path; 688 syscallarg(const netbsd32_charp) path;
681 syscallarg(netbsd32_charp) buf; 689 syscallarg(netbsd32_charp) buf;
682 syscallarg(netbsd32_size_t) count; 690 syscallarg(netbsd32_size_t) count;
683 } */ 691 } */
684 struct sys_readlink_args ua; 692 struct sys_readlink_args ua;
685 693
686 NETBSD32TOP_UAP(path, const char); 694 NETBSD32TOP_UAP(path, const char);
687 NETBSD32TOP_UAP(buf, char); 695 NETBSD32TOP_UAP(buf, char);
688 NETBSD32TOX_UAP(count, size_t); 696 NETBSD32TOX_UAP(count, size_t);
689 697
690 return sys_readlink(l, &ua, retval); 698 return sys_readlink(l, &ua, retval);
691} 699}
692 700
693int 701int
694netbsd32_umask(struct lwp *l, const struct netbsd32_umask_args *uap, register_t *retval) 702netbsd32_umask(struct lwp *l, const struct netbsd32_umask_args *uap, register_t *retval)
695{ 703{
696 /* { 704 /* {
697 syscallarg(mode_t) newmask; 705 syscallarg(mode_t) newmask;
698 } */ 706 } */
699 struct sys_umask_args ua; 707 struct sys_umask_args ua;
700 708
701 NETBSD32TO64_UAP(newmask); 709 NETBSD32TO64_UAP(newmask);
702 710
703 return sys_umask(l, &ua, retval); 711 return sys_umask(l, &ua, retval);
704} 712}
705 713
706int 714int
707netbsd32_chroot(struct lwp *l, const struct netbsd32_chroot_args *uap, register_t *retval) 715netbsd32_chroot(struct lwp *l, const struct netbsd32_chroot_args *uap, register_t *retval)
708{ 716{
709 /* { 717 /* {
710 syscallarg(const netbsd32_charp) path; 718 syscallarg(const netbsd32_charp) path;
711 } */ 719 } */
712 struct sys_chroot_args ua; 720 struct sys_chroot_args ua;
713 721
714 NETBSD32TOP_UAP(path, const char); 722 NETBSD32TOP_UAP(path, const char);
715 723
716 return sys_chroot(l, &ua, retval); 724 return sys_chroot(l, &ua, retval);
717} 725}
718 726
719int 727int
720netbsd32_munmap(struct lwp *l, const struct netbsd32_munmap_args *uap, register_t *retval) 728netbsd32_munmap(struct lwp *l, const struct netbsd32_munmap_args *uap, register_t *retval)
721{ 729{
722 /* { 730 /* {
723 syscallarg(netbsd32_voidp) addr; 731 syscallarg(netbsd32_voidp) addr;
724 syscallarg(netbsd32_size_t) len; 732 syscallarg(netbsd32_size_t) len;
725 } */ 733 } */
726 struct sys_munmap_args ua; 734 struct sys_munmap_args ua;
727 735
728 NETBSD32TOP_UAP(addr, void); 736 NETBSD32TOP_UAP(addr, void);
729 NETBSD32TOX_UAP(len, size_t); 737 NETBSD32TOX_UAP(len, size_t);
730 738
731 return sys_munmap(l, &ua, retval); 739 return sys_munmap(l, &ua, retval);
732} 740}
733 741
734int 742int
735netbsd32_mprotect(struct lwp *l, const struct netbsd32_mprotect_args *uap, register_t *retval) 743netbsd32_mprotect(struct lwp *l, const struct netbsd32_mprotect_args *uap, register_t *retval)
736{ 744{
737 /* { 745 /* {
738 syscallarg(netbsd32_voidp) addr; 746 syscallarg(netbsd32_voidp) addr;
739 syscallarg(netbsd32_size_t) len; 747 syscallarg(netbsd32_size_t) len;
740 syscallarg(int) prot; 748 syscallarg(int) prot;
741 } */ 749 } */
742 struct sys_mprotect_args ua; 750 struct sys_mprotect_args ua;
743 751
744 NETBSD32TOP_UAP(addr, void); 752 NETBSD32TOP_UAP(addr, void);
745 NETBSD32TOX_UAP(len, size_t); 753 NETBSD32TOX_UAP(len, size_t);
746 NETBSD32TO64_UAP(prot); 754 NETBSD32TO64_UAP(prot);
747 755
748 return sys_mprotect(l, &ua, retval); 756 return sys_mprotect(l, &ua, retval);
749} 757}
750 758
751int 759int
752netbsd32_madvise(struct lwp *l, const struct netbsd32_madvise_args *uap, register_t *retval) 760netbsd32_madvise(struct lwp *l, const struct netbsd32_madvise_args *uap, register_t *retval)
753{ 761{
754 /* { 762 /* {
755 syscallarg(netbsd32_voidp) addr; 763 syscallarg(netbsd32_voidp) addr;
756 syscallarg(netbsd32_size_t) len; 764 syscallarg(netbsd32_size_t) len;
757 syscallarg(int) behav; 765 syscallarg(int) behav;
758 } */ 766 } */
759 struct sys_madvise_args ua; 767 struct sys_madvise_args ua;
760 768
761 NETBSD32TOP_UAP(addr, void); 769 NETBSD32TOP_UAP(addr, void);
762 NETBSD32TOX_UAP(len, size_t); 770 NETBSD32TOX_UAP(len, size_t);
763 NETBSD32TO64_UAP(behav); 771 NETBSD32TO64_UAP(behav);
764 772
765 return sys_madvise(l, &ua, retval); 773 return sys_madvise(l, &ua, retval);
766} 774}
767 775
768int 776int
769netbsd32_mincore(struct lwp *l, const struct netbsd32_mincore_args *uap, register_t *retval) 777netbsd32_mincore(struct lwp *l, const struct netbsd32_mincore_args *uap, register_t *retval)
770{ 778{
771 /* { 779 /* {
772 syscallarg(netbsd32_voidp) addr; 780 syscallarg(netbsd32_voidp) addr;
773 syscallarg(netbsd32_size_t) len; 781 syscallarg(netbsd32_size_t) len;
774 syscallarg(netbsd32_charp) vec; 782 syscallarg(netbsd32_charp) vec;
775 } */ 783 } */
776 struct sys_mincore_args ua; 784 struct sys_mincore_args ua;
777 785
778 NETBSD32TOP_UAP(addr, void *); 786 NETBSD32TOP_UAP(addr, void *);
779 NETBSD32TOX_UAP(len, size_t); 787 NETBSD32TOX_UAP(len, size_t);
780 NETBSD32TOP_UAP(vec, char); 788 NETBSD32TOP_UAP(vec, char);
781 789
782 return sys_mincore(l, &ua, retval); 790 return sys_mincore(l, &ua, retval);
783} 791}
784 792
785int 793int
786netbsd32_getgroups(struct lwp *l, const struct netbsd32_getgroups_args *uap, register_t *retval) 794netbsd32_getgroups(struct lwp *l, const struct netbsd32_getgroups_args *uap, register_t *retval)
787{ 795{
788 /* { 796 /* {
789 syscallarg(int) gidsetsize; 797 syscallarg(int) gidsetsize;
790 syscallarg(netbsd32_gid_tp) gidset; 798 syscallarg(netbsd32_gid_tp) gidset;
791 } */ 799 } */
792 struct sys_getgroups_args ua; 800 struct sys_getgroups_args ua;
793 801
794 /* Since sizeof (gid_t) == sizeof (netbsd32_gid_t) ... */ 802 /* Since sizeof (gid_t) == sizeof (netbsd32_gid_t) ... */
795 803
796 NETBSD32TO64_UAP(gidsetsize); 804 NETBSD32TO64_UAP(gidsetsize);
797 NETBSD32TOP_UAP(gidset, gid_t); 805 NETBSD32TOP_UAP(gidset, gid_t);
798 806
799 return sys_getgroups(l, &ua, retval); 807 return sys_getgroups(l, &ua, retval);
800} 808}
801 809
802int 810int
803netbsd32_setgroups(struct lwp *l, const struct netbsd32_setgroups_args *uap, register_t *retval) 811netbsd32_setgroups(struct lwp *l, const struct netbsd32_setgroups_args *uap, register_t *retval)
804{ 812{
805 /* { 813 /* {
806 syscallarg(int) gidsetsize; 814 syscallarg(int) gidsetsize;
807 syscallarg(const netbsd32_gid_tp) gidset; 815 syscallarg(const netbsd32_gid_tp) gidset;
808 } */ 816 } */
809 struct sys_setgroups_args ua; 817 struct sys_setgroups_args ua;
810 818
811 NETBSD32TO64_UAP(gidsetsize); 819 NETBSD32TO64_UAP(gidsetsize);
812 NETBSD32TOP_UAP(gidset, gid_t); 820 NETBSD32TOP_UAP(gidset, gid_t);
813 821
814 return sys_setgroups(l, &ua, retval); 822 return sys_setgroups(l, &ua, retval);
815} 823}
816 824
817int 825int
818netbsd32_setpgid(struct lwp *l, const struct netbsd32_setpgid_args *uap, register_t *retval) 826netbsd32_setpgid(struct lwp *l, const struct netbsd32_setpgid_args *uap, register_t *retval)
819{ 827{
820 /* { 828 /* {
821 syscallarg(int) pid; 829 syscallarg(int) pid;
822 syscallarg(int) pgid; 830 syscallarg(int) pgid;
823 } */ 831 } */
824 struct sys_setpgid_args ua; 832 struct sys_setpgid_args ua;
825 833
826 NETBSD32TO64_UAP(pid); 834 NETBSD32TO64_UAP(pid);
827 NETBSD32TO64_UAP(pgid); 835 NETBSD32TO64_UAP(pgid);
828 836
829 return sys_setpgid(l, &ua, retval); 837 return sys_setpgid(l, &ua, retval);
830} 838}
831 839
832int 840int
833netbsd32_fcntl(struct lwp *l, const struct netbsd32_fcntl_args *uap, register_t *retval) 841netbsd32_fcntl(struct lwp *l, const struct netbsd32_fcntl_args *uap, register_t *retval)
834{ 842{
835 /* { 843 /* {
836 syscallarg(int) fd; 844 syscallarg(int) fd;
837 syscallarg(int) cmd; 845 syscallarg(int) cmd;
838 syscallarg(netbsd32_voidp) arg; 846 syscallarg(netbsd32_voidp) arg;
839 } */ 847 } */
840 struct sys_fcntl_args ua; 848 struct sys_fcntl_args ua;
841 849
842 NETBSD32TO64_UAP(fd); 850 NETBSD32TO64_UAP(fd);
843 NETBSD32TO64_UAP(cmd); 851 NETBSD32TO64_UAP(cmd);
844 /* we can do this because `struct flock' doesn't change */ 852 /* we can do this because `struct flock' doesn't change */
845 NETBSD32TOP_UAP(arg, void); 853 NETBSD32TOP_UAP(arg, void);
846 854
847 return sys_fcntl(l, &ua, retval); 855 return sys_fcntl(l, &ua, retval);
848} 856}
849 857
850int 858int
851netbsd32_dup2(struct lwp *l, const struct netbsd32_dup2_args *uap, register_t *retval) 859netbsd32_dup2(struct lwp *l, const struct netbsd32_dup2_args *uap, register_t *retval)
852{ 860{
853 /* { 861 /* {
854 syscallarg(int) from; 862 syscallarg(int) from;
855 syscallarg(int) to; 863 syscallarg(int) to;
856 } */ 864 } */
857 struct sys_dup2_args ua; 865 struct sys_dup2_args ua;
858 866
859 NETBSD32TO64_UAP(from); 867 NETBSD32TO64_UAP(from);
860 NETBSD32TO64_UAP(to); 868 NETBSD32TO64_UAP(to);
861 869
862 return sys_dup2(l, &ua, retval); 870 return sys_dup2(l, &ua, retval);
863} 871}
864 872
865int 873int
866netbsd32_fsync(struct lwp *l, const struct netbsd32_fsync_args *uap, register_t *retval) 874netbsd32_fsync(struct lwp *l, const struct netbsd32_fsync_args *uap, register_t *retval)
867{ 875{
868 /* { 876 /* {
869 syscallarg(int) fd; 877 syscallarg(int) fd;
870 } */ 878 } */
871 struct sys_fsync_args ua; 879 struct sys_fsync_args ua;
872 880
873 NETBSD32TO64_UAP(fd); 881 NETBSD32TO64_UAP(fd);
874 882
875 return sys_fsync(l, &ua, retval); 883 return sys_fsync(l, &ua, retval);
876} 884}
877 885
878int 886int
879netbsd32_setpriority(struct lwp *l, const struct netbsd32_setpriority_args *uap, register_t *retval) 887netbsd32_setpriority(struct lwp *l, const struct netbsd32_setpriority_args *uap, register_t *retval)
880{ 888{
881 /* { 889 /* {
882 syscallarg(int) which; 890 syscallarg(int) which;
883 syscallarg(int) who; 891 syscallarg(int) who;
884 syscallarg(int) prio; 892 syscallarg(int) prio;
885 } */ 893 } */
886 struct sys_setpriority_args ua; 894 struct sys_setpriority_args ua;
887 895
888 NETBSD32TO64_UAP(which); 896 NETBSD32TO64_UAP(which);
889 NETBSD32TO64_UAP(who); 897 NETBSD32TO64_UAP(who);
890 NETBSD32TO64_UAP(prio); 898 NETBSD32TO64_UAP(prio);
891 899
892 return sys_setpriority(l, &ua, retval); 900 return sys_setpriority(l, &ua, retval);
893} 901}
894 902
895int 903int
896netbsd32___socket30(struct lwp *l, const struct netbsd32___socket30_args *uap, register_t *retval) 904netbsd32___socket30(struct lwp *l, const struct netbsd32___socket30_args *uap, register_t *retval)
897{ 905{
898 /* { 906 /* {
899 syscallarg(int) domain; 907 syscallarg(int) domain;
900 syscallarg(int) type; 908 syscallarg(int) type;
901 syscallarg(int) protocol; 909 syscallarg(int) protocol;
902 } */ 910 } */
903 struct sys___socket30_args ua; 911 struct sys___socket30_args ua;
904 912
905 NETBSD32TO64_UAP(domain); 913 NETBSD32TO64_UAP(domain);
906 NETBSD32TO64_UAP(type); 914 NETBSD32TO64_UAP(type);
907 NETBSD32TO64_UAP(protocol); 915 NETBSD32TO64_UAP(protocol);
908 916
909 return sys___socket30(l, &ua, retval); 917 return sys___socket30(l, &ua, retval);
910} 918}
911 919
912int 920int
913netbsd32_connect(struct lwp *l, const struct netbsd32_connect_args *uap, register_t *retval) 921netbsd32_connect(struct lwp *l, const struct netbsd32_connect_args *uap, register_t *retval)
914{ 922{
915 /* { 923 /* {
916 syscallarg(int) s; 924 syscallarg(int) s;
917 syscallarg(const netbsd32_sockaddrp_t) name; 925 syscallarg(const netbsd32_sockaddrp_t) name;
918 syscallarg(int) namelen; 926 syscallarg(int) namelen;
919 } */ 927 } */
920 struct sys_connect_args ua; 928 struct sys_connect_args ua;
921 929
922 NETBSD32TO64_UAP(s); 930 NETBSD32TO64_UAP(s);
923 NETBSD32TOP_UAP(name, struct sockaddr); 931 NETBSD32TOP_UAP(name, struct sockaddr);
924 NETBSD32TO64_UAP(namelen); 932 NETBSD32TO64_UAP(namelen);
925 933
926 return sys_connect(l, &ua, retval); 934 return sys_connect(l, &ua, retval);
927} 935}
928 936
929int 937int
930netbsd32_getpriority(struct lwp *l, const struct netbsd32_getpriority_args *uap, register_t *retval) 938netbsd32_getpriority(struct lwp *l, const struct netbsd32_getpriority_args *uap, register_t *retval)
931{ 939{
932 /* { 940 /* {
933 syscallarg(int) which; 941 syscallarg(int) which;
934 syscallarg(int) who; 942 syscallarg(int) who;
935 } */ 943 } */
936 struct sys_getpriority_args ua; 944 struct sys_getpriority_args ua;
937 945
938 NETBSD32TO64_UAP(which); 946 NETBSD32TO64_UAP(which);
939 NETBSD32TO64_UAP(who); 947 NETBSD32TO64_UAP(who);
940 948
941 return sys_getpriority(l, &ua, retval); 949 return sys_getpriority(l, &ua, retval);
942} 950}
943 951
944int 952int
945netbsd32_bind(struct lwp *l, const struct netbsd32_bind_args *uap, register_t *retval) 953netbsd32_bind(struct lwp *l, const struct netbsd32_bind_args *uap, register_t *retval)
946{ 954{
947 /* { 955 /* {
948 syscallarg(int) s; 956 syscallarg(int) s;
949 syscallarg(const netbsd32_sockaddrp_t) name; 957 syscallarg(const netbsd32_sockaddrp_t) name;
950 syscallarg(int) namelen; 958 syscallarg(int) namelen;
951 } */ 959 } */
952 struct sys_bind_args ua; 960 struct sys_bind_args ua;
953 961
954 NETBSD32TO64_UAP(s); 962 NETBSD32TO64_UAP(s);
955 NETBSD32TOP_UAP(name, struct sockaddr); 963 NETBSD32TOP_UAP(name, struct sockaddr);
956 NETBSD32TO64_UAP(namelen); 964 NETBSD32TO64_UAP(namelen);
957 965
958 return sys_bind(l, &ua, retval); 966 return sys_bind(l, &ua, retval);
959} 967}
960 968
961int 969int
962netbsd32_setsockopt(struct lwp *l, const struct netbsd32_setsockopt_args *uap, register_t *retval) 970netbsd32_setsockopt(struct lwp *l, const struct netbsd32_setsockopt_args *uap, register_t *retval)
963{ 971{
964 /* { 972 /* {
965 syscallarg(int) s; 973 syscallarg(int) s;
966 syscallarg(int) level; 974 syscallarg(int) level;
967 syscallarg(int) name; 975 syscallarg(int) name;
968 syscallarg(const netbsd32_voidp) val; 976 syscallarg(const netbsd32_voidp) val;
969 syscallarg(int) valsize; 977 syscallarg(int) valsize;
970 } */ 978 } */
971 struct sys_setsockopt_args ua; 979 struct sys_setsockopt_args ua;
972 980
973 NETBSD32TO64_UAP(s); 981 NETBSD32TO64_UAP(s);
974 NETBSD32TO64_UAP(level); 982 NETBSD32TO64_UAP(level);
975 NETBSD32TO64_UAP(name); 983 NETBSD32TO64_UAP(name);
976 NETBSD32TOP_UAP(val, void); 984 NETBSD32TOP_UAP(val, void);
977 NETBSD32TO64_UAP(valsize); 985 NETBSD32TO64_UAP(valsize);
978 /* may be more efficient to do this inline. */ 986 /* may be more efficient to do this inline. */
979 987
980 return sys_setsockopt(l, &ua, retval); 988 return sys_setsockopt(l, &ua, retval);
981} 989}
982 990
983int 991int
984netbsd32_listen(struct lwp *l, const struct netbsd32_listen_args *uap, register_t *retval) 992netbsd32_listen(struct lwp *l, const struct netbsd32_listen_args *uap, register_t *retval)
985{ 993{
986 /* { 994 /* {
987 syscallarg(int) s; 995 syscallarg(int) s;
988 syscallarg(int) backlog; 996 syscallarg(int) backlog;
989 } */ 997 } */
990 struct sys_listen_args ua; 998 struct sys_listen_args ua;
991 999
992 NETBSD32TO64_UAP(s); 1000 NETBSD32TO64_UAP(s);
993 NETBSD32TO64_UAP(backlog); 1001 NETBSD32TO64_UAP(backlog);
994 1002
995 return sys_listen(l, &ua, retval); 1003 return sys_listen(l, &ua, retval);
996} 1004}
997 1005
998int 1006int
999netbsd32_fchown(struct lwp *l, const struct netbsd32_fchown_args *uap, register_t *retval) 1007netbsd32_fchown(struct lwp *l, const struct netbsd32_fchown_args *uap, register_t *retval)
1000{ 1008{
1001 /* { 1009 /* {
1002 syscallarg(int) fd; 1010 syscallarg(int) fd;
1003 syscallarg(uid_t) uid; 1011 syscallarg(uid_t) uid;
1004 syscallarg(gid_t) gid; 1012 syscallarg(gid_t) gid;
1005 } */ 1013 } */
1006 struct sys_fchown_args ua; 1014 struct sys_fchown_args ua;
1007 1015
1008 NETBSD32TO64_UAP(fd); 1016 NETBSD32TO64_UAP(fd);
1009 NETBSD32TO64_UAP(uid); 1017 NETBSD32TO64_UAP(uid);
1010 NETBSD32TO64_UAP(gid); 1018 NETBSD32TO64_UAP(gid);
1011 1019
1012 return sys_fchown(l, &ua, retval); 1020 return sys_fchown(l, &ua, retval);
1013} 1021}
1014 1022
1015int 1023int
1016netbsd32_fchmod(struct lwp *l, const struct netbsd32_fchmod_args *uap, register_t *retval) 1024netbsd32_fchmod(struct lwp *l, const struct netbsd32_fchmod_args *uap, register_t *retval)
1017{ 1025{
1018 /* { 1026 /* {
1019 syscallarg(int) fd; 1027 syscallarg(int) fd;
1020 syscallarg(mode_t) mode; 1028 syscallarg(mode_t) mode;
1021 } */ 1029 } */
1022 struct sys_fchmod_args ua; 1030 struct sys_fchmod_args ua;
1023 1031
1024 NETBSD32TO64_UAP(fd); 1032 NETBSD32TO64_UAP(fd);
1025 NETBSD32TO64_UAP(mode); 1033 NETBSD32TO64_UAP(mode);
1026 1034
1027 return sys_fchmod(l, &ua, retval); 1035 return sys_fchmod(l, &ua, retval);
1028} 1036}
1029 1037
1030int 1038int
1031netbsd32_setreuid(struct lwp *l, const struct netbsd32_setreuid_args *uap, register_t *retval) 1039netbsd32_setreuid(struct lwp *l, const struct netbsd32_setreuid_args *uap, register_t *retval)
1032{ 1040{
1033 /* { 1041 /* {
1034 syscallarg(uid_t) ruid; 1042 syscallarg(uid_t) ruid;
1035 syscallarg(uid_t) euid; 1043 syscallarg(uid_t) euid;
1036 } */ 1044 } */
1037 struct sys_setreuid_args ua; 1045 struct sys_setreuid_args ua;
1038 1046
1039 NETBSD32TO64_UAP(ruid); 1047 NETBSD32TO64_UAP(ruid);
1040 NETBSD32TO64_UAP(euid); 1048 NETBSD32TO64_UAP(euid);
1041 return sys_setreuid(l, &ua, retval); 1049 return sys_setreuid(l, &ua, retval);
1042} 1050}
1043 1051
1044int 1052int
1045netbsd32_setregid(struct lwp *l, const struct netbsd32_setregid_args *uap, register_t *retval) 1053netbsd32_setregid(struct lwp *l, const struct netbsd32_setregid_args *uap, register_t *retval)
1046{ 1054{
1047 /* { 1055 /* {
1048 syscallarg(gid_t) rgid; 1056 syscallarg(gid_t) rgid;
1049 syscallarg(gid_t) egid; 1057 syscallarg(gid_t) egid;
1050 } */ 1058 } */
1051 struct sys_setregid_args ua; 1059 struct sys_setregid_args ua;
1052 1060
1053 NETBSD32TO64_UAP(rgid); 1061 NETBSD32TO64_UAP(rgid);
1054 NETBSD32TO64_UAP(egid); 1062 NETBSD32TO64_UAP(egid);
1055 1063
1056 return sys_setregid(l, &ua, retval); 1064 return sys_setregid(l, &ua, retval);
1057} 1065}
1058 1066
1059int 1067int
1060netbsd32_getsockopt(struct lwp *l, const struct netbsd32_getsockopt_args *uap, register_t *retval) 1068netbsd32_getsockopt(struct lwp *l, const struct netbsd32_getsockopt_args *uap, register_t *retval)
1061{ 1069{
1062 /* { 1070 /* {
1063 syscallarg(int) s; 1071 syscallarg(int) s;
1064 syscallarg(int) level; 1072 syscallarg(int) level;
1065 syscallarg(int) name; 1073 syscallarg(int) name;
1066 syscallarg(netbsd32_voidp) val; 1074 syscallarg(netbsd32_voidp) val;
1067 syscallarg(netbsd32_intp) avalsize; 1075 syscallarg(netbsd32_intp) avalsize;
1068 } */ 1076 } */
1069 struct sys_getsockopt_args ua; 1077 struct sys_getsockopt_args ua;
1070 1078
1071 NETBSD32TO64_UAP(s); 1079 NETBSD32TO64_UAP(s);
1072 NETBSD32TO64_UAP(level); 1080 NETBSD32TO64_UAP(level);
1073 NETBSD32TO64_UAP(name); 1081 NETBSD32TO64_UAP(name);
1074 NETBSD32TOP_UAP(val, void); 1082 NETBSD32TOP_UAP(val, void);
1075 NETBSD32TOP_UAP(avalsize, socklen_t); 1083 NETBSD32TOP_UAP(avalsize, socklen_t);
1076 1084
1077 return sys_getsockopt(l, &ua, retval); 1085 return sys_getsockopt(l, &ua, retval);
1078} 1086}
1079 1087
1080int 1088int
1081netbsd32_getsockopt2(struct lwp *l, const struct netbsd32_getsockopt2_args *uap, register_t *retval) 1089netbsd32_getsockopt2(struct lwp *l, const struct netbsd32_getsockopt2_args *uap, register_t *retval)
1082{ 1090{
1083 /* { 1091 /* {
1084 syscallarg(int) s; 1092 syscallarg(int) s;
1085 syscallarg(int) level; 1093 syscallarg(int) level;
1086 syscallarg(int) name; 1094 syscallarg(int) name;
1087 syscallarg(netbsd32_voidp) val; 1095 syscallarg(netbsd32_voidp) val;
1088 syscallarg(netbsd32_intp) avalsize; 1096 syscallarg(netbsd32_intp) avalsize;
1089 } */ 1097 } */
1090 struct sys_getsockopt2_args ua; 1098 struct sys_getsockopt2_args ua;
1091 1099
1092 NETBSD32TO64_UAP(s); 1100 NETBSD32TO64_UAP(s);
1093 NETBSD32TO64_UAP(level); 1101 NETBSD32TO64_UAP(level);
1094 NETBSD32TO64_UAP(name); 1102 NETBSD32TO64_UAP(name);
1095 NETBSD32TOP_UAP(val, void); 1103 NETBSD32TOP_UAP(val, void);
1096 NETBSD32TOP_UAP(avalsize, socklen_t); 1104 NETBSD32TOP_UAP(avalsize, socklen_t);
1097 1105
1098 return sys_getsockopt2(l, &ua, retval); 1106 return sys_getsockopt2(l, &ua, retval);
1099} 1107}
1100 1108
1101int 1109int
1102netbsd32_rename(struct lwp *l, const struct netbsd32_rename_args *uap, register_t *retval) 1110netbsd32_rename(struct lwp *l, const struct netbsd32_rename_args *uap, register_t *retval)
1103{ 1111{
1104 /* { 1112 /* {
1105 syscallarg(const netbsd32_charp) from; 1113 syscallarg(const netbsd32_charp) from;
1106 syscallarg(const netbsd32_charp) to; 1114 syscallarg(const netbsd32_charp) to;
1107 } */ 1115 } */
1108 struct sys_rename_args ua; 1116 struct sys_rename_args ua;
1109 1117
1110 NETBSD32TOP_UAP(from, const char); 1118 NETBSD32TOP_UAP(from, const char);
1111 NETBSD32TOP_UAP(to, const char); 1119 NETBSD32TOP_UAP(to, const char);
1112 1120
1113 return sys_rename(l, &ua, retval); 1121 return sys_rename(l, &ua, retval);
1114} 1122}
1115 1123
1116int 1124int
1117netbsd32_flock(struct lwp *l, const struct netbsd32_flock_args *uap, register_t *retval) 1125netbsd32_flock(struct lwp *l, const struct netbsd32_flock_args *uap, register_t *retval)
1118{ 1126{
1119 /* { 1127 /* {
1120 syscallarg(int) fd; 1128 syscallarg(int) fd;
1121 syscallarg(int) how; 1129 syscallarg(int) how;
1122 } */ 1130 } */
1123 struct sys_flock_args ua; 1131 struct sys_flock_args ua;
1124 1132
1125 NETBSD32TO64_UAP(fd); 1133 NETBSD32TO64_UAP(fd);
1126 NETBSD32TO64_UAP(how); 1134 NETBSD32TO64_UAP(how);
1127 1135
1128 return sys_flock(l, &ua, retval); 1136 return sys_flock(l, &ua, retval);
1129} 1137}
1130 1138
1131int 1139int
1132netbsd32_mkfifo(struct lwp *l, const struct netbsd32_mkfifo_args *uap, register_t *retval) 1140netbsd32_mkfifo(struct lwp *l, const struct netbsd32_mkfifo_args *uap, register_t *retval)
1133{ 1141{
1134 /* { 1142 /* {
1135 syscallarg(const netbsd32_charp) path; 1143 syscallarg(const netbsd32_charp) path;
1136 syscallarg(mode_t) mode; 1144 syscallarg(mode_t) mode;
1137 } */ 1145 } */
1138 struct sys_mkfifo_args ua; 1146 struct sys_mkfifo_args ua;
1139 1147
1140 NETBSD32TOP_UAP(path, const char); 1148 NETBSD32TOP_UAP(path, const char);
1141 NETBSD32TO64_UAP(mode); 1149 NETBSD32TO64_UAP(mode);
1142 1150
1143 return sys_mkfifo(l, &ua, retval); 1151 return sys_mkfifo(l, &ua, retval);
1144} 1152}
1145 1153
1146int 1154int
1147netbsd32_shutdown(struct lwp *l, const struct netbsd32_shutdown_args *uap, register_t *retval) 1155netbsd32_shutdown(struct lwp *l, const struct netbsd32_shutdown_args *uap, register_t *retval)
1148{ 1156{
1149 /* { 1157 /* {
1150 syscallarg(int) s; 1158 syscallarg(int) s;
1151 syscallarg(int) how; 1159 syscallarg(int) how;
1152 } */ 1160 } */
1153 struct sys_shutdown_args ua; 1161 struct sys_shutdown_args ua;
1154 1162
1155 NETBSD32TO64_UAP(s); 1163 NETBSD32TO64_UAP(s);
1156 NETBSD32TO64_UAP(how); 1164 NETBSD32TO64_UAP(how);
1157 1165
1158 return sys_shutdown(l, &ua, retval); 1166 return sys_shutdown(l, &ua, retval);
1159} 1167}
1160 1168
1161int 1169int
1162netbsd32_socketpair(struct lwp *l, const struct netbsd32_socketpair_args *uap, register_t *retval) 1170netbsd32_socketpair(struct lwp *l, const struct netbsd32_socketpair_args *uap, register_t *retval)
1163{ 1171{
1164 /* { 1172 /* {
1165 syscallarg(int) domain; 1173 syscallarg(int) domain;
1166 syscallarg(int) type; 1174 syscallarg(int) type;
1167 syscallarg(int) protocol; 1175 syscallarg(int) protocol;
1168 syscallarg(netbsd32_intp) rsv; 1176 syscallarg(netbsd32_intp) rsv;
1169 } */ 1177 } */
1170 struct sys_socketpair_args ua; 1178 struct sys_socketpair_args ua;
1171 1179
1172 NETBSD32TO64_UAP(domain); 1180 NETBSD32TO64_UAP(domain);
1173 NETBSD32TO64_UAP(type); 1181 NETBSD32TO64_UAP(type);
1174 NETBSD32TO64_UAP(protocol); 1182 NETBSD32TO64_UAP(protocol);
1175 NETBSD32TOP_UAP(rsv, int); 1183 NETBSD32TOP_UAP(rsv, int);
1176 1184
1177 /* Since we're just copying out two `int's we can do this */ 1185 /* Since we're just copying out two `int's we can do this */
1178 return sys_socketpair(l, &ua, retval); 1186 return sys_socketpair(l, &ua, retval);
1179} 1187}
1180 1188
1181int 1189int
1182netbsd32_mkdir(struct lwp *l, const struct netbsd32_mkdir_args *uap, register_t *retval) 1190netbsd32_mkdir(struct lwp *l, const struct netbsd32_mkdir_args *uap, register_t *retval)
1183{ 1191{
1184 /* { 1192 /* {
1185 syscallarg(const netbsd32_charp) path; 1193 syscallarg(const netbsd32_charp) path;
1186 syscallarg(mode_t) mode; 1194 syscallarg(mode_t) mode;
1187 } */ 1195 } */
1188 struct sys_mkdir_args ua; 1196 struct sys_mkdir_args ua;
1189 1197
1190 NETBSD32TOP_UAP(path, const char); 1198 NETBSD32TOP_UAP(path, const char);
1191 NETBSD32TO64_UAP(mode); 1199 NETBSD32TO64_UAP(mode);
1192 1200
1193 return sys_mkdir(l, &ua, retval); 1201 return sys_mkdir(l, &ua, retval);
1194} 1202}
1195 1203
1196int 1204int
1197netbsd32_rmdir(struct lwp *l, const struct netbsd32_rmdir_args *uap, register_t *retval) 1205netbsd32_rmdir(struct lwp *l, const struct netbsd32_rmdir_args *uap, register_t *retval)
1198{ 1206{
1199 /* { 1207 /* {
1200 syscallarg(const netbsd32_charp) path; 1208 syscallarg(const netbsd32_charp) path;
1201 } */ 1209 } */
1202 struct sys_rmdir_args ua; 1210 struct sys_rmdir_args ua;
1203 1211
1204 NETBSD32TOP_UAP(path, const char); 1212 NETBSD32TOP_UAP(path, const char);
1205 1213
1206 return sys_rmdir(l, &ua, retval); 1214 return sys_rmdir(l, &ua, retval);
1207} 1215}
1208 1216
1209int 1217// XXX new file
1210netbsd32___quotactl(struct lwp *l, const struct netbsd32___quotactl_args *uap, register_t *retval) 
1211{ 
1212 /* { 
1213 syscallarg(const netbsd32_charp) path; 
1214 syscallarg(netbsd32_voidp) args; 
1215 } */ 
1216 struct netbsd32_quotactlargs args32; 
1217 struct quotactl_args args; 
1218 int error; 
1219 
1220 error = copyin(SCARG_P32(uap, args), &args32, sizeof(args32)); 
1221 if (error) { 
1222 return error; 
1223 } 
1224 
1225 args.qc_op = args32.qc_op; 
1226 switch (args.qc_op) { 
1227 case QUOTACTL_STAT: 
1228 args.u.stat.qc_info = NETBSD32PTR64(args32.u.stat.qc_info); 
1229 break; 
1230 case QUOTACTL_IDTYPESTAT: 
1231 args.u.idtypestat.qc_idtype = args32.u.idtypestat.qc_idtype; 
1232 args.u.idtypestat.qc_info = 
1233 NETBSD32PTR64(args32.u.idtypestat.qc_info); 
1234 break; 
1235 case QUOTACTL_OBJTYPESTAT: 
1236 args.u.objtypestat.qc_objtype = 
1237 args32.u.objtypestat.qc_objtype; 
1238 args.u.objtypestat.qc_info = 
1239 NETBSD32PTR64(args32.u.objtypestat.qc_info); 
1240 break; 
1241 case QUOTACTL_GET: 
1242 args.u.get.qc_key = NETBSD32PTR64(args32.u.get.qc_key); 
1243 args.u.get.qc_val = NETBSD32PTR64(args32.u.get.qc_val); 
1244 break; 
1245 case QUOTACTL_PUT: 
1246 args.u.put.qc_key = NETBSD32PTR64(args32.u.put.qc_key); 
1247 args.u.put.qc_val = NETBSD32PTR64(args32.u.put.qc_val); 
1248 break; 
1249 case QUOTACTL_DEL: 
1250 args.u.del.qc_key = NETBSD32PTR64(args32.u.del.qc_key); 
1251 break; 
1252 case QUOTACTL_CURSOROPEN: 
1253 args.u.cursoropen.qc_cursor = 
1254 NETBSD32PTR64(args32.u.cursoropen.qc_cursor); 
1255 break; 
1256 case QUOTACTL_CURSORCLOSE: 
1257 args.u.cursorclose.qc_cursor = 
1258 NETBSD32PTR64(args32.u.cursorclose.qc_cursor); 
1259 break; 
1260 case QUOTACTL_CURSORSKIPIDTYPE: 
1261 args.u.cursorskipidtype.qc_cursor = 
1262 NETBSD32PTR64(args32.u.cursorskipidtype.qc_cursor); 
1263 args.u.cursorskipidtype.qc_idtype = 
1264 args32.u.cursorskipidtype.qc_idtype; 
1265 break; 
1266 case QUOTACTL_CURSORGET: 
1267 args.u.cursorget.qc_cursor = 
1268 NETBSD32PTR64(args32.u.cursorget.qc_cursor); 
1269 args.u.cursorget.qc_keys = 
1270 NETBSD32PTR64(args32.u.cursorget.qc_keys); 
1271 args.u.cursorget.qc_vals = 
1272 NETBSD32PTR64(args32.u.cursorget.qc_vals); 
1273 args.u.cursorget.qc_maxnum = 
1274 args32.u.cursorget.qc_maxnum; 
1275 args.u.cursorget.qc_ret = 
1276 NETBSD32PTR64(args32.u.cursorget.qc_ret); 
1277 break; 
1278 case QUOTACTL_CURSORATEND: 
1279 args.u.cursoratend.qc_cursor = 
1280 NETBSD32PTR64(args32.u.cursoratend.qc_cursor); 
1281 args.u.cursoratend.qc_ret = 
1282 NETBSD32PTR64(args32.u.cursoratend.qc_ret); 
1283 break; 
1284 case QUOTACTL_CURSORREWIND: 
1285 args.u.cursorrewind.qc_cursor = 
1286 NETBSD32PTR64(args32.u.cursorrewind.qc_cursor); 
1287 break; 
1288 case QUOTACTL_QUOTAON: 
1289 args.u.quotaon.qc_idtype = args32.u.quotaon.qc_idtype; 
1290 args.u.quotaon.qc_quotafile = 
1291 NETBSD32PTR64(args32.u.quotaon.qc_quotafile); 
1292 break; 
1293 case QUOTACTL_QUOTAOFF: 
1294 args.u.quotaoff.qc_idtype = args32.u.quotaoff.qc_idtype; 
1295 break; 
1296 default: 
1297 return EINVAL; 
1298 } 
1299 
1300 return do_sys_quotactl(SCARG_P32(uap, path), &args); 
1301} 
1302 
1303int 1218int
1304netbsd32___getfh30(struct lwp *l, const struct netbsd32___getfh30_args *uap, register_t *retval) 1219netbsd32___getfh30(struct lwp *l, const struct netbsd32___getfh30_args *uap, register_t *retval)
1305{ 1220{
1306 /* { 1221 /* {
1307 syscallarg(const netbsd32_charp) fname; 1222 syscallarg(const netbsd32_charp) fname;
1308 syscallarg(netbsd32_fhandlep_t) fhp; 1223 syscallarg(netbsd32_fhandlep_t) fhp;
1309 syscallarg(netbsd32_size_tp) fh_size; 1224 syscallarg(netbsd32_size_tp) fh_size;
1310 } */ 1225 } */
1311 struct vnode *vp; 1226 struct vnode *vp;
1312 fhandle_t *fh; 1227 fhandle_t *fh;
1313 int error; 1228 int error;
1314 struct pathbuf *pb; 1229 struct pathbuf *pb;
1315 struct nameidata nd; 1230 struct nameidata nd;
1316 netbsd32_size_t usz32, sz32; 1231 netbsd32_size_t usz32, sz32;
1317 size_t sz; 1232 size_t sz;
1318 1233
1319 /* 1234 /*
1320 * Must be super user 1235 * Must be super user
1321 */ 1236 */
1322 error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FILEHANDLE, 1237 error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FILEHANDLE,
1323 0, NULL, NULL, NULL); 1238 0, NULL, NULL, NULL);
1324 if (error) 1239 if (error)
1325 return error; 1240 return error;
1326 1241
1327 error = pathbuf_copyin(SCARG_P32(uap, fname), &pb); 1242 error = pathbuf_copyin(SCARG_P32(uap, fname), &pb);
1328 if (error) { 1243 if (error) {
1329 return error; 1244 return error;
1330 } 1245 }
1331 1246
1332 NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb); 1247 NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
1333 error = namei(&nd); 1248 error = namei(&nd);
1334 if (error) { 1249 if (error) {
1335 pathbuf_destroy(pb); 1250 pathbuf_destroy(pb);
1336 return error; 1251 return error;
1337 } 1252 }
1338 vp = nd.ni_vp; 1253 vp = nd.ni_vp;
1339 pathbuf_destroy(pb); 1254 pathbuf_destroy(pb);
1340 1255
1341 error = vfs_composefh_alloc(vp, &fh); 1256 error = vfs_composefh_alloc(vp, &fh);
1342 vput(vp); 1257 vput(vp);
1343 if (error != 0) { 1258 if (error != 0) {
1344 return error; 1259 return error;
1345 } 1260 }
1346 error = copyin(SCARG_P32(uap, fh_size), &usz32, sizeof(usz32)); 1261 error = copyin(SCARG_P32(uap, fh_size), &usz32, sizeof(usz32));
1347 if (error != 0) { 1262 if (error != 0) {
1348 goto out; 1263 goto out;
1349 } 1264 }
1350 sz = FHANDLE_SIZE(fh); 1265 sz = FHANDLE_SIZE(fh);
1351 sz32 = sz; 1266 sz32 = sz;
1352 1267
1353 error = copyout(&sz32, SCARG_P32(uap, fh_size), sizeof(sz32)); 1268 error = copyout(&sz32, SCARG_P32(uap, fh_size), sizeof(sz32));
1354 if (error != 0) { 1269 if (error != 0) {
1355 goto out; 1270 goto out;
1356 } 1271 }
1357 if (usz32 >= sz32) { 1272 if (usz32 >= sz32) {
1358 error = copyout(fh, SCARG_P32(uap, fhp), sz); 1273 error = copyout(fh, SCARG_P32(uap, fhp), sz);
1359 } else { 1274 } else {
1360 error = E2BIG; 1275 error = E2BIG;
1361 } 1276 }
1362out: 1277out:
1363 vfs_composefh_free(fh); 1278 vfs_composefh_free(fh);
1364 return error; 1279 return error;
1365} 1280}
1366 1281
1367int 1282int
1368netbsd32_pread(struct lwp *l, const struct netbsd32_pread_args *uap, register_t *retval) 1283netbsd32_pread(struct lwp *l, const struct netbsd32_pread_args *uap, register_t *retval)
1369{ 1284{
1370 /* { 1285 /* {
1371 syscallarg(int) fd; 1286 syscallarg(int) fd;
1372 syscallarg(netbsd32_voidp) buf; 1287 syscallarg(netbsd32_voidp) buf;
1373 syscallarg(netbsd32_size_t) nbyte; 1288 syscallarg(netbsd32_size_t) nbyte;
1374 syscallarg(int) PAD; 1289 syscallarg(int) PAD;
1375 syscallarg(netbsd32_off_t) offset; 1290 syscallarg(netbsd32_off_t) offset;
1376 } */ 1291 } */
1377 struct sys_pread_args ua; 1292 struct sys_pread_args ua;
1378 1293
1379 NETBSD32TO64_UAP(fd); 1294 NETBSD32TO64_UAP(fd);
1380 NETBSD32TOP_UAP(buf, void); 1295 NETBSD32TOP_UAP(buf, void);
1381 NETBSD32TOX_UAP(nbyte, size_t); 1296 NETBSD32TOX_UAP(nbyte, size_t);
1382 NETBSD32TO64_UAP(PAD); 1297 NETBSD32TO64_UAP(PAD);
1383 NETBSD32TO64_UAP(offset); 1298 NETBSD32TO64_UAP(offset);
1384 1299
1385 return sys_pread(l, &ua, retval); 1300 return sys_pread(l, &ua, retval);
1386} 1301}
1387 1302
1388int 1303int
1389netbsd32_pwrite(struct lwp *l, const struct netbsd32_pwrite_args *uap, register_t *retval) 1304netbsd32_pwrite(struct lwp *l, const struct netbsd32_pwrite_args *uap, register_t *retval)
1390{ 1305{
1391 /* { 1306 /* {
1392 syscallarg(int) fd; 1307 syscallarg(int) fd;
1393 syscallarg(const netbsd32_voidp) buf; 1308 syscallarg(const netbsd32_voidp) buf;
1394 syscallarg(netbsd32_size_t) nbyte; 1309 syscallarg(netbsd32_size_t) nbyte;
1395 syscallarg(int) PAD; 1310 syscallarg(int) PAD;
1396 syscallarg(netbsd32_off_t) offset; 1311 syscallarg(netbsd32_off_t) offset;
1397 } */ 1312 } */
1398 struct sys_pwrite_args ua; 1313 struct sys_pwrite_args ua;
1399 1314
1400 NETBSD32TO64_UAP(fd); 1315 NETBSD32TO64_UAP(fd);
1401 NETBSD32TOP_UAP(buf, void); 1316 NETBSD32TOP_UAP(buf, void);
1402 NETBSD32TOX_UAP(nbyte, size_t); 1317 NETBSD32TOX_UAP(nbyte, size_t);
1403 NETBSD32TO64_UAP(PAD); 1318 NETBSD32TO64_UAP(PAD);
1404 NETBSD32TO64_UAP(offset); 1319 NETBSD32TO64_UAP(offset);
1405 1320
1406 return sys_pwrite(l, &ua, retval); 1321 return sys_pwrite(l, &ua, retval);
1407} 1322}
1408 1323
1409int 1324int
1410netbsd32_setgid(struct lwp *l, const struct netbsd32_setgid_args *uap, register_t *retval) 1325netbsd32_setgid(struct lwp *l, const struct netbsd32_setgid_args *uap, register_t *retval)
1411{ 1326{
1412 /* { 1327 /* {
1413 syscallarg(gid_t) gid; 1328 syscallarg(gid_t) gid;
1414 } */ 1329 } */
1415 struct sys_setgid_args ua; 1330 struct sys_setgid_args ua;
1416 1331
1417 NETBSD32TO64_UAP(gid); 1332 NETBSD32TO64_UAP(gid);
1418 1333
1419 return sys_setgid(l, &ua, retval); 1334 return sys_setgid(l, &ua, retval);
1420} 1335}
1421 1336
1422int 1337int
1423netbsd32_setegid(struct lwp *l, const struct netbsd32_setegid_args *uap, register_t *retval) 1338netbsd32_setegid(struct lwp *l, const struct netbsd32_setegid_args *uap, register_t *retval)
1424{ 1339{
1425 /* { 1340 /* {
1426 syscallarg(gid_t) egid; 1341 syscallarg(gid_t) egid;
1427 } */ 1342 } */
1428 struct sys_setegid_args ua; 1343 struct sys_setegid_args ua;
1429 1344
1430 NETBSD32TO64_UAP(egid); 1345 NETBSD32TO64_UAP(egid);
1431 1346
1432 return sys_setegid(l, &ua, retval); 1347 return sys_setegid(l, &ua, retval);
1433} 1348}
1434 1349
1435int 1350int
1436netbsd32_seteuid(struct lwp *l, const struct netbsd32_seteuid_args *uap, register_t *retval) 1351netbsd32_seteuid(struct lwp *l, const struct netbsd32_seteuid_args *uap, register_t *retval)
1437{ 1352{
1438 /* { 1353 /* {
1439 syscallarg(gid_t) euid; 1354 syscallarg(gid_t) euid;
1440 } */ 1355 } */
1441 struct sys_seteuid_args ua; 1356 struct sys_seteuid_args ua;
1442 1357
1443 NETBSD32TO64_UAP(euid); 1358 NETBSD32TO64_UAP(euid);
1444 1359
1445 return sys_seteuid(l, &ua, retval); 1360 return sys_seteuid(l, &ua, retval);
1446} 1361}
1447 1362
1448int 1363int
1449netbsd32_pathconf(struct lwp *l, const struct netbsd32_pathconf_args *uap, register_t *retval) 1364netbsd32_pathconf(struct lwp *l, const struct netbsd32_pathconf_args *uap, register_t *retval)
1450{ 1365{
1451 /* { 1366 /* {
1452 syscallarg(netbsd32_charp) path; 1367 syscallarg(netbsd32_charp) path;
1453 syscallarg(int) name; 1368 syscallarg(int) name;
1454 } */ 1369 } */
1455 struct sys_pathconf_args ua; 1370 struct sys_pathconf_args ua;
1456 1371
1457 NETBSD32TOP_UAP(path, const char); 1372 NETBSD32TOP_UAP(path, const char);
1458 NETBSD32TO64_UAP(name); 1373 NETBSD32TO64_UAP(name);
1459 1374
1460 return sys_pathconf(l, &ua, retval); 1375 return sys_pathconf(l, &ua, retval);
1461} 1376}
1462 1377
1463int 1378int
1464netbsd32_fpathconf(struct lwp *l, const struct netbsd32_fpathconf_args *uap, register_t *retval) 1379netbsd32_fpathconf(struct lwp *l, const struct netbsd32_fpathconf_args *uap, register_t *retval)
1465{ 1380{
1466 /* { 1381 /* {
1467 syscallarg(int) fd; 1382 syscallarg(int) fd;
1468 syscallarg(int) name; 1383 syscallarg(int) name;
1469 } */ 1384 } */
1470 struct sys_fpathconf_args ua; 1385 struct sys_fpathconf_args ua;
1471 1386
1472 NETBSD32TO64_UAP(fd); 1387 NETBSD32TO64_UAP(fd);
1473 NETBSD32TO64_UAP(name); 1388 NETBSD32TO64_UAP(name);
1474 return sys_fpathconf(l, &ua, retval); 
1475} 
1476 1389
1477static void 1390 return sys_fpathconf(l, &ua, retval);
1478fixlimit(int which, struct rlimit *alim) 
1479{ 
1480 switch (which) { 
1481 case RLIMIT_DATA: 
1482 if (LIMITCHECK(alim->rlim_cur, MAXDSIZ32)) 
1483 alim->rlim_cur = MAXDSIZ32; 
1484 if (LIMITCHECK(alim->rlim_max, MAXDSIZ32)) 
1485 alim->rlim_max = MAXDSIZ32; 
1486 return; 
1487 case RLIMIT_STACK: 
1488 if (LIMITCHECK(alim->rlim_cur, MAXSSIZ32)) 
1489 alim->rlim_cur = MAXSSIZ32; 
1490 if (LIMITCHECK(alim->rlim_max, MAXSSIZ32)) 
1491 alim->rlim_max = MAXSSIZ32; 
1492 return; 
1493 default: 
1494 return; 
1495 } 
1496} 
1497 
1498int 
1499netbsd32_getrlimit(struct lwp *l, const struct netbsd32_getrlimit_args *uap, 
1500 register_t *retval) 
1501{ 
1502 /* { 
1503 syscallarg(int) which; 
1504 syscallarg(netbsd32_rlimitp_t) rlp; 
1505 } */ 
1506 int which = SCARG(uap, which); 
1507 struct rlimit alim; 
1508 
1509 if ((u_int)which >= RLIM_NLIMITS) 
1510 return EINVAL; 
1511 
1512 alim = l->l_proc->p_rlimit[which]; 
1513 
1514 fixlimit(which, &alim); 
1515 
1516 return copyout(&alim, SCARG_P32(uap, rlp), sizeof(alim)); 
1517} 
1518 
1519int 
1520netbsd32_setrlimit(struct lwp *l, const struct netbsd32_setrlimit_args *uap, 
1521 register_t *retval) 
1522{ 
1523 /* { 
1524 syscallarg(int) which; 
1525 syscallarg(const netbsd32_rlimitp_t) rlp; 
1526 } */ 
1527 int which = SCARG(uap, which); 
1528 struct rlimit alim; 
1529 int error; 
1530 
1531 if ((u_int)which >= RLIM_NLIMITS) 
1532 return EINVAL; 
1533 
1534 error = copyin(SCARG_P32(uap, rlp), &alim, sizeof(struct rlimit)); 
1535 if (error) 
1536 return error; 
1537 
1538 fixlimit(which, &alim); 
1539 
1540 return dosetrlimit(l, l->l_proc, which, &alim); 
1541} 1391}
1542 1392
 1393// XXX new file
1543int 1394int
1544netbsd32_mmap(struct lwp *l, const struct netbsd32_mmap_args *uap, register_t *retval) 1395netbsd32_mmap(struct lwp *l, const struct netbsd32_mmap_args *uap, register_t *retval)
1545{ 1396{
1546 /* { 1397 /* {
1547 syscallarg(netbsd32_voidp) addr; 1398 syscallarg(netbsd32_voidp) addr;
1548 syscallarg(netbsd32_size_t) len; 1399 syscallarg(netbsd32_size_t) len;
1549 syscallarg(int) prot; 1400 syscallarg(int) prot;
1550 syscallarg(int) flags; 1401 syscallarg(int) flags;
1551 syscallarg(int) fd; 1402 syscallarg(int) fd;
1552 syscallarg(netbsd32_long) PAD; 1403 syscallarg(netbsd32_long) PAD;
1553 syscallarg(netbsd32_off_t) pos; 1404 syscallarg(netbsd32_off_t) pos;
1554 } */ 1405 } */
1555 struct sys_mmap_args ua; 1406 struct sys_mmap_args ua;
1556 int error; 1407 int error;
1557 1408
1558 NETBSD32TOP_UAP(addr, void); 1409 NETBSD32TOP_UAP(addr, void);
1559 NETBSD32TOX_UAP(len, size_t); 1410 NETBSD32TOX_UAP(len, size_t);
1560 NETBSD32TO64_UAP(prot); 1411 NETBSD32TO64_UAP(prot);
1561 NETBSD32TO64_UAP(flags); 1412 NETBSD32TO64_UAP(flags);
1562#ifdef __x86_64__ 1413#ifdef __x86_64__
1563 /* 1414 /*
1564 * Ancient kernel on x86 did not obey PROT_EXEC on i386 at least 1415 * Ancient kernel on x86 did not obey PROT_EXEC on i386 at least
1565 * and ld.so did not turn it on! 1416 * and ld.so did not turn it on!
1566 */ 1417 */
1567 if (SCARG(&ua, flags) & COMPAT_MAP_COPY) { 1418 if (SCARG(&ua, flags) & COMPAT_MAP_COPY) {
1568 SCARG(&ua, flags) = MAP_PRIVATE 1419 SCARG(&ua, flags) = MAP_PRIVATE
1569 | (SCARG(&ua, flags) & ~COMPAT_MAP_COPY); 1420 | (SCARG(&ua, flags) & ~COMPAT_MAP_COPY);
1570 SCARG(&ua, prot) |= PROT_EXEC; 1421 SCARG(&ua, prot) |= PROT_EXEC;
1571 } 1422 }
1572#endif 1423#endif
1573 NETBSD32TO64_UAP(fd); 1424 NETBSD32TO64_UAP(fd);
1574 NETBSD32TOX_UAP(PAD, long); 1425 NETBSD32TOX_UAP(PAD, long);
1575 NETBSD32TOX_UAP(pos, off_t); 1426 NETBSD32TOX_UAP(pos, off_t);
1576#ifdef DEBUG_MMAP 1427#ifdef DEBUG_MMAP
1577 printf("mmap(addr=0x%lx, len=0x%lx, prot=0x%lx, flags=0x%lx, " 1428 printf("mmap(addr=0x%lx, len=0x%lx, prot=0x%lx, flags=0x%lx, "
1578 "fd=%ld, pos=0x%lx);\n", 1429 "fd=%ld, pos=0x%lx);\n",
1579 (long)SCARG(&ua, addr), (long)SCARG(&ua, len), 1430 (long)SCARG(&ua, addr), (long)SCARG(&ua, len),
1580 (long)SCARG(&ua, prot), (long)SCARG(&ua, flags), 1431 (long)SCARG(&ua, prot), (long)SCARG(&ua, flags),
1581 (long)SCARG(&ua, fd), (long)SCARG(&ua, pos)); 1432 (long)SCARG(&ua, fd), (long)SCARG(&ua, pos));
1582#endif 1433#endif
1583 1434
1584 error = sys_mmap(l, &ua, retval); 1435 error = sys_mmap(l, &ua, retval);
1585 if ((u_long)*retval > (u_long)UINT_MAX) { 1436 if ((u_long)*retval > (u_long)UINT_MAX) {
1586 printf("netbsd32_mmap: retval out of range: 0x%lx\n", 1437 printf("netbsd32_mmap: retval out of range: 0x%lx\n",
1587 (u_long)*retval); 1438 (u_long)*retval);
1588 /* Should try to recover and return an error here. */ 1439 /* Should try to recover and return an error here. */
1589 } 1440 }
1590 return error; 1441 return error;
1591} 1442}
1592 1443
1593int 1444int
1594netbsd32_mremap(struct lwp *l, const struct netbsd32_mremap_args *uap, register_t *retval) 1445netbsd32_mremap(struct lwp *l, const struct netbsd32_mremap_args *uap, register_t *retval)
1595{ 1446{
1596 /* { 1447 /* {
1597 syscallarg(void *) old_address; 1448 syscallarg(void *) old_address;
1598 syscallarg(size_t) old_size; 1449 syscallarg(size_t) old_size;
1599 syscallarg(void *) new_address; 1450 syscallarg(void *) new_address;
1600 syscallarg(size_t) new_size; 1451 syscallarg(size_t) new_size;
1601 syscallarg(int) flags; 1452 syscallarg(int) flags;
1602 } */ 1453 } */
1603 struct sys_mremap_args ua; 1454 struct sys_mremap_args ua;
1604 1455
1605 NETBSD32TOP_UAP(old_address, void); 1456 NETBSD32TOP_UAP(old_address, void);
1606 NETBSD32TOX_UAP(old_size, size_t); 1457 NETBSD32TOX_UAP(old_size, size_t);
1607 NETBSD32TOP_UAP(new_address, void); 1458 NETBSD32TOP_UAP(new_address, void);
1608 NETBSD32TOX_UAP(new_size, size_t); 1459 NETBSD32TOX_UAP(new_size, size_t);
1609 NETBSD32TO64_UAP(flags); 1460 NETBSD32TO64_UAP(flags);
1610 1461
1611 return sys_mremap(l, &ua, retval); 1462 return sys_mremap(l, &ua, retval);
1612} 1463}
1613 1464
1614int 1465int
1615netbsd32_lseek(struct lwp *l, const struct netbsd32_lseek_args *uap, register_t *retval) 1466netbsd32_lseek(struct lwp *l, const struct netbsd32_lseek_args *uap, register_t *retval)
1616{ 1467{
1617 /* { 1468 /* {
1618 syscallarg(int) fd; 1469 syscallarg(int) fd;
1619 syscallarg(int) PAD; 1470 syscallarg(int) PAD;
1620 syscallarg(netbsd32_off_t) offset; 1471 syscallarg(netbsd32_off_t) offset;
1621 syscallarg(int) whence; 1472 syscallarg(int) whence;
1622 } */ 1473 } */
1623 struct sys_lseek_args ua; 1474 struct sys_lseek_args ua;
1624 union { 1475 union {
1625 register_t retval64[2]; 1476 register_t retval64[2];
1626 register32_t retval32[4]; 1477 register32_t retval32[4];
1627 } newpos; 1478 } newpos;
1628 int rv; 1479 int rv;
1629 1480
1630 NETBSD32TO64_UAP(fd); 1481 NETBSD32TO64_UAP(fd);
1631 NETBSD32TO64_UAP(PAD); 1482 NETBSD32TO64_UAP(PAD);
1632 NETBSD32TO64_UAP(offset); 1483 NETBSD32TO64_UAP(offset);
1633 NETBSD32TO64_UAP(whence); 1484 NETBSD32TO64_UAP(whence);
1634 rv = sys_lseek(l, &ua, newpos.retval64); 1485 rv = sys_lseek(l, &ua, newpos.retval64);
1635 1486
1636 /* 1487 /*
1637 * We have to split the 64 bit value into 2 halves which will 1488 * We have to split the 64 bit value into 2 halves which will
1638 * end up in separate 32 bit registers. 1489 * end up in separate 32 bit registers.
1639 * This should DTRT on big and little-endian systems provided that 1490 * This should DTRT on big and little-endian systems provided that
1640 * gcc's 'strict aliasing' tests don't decide that the retval32[] 1491 * gcc's 'strict aliasing' tests don't decide that the retval32[]
1641 * entries can't have been assigned to, so need not be read! 1492 * entries can't have been assigned to, so need not be read!
1642 */ 1493 */
1643 retval[0] = newpos.retval32[0]; 1494 retval[0] = newpos.retval32[0];
1644 retval[1] = newpos.retval32[1]; 1495 retval[1] = newpos.retval32[1];
1645 1496
1646 return rv; 1497 return rv;
1647} 1498}
1648 1499
1649int 1500int
1650netbsd32_truncate(struct lwp *l, const struct netbsd32_truncate_args *uap, register_t *retval) 1501netbsd32_truncate(struct lwp *l, const struct netbsd32_truncate_args *uap, register_t *retval)
1651{ 1502{
1652 /* { 1503 /* {
1653 syscallarg(const netbsd32_charp) path; 1504 syscallarg(const netbsd32_charp) path;
1654 syscallarg(int) PAD; 1505 syscallarg(int) PAD;
1655 syscallarg(netbsd32_off_t) length; 1506 syscallarg(netbsd32_off_t) length;
1656 } */ 1507 } */
1657 struct sys_truncate_args ua; 1508 struct sys_truncate_args ua;
1658 1509
1659 NETBSD32TOP_UAP(path, const char); 1510 NETBSD32TOP_UAP(path, const char);
1660 NETBSD32TO64_UAP(PAD); 1511 NETBSD32TO64_UAP(PAD);
1661 NETBSD32TO64_UAP(length); 1512 NETBSD32TO64_UAP(length);
1662 1513
1663 return sys_truncate(l, &ua, retval); 1514 return sys_truncate(l, &ua, retval);
1664} 1515}
1665 1516
1666int 1517int
1667netbsd32_ftruncate(struct lwp *l, const struct netbsd32_ftruncate_args *uap, register_t *retval) 1518netbsd32_ftruncate(struct lwp *l, const struct netbsd32_ftruncate_args *uap, register_t *retval)
1668{ 1519{
1669 /* { 1520 /* {
1670 syscallarg(int) fd; 1521 syscallarg(int) fd;
1671 syscallarg(int) PAD; 1522 syscallarg(int) PAD;
1672 syscallarg(netbsd32_off_t) length; 1523 syscallarg(netbsd32_off_t) length;
1673 } */ 1524 } */
1674 struct sys_ftruncate_args ua; 1525 struct sys_ftruncate_args ua;
1675 1526
1676 NETBSD32TO64_UAP(fd); 1527 NETBSD32TO64_UAP(fd);
1677 NETBSD32TO64_UAP(PAD); 1528 NETBSD32TO64_UAP(PAD);
1678 NETBSD32TO64_UAP(length); 1529 NETBSD32TO64_UAP(length);
1679 1530
1680 return sys_ftruncate(l, &ua, retval); 1531 return sys_ftruncate(l, &ua, retval);
1681} 1532}
1682 1533
1683int 1534int
1684netbsd32_mlock(struct lwp *l, const struct netbsd32_mlock_args *uap, register_t *retval) 1535netbsd32_mlock(struct lwp *l, const struct netbsd32_mlock_args *uap, register_t *retval)
1685{ 1536{
1686 /* { 1537 /* {
1687 syscallarg(const netbsd32_voidp) addr; 1538 syscallarg(const netbsd32_voidp) addr;
1688 syscallarg(netbsd32_size_t) len; 1539 syscallarg(netbsd32_size_t) len;
1689 } */ 1540 } */
1690 struct sys_mlock_args ua; 1541 struct sys_mlock_args ua;
1691 1542
1692 NETBSD32TOP_UAP(addr, const void); 1543 NETBSD32TOP_UAP(addr, const void);
1693 NETBSD32TO64_UAP(len); 1544 NETBSD32TO64_UAP(len);
1694 1545
1695 return sys_mlock(l, &ua, retval); 1546 return sys_mlock(l, &ua, retval);
1696} 1547}
1697 1548
1698int 1549int
1699netbsd32_munlock(struct lwp *l, const struct netbsd32_munlock_args *uap, register_t *retval) 1550netbsd32_munlock(struct lwp *l, const struct netbsd32_munlock_args *uap, register_t *retval)
1700{ 1551{
1701 /* { 1552 /* {
1702 syscallarg(const netbsd32_voidp) addr; 1553 syscallarg(const netbsd32_voidp) addr;
1703 syscallarg(netbsd32_size_t) len; 1554 syscallarg(netbsd32_size_t) len;
1704 } */ 1555 } */
1705 struct sys_munlock_args ua; 1556 struct sys_munlock_args ua;
1706 1557
1707 NETBSD32TOP_UAP(addr, const void); 1558 NETBSD32TOP_UAP(addr, const void);
1708 NETBSD32TO64_UAP(len); 1559 NETBSD32TO64_UAP(len);
1709 1560
1710 return sys_munlock(l, &ua, retval); 1561 return sys_munlock(l, &ua, retval);
1711} 1562}
1712 1563
1713int 1564int
1714netbsd32_undelete(struct lwp *l, const struct netbsd32_undelete_args *uap, register_t *retval) 1565netbsd32_undelete(struct lwp *l, const struct netbsd32_undelete_args *uap, register_t *retval)
1715{ 1566{
1716 /* { 1567 /* {
1717 syscallarg(const netbsd32_charp) path; 1568 syscallarg(const netbsd32_charp) path;
1718 } */ 1569 } */
1719 struct sys_undelete_args ua; 1570 struct sys_undelete_args ua;
1720 1571
1721 NETBSD32TOP_UAP(path, const char); 1572 NETBSD32TOP_UAP(path, const char);
1722 1573
1723 return sys_undelete(l, &ua, retval); 1574 return sys_undelete(l, &ua, retval);
1724} 1575}
1725 1576
1726int 1577int
1727netbsd32_getpgid(struct lwp *l, const struct netbsd32_getpgid_args *uap, register_t *retval) 1578netbsd32_getpgid(struct lwp *l, const struct netbsd32_getpgid_args *uap, register_t *retval)
1728{ 1579{
1729 /* { 1580 /* {
1730 syscallarg(pid_t) pid; 1581 syscallarg(pid_t) pid;
1731 } */ 1582 } */
1732 struct sys_getpgid_args ua; 1583 struct sys_getpgid_args ua;
1733 1584
1734 NETBSD32TO64_UAP(pid); 1585 NETBSD32TO64_UAP(pid);
1735 1586
1736 return sys_getpgid(l, &ua, retval); 1587 return sys_getpgid(l, &ua, retval);
1737} 1588}
1738 1589
1739int 1590int
1740netbsd32_reboot(struct lwp *l, const struct netbsd32_reboot_args *uap, register_t *retval) 1591netbsd32_reboot(struct lwp *l, const struct netbsd32_reboot_args *uap, register_t *retval)
1741{ 1592{
1742 /* { 1593 /* {
1743 syscallarg(int) opt; 1594 syscallarg(int) opt;
1744 syscallarg(netbsd32_charp) bootstr; 1595 syscallarg(netbsd32_charp) bootstr;
1745 } */ 1596 } */
1746 struct sys_reboot_args ua; 1597 struct sys_reboot_args ua;
1747 1598
1748 NETBSD32TO64_UAP(opt); 1599 NETBSD32TO64_UAP(opt);
1749 NETBSD32TOP_UAP(bootstr, char); 1600 NETBSD32TOP_UAP(bootstr, char);
1750 1601
1751 return sys_reboot(l, &ua, retval); 1602 return sys_reboot(l, &ua, retval);
1752} 1603}
1753 1604
1754#include <sys/poll.h> 1605#include <sys/poll.h>
1755int 1606int
1756netbsd32_poll(struct lwp *l, const struct netbsd32_poll_args *uap, register_t *retval) 1607netbsd32_poll(struct lwp *l, const struct netbsd32_poll_args *uap, register_t *retval)
1757{ 1608{
1758 /* { 1609 /* {
1759 syscallarg(netbsd32_pollfdp_t) fds; 1610 syscallarg(netbsd32_pollfdp_t) fds;
1760 syscallarg(u_int) nfds; 1611 syscallarg(u_int) nfds;
1761 syscallarg(int) timeout; 1612 syscallarg(int) timeout;
1762 } */ 1613 } */
1763 struct sys_poll_args ua; 1614 struct sys_poll_args ua;
1764 1615
1765 NETBSD32TOP_UAP(fds, struct pollfd); 1616 NETBSD32TOP_UAP(fds, struct pollfd);
1766 NETBSD32TO64_UAP(nfds); 1617 NETBSD32TO64_UAP(nfds);
1767 NETBSD32TO64_UAP(timeout); 1618 NETBSD32TO64_UAP(timeout);
1768 1619
1769 return sys_poll(l, &ua, retval); 1620 return sys_poll(l, &ua, retval);
1770} 1621}
1771 1622
1772int 1623int
1773netbsd32_fdatasync(struct lwp *l, const struct netbsd32_fdatasync_args *uap, register_t *retval) 1624netbsd32_fdatasync(struct lwp *l, const struct netbsd32_fdatasync_args *uap, register_t *retval)
1774{ 1625{
1775 /* { 1626 /* {
1776 syscallarg(int) fd; 1627 syscallarg(int) fd;
1777 } */ 1628 } */
1778 struct sys_fdatasync_args ua; 1629 struct sys_fdatasync_args ua;
1779 1630
1780 NETBSD32TO64_UAP(fd); 1631 NETBSD32TO64_UAP(fd);
1781 1632
1782 return sys_fdatasync(l, &ua, retval); 1633 return sys_fdatasync(l, &ua, retval);
1783} 1634}
1784 1635
1785int 1636int
1786netbsd32___posix_rename(struct lwp *l, const struct netbsd32___posix_rename_args *uap, register_t *retval) 1637netbsd32___posix_rename(struct lwp *l, const struct netbsd32___posix_rename_args *uap, register_t *retval)
1787{ 1638{
1788 /* { 1639 /* {
1789 syscallarg(const netbsd32_charp) from; 1640 syscallarg(const netbsd32_charp) from;
1790 syscallarg(const netbsd32_charp) to; 1641 syscallarg(const netbsd32_charp) to;
1791 } */ 1642 } */
1792 struct sys___posix_rename_args ua; 1643 struct sys___posix_rename_args ua;
1793 1644
1794 NETBSD32TOP_UAP(from, const char); 1645 NETBSD32TOP_UAP(from, const char);
1795 NETBSD32TOP_UAP(to, const char); 1646 NETBSD32TOP_UAP(to, const char);
1796 1647
1797 return sys___posix_rename(l, &ua, retval); 1648 return sys___posix_rename(l, &ua, retval);
1798} 1649}
1799 1650
1800static void 1651static void
1801swapent32_cvt(void *p, const struct swapent *se) 1652swapent32_cvt(void *p, const struct swapent *se)
1802{ 1653{
1803 struct netbsd32_swapent *se32 = p; 1654 struct netbsd32_swapent *se32 = p;
1804 1655
1805 se32->se_dev = se->se_dev; 1656 se32->se_dev = se->se_dev;
1806 se32->se_flags = se->se_flags; 1657 se32->se_flags = se->se_flags;
1807 se32->se_nblks = se->se_nblks; 1658 se32->se_nblks = se->se_nblks;
1808 se32->se_inuse = se->se_inuse; 1659 se32->se_inuse = se->se_inuse;
1809 se32->se_priority = se->se_priority; 1660 se32->se_priority = se->se_priority;
1810 KASSERT(sizeof(se->se_path) <= sizeof(se32->se_path)); 1661 KASSERT(sizeof(se->se_path) <= sizeof(se32->se_path));
1811 strcpy(se32->se_path, se->se_path); 1662 strcpy(se32->se_path, se->se_path);
1812} 1663}
1813 1664
1814int 1665int
1815netbsd32_swapctl(struct lwp *l, const struct netbsd32_swapctl_args *uap, 1666netbsd32_swapctl(struct lwp *l, const struct netbsd32_swapctl_args *uap,
1816 register_t *retval) 1667 register_t *retval)
1817{ 1668{
1818 /* { 1669 /* {
1819 syscallarg(int) cmd; 1670 syscallarg(int) cmd;
1820 syscallarg(const netbsd32_voidp) arg; 1671 syscallarg(const netbsd32_voidp) arg;
1821 syscallarg(int) misc; 1672 syscallarg(int) misc;
1822 } */ 1673 } */
1823 struct sys_swapctl_args ua; 1674 struct sys_swapctl_args ua;
1824 1675
1825 NETBSD32TO64_UAP(cmd); 1676 NETBSD32TO64_UAP(cmd);
1826 NETBSD32TOP_UAP(arg, void); 1677 NETBSD32TOP_UAP(arg, void);
1827 NETBSD32TO64_UAP(misc); 1678 NETBSD32TO64_UAP(misc);
1828 1679
1829 /* SWAP_STATS50 and SWAP_STATS13 structures need no translation */ 1680 /* SWAP_STATS50 and SWAP_STATS13 structures need no translation */
1830 if (SCARG(&ua, cmd) == SWAP_STATS) { 1681 if (SCARG(&ua, cmd) == SWAP_STATS) {
1831 swapsys_lock(RW_READER); 1682 swapsys_lock(RW_READER);
1832 int error = uvm_swap_stats(SCARG(&ua, arg), SCARG(&ua, misc), 1683 int error = uvm_swap_stats(SCARG(&ua, arg), SCARG(&ua, misc),
1833 swapent32_cvt, sizeof(struct netbsd32_swapent), retval); 1684 swapent32_cvt, sizeof(struct netbsd32_swapent), retval);
1834 swapsys_unlock(); 1685 swapsys_unlock();
1835 return error; 1686 return error;
1836 } 1687 }
1837 1688
1838 return sys_swapctl(l, &ua, retval); 1689 return sys_swapctl(l, &ua, retval);
1839} 1690}
1840 1691
1841int 1692int
1842netbsd32_minherit(struct lwp *l, const struct netbsd32_minherit_args *uap, register_t *retval) 1693netbsd32_minherit(struct lwp *l, const struct netbsd32_minherit_args *uap, register_t *retval)
1843{ 1694{
1844 /* { 1695 /* {
1845 syscallarg(netbsd32_voidp) addr; 1696 syscallarg(netbsd32_voidp) addr;
1846 syscallarg(netbsd32_size_t) len; 1697 syscallarg(netbsd32_size_t) len;
1847 syscallarg(int) inherit; 1698 syscallarg(int) inherit;
1848 } */ 1699 } */
1849 struct sys_minherit_args ua; 1700 struct sys_minherit_args ua;
1850 1701
1851 NETBSD32TOP_UAP(addr, void); 1702 NETBSD32TOP_UAP(addr, void);
1852 NETBSD32TOX_UAP(len, size_t); 1703 NETBSD32TOX_UAP(len, size_t);
1853 NETBSD32TO64_UAP(inherit); 1704 NETBSD32TO64_UAP(inherit);
1854 1705
1855 return sys_minherit(l, &ua, retval); 1706 return sys_minherit(l, &ua, retval);
1856} 1707}
1857 1708
1858int 1709int
1859netbsd32_lchmod(struct lwp *l, const struct netbsd32_lchmod_args *uap, register_t *retval) 1710netbsd32_lchmod(struct lwp *l, const struct netbsd32_lchmod_args *uap, register_t *retval)
1860{ 1711{
1861 /* { 1712 /* {
1862 syscallarg(const netbsd32_charp) path; 1713 syscallarg(const netbsd32_charp) path;
1863 syscallarg(mode_t) mode; 1714 syscallarg(mode_t) mode;
1864 } */ 1715 } */
1865 struct sys_lchmod_args ua; 1716 struct sys_lchmod_args ua;
1866 1717
1867 NETBSD32TOP_UAP(path, const char); 1718 NETBSD32TOP_UAP(path, const char);
1868 NETBSD32TO64_UAP(mode); 1719 NETBSD32TO64_UAP(mode);
1869 1720
1870 return sys_lchmod(l, &ua, retval); 1721 return sys_lchmod(l, &ua, retval);
1871} 1722}
1872 1723
1873int 1724int
1874netbsd32_lchown(struct lwp *l, const struct netbsd32_lchown_args *uap, register_t *retval) 1725netbsd32_lchown(struct lwp *l, const struct netbsd32_lchown_args *uap, register_t *retval)
1875{ 1726{
1876 /* { 1727 /* {
1877 syscallarg(const netbsd32_charp) path; 1728 syscallarg(const netbsd32_charp) path;
1878 syscallarg(uid_t) uid; 1729 syscallarg(uid_t) uid;
1879 syscallarg(gid_t) gid; 1730 syscallarg(gid_t) gid;
1880 } */ 1731 } */
1881 struct sys_lchown_args ua; 1732 struct sys_lchown_args ua;
1882 1733
1883 NETBSD32TOP_UAP(path, const char); 1734 NETBSD32TOP_UAP(path, const char);
1884 NETBSD32TO64_UAP(uid); 1735 NETBSD32TO64_UAP(uid);
1885 NETBSD32TO64_UAP(gid); 1736 NETBSD32TO64_UAP(gid);
1886 1737
1887 return sys_lchown(l, &ua, retval); 1738 return sys_lchown(l, &ua, retval);
1888} 1739}
1889 1740
1890int 1741int
1891netbsd32___msync13(struct lwp *l, const struct netbsd32___msync13_args *uap, register_t *retval) 1742netbsd32___msync13(struct lwp *l, const struct netbsd32___msync13_args *uap, register_t *retval)
1892{ 1743{
1893 /* { 1744 /* {
1894 syscallarg(netbsd32_voidp) addr; 1745 syscallarg(netbsd32_voidp) addr;
1895 syscallarg(netbsd32_size_t) len; 1746 syscallarg(netbsd32_size_t) len;
1896 syscallarg(int) flags; 1747 syscallarg(int) flags;
1897 } */ 1748 } */
1898 struct sys___msync13_args ua; 1749 struct sys___msync13_args ua;
1899 1750
1900 NETBSD32TOP_UAP(addr, void); 1751 NETBSD32TOP_UAP(addr, void);
1901 NETBSD32TOX_UAP(len, size_t); 1752 NETBSD32TOX_UAP(len, size_t);
1902 NETBSD32TO64_UAP(flags); 1753 NETBSD32TO64_UAP(flags);
1903 1754
1904 return sys___msync13(l, &ua, retval); 1755 return sys___msync13(l, &ua, retval);
1905} 1756}
1906 1757
1907int 1758int
1908netbsd32___posix_chown(struct lwp *l, const struct netbsd32___posix_chown_args *uap, register_t *retval) 1759netbsd32___posix_chown(struct lwp *l, const struct netbsd32___posix_chown_args *uap, register_t *retval)
1909{ 1760{
1910 /* { 1761 /* {
1911 syscallarg(const netbsd32_charp) path; 1762 syscallarg(const netbsd32_charp) path;
1912 syscallarg(uid_t) uid; 1763 syscallarg(uid_t) uid;
1913 syscallarg(gid_t) gid; 1764 syscallarg(gid_t) gid;
1914 } */ 1765 } */
1915 struct sys___posix_chown_args ua; 1766 struct sys___posix_chown_args ua;
1916 1767
1917 NETBSD32TOP_UAP(path, const char); 1768 NETBSD32TOP_UAP(path, const char);
1918 NETBSD32TO64_UAP(uid); 1769 NETBSD32TO64_UAP(uid);
1919 NETBSD32TO64_UAP(gid); 1770 NETBSD32TO64_UAP(gid);
1920 1771
1921 return sys___posix_chown(l, &ua, retval); 1772 return sys___posix_chown(l, &ua, retval);
1922} 1773}
1923 1774
1924int 1775int
1925netbsd32___posix_fchown(struct lwp *l, const struct netbsd32___posix_fchown_args *uap, register_t *retval) 1776netbsd32___posix_fchown(struct lwp *l, const struct netbsd32___posix_fchown_args *uap, register_t *retval)
1926{ 1777{
1927 /* { 1778 /* {
1928 syscallarg(int) fd; 1779 syscallarg(int) fd;
1929 syscallarg(uid_t) uid; 1780 syscallarg(uid_t) uid;
1930 syscallarg(gid_t) gid; 1781 syscallarg(gid_t) gid;
1931 } */ 1782 } */
1932 struct sys___posix_fchown_args ua; 1783 struct sys___posix_fchown_args ua;
1933 1784
1934 NETBSD32TO64_UAP(fd); 1785 NETBSD32TO64_UAP(fd);
1935 NETBSD32TO64_UAP(uid); 1786 NETBSD32TO64_UAP(uid);
1936 NETBSD32TO64_UAP(gid); 1787 NETBSD32TO64_UAP(gid);
1937 1788
1938 return sys___posix_fchown(l, &ua, retval); 1789 return sys___posix_fchown(l, &ua, retval);
1939} 1790}
1940 1791
1941int 1792int
1942netbsd32___posix_lchown(struct lwp *l, const struct netbsd32___posix_lchown_args *uap, register_t *retval) 1793netbsd32___posix_lchown(struct lwp *l, const struct netbsd32___posix_lchown_args *uap, register_t *retval)
1943{ 1794{
1944 /* { 1795 /* {
1945 syscallarg(const netbsd32_charp) path; 1796 syscallarg(const netbsd32_charp) path;
1946 syscallarg(uid_t) uid; 1797 syscallarg(uid_t) uid;
1947 syscallarg(gid_t) gid; 1798 syscallarg(gid_t) gid;
1948 } */ 1799 } */
1949 struct sys___posix_lchown_args ua; 1800 struct sys___posix_lchown_args ua;
1950 1801
1951 NETBSD32TOP_UAP(path, const char); 1802 NETBSD32TOP_UAP(path, const char);
1952 NETBSD32TO64_UAP(uid); 1803 NETBSD32TO64_UAP(uid);
1953 NETBSD32TO64_UAP(gid); 1804 NETBSD32TO64_UAP(gid);
1954 1805
1955 return sys___posix_lchown(l, &ua, retval); 1806 return sys___posix_lchown(l, &ua, retval);
1956} 1807}
1957 1808
1958int 1809int
1959netbsd32_getsid(struct lwp *l, const struct netbsd32_getsid_args *uap, register_t *retval) 1810netbsd32_getsid(struct lwp *l, const struct netbsd32_getsid_args *uap, register_t *retval)
1960{ 1811{
1961 /* { 1812 /* {
1962 syscallarg(pid_t) pid; 1813 syscallarg(pid_t) pid;
1963 } */ 1814 } */
1964 struct sys_getsid_args ua; 1815 struct sys_getsid_args ua;
1965 1816
1966 NETBSD32TO64_UAP(pid); 1817 NETBSD32TO64_UAP(pid);
1967 1818
1968 return sys_getsid(l, &ua, retval); 1819 return sys_getsid(l, &ua, retval);
1969} 1820}
1970 1821
1971int 1822int
1972netbsd32_fktrace(struct lwp *l, const struct netbsd32_fktrace_args *uap, register_t *retval) 1823netbsd32_fktrace(struct lwp *l, const struct netbsd32_fktrace_args *uap, register_t *retval)
1973{ 1824{
1974 /* { 1825 /* {
1975 syscallarg(int) fd; 1826 syscallarg(int) fd;
1976 syscallarg(int) ops; 1827 syscallarg(int) ops;
1977 syscallarg(int) facs; 1828 syscallarg(int) facs;
1978 syscallarg(int) pid; 1829 syscallarg(int) pid;
1979 } */ 1830 } */
1980 struct sys_fktrace_args ua; 1831 struct sys_fktrace_args ua;
1981 1832
1982 NETBSD32TOX_UAP(fd, int); 1833 NETBSD32TOX_UAP(fd, int);
1983 NETBSD32TO64_UAP(ops); 1834 NETBSD32TO64_UAP(ops);
1984 NETBSD32TO64_UAP(facs); 1835 NETBSD32TO64_UAP(facs);
1985 NETBSD32TO64_UAP(pid); 1836 NETBSD32TO64_UAP(pid);
1986 1837
1987 return sys_fktrace(l, &ua, retval); 1838 return sys_fktrace(l, &ua, retval);
1988} 1839}
1989 1840
1990int 1841int
1991netbsd32___sigpending14(struct lwp *l, const struct netbsd32___sigpending14_args *uap, register_t *retval) 1842netbsd32___sigpending14(struct lwp *l, const struct netbsd32___sigpending14_args *uap, register_t *retval)
1992{ 1843{
1993 /* { 1844 /* {
1994 syscallarg(sigset_t *) set; 1845 syscallarg(sigset_t *) set;
1995 } */ 1846 } */
1996 struct sys___sigpending14_args ua; 1847 struct sys___sigpending14_args ua;
1997 1848
1998 NETBSD32TOP_UAP(set, sigset_t); 1849 NETBSD32TOP_UAP(set, sigset_t);
1999 1850
2000 return sys___sigpending14(l, &ua, retval); 1851 return sys___sigpending14(l, &ua, retval);
2001} 1852}
2002 1853
2003int 1854int
2004netbsd32___sigprocmask14(struct lwp *l, const struct netbsd32___sigprocmask14_args *uap, register_t *retval) 1855netbsd32___sigprocmask14(struct lwp *l, const struct netbsd32___sigprocmask14_args *uap, register_t *retval)
2005{ 1856{
2006 /* { 1857 /* {
2007 syscallarg(int) how; 1858 syscallarg(int) how;
2008 syscallarg(const sigset_t *) set; 1859 syscallarg(const sigset_t *) set;
2009 syscallarg(sigset_t *) oset; 1860 syscallarg(sigset_t *) oset;
2010 } */ 1861 } */
2011 struct sys___sigprocmask14_args ua; 1862 struct sys___sigprocmask14_args ua;
2012 1863
2013 NETBSD32TO64_UAP(how); 1864 NETBSD32TO64_UAP(how);
2014 NETBSD32TOP_UAP(set, sigset_t); 1865 NETBSD32TOP_UAP(set, sigset_t);
2015 NETBSD32TOP_UAP(oset, sigset_t); 1866 NETBSD32TOP_UAP(oset, sigset_t);
2016 1867
2017 return sys___sigprocmask14(l, &ua, retval); 1868 return sys___sigprocmask14(l, &ua, retval);
2018} 1869}
2019 1870
2020int 1871int
2021netbsd32___sigsuspend14(struct lwp *l, const struct netbsd32___sigsuspend14_args *uap, register_t *retval) 1872netbsd32___sigsuspend14(struct lwp *l, const struct netbsd32___sigsuspend14_args *uap, register_t *retval)
2022{ 1873{
2023 /* { 1874 /* {
2024 syscallarg(const sigset_t *) set; 1875 syscallarg(const sigset_t *) set;
2025 } */ 1876 } */
2026 struct sys___sigsuspend14_args ua; 1877 struct sys___sigsuspend14_args ua;
2027 1878
2028 NETBSD32TOP_UAP(set, sigset_t); 1879 NETBSD32TOP_UAP(set, sigset_t);
2029 1880
2030 return sys___sigsuspend14(l, &ua, retval); 1881 return sys___sigsuspend14(l, &ua, retval);
2031} 1882}
2032 1883
2033int 1884int
2034netbsd32_fchroot(struct lwp *l, const struct netbsd32_fchroot_args *uap, register_t *retval) 1885netbsd32_fchroot(struct lwp *l, const struct netbsd32_fchroot_args *uap, register_t *retval)
2035{ 1886{
2036 /* { 1887 /* {
2037 syscallarg(int) fd; 1888 syscallarg(int) fd;
2038 } */ 1889 } */
2039 struct sys_fchroot_args ua; 1890 struct sys_fchroot_args ua;
2040 1891
2041 NETBSD32TO64_UAP(fd); 1892 NETBSD32TO64_UAP(fd);
2042 1893
2043 return sys_fchroot(l, &ua, retval); 1894 return sys_fchroot(l, &ua, retval);
2044} 1895}
2045 1896
2046/* 1897/*
2047 * Open a file given a file handle. 1898 * Open a file given a file handle.
2048 * 1899 *
2049 * Check permissions, allocate an open file structure, 1900 * Check permissions, allocate an open file structure,
2050 * and call the device open routine if any. 1901 * and call the device open routine if any.
2051 */ 1902 */
2052int 1903int
2053netbsd32___fhopen40(struct lwp *l, const struct netbsd32___fhopen40_args *uap, register_t *retval) 1904netbsd32___fhopen40(struct lwp *l, const struct netbsd32___fhopen40_args *uap, register_t *retval)
2054{ 1905{
2055 /* { 1906 /* {
2056 syscallarg(const netbsd32_pointer_t *) fhp; 1907 syscallarg(const netbsd32_pointer_t *) fhp;
2057 syscallarg(netbsd32_size_t) fh_size; 1908 syscallarg(netbsd32_size_t) fh_size;
2058 syscallarg(int) flags; 1909 syscallarg(int) flags;
2059 } */ 1910 } */
2060 struct sys___fhopen40_args ua; 1911 struct sys___fhopen40_args ua;
2061 1912
2062 NETBSD32TOP_UAP(fhp, fhandle_t); 1913 NETBSD32TOP_UAP(fhp, fhandle_t);
2063 NETBSD32TO64_UAP(fh_size); 1914 NETBSD32TO64_UAP(fh_size);
2064 NETBSD32TO64_UAP(flags); 1915 NETBSD32TO64_UAP(flags);
2065 1916
2066 return sys___fhopen40(l, &ua, retval); 1917 return sys___fhopen40(l, &ua, retval);
2067} 1918}
2068 1919
2069/* virtual memory syscalls */ 1920/* virtual memory syscalls */
2070int 1921int
2071netbsd32_ovadvise(struct lwp *l, const struct netbsd32_ovadvise_args *uap, register_t *retval) 1922netbsd32_ovadvise(struct lwp *l, const struct netbsd32_ovadvise_args *uap, register_t *retval)
2072{ 1923{
2073 /* { 1924 /* {
2074 syscallarg(int) anom; 1925 syscallarg(int) anom;
2075 } */ 1926 } */
2076 struct sys_ovadvise_args ua; 1927 struct sys_ovadvise_args ua;
2077 1928
2078 NETBSD32TO64_UAP(anom); 1929 NETBSD32TO64_UAP(anom);
2079 1930
2080 return sys_ovadvise(l, &ua, retval); 1931 return sys_ovadvise(l, &ua, retval);
2081} 1932}
2082 1933
2083void 
2084netbsd32_adjust_limits(struct proc *p) 
2085{ 
2086 static const struct { 
2087 int id; 
2088 rlim_t lim; 
2089 } lm[] = { 
2090 { RLIMIT_DATA, MAXDSIZ32 }, 
2091 { RLIMIT_STACK, MAXSSIZ32 }, 
2092 }; 
2093 size_t i; 
2094 struct plimit *lim; 
2095 struct rlimit *rlim; 
2096 
2097 /* 
2098 * We can only reduce the current limits, we cannot stop external 
2099 * processes from changing them (eg via sysctl) later on. 
2100 * So there is no point trying to lock out such changes here. 
2101 * 
2102 * If we assume that rlim_cur/max are accessed using atomic 
2103 * operations, we don't need to lock against any other updates 
2104 * that might happen if the plimit structure is shared writable 
2105 * between multiple processes. 
2106 */ 
2107 
2108 /* Scan to determine is any limits are out of range */ 
2109 lim = p->p_limit; 
2110 for (i = 0; ; i++) { 
2111 if (i >= __arraycount(lm)) 
2112 /* All in range */ 
2113 return; 
2114 rlim = lim->pl_rlimit + lm[i].id; 
2115 if (LIMITCHECK(rlim->rlim_cur, lm[i].lim)) 
2116 break; 
2117 if (LIMITCHECK(rlim->rlim_max, lm[i].lim)) 
2118 break; 
2119 } 
2120 
2121 lim_privatise(p); 
2122 
2123 lim = p->p_limit; 
2124 for (i = 0; i < __arraycount(lm); i++) { 
2125 rlim = lim->pl_rlimit + lm[i].id; 
2126 if (LIMITCHECK(rlim->rlim_cur, lm[i].lim)) 
2127 rlim->rlim_cur = lm[i].lim; 
2128 if (LIMITCHECK(rlim->rlim_max, lm[i].lim)) 
2129 rlim->rlim_max = lm[i].lim; 
2130 } 
2131} 
2132 
2133int 1934int
2134netbsd32_uuidgen(struct lwp *l, const struct netbsd32_uuidgen_args *uap, register_t *retval) 1935netbsd32_uuidgen(struct lwp *l, const struct netbsd32_uuidgen_args *uap, register_t *retval)
2135{ 1936{
2136 /* { 1937 /* {
2137 syscallarg(netbsd32_uuidp_t) store; 1938 syscallarg(netbsd32_uuidp_t) store;
2138 syscallarg(int) count; 1939 syscallarg(int) count;
2139 } */ 1940 } */
2140 struct sys_uuidgen_args ua; 1941 struct sys_uuidgen_args ua;
2141 1942
2142 NETBSD32TOP_UAP(store, struct uuid); 1943 NETBSD32TOP_UAP(store, struct uuid);
2143 NETBSD32TO64_UAP(count); 1944 NETBSD32TO64_UAP(count);
2144 1945
2145 return sys_uuidgen(l, &ua, retval); 1946 return sys_uuidgen(l, &ua, retval);
2146} 1947}
2147 1948
2148int 1949int
2149netbsd32_extattrctl(struct lwp *l, const struct netbsd32_extattrctl_args *uap, register_t *retval) 1950netbsd32_extattrctl(struct lwp *l, const struct netbsd32_extattrctl_args *uap, register_t *retval)
2150{ 1951{
2151 /* { 1952 /* {
2152 syscallarg(const netbsd32_charp) path; 1953 syscallarg(const netbsd32_charp) path;
2153 syscallarg(int) cmd; 1954 syscallarg(int) cmd;
2154 syscallarg(const netbsd32_charp) filename; 1955 syscallarg(const netbsd32_charp) filename;
2155 syscallarg(int) attrnamespace; 1956 syscallarg(int) attrnamespace;
2156 syscallarg(const netbsd32_charp) attrname; 1957 syscallarg(const netbsd32_charp) attrname;
2157 } */ 1958 } */
2158 struct sys_extattrctl_args ua; 1959 struct sys_extattrctl_args ua;
2159 1960
2160 NETBSD32TOP_UAP(path, const char); 1961 NETBSD32TOP_UAP(path, const char);
2161 NETBSD32TO64_UAP(cmd); 1962 NETBSD32TO64_UAP(cmd);
2162 NETBSD32TOP_UAP(filename, const char); 1963 NETBSD32TOP_UAP(filename, const char);
2163 NETBSD32TO64_UAP(attrnamespace); 1964 NETBSD32TO64_UAP(attrnamespace);
2164 NETBSD32TOP_UAP(attrname, const char); 1965 NETBSD32TOP_UAP(attrname, const char);
2165 1966
2166 return sys_extattrctl(l, &ua, retval); 1967 return sys_extattrctl(l, &ua, retval);
2167} 1968}
2168 1969
2169int 1970int
2170netbsd32_extattr_set_fd(struct lwp *l, const struct netbsd32_extattr_set_fd_args *uap, register_t *retval) 1971netbsd32_extattr_set_fd(struct lwp *l, const struct netbsd32_extattr_set_fd_args *uap, register_t *retval)
2171{ 1972{
2172 /* { 1973 /* {
2173 syscallarg(int) fd; 1974 syscallarg(int) fd;
2174 syscallarg(int) attrnamespace; 1975 syscallarg(int) attrnamespace;
2175 syscallarg(const netbsd32_charp) attrname; 1976 syscallarg(const netbsd32_charp) attrname;
2176 syscallarg(const netbsd32_voidp) data; 1977 syscallarg(const netbsd32_voidp) data;
2177 syscallarg(netbsd32_size_t) nbytes; 1978 syscallarg(netbsd32_size_t) nbytes;
2178 } */ 1979 } */
2179 struct sys_extattr_set_fd_args ua; 1980 struct sys_extattr_set_fd_args ua;
2180 1981
2181 NETBSD32TO64_UAP(fd); 1982 NETBSD32TO64_UAP(fd);
2182 NETBSD32TO64_UAP(attrnamespace); 1983 NETBSD32TO64_UAP(attrnamespace);
2183 NETBSD32TOP_UAP(attrname, const char); 1984 NETBSD32TOP_UAP(attrname, const char);
2184 NETBSD32TOP_UAP(data, const void); 1985 NETBSD32TOP_UAP(data, const void);
2185 NETBSD32TOX_UAP(nbytes, size_t); 1986 NETBSD32TOX_UAP(nbytes, size_t);
2186 1987
2187 return sys_extattr_set_fd(l, &ua, retval); 1988 return sys_extattr_set_fd(l, &ua, retval);
2188} 1989}
2189 1990
2190int 1991int
2191netbsd32_extattr_set_file(struct lwp *l, const struct netbsd32_extattr_set_file_args *uap, register_t *retval) 1992netbsd32_extattr_set_file(struct lwp *l, const struct netbsd32_extattr_set_file_args *uap, register_t *retval)
2192{ 1993{
2193 /* { 1994 /* {
2194 syscallarg(const netbsd32_charp) path; 1995 syscallarg(const netbsd32_charp) path;
2195 syscallarg(int) attrnamespace; 1996 syscallarg(int) attrnamespace;
2196 syscallarg(const netbsd32_charp) attrname; 1997 syscallarg(const netbsd32_charp) attrname;
2197 syscallarg(const netbsd32_voidp) data; 1998 syscallarg(const netbsd32_voidp) data;
2198 syscallarg(netbsd32_size_t) nbytes; 1999 syscallarg(netbsd32_size_t) nbytes;
2199 } */ 2000 } */
2200 struct sys_extattr_set_file_args ua; 2001 struct sys_extattr_set_file_args ua;
2201 2002
2202 NETBSD32TOP_UAP(path, const char); 2003 NETBSD32TOP_UAP(path, const char);
2203 NETBSD32TO64_UAP(attrnamespace); 2004 NETBSD32TO64_UAP(attrnamespace);
2204 NETBSD32TOP_UAP(attrname, const char); 2005 NETBSD32TOP_UAP(attrname, const char);
2205 NETBSD32TOP_UAP(data, const void); 2006 NETBSD32TOP_UAP(data, const void);
2206 NETBSD32TOX_UAP(nbytes, size_t); 2007 NETBSD32TOX_UAP(nbytes, size_t);
2207 2008
2208 return sys_extattr_set_file(l, &ua, retval); 2009 return sys_extattr_set_file(l, &ua, retval);
2209} 2010}
2210 2011
2211int 2012int
2212netbsd32_extattr_set_link(struct lwp *l, const struct netbsd32_extattr_set_link_args *uap, register_t *retval) 2013netbsd32_extattr_set_link(struct lwp *l, const struct netbsd32_extattr_set_link_args *uap, register_t *retval)
2213{ 2014{
2214 /* { 2015 /* {
2215 syscallarg(const netbsd32_charp) path; 2016 syscallarg(const netbsd32_charp) path;
2216 syscallarg(int) attrnamespace; 2017 syscallarg(int) attrnamespace;
2217 syscallarg(const netbsd32_charp) attrname; 2018 syscallarg(const netbsd32_charp) attrname;
2218 syscallarg(const netbsd32_voidp) data; 2019 syscallarg(const netbsd32_voidp) data;
2219 syscallarg(netbsd32_size_t) nbytes; 2020 syscallarg(netbsd32_size_t) nbytes;
2220 } */ 2021 } */
2221 struct sys_extattr_set_link_args ua; 2022 struct sys_extattr_set_link_args ua;
2222 2023
2223 NETBSD32TOP_UAP(path, const char); 2024 NETBSD32TOP_UAP(path, const char);
2224 NETBSD32TO64_UAP(attrnamespace); 2025 NETBSD32TO64_UAP(attrnamespace);
2225 NETBSD32TOP_UAP(attrname, const char); 2026 NETBSD32TOP_UAP(attrname, const char);
2226 NETBSD32TOP_UAP(data, const void); 2027 NETBSD32TOP_UAP(data, const void);
2227 NETBSD32TOX_UAP(nbytes, size_t); 2028 NETBSD32TOX_UAP(nbytes, size_t);
2228 2029
2229 return sys_extattr_set_link(l, &ua, retval); 2030 return sys_extattr_set_link(l, &ua, retval);
2230} 2031}
2231 2032
2232int 2033int
2233netbsd32_extattr_get_fd(struct lwp *l, const struct netbsd32_extattr_get_fd_args *uap, register_t *retval) 2034netbsd32_extattr_get_fd(struct lwp *l, const struct netbsd32_extattr_get_fd_args *uap, register_t *retval)
2234{ 2035{
2235 /* { 2036 /* {
2236 syscallarg(int) fd; 2037 syscallarg(int) fd;
2237 syscallarg(int) attrnamespace; 2038 syscallarg(int) attrnamespace;
2238 syscallarg(const netbsd32_charp) attrname; 2039 syscallarg(const netbsd32_charp) attrname;
2239 syscallarg(netbsd32_voidp) data; 2040 syscallarg(netbsd32_voidp) data;
2240 syscallarg(netbsd32_size_t) nbytes; 2041 syscallarg(netbsd32_size_t) nbytes;
2241 } */ 2042 } */
2242 struct sys_extattr_get_fd_args ua; 2043 struct sys_extattr_get_fd_args ua;
2243 2044
2244 NETBSD32TO64_UAP(fd); 2045 NETBSD32TO64_UAP(fd);
2245 NETBSD32TO64_UAP(attrnamespace); 2046 NETBSD32TO64_UAP(attrnamespace);
2246 NETBSD32TOP_UAP(attrname, const char); 2047 NETBSD32TOP_UAP(attrname, const char);
2247 NETBSD32TOP_UAP(data, void); 2048 NETBSD32TOP_UAP(data, void);
2248 NETBSD32TOX_UAP(nbytes, size_t); 2049 NETBSD32TOX_UAP(nbytes, size_t);
2249 2050
2250 return sys_extattr_get_fd(l, &ua, retval); 2051 return sys_extattr_get_fd(l, &ua, retval);
2251} 2052}
2252 2053
2253int 2054int
2254netbsd32_extattr_get_file(struct lwp *l, const struct netbsd32_extattr_get_file_args *uap, register_t *retval) 2055netbsd32_extattr_get_file(struct lwp *l, const struct netbsd32_extattr_get_file_args *uap, register_t *retval)
2255{ 2056{
2256 /* { 2057 /* {
2257 syscallarg(const netbsd32_charp) path; 2058 syscallarg(const netbsd32_charp) path;
2258 syscallarg(int) attrnamespace; 2059 syscallarg(int) attrnamespace;
2259 syscallarg(const netbsd32_charp) attrname; 2060 syscallarg(const netbsd32_charp) attrname;
2260 syscallarg(netbsd32_voidp) data; 2061 syscallarg(netbsd32_voidp) data;
2261 syscallarg(netbsd32_size_t) nbytes; 2062 syscallarg(netbsd32_size_t) nbytes;
2262 } */ 2063 } */
2263 struct sys_extattr_get_file_args ua; 2064 struct sys_extattr_get_file_args ua;
2264 2065
2265 NETBSD32TOP_UAP(path, const char); 2066 NETBSD32TOP_UAP(path, const char);
2266 NETBSD32TO64_UAP(attrnamespace); 2067 NETBSD32TO64_UAP(attrnamespace);
2267 NETBSD32TOP_UAP(attrname, const char); 2068 NETBSD32TOP_UAP(attrname, const char);
2268 NETBSD32TOP_UAP(data, void); 2069 NETBSD32TOP_UAP(data, void);
2269 NETBSD32TOX_UAP(nbytes, size_t); 2070 NETBSD32TOX_UAP(nbytes, size_t);
2270 2071
2271 return sys_extattr_get_file(l, &ua, retval); 2072 return sys_extattr_get_file(l, &ua, retval);
2272} 2073}
2273 2074
2274int 2075int
2275netbsd32_extattr_get_link(struct lwp *l, const struct netbsd32_extattr_get_link_args *uap, register_t *retval) 2076netbsd32_extattr_get_link(struct lwp *l, const struct netbsd32_extattr_get_link_args *uap, register_t *retval)
2276{ 2077{
2277 /* { 2078 /* {
2278 syscallarg(const netbsd32_charp) path; 2079 syscallarg(const netbsd32_charp) path;
2279 syscallarg(int) attrnamespace; 2080 syscallarg(int) attrnamespace;
2280 syscallarg(const netbsd32_charp) attrname; 2081 syscallarg(const netbsd32_charp) attrname;
2281 syscallarg(netbsd32_voidp) data; 2082 syscallarg(netbsd32_voidp) data;
2282 syscallarg(netbsd32_size_t) nbytes; 2083 syscallarg(netbsd32_size_t) nbytes;
2283 } */ 2084 } */
2284 struct sys_extattr_get_link_args ua; 2085 struct sys_extattr_get_link_args ua;
2285 2086
2286 NETBSD32TOP_UAP(path, const char); 2087 NETBSD32TOP_UAP(path, const char);
2287 NETBSD32TO64_UAP(attrnamespace); 2088 NETBSD32TO64_UAP(attrnamespace);
2288 NETBSD32TOP_UAP(attrname, const char); 2089 NETBSD32TOP_UAP(attrname, const char);
2289 NETBSD32TOP_UAP(data, void); 2090 NETBSD32TOP_UAP(data, void);
2290 NETBSD32TOX_UAP(nbytes, size_t); 2091 NETBSD32TOX_UAP(nbytes, size_t);
2291 2092
2292 return sys_extattr_get_link(l, &ua, retval); 2093 return sys_extattr_get_link(l, &ua, retval);
2293} 2094}
2294 2095
2295int 2096int
2296netbsd32_extattr_delete_fd(struct lwp *l, const struct netbsd32_extattr_delete_fd_args *uap, register_t *retval) 2097netbsd32_extattr_delete_fd(struct lwp *l, const struct netbsd32_extattr_delete_fd_args *uap, register_t *retval)
2297{ 2098{
2298 /* { 2099 /* {
2299 syscallarg(int) fd; 2100 syscallarg(int) fd;
2300 syscallarg(int) attrnamespace; 2101 syscallarg(int) attrnamespace;
2301 syscallarg(const netbsd32_charp) attrname; 2102 syscallarg(const netbsd32_charp) attrname;
2302 } */ 2103 } */
2303 struct sys_extattr_delete_fd_args ua; 2104 struct sys_extattr_delete_fd_args ua;
2304 2105
2305 NETBSD32TO64_UAP(fd); 2106 NETBSD32TO64_UAP(fd);
2306 NETBSD32TO64_UAP(attrnamespace); 2107 NETBSD32TO64_UAP(attrnamespace);
2307 NETBSD32TOP_UAP(attrname, const char); 2108 NETBSD32TOP_UAP(attrname, const char);
2308 2109
2309 return sys_extattr_delete_fd(l, &ua, retval); 2110 return sys_extattr_delete_fd(l, &ua, retval);
2310} 2111}
2311 2112
2312int 2113int
2313netbsd32_extattr_delete_file(struct lwp *l, const struct netbsd32_extattr_delete_file_args *uap, register_t *retval) 2114netbsd32_extattr_delete_file(struct lwp *l, const struct netbsd32_extattr_delete_file_args *uap, register_t *retval)
2314{ 2115{
2315 /* { 2116 /* {
2316 syscallarg(const netbsd32_charp) path; 2117 syscallarg(const netbsd32_charp) path;
2317 syscallarg(int) attrnamespace; 2118 syscallarg(int) attrnamespace;
2318 syscallarg(const netbsd32_charp) attrname; 2119 syscallarg(const netbsd32_charp) attrname;
2319 } */ 2120 } */
2320 struct sys_extattr_delete_file_args ua; 2121 struct sys_extattr_delete_file_args ua;
2321 2122
2322 NETBSD32TOP_UAP(path, const char); 2123 NETBSD32TOP_UAP(path, const char);
2323 NETBSD32TO64_UAP(attrnamespace); 2124 NETBSD32TO64_UAP(attrnamespace);
2324 NETBSD32TOP_UAP(attrname, const char); 2125 NETBSD32TOP_UAP(attrname, const char);
2325 2126
2326 return sys_extattr_delete_file(l, &ua, retval); 2127 return sys_extattr_delete_file(l, &ua, retval);
2327} 2128}
2328 2129
2329int 2130int
2330netbsd32_extattr_delete_link(struct lwp *l, const struct netbsd32_extattr_delete_link_args *uap, register_t *retval) 2131netbsd32_extattr_delete_link(struct lwp *l, const struct netbsd32_extattr_delete_link_args *uap, register_t *retval)
2331{ 2132{
2332 /* { 2133 /* {
2333 syscallarg(const netbsd32_charp) path; 2134 syscallarg(const netbsd32_charp) path;
2334 syscallarg(int) attrnamespace; 2135 syscallarg(int) attrnamespace;
2335 syscallarg(const netbsd32_charp) attrname; 2136 syscallarg(const netbsd32_charp) attrname;
2336 } */ 2137 } */
2337 struct sys_extattr_delete_link_args ua; 2138 struct sys_extattr_delete_link_args ua;
2338 2139
2339 NETBSD32TOP_UAP(path, const char); 2140 NETBSD32TOP_UAP(path, const char);
2340 NETBSD32TO64_UAP(attrnamespace); 2141 NETBSD32TO64_UAP(attrnamespace);
2341 NETBSD32TOP_UAP(attrname, const char); 2142 NETBSD32TOP_UAP(attrname, const char);
2342 2143
2343 return sys_extattr_delete_link(l, &ua, retval); 2144 return sys_extattr_delete_link(l, &ua, retval);
2344} 2145}
2345 2146
2346int 2147int
2347netbsd32_extattr_list_fd(struct lwp *l, const struct netbsd32_extattr_list_fd_args *uap, register_t *retval) 2148netbsd32_extattr_list_fd(struct lwp *l, const struct netbsd32_extattr_list_fd_args *uap, register_t *retval)
2348{ 2149{
2349 /* { 2150 /* {
2350 syscallarg(int) fd; 2151 syscallarg(int) fd;
2351 syscallarg(int) attrnamespace; 2152 syscallarg(int) attrnamespace;
2352 syscallarg(netbsd32_voidp) data; 2153 syscallarg(netbsd32_voidp) data;
2353 syscallarg(netbsd32_size_t) nbytes; 2154 syscallarg(netbsd32_size_t) nbytes;
2354 } */ 2155 } */
2355 struct sys_extattr_list_fd_args ua; 2156 struct sys_extattr_list_fd_args ua;
2356 2157
2357 NETBSD32TO64_UAP(fd); 2158 NETBSD32TO64_UAP(fd);
2358 NETBSD32TO64_UAP(attrnamespace); 2159 NETBSD32TO64_UAP(attrnamespace);
2359 NETBSD32TOP_UAP(data, void); 2160 NETBSD32TOP_UAP(data, void);
2360 NETBSD32TOX_UAP(nbytes, size_t); 2161 NETBSD32TOX_UAP(nbytes, size_t);
2361 2162
2362 return sys_extattr_list_fd(l, &ua, retval); 2163 return sys_extattr_list_fd(l, &ua, retval);
2363} 2164}
2364 2165
2365int 2166int
2366netbsd32_extattr_list_file(struct lwp *l, const struct netbsd32_extattr_list_file_args *uap, register_t *retval) 2167netbsd32_extattr_list_file(struct lwp *l, const struct netbsd32_extattr_list_file_args *uap, register_t *retval)
2367{ 2168{
2368 /* { 2169 /* {
2369 syscallarg(const netbsd32_charp) path; 2170 syscallarg(const netbsd32_charp) path;
2370 syscallarg(int) attrnamespace; 2171 syscallarg(int) attrnamespace;
2371 syscallarg(netbsd32_voidp) data; 2172 syscallarg(netbsd32_voidp) data;
2372 syscallarg(netbsd32_size_t) nbytes; 2173 syscallarg(netbsd32_size_t) nbytes;
2373 } */ 2174 } */
2374 struct sys_extattr_list_file_args ua; 2175 struct sys_extattr_list_file_args ua;
2375 2176
2376 NETBSD32TOP_UAP(path, const char); 2177 NETBSD32TOP_UAP(path, const char);
2377 NETBSD32TO64_UAP(attrnamespace); 2178 NETBSD32TO64_UAP(attrnamespace);
2378 NETBSD32TOP_UAP(data, void); 2179 NETBSD32TOP_UAP(data, void);
2379 NETBSD32TOX_UAP(nbytes, size_t); 2180 NETBSD32TOX_UAP(nbytes, size_t);
2380 2181
2381 return sys_extattr_list_file(l, &ua, retval); 2182 return sys_extattr_list_file(l, &ua, retval);
2382} 2183}
2383 2184
2384int 2185int
2385netbsd32_extattr_list_link(struct lwp *l, const struct netbsd32_extattr_list_link_args *uap, register_t *retval) 2186netbsd32_extattr_list_link(struct lwp *l, const struct netbsd32_extattr_list_link_args *uap, register_t *retval)
2386{ 2187{
2387 /* { 2188 /* {
2388 syscallarg(const netbsd32_charp) path; 2189 syscallarg(const netbsd32_charp) path;
2389 syscallarg(int) attrnamespace; 2190 syscallarg(int) attrnamespace;
2390 syscallarg(netbsd32_voidp) data; 2191 syscallarg(netbsd32_voidp) data;
2391 syscallarg(netbsd32_size_t) nbytes; 2192 syscallarg(netbsd32_size_t) nbytes;
2392 } */ 2193 } */
2393 struct sys_extattr_list_link_args ua; 2194 struct sys_extattr_list_link_args ua;
2394 2195
2395 NETBSD32TOP_UAP(path, const char); 2196 NETBSD32TOP_UAP(path, const char);
2396 NETBSD32TO64_UAP(attrnamespace); 2197 NETBSD32TO64_UAP(attrnamespace);
2397 NETBSD32TOP_UAP(data, void); 2198 NETBSD32TOP_UAP(data, void);
2398 NETBSD32TOX_UAP(nbytes, size_t); 2199 NETBSD32TOX_UAP(nbytes, size_t);
2399 2200
2400 return sys_extattr_list_link(l, &ua, retval); 2201 return sys_extattr_list_link(l, &ua, retval);
2401} 2202}
2402 2203
2403int 2204int
2404netbsd32_mlockall(struct lwp *l, const struct netbsd32_mlockall_args *uap, register_t *retval) 2205netbsd32_mlockall(struct lwp *l, const struct netbsd32_mlockall_args *uap, register_t *retval)
2405{ 2206{
2406 /* { 2207 /* {
2407 syscallarg(int) flags; 2208 syscallarg(int) flags;
2408 } */ 2209 } */
2409 struct sys_mlockall_args ua; 2210 struct sys_mlockall_args ua;
2410 2211
2411 NETBSD32TO64_UAP(flags); 2212 NETBSD32TO64_UAP(flags);
2412 2213
2413 return sys_mlockall(l, &ua, retval); 2214 return sys_mlockall(l, &ua, retval);
2414} 2215}
2415 2216
2416int 2217int
2417netbsd32___clone(struct lwp *l, const struct netbsd32___clone_args *uap, register_t *retval) 2218netbsd32___clone(struct lwp *l, const struct netbsd32___clone_args *uap, register_t *retval)
2418{ 2219{
2419 /* { 2220 /* {
2420 syscallarg(int) flags; 2221 syscallarg(int) flags;
2421 syscallarg(netbsd32_voidp) stack; 2222 syscallarg(netbsd32_voidp) stack;
2422 } */ 2223 } */
2423 struct sys___clone_args ua; 2224 struct sys___clone_args ua;
2424 2225
2425 NETBSD32TO64_UAP(flags); 2226 NETBSD32TO64_UAP(flags);
2426 NETBSD32TOP_UAP(stack, void); 2227 NETBSD32TOP_UAP(stack, void);
2427 2228
2428 return sys___clone(l, &ua, retval); 2229 return sys___clone(l, &ua, retval);
2429} 2230}
2430 2231
2431int 2232int
2432netbsd32_fsync_range(struct lwp *l, const struct netbsd32_fsync_range_args *uap, register_t *retval) 2233netbsd32_fsync_range(struct lwp *l, const struct netbsd32_fsync_range_args *uap, register_t *retval)
2433{ 2234{
2434 /* { 2235 /* {
2435 syscallarg(int) fd; 2236 syscallarg(int) fd;
2436 syscallarg(int) flags; 2237 syscallarg(int) flags;
2437 syscallarg(off_t) start; 2238 syscallarg(off_t) start;
2438 syscallarg(off_t) length; 2239 syscallarg(off_t) length;
2439 } */ 2240 } */
2440 struct sys_fsync_range_args ua; 2241 struct sys_fsync_range_args ua;
2441 2242
2442 NETBSD32TO64_UAP(fd); 2243 NETBSD32TO64_UAP(fd);
2443 NETBSD32TO64_UAP(flags); 2244 NETBSD32TO64_UAP(flags);
2444 NETBSD32TO64_UAP(start); 2245 NETBSD32TO64_UAP(start);
2445 NETBSD32TO64_UAP(length); 2246 NETBSD32TO64_UAP(length);
2446 2247
2447 return sys_fsync_range(l, &ua, retval); 2248 return sys_fsync_range(l, &ua, retval);
2448} 2249}
2449 2250
2450int 2251int
2451netbsd32_rasctl(struct lwp *l, const struct netbsd32_rasctl_args *uap, register_t *retval) 2252netbsd32_rasctl(struct lwp *l, const struct netbsd32_rasctl_args *uap, register_t *retval)
2452{ 2253{
2453 /* { 2254 /* {
2454 syscallarg(netbsd32_voidp) addr; 2255 syscallarg(netbsd32_voidp) addr;
2455 syscallarg(netbsd32_size_t) len; 2256 syscallarg(netbsd32_size_t) len;
2456 syscallarg(int) op; 2257 syscallarg(int) op;
2457 } */ 2258 } */
2458 struct sys_rasctl_args ua; 2259 struct sys_rasctl_args ua;
2459 2260
2460 NETBSD32TOP_UAP(addr, void *); 2261 NETBSD32TOP_UAP(addr, void *);
2461 NETBSD32TOX_UAP(len, size_t); 2262 NETBSD32TOX_UAP(len, size_t);
2462 NETBSD32TO64_UAP(op); 2263 NETBSD32TO64_UAP(op);
2463 2264
2464 return sys_rasctl(l, &ua, retval); 2265 return sys_rasctl(l, &ua, retval);
2465} 2266}
2466 2267
2467int 2268int
2468netbsd32_setxattr(struct lwp *l, const struct netbsd32_setxattr_args *uap, register_t *retval) 2269netbsd32_setxattr(struct lwp *l, const struct netbsd32_setxattr_args *uap, register_t *retval)
2469{ 2270{
2470 /* { 2271 /* {
2471 syscallarg(const netbsd32_charp) path; 2272 syscallarg(const netbsd32_charp) path;
2472 syscallarg(const netbsd32_charp) name; 2273 syscallarg(const netbsd32_charp) name;
2473 syscallarg(netbsd32_voidp) value; 2274 syscallarg(netbsd32_voidp) value;
2474 syscallarg(netbsd32_size_t) size; 2275 syscallarg(netbsd32_size_t) size;
2475 syscallarg(int) flags; 2276 syscallarg(int) flags;
2476 } */ 2277 } */
2477 struct sys_setxattr_args ua; 2278 struct sys_setxattr_args ua;
2478 2279
2479 NETBSD32TOP_UAP(path, const char); 2280 NETBSD32TOP_UAP(path, const char);
2480 NETBSD32TOP_UAP(name, const char); 2281 NETBSD32TOP_UAP(name, const char);
2481 NETBSD32TOP_UAP(value, void); 2282 NETBSD32TOP_UAP(value, void);
2482 NETBSD32TOX_UAP(size, size_t); 2283 NETBSD32TOX_UAP(size, size_t);
2483 NETBSD32TO64_UAP(flags); 2284 NETBSD32TO64_UAP(flags);
2484 2285
2485 return sys_setxattr(l, &ua, retval); 2286 return sys_setxattr(l, &ua, retval);
2486} 2287}
2487 2288
2488int 2289int
2489netbsd32_lsetxattr(struct lwp *l, const struct netbsd32_lsetxattr_args *uap, register_t *retval) 2290netbsd32_lsetxattr(struct lwp *l, const struct netbsd32_lsetxattr_args *uap, register_t *retval)
2490{ 2291{
2491 /* { 2292 /* {
2492 syscallarg(const netbsd32_charp) path; 2293 syscallarg(const netbsd32_charp) path;
2493 syscallarg(const netbsd32_charp) name; 2294 syscallarg(const netbsd32_charp) name;
2494 syscallarg(netbsd32_voidp) value; 2295 syscallarg(netbsd32_voidp) value;
2495 syscallarg(netbsd32_size_t) size; 2296 syscallarg(netbsd32_size_t) size;
2496 syscallarg(int) flags; 2297 syscallarg(int) flags;
2497 } */ 2298 } */
2498 struct sys_lsetxattr_args ua; 2299 struct sys_lsetxattr_args ua;
2499 2300
2500 NETBSD32TOP_UAP(path, const char); 2301 NETBSD32TOP_UAP(path, const char);
2501 NETBSD32TOP_UAP(name, const char); 2302 NETBSD32TOP_UAP(name, const char);
2502 NETBSD32TOP_UAP(value, void); 2303 NETBSD32TOP_UAP(value, void);
2503 NETBSD32TOX_UAP(size, size_t); 2304 NETBSD32TOX_UAP(size, size_t);
2504 NETBSD32TO64_UAP(flags); 2305 NETBSD32TO64_UAP(flags);
2505 2306
2506 return sys_lsetxattr(l, &ua, retval); 2307 return sys_lsetxattr(l, &ua, retval);
2507} 2308}
2508 2309
2509int 2310int
2510netbsd32_fsetxattr(struct lwp *l, const struct netbsd32_fsetxattr_args *uap, register_t *retval) 2311netbsd32_fsetxattr(struct lwp *l, const struct netbsd32_fsetxattr_args *uap, register_t *retval)
2511{ 2312{
2512 /* { 2313 /* {
2513 syscallarg(int) fd; 2314 syscallarg(int) fd;
2514 syscallarg(const netbsd32_charp) name; 2315 syscallarg(const netbsd32_charp) name;
2515 syscallarg(netbsd32_voidp) value; 2316 syscallarg(netbsd32_voidp) value;
2516 syscallarg(netbsd32_size_t) size; 2317 syscallarg(netbsd32_size_t) size;
2517 syscallarg(int) flags; 2318 syscallarg(int) flags;
2518 } */ 2319 } */
2519 struct sys_fsetxattr_args ua; 2320 struct sys_fsetxattr_args ua;
2520 2321
2521 NETBSD32TO64_UAP(fd); 2322 NETBSD32TO64_UAP(fd);
2522 NETBSD32TOP_UAP(name, const char); 2323 NETBSD32TOP_UAP(name, const char);
2523 NETBSD32TOP_UAP(value, void); 2324 NETBSD32TOP_UAP(value, void);
2524 NETBSD32TOX_UAP(size, size_t); 2325 NETBSD32TOX_UAP(size, size_t);
2525 NETBSD32TO64_UAP(flags); 2326 NETBSD32TO64_UAP(flags);
2526 2327
2527 return sys_fsetxattr(l, &ua, retval); 2328 return sys_fsetxattr(l, &ua, retval);
2528} 2329}
2529 2330
2530int 2331int
2531netbsd32_getxattr(struct lwp *l, const struct netbsd32_getxattr_args *uap, register_t *retval) 2332netbsd32_getxattr(struct lwp *l, const struct netbsd32_getxattr_args *uap, register_t *retval)
2532{ 2333{
2533 /* { 2334 /* {
2534 syscallarg(const netbsd32_charp) path; 2335 syscallarg(const netbsd32_charp) path;
2535 syscallarg(const netbsd32_charp) name; 2336 syscallarg(const netbsd32_charp) name;
2536 syscallarg(netbsd32_voidp) value; 2337 syscallarg(netbsd32_voidp) value;
2537 syscallarg(netbsd32_size_t) size; 2338 syscallarg(netbsd32_size_t) size;
2538 } */ 2339 } */
2539 struct sys_getxattr_args ua; 2340 struct sys_getxattr_args ua;
2540 2341
2541 NETBSD32TOP_UAP(path, const char); 2342 NETBSD32TOP_UAP(path, const char);
2542 NETBSD32TOP_UAP(name, const char); 2343 NETBSD32TOP_UAP(name, const char);
2543 NETBSD32TOP_UAP(value, void); 2344 NETBSD32TOP_UAP(value, void);
2544 NETBSD32TOX_UAP(size, size_t); 2345 NETBSD32TOX_UAP(size, size_t);
2545 2346
2546 return sys_getxattr(l, &ua, retval); 2347 return sys_getxattr(l, &ua, retval);
2547} 2348}
2548 2349
2549int 2350int
2550netbsd32_lgetxattr(struct lwp *l, const struct netbsd32_lgetxattr_args *uap, register_t *retval) 2351netbsd32_lgetxattr(struct lwp *l, const struct netbsd32_lgetxattr_args *uap, register_t *retval)
2551{ 2352{
2552 /* { 2353 /* {
2553 syscallarg(const netbsd32_charp) path; 2354 syscallarg(const netbsd32_charp) path;
2554 syscallarg(const netbsd32_charp) name; 2355 syscallarg(const netbsd32_charp) name;
2555 syscallarg(netbsd32_voidp) value; 2356 syscallarg(netbsd32_voidp) value;
2556 syscallarg(netbsd32_size_t) size; 2357 syscallarg(netbsd32_size_t) size;
2557 } */ 2358 } */
2558 struct sys_lgetxattr_args ua; 2359 struct sys_lgetxattr_args ua;
2559 2360
2560 NETBSD32TOP_UAP(path, const char); 2361 NETBSD32TOP_UAP(path, const char);
2561 NETBSD32TOP_UAP(name, const char); 2362 NETBSD32TOP_UAP(name, const char);
2562 NETBSD32TOP_UAP(value, void); 2363 NETBSD32TOP_UAP(value, void);
2563 NETBSD32TOX_UAP(size, size_t); 2364 NETBSD32TOX_UAP(size, size_t);
2564 2365
2565 return sys_lgetxattr(l, &ua, retval); 2366 return sys_lgetxattr(l, &ua, retval);
2566} 2367}
2567 2368
2568int 2369int
2569netbsd32_fgetxattr(struct lwp *l, const struct netbsd32_fgetxattr_args *uap, register_t *retval) 2370netbsd32_fgetxattr(struct lwp *l, const struct netbsd32_fgetxattr_args *uap, register_t *retval)
2570{ 2371{
2571 /* { 2372 /* {
2572 syscallarg(int) fd; 2373 syscallarg(int) fd;
2573 syscallarg(const netbsd32_charp) name; 2374 syscallarg(const netbsd32_charp) name;
2574 syscallarg(netbsd32_voidp) value; 2375 syscallarg(netbsd32_voidp) value;
2575 syscallarg(netbsd32_size_t) size; 2376 syscallarg(netbsd32_size_t) size;
2576 } */ 2377 } */
2577 struct sys_fgetxattr_args ua; 2378 struct sys_fgetxattr_args ua;
2578 2379
2579 NETBSD32TO64_UAP(fd); 2380 NETBSD32TO64_UAP(fd);
2580 NETBSD32TOP_UAP(name, const char); 2381 NETBSD32TOP_UAP(name, const char);
2581 NETBSD32TOP_UAP(value, void); 2382 NETBSD32TOP_UAP(value, void);
2582 NETBSD32TOX_UAP(size, size_t); 2383 NETBSD32TOX_UAP(size, size_t);
2583 2384
2584 return sys_fgetxattr(l, &ua, retval); 2385 return sys_fgetxattr(l, &ua, retval);
2585} 2386}
2586 2387
2587int 2388int
2588netbsd32_listxattr(struct lwp *l, const struct netbsd32_listxattr_args *uap, register_t *retval) 2389netbsd32_listxattr(struct lwp *l, const struct netbsd32_listxattr_args *uap, register_t *retval)
2589{ 2390{
2590 /* { 2391 /* {
2591 syscallarg(const netbsd32_charp) path; 2392 syscallarg(const netbsd32_charp) path;
2592 syscallarg(netbsd32_charp) list; 2393 syscallarg(netbsd32_charp) list;
2593 syscallarg(netbsd32_size_t) size; 2394 syscallarg(netbsd32_size_t) size;
2594 } */ 2395 } */
2595 struct sys_listxattr_args ua; 2396 struct sys_listxattr_args ua;
2596 2397
2597 NETBSD32TOP_UAP(path, const char); 2398 NETBSD32TOP_UAP(path, const char);
2598 NETBSD32TOP_UAP(list, char); 2399 NETBSD32TOP_UAP(list, char);
2599 NETBSD32TOX_UAP(size, size_t); 2400 NETBSD32TOX_UAP(size, size_t);
2600 2401
2601 return sys_listxattr(l, &ua, retval); 2402 return sys_listxattr(l, &ua, retval);
2602} 2403}
2603 2404
2604int 2405int
2605netbsd32_llistxattr(struct lwp *l, const struct netbsd32_llistxattr_args *uap, register_t *retval) 2406netbsd32_llistxattr(struct lwp *l, const struct netbsd32_llistxattr_args *uap, register_t *retval)
2606{ 2407{
2607 /* { 2408 /* {
2608 syscallarg(const netbsd32_charp) path; 2409 syscallarg(const netbsd32_charp) path;
2609 syscallarg(netbsd32_charp) list; 2410 syscallarg(netbsd32_charp) list;
2610 syscallarg(netbsd32_size_t) size; 2411 syscallarg(netbsd32_size_t) size;
2611 } */ 2412 } */
2612 struct sys_llistxattr_args ua; 2413 struct sys_llistxattr_args ua;
2613 2414
2614 NETBSD32TOP_UAP(path, const char); 2415 NETBSD32TOP_UAP(path, const char);
2615 NETBSD32TOP_UAP(list, char); 2416 NETBSD32TOP_UAP(list, char);
2616 NETBSD32TOX_UAP(size, size_t); 2417 NETBSD32TOX_UAP(size, size_t);
2617 2418
2618 return sys_llistxattr(l, &ua, retval); 2419 return sys_llistxattr(l, &ua, retval);
2619} 2420}
2620 2421
2621int 2422int
2622netbsd32_flistxattr(struct lwp *l, const struct netbsd32_flistxattr_args *uap, register_t *retval) 2423netbsd32_flistxattr(struct lwp *l, const struct netbsd32_flistxattr_args *uap, register_t *retval)
2623{ 2424{
2624 /* { 2425 /* {
2625 syscallarg(int) fd; 2426 syscallarg(int) fd;
2626 syscallarg(netbsd32_charp) list; 2427 syscallarg(netbsd32_charp) list;
2627 syscallarg(netbsd32_size_t) size; 2428 syscallarg(netbsd32_size_t) size;
2628 } */ 2429 } */
2629 struct sys_flistxattr_args ua; 2430 struct sys_flistxattr_args ua;
2630 2431
2631 NETBSD32TO64_UAP(fd); 2432 NETBSD32TO64_UAP(fd);
2632 NETBSD32TOP_UAP(list, char); 2433 NETBSD32TOP_UAP(list, char);
2633 NETBSD32TOX_UAP(size, size_t); 2434 NETBSD32TOX_UAP(size, size_t);
2634 2435
2635 return sys_flistxattr(l, &ua, retval); 2436 return sys_flistxattr(l, &ua, retval);
2636} 2437}
2637 2438
2638int 2439int
2639netbsd32_removexattr(struct lwp *l, const struct netbsd32_removexattr_args *uap, register_t *retval) 2440netbsd32_removexattr(struct lwp *l, const struct netbsd32_removexattr_args *uap, register_t *retval)
2640{ 2441{
2641 /* { 2442 /* {
2642 syscallarg(const netbsd32_charp) path; 2443 syscallarg(const netbsd32_charp) path;
2643 syscallarg(const netbsd32_charp) name; 2444 syscallarg(const netbsd32_charp) name;
2644 } */ 2445 } */
2645 struct sys_removexattr_args ua; 2446 struct sys_removexattr_args ua;
2646 2447
2647 NETBSD32TOP_UAP(path, const char); 2448 NETBSD32TOP_UAP(path, const char);
2648 NETBSD32TOP_UAP(name, const char); 2449 NETBSD32TOP_UAP(name, const char);
2649 2450
2650 return sys_removexattr(l, &ua, retval); 2451 return sys_removexattr(l, &ua, retval);
2651} 2452}
2652 2453
2653int 2454int
2654netbsd32_lremovexattr(struct lwp *l, const struct netbsd32_lremovexattr_args *uap, register_t *retval) 2455netbsd32_lremovexattr(struct lwp *l, const struct netbsd32_lremovexattr_args *uap, register_t *retval)
2655{ 2456{
2656 /* { 2457 /* {
2657 syscallarg(const netbsd32_charp) path; 2458 syscallarg(const netbsd32_charp) path;
2658 syscallarg(const netbsd32_charp) name; 2459 syscallarg(const netbsd32_charp) name;
2659 } */ 2460 } */
2660 struct sys_lremovexattr_args ua; 2461 struct sys_lremovexattr_args ua;
2661 NETBSD32TOP_UAP(path, const char); 2462 NETBSD32TOP_UAP(path, const char);
2662 NETBSD32TOP_UAP(name, const char); 2463 NETBSD32TOP_UAP(name, const char);
2663 return sys_lremovexattr(l, &ua, retval); 2464 return sys_lremovexattr(l, &ua, retval);
2664} 2465}
2665 2466
2666int 2467int
2667netbsd32_fremovexattr(struct lwp *l, const struct netbsd32_fremovexattr_args *uap, register_t *retval) 2468netbsd32_fremovexattr(struct lwp *l, const struct netbsd32_fremovexattr_args *uap, register_t *retval)
2668{ 2469{
2669 /* { 2470 /* {
2670 syscallarg(int) fd; 2471 syscallarg(int) fd;
2671 syscallarg(const netbsd32_charp) name; 2472 syscallarg(const netbsd32_charp) name;
2672 } */ 2473 } */
2673 struct sys_fremovexattr_args ua; 2474 struct sys_fremovexattr_args ua;
2674 2475
2675 NETBSD32TO64_UAP(fd); 2476 NETBSD32TO64_UAP(fd);
2676 NETBSD32TOP_UAP(name, const char); 2477 NETBSD32TOP_UAP(name, const char);
2677 2478
2678 return sys_fremovexattr(l, &ua, retval); 2479 return sys_fremovexattr(l, &ua, retval);
2679} 2480}
2680 2481
2681int 2482int
2682netbsd32___posix_fadvise50(struct lwp *l, 2483netbsd32___posix_fadvise50(struct lwp *l,
2683 const struct netbsd32___posix_fadvise50_args *uap, register_t *retval) 2484 const struct netbsd32___posix_fadvise50_args *uap, register_t *retval)
2684{ 2485{
2685 /* { 2486 /* {
2686 syscallarg(int) fd; 2487 syscallarg(int) fd;
2687 syscallarg(int) PAD; 2488 syscallarg(int) PAD;
2688 syscallarg(netbsd32_off_t) offset; 2489 syscallarg(netbsd32_off_t) offset;
2689 syscallarg(netbsd32_off_t) len; 2490 syscallarg(netbsd32_off_t) len;
2690 syscallarg(int) advice; 2491 syscallarg(int) advice;
2691 } */ 2492 } */
2692 2493
2693 *retval = do_posix_fadvise(SCARG(uap, fd), SCARG(uap, offset), 2494 *retval = do_posix_fadvise(SCARG(uap, fd), SCARG(uap, offset),
2694 SCARG(uap, len), SCARG(uap, advice)); 2495 SCARG(uap, len), SCARG(uap, advice));
2695 2496
2696 return 0; 2497 return 0;
2697} 2498}
2698 2499
2699int 2500int
2700netbsd32__sched_setparam(struct lwp *l, 2501netbsd32__sched_setparam(struct lwp *l,
2701 const struct netbsd32__sched_setparam_args *uap, 2502 const struct netbsd32__sched_setparam_args *uap,
2702 register_t *retval) 2503 register_t *retval)
2703{ 2504{
2704 /* { 2505 /* {
2705 syscallarg(pid_t) pid; 2506 syscallarg(pid_t) pid;
2706 syscallarg(lwpid_t) lid; 2507 syscallarg(lwpid_t) lid;
2707 syscallarg(int) policy; 2508 syscallarg(int) policy;
2708 syscallarg(const netbsd32_sched_paramp_t) params; 2509 syscallarg(const netbsd32_sched_paramp_t) params;
2709 } */ 2510 } */
2710 struct sys__sched_setparam_args ua; 2511 struct sys__sched_setparam_args ua;
2711 2512
2712 NETBSD32TO64_UAP(pid); 2513 NETBSD32TO64_UAP(pid);
2713 NETBSD32TO64_UAP(lid); 2514 NETBSD32TO64_UAP(lid);
2714 NETBSD32TO64_UAP(policy); 2515 NETBSD32TO64_UAP(policy);
2715 NETBSD32TOP_UAP(params, const struct sched_param *); 2516 NETBSD32TOP_UAP(params, const struct sched_param *);
2716 2517
2717 return sys__sched_setparam(l, &ua, retval); 2518 return sys__sched_setparam(l, &ua, retval);
2718} 2519}
2719 2520
2720int 2521int
2721netbsd32__sched_getparam(struct lwp *l, 2522netbsd32__sched_getparam(struct lwp *l,
2722 const struct netbsd32__sched_getparam_args *uap, 2523 const struct netbsd32__sched_getparam_args *uap,
2723 register_t *retval) 2524 register_t *retval)
2724{ 2525{
2725 /* { 2526 /* {
2726 syscallarg(pid_t) pid; 2527 syscallarg(pid_t) pid;
2727 syscallarg(lwpid_t) lid; 2528 syscallarg(lwpid_t) lid;
2728 syscallarg(netbsd32_intp) policy; 2529 syscallarg(netbsd32_intp) policy;
2729 syscallarg(netbsd32_sched_paramp_t) params; 2530 syscallarg(netbsd32_sched_paramp_t) params;
2730 } */ 2531 } */
2731 struct sys__sched_getparam_args ua; 2532 struct sys__sched_getparam_args ua;
2732 2533
2733 NETBSD32TO64_UAP(pid); 2534 NETBSD32TO64_UAP(pid);
2734 NETBSD32TO64_UAP(lid); 2535 NETBSD32TO64_UAP(lid);
2735 NETBSD32TOP_UAP(policy, int *); 2536 NETBSD32TOP_UAP(policy, int *);
2736 NETBSD32TOP_UAP(params, struct sched_param *); 2537 NETBSD32TOP_UAP(params, struct sched_param *);
2737 2538
2738 return sys__sched_getparam(l, &ua, retval); 2539 return sys__sched_getparam(l, &ua, retval);
2739} 2540}
2740 2541
2741int 2542int
2742netbsd32__sched_setaffinity(struct lwp *l, 2543netbsd32__sched_setaffinity(struct lwp *l,
2743 const struct netbsd32__sched_setaffinity_args *uap, 2544 const struct netbsd32__sched_setaffinity_args *uap,
2744 register_t *retval) 2545 register_t *retval)
2745{ 2546{
2746 /* { 2547 /* {
2747 syscallarg(pid_t) pid; 2548 syscallarg(pid_t) pid;
2748 syscallarg(lwpid_t) lid; 2549 syscallarg(lwpid_t) lid;
2749 syscallarg(netbsd_size_t) size; 2550 syscallarg(netbsd_size_t) size;
2750 syscallarg(const netbsd32_cpusetp_t) cpuset; 2551 syscallarg(const netbsd32_cpusetp_t) cpuset;
2751 } */ 2552 } */
2752 struct sys__sched_setaffinity_args ua; 2553 struct sys__sched_setaffinity_args ua;
2753 2554
2754 NETBSD32TO64_UAP(pid); 2555 NETBSD32TO64_UAP(pid);
2755 NETBSD32TO64_UAP(lid); 2556 NETBSD32TO64_UAP(lid);
2756 NETBSD32TOX_UAP(size, size_t); 2557 NETBSD32TOX_UAP(size, size_t);
2757 NETBSD32TOP_UAP(cpuset, const cpuset_t *); 2558 NETBSD32TOP_UAP(cpuset, const cpuset_t *);
2758 2559
2759 return sys__sched_setaffinity(l, &ua, retval); 2560 return sys__sched_setaffinity(l, &ua, retval);
2760} 2561}
2761 2562
2762int 2563int
2763netbsd32__sched_getaffinity(struct lwp *l, 2564netbsd32__sched_getaffinity(struct lwp *l,
2764 const struct netbsd32__sched_getaffinity_args *uap, 2565 const struct netbsd32__sched_getaffinity_args *uap,
2765 register_t *retval) 2566 register_t *retval)
2766{ 2567{
2767 /* { 2568 /* {
2768 syscallarg(pid_t) pid; 2569 syscallarg(pid_t) pid;
2769 syscallarg(lwpid_t) lid; 2570 syscallarg(lwpid_t) lid;
2770 syscallarg(netbsd_size_t) size; 2571 syscallarg(netbsd_size_t) size;
2771 syscallarg(netbsd32_cpusetp_t) cpuset; 2572 syscallarg(netbsd32_cpusetp_t) cpuset;
2772 } */ 2573 } */
2773 struct sys__sched_getaffinity_args ua; 2574 struct sys__sched_getaffinity_args ua;
2774 2575
2775 NETBSD32TO64_UAP(pid); 2576 NETBSD32TO64_UAP(pid);
2776 NETBSD32TO64_UAP(lid); 2577 NETBSD32TO64_UAP(lid);
2777 NETBSD32TOX_UAP(size, size_t); 2578 NETBSD32TOX_UAP(size, size_t);
2778 NETBSD32TOP_UAP(cpuset, cpuset_t *); 2579 NETBSD32TOP_UAP(cpuset, cpuset_t *);
2779 2580
2780 return sys__sched_getaffinity(l, &ua, retval); 2581 return sys__sched_getaffinity(l, &ua, retval);
2781} 2582}
2782 2583
2783int 2584int
2784netbsd32__sched_protect(struct lwp *l, 2585netbsd32__sched_protect(struct lwp *l,
2785 const struct netbsd32__sched_protect_args *uap, 2586 const struct netbsd32__sched_protect_args *uap,
2786 register_t *retval) 2587 register_t *retval)
2787{ 2588{
2788 /* { 2589 /* {
2789 syscallarg(int) priority; 2590 syscallarg(int) priority;
2790 } */ 2591 } */
2791 struct sys__sched_protect_args ua; 2592 struct sys__sched_protect_args ua;
2792 2593
2793 NETBSD32TO64_UAP(priority); 2594 NETBSD32TO64_UAP(priority);
2794 2595
2795 return sys__sched_protect(l, &ua, retval); 2596 return sys__sched_protect(l, &ua, retval);
2796} 2597}
2797 2598
2798// XXX new file 2599// XXX new file
2799int 2600int
2800netbsd32_pipe2(struct lwp *l, const struct netbsd32_pipe2_args *uap, 2601netbsd32_pipe2(struct lwp *l, const struct netbsd32_pipe2_args *uap,
2801 register_t *retval) 2602 register_t *retval)
2802{ 2603{
2803 /* { 2604 /* {
2804 syscallarg(netbsd32_intp) fildes; 2605 syscallarg(netbsd32_intp) fildes;
2805 syscallarg(int) flags; 2606 syscallarg(int) flags;
2806 } */ 2607 } */
2807 int fd[2], error; 2608 int fd[2], error;
2808 2609
2809 error = pipe1(l, fd, SCARG(uap, flags)); 2610 error = pipe1(l, fd, SCARG(uap, flags));
2810 if (error != 0) 2611 if (error != 0)
2811 return error; 2612 return error;
2812 2613
2813 error = copyout(fd, SCARG_P32(uap, fildes), sizeof(fd)); 2614 error = copyout(fd, SCARG_P32(uap, fildes), sizeof(fd));
2814 if (error != 0) 2615 if (error != 0)
2815 return error; 2616 return error;
2816 2617
2817 retval[0] = 0; 2618 retval[0] = 0;
2818 return 0; 2619 return 0;
2819} 2620}
2820 2621
2821int 2622int
2822netbsd32_dup3(struct lwp *l, const struct netbsd32_dup3_args *uap, 2623netbsd32_dup3(struct lwp *l, const struct netbsd32_dup3_args *uap,
2823 register_t *retval) 2624 register_t *retval)
2824{ 2625{
2825 /* { 2626 /* {
2826 syscallarg(int) from; 2627 syscallarg(int) from;
2827 syscallarg(int) to; 2628 syscallarg(int) to;
2828 syscallarg(int) flags; 2629 syscallarg(int) flags;
2829 } */ 2630 } */
2830 struct sys_dup3_args ua; 2631 struct sys_dup3_args ua;
2831 2632
2832 NETBSD32TO64_UAP(from); 2633 NETBSD32TO64_UAP(from);
2833 NETBSD32TO64_UAP(to); 2634 NETBSD32TO64_UAP(to);
2834 NETBSD32TO64_UAP(flags); 2635 NETBSD32TO64_UAP(flags);
2835 2636
2836 return sys_dup3(l, &ua, retval); 2637 return sys_dup3(l, &ua, retval);
2837} 2638}
2838 2639
2839int 2640int
2840netbsd32_kqueue1(struct lwp *l, const struct netbsd32_kqueue1_args *uap, 2641netbsd32_kqueue1(struct lwp *l, const struct netbsd32_kqueue1_args *uap,
2841 register_t *retval) 2642 register_t *retval)
2842{ 2643{
2843 /* { 2644 /* {
2844 syscallarg(int) flags; 2645 syscallarg(int) flags;
2845 } */ 2646 } */
2846 struct sys_kqueue1_args ua; 2647 struct sys_kqueue1_args ua;
2847 2648
2848 NETBSD32TO64_UAP(flags); 2649 NETBSD32TO64_UAP(flags);
2849 2650
2850 return sys_kqueue1(l, &ua, retval); 2651 return sys_kqueue1(l, &ua, retval);
2851} 2652}
2852 2653
2853int 2654int
2854netbsd32_paccept(struct lwp *l, const struct netbsd32_paccept_args *uap, 2655netbsd32_paccept(struct lwp *l, const struct netbsd32_paccept_args *uap,
2855 register_t *retval) 2656 register_t *retval)
2856{ 2657{
2857 /* { 2658 /* {
2858 syscallarg(int) s; 2659 syscallarg(int) s;
2859 syscallarg(netbsd32_sockaddrp_t) name; 2660 syscallarg(netbsd32_sockaddrp_t) name;
2860 syscallarg(netbsd32_socklenp_t) anamelen; 2661 syscallarg(netbsd32_socklenp_t) anamelen;
2861 syscallarg(const netbsd32_sigsetp_t) mask; 2662 syscallarg(const netbsd32_sigsetp_t) mask;
2862 syscallarg(int) flags; 2663 syscallarg(int) flags;
2863 } */ 2664 } */
2864 struct sys_paccept_args ua; 2665 struct sys_paccept_args ua;
2865 2666
2866 NETBSD32TO64_UAP(s); 2667 NETBSD32TO64_UAP(s);
2867 NETBSD32TOP_UAP(name, struct sockaddr *); 2668 NETBSD32TOP_UAP(name, struct sockaddr *);
2868 NETBSD32TOP_UAP(anamelen, socklen_t *); 2669 NETBSD32TOP_UAP(anamelen, socklen_t *);
2869 NETBSD32TOP_UAP(mask, const sigset_t *); 2670 NETBSD32TOP_UAP(mask, const sigset_t *);
2870 NETBSD32TO64_UAP(flags); 2671 NETBSD32TO64_UAP(flags);
2871 2672
2872 return sys_paccept(l, &ua, retval); 2673 return sys_paccept(l, &ua, retval);
2873} 2674}
2874 2675
2875int 2676int
2876netbsd32_fdiscard(struct lwp *l, const struct netbsd32_fdiscard_args *uap, 2677netbsd32_fdiscard(struct lwp *l, const struct netbsd32_fdiscard_args *uap,
2877 register_t *retval) 2678 register_t *retval)
2878{ 2679{
2879 /* { 2680 /* {
2880 syscallarg(int) fd; 2681 syscallarg(int) fd;
2881 syscallarg(netbsd32_off_t) pos; 2682 syscallarg(netbsd32_off_t) pos;
2882 syscallarg(netbsd32_off_t) len; 2683 syscallarg(netbsd32_off_t) len;
2883 } */ 2684 } */
2884 struct sys_fdiscard_args ua; 2685 struct sys_fdiscard_args ua;
2885 2686
2886 NETBSD32TO64_UAP(fd); 2687 NETBSD32TO64_UAP(fd);
2887 NETBSD32TO64_UAP(pos); 2688 NETBSD32TO64_UAP(pos);
2888 NETBSD32TO64_UAP(len); 2689 NETBSD32TO64_UAP(len);
2889 2690
2890 return sys_fdiscard(l, &ua, retval); 2691 return sys_fdiscard(l, &ua, retval);
2891} 2692}
2892 2693
2893int 2694int
2894netbsd32_posix_fallocate(struct lwp *l, const struct netbsd32_posix_fallocate_args *uap, 2695netbsd32_posix_fallocate(struct lwp *l, const struct netbsd32_posix_fallocate_args *uap,
2895 register_t *retval) 2696 register_t *retval)
2896{ 2697{
2897 /* { 2698 /* {
2898 syscallarg(int) fd; 2699 syscallarg(int) fd;
2899 syscallarg(netbsd32_off_t) pos; 2700 syscallarg(netbsd32_off_t) pos;
2900 syscallarg(netbsd32_off_t) len; 2701 syscallarg(netbsd32_off_t) len;
2901 } */ 2702 } */
2902 struct sys_posix_fallocate_args ua; 2703 struct sys_posix_fallocate_args ua;
2903 2704
2904 NETBSD32TO64_UAP(fd); 2705 NETBSD32TO64_UAP(fd);
2905 NETBSD32TO64_UAP(pos); 2706 NETBSD32TO64_UAP(pos);
2906 NETBSD32TO64_UAP(len); 2707 NETBSD32TO64_UAP(len);
2907 2708
2908 return sys_posix_fallocate(l, &ua, retval); 2709 return sys_posix_fallocate(l, &ua, retval);
2909} 2710}
2910 2711
2911int 2712int
2912netbsd32_pset_create(struct lwp *l, 2713netbsd32_pset_create(struct lwp *l,
2913 const struct netbsd32_pset_create_args *uap, register_t *retval) 2714 const struct netbsd32_pset_create_args *uap, register_t *retval)
2914{ 2715{
2915 /* { 2716 /* {
2916 syscallarg(netbsd32_psetidp_t) psid; 2717 syscallarg(netbsd32_psetidp_t) psid;
2917 }; */ 2718 }; */
2918 struct sys_pset_create_args ua; 2719 struct sys_pset_create_args ua;
2919 2720
2920 NETBSD32TOP_UAP(psid, psetid_t); 2721 NETBSD32TOP_UAP(psid, psetid_t);
2921 2722
2922 return sys_pset_create(l, &ua, retval); 2723 return sys_pset_create(l, &ua, retval);
2923} 2724}
2924 2725
2925int 2726int
2926netbsd32_pset_destroy(struct lwp *l, 2727netbsd32_pset_destroy(struct lwp *l,
2927 const struct netbsd32_pset_destroy_args *uap, register_t *retval) 2728 const struct netbsd32_pset_destroy_args *uap, register_t *retval)
2928{ 2729{
2929 /* { 2730 /* {
2930 syscallarg(psetid_t) psid; 2731 syscallarg(psetid_t) psid;
2931 }; */ 2732 }; */
2932 2733
2933 return sys_pset_destroy(l, (const void *)uap, retval); 2734 return sys_pset_destroy(l, (const void *)uap, retval);
2934} 2735}
2935 2736
2936int 2737int
2937netbsd32_pset_assign(struct lwp *l, 2738netbsd32_pset_assign(struct lwp *l,
2938 const struct netbsd32_pset_assign_args *uap, register_t *retval) 2739 const struct netbsd32_pset_assign_args *uap, register_t *retval)
2939{ 2740{
2940 /* { 2741 /* {
2941 syscallarg(psetid_t) psid; 2742 syscallarg(psetid_t) psid;
2942 syscallarg(cpuid_t) cpuid; 2743 syscallarg(cpuid_t) cpuid;
2943 syscallarg(netbsd32_psetidp_t) opsid; 2744 syscallarg(netbsd32_psetidp_t) opsid;
2944 }; */ 2745 }; */
2945 struct sys_pset_assign_args ua; 2746 struct sys_pset_assign_args ua;
2946 2747
2947 SCARG(&ua, psid) = SCARG(uap, psid); 2748 SCARG(&ua, psid) = SCARG(uap, psid);
2948 NETBSD32TO64_UAP(cpuid); 2749 NETBSD32TO64_UAP(cpuid);
2949 NETBSD32TOP_UAP(opsid, psetid_t); 2750 NETBSD32TOP_UAP(opsid, psetid_t);
2950 2751
2951 return sys_pset_assign(l, &ua, retval); 2752 return sys_pset_assign(l, &ua, retval);
2952} 2753}
2953 2754
2954int 2755int
2955netbsd32__pset_bind(struct lwp *l, 2756netbsd32__pset_bind(struct lwp *l,
2956 const struct netbsd32__pset_bind_args *uap, register_t *retval) 2757 const struct netbsd32__pset_bind_args *uap, register_t *retval)
2957{ 2758{
2958 /* { 2759 /* {
2959 syscallarg(idtype_t) idtype; 2760 syscallarg(idtype_t) idtype;
2960 syscallarg(id_t) first_id; 2761 syscallarg(id_t) first_id;
2961 syscallarg(id_t) second_id; 2762 syscallarg(id_t) second_id;
2962 syscallarg(psetid_t) psid; 2763 syscallarg(psetid_t) psid;
2963 syscallarg(netbsd32_psetidp_t) opsid; 2764 syscallarg(netbsd32_psetidp_t) opsid;
2964 }; */ 2765 }; */
2965 struct sys__pset_bind_args ua; 2766 struct sys__pset_bind_args ua;
2966 2767
2967 SCARG(&ua, idtype) = SCARG(uap, idtype); 2768 SCARG(&ua, idtype) = SCARG(uap, idtype);
2968 SCARG(&ua, first_id) = SCARG(uap, first_id); 2769 SCARG(&ua, first_id) = SCARG(uap, first_id);
2969 SCARG(&ua, second_id) = SCARG(uap, second_id); 2770 SCARG(&ua, second_id) = SCARG(uap, second_id);
2970 SCARG(&ua, psid) = SCARG(uap, psid); 2771 SCARG(&ua, psid) = SCARG(uap, psid);
2971 NETBSD32TOP_UAP(opsid, psetid_t); 2772 NETBSD32TOP_UAP(opsid, psetid_t);
2972 2773
2973 return sys__pset_bind(l, &ua, retval); 2774 return sys__pset_bind(l, &ua, retval);
2974} 2775}
2975 2776
2976 2777
2977/* 2778/*
2978 * MI indirect system call support. 2779 * MI indirect system call support.
2979 * Only used if the MD netbsd32_syscall.c doesn't intercept the calls. 2780 * Only used if the MD netbsd32_syscall.c doesn't intercept the calls.
2980 */ 2781 */
2981 2782
2982#define NETBSD32_SYSCALL 2783#define NETBSD32_SYSCALL
2983#undef SYS_NSYSENT 2784#undef SYS_NSYSENT
2984#define SYS_NSYSENT NETBSD32_SYS_NSYSENT 2785#define SYS_NSYSENT NETBSD32_SYS_NSYSENT
2985 2786
2986#define SYS_SYSCALL netbsd32_syscall 2787#define SYS_SYSCALL netbsd32_syscall
2987#include "../../kern/sys_syscall.c" 2788#include "../../kern/sys_syscall.c"
2988#undef SYS_SYSCALL 2789#undef SYS_SYSCALL
2989 2790
2990#define SYS_SYSCALL netbsd32____syscall 2791#define SYS_SYSCALL netbsd32____syscall
2991#include "../../kern/sys_syscall.c" 2792#include "../../kern/sys_syscall.c"
2992#undef SYS_SYSCALL 2793#undef SYS_SYSCALL

File Added: src/sys/compat/netbsd32/netbsd32_quota.c
/*	$NetBSD: netbsd32_quota.c,v 1.1 2018/12/24 20:44:39 mrg Exp $	*/

/*
 * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * from: NetBSD: netbsd32_netbsd.c,v 1.218 2018/08/10 21:44:58 pgoyette Exp
 */

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_quota.c,v 1.1 2018/12/24 20:44:39 mrg Exp $");

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/quotactl.h>
#include <sys/filedesc.h>
#include <sys/vfs_syscalls.h>

#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>

int
netbsd32___quotactl(struct lwp *l, const struct netbsd32___quotactl_args *uap, register_t *retval)
{
	/* {
		syscallarg(const netbsd32_charp) path;
		syscallarg(netbsd32_voidp) args;
	} */
	struct netbsd32_quotactlargs args32;
	struct quotactl_args args;
	int error;

	error = copyin(SCARG_P32(uap, args), &args32, sizeof(args32));
	if (error) {
		return error;
	}

	args.qc_op = args32.qc_op;
	switch (args.qc_op) {
	    case QUOTACTL_STAT:
		args.u.stat.qc_info = NETBSD32PTR64(args32.u.stat.qc_info);
		break;
	    case QUOTACTL_IDTYPESTAT:
		args.u.idtypestat.qc_idtype = args32.u.idtypestat.qc_idtype;
		args.u.idtypestat.qc_info =
			NETBSD32PTR64(args32.u.idtypestat.qc_info);
		break;
	    case QUOTACTL_OBJTYPESTAT:
		args.u.objtypestat.qc_objtype =
			args32.u.objtypestat.qc_objtype;
		args.u.objtypestat.qc_info =
			NETBSD32PTR64(args32.u.objtypestat.qc_info);
		break;
	    case QUOTACTL_GET:
		args.u.get.qc_key = NETBSD32PTR64(args32.u.get.qc_key);
		args.u.get.qc_val = NETBSD32PTR64(args32.u.get.qc_val);
		break;
	    case QUOTACTL_PUT:
		args.u.put.qc_key = NETBSD32PTR64(args32.u.put.qc_key);
		args.u.put.qc_val = NETBSD32PTR64(args32.u.put.qc_val);
		break;
	    case QUOTACTL_DEL:
		args.u.del.qc_key = NETBSD32PTR64(args32.u.del.qc_key);
		break;
	    case QUOTACTL_CURSOROPEN:
		args.u.cursoropen.qc_cursor =
			NETBSD32PTR64(args32.u.cursoropen.qc_cursor);
		break;
	    case QUOTACTL_CURSORCLOSE:
		args.u.cursorclose.qc_cursor =
			NETBSD32PTR64(args32.u.cursorclose.qc_cursor);
		break;
	    case QUOTACTL_CURSORSKIPIDTYPE:
		args.u.cursorskipidtype.qc_cursor =
			NETBSD32PTR64(args32.u.cursorskipidtype.qc_cursor);
		args.u.cursorskipidtype.qc_idtype =
			args32.u.cursorskipidtype.qc_idtype;
		break;
	    case QUOTACTL_CURSORGET:
		args.u.cursorget.qc_cursor =
			NETBSD32PTR64(args32.u.cursorget.qc_cursor);
		args.u.cursorget.qc_keys =
			NETBSD32PTR64(args32.u.cursorget.qc_keys);
		args.u.cursorget.qc_vals =
			NETBSD32PTR64(args32.u.cursorget.qc_vals);
		args.u.cursorget.qc_maxnum =
			args32.u.cursorget.qc_maxnum;
		args.u.cursorget.qc_ret =
			NETBSD32PTR64(args32.u.cursorget.qc_ret);
		break;
	    case QUOTACTL_CURSORATEND:
		args.u.cursoratend.qc_cursor =
			NETBSD32PTR64(args32.u.cursoratend.qc_cursor);
		args.u.cursoratend.qc_ret =
			NETBSD32PTR64(args32.u.cursoratend.qc_ret);
		break;
	    case QUOTACTL_CURSORREWIND:
		args.u.cursorrewind.qc_cursor =
			NETBSD32PTR64(args32.u.cursorrewind.qc_cursor);
		break;
	    case QUOTACTL_QUOTAON:
		args.u.quotaon.qc_idtype = args32.u.quotaon.qc_idtype;
		args.u.quotaon.qc_quotafile =
			NETBSD32PTR64(args32.u.quotaon.qc_quotafile);
		break;
	    case QUOTACTL_QUOTAOFF:
		args.u.quotaoff.qc_idtype = args32.u.quotaoff.qc_idtype;
		break;
	    default:
		return EINVAL;
	}

	return do_sys_quotactl(SCARG_P32(uap, path), &args);
}

File Added: src/sys/compat/netbsd32/netbsd32_rlimit.c
/*	$NetBSD: netbsd32_rlimit.c,v 1.1 2018/12/24 20:44:39 mrg Exp $	*/

/*
 * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * from: NetBSD: netbsd32_netbsd.c,v 1.218 2018/08/10 21:44:58 pgoyette Exp
 */

/* rlimit netbsd32 related code */

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_rlimit.c,v 1.1 2018/12/24 20:44:39 mrg Exp $");

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/resource.h>
#include <sys/exec.h>

#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>

#define LIMITCHECK(a, b) ((a) != RLIM_INFINITY && (a) > (b))

static void
fixlimit(int which, struct rlimit *alim)
{
	switch (which) {
	case RLIMIT_DATA:
		if (LIMITCHECK(alim->rlim_cur, MAXDSIZ32))
			alim->rlim_cur = MAXDSIZ32;
		if (LIMITCHECK(alim->rlim_max, MAXDSIZ32))
			alim->rlim_max = MAXDSIZ32;
		return;
	case RLIMIT_STACK:
		if (LIMITCHECK(alim->rlim_cur, MAXSSIZ32))
			alim->rlim_cur = MAXSSIZ32;
		if (LIMITCHECK(alim->rlim_max, MAXSSIZ32))
			alim->rlim_max = MAXSSIZ32;
		return;
	default:
		return;
	}
}

int
netbsd32_getrlimit(struct lwp *l, const struct netbsd32_getrlimit_args *uap,
    register_t *retval)
{
	/* {
		syscallarg(int) which;
		syscallarg(netbsd32_rlimitp_t) rlp;
	} */
	int which = SCARG(uap, which);
	struct rlimit alim;

	if ((u_int)which >= RLIM_NLIMITS)
		return EINVAL;

	alim = l->l_proc->p_rlimit[which];

	fixlimit(which, &alim);

	return copyout(&alim, SCARG_P32(uap, rlp), sizeof(alim));
}

int
netbsd32_setrlimit(struct lwp *l, const struct netbsd32_setrlimit_args *uap,
    register_t *retval)
{
	/* {
		syscallarg(int) which;
		syscallarg(const netbsd32_rlimitp_t) rlp;
	} */
		int which = SCARG(uap, which);
	struct rlimit alim;
	int error;

	if ((u_int)which >= RLIM_NLIMITS)
		return EINVAL;

	error = copyin(SCARG_P32(uap, rlp), &alim, sizeof(struct rlimit));
	if (error)
		return (error);

	fixlimit(which, &alim);

	return dosetrlimit(l, l->l_proc, which, &alim);
}

void
netbsd32_adjust_limits(struct proc *p)
{
	static const struct {
		int id;
		rlim_t lim;
	} lm[] = {
		{ RLIMIT_DATA,	MAXDSIZ32 },
		{ RLIMIT_STACK, MAXSSIZ32 },
	};
	size_t i;
	struct plimit *lim;
	struct rlimit *rlim;

	/*
	 * We can only reduce the current limits, we cannot stop external
	 * processes from changing them (eg via sysctl) later on.
	 * So there is no point trying to lock out such changes here.
	 *
	 * If we assume that rlim_cur/max are accessed using atomic
	 * operations, we don't need to lock against any other updates
	 * that might happen if the plimit structure is shared writable
	 * between multiple processes.
	 */

	/* Scan to determine is any limits are out of range */
	lim = p->p_limit;
	for (i = 0; ; i++) {
		if (i >= __arraycount(lm))
			/* All in range */
			return;
		rlim = lim->pl_rlimit + lm[i].id;
		if (LIMITCHECK(rlim->rlim_cur, lm[i].lim))
			break;
		if (LIMITCHECK(rlim->rlim_max, lm[i].lim))
			break;
	}

	lim_privatise(p);

	lim = p->p_limit;
	for (i = 0; i < __arraycount(lm); i++) {
		rlim = lim->pl_rlimit + lm[i].id;
		if (LIMITCHECK(rlim->rlim_cur, lm[i].lim))
			rlim->rlim_cur = lm[i].lim;
		if (LIMITCHECK(rlim->rlim_max, lm[i].lim))
			rlim->rlim_max = lm[i].lim;
	}
}