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