netbsd32_netbsd.c revision 1.93 1 /* $NetBSD: netbsd32_netbsd.c,v 1.93 2005/07/10 11:28:58 cube Exp $ */
2
3 /*
4 * Copyright (c) 1998, 2001 Matthew R. Green
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31 #include <sys/cdefs.h>
32 __KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.93 2005/07/10 11:28:58 cube Exp $");
33
34 #if defined(_KERNEL_OPT)
35 #include "opt_ddb.h"
36 #include "opt_ktrace.h"
37 #include "opt_ntp.h"
38 #include "opt_compat_netbsd.h"
39 #include "opt_compat_43.h"
40 #include "opt_sysv.h"
41 #include "opt_nfsserver.h"
42 #include "opt_syscall_debug.h"
43
44 #include "fs_lfs.h"
45 #include "fs_nfs.h"
46 #endif
47
48 /*
49 * Though COMPAT_OLDSOCK is needed only for COMPAT_43, SunOS, Linux,
50 * HP-UX, FreeBSD, Ultrix, OSF1, we define it unconditionally so that
51 * this would be LKM-safe.
52 */
53 #define COMPAT_OLDSOCK /* used by <sys/socket.h> */
54
55 #include <sys/param.h>
56 #include <sys/systm.h>
57 #include <sys/kernel.h>
58 //#define msg __msg /* Don't ask me! */
59 #include <sys/malloc.h>
60 #include <sys/mount.h>
61 #include <sys/socket.h>
62 #include <sys/sockio.h>
63 #include <sys/socketvar.h>
64 #include <sys/mbuf.h>
65 #include <sys/stat.h>
66 #include <sys/time.h>
67 #include <sys/signalvar.h>
68 #include <sys/ptrace.h>
69 #include <sys/ktrace.h>
70 #include <sys/trace.h>
71 #include <sys/resourcevar.h>
72 #include <sys/pool.h>
73 #include <sys/vnode.h>
74 #include <sys/file.h>
75 #include <sys/filedesc.h>
76 #include <sys/namei.h>
77
78 #include <uvm/uvm_extern.h>
79
80 #include <sys/sa.h>
81 #include <sys/syscallargs.h>
82 #include <sys/proc.h>
83 #include <sys/acct.h>
84 #include <sys/exec.h>
85
86 #include <net/if.h>
87
88 #include <compat/netbsd32/netbsd32.h>
89 #include <compat/netbsd32/netbsd32_exec.h>
90 #include <compat/netbsd32/netbsd32_syscall.h>
91 #include <compat/netbsd32/netbsd32_syscallargs.h>
92 #include <compat/netbsd32/netbsd32_conv.h>
93
94 #include <machine/frame.h>
95
96 #if defined(DDB)
97 #include <ddb/ddbvar.h>
98 #endif
99
100 extern struct sysent netbsd32_sysent[];
101 #ifdef SYSCALL_DEBUG
102 extern const char * const netbsd32_syscallnames[];
103 #endif
104 #ifdef __HAVE_SYSCALL_INTERN
105 void netbsd32_syscall_intern __P((struct proc *));
106 #else
107 void syscall __P((void));
108 #endif
109
110 #ifdef COMPAT_16
111 extern char netbsd32_sigcode[], netbsd32_esigcode[];
112 struct uvm_object *emul_netbsd32_object;
113 #endif
114
115 extern struct sysctlnode netbsd32_sysctl_root;
116
117 const struct emul emul_netbsd32 = {
118 "netbsd32",
119 "/emul/netbsd32",
120 #ifndef __HAVE_MINIMAL_EMUL
121 0,
122 NULL,
123 netbsd32_SYS_syscall,
124 netbsd32_SYS_NSYSENT,
125 #endif
126 netbsd32_sysent,
127 #ifdef SYSCALL_DEBUG
128 netbsd32_syscallnames,
129 #else
130 NULL,
131 #endif
132 netbsd32_sendsig,
133 trapsignal,
134 NULL,
135 #ifdef COMPAT_16
136 netbsd32_sigcode,
137 netbsd32_esigcode,
138 &emul_netbsd32_object,
139 #else
140 NULL,
141 NULL,
142 NULL,
143 #endif
144 netbsd32_setregs,
145 NULL,
146 NULL,
147 NULL,
148 NULL,
149 NULL,
150 #ifdef __HAVE_SYSCALL_INTERN
151 netbsd32_syscall_intern,
152 #else
153 syscall,
154 #endif
155 &netbsd32_sysctl_root,
156 NULL,
157
158 netbsd32_vm_default_addr,
159 };
160
161 /*
162 * below are all the standard NetBSD system calls, in the 32bit
163 * environment, with the necessary conversions to 64bit before
164 * calling the real syscall. anything that needs special
165 * attention is handled elsewhere.
166 */
167
168 int
169 netbsd32_exit(l, v, retval)
170 struct lwp *l;
171 void *v;
172 register_t *retval;
173 {
174 struct netbsd32_exit_args /* {
175 syscallarg(int) rval;
176 } */ *uap = v;
177 struct sys_exit_args ua;
178
179 NETBSD32TO64_UAP(rval);
180 return sys_exit(l, &ua, retval);
181 }
182
183 int
184 netbsd32_read(l, v, retval)
185 struct lwp *l;
186 void *v;
187 register_t *retval;
188 {
189 struct netbsd32_read_args /* {
190 syscallarg(int) fd;
191 syscallarg(netbsd32_voidp) buf;
192 syscallarg(netbsd32_size_t) nbyte;
193 } */ *uap = v;
194 struct sys_read_args ua;
195
196 NETBSD32TO64_UAP(fd);
197 NETBSD32TOP_UAP(buf, void *);
198 NETBSD32TOX_UAP(nbyte, size_t);
199 return sys_read(l, &ua, retval);
200 }
201
202 int
203 netbsd32_write(l, v, retval)
204 struct lwp *l;
205 void *v;
206 register_t *retval;
207 {
208 struct netbsd32_write_args /* {
209 syscallarg(int) fd;
210 syscallarg(const netbsd32_voidp) buf;
211 syscallarg(netbsd32_size_t) nbyte;
212 } */ *uap = v;
213 struct sys_write_args ua;
214
215 NETBSD32TO64_UAP(fd);
216 NETBSD32TOP_UAP(buf, void *);
217 NETBSD32TOX_UAP(nbyte, size_t);
218 return sys_write(l, &ua, retval);
219 }
220
221 int
222 netbsd32_close(l, v, retval)
223 struct lwp *l;
224 void *v;
225 register_t *retval;
226 {
227 struct netbsd32_close_args /* {
228 syscallarg(int) fd;
229 } */ *uap = v;
230 struct sys_close_args ua;
231
232 NETBSD32TO64_UAP(fd);
233 return sys_close(l, &ua, retval);
234 }
235
236 int
237 netbsd32_open(l, v, retval)
238 struct lwp *l;
239 void *v;
240 register_t *retval;
241 {
242 struct netbsd32_open_args /* {
243 syscallarg(const netbsd32_charp) path;
244 syscallarg(int) flags;
245 syscallarg(mode_t) mode;
246 } */ *uap = v;
247 struct sys_open_args ua;
248 caddr_t sg;
249
250 NETBSD32TOP_UAP(path, const char);
251 NETBSD32TO64_UAP(flags);
252 NETBSD32TO64_UAP(mode);
253 sg = stackgap_init(l->l_proc, 0);
254 CHECK_ALT_EXIST(l->l_proc, &sg, SCARG(&ua, path));
255
256 return (sys_open(l, &ua, retval));
257 }
258
259 int
260 netbsd32_link(l, v, retval)
261 struct lwp *l;
262 void *v;
263 register_t *retval;
264 {
265 struct netbsd32_link_args /* {
266 syscallarg(const netbsd32_charp) path;
267 syscallarg(const netbsd32_charp) link;
268 } */ *uap = v;
269 struct sys_link_args ua;
270
271 NETBSD32TOP_UAP(path, const char);
272 NETBSD32TOP_UAP(link, const char);
273 return (sys_link(l, &ua, retval));
274 }
275
276 int
277 netbsd32_unlink(l, v, retval)
278 struct lwp *l;
279 void *v;
280 register_t *retval;
281 {
282 struct netbsd32_unlink_args /* {
283 syscallarg(const netbsd32_charp) path;
284 } */ *uap = v;
285 struct sys_unlink_args ua;
286
287 NETBSD32TOP_UAP(path, const char);
288
289 return (sys_unlink(l, &ua, retval));
290 }
291
292 int
293 netbsd32_chdir(l, v, retval)
294 struct lwp *l;
295 void *v;
296 register_t *retval;
297 {
298 struct netbsd32_chdir_args /* {
299 syscallarg(const netbsd32_charp) path;
300 } */ *uap = v;
301 struct sys_chdir_args ua;
302
303 NETBSD32TOP_UAP(path, const char);
304
305 return (sys_chdir(l, &ua, retval));
306 }
307
308 int
309 netbsd32_fchdir(l, v, retval)
310 struct lwp *l;
311 void *v;
312 register_t *retval;
313 {
314 struct netbsd32_fchdir_args /* {
315 syscallarg(int) fd;
316 } */ *uap = v;
317 struct sys_fchdir_args ua;
318
319 NETBSD32TO64_UAP(fd);
320
321 return (sys_fchdir(l, &ua, retval));
322 }
323
324 int
325 netbsd32_mknod(l, v, retval)
326 struct lwp *l;
327 void *v;
328 register_t *retval;
329 {
330 struct netbsd32_mknod_args /* {
331 syscallarg(const netbsd32_charp) path;
332 syscallarg(mode_t) mode;
333 syscallarg(dev_t) dev;
334 } */ *uap = v;
335 struct sys_mknod_args ua;
336
337 NETBSD32TOP_UAP(path, const char);
338 NETBSD32TO64_UAP(dev);
339 NETBSD32TO64_UAP(mode);
340
341 return (sys_mknod(l, &ua, retval));
342 }
343
344 int
345 netbsd32_chmod(l, v, retval)
346 struct lwp *l;
347 void *v;
348 register_t *retval;
349 {
350 struct netbsd32_chmod_args /* {
351 syscallarg(const netbsd32_charp) path;
352 syscallarg(mode_t) mode;
353 } */ *uap = v;
354 struct sys_chmod_args ua;
355
356 NETBSD32TOP_UAP(path, const char);
357 NETBSD32TO64_UAP(mode);
358
359 return (sys_chmod(l, &ua, retval));
360 }
361
362 int
363 netbsd32_chown(l, v, retval)
364 struct lwp *l;
365 void *v;
366 register_t *retval;
367 {
368 struct netbsd32_chown_args /* {
369 syscallarg(const netbsd32_charp) path;
370 syscallarg(uid_t) uid;
371 syscallarg(gid_t) gid;
372 } */ *uap = v;
373 struct sys_chown_args ua;
374
375 NETBSD32TOP_UAP(path, const char);
376 NETBSD32TO64_UAP(uid);
377 NETBSD32TO64_UAP(gid);
378
379 return (sys_chown(l, &ua, retval));
380 }
381
382 int
383 netbsd32_break(l, v, retval)
384 struct lwp *l;
385 void *v;
386 register_t *retval;
387 {
388 struct netbsd32_break_args /* {
389 syscallarg(netbsd32_charp) nsize;
390 } */ *uap = v;
391 struct sys_obreak_args ua;
392
393 SCARG(&ua, nsize) = (char *)NETBSD32PTR64(SCARG(uap, nsize));
394 NETBSD32TOP_UAP(nsize, char);
395 return (sys_obreak(l, &ua, retval));
396 }
397
398 int
399 netbsd32_mount(l, v, retval)
400 struct lwp *l;
401 void *v;
402 register_t *retval;
403 {
404 struct netbsd32_mount_args /* {
405 syscallarg(const netbsd32_charp) type;
406 syscallarg(const netbsd32_charp) path;
407 syscallarg(int) flags;
408 syscallarg(netbsd32_voidp) data;
409 } */ *uap = v;
410 struct sys_mount_args ua;
411
412 NETBSD32TOP_UAP(type, const char);
413 NETBSD32TOP_UAP(path, const char);
414 NETBSD32TO64_UAP(flags);
415 NETBSD32TOP_UAP(data, void);
416 return (sys_mount(l, &ua, retval));
417 }
418
419 int
420 netbsd32_unmount(l, v, retval)
421 struct lwp *l;
422 void *v;
423 register_t *retval;
424 {
425 struct netbsd32_unmount_args /* {
426 syscallarg(const netbsd32_charp) path;
427 syscallarg(int) flags;
428 } */ *uap = v;
429 struct sys_unmount_args ua;
430
431 NETBSD32TOP_UAP(path, const char);
432 NETBSD32TO64_UAP(flags);
433 return (sys_unmount(l, &ua, retval));
434 }
435
436 int
437 netbsd32_setuid(l, v, retval)
438 struct lwp *l;
439 void *v;
440 register_t *retval;
441 {
442 struct netbsd32_setuid_args /* {
443 syscallarg(uid_t) uid;
444 } */ *uap = v;
445 struct sys_setuid_args ua;
446
447 NETBSD32TO64_UAP(uid);
448 return (sys_setuid(l, &ua, retval));
449 }
450
451 int
452 netbsd32_ptrace(l, v, retval)
453 struct lwp *l;
454 void *v;
455 register_t *retval;
456 {
457 struct netbsd32_ptrace_args /* {
458 syscallarg(int) req;
459 syscallarg(pid_t) pid;
460 syscallarg(netbsd32_caddr_t) addr;
461 syscallarg(int) data;
462 } */ *uap = v;
463 struct sys_ptrace_args ua;
464
465 NETBSD32TO64_UAP(req);
466 NETBSD32TO64_UAP(pid);
467 NETBSD32TOX64_UAP(addr, caddr_t);
468 NETBSD32TO64_UAP(data);
469 return (sys_ptrace(l, &ua, retval));
470 }
471
472 int
473 netbsd32_accept(l, v, retval)
474 struct lwp *l;
475 void *v;
476 register_t *retval;
477 {
478 struct netbsd32_accept_args /* {
479 syscallarg(int) s;
480 syscallarg(netbsd32_sockaddrp_t) name;
481 syscallarg(netbsd32_intp) anamelen;
482 } */ *uap = v;
483 struct sys_accept_args ua;
484
485 NETBSD32TO64_UAP(s);
486 NETBSD32TOP_UAP(name, struct sockaddr);
487 NETBSD32TOP_UAP(anamelen, int);
488 return (sys_accept(l, &ua, retval));
489 }
490
491 int
492 netbsd32_getpeername(l, v, retval)
493 struct lwp *l;
494 void *v;
495 register_t *retval;
496 {
497 struct netbsd32_getpeername_args /* {
498 syscallarg(int) fdes;
499 syscallarg(netbsd32_sockaddrp_t) asa;
500 syscallarg(netbsd32_intp) alen;
501 } */ *uap = v;
502 struct sys_getpeername_args ua;
503
504 NETBSD32TO64_UAP(fdes);
505 NETBSD32TOP_UAP(asa, struct sockaddr);
506 NETBSD32TOP_UAP(alen, int);
507 /* NB: do the protocol specific sockaddrs need to be converted? */
508 return (sys_getpeername(l, &ua, retval));
509 }
510
511 int
512 netbsd32_getsockname(l, v, retval)
513 struct lwp *l;
514 void *v;
515 register_t *retval;
516 {
517 struct netbsd32_getsockname_args /* {
518 syscallarg(int) fdes;
519 syscallarg(netbsd32_sockaddrp_t) asa;
520 syscallarg(netbsd32_intp) alen;
521 } */ *uap = v;
522 struct sys_getsockname_args ua;
523
524 NETBSD32TO64_UAP(fdes);
525 NETBSD32TOP_UAP(asa, struct sockaddr);
526 NETBSD32TOP_UAP(alen, int);
527 return (sys_getsockname(l, &ua, retval));
528 }
529
530 int
531 netbsd32_access(l, v, retval)
532 struct lwp *l;
533 void *v;
534 register_t *retval;
535 {
536 struct netbsd32_access_args /* {
537 syscallarg(const netbsd32_charp) path;
538 syscallarg(int) flags;
539 } */ *uap = v;
540 struct sys_access_args ua;
541 caddr_t sg;
542
543 NETBSD32TOP_UAP(path, const char);
544 NETBSD32TO64_UAP(flags);
545 sg = stackgap_init(l->l_proc, 0);
546 CHECK_ALT_EXIST(l->l_proc, &sg, SCARG(&ua, path));
547
548 return (sys_access(l, &ua, retval));
549 }
550
551 int
552 netbsd32_chflags(l, v, retval)
553 struct lwp *l;
554 void *v;
555 register_t *retval;
556 {
557 struct netbsd32_chflags_args /* {
558 syscallarg(const netbsd32_charp) path;
559 syscallarg(netbsd32_u_long) flags;
560 } */ *uap = v;
561 struct sys_chflags_args ua;
562
563 NETBSD32TOP_UAP(path, const char);
564 NETBSD32TO64_UAP(flags);
565
566 return (sys_chflags(l, &ua, retval));
567 }
568
569 int
570 netbsd32_fchflags(l, v, retval)
571 struct lwp *l;
572 void *v;
573 register_t *retval;
574 {
575 struct netbsd32_fchflags_args /* {
576 syscallarg(int) fd;
577 syscallarg(netbsd32_u_long) flags;
578 } */ *uap = v;
579 struct sys_fchflags_args ua;
580
581 NETBSD32TO64_UAP(fd);
582 NETBSD32TO64_UAP(flags);
583
584 return (sys_fchflags(l, &ua, retval));
585 }
586
587 int
588 netbsd32_lchflags(l, v, retval)
589 struct lwp *l;
590 void *v;
591 register_t *retval;
592 {
593 struct netbsd32_lchflags_args /* {
594 syscallarg(const char *) path;
595 syscallarg(netbsd32_u_long) flags;
596 } */ *uap = v;
597 struct sys_lchflags_args ua;
598
599 NETBSD32TOP_UAP(path, const char);
600 NETBSD32TO64_UAP(flags);
601
602 return (sys_lchflags(l, &ua, retval));
603 }
604
605 int
606 netbsd32_kill(l, v, retval)
607 struct lwp *l;
608 void *v;
609 register_t *retval;
610 {
611 struct netbsd32_kill_args /* {
612 syscallarg(int) pid;
613 syscallarg(int) signum;
614 } */ *uap = v;
615 struct sys_kill_args ua;
616
617 NETBSD32TO64_UAP(pid);
618 NETBSD32TO64_UAP(signum);
619
620 return (sys_kill(l, &ua, retval));
621 }
622
623 int
624 netbsd32_dup(l, v, retval)
625 struct lwp *l;
626 void *v;
627 register_t *retval;
628 {
629 struct netbsd32_dup_args /* {
630 syscallarg(int) fd;
631 } */ *uap = v;
632 struct sys_dup_args ua;
633
634 NETBSD32TO64_UAP(fd);
635
636 return (sys_dup(l, &ua, retval));
637 }
638
639 int
640 netbsd32_profil(l, v, retval)
641 struct lwp *l;
642 void *v;
643 register_t *retval;
644 {
645 struct netbsd32_profil_args /* {
646 syscallarg(netbsd32_caddr_t) samples;
647 syscallarg(netbsd32_size_t) size;
648 syscallarg(netbsd32_u_long) offset;
649 syscallarg(u_int) scale;
650 } */ *uap = v;
651 struct sys_profil_args ua;
652
653 NETBSD32TOX64_UAP(samples, caddr_t);
654 NETBSD32TOX_UAP(size, size_t);
655 NETBSD32TOX_UAP(offset, u_long);
656 NETBSD32TO64_UAP(scale);
657 return (sys_profil(l, &ua, retval));
658 }
659
660 #ifdef KTRACE
661 int
662 netbsd32_ktrace(l, v, retval)
663 struct lwp *l;
664 void *v;
665 register_t *retval;
666 {
667 struct netbsd32_ktrace_args /* {
668 syscallarg(const netbsd32_charp) fname;
669 syscallarg(int) ops;
670 syscallarg(int) facs;
671 syscallarg(int) pid;
672 } */ *uap = v;
673 struct sys_ktrace_args ua;
674
675 NETBSD32TOP_UAP(fname, const char);
676 NETBSD32TO64_UAP(ops);
677 NETBSD32TO64_UAP(facs);
678 NETBSD32TO64_UAP(pid);
679 return (sys_ktrace(l, &ua, retval));
680 }
681 #endif /* KTRACE */
682
683 int
684 netbsd32_utrace(l, v, retval)
685 struct lwp *l;
686 void *v;
687 register_t *retval;
688 {
689 struct netbsd32_utrace_args /* {
690 syscallarg(const netbsd32_charp) label;
691 syscallarg(netbsd32_voidp) addr;
692 syscallarg(netbsd32_size_t) len;
693 } */ *uap = v;
694 struct sys_utrace_args ua;
695
696 NETBSD32TOP_UAP(label, const char);
697 NETBSD32TOP_UAP(addr, void);
698 NETBSD32TO64_UAP(len);
699 return (sys_utrace(l, &ua, retval));
700 }
701
702 int
703 netbsd32___getlogin(l, v, retval)
704 struct lwp *l;
705 void *v;
706 register_t *retval;
707 {
708 struct netbsd32___getlogin_args /* {
709 syscallarg(netbsd32_charp) namebuf;
710 syscallarg(u_int) namelen;
711 } */ *uap = v;
712 struct sys___getlogin_args ua;
713
714 NETBSD32TOP_UAP(namebuf, char);
715 NETBSD32TO64_UAP(namelen);
716 return (sys___getlogin(l, &ua, retval));
717 }
718
719 int
720 netbsd32_setlogin(l, v, retval)
721 struct lwp *l;
722 void *v;
723 register_t *retval;
724 {
725 struct netbsd32_setlogin_args /* {
726 syscallarg(const netbsd32_charp) namebuf;
727 } */ *uap = v;
728 struct sys___setlogin_args ua;
729
730 NETBSD32TOP_UAP(namebuf, char);
731 return (sys___setlogin(l, &ua, retval));
732 }
733
734 int
735 netbsd32_acct(l, v, retval)
736 struct lwp *l;
737 void *v;
738 register_t *retval;
739 {
740 struct netbsd32_acct_args /* {
741 syscallarg(const netbsd32_charp) path;
742 } */ *uap = v;
743 struct sys_acct_args ua;
744
745 NETBSD32TOP_UAP(path, const char);
746 return (sys_acct(l, &ua, retval));
747 }
748
749 int
750 netbsd32_revoke(l, v, retval)
751 struct lwp *l;
752 void *v;
753 register_t *retval;
754 {
755 struct netbsd32_revoke_args /* {
756 syscallarg(const netbsd32_charp) path;
757 } */ *uap = v;
758 struct sys_revoke_args ua;
759 caddr_t sg;
760
761 NETBSD32TOP_UAP(path, const char);
762 sg = stackgap_init(l->l_proc, 0);
763 CHECK_ALT_EXIST(l->l_proc, &sg, SCARG(&ua, path));
764
765 return (sys_revoke(l, &ua, retval));
766 }
767
768 int
769 netbsd32_symlink(l, v, retval)
770 struct lwp *l;
771 void *v;
772 register_t *retval;
773 {
774 struct netbsd32_symlink_args /* {
775 syscallarg(const netbsd32_charp) path;
776 syscallarg(const netbsd32_charp) link;
777 } */ *uap = v;
778 struct sys_symlink_args ua;
779
780 NETBSD32TOP_UAP(path, const char);
781 NETBSD32TOP_UAP(link, const char);
782
783 return (sys_symlink(l, &ua, retval));
784 }
785
786 int
787 netbsd32_readlink(l, v, retval)
788 struct lwp *l;
789 void *v;
790 register_t *retval;
791 {
792 struct netbsd32_readlink_args /* {
793 syscallarg(const netbsd32_charp) path;
794 syscallarg(netbsd32_charp) buf;
795 syscallarg(netbsd32_size_t) count;
796 } */ *uap = v;
797 struct sys_readlink_args ua;
798 caddr_t sg;
799
800 NETBSD32TOP_UAP(path, const char);
801 NETBSD32TOP_UAP(buf, char);
802 NETBSD32TOX_UAP(count, size_t);
803 sg = stackgap_init(l->l_proc, 0);
804 CHECK_ALT_SYMLINK(l->l_proc, &sg, SCARG(&ua, path));
805
806 return (sys_readlink(l, &ua, retval));
807 }
808
809 int
810 netbsd32_umask(l, v, retval)
811 struct lwp *l;
812 void *v;
813 register_t *retval;
814 {
815 struct netbsd32_umask_args /* {
816 syscallarg(mode_t) newmask;
817 } */ *uap = v;
818 struct sys_umask_args ua;
819
820 NETBSD32TO64_UAP(newmask);
821 return (sys_umask(l, &ua, retval));
822 }
823
824 int
825 netbsd32_chroot(l, v, retval)
826 struct lwp *l;
827 void *v;
828 register_t *retval;
829 {
830 struct netbsd32_chroot_args /* {
831 syscallarg(const netbsd32_charp) path;
832 } */ *uap = v;
833 struct sys_chroot_args ua;
834
835 NETBSD32TOP_UAP(path, const char);
836 return (sys_chroot(l, &ua, retval));
837 }
838
839 int
840 netbsd32_sbrk(l, v, retval)
841 struct lwp *l;
842 void *v;
843 register_t *retval;
844 {
845 struct netbsd32_sbrk_args /* {
846 syscallarg(int) incr;
847 } */ *uap = v;
848 struct sys_sbrk_args ua;
849
850 NETBSD32TO64_UAP(incr);
851 return (sys_sbrk(l, &ua, retval));
852 }
853
854 int
855 netbsd32_sstk(l, v, retval)
856 struct lwp *l;
857 void *v;
858 register_t *retval;
859 {
860 struct netbsd32_sstk_args /* {
861 syscallarg(int) incr;
862 } */ *uap = v;
863 struct sys_sstk_args ua;
864
865 NETBSD32TO64_UAP(incr);
866 return (sys_sstk(l, &ua, retval));
867 }
868
869 int
870 netbsd32_munmap(l, v, retval)
871 struct lwp *l;
872 void *v;
873 register_t *retval;
874 {
875 struct netbsd32_munmap_args /* {
876 syscallarg(netbsd32_voidp) addr;
877 syscallarg(netbsd32_size_t) len;
878 } */ *uap = v;
879 struct sys_munmap_args ua;
880
881 NETBSD32TOP_UAP(addr, void);
882 NETBSD32TOX_UAP(len, size_t);
883 return (sys_munmap(l, &ua, retval));
884 }
885
886 int
887 netbsd32_mprotect(l, v, retval)
888 struct lwp *l;
889 void *v;
890 register_t *retval;
891 {
892 struct netbsd32_mprotect_args /* {
893 syscallarg(netbsd32_voidp) addr;
894 syscallarg(netbsd32_size_t) len;
895 syscallarg(int) prot;
896 } */ *uap = v;
897 struct sys_mprotect_args ua;
898
899 NETBSD32TOP_UAP(addr, void);
900 NETBSD32TOX_UAP(len, size_t);
901 NETBSD32TO64_UAP(prot);
902 return (sys_mprotect(l, &ua, retval));
903 }
904
905 int
906 netbsd32_madvise(l, v, retval)
907 struct lwp *l;
908 void *v;
909 register_t *retval;
910 {
911 struct netbsd32_madvise_args /* {
912 syscallarg(netbsd32_voidp) addr;
913 syscallarg(netbsd32_size_t) len;
914 syscallarg(int) behav;
915 } */ *uap = v;
916 struct sys_madvise_args ua;
917
918 NETBSD32TOP_UAP(addr, void);
919 NETBSD32TOX_UAP(len, size_t);
920 NETBSD32TO64_UAP(behav);
921 return (sys_madvise(l, &ua, retval));
922 }
923
924 int
925 netbsd32_mincore(l, v, retval)
926 struct lwp *l;
927 void *v;
928 register_t *retval;
929 {
930 struct netbsd32_mincore_args /* {
931 syscallarg(netbsd32_caddr_t) addr;
932 syscallarg(netbsd32_size_t) len;
933 syscallarg(netbsd32_charp) vec;
934 } */ *uap = v;
935 struct sys_mincore_args ua;
936
937 NETBSD32TOX64_UAP(addr, caddr_t);
938 NETBSD32TOX_UAP(len, size_t);
939 NETBSD32TOP_UAP(vec, char);
940 return (sys_mincore(l, &ua, retval));
941 }
942
943 /* XXX MOVE ME XXX ? */
944 int
945 netbsd32_getgroups(l, v, retval)
946 struct lwp *l;
947 void *v;
948 register_t *retval;
949 {
950 struct netbsd32_getgroups_args /* {
951 syscallarg(int) gidsetsize;
952 syscallarg(netbsd32_gid_tp) gidset;
953 } */ *uap = v;
954 struct pcred *pc = l->l_proc->p_cred;
955 int ngrp;
956 int error;
957
958 ngrp = SCARG(uap, gidsetsize);
959 if (ngrp == 0) {
960 *retval = pc->pc_ucred->cr_ngroups;
961 return (0);
962 }
963 if (ngrp < pc->pc_ucred->cr_ngroups)
964 return (EINVAL);
965 ngrp = pc->pc_ucred->cr_ngroups;
966 /* Should convert gid_t to netbsd32_gid_t, but they're the same */
967 error = copyout((caddr_t)pc->pc_ucred->cr_groups,
968 (caddr_t)NETBSD32PTR64(SCARG(uap, gidset)), ngrp * sizeof(gid_t));
969 if (error)
970 return (error);
971 *retval = ngrp;
972 return (0);
973 }
974
975 int
976 netbsd32_setgroups(l, v, retval)
977 struct lwp *l;
978 void *v;
979 register_t *retval;
980 {
981 struct netbsd32_setgroups_args /* {
982 syscallarg(int) gidsetsize;
983 syscallarg(const netbsd32_gid_tp) gidset;
984 } */ *uap = v;
985 struct sys_setgroups_args ua;
986
987 NETBSD32TO64_UAP(gidsetsize);
988 NETBSD32TOP_UAP(gidset, gid_t);
989 return (sys_setgroups(l, &ua, retval));
990 }
991
992 int
993 netbsd32_setpgid(l, v, retval)
994 struct lwp *l;
995 void *v;
996 register_t *retval;
997 {
998 struct netbsd32_setpgid_args /* {
999 syscallarg(int) pid;
1000 syscallarg(int) pgid;
1001 } */ *uap = v;
1002 struct sys_setpgid_args ua;
1003
1004 NETBSD32TO64_UAP(pid);
1005 NETBSD32TO64_UAP(pgid);
1006 return (sys_setpgid(l, &ua, retval));
1007 }
1008
1009 int
1010 netbsd32_fcntl(l, v, retval)
1011 struct lwp *l;
1012 void *v;
1013 register_t *retval;
1014 {
1015 struct netbsd32_fcntl_args /* {
1016 syscallarg(int) fd;
1017 syscallarg(int) cmd;
1018 syscallarg(netbsd32_voidp) arg;
1019 } */ *uap = v;
1020 struct sys_fcntl_args ua;
1021
1022 NETBSD32TO64_UAP(fd);
1023 NETBSD32TO64_UAP(cmd);
1024 NETBSD32TOP_UAP(arg, void);
1025 /* we can do this because `struct flock' doesn't change */
1026 return (sys_fcntl(l, &ua, retval));
1027 }
1028
1029 int
1030 netbsd32_dup2(l, v, retval)
1031 struct lwp *l;
1032 void *v;
1033 register_t *retval;
1034 {
1035 struct netbsd32_dup2_args /* {
1036 syscallarg(int) from;
1037 syscallarg(int) to;
1038 } */ *uap = v;
1039 struct sys_dup2_args ua;
1040
1041 NETBSD32TO64_UAP(from);
1042 NETBSD32TO64_UAP(to);
1043 return (sys_dup2(l, &ua, retval));
1044 }
1045
1046 int
1047 netbsd32_fsync(l, v, retval)
1048 struct lwp *l;
1049 void *v;
1050 register_t *retval;
1051 {
1052 struct netbsd32_fsync_args /* {
1053 syscallarg(int) fd;
1054 } */ *uap = v;
1055 struct sys_fsync_args ua;
1056
1057 NETBSD32TO64_UAP(fd);
1058 return (sys_fsync(l, &ua, retval));
1059 }
1060
1061 int
1062 netbsd32_setpriority(l, v, retval)
1063 struct lwp *l;
1064 void *v;
1065 register_t *retval;
1066 {
1067 struct netbsd32_setpriority_args /* {
1068 syscallarg(int) which;
1069 syscallarg(int) who;
1070 syscallarg(int) prio;
1071 } */ *uap = v;
1072 struct sys_setpriority_args ua;
1073
1074 NETBSD32TO64_UAP(which);
1075 NETBSD32TO64_UAP(who);
1076 NETBSD32TO64_UAP(prio);
1077 return (sys_setpriority(l, &ua, retval));
1078 }
1079
1080 int
1081 netbsd32_socket(l, v, retval)
1082 struct lwp *l;
1083 void *v;
1084 register_t *retval;
1085 {
1086 struct netbsd32_socket_args /* {
1087 syscallarg(int) domain;
1088 syscallarg(int) type;
1089 syscallarg(int) protocol;
1090 } */ *uap = v;
1091 struct sys_socket_args ua;
1092
1093 NETBSD32TO64_UAP(domain);
1094 NETBSD32TO64_UAP(type);
1095 NETBSD32TO64_UAP(protocol);
1096 return (sys_socket(l, &ua, retval));
1097 }
1098
1099 int
1100 netbsd32_connect(l, v, retval)
1101 struct lwp *l;
1102 void *v;
1103 register_t *retval;
1104 {
1105 struct netbsd32_connect_args /* {
1106 syscallarg(int) s;
1107 syscallarg(const netbsd32_sockaddrp_t) name;
1108 syscallarg(int) namelen;
1109 } */ *uap = v;
1110 struct sys_connect_args ua;
1111
1112 NETBSD32TO64_UAP(s);
1113 NETBSD32TOP_UAP(name, struct sockaddr);
1114 NETBSD32TO64_UAP(namelen);
1115 return (sys_connect(l, &ua, retval));
1116 }
1117
1118 int
1119 netbsd32_getpriority(l, v, retval)
1120 struct lwp *l;
1121 void *v;
1122 register_t *retval;
1123 {
1124 struct netbsd32_getpriority_args /* {
1125 syscallarg(int) which;
1126 syscallarg(int) who;
1127 } */ *uap = v;
1128 struct sys_getpriority_args ua;
1129
1130 NETBSD32TO64_UAP(which);
1131 NETBSD32TO64_UAP(who);
1132 return (sys_getpriority(l, &ua, retval));
1133 }
1134
1135 int
1136 netbsd32_bind(l, v, retval)
1137 struct lwp *l;
1138 void *v;
1139 register_t *retval;
1140 {
1141 struct netbsd32_bind_args /* {
1142 syscallarg(int) s;
1143 syscallarg(const netbsd32_sockaddrp_t) name;
1144 syscallarg(int) namelen;
1145 } */ *uap = v;
1146 struct sys_bind_args ua;
1147
1148 NETBSD32TO64_UAP(s);
1149 NETBSD32TOP_UAP(name, struct sockaddr);
1150 NETBSD32TO64_UAP(namelen);
1151 return (sys_bind(l, &ua, retval));
1152 }
1153
1154 int
1155 netbsd32_setsockopt(l, v, retval)
1156 struct lwp *l;
1157 void *v;
1158 register_t *retval;
1159 {
1160 struct netbsd32_setsockopt_args /* {
1161 syscallarg(int) s;
1162 syscallarg(int) level;
1163 syscallarg(int) name;
1164 syscallarg(const netbsd32_voidp) val;
1165 syscallarg(int) valsize;
1166 } */ *uap = v;
1167 struct sys_setsockopt_args ua;
1168
1169 NETBSD32TO64_UAP(s);
1170 NETBSD32TO64_UAP(level);
1171 NETBSD32TO64_UAP(name);
1172 NETBSD32TOP_UAP(val, void);
1173 NETBSD32TO64_UAP(valsize);
1174 /* may be more efficient to do this inline. */
1175 return (sys_setsockopt(l, &ua, retval));
1176 }
1177
1178 int
1179 netbsd32_listen(l, v, retval)
1180 struct lwp *l;
1181 void *v;
1182 register_t *retval;
1183 {
1184 struct netbsd32_listen_args /* {
1185 syscallarg(int) s;
1186 syscallarg(int) backlog;
1187 } */ *uap = v;
1188 struct sys_listen_args ua;
1189
1190 NETBSD32TO64_UAP(s);
1191 NETBSD32TO64_UAP(backlog);
1192 return (sys_listen(l, &ua, retval));
1193 }
1194
1195 int
1196 netbsd32_fchown(l, v, retval)
1197 struct lwp *l;
1198 void *v;
1199 register_t *retval;
1200 {
1201 struct netbsd32_fchown_args /* {
1202 syscallarg(int) fd;
1203 syscallarg(uid_t) uid;
1204 syscallarg(gid_t) gid;
1205 } */ *uap = v;
1206 struct sys_fchown_args ua;
1207
1208 NETBSD32TO64_UAP(fd);
1209 NETBSD32TO64_UAP(uid);
1210 NETBSD32TO64_UAP(gid);
1211 return (sys_fchown(l, &ua, retval));
1212 }
1213
1214 int
1215 netbsd32_fchmod(l, v, retval)
1216 struct lwp *l;
1217 void *v;
1218 register_t *retval;
1219 {
1220 struct netbsd32_fchmod_args /* {
1221 syscallarg(int) fd;
1222 syscallarg(mode_t) mode;
1223 } */ *uap = v;
1224 struct sys_fchmod_args ua;
1225
1226 NETBSD32TO64_UAP(fd);
1227 NETBSD32TO64_UAP(mode);
1228 return (sys_fchmod(l, &ua, retval));
1229 }
1230
1231 int
1232 netbsd32_setreuid(l, v, retval)
1233 struct lwp *l;
1234 void *v;
1235 register_t *retval;
1236 {
1237 struct netbsd32_setreuid_args /* {
1238 syscallarg(uid_t) ruid;
1239 syscallarg(uid_t) euid;
1240 } */ *uap = v;
1241 struct sys_setreuid_args ua;
1242
1243 NETBSD32TO64_UAP(ruid);
1244 NETBSD32TO64_UAP(euid);
1245 return (sys_setreuid(l, &ua, retval));
1246 }
1247
1248 int
1249 netbsd32_setregid(l, v, retval)
1250 struct lwp *l;
1251 void *v;
1252 register_t *retval;
1253 {
1254 struct netbsd32_setregid_args /* {
1255 syscallarg(gid_t) rgid;
1256 syscallarg(gid_t) egid;
1257 } */ *uap = v;
1258 struct sys_setregid_args ua;
1259
1260 NETBSD32TO64_UAP(rgid);
1261 NETBSD32TO64_UAP(egid);
1262 return (sys_setregid(l, &ua, retval));
1263 }
1264
1265 int
1266 netbsd32_getsockopt(l, v, retval)
1267 struct lwp *l;
1268 void *v;
1269 register_t *retval;
1270 {
1271 struct netbsd32_getsockopt_args /* {
1272 syscallarg(int) s;
1273 syscallarg(int) level;
1274 syscallarg(int) name;
1275 syscallarg(netbsd32_voidp) val;
1276 syscallarg(netbsd32_intp) avalsize;
1277 } */ *uap = v;
1278 struct sys_getsockopt_args ua;
1279
1280 NETBSD32TO64_UAP(s);
1281 NETBSD32TO64_UAP(level);
1282 NETBSD32TO64_UAP(name);
1283 NETBSD32TOP_UAP(val, void);
1284 NETBSD32TOP_UAP(avalsize, int);
1285 return (sys_getsockopt(l, &ua, retval));
1286 }
1287
1288 int
1289 netbsd32_rename(l, v, retval)
1290 struct lwp *l;
1291 void *v;
1292 register_t *retval;
1293 {
1294 struct netbsd32_rename_args /* {
1295 syscallarg(const netbsd32_charp) from;
1296 syscallarg(const netbsd32_charp) to;
1297 } */ *uap = v;
1298 struct sys_rename_args ua;
1299
1300 NETBSD32TOP_UAP(from, const char);
1301 NETBSD32TOP_UAP(to, const char)
1302
1303 return (sys_rename(l, &ua, retval));
1304 }
1305
1306 int
1307 netbsd32_flock(l, v, retval)
1308 struct lwp *l;
1309 void *v;
1310 register_t *retval;
1311 {
1312 struct netbsd32_flock_args /* {
1313 syscallarg(int) fd;
1314 syscallarg(int) how;
1315 } */ *uap = v;
1316 struct sys_flock_args ua;
1317
1318 NETBSD32TO64_UAP(fd);
1319 NETBSD32TO64_UAP(how)
1320
1321 return (sys_flock(l, &ua, retval));
1322 }
1323
1324 int
1325 netbsd32_mkfifo(l, v, retval)
1326 struct lwp *l;
1327 void *v;
1328 register_t *retval;
1329 {
1330 struct netbsd32_mkfifo_args /* {
1331 syscallarg(const netbsd32_charp) path;
1332 syscallarg(mode_t) mode;
1333 } */ *uap = v;
1334 struct sys_mkfifo_args ua;
1335
1336 NETBSD32TOP_UAP(path, const char)
1337 NETBSD32TO64_UAP(mode);
1338 return (sys_mkfifo(l, &ua, retval));
1339 }
1340
1341 int
1342 netbsd32_shutdown(l, v, retval)
1343 struct lwp *l;
1344 void *v;
1345 register_t *retval;
1346 {
1347 struct netbsd32_shutdown_args /* {
1348 syscallarg(int) s;
1349 syscallarg(int) how;
1350 } */ *uap = v;
1351 struct sys_shutdown_args ua;
1352
1353 NETBSD32TO64_UAP(s)
1354 NETBSD32TO64_UAP(how);
1355 return (sys_shutdown(l, &ua, retval));
1356 }
1357
1358 int
1359 netbsd32_socketpair(l, v, retval)
1360 struct lwp *l;
1361 void *v;
1362 register_t *retval;
1363 {
1364 struct netbsd32_socketpair_args /* {
1365 syscallarg(int) domain;
1366 syscallarg(int) type;
1367 syscallarg(int) protocol;
1368 syscallarg(netbsd32_intp) rsv;
1369 } */ *uap = v;
1370 struct sys_socketpair_args ua;
1371
1372 NETBSD32TO64_UAP(domain);
1373 NETBSD32TO64_UAP(type);
1374 NETBSD32TO64_UAP(protocol);
1375 NETBSD32TOP_UAP(rsv, int);
1376 /* Since we're just copying out two `int's we can do this */
1377 return (sys_socketpair(l, &ua, retval));
1378 }
1379
1380 int
1381 netbsd32_mkdir(l, v, retval)
1382 struct lwp *l;
1383 void *v;
1384 register_t *retval;
1385 {
1386 struct netbsd32_mkdir_args /* {
1387 syscallarg(const netbsd32_charp) path;
1388 syscallarg(mode_t) mode;
1389 } */ *uap = v;
1390 struct sys_mkdir_args ua;
1391
1392 NETBSD32TOP_UAP(path, const char)
1393 NETBSD32TO64_UAP(mode);
1394 return (sys_mkdir(l, &ua, retval));
1395 }
1396
1397 int
1398 netbsd32_rmdir(l, v, retval)
1399 struct lwp *l;
1400 void *v;
1401 register_t *retval;
1402 {
1403 struct netbsd32_rmdir_args /* {
1404 syscallarg(const netbsd32_charp) path;
1405 } */ *uap = v;
1406 struct sys_rmdir_args ua;
1407
1408 NETBSD32TOP_UAP(path, const char);
1409 return (sys_rmdir(l, &ua, retval));
1410 }
1411
1412 int
1413 netbsd32_quotactl(l, v, retval)
1414 struct lwp *l;
1415 void *v;
1416 register_t *retval;
1417 {
1418 struct netbsd32_quotactl_args /* {
1419 syscallarg(const netbsd32_charp) path;
1420 syscallarg(int) cmd;
1421 syscallarg(int) uid;
1422 syscallarg(netbsd32_caddr_t) arg;
1423 } */ *uap = v;
1424 struct sys_quotactl_args ua;
1425
1426 NETBSD32TOP_UAP(path, const char);
1427 NETBSD32TO64_UAP(cmd);
1428 NETBSD32TO64_UAP(uid);
1429 NETBSD32TOX64_UAP(arg, caddr_t);
1430 return (sys_quotactl(l, &ua, retval));
1431 }
1432
1433 #if defined(NFS) || defined(NFSSERVER)
1434 int
1435 netbsd32_nfssvc(l, v, retval)
1436 struct lwp *l;
1437 void *v;
1438 register_t *retval;
1439 {
1440 #if 0
1441 struct netbsd32_nfssvc_args /* {
1442 syscallarg(int) flag;
1443 syscallarg(netbsd32_voidp) argp;
1444 } */ *uap = v;
1445 struct sys_nfssvc_args ua;
1446
1447 NETBSD32TO64_UAP(flag);
1448 NETBSD32TOP_UAP(argp, void);
1449 return (sys_nfssvc(l, &ua, retval));
1450 #else
1451 /* Why would we want to support a 32-bit nfsd? */
1452 return (ENOSYS);
1453 #endif
1454 }
1455 #endif
1456
1457 #if defined(NFS) || defined(NFSSERVER)
1458 int
1459 netbsd32_getfh(l, v, retval)
1460 struct lwp *l;
1461 void *v;
1462 register_t *retval;
1463 {
1464 struct netbsd32_getfh_args /* {
1465 syscallarg(const netbsd32_charp) fname;
1466 syscallarg(netbsd32_fhandlep_t) fhp;
1467 } */ *uap = v;
1468 struct sys_getfh_args ua;
1469
1470 NETBSD32TOP_UAP(fname, const char);
1471 NETBSD32TOP_UAP(fhp, struct fhandle);
1472 /* Lucky for us a fhandlep_t doesn't change sizes */
1473 return (sys_getfh(l, &ua, retval));
1474 }
1475 #endif
1476
1477 int
1478 netbsd32_pread(l, v, retval)
1479 struct lwp *l;
1480 void *v;
1481 register_t *retval;
1482 {
1483 struct netbsd32_pread_args /* {
1484 syscallarg(int) fd;
1485 syscallarg(netbsd32_voidp) buf;
1486 syscallarg(netbsd32_size_t) nbyte;
1487 syscallarg(int) pad;
1488 syscallarg(off_t) offset;
1489 } */ *uap = v;
1490 struct sys_pread_args ua;
1491 ssize_t rt;
1492 int error;
1493
1494 NETBSD32TO64_UAP(fd);
1495 NETBSD32TOP_UAP(buf, void);
1496 NETBSD32TOX_UAP(nbyte, size_t);
1497 NETBSD32TO64_UAP(pad);
1498 NETBSD32TO64_UAP(offset);
1499 error = sys_pread(l, &ua, (register_t *)&rt);
1500 *retval = rt;
1501 return (error);
1502 }
1503
1504 int
1505 netbsd32_pwrite(l, v, retval)
1506 struct lwp *l;
1507 void *v;
1508 register_t *retval;
1509 {
1510 struct netbsd32_pwrite_args /* {
1511 syscallarg(int) fd;
1512 syscallarg(const netbsd32_voidp) buf;
1513 syscallarg(netbsd32_size_t) nbyte;
1514 syscallarg(int) pad;
1515 syscallarg(off_t) offset;
1516 } */ *uap = v;
1517 struct sys_pwrite_args ua;
1518 ssize_t rt;
1519 int error;
1520
1521 NETBSD32TO64_UAP(fd);
1522 NETBSD32TOP_UAP(buf, void);
1523 NETBSD32TOX_UAP(nbyte, size_t);
1524 NETBSD32TO64_UAP(pad);
1525 NETBSD32TO64_UAP(offset);
1526 error = sys_pwrite(l, &ua, (register_t *)&rt);
1527 *retval = rt;
1528 return (error);
1529 }
1530
1531 int
1532 netbsd32_setgid(l, v, retval)
1533 struct lwp *l;
1534 void *v;
1535 register_t *retval;
1536 {
1537 struct netbsd32_setgid_args /* {
1538 syscallarg(gid_t) gid;
1539 } */ *uap = v;
1540 struct sys_setgid_args ua;
1541
1542 NETBSD32TO64_UAP(gid);
1543 return (sys_setgid(l, v, retval));
1544 }
1545
1546 int
1547 netbsd32_setegid(l, v, retval)
1548 struct lwp *l;
1549 void *v;
1550 register_t *retval;
1551 {
1552 struct netbsd32_setegid_args /* {
1553 syscallarg(gid_t) egid;
1554 } */ *uap = v;
1555 struct sys_setegid_args ua;
1556
1557 NETBSD32TO64_UAP(egid);
1558 return (sys_setegid(l, v, retval));
1559 }
1560
1561 int
1562 netbsd32_seteuid(l, v, retval)
1563 struct lwp *l;
1564 void *v;
1565 register_t *retval;
1566 {
1567 struct netbsd32_seteuid_args /* {
1568 syscallarg(gid_t) euid;
1569 } */ *uap = v;
1570 struct sys_seteuid_args ua;
1571
1572 NETBSD32TO64_UAP(euid);
1573 return (sys_seteuid(l, v, retval));
1574 }
1575
1576 #ifdef LFS
1577 int
1578 netbsd32_sys_lfs_bmapv(l, v, retval)
1579 struct lwp *l;
1580 void *v;
1581 register_t *retval;
1582 {
1583
1584 return (ENOSYS); /* XXX */
1585 }
1586
1587 int
1588 netbsd32_sys_lfs_markv(l, v, retval)
1589 struct lwp *l;
1590 void *v;
1591 register_t *retval;
1592 {
1593
1594 return (ENOSYS); /* XXX */
1595 }
1596
1597 int
1598 netbsd32_sys_lfs_segclean(l, v, retval)
1599 struct lwp *l;
1600 void *v;
1601 register_t *retval;
1602 {
1603
1604 return (ENOSYS); /* XXX */
1605 }
1606
1607 int
1608 netbsd32_sys_lfs_segwait(l, v, retval)
1609 struct lwp *l;
1610 void *v;
1611 register_t *retval;
1612 {
1613
1614 return (ENOSYS); /* XXX */
1615 }
1616 #endif
1617
1618 int
1619 netbsd32_pathconf(l, v, retval)
1620 struct lwp *l;
1621 void *v;
1622 register_t *retval;
1623 {
1624 struct netbsd32_pathconf_args /* {
1625 syscallarg(int) fd;
1626 syscallarg(int) name;
1627 } */ *uap = v;
1628 struct sys_pathconf_args ua;
1629 long rt;
1630 int error;
1631
1632 NETBSD32TOP_UAP(path, const char);
1633 NETBSD32TO64_UAP(name);
1634 error = sys_pathconf(l, &ua, (register_t *)&rt);
1635 *retval = rt;
1636 return (error);
1637 }
1638
1639 int
1640 netbsd32_fpathconf(l, v, retval)
1641 struct lwp *l;
1642 void *v;
1643 register_t *retval;
1644 {
1645 struct netbsd32_fpathconf_args /* {
1646 syscallarg(int) fd;
1647 syscallarg(int) name;
1648 } */ *uap = v;
1649 struct sys_fpathconf_args ua;
1650 long rt;
1651 int error;
1652
1653 NETBSD32TO64_UAP(fd);
1654 NETBSD32TO64_UAP(name);
1655 error = sys_fpathconf(l, &ua, (register_t *)&rt);
1656 *retval = rt;
1657 return (error);
1658 }
1659
1660 int
1661 netbsd32_getrlimit(l, v, retval)
1662 struct lwp *l;
1663 void *v;
1664 register_t *retval;
1665 {
1666 struct netbsd32_getrlimit_args /* {
1667 syscallarg(int) which;
1668 syscallarg(netbsd32_rlimitp_t) rlp;
1669 } */ *uap = v;
1670 int which = SCARG(uap, which);
1671
1672 if ((u_int)which >= RLIM_NLIMITS)
1673 return (EINVAL);
1674 return (copyout(&l->l_proc->p_rlimit[which],
1675 (caddr_t)NETBSD32PTR64(SCARG(uap, rlp)), sizeof(struct rlimit)));
1676 }
1677
1678 int
1679 netbsd32_setrlimit(l, v, retval)
1680 struct lwp *l;
1681 void *v;
1682 register_t *retval;
1683 {
1684 struct netbsd32_setrlimit_args /* {
1685 syscallarg(int) which;
1686 syscallarg(const netbsd32_rlimitp_t) rlp;
1687 } */ *uap = v;
1688 int which = SCARG(uap, which);
1689 struct rlimit alim;
1690 int error;
1691 struct proc *p = l->l_proc;
1692
1693 error = copyin((caddr_t)NETBSD32PTR64(SCARG(uap, rlp)), &alim,
1694 sizeof(struct rlimit));
1695 if (error)
1696 return (error);
1697
1698 switch (which) {
1699 case RLIMIT_DATA:
1700 if (alim.rlim_cur > MAXDSIZ32)
1701 alim.rlim_cur = MAXDSIZ32;
1702 if (alim.rlim_max > MAXDSIZ32)
1703 alim.rlim_max = MAXDSIZ32;
1704 break;
1705
1706 case RLIMIT_STACK:
1707 if (alim.rlim_cur > MAXSSIZ32)
1708 alim.rlim_cur = MAXSSIZ32;
1709 if (alim.rlim_max > MAXSSIZ32)
1710 alim.rlim_max = MAXSSIZ32;
1711 default:
1712 break;
1713 }
1714
1715 return (dosetrlimit(p, p->p_cred, which, &alim));
1716 }
1717
1718 int
1719 netbsd32_mmap(l, v, retval)
1720 struct lwp *l;
1721 void *v;
1722 register_t *retval;
1723 {
1724 struct netbsd32_mmap_args /* {
1725 syscallarg(netbsd32_voidp) addr;
1726 syscallarg(netbsd32_size_t) len;
1727 syscallarg(int) prot;
1728 syscallarg(int) flags;
1729 syscallarg(int) fd;
1730 syscallarg(netbsd32_long) pad;
1731 syscallarg(off_t) pos;
1732 } */ *uap = v;
1733 struct sys_mmap_args ua;
1734 int error;
1735
1736 NETBSD32TOP_UAP(addr, void);
1737 NETBSD32TOX_UAP(len, size_t);
1738 NETBSD32TO64_UAP(prot);
1739 NETBSD32TO64_UAP(flags);
1740 NETBSD32TO64_UAP(fd);
1741 NETBSD32TOX_UAP(pad, long);
1742 NETBSD32TOX_UAP(pos, off_t);
1743 error = sys_mmap(l, &ua, retval);
1744 if ((u_long)*retval > (u_long)UINT_MAX) {
1745 printf("netbsd32_mmap: retval out of range: 0x%lx",
1746 (u_long)*retval);
1747 /* Should try to recover and return an error here. */
1748 }
1749 return (error);
1750 }
1751
1752 int
1753 netbsd32_lseek(l, v, retval)
1754 struct lwp *l;
1755 void *v;
1756 register_t *retval;
1757 {
1758 struct netbsd32_lseek_args /* {
1759 syscallarg(int) fd;
1760 syscallarg(int) pad;
1761 syscallarg(off_t) offset;
1762 syscallarg(int) whence;
1763 } */ *uap = v;
1764 struct sys_lseek_args ua;
1765
1766 NETBSD32TO64_UAP(fd);
1767 NETBSD32TO64_UAP(pad);
1768 NETBSD32TO64_UAP(offset);
1769 NETBSD32TO64_UAP(whence);
1770 return (sys_lseek(l, &ua, retval));
1771 }
1772
1773 int
1774 netbsd32_truncate(l, v, retval)
1775 struct lwp *l;
1776 void *v;
1777 register_t *retval;
1778 {
1779 struct netbsd32_truncate_args /* {
1780 syscallarg(const netbsd32_charp) path;
1781 syscallarg(int) pad;
1782 syscallarg(off_t) length;
1783 } */ *uap = v;
1784 struct sys_truncate_args ua;
1785
1786 NETBSD32TOP_UAP(path, const char);
1787 NETBSD32TO64_UAP(pad);
1788 NETBSD32TO64_UAP(length);
1789 return (sys_truncate(l, &ua, retval));
1790 }
1791
1792 int
1793 netbsd32_ftruncate(l, v, retval)
1794 struct lwp *l;
1795 void *v;
1796 register_t *retval;
1797 {
1798 struct netbsd32_ftruncate_args /* {
1799 syscallarg(int) fd;
1800 syscallarg(int) pad;
1801 syscallarg(off_t) length;
1802 } */ *uap = v;
1803 struct sys_ftruncate_args ua;
1804
1805 NETBSD32TO64_UAP(fd);
1806 NETBSD32TO64_UAP(pad);
1807 NETBSD32TO64_UAP(length);
1808 return (sys_ftruncate(l, &ua, retval));
1809 }
1810
1811 int
1812 netbsd32_mlock(l, v, retval)
1813 struct lwp *l;
1814 void *v;
1815 register_t *retval;
1816 {
1817 struct netbsd32_mlock_args /* {
1818 syscallarg(const netbsd32_voidp) addr;
1819 syscallarg(netbsd32_size_t) len;
1820 } */ *uap = v;
1821 struct sys_mlock_args ua;
1822
1823 NETBSD32TOP_UAP(addr, const void);
1824 NETBSD32TO64_UAP(len);
1825 return (sys_mlock(l, &ua, retval));
1826 }
1827
1828 int
1829 netbsd32_munlock(l, v, retval)
1830 struct lwp *l;
1831 void *v;
1832 register_t *retval;
1833 {
1834 struct netbsd32_munlock_args /* {
1835 syscallarg(const netbsd32_voidp) addr;
1836 syscallarg(netbsd32_size_t) len;
1837 } */ *uap = v;
1838 struct sys_munlock_args ua;
1839
1840 NETBSD32TOP_UAP(addr, const void);
1841 NETBSD32TO64_UAP(len);
1842 return (sys_munlock(l, &ua, retval));
1843 }
1844
1845 int
1846 netbsd32_undelete(l, v, retval)
1847 struct lwp *l;
1848 void *v;
1849 register_t *retval;
1850 {
1851 struct netbsd32_undelete_args /* {
1852 syscallarg(const netbsd32_charp) path;
1853 } */ *uap = v;
1854 struct sys_undelete_args ua;
1855
1856 NETBSD32TOP_UAP(path, const char);
1857 return (sys_undelete(l, &ua, retval));
1858 }
1859
1860 int
1861 netbsd32_getpgid(l, v, retval)
1862 struct lwp *l;
1863 void *v;
1864 register_t *retval;
1865 {
1866 struct netbsd32_getpgid_args /* {
1867 syscallarg(pid_t) pid;
1868 } */ *uap = v;
1869 struct sys_getpgid_args ua;
1870
1871 NETBSD32TO64_UAP(pid);
1872 return (sys_getpgid(l, &ua, retval));
1873 }
1874
1875 int
1876 netbsd32_reboot(l, v, retval)
1877 struct lwp *l;
1878 void *v;
1879 register_t *retval;
1880 {
1881 struct netbsd32_reboot_args /* {
1882 syscallarg(int) opt;
1883 syscallarg(netbsd32_charp) bootstr;
1884 } */ *uap = v;
1885 struct sys_reboot_args ua;
1886
1887 NETBSD32TO64_UAP(opt);
1888 NETBSD32TOP_UAP(bootstr, char);
1889 return (sys_reboot(l, &ua, retval));
1890 }
1891
1892 int
1893 netbsd32_poll(l, v, retval)
1894 struct lwp *l;
1895 void *v;
1896 register_t *retval;
1897 {
1898 struct netbsd32_poll_args /* {
1899 syscallarg(netbsd32_pollfdp_t) fds;
1900 syscallarg(u_int) nfds;
1901 syscallarg(int) timeout;
1902 } */ *uap = v;
1903 struct sys_poll_args ua;
1904
1905 NETBSD32TOP_UAP(fds, struct pollfd);
1906 NETBSD32TO64_UAP(nfds);
1907 NETBSD32TO64_UAP(timeout);
1908 return (sys_poll(l, &ua, retval));
1909 }
1910
1911 int
1912 netbsd32_fdatasync(l, v, retval)
1913 struct lwp *l;
1914 void *v;
1915 register_t *retval;
1916 {
1917 struct netbsd32_fdatasync_args /* {
1918 syscallarg(int) fd;
1919 } */ *uap = v;
1920 struct sys_fdatasync_args ua;
1921
1922 NETBSD32TO64_UAP(fd);
1923 return (sys_fdatasync(l, &ua, retval));
1924 }
1925
1926 int
1927 netbsd32___posix_rename(l, v, retval)
1928 struct lwp *l;
1929 void *v;
1930 register_t *retval;
1931 {
1932 struct netbsd32___posix_rename_args /* {
1933 syscallarg(const netbsd32_charp) from;
1934 syscallarg(const netbsd32_charp) to;
1935 } */ *uap = v;
1936 struct sys___posix_rename_args ua;
1937
1938 NETBSD32TOP_UAP(from, const char);
1939 NETBSD32TOP_UAP(to, const char);
1940 return (sys___posix_rename(l, &ua, retval));
1941 }
1942
1943 int
1944 netbsd32_swapctl(l, v, retval)
1945 struct lwp *l;
1946 void *v;
1947 register_t *retval;
1948 {
1949 struct netbsd32_swapctl_args /* {
1950 syscallarg(int) cmd;
1951 syscallarg(const netbsd32_voidp) arg;
1952 syscallarg(int) misc;
1953 } */ *uap = v;
1954 struct sys_swapctl_args ua;
1955
1956 NETBSD32TO64_UAP(cmd);
1957 NETBSD32TOP_UAP(arg, void);
1958 NETBSD32TO64_UAP(misc);
1959 return (sys_swapctl(l, &ua, retval));
1960 }
1961
1962 int
1963 netbsd32_minherit(l, v, retval)
1964 struct lwp *l;
1965 void *v;
1966 register_t *retval;
1967 {
1968 struct netbsd32_minherit_args /* {
1969 syscallarg(netbsd32_voidp) addr;
1970 syscallarg(netbsd32_size_t) len;
1971 syscallarg(int) inherit;
1972 } */ *uap = v;
1973 struct sys_minherit_args ua;
1974
1975 NETBSD32TOP_UAP(addr, void);
1976 NETBSD32TOX_UAP(len, size_t);
1977 NETBSD32TO64_UAP(inherit);
1978 return (sys_minherit(l, &ua, retval));
1979 }
1980
1981 int
1982 netbsd32_lchmod(l, v, retval)
1983 struct lwp *l;
1984 void *v;
1985 register_t *retval;
1986 {
1987 struct netbsd32_lchmod_args /* {
1988 syscallarg(const netbsd32_charp) path;
1989 syscallarg(mode_t) mode;
1990 } */ *uap = v;
1991 struct sys_lchmod_args ua;
1992
1993 NETBSD32TOP_UAP(path, const char);
1994 NETBSD32TO64_UAP(mode);
1995 return (sys_lchmod(l, &ua, retval));
1996 }
1997
1998 int
1999 netbsd32_lchown(l, v, retval)
2000 struct lwp *l;
2001 void *v;
2002 register_t *retval;
2003 {
2004 struct netbsd32_lchown_args /* {
2005 syscallarg(const netbsd32_charp) path;
2006 syscallarg(uid_t) uid;
2007 syscallarg(gid_t) gid;
2008 } */ *uap = v;
2009 struct sys_lchown_args ua;
2010
2011 NETBSD32TOP_UAP(path, const char);
2012 NETBSD32TO64_UAP(uid);
2013 NETBSD32TO64_UAP(gid);
2014 return (sys_lchown(l, &ua, retval));
2015 }
2016
2017 int
2018 netbsd32___msync13(l, v, retval)
2019 struct lwp *l;
2020 void *v;
2021 register_t *retval;
2022 {
2023 struct netbsd32___msync13_args /* {
2024 syscallarg(netbsd32_voidp) addr;
2025 syscallarg(netbsd32_size_t) len;
2026 syscallarg(int) flags;
2027 } */ *uap = v;
2028 struct sys___msync13_args ua;
2029
2030 NETBSD32TOP_UAP(addr, void);
2031 NETBSD32TOX_UAP(len, size_t);
2032 NETBSD32TO64_UAP(flags);
2033 return (sys___msync13(l, &ua, retval));
2034 }
2035
2036 int
2037 netbsd32___posix_chown(l, v, retval)
2038 struct lwp *l;
2039 void *v;
2040 register_t *retval;
2041 {
2042 struct netbsd32___posix_chown_args /* {
2043 syscallarg(const netbsd32_charp) path;
2044 syscallarg(uid_t) uid;
2045 syscallarg(gid_t) gid;
2046 } */ *uap = v;
2047 struct sys___posix_chown_args ua;
2048
2049 NETBSD32TOP_UAP(path, const char);
2050 NETBSD32TO64_UAP(uid);
2051 NETBSD32TO64_UAP(gid);
2052 return (sys___posix_chown(l, &ua, retval));
2053 }
2054
2055 int
2056 netbsd32___posix_fchown(l, v, retval)
2057 struct lwp *l;
2058 void *v;
2059 register_t *retval;
2060 {
2061 struct netbsd32___posix_fchown_args /* {
2062 syscallarg(int) fd;
2063 syscallarg(uid_t) uid;
2064 syscallarg(gid_t) gid;
2065 } */ *uap = v;
2066 struct sys___posix_fchown_args ua;
2067
2068 NETBSD32TO64_UAP(fd);
2069 NETBSD32TO64_UAP(uid);
2070 NETBSD32TO64_UAP(gid);
2071 return (sys___posix_fchown(l, &ua, retval));
2072 }
2073
2074 int
2075 netbsd32___posix_lchown(l, v, retval)
2076 struct lwp *l;
2077 void *v;
2078 register_t *retval;
2079 {
2080 struct netbsd32___posix_lchown_args /* {
2081 syscallarg(const netbsd32_charp) path;
2082 syscallarg(uid_t) uid;
2083 syscallarg(gid_t) gid;
2084 } */ *uap = v;
2085 struct sys___posix_lchown_args ua;
2086
2087 NETBSD32TOP_UAP(path, const char);
2088 NETBSD32TO64_UAP(uid);
2089 NETBSD32TO64_UAP(gid);
2090 return (sys___posix_lchown(l, &ua, retval));
2091 }
2092
2093 int
2094 netbsd32_getsid(l, v, retval)
2095 struct lwp *l;
2096 void *v;
2097 register_t *retval;
2098 {
2099 struct netbsd32_getsid_args /* {
2100 syscallarg(pid_t) pid;
2101 } */ *uap = v;
2102 struct sys_getsid_args ua;
2103
2104 NETBSD32TO64_UAP(pid);
2105 return (sys_getsid(l, &ua, retval));
2106 }
2107
2108 #ifdef KTRACE
2109 int
2110 netbsd32_fktrace(l, v, retval)
2111 struct lwp *l;
2112 void *v;
2113 register_t *retval;
2114 {
2115 struct netbsd32_fktrace_args /* {
2116 syscallarg(const int) fd;
2117 syscallarg(int) ops;
2118 syscallarg(int) facs;
2119 syscallarg(int) pid;
2120 } */ *uap = v;
2121 #if 0
2122 struct sys_fktrace_args ua;
2123 #else
2124 /* XXXX */
2125 struct sys_fktrace_noconst_args {
2126 syscallarg(int) fd;
2127 syscallarg(int) ops;
2128 syscallarg(int) facs;
2129 syscallarg(int) pid;
2130 } ua;
2131 #endif
2132
2133 NETBSD32TOX_UAP(fd, int);
2134 NETBSD32TO64_UAP(ops);
2135 NETBSD32TO64_UAP(facs);
2136 NETBSD32TO64_UAP(pid);
2137 return (sys_fktrace(l, &ua, retval));
2138 }
2139 #endif /* KTRACE */
2140
2141 int netbsd32___sigpending14(l, v, retval)
2142 struct lwp *l;
2143 void *v;
2144 register_t *retval;
2145 {
2146 struct netbsd32___sigpending14_args /* {
2147 syscallarg(sigset_t *) set;
2148 } */ *uap = v;
2149 struct sys___sigpending14_args ua;
2150
2151 NETBSD32TOP_UAP(set, sigset_t);
2152 return (sys___sigpending14(l, &ua, retval));
2153 }
2154
2155 int netbsd32___sigprocmask14(l, v, retval)
2156 struct lwp *l;
2157 void *v;
2158 register_t *retval;
2159 {
2160 struct netbsd32___sigprocmask14_args /* {
2161 syscallarg(int) how;
2162 syscallarg(const sigset_t *) set;
2163 syscallarg(sigset_t *) oset;
2164 } */ *uap = v;
2165 struct sys___sigprocmask14_args ua;
2166
2167 NETBSD32TO64_UAP(how);
2168 NETBSD32TOP_UAP(set, sigset_t);
2169 NETBSD32TOP_UAP(oset, sigset_t);
2170 return (sys___sigprocmask14(l, &ua, retval));
2171 }
2172
2173 int netbsd32___sigsuspend14(l, v, retval)
2174 struct lwp *l;
2175 void *v;
2176 register_t *retval;
2177 {
2178 struct netbsd32___sigsuspend14_args /* {
2179 syscallarg(const sigset_t *) set;
2180 } */ *uap = v;
2181 struct sys___sigsuspend14_args ua;
2182
2183 NETBSD32TOP_UAP(set, sigset_t);
2184 return (sys___sigsuspend14(l, &ua, retval));
2185 };
2186
2187 int netbsd32_fchroot(l, v, retval)
2188 struct lwp *l;
2189 void *v;
2190 register_t *retval;
2191 {
2192 struct netbsd32_fchroot_args /* {
2193 syscallarg(int) fd;
2194 } */ *uap = v;
2195 struct sys_fchroot_args ua;
2196
2197 NETBSD32TO64_UAP(fd);
2198 return (sys_fchroot(l, &ua, retval));
2199 }
2200
2201 /*
2202 * Open a file given a file handle.
2203 *
2204 * Check permissions, allocate an open file structure,
2205 * and call the device open routine if any.
2206 */
2207 int
2208 netbsd32_fhopen(l, v, retval)
2209 struct lwp *l;
2210 void *v;
2211 register_t *retval;
2212 {
2213 struct netbsd32_fhopen_args /* {
2214 syscallarg(const fhandle_t *) fhp;
2215 syscallarg(int) flags;
2216 } */ *uap = v;
2217 struct sys_fhopen_args ua;
2218
2219 NETBSD32TOP_UAP(fhp, fhandle_t);
2220 NETBSD32TO64_UAP(flags);
2221 return (sys_fhopen(l, &ua, retval));
2222 }
2223
2224 int netbsd32_fhstat(l, v, retval)
2225 struct lwp *l;
2226 void *v;
2227 register_t *retval;
2228 {
2229 struct netbsd32_fhstat_args /* {
2230 syscallarg(const netbsd32_fhandlep_t) fhp;
2231 syscallarg(struct stat *) sb;
2232 } */ *uap = v;
2233 struct sys_fhstat_args ua;
2234
2235 NETBSD32TOP_UAP(fhp, const fhandle_t);
2236 NETBSD32TOP_UAP(sb, struct stat);
2237 return (sys_fhstat(l, &ua, retval));
2238 }
2239
2240 /* virtual memory syscalls */
2241 int
2242 netbsd32_ovadvise(l, v, retval)
2243 struct lwp *l;
2244 void *v;
2245 register_t *retval;
2246 {
2247 struct netbsd32_ovadvise_args /* {
2248 syscallarg(int) anom;
2249 } */ *uap = v;
2250 struct sys_ovadvise_args ua;
2251
2252 NETBSD32TO64_UAP(anom);
2253 return (sys_ovadvise(l, &ua, retval));
2254 }
2255
2256 void
2257 netbsd32_adjust_limits(struct proc *p)
2258 {
2259 rlim_t *valp;
2260
2261 valp = &p->p_rlimit[RLIMIT_DATA].rlim_cur;
2262 if (*valp != RLIM_INFINITY && *valp > MAXDSIZ32)
2263 *valp = MAXDSIZ32;
2264 valp = &p->p_rlimit[RLIMIT_DATA].rlim_max;
2265 if (*valp != RLIM_INFINITY && *valp > MAXDSIZ32)
2266 *valp = MAXDSIZ32;
2267
2268 valp = &p->p_rlimit[RLIMIT_STACK].rlim_cur;
2269 if (*valp != RLIM_INFINITY && *valp > MAXSSIZ32)
2270 *valp = MAXSSIZ32;
2271 valp = &p->p_rlimit[RLIMIT_STACK].rlim_max;
2272 if (*valp != RLIM_INFINITY && *valp > MAXSSIZ32)
2273 *valp = MAXSSIZ32;
2274 }
2275
2276 int
2277 netbsd32_uuidgen(struct lwp *l, void *v, register_t *retval)
2278 {
2279 struct netbsd32_uuidgen_args /* {
2280 syscallarg(netbsd32_uuidp_t) store;
2281 syscallarg(int) count;
2282 } */ *uap = v;
2283 struct sys_uuidgen_args ua;
2284
2285 NETBSD32TOP_UAP(store, struct uuid);
2286 NETBSD32TO64_UAP(count);
2287 return (sys_uuidgen(l, &ua, retval));
2288 }
2289
2290 int
2291 netbsd32_extattrctl(struct lwp *l, void *v, register_t *retval)
2292 {
2293 struct netbsd32_extattrctl_args /* {
2294 syscallarg(const netbsd32_charp) path;
2295 syscallarg(int) cmd;
2296 syscallarg(const netbsd32_charp) filename;
2297 syscallarg(int) attrnamespace;
2298 syscallarg(const netbsd32_charp) attrname;
2299 } */ *uap = v;
2300 struct sys_extattrctl_args ua;
2301
2302 NETBSD32TOP_UAP(path, const char);
2303 NETBSD32TO64_UAP(cmd);
2304 NETBSD32TOP_UAP(filename, const char);
2305 NETBSD32TO64_UAP(attrnamespace);
2306 NETBSD32TOP_UAP(attrname, const char);
2307 return sys_extattrctl(l, &ua, retval);
2308 }
2309
2310 int
2311 netbsd32_extattr_set_fd(struct lwp *l, void *v, register_t *retval)
2312 {
2313 struct netbsd32_extattr_set_fd_args /* {
2314 syscallarg(int) fd;
2315 syscallarg(int) attrnamespace;
2316 syscallarg(const netbsd32_charp) attrname;
2317 syscallarg(const netbsd32_voidp) data;
2318 syscallarg(netbsd32_size_t) nbytes;
2319 } */ *uap = v;
2320 struct sys_extattr_set_fd_args ua;
2321
2322 NETBSD32TO64_UAP(fd);
2323 NETBSD32TO64_UAP(attrnamespace);
2324 NETBSD32TOP_UAP(attrname, const char);
2325 NETBSD32TOP_UAP(data, const void);
2326 NETBSD32TOX_UAP(nbytes, size_t);
2327 return sys_extattr_set_fd(l, &ua, retval);
2328 }
2329
2330 int
2331 netbsd32_extattr_set_file(struct lwp *l, void *v, register_t *retval)
2332 {
2333 struct netbsd32_extattr_set_file_args /* {
2334 syscallarg(const netbsd32_charp) path;
2335 syscallarg(int) attrnamespace;
2336 syscallarg(const netbsd32_charp) attrname;
2337 syscallarg(const netbsd32_voidp) data;
2338 syscallarg(netbsd32_size_t) nbytes;
2339 } */ *uap = v;
2340 struct sys_extattr_set_file_args ua;
2341
2342 NETBSD32TOP_UAP(path, const char);
2343 NETBSD32TO64_UAP(attrnamespace);
2344 NETBSD32TOP_UAP(attrname, const char);
2345 NETBSD32TOP_UAP(data, const void);
2346 NETBSD32TOX_UAP(nbytes, size_t);
2347 return sys_extattr_set_file(l, &ua, retval);
2348 }
2349
2350 int
2351 netbsd32_extattr_set_link(struct lwp *l, void *v, register_t *retval)
2352 {
2353 struct netbsd32_extattr_set_link_args /* {
2354 syscallarg(const netbsd32_charp) path;
2355 syscallarg(int) attrnamespace;
2356 syscallarg(const netbsd32_charp) attrname;
2357 syscallarg(const netbsd32_voidp) data;
2358 syscallarg(netbsd32_size_t) nbytes;
2359 } */ *uap = v;
2360 struct sys_extattr_set_link_args ua;
2361
2362 NETBSD32TOP_UAP(path, const char);
2363 NETBSD32TO64_UAP(attrnamespace);
2364 NETBSD32TOP_UAP(attrname, const char);
2365 NETBSD32TOP_UAP(data, const void);
2366 NETBSD32TOX_UAP(nbytes, size_t);
2367 return sys_extattr_set_link(l, &ua, retval);
2368 }
2369
2370 int
2371 netbsd32_extattr_get_fd(struct lwp *l, void *v, register_t *retval)
2372 {
2373 struct netbsd32_extattr_get_fd_args /* {
2374 syscallarg(int) fd;
2375 syscallarg(int) attrnamespace;
2376 syscallarg(const netbsd32_charp) attrname;
2377 syscallarg(netbsd32_voidp) data;
2378 syscallarg(netbsd32_size_t) nbytes;
2379 } */ *uap = v;
2380 struct sys_extattr_get_fd_args ua;
2381
2382 NETBSD32TO64_UAP(fd);
2383 NETBSD32TO64_UAP(attrnamespace);
2384 NETBSD32TOP_UAP(attrname, const char);
2385 NETBSD32TOP_UAP(data, void);
2386 NETBSD32TOX_UAP(nbytes, size_t);
2387 return sys_extattr_get_fd(l, &ua, retval);
2388 }
2389
2390 int
2391 netbsd32_extattr_get_file(struct lwp *l, void *v, register_t *retval)
2392 {
2393 struct netbsd32_extattr_get_file_args /* {
2394 syscallarg(const netbsd32_charp) path;
2395 syscallarg(int) attrnamespace;
2396 syscallarg(const netbsd32_charp) attrname;
2397 syscallarg(netbsd32_voidp) data;
2398 syscallarg(netbsd32_size_t) nbytes;
2399 } */ *uap = v;
2400 struct sys_extattr_get_file_args ua;
2401
2402 NETBSD32TOP_UAP(path, const char);
2403 NETBSD32TO64_UAP(attrnamespace);
2404 NETBSD32TOP_UAP(attrname, const char);
2405 NETBSD32TOP_UAP(data, void);
2406 NETBSD32TOX_UAP(nbytes, size_t);
2407 return sys_extattr_get_file(l, &ua, retval);
2408 }
2409
2410 int
2411 netbsd32_extattr_get_link(struct lwp *l, void *v, register_t *retval)
2412 {
2413 struct netbsd32_extattr_get_link_args /* {
2414 syscallarg(const netbsd32_charp) path;
2415 syscallarg(int) attrnamespace;
2416 syscallarg(const netbsd32_charp) attrname;
2417 syscallarg(netbsd32_voidp) data;
2418 syscallarg(netbsd32_size_t) nbytes;
2419 } */ *uap = v;
2420 struct sys_extattr_get_link_args ua;
2421
2422 NETBSD32TOP_UAP(path, const char);
2423 NETBSD32TO64_UAP(attrnamespace);
2424 NETBSD32TOP_UAP(attrname, const char);
2425 NETBSD32TOP_UAP(data, void);
2426 NETBSD32TOX_UAP(nbytes, size_t);
2427 return sys_extattr_get_link(l, &ua, retval);
2428 }
2429
2430 int
2431 netbsd32_extattr_delete_fd(struct lwp *l, void *v, register_t *retval)
2432 {
2433 struct netbsd32_extattr_delete_fd_args /* {
2434 syscallarg(int) fd;
2435 syscallarg(int) attrnamespace;
2436 syscallarg(const netbsd32_charp) attrname;
2437 } */ *uap = v;
2438 struct sys_extattr_delete_fd_args ua;
2439
2440 NETBSD32TO64_UAP(fd);
2441 NETBSD32TO64_UAP(attrnamespace);
2442 NETBSD32TOP_UAP(attrname, const char);
2443 return sys_extattr_delete_fd(l, &ua, retval);
2444 }
2445
2446 int
2447 netbsd32_extattr_delete_file(struct lwp *l, void *v, register_t *retval)
2448 {
2449 struct netbsd32_extattr_delete_file_args /* {
2450 syscallarg(const netbsd32_charp) path;
2451 syscallarg(int) attrnamespace;
2452 syscallarg(const netbsd32_charp) attrname;
2453 } */ *uap = v;
2454 struct sys_extattr_delete_file_args ua;
2455
2456 NETBSD32TOP_UAP(path, const char);
2457 NETBSD32TO64_UAP(attrnamespace);
2458 NETBSD32TOP_UAP(attrname, const char);
2459 return sys_extattr_delete_file(l, &ua, retval);
2460 }
2461
2462 int
2463 netbsd32_extattr_delete_link(struct lwp *l, void *v, register_t *retval)
2464 {
2465 struct netbsd32_extattr_delete_link_args /* {
2466 syscallarg(const netbsd32_charp) path;
2467 syscallarg(int) attrnamespace;
2468 syscallarg(const netbsd32_charp) attrname;
2469 } */ *uap = v;
2470 struct sys_extattr_delete_link_args ua;
2471
2472 NETBSD32TOP_UAP(path, const char);
2473 NETBSD32TO64_UAP(attrnamespace);
2474 NETBSD32TOP_UAP(attrname, const char);
2475 return sys_extattr_delete_link(l, &ua, retval);
2476 }
2477
2478 int
2479 netbsd32_extattr_list_fd(struct lwp *l, void *v, register_t *retval)
2480 {
2481 struct netbsd32_extattr_list_fd_args /* {
2482 syscallarg(int) fd;
2483 syscallarg(int) attrnamespace;
2484 syscallarg(netbsd32_voidp) data;
2485 syscallarg(netbsd32_size_t) nbytes;
2486 } */ *uap = v;
2487 struct sys_extattr_list_fd_args ua;
2488
2489 NETBSD32TO64_UAP(fd);
2490 NETBSD32TO64_UAP(attrnamespace);
2491 NETBSD32TOP_UAP(data, void);
2492 NETBSD32TOX_UAP(nbytes, size_t);
2493 return sys_extattr_list_fd(l, &ua, retval);
2494 }
2495
2496 int
2497 netbsd32_extattr_list_file(struct lwp *l, void *v, register_t *retval)
2498 {
2499 struct netbsd32_extattr_list_file_args /* {
2500 syscallarg(const netbsd32_charp) path;
2501 syscallarg(int) attrnamespace;
2502 syscallarg(netbsd32_voidp) data;
2503 syscallarg(netbsd32_size_t) nbytes;
2504 } */ *uap = v;
2505 struct sys_extattr_list_file_args ua;
2506
2507 NETBSD32TOP_UAP(path, const char);
2508 NETBSD32TO64_UAP(attrnamespace);
2509 NETBSD32TOP_UAP(data, void);
2510 NETBSD32TOX_UAP(nbytes, size_t);
2511 return sys_extattr_list_file(l, &ua, retval);
2512 }
2513
2514 int
2515 netbsd32_extattr_list_link(struct lwp *l, void *v, register_t *retval)
2516 {
2517 struct netbsd32_extattr_list_link_args /* {
2518 syscallarg(const netbsd32_charp) path;
2519 syscallarg(int) attrnamespace;
2520 syscallarg(netbsd32_voidp) data;
2521 syscallarg(netbsd32_size_t) nbytes;
2522 } */ *uap = v;
2523 struct sys_extattr_list_link_args ua;
2524
2525 NETBSD32TOP_UAP(path, const char);
2526 NETBSD32TO64_UAP(attrnamespace);
2527 NETBSD32TOP_UAP(data, void);
2528 NETBSD32TOX_UAP(nbytes, size_t);
2529 return sys_extattr_list_link(l, &ua, retval);
2530 }
2531
2532 int
2533 netbsd32_mlockall(l, v, retval)
2534 struct lwp *l;
2535 void *v;
2536 register_t *retval;
2537 {
2538 struct netbsd32_mlockall_args /* {
2539 syscallarg(int) flags;
2540 } */ *uap = v;
2541 struct sys_mlockall_args ua;
2542
2543 NETBSD32TO64_UAP(flags);
2544 return (sys_mlockall(l, &ua, retval));
2545 }
2546
2547 int
2548 netbsd32___clone(struct lwp *l, void *v, register_t *retval)
2549 {
2550 struct netbsd32___clone_args /* {
2551 syscallarg(int) flags;
2552 syscallarg(netbsd32_voidp) stack;
2553 } */ *uap = v;
2554 struct sys___clone_args ua;
2555
2556 NETBSD32TO64_UAP(flags);
2557 NETBSD32TOP_UAP(stack, void);
2558 return sys___clone(l, &ua, retval);
2559 }
2560