1 /* $NetBSD: netbsd32_netbsd.c,v 1.153 2009/01/21 10:01:42 tron Exp $ */
4 * Copyright (c) 1998, 2001, 2008 Matthew R. Green
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.153 2009/01/21 10:01:42 tron Exp $");
32 #if defined(_KERNEL_OPT)
35 #include "opt_compat_netbsd.h"
36 #include "opt_compat_43.h"
38 #include "opt_syscall_debug.h"
45 * Though COMPAT_OLDSOCK is needed only for COMPAT_43, SunOS, Linux,
46 * HP-UX, FreeBSD, Ultrix, OSF1, we define it unconditionally so that
47 * this would be module-safe.
49 #define COMPAT_OLDSOCK /* used by <sys/socket.h> */
51 #include <sys/param.h>
52 #include <sys/systm.h>
53 #include <sys/kernel.h>
54 //#define msg __msg /* Don't ask me! */
55 #include <sys/malloc.h>
56 #include <sys/mount.h>
57 #include <sys/socket.h>
58 #include <sys/sockio.h>
59 #include <sys/socketvar.h>
63 #include <sys/signalvar.h>
64 #include <sys/ptrace.h>
65 #include <sys/ktrace.h>
66 #include <sys/trace.h>
67 #include <sys/resourcevar.h>
69 #include <sys/vnode.h>
71 #include <sys/filedesc.h>
72 #include <sys/namei.h>
73 #include <sys/dirent.h>
74 #include <sys/kauth.h>
75 #include <sys/vfs_syscalls.h>
77 #include <uvm/uvm_extern.h>
80 #include <sys/savar.h>
81 #include <sys/syscallargs.h>
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 #include <compat/netbsd32/netbsd32_sa.h>
95 #include <machine/frame.h>
98 #include <ddb/ddbvar.h>
101 extern struct sysent netbsd32_sysent
[];
103 extern const char * const netbsd32_syscallnames
[];
105 #ifdef __HAVE_SYSCALL_INTERN
106 void netbsd32_syscall_intern(struct proc
*);
111 #define LIMITCHECK(a, b) ((a) != RLIM_INFINITY && (a) > (b))
114 extern char netbsd32_sigcode
[], netbsd32_esigcode
[];
115 struct uvm_object
*emul_netbsd32_object
;
118 extern struct sysctlnode netbsd32_sysctl_root
;
120 const struct sa_emul saemul_netbsd32
= {
121 sizeof(ucontext32_t
),
122 sizeof(struct netbsd32_sa_t
),
123 sizeof(netbsd32_sa_tp
),
127 (void (*)(struct lwp
*, void *))getucontext32_sa
,
135 struct emul emul_netbsd32
= {
138 #ifndef __HAVE_MINIMAL_EMUL
141 NETBSD32_SYS_netbsd32_syscall
,
142 NETBSD32_SYS_NSYSENT
,
146 netbsd32_syscallnames
,
156 &emul_netbsd32_object
,
168 #ifdef __HAVE_SYSCALL_INTERN
169 netbsd32_syscall_intern
,
173 &netbsd32_sysctl_root
,
176 netbsd32_vm_default_addr
,
183 sizeof(ucontext32_t
),
188 * below are all the standard NetBSD system calls, in the 32bit
189 * environment, with the necessary conversions to 64bit before
190 * calling the real syscall. anything that needs special
191 * attention is handled elsewhere.
195 netbsd32_exit(struct lwp
*l
, const struct netbsd32_exit_args
*uap
, register_t
*retval
)
198 syscallarg(int) rval;
200 struct sys_exit_args ua
;
202 NETBSD32TO64_UAP(rval
);
203 return sys_exit(l
, &ua
, retval
);
207 netbsd32_read(struct lwp
*l
, const struct netbsd32_read_args
*uap
, register_t
*retval
)
211 syscallarg(netbsd32_voidp) buf;
212 syscallarg(netbsd32_size_t) nbyte;
214 struct sys_read_args ua
;
216 NETBSD32TO64_UAP(fd
);
217 NETBSD32TOP_UAP(buf
, void *);
218 NETBSD32TOX_UAP(nbyte
, size_t);
219 return sys_read(l
, &ua
, retval
);
223 netbsd32_write(struct lwp
*l
, const struct netbsd32_write_args
*uap
, register_t
*retval
)
227 syscallarg(const netbsd32_voidp) buf;
228 syscallarg(netbsd32_size_t) nbyte;
230 struct sys_write_args ua
;
232 NETBSD32TO64_UAP(fd
);
233 NETBSD32TOP_UAP(buf
, void *);
234 NETBSD32TOX_UAP(nbyte
, size_t);
235 return sys_write(l
, &ua
, retval
);
239 netbsd32_close(struct lwp
*l
, const struct netbsd32_close_args
*uap
, register_t
*retval
)
244 struct sys_close_args ua
;
246 NETBSD32TO64_UAP(fd
);
247 return sys_close(l
, &ua
, retval
);
251 netbsd32_open(struct lwp
*l
, const struct netbsd32_open_args
*uap
, register_t
*retval
)
254 syscallarg(const netbsd32_charp) path;
255 syscallarg(int) flags;
256 syscallarg(mode_t) mode;
258 struct sys_open_args ua
;
260 NETBSD32TOP_UAP(path
, const char);
261 NETBSD32TO64_UAP(flags
);
262 NETBSD32TO64_UAP(mode
);
264 return (sys_open(l
, &ua
, retval
));
268 netbsd32_link(struct lwp
*l
, const struct netbsd32_link_args
*uap
, register_t
*retval
)
271 syscallarg(const netbsd32_charp) path;
272 syscallarg(const netbsd32_charp) link;
274 struct sys_link_args ua
;
276 NETBSD32TOP_UAP(path
, const char);
277 NETBSD32TOP_UAP(link
, const char);
278 return (sys_link(l
, &ua
, retval
));
282 netbsd32_unlink(struct lwp
*l
, const struct netbsd32_unlink_args
*uap
, register_t
*retval
)
285 syscallarg(const netbsd32_charp) path;
287 struct sys_unlink_args ua
;
289 NETBSD32TOP_UAP(path
, const char);
291 return (sys_unlink(l
, &ua
, retval
));
295 netbsd32_chdir(struct lwp
*l
, const struct netbsd32_chdir_args
*uap
, register_t
*retval
)
298 syscallarg(const netbsd32_charp) path;
300 struct sys_chdir_args ua
;
302 NETBSD32TOP_UAP(path
, const char);
304 return (sys_chdir(l
, &ua
, retval
));
308 netbsd32_fchdir(struct lwp
*l
, const struct netbsd32_fchdir_args
*uap
, register_t
*retval
)
313 struct sys_fchdir_args ua
;
315 NETBSD32TO64_UAP(fd
);
317 return (sys_fchdir(l
, &ua
, retval
));
321 netbsd32___mknod50(struct lwp
*l
, const struct netbsd32___mknod50_args
*uap
, register_t
*retval
)
324 syscallarg(const netbsd32_charp) path;
325 syscallarg(mode_t) mode;
326 syscallarg(dev_t) dev;
329 return do_sys_mknod(l
, SCARG_P32(uap
, path
), SCARG(uap
, mode
),
330 SCARG(uap
, dev
), retval
);
334 netbsd32_chmod(struct lwp
*l
, const struct netbsd32_chmod_args
*uap
, register_t
*retval
)
337 syscallarg(const netbsd32_charp) path;
338 syscallarg(mode_t) mode;
340 struct sys_chmod_args ua
;
342 NETBSD32TOP_UAP(path
, const char);
343 NETBSD32TO64_UAP(mode
);
345 return (sys_chmod(l
, &ua
, retval
));
349 netbsd32_chown(struct lwp
*l
, const struct netbsd32_chown_args
*uap
, register_t
*retval
)
352 syscallarg(const netbsd32_charp) path;
353 syscallarg(uid_t) uid;
354 syscallarg(gid_t) gid;
356 struct sys_chown_args ua
;
358 NETBSD32TOP_UAP(path
, const char);
359 NETBSD32TO64_UAP(uid
);
360 NETBSD32TO64_UAP(gid
);
362 return (sys_chown(l
, &ua
, retval
));
366 netbsd32_break(struct lwp
*l
, const struct netbsd32_break_args
*uap
, register_t
*retval
)
369 syscallarg(netbsd32_charp) nsize;
371 struct sys_obreak_args ua
;
373 SCARG(&ua
, nsize
) = SCARG_P32(uap
, nsize
);
374 NETBSD32TOP_UAP(nsize
, char);
375 return (sys_obreak(l
, &ua
, retval
));
379 netbsd32_mount(struct lwp
*l
, const struct netbsd32_mount_args
*uap
, register_t
*retval
)
383 syscallarg(const netbsd32_charp) type;
384 syscallarg(const netbsd32_charp) path;
385 syscallarg(int) flags;
386 syscallarg(netbsd32_voidp) data;
388 struct compat_40_sys_mount_args ua
;
390 NETBSD32TOP_UAP(type
, const char);
391 NETBSD32TOP_UAP(path
, const char);
392 NETBSD32TO64_UAP(flags
);
393 NETBSD32TOP_UAP(data
, void);
394 return (compat_40_sys_mount(l
, &ua
, retval
));
401 netbsd32_unmount(struct lwp
*l
, const struct netbsd32_unmount_args
*uap
, register_t
*retval
)
404 syscallarg(const netbsd32_charp) path;
405 syscallarg(int) flags;
407 struct sys_unmount_args ua
;
409 NETBSD32TOP_UAP(path
, const char);
410 NETBSD32TO64_UAP(flags
);
411 return (sys_unmount(l
, &ua
, retval
));
415 netbsd32_setuid(struct lwp
*l
, const struct netbsd32_setuid_args
*uap
, register_t
*retval
)
418 syscallarg(uid_t) uid;
420 struct sys_setuid_args ua
;
422 NETBSD32TO64_UAP(uid
);
423 return (sys_setuid(l
, &ua
, retval
));
427 netbsd32_ptrace(struct lwp
*l
, const struct netbsd32_ptrace_args
*uap
, register_t
*retval
)
431 syscallarg(pid_t) pid;
432 syscallarg(netbsd32_voidp) addr;
433 syscallarg(int) data;
435 struct sys_ptrace_args ua
;
437 NETBSD32TO64_UAP(req
);
438 NETBSD32TO64_UAP(pid
);
439 NETBSD32TOP_UAP(addr
, void *);
440 NETBSD32TO64_UAP(data
);
442 return (*sysent
[SYS_ptrace
].sy_call
)(l
, &ua
, retval
);
446 netbsd32_accept(struct lwp
*l
, const struct netbsd32_accept_args
*uap
, register_t
*retval
)
450 syscallarg(netbsd32_sockaddrp_t) name;
451 syscallarg(netbsd32_intp) anamelen;
453 struct sys_accept_args ua
;
456 NETBSD32TOP_UAP(name
, struct sockaddr
);
457 NETBSD32TOP_UAP(anamelen
, socklen_t
);
458 return (sys_accept(l
, &ua
, retval
));
462 netbsd32_getpeername(struct lwp
*l
, const struct netbsd32_getpeername_args
*uap
, register_t
*retval
)
465 syscallarg(int) fdes;
466 syscallarg(netbsd32_sockaddrp_t) asa;
467 syscallarg(netbsd32_intp) alen;
469 struct sys_getpeername_args ua
;
471 NETBSD32TO64_UAP(fdes
);
472 NETBSD32TOP_UAP(asa
, struct sockaddr
);
473 NETBSD32TOP_UAP(alen
, socklen_t
);
474 /* NB: do the protocol specific sockaddrs need to be converted? */
475 return (sys_getpeername(l
, &ua
, retval
));
479 netbsd32_getsockname(struct lwp
*l
, const struct netbsd32_getsockname_args
*uap
, register_t
*retval
)
482 syscallarg(int) fdes;
483 syscallarg(netbsd32_sockaddrp_t) asa;
484 syscallarg(netbsd32_intp) alen;
486 struct sys_getsockname_args ua
;
488 NETBSD32TO64_UAP(fdes
);
489 NETBSD32TOP_UAP(asa
, struct sockaddr
);
490 NETBSD32TOP_UAP(alen
, socklen_t
);
491 return (sys_getsockname(l
, &ua
, retval
));
495 netbsd32_access(struct lwp
*l
, const struct netbsd32_access_args
*uap
, register_t
*retval
)
498 syscallarg(const netbsd32_charp) path;
499 syscallarg(int) flags;
501 struct sys_access_args ua
;
503 NETBSD32TOP_UAP(path
, const char);
504 NETBSD32TO64_UAP(flags
);
506 return sys_access(l
, &ua
, retval
);
510 netbsd32_chflags(struct lwp
*l
, const struct netbsd32_chflags_args
*uap
, register_t
*retval
)
513 syscallarg(const netbsd32_charp) path;
514 syscallarg(netbsd32_u_long) flags;
516 struct sys_chflags_args ua
;
518 NETBSD32TOP_UAP(path
, const char);
519 NETBSD32TO64_UAP(flags
);
521 return (sys_chflags(l
, &ua
, retval
));
525 netbsd32_fchflags(struct lwp
*l
, const struct netbsd32_fchflags_args
*uap
, register_t
*retval
)
529 syscallarg(netbsd32_u_long) flags;
531 struct sys_fchflags_args ua
;
533 NETBSD32TO64_UAP(fd
);
534 NETBSD32TO64_UAP(flags
);
536 return (sys_fchflags(l
, &ua
, retval
));
540 netbsd32_lchflags(struct lwp
*l
, const struct netbsd32_lchflags_args
*uap
, register_t
*retval
)
543 syscallarg(const char *) path;
544 syscallarg(netbsd32_u_long) flags;
546 struct sys_lchflags_args ua
;
548 NETBSD32TOP_UAP(path
, const char);
549 NETBSD32TO64_UAP(flags
);
551 return (sys_lchflags(l
, &ua
, retval
));
555 netbsd32_kill(struct lwp
*l
, const struct netbsd32_kill_args
*uap
, register_t
*retval
)
559 syscallarg(int) signum;
561 struct sys_kill_args ua
;
563 NETBSD32TO64_UAP(pid
);
564 NETBSD32TO64_UAP(signum
);
566 return (sys_kill(l
, &ua
, retval
));
570 netbsd32_dup(struct lwp
*l
, const struct netbsd32_dup_args
*uap
, register_t
*retval
)
575 struct sys_dup_args ua
;
577 NETBSD32TO64_UAP(fd
);
579 return (sys_dup(l
, &ua
, retval
));
583 netbsd32_profil(struct lwp
*l
, const struct netbsd32_profil_args
*uap
, register_t
*retval
)
586 syscallarg(netbsd32_voidp) samples;
587 syscallarg(netbsd32_size_t) size;
588 syscallarg(netbsd32_u_long) offset;
589 syscallarg(u_int) scale;
591 struct sys_profil_args ua
;
593 NETBSD32TOP_UAP(samples
, void *);
594 NETBSD32TOX_UAP(size
, size_t);
595 NETBSD32TOX_UAP(offset
, u_long
);
596 NETBSD32TO64_UAP(scale
);
597 return (sys_profil(l
, &ua
, retval
));
601 netbsd32_ktrace(struct lwp
*l
, const struct netbsd32_ktrace_args
*uap
, register_t
*retval
)
604 syscallarg(const netbsd32_charp) fname;
606 syscallarg(int) facs;
609 struct sys_ktrace_args ua
;
611 NETBSD32TOP_UAP(fname
, const char);
612 NETBSD32TO64_UAP(ops
);
613 NETBSD32TO64_UAP(facs
);
614 NETBSD32TO64_UAP(pid
);
615 return (sys_ktrace(l
, &ua
, retval
));
619 netbsd32_utrace(struct lwp
*l
, const struct netbsd32_utrace_args
*uap
, register_t
*retval
)
622 syscallarg(const netbsd32_charp) label;
623 syscallarg(netbsd32_voidp) addr;
624 syscallarg(netbsd32_size_t) len;
626 struct sys_utrace_args ua
;
628 NETBSD32TOP_UAP(label
, const char);
629 NETBSD32TOP_UAP(addr
, void);
630 NETBSD32TO64_UAP(len
);
631 return (sys_utrace(l
, &ua
, retval
));
635 netbsd32___getlogin(struct lwp
*l
, const struct netbsd32___getlogin_args
*uap
, register_t
*retval
)
638 syscallarg(netbsd32_charp) namebuf;
639 syscallarg(u_int) namelen;
641 struct sys___getlogin_args ua
;
643 NETBSD32TOP_UAP(namebuf
, char);
644 NETBSD32TO64_UAP(namelen
);
645 return (sys___getlogin(l
, &ua
, retval
));
649 netbsd32_setlogin(struct lwp
*l
, const struct netbsd32_setlogin_args
*uap
, register_t
*retval
)
652 syscallarg(const netbsd32_charp) namebuf;
654 struct sys___setlogin_args ua
;
656 NETBSD32TOP_UAP(namebuf
, char);
657 return (sys___setlogin(l
, &ua
, retval
));
661 netbsd32_acct(struct lwp
*l
, const struct netbsd32_acct_args
*uap
, register_t
*retval
)
664 syscallarg(const netbsd32_charp) path;
666 struct sys_acct_args ua
;
668 NETBSD32TOP_UAP(path
, const char);
669 return (sys_acct(l
, &ua
, retval
));
673 netbsd32_revoke(struct lwp
*l
, const struct netbsd32_revoke_args
*uap
, register_t
*retval
)
676 syscallarg(const netbsd32_charp) path;
678 struct sys_revoke_args ua
;
680 NETBSD32TOP_UAP(path
, const char);
682 return (sys_revoke(l
, &ua
, retval
));
686 netbsd32_symlink(struct lwp
*l
, const struct netbsd32_symlink_args
*uap
, register_t
*retval
)
689 syscallarg(const netbsd32_charp) path;
690 syscallarg(const netbsd32_charp) link;
692 struct sys_symlink_args ua
;
694 NETBSD32TOP_UAP(path
, const char);
695 NETBSD32TOP_UAP(link
, const char);
697 return (sys_symlink(l
, &ua
, retval
));
701 netbsd32_readlink(struct lwp
*l
, const struct netbsd32_readlink_args
*uap
, register_t
*retval
)
704 syscallarg(const netbsd32_charp) path;
705 syscallarg(netbsd32_charp) buf;
706 syscallarg(netbsd32_size_t) count;
708 struct sys_readlink_args ua
;
710 NETBSD32TOP_UAP(path
, const char);
711 NETBSD32TOP_UAP(buf
, char);
712 NETBSD32TOX_UAP(count
, size_t);
714 return (sys_readlink(l
, &ua
, retval
));
718 netbsd32_umask(struct lwp
*l
, const struct netbsd32_umask_args
*uap
, register_t
*retval
)
721 syscallarg(mode_t) newmask;
723 struct sys_umask_args ua
;
725 NETBSD32TO64_UAP(newmask
);
726 return (sys_umask(l
, &ua
, retval
));
730 netbsd32_chroot(struct lwp
*l
, const struct netbsd32_chroot_args
*uap
, register_t
*retval
)
733 syscallarg(const netbsd32_charp) path;
735 struct sys_chroot_args ua
;
737 NETBSD32TOP_UAP(path
, const char);
738 return (sys_chroot(l
, &ua
, retval
));
742 netbsd32_sbrk(struct lwp
*l
, const struct netbsd32_sbrk_args
*uap
, register_t
*retval
)
745 syscallarg(int) incr;
747 struct sys_sbrk_args ua
;
749 NETBSD32TO64_UAP(incr
);
750 return (sys_sbrk(l
, &ua
, retval
));
754 netbsd32_sstk(struct lwp
*l
, const struct netbsd32_sstk_args
*uap
, register_t
*retval
)
757 syscallarg(int) incr;
759 struct sys_sstk_args ua
;
761 NETBSD32TO64_UAP(incr
);
762 return (sys_sstk(l
, &ua
, retval
));
766 netbsd32_munmap(struct lwp
*l
, const struct netbsd32_munmap_args
*uap
, register_t
*retval
)
769 syscallarg(netbsd32_voidp) addr;
770 syscallarg(netbsd32_size_t) len;
772 struct sys_munmap_args ua
;
774 NETBSD32TOP_UAP(addr
, void);
775 NETBSD32TOX_UAP(len
, size_t);
776 return (sys_munmap(l
, &ua
, retval
));
780 netbsd32_mprotect(struct lwp
*l
, const struct netbsd32_mprotect_args
*uap
, register_t
*retval
)
783 syscallarg(netbsd32_voidp) addr;
784 syscallarg(netbsd32_size_t) len;
785 syscallarg(int) prot;
787 struct sys_mprotect_args ua
;
789 NETBSD32TOP_UAP(addr
, void);
790 NETBSD32TOX_UAP(len
, size_t);
791 NETBSD32TO64_UAP(prot
);
792 return (sys_mprotect(l
, &ua
, retval
));
796 netbsd32_madvise(struct lwp
*l
, const struct netbsd32_madvise_args
*uap
, register_t
*retval
)
799 syscallarg(netbsd32_voidp) addr;
800 syscallarg(netbsd32_size_t) len;
801 syscallarg(int) behav;
803 struct sys_madvise_args ua
;
805 NETBSD32TOP_UAP(addr
, void);
806 NETBSD32TOX_UAP(len
, size_t);
807 NETBSD32TO64_UAP(behav
);
808 return (sys_madvise(l
, &ua
, retval
));
812 netbsd32_mincore(struct lwp
*l
, const struct netbsd32_mincore_args
*uap
, register_t
*retval
)
815 syscallarg(netbsd32_voidp) addr;
816 syscallarg(netbsd32_size_t) len;
817 syscallarg(netbsd32_charp) vec;
819 struct sys_mincore_args ua
;
821 NETBSD32TOP_UAP(addr
, void *);
822 NETBSD32TOX_UAP(len
, size_t);
823 NETBSD32TOP_UAP(vec
, char);
824 return (sys_mincore(l
, &ua
, retval
));
827 /* XXX MOVE ME XXX ? */
829 netbsd32_getgroups(struct lwp
*l
, const struct netbsd32_getgroups_args
*uap
, register_t
*retval
)
832 syscallarg(int) gidsetsize;
833 syscallarg(netbsd32_gid_tp) gidset;
835 struct sys_getgroups_args ua
;
837 /* Since sizeof (gid_t) == sizeof (netbsd32_gid_t) ... */
839 NETBSD32TO64_UAP(gidsetsize
);
840 NETBSD32TOP_UAP(gidset
, gid_t
);
841 return (sys_getgroups(l
, &ua
, retval
));
845 netbsd32_setgroups(struct lwp
*l
, const struct netbsd32_setgroups_args
*uap
, register_t
*retval
)
848 syscallarg(int) gidsetsize;
849 syscallarg(const netbsd32_gid_tp) gidset;
851 struct sys_setgroups_args ua
;
853 NETBSD32TO64_UAP(gidsetsize
);
854 NETBSD32TOP_UAP(gidset
, gid_t
);
855 return (sys_setgroups(l
, &ua
, retval
));
859 netbsd32_setpgid(struct lwp
*l
, const struct netbsd32_setpgid_args
*uap
, register_t
*retval
)
863 syscallarg(int) pgid;
865 struct sys_setpgid_args ua
;
867 NETBSD32TO64_UAP(pid
);
868 NETBSD32TO64_UAP(pgid
);
869 return (sys_setpgid(l
, &ua
, retval
));
873 netbsd32_fcntl(struct lwp
*l
, const struct netbsd32_fcntl_args
*uap
, register_t
*retval
)
878 syscallarg(netbsd32_voidp) arg;
880 struct sys_fcntl_args ua
;
882 NETBSD32TO64_UAP(fd
);
883 NETBSD32TO64_UAP(cmd
);
884 NETBSD32TOP_UAP(arg
, void);
885 /* we can do this because `struct flock' doesn't change */
886 return (sys_fcntl(l
, &ua
, retval
));
890 netbsd32_dup2(struct lwp
*l
, const struct netbsd32_dup2_args
*uap
, register_t
*retval
)
893 syscallarg(int) from;
896 struct sys_dup2_args ua
;
898 NETBSD32TO64_UAP(from
);
899 NETBSD32TO64_UAP(to
);
900 return (sys_dup2(l
, &ua
, retval
));
904 netbsd32_fsync(struct lwp
*l
, const struct netbsd32_fsync_args
*uap
, register_t
*retval
)
909 struct sys_fsync_args ua
;
911 NETBSD32TO64_UAP(fd
);
912 return (sys_fsync(l
, &ua
, retval
));
916 netbsd32_setpriority(struct lwp
*l
, const struct netbsd32_setpriority_args
*uap
, register_t
*retval
)
919 syscallarg(int) which;
921 syscallarg(int) prio;
923 struct sys_setpriority_args ua
;
925 NETBSD32TO64_UAP(which
);
926 NETBSD32TO64_UAP(who
);
927 NETBSD32TO64_UAP(prio
);
928 return (sys_setpriority(l
, &ua
, retval
));
932 netbsd32___socket30(struct lwp
*l
, const struct netbsd32___socket30_args
*uap
, register_t
*retval
)
935 syscallarg(int) domain;
936 syscallarg(int) type;
937 syscallarg(int) protocol;
939 struct sys___socket30_args ua
;
941 NETBSD32TO64_UAP(domain
);
942 NETBSD32TO64_UAP(type
);
943 NETBSD32TO64_UAP(protocol
);
944 return (sys___socket30(l
, &ua
, retval
));
948 netbsd32_connect(struct lwp
*l
, const struct netbsd32_connect_args
*uap
, register_t
*retval
)
952 syscallarg(const netbsd32_sockaddrp_t) name;
953 syscallarg(int) namelen;
955 struct sys_connect_args ua
;
958 NETBSD32TOP_UAP(name
, struct sockaddr
);
959 NETBSD32TO64_UAP(namelen
);
960 return (sys_connect(l
, &ua
, retval
));
964 netbsd32_getpriority(struct lwp
*l
, const struct netbsd32_getpriority_args
*uap
, register_t
*retval
)
967 syscallarg(int) which;
970 struct sys_getpriority_args ua
;
972 NETBSD32TO64_UAP(which
);
973 NETBSD32TO64_UAP(who
);
974 return (sys_getpriority(l
, &ua
, retval
));
978 netbsd32_bind(struct lwp
*l
, const struct netbsd32_bind_args
*uap
, register_t
*retval
)
982 syscallarg(const netbsd32_sockaddrp_t) name;
983 syscallarg(int) namelen;
985 struct sys_bind_args ua
;
988 NETBSD32TOP_UAP(name
, struct sockaddr
);
989 NETBSD32TO64_UAP(namelen
);
990 return (sys_bind(l
, &ua
, retval
));
994 netbsd32_setsockopt(struct lwp
*l
, const struct netbsd32_setsockopt_args
*uap
, register_t
*retval
)
998 syscallarg(int) level;
999 syscallarg(int) name;
1000 syscallarg(const netbsd32_voidp) val;
1001 syscallarg(int) valsize;
1003 struct sys_setsockopt_args ua
;
1005 NETBSD32TO64_UAP(s
);
1006 NETBSD32TO64_UAP(level
);
1007 NETBSD32TO64_UAP(name
);
1008 NETBSD32TOP_UAP(val
, void);
1009 NETBSD32TO64_UAP(valsize
);
1010 /* may be more efficient to do this inline. */
1011 return (sys_setsockopt(l
, &ua
, retval
));
1015 netbsd32_listen(struct lwp
*l
, const struct netbsd32_listen_args
*uap
, register_t
*retval
)
1019 syscallarg(int) backlog;
1021 struct sys_listen_args ua
;
1023 NETBSD32TO64_UAP(s
);
1024 NETBSD32TO64_UAP(backlog
);
1025 return (sys_listen(l
, &ua
, retval
));
1029 netbsd32_fchown(struct lwp
*l
, const struct netbsd32_fchown_args
*uap
, register_t
*retval
)
1033 syscallarg(uid_t) uid;
1034 syscallarg(gid_t) gid;
1036 struct sys_fchown_args ua
;
1038 NETBSD32TO64_UAP(fd
);
1039 NETBSD32TO64_UAP(uid
);
1040 NETBSD32TO64_UAP(gid
);
1041 return (sys_fchown(l
, &ua
, retval
));
1045 netbsd32_fchmod(struct lwp
*l
, const struct netbsd32_fchmod_args
*uap
, register_t
*retval
)
1049 syscallarg(mode_t) mode;
1051 struct sys_fchmod_args ua
;
1053 NETBSD32TO64_UAP(fd
);
1054 NETBSD32TO64_UAP(mode
);
1055 return (sys_fchmod(l
, &ua
, retval
));
1059 netbsd32_setreuid(struct lwp
*l
, const struct netbsd32_setreuid_args
*uap
, register_t
*retval
)
1062 syscallarg(uid_t) ruid;
1063 syscallarg(uid_t) euid;
1065 struct sys_setreuid_args ua
;
1067 NETBSD32TO64_UAP(ruid
);
1068 NETBSD32TO64_UAP(euid
);
1069 return (sys_setreuid(l
, &ua
, retval
));
1073 netbsd32_setregid(struct lwp
*l
, const struct netbsd32_setregid_args
*uap
, register_t
*retval
)
1076 syscallarg(gid_t) rgid;
1077 syscallarg(gid_t) egid;
1079 struct sys_setregid_args ua
;
1081 NETBSD32TO64_UAP(rgid
);
1082 NETBSD32TO64_UAP(egid
);
1083 return (sys_setregid(l
, &ua
, retval
));
1087 netbsd32_getsockopt(struct lwp
*l
, const struct netbsd32_getsockopt_args
*uap
, register_t
*retval
)
1091 syscallarg(int) level;
1092 syscallarg(int) name;
1093 syscallarg(netbsd32_voidp) val;
1094 syscallarg(netbsd32_intp) avalsize;
1096 struct sys_getsockopt_args ua
;
1098 NETBSD32TO64_UAP(s
);
1099 NETBSD32TO64_UAP(level
);
1100 NETBSD32TO64_UAP(name
);
1101 NETBSD32TOP_UAP(val
, void);
1102 NETBSD32TOP_UAP(avalsize
, socklen_t
);
1103 return (sys_getsockopt(l
, &ua
, retval
));
1107 netbsd32_rename(struct lwp
*l
, const struct netbsd32_rename_args
*uap
, register_t
*retval
)
1110 syscallarg(const netbsd32_charp) from;
1111 syscallarg(const netbsd32_charp) to;
1113 struct sys_rename_args ua
;
1115 NETBSD32TOP_UAP(from
, const char);
1116 NETBSD32TOP_UAP(to
, const char)
1118 return (sys_rename(l
, &ua
, retval
));
1122 netbsd32_flock(struct lwp
*l
, const struct netbsd32_flock_args
*uap
, register_t
*retval
)
1126 syscallarg(int) how;
1128 struct sys_flock_args ua
;
1130 NETBSD32TO64_UAP(fd
);
1131 NETBSD32TO64_UAP(how
)
1133 return (sys_flock(l
, &ua
, retval
));
1137 netbsd32_mkfifo(struct lwp
*l
, const struct netbsd32_mkfifo_args
*uap
, register_t
*retval
)
1140 syscallarg(const netbsd32_charp) path;
1141 syscallarg(mode_t) mode;
1143 struct sys_mkfifo_args ua
;
1145 NETBSD32TOP_UAP(path
, const char)
1146 NETBSD32TO64_UAP(mode
);
1147 return (sys_mkfifo(l
, &ua
, retval
));
1151 netbsd32_shutdown(struct lwp
*l
, const struct netbsd32_shutdown_args
*uap
, register_t
*retval
)
1155 syscallarg(int) how;
1157 struct sys_shutdown_args ua
;
1160 NETBSD32TO64_UAP(how
);
1161 return (sys_shutdown(l
, &ua
, retval
));
1165 netbsd32_socketpair(struct lwp
*l
, const struct netbsd32_socketpair_args
*uap
, register_t
*retval
)
1168 syscallarg(int) domain;
1169 syscallarg(int) type;
1170 syscallarg(int) protocol;
1171 syscallarg(netbsd32_intp) rsv;
1173 struct sys_socketpair_args ua
;
1175 NETBSD32TO64_UAP(domain
);
1176 NETBSD32TO64_UAP(type
);
1177 NETBSD32TO64_UAP(protocol
);
1178 NETBSD32TOP_UAP(rsv
, int);
1179 /* Since we're just copying out two `int's we can do this */
1180 return (sys_socketpair(l
, &ua
, retval
));
1184 netbsd32_mkdir(struct lwp
*l
, const struct netbsd32_mkdir_args
*uap
, register_t
*retval
)
1187 syscallarg(const netbsd32_charp) path;
1188 syscallarg(mode_t) mode;
1190 struct sys_mkdir_args ua
;
1192 NETBSD32TOP_UAP(path
, const char)
1193 NETBSD32TO64_UAP(mode
);
1194 return (sys_mkdir(l
, &ua
, retval
));
1198 netbsd32_rmdir(struct lwp
*l
, const struct netbsd32_rmdir_args
*uap
, register_t
*retval
)
1201 syscallarg(const netbsd32_charp) path;
1203 struct sys_rmdir_args ua
;
1205 NETBSD32TOP_UAP(path
, const char);
1206 return (sys_rmdir(l
, &ua
, retval
));
1210 netbsd32_quotactl(struct lwp
*l
, const struct netbsd32_quotactl_args
*uap
, register_t
*retval
)
1213 syscallarg(const netbsd32_charp) path;
1214 syscallarg(int) cmd;
1215 syscallarg(int) uid;
1216 syscallarg(netbsd32_voidp) arg;
1218 struct sys_quotactl_args ua
;
1220 NETBSD32TOP_UAP(path
, const char);
1221 NETBSD32TO64_UAP(cmd
);
1222 NETBSD32TO64_UAP(uid
);
1223 NETBSD32TOP_UAP(arg
, void *);
1224 return (sys_quotactl(l
, &ua
, retval
));
1228 netbsd32_nfssvc(struct lwp
*l
, const struct netbsd32_nfssvc_args
*uap
, register_t
*retval
)
1232 syscallarg(int) flag;
1233 syscallarg(netbsd32_voidp) argp;
1235 struct sys_nfssvc_args ua
;
1237 NETBSD32TO64_UAP(flag
);
1238 NETBSD32TOP_UAP(argp
, void);
1239 return (sys_nfssvc(l
, &ua
, retval
));
1241 /* Why would we want to support a 32-bit nfsd? */
1247 netbsd32___getfh30(struct lwp
*l
, const struct netbsd32___getfh30_args
*uap
, register_t
*retval
)
1250 syscallarg(const netbsd32_charp) fname;
1251 syscallarg(netbsd32_fhandlep_t) fhp;
1252 syscallarg(netbsd32_size_tp) fh_size;
1257 struct nameidata nd
;
1258 netbsd32_size_t sz32
;
1262 * Must be super user
1264 error
= kauth_authorize_system(l
->l_cred
, KAUTH_SYSTEM_FILEHANDLE
,
1265 0, NULL
, NULL
, NULL
);
1269 NDINIT(&nd
, LOOKUP
, FOLLOW
| LOCKLEAF
| TRYEMULROOT
, UIO_USERSPACE
,
1270 SCARG_P32(uap
, fname
));
1275 error
= copyin(SCARG_P32(uap
, fh_size
), &sz32
,
1276 sizeof(netbsd32_size_t
));
1278 fh
= malloc(sz32
, M_TEMP
, M_WAITOK
);
1282 error
= vfs_composefh(vp
, fh
, &sz
);
1287 copyout(&sz
, SCARG_P32(uap
, fh_size
), sizeof(size_t));
1289 error
= copyout(&sz32
, SCARG_P32(uap
, fh_size
),
1290 sizeof(netbsd32_size_t
));
1292 error
= copyout(fh
, SCARG_P32(uap
, fhp
), sz
);
1299 netbsd32_pread(struct lwp
*l
, const struct netbsd32_pread_args
*uap
, register_t
*retval
)
1303 syscallarg(netbsd32_voidp) buf;
1304 syscallarg(netbsd32_size_t) nbyte;
1305 syscallarg(int) pad;
1306 syscallarg(off_t) offset;
1308 struct sys_pread_args ua
;
1310 NETBSD32TO64_UAP(fd
);
1311 NETBSD32TOP_UAP(buf
, void);
1312 NETBSD32TOX_UAP(nbyte
, size_t);
1313 NETBSD32TO64_UAP(pad
);
1314 NETBSD32TO64_UAP(offset
);
1315 return sys_pread(l
, &ua
, retval
);
1319 netbsd32_pwrite(struct lwp
*l
, const struct netbsd32_pwrite_args
*uap
, register_t
*retval
)
1323 syscallarg(const netbsd32_voidp) buf;
1324 syscallarg(netbsd32_size_t) nbyte;
1325 syscallarg(int) pad;
1326 syscallarg(off_t) offset;
1328 struct sys_pwrite_args ua
;
1330 NETBSD32TO64_UAP(fd
);
1331 NETBSD32TOP_UAP(buf
, void);
1332 NETBSD32TOX_UAP(nbyte
, size_t);
1333 NETBSD32TO64_UAP(pad
);
1334 NETBSD32TO64_UAP(offset
);
1335 return sys_pwrite(l
, &ua
, retval
);
1339 netbsd32_setgid(struct lwp
*l
, const struct netbsd32_setgid_args
*uap
, register_t
*retval
)
1342 syscallarg(gid_t) gid;
1344 struct sys_setgid_args ua
;
1346 NETBSD32TO64_UAP(gid
);
1347 return (sys_setgid(l
, &ua
, retval
));
1351 netbsd32_setegid(struct lwp
*l
, const struct netbsd32_setegid_args
*uap
, register_t
*retval
)
1354 syscallarg(gid_t) egid;
1356 struct sys_setegid_args ua
;
1358 NETBSD32TO64_UAP(egid
);
1359 return (sys_setegid(l
, &ua
, retval
));
1363 netbsd32_seteuid(struct lwp
*l
, const struct netbsd32_seteuid_args
*uap
, register_t
*retval
)
1366 syscallarg(gid_t) euid;
1368 struct sys_seteuid_args ua
;
1370 NETBSD32TO64_UAP(euid
);
1371 return (sys_seteuid(l
, &ua
, retval
));
1376 netbsd32_lfs_bmapv(struct lwp
*l
, const struct netbsd32_lfs_bmapv_args
*v
, register_t
*retval
)
1379 return (ENOSYS
); /* XXX */
1383 netbsd32_lfs_markv(struct lwp
*l
, const struct netbsd32_lfs_markv_args
*v
, register_t
*retval
)
1386 return (ENOSYS
); /* XXX */
1390 netbsd32_lfs_segclean(struct lwp
*l
, const struct netbsd32_lfs_segclean_args
*v
, register_t
*retval
)
1393 return (ENOSYS
); /* XXX */
1397 netbsd32___lfs_segwait50(struct lwp
*l
, const struct netbsd32___lfs_segwait50_args
*v
, register_t
*retval
)
1400 return (ENOSYS
); /* XXX */
1405 netbsd32_pathconf(struct lwp
*l
, const struct netbsd32_pathconf_args
*uap
, register_t
*retval
)
1409 syscallarg(int) name;
1411 struct sys_pathconf_args ua
;
1413 NETBSD32TOP_UAP(path
, const char);
1414 NETBSD32TO64_UAP(name
);
1415 return sys_pathconf(l
, &ua
, retval
);
1419 netbsd32_fpathconf(struct lwp
*l
, const struct netbsd32_fpathconf_args
*uap
, register_t
*retval
)
1423 syscallarg(int) name;
1425 struct sys_fpathconf_args ua
;
1427 NETBSD32TO64_UAP(fd
);
1428 NETBSD32TO64_UAP(name
);
1429 return sys_fpathconf(l
, &ua
, retval
);
1433 netbsd32_getrlimit(struct lwp
*l
, const struct netbsd32_getrlimit_args
*uap
, register_t
*retval
)
1436 syscallarg(int) which;
1437 syscallarg(netbsd32_rlimitp_t) rlp;
1439 int which
= SCARG(uap
, which
);
1441 if ((u_int
)which
>= RLIM_NLIMITS
)
1443 return (copyout(&l
->l_proc
->p_rlimit
[which
],
1444 SCARG_P32(uap
, rlp
), sizeof(struct rlimit
)));
1448 netbsd32_setrlimit(struct lwp
*l
, const struct netbsd32_setrlimit_args
*uap
, register_t
*retval
)
1451 syscallarg(int) which;
1452 syscallarg(const netbsd32_rlimitp_t) rlp;
1454 int which
= SCARG(uap
, which
);
1458 error
= copyin(SCARG_P32(uap
, rlp
), &alim
, sizeof(struct rlimit
));
1464 if (LIMITCHECK(alim
.rlim_cur
, MAXDSIZ32
))
1465 alim
.rlim_cur
= MAXDSIZ32
;
1466 if (LIMITCHECK(alim
.rlim_max
, MAXDSIZ32
))
1467 alim
.rlim_max
= MAXDSIZ32
;
1471 if (LIMITCHECK(alim
.rlim_cur
, MAXSSIZ32
))
1472 alim
.rlim_cur
= MAXSSIZ32
;
1473 if (LIMITCHECK(alim
.rlim_max
, MAXSSIZ32
))
1474 alim
.rlim_max
= MAXSSIZ32
;
1479 return (dosetrlimit(l
, l
->l_proc
, which
, &alim
));
1483 netbsd32_mmap(struct lwp
*l
, const struct netbsd32_mmap_args
*uap
, register_t
*retval
)
1486 syscallarg(netbsd32_voidp) addr;
1487 syscallarg(netbsd32_size_t) len;
1488 syscallarg(int) prot;
1489 syscallarg(int) flags;
1491 syscallarg(netbsd32_long) pad;
1492 syscallarg(off_t) pos;
1494 struct sys_mmap_args ua
;
1497 NETBSD32TOP_UAP(addr
, void);
1498 NETBSD32TOX_UAP(len
, size_t);
1499 NETBSD32TO64_UAP(prot
);
1500 NETBSD32TO64_UAP(flags
);
1501 NETBSD32TO64_UAP(fd
);
1502 NETBSD32TOX_UAP(pad
, long);
1503 NETBSD32TOX_UAP(pos
, off_t
);
1504 error
= sys_mmap(l
, &ua
, retval
);
1505 if ((u_long
)*retval
> (u_long
)UINT_MAX
) {
1506 printf("netbsd32_mmap: retval out of range: 0x%lx",
1508 /* Should try to recover and return an error here. */
1514 netbsd32_mremap(struct lwp
*l
, const struct netbsd32_mremap_args
*uap
, register_t
*retval
)
1517 syscallarg(void *) old_address;
1518 syscallarg(size_t) old_size;
1519 syscallarg(void *) new_address;
1520 syscallarg(size_t) new_size;
1521 syscallarg(int) flags;
1523 struct sys_mremap_args ua
;
1525 NETBSD32TOP_UAP(old_address
, void);
1526 NETBSD32TOX_UAP(old_size
, size_t);
1527 NETBSD32TOP_UAP(new_address
, void);
1528 NETBSD32TOX_UAP(new_size
, size_t);
1529 NETBSD32TO64_UAP(flags
);
1531 return sys_mremap(l
, &ua
, retval
);
1535 netbsd32_lseek(struct lwp
*l
, const struct netbsd32_lseek_args
*uap
, register_t
*retval
)
1539 syscallarg(int) pad;
1540 syscallarg(off_t) offset;
1541 syscallarg(int) whence;
1543 struct sys_lseek_args ua
;
1545 register_t retval64
[2];
1546 register32_t retval32
[4];
1550 NETBSD32TO64_UAP(fd
);
1551 NETBSD32TO64_UAP(pad
);
1552 NETBSD32TO64_UAP(offset
);
1553 NETBSD32TO64_UAP(whence
);
1554 rv
= sys_lseek(l
, &ua
, newpos
.retval64
);
1557 * We have to split the 64 bit value into 2 halves which will
1558 * end up in separate 32 bit registers.
1559 * This should DTRT on big and little-endian systems provided that
1560 * gcc's 'strict aliasing' tests don't decide that the retval32[]
1561 * entries can't have been assigned to, so need not be read!
1563 retval
[0] = newpos
.retval32
[0];
1564 retval
[1] = newpos
.retval32
[1];
1570 netbsd32_truncate(struct lwp
*l
, const struct netbsd32_truncate_args
*uap
, register_t
*retval
)
1573 syscallarg(const netbsd32_charp) path;
1574 syscallarg(int) pad;
1575 syscallarg(off_t) length;
1577 struct sys_truncate_args ua
;
1579 NETBSD32TOP_UAP(path
, const char);
1580 NETBSD32TO64_UAP(pad
);
1581 NETBSD32TO64_UAP(length
);
1582 return (sys_truncate(l
, &ua
, retval
));
1586 netbsd32_ftruncate(struct lwp
*l
, const struct netbsd32_ftruncate_args
*uap
, register_t
*retval
)
1590 syscallarg(int) pad;
1591 syscallarg(off_t) length;
1593 struct sys_ftruncate_args ua
;
1595 NETBSD32TO64_UAP(fd
);
1596 NETBSD32TO64_UAP(pad
);
1597 NETBSD32TO64_UAP(length
);
1598 return (sys_ftruncate(l
, &ua
, retval
));
1602 netbsd32_mlock(struct lwp
*l
, const struct netbsd32_mlock_args
*uap
, register_t
*retval
)
1605 syscallarg(const netbsd32_voidp) addr;
1606 syscallarg(netbsd32_size_t) len;
1608 struct sys_mlock_args ua
;
1610 NETBSD32TOP_UAP(addr
, const void);
1611 NETBSD32TO64_UAP(len
);
1612 return (sys_mlock(l
, &ua
, retval
));
1616 netbsd32_munlock(struct lwp
*l
, const struct netbsd32_munlock_args
*uap
, register_t
*retval
)
1619 syscallarg(const netbsd32_voidp) addr;
1620 syscallarg(netbsd32_size_t) len;
1622 struct sys_munlock_args ua
;
1624 NETBSD32TOP_UAP(addr
, const void);
1625 NETBSD32TO64_UAP(len
);
1626 return (sys_munlock(l
, &ua
, retval
));
1630 netbsd32_undelete(struct lwp
*l
, const struct netbsd32_undelete_args
*uap
, register_t
*retval
)
1633 syscallarg(const netbsd32_charp) path;
1635 struct sys_undelete_args ua
;
1637 NETBSD32TOP_UAP(path
, const char);
1638 return (sys_undelete(l
, &ua
, retval
));
1642 netbsd32_getpgid(struct lwp
*l
, const struct netbsd32_getpgid_args
*uap
, register_t
*retval
)
1645 syscallarg(pid_t) pid;
1647 struct sys_getpgid_args ua
;
1649 NETBSD32TO64_UAP(pid
);
1650 return (sys_getpgid(l
, &ua
, retval
));
1654 netbsd32_reboot(struct lwp
*l
, const struct netbsd32_reboot_args
*uap
, register_t
*retval
)
1657 syscallarg(int) opt;
1658 syscallarg(netbsd32_charp) bootstr;
1660 struct sys_reboot_args ua
;
1662 NETBSD32TO64_UAP(opt
);
1663 NETBSD32TOP_UAP(bootstr
, char);
1664 return (sys_reboot(l
, &ua
, retval
));
1667 #include <sys/poll.h>
1669 netbsd32_poll(struct lwp
*l
, const struct netbsd32_poll_args
*uap
, register_t
*retval
)
1672 syscallarg(netbsd32_pollfdp_t) fds;
1673 syscallarg(u_int) nfds;
1674 syscallarg(int) timeout;
1676 struct sys_poll_args ua
;
1678 NETBSD32TOP_UAP(fds
, struct pollfd
);
1679 NETBSD32TO64_UAP(nfds
);
1680 NETBSD32TO64_UAP(timeout
);
1682 return (sys_poll(l
, &ua
, retval
));
1686 netbsd32_fdatasync(struct lwp
*l
, const struct netbsd32_fdatasync_args
*uap
, register_t
*retval
)
1691 struct sys_fdatasync_args ua
;
1693 NETBSD32TO64_UAP(fd
);
1694 return (sys_fdatasync(l
, &ua
, retval
));
1698 netbsd32___posix_rename(struct lwp
*l
, const struct netbsd32___posix_rename_args
*uap
, register_t
*retval
)
1701 syscallarg(const netbsd32_charp) from;
1702 syscallarg(const netbsd32_charp) to;
1704 struct sys___posix_rename_args ua
;
1706 NETBSD32TOP_UAP(from
, const char);
1707 NETBSD32TOP_UAP(to
, const char);
1708 return (sys___posix_rename(l
, &ua
, retval
));
1712 netbsd32_swapctl(struct lwp
*l
, const struct netbsd32_swapctl_args
*uap
, register_t
*retval
)
1715 syscallarg(int) cmd;
1716 syscallarg(const netbsd32_voidp) arg;
1717 syscallarg(int) misc;
1719 struct sys_swapctl_args ua
;
1721 NETBSD32TO64_UAP(cmd
);
1722 NETBSD32TOP_UAP(arg
, void);
1723 NETBSD32TO64_UAP(misc
);
1724 return (sys_swapctl(l
, &ua
, retval
));
1728 netbsd32_minherit(struct lwp
*l
, const struct netbsd32_minherit_args
*uap
, register_t
*retval
)
1731 syscallarg(netbsd32_voidp) addr;
1732 syscallarg(netbsd32_size_t) len;
1733 syscallarg(int) inherit;
1735 struct sys_minherit_args ua
;
1737 NETBSD32TOP_UAP(addr
, void);
1738 NETBSD32TOX_UAP(len
, size_t);
1739 NETBSD32TO64_UAP(inherit
);
1740 return (sys_minherit(l
, &ua
, retval
));
1744 netbsd32_lchmod(struct lwp
*l
, const struct netbsd32_lchmod_args
*uap
, register_t
*retval
)
1747 syscallarg(const netbsd32_charp) path;
1748 syscallarg(mode_t) mode;
1750 struct sys_lchmod_args ua
;
1752 NETBSD32TOP_UAP(path
, const char);
1753 NETBSD32TO64_UAP(mode
);
1754 return (sys_lchmod(l
, &ua
, retval
));
1758 netbsd32_lchown(struct lwp
*l
, const struct netbsd32_lchown_args
*uap
, register_t
*retval
)
1761 syscallarg(const netbsd32_charp) path;
1762 syscallarg(uid_t) uid;
1763 syscallarg(gid_t) gid;
1765 struct sys_lchown_args ua
;
1767 NETBSD32TOP_UAP(path
, const char);
1768 NETBSD32TO64_UAP(uid
);
1769 NETBSD32TO64_UAP(gid
);
1770 return (sys_lchown(l
, &ua
, retval
));
1774 netbsd32___msync13(struct lwp
*l
, const struct netbsd32___msync13_args
*uap
, register_t
*retval
)
1777 syscallarg(netbsd32_voidp) addr;
1778 syscallarg(netbsd32_size_t) len;
1779 syscallarg(int) flags;
1781 struct sys___msync13_args ua
;
1783 NETBSD32TOP_UAP(addr
, void);
1784 NETBSD32TOX_UAP(len
, size_t);
1785 NETBSD32TO64_UAP(flags
);
1786 return (sys___msync13(l
, &ua
, retval
));
1790 netbsd32___posix_chown(struct lwp
*l
, const struct netbsd32___posix_chown_args
*uap
, register_t
*retval
)
1793 syscallarg(const netbsd32_charp) path;
1794 syscallarg(uid_t) uid;
1795 syscallarg(gid_t) gid;
1797 struct sys___posix_chown_args ua
;
1799 NETBSD32TOP_UAP(path
, const char);
1800 NETBSD32TO64_UAP(uid
);
1801 NETBSD32TO64_UAP(gid
);
1802 return (sys___posix_chown(l
, &ua
, retval
));
1806 netbsd32___posix_fchown(struct lwp
*l
, const struct netbsd32___posix_fchown_args
*uap
, register_t
*retval
)
1810 syscallarg(uid_t) uid;
1811 syscallarg(gid_t) gid;
1813 struct sys___posix_fchown_args ua
;
1815 NETBSD32TO64_UAP(fd
);
1816 NETBSD32TO64_UAP(uid
);
1817 NETBSD32TO64_UAP(gid
);
1818 return (sys___posix_fchown(l
, &ua
, retval
));
1822 netbsd32___posix_lchown(struct lwp
*l
, const struct netbsd32___posix_lchown_args
*uap
, register_t
*retval
)
1825 syscallarg(const netbsd32_charp) path;
1826 syscallarg(uid_t) uid;
1827 syscallarg(gid_t) gid;
1829 struct sys___posix_lchown_args ua
;
1831 NETBSD32TOP_UAP(path
, const char);
1832 NETBSD32TO64_UAP(uid
);
1833 NETBSD32TO64_UAP(gid
);
1834 return (sys___posix_lchown(l
, &ua
, retval
));
1838 netbsd32_getsid(struct lwp
*l
, const struct netbsd32_getsid_args
*uap
, register_t
*retval
)
1841 syscallarg(pid_t) pid;
1843 struct sys_getsid_args ua
;
1845 NETBSD32TO64_UAP(pid
);
1846 return (sys_getsid(l
, &ua
, retval
));
1850 netbsd32_fktrace(struct lwp
*l
, const struct netbsd32_fktrace_args
*uap
, register_t
*retval
)
1854 syscallarg(int) ops;
1855 syscallarg(int) facs;
1856 syscallarg(int) pid;
1858 struct sys_fktrace_args ua
;
1860 NETBSD32TOX_UAP(fd
, int);
1861 NETBSD32TO64_UAP(ops
);
1862 NETBSD32TO64_UAP(facs
);
1863 NETBSD32TO64_UAP(pid
);
1864 return (sys_fktrace(l
, &ua
, retval
));
1868 netbsd32___sigpending14(struct lwp
*l
, const struct netbsd32___sigpending14_args
*uap
, register_t
*retval
)
1871 syscallarg(sigset_t *) set;
1873 struct sys___sigpending14_args ua
;
1875 NETBSD32TOP_UAP(set
, sigset_t
);
1876 return (sys___sigpending14(l
, &ua
, retval
));
1880 netbsd32___sigprocmask14(struct lwp
*l
, const struct netbsd32___sigprocmask14_args
*uap
, register_t
*retval
)
1883 syscallarg(int) how;
1884 syscallarg(const sigset_t *) set;
1885 syscallarg(sigset_t *) oset;
1887 struct sys___sigprocmask14_args ua
;
1889 NETBSD32TO64_UAP(how
);
1890 NETBSD32TOP_UAP(set
, sigset_t
);
1891 NETBSD32TOP_UAP(oset
, sigset_t
);
1892 return (sys___sigprocmask14(l
, &ua
, retval
));
1896 netbsd32___sigsuspend14(struct lwp
*l
, const struct netbsd32___sigsuspend14_args
*uap
, register_t
*retval
)
1899 syscallarg(const sigset_t *) set;
1901 struct sys___sigsuspend14_args ua
;
1903 NETBSD32TOP_UAP(set
, sigset_t
);
1904 return (sys___sigsuspend14(l
, &ua
, retval
));
1908 netbsd32_fchroot(struct lwp
*l
, const struct netbsd32_fchroot_args
*uap
, register_t
*retval
)
1913 struct sys_fchroot_args ua
;
1915 NETBSD32TO64_UAP(fd
);
1916 return (sys_fchroot(l
, &ua
, retval
));
1920 * Open a file given a file handle.
1922 * Check permissions, allocate an open file structure,
1923 * and call the device open routine if any.
1926 netbsd32___fhopen40(struct lwp
*l
, const struct netbsd32___fhopen40_args
*uap
, register_t
*retval
)
1929 syscallarg(const netbsd32_pointer_t *) fhp;
1930 syscallarg(netbsd32_size_t) fh_size;
1931 syscallarg(int) flags;
1933 struct sys___fhopen40_args ua
;
1935 NETBSD32TOP_UAP(fhp
, fhandle_t
);
1936 NETBSD32TO64_UAP(fh_size
);
1937 NETBSD32TO64_UAP(flags
);
1938 return (sys___fhopen40(l
, &ua
, retval
));
1941 /* virtual memory syscalls */
1943 netbsd32_ovadvise(struct lwp
*l
, const struct netbsd32_ovadvise_args
*uap
, register_t
*retval
)
1946 syscallarg(int) anom;
1948 struct sys_ovadvise_args ua
;
1950 NETBSD32TO64_UAP(anom
);
1951 return (sys_ovadvise(l
, &ua
, retval
));
1955 netbsd32_adjust_limits(struct proc
*p
)
1957 static const struct {
1961 { RLIMIT_DATA
, MAXDSIZ32
},
1962 { RLIMIT_STACK
, MAXSSIZ32
},
1966 struct rlimit
*rlim
;
1969 * We can only reduce the current limits, we cannot stop external
1970 * processes from changing them (eg via sysctl) later on.
1971 * So there is no point trying to lock out such changes here.
1973 * If we assume that rlim_cur/max are accessed using atomic
1974 * operations, we don't need to lock against any other updates
1975 * that might happen if the plimit structure is shared writable
1976 * between multiple processes.
1979 /* Scan to determine is any limits are out of range */
1981 for (i
= 0; ; i
++) {
1982 if (i
>= __arraycount(lm
))
1985 rlim
= lim
->pl_rlimit
+ lm
[i
].id
;
1986 if (LIMITCHECK(rlim
->rlim_cur
, lm
[i
].lim
))
1988 if (LIMITCHECK(rlim
->rlim_max
, lm
[i
].lim
))
1992 lim_privatise(p
, false);
1995 for (i
= 0; i
< __arraycount(lm
); i
++) {
1996 rlim
= lim
->pl_rlimit
+ lm
[i
].id
;
1997 if (LIMITCHECK(rlim
->rlim_cur
, lm
[i
].lim
))
1998 rlim
->rlim_cur
= lm
[i
].lim
;
1999 if (LIMITCHECK(rlim
->rlim_max
, lm
[i
].lim
))
2000 rlim
->rlim_max
= lm
[i
].lim
;
2005 netbsd32_uuidgen(struct lwp
*l
, const struct netbsd32_uuidgen_args
*uap
, register_t
*retval
)
2008 syscallarg(netbsd32_uuidp_t) store;
2009 syscallarg(int) count;
2011 struct sys_uuidgen_args ua
;
2013 NETBSD32TOP_UAP(store
, struct uuid
);
2014 NETBSD32TO64_UAP(count
);
2015 return (sys_uuidgen(l
, &ua
, retval
));
2019 netbsd32_extattrctl(struct lwp
*l
, const struct netbsd32_extattrctl_args
*uap
, register_t
*retval
)
2022 syscallarg(const netbsd32_charp) path;
2023 syscallarg(int) cmd;
2024 syscallarg(const netbsd32_charp) filename;
2025 syscallarg(int) attrnamespace;
2026 syscallarg(const netbsd32_charp) attrname;
2028 struct sys_extattrctl_args ua
;
2030 NETBSD32TOP_UAP(path
, const char);
2031 NETBSD32TO64_UAP(cmd
);
2032 NETBSD32TOP_UAP(filename
, const char);
2033 NETBSD32TO64_UAP(attrnamespace
);
2034 NETBSD32TOP_UAP(attrname
, const char);
2035 return sys_extattrctl(l
, &ua
, retval
);
2039 netbsd32_extattr_set_fd(struct lwp
*l
, const struct netbsd32_extattr_set_fd_args
*uap
, register_t
*retval
)
2043 syscallarg(int) attrnamespace;
2044 syscallarg(const netbsd32_charp) attrname;
2045 syscallarg(const netbsd32_voidp) data;
2046 syscallarg(netbsd32_size_t) nbytes;
2048 struct sys_extattr_set_fd_args ua
;
2050 NETBSD32TO64_UAP(fd
);
2051 NETBSD32TO64_UAP(attrnamespace
);
2052 NETBSD32TOP_UAP(attrname
, const char);
2053 NETBSD32TOP_UAP(data
, const void);
2054 NETBSD32TOX_UAP(nbytes
, size_t);
2055 return sys_extattr_set_fd(l
, &ua
, retval
);
2059 netbsd32_extattr_set_file(struct lwp
*l
, const struct netbsd32_extattr_set_file_args
*uap
, register_t
*retval
)
2062 syscallarg(const netbsd32_charp) path;
2063 syscallarg(int) attrnamespace;
2064 syscallarg(const netbsd32_charp) attrname;
2065 syscallarg(const netbsd32_voidp) data;
2066 syscallarg(netbsd32_size_t) nbytes;
2068 struct sys_extattr_set_file_args ua
;
2070 NETBSD32TOP_UAP(path
, const char);
2071 NETBSD32TO64_UAP(attrnamespace
);
2072 NETBSD32TOP_UAP(attrname
, const char);
2073 NETBSD32TOP_UAP(data
, const void);
2074 NETBSD32TOX_UAP(nbytes
, size_t);
2075 return sys_extattr_set_file(l
, &ua
, retval
);
2079 netbsd32_extattr_set_link(struct lwp
*l
, const struct netbsd32_extattr_set_link_args
*uap
, register_t
*retval
)
2082 syscallarg(const netbsd32_charp) path;
2083 syscallarg(int) attrnamespace;
2084 syscallarg(const netbsd32_charp) attrname;
2085 syscallarg(const netbsd32_voidp) data;
2086 syscallarg(netbsd32_size_t) nbytes;
2088 struct sys_extattr_set_link_args ua
;
2090 NETBSD32TOP_UAP(path
, const char);
2091 NETBSD32TO64_UAP(attrnamespace
);
2092 NETBSD32TOP_UAP(attrname
, const char);
2093 NETBSD32TOP_UAP(data
, const void);
2094 NETBSD32TOX_UAP(nbytes
, size_t);
2095 return sys_extattr_set_link(l
, &ua
, retval
);
2099 netbsd32_extattr_get_fd(struct lwp
*l
, const struct netbsd32_extattr_get_fd_args
*uap
, register_t
*retval
)
2103 syscallarg(int) attrnamespace;
2104 syscallarg(const netbsd32_charp) attrname;
2105 syscallarg(netbsd32_voidp) data;
2106 syscallarg(netbsd32_size_t) nbytes;
2108 struct sys_extattr_get_fd_args ua
;
2110 NETBSD32TO64_UAP(fd
);
2111 NETBSD32TO64_UAP(attrnamespace
);
2112 NETBSD32TOP_UAP(attrname
, const char);
2113 NETBSD32TOP_UAP(data
, void);
2114 NETBSD32TOX_UAP(nbytes
, size_t);
2115 return sys_extattr_get_fd(l
, &ua
, retval
);
2119 netbsd32_extattr_get_file(struct lwp
*l
, const struct netbsd32_extattr_get_file_args
*uap
, register_t
*retval
)
2122 syscallarg(const netbsd32_charp) path;
2123 syscallarg(int) attrnamespace;
2124 syscallarg(const netbsd32_charp) attrname;
2125 syscallarg(netbsd32_voidp) data;
2126 syscallarg(netbsd32_size_t) nbytes;
2128 struct sys_extattr_get_file_args ua
;
2130 NETBSD32TOP_UAP(path
, const char);
2131 NETBSD32TO64_UAP(attrnamespace
);
2132 NETBSD32TOP_UAP(attrname
, const char);
2133 NETBSD32TOP_UAP(data
, void);
2134 NETBSD32TOX_UAP(nbytes
, size_t);
2135 return sys_extattr_get_file(l
, &ua
, retval
);
2139 netbsd32_extattr_get_link(struct lwp
*l
, const struct netbsd32_extattr_get_link_args
*uap
, register_t
*retval
)
2142 syscallarg(const netbsd32_charp) path;
2143 syscallarg(int) attrnamespace;
2144 syscallarg(const netbsd32_charp) attrname;
2145 syscallarg(netbsd32_voidp) data;
2146 syscallarg(netbsd32_size_t) nbytes;
2148 struct sys_extattr_get_link_args ua
;
2150 NETBSD32TOP_UAP(path
, const char);
2151 NETBSD32TO64_UAP(attrnamespace
);
2152 NETBSD32TOP_UAP(attrname
, const char);
2153 NETBSD32TOP_UAP(data
, void);
2154 NETBSD32TOX_UAP(nbytes
, size_t);
2155 return sys_extattr_get_link(l
, &ua
, retval
);
2159 netbsd32_extattr_delete_fd(struct lwp
*l
, const struct netbsd32_extattr_delete_fd_args
*uap
, register_t
*retval
)
2163 syscallarg(int) attrnamespace;
2164 syscallarg(const netbsd32_charp) attrname;
2166 struct sys_extattr_delete_fd_args ua
;
2168 NETBSD32TO64_UAP(fd
);
2169 NETBSD32TO64_UAP(attrnamespace
);
2170 NETBSD32TOP_UAP(attrname
, const char);
2171 return sys_extattr_delete_fd(l
, &ua
, retval
);
2175 netbsd32_extattr_delete_file(struct lwp
*l
, const struct netbsd32_extattr_delete_file_args
*uap
, register_t
*retval
)
2178 syscallarg(const netbsd32_charp) path;
2179 syscallarg(int) attrnamespace;
2180 syscallarg(const netbsd32_charp) attrname;
2182 struct sys_extattr_delete_file_args ua
;
2184 NETBSD32TOP_UAP(path
, const char);
2185 NETBSD32TO64_UAP(attrnamespace
);
2186 NETBSD32TOP_UAP(attrname
, const char);
2187 return sys_extattr_delete_file(l
, &ua
, retval
);
2191 netbsd32_extattr_delete_link(struct lwp
*l
, const struct netbsd32_extattr_delete_link_args
*uap
, register_t
*retval
)
2194 syscallarg(const netbsd32_charp) path;
2195 syscallarg(int) attrnamespace;
2196 syscallarg(const netbsd32_charp) attrname;
2198 struct sys_extattr_delete_link_args ua
;
2200 NETBSD32TOP_UAP(path
, const char);
2201 NETBSD32TO64_UAP(attrnamespace
);
2202 NETBSD32TOP_UAP(attrname
, const char);
2203 return sys_extattr_delete_link(l
, &ua
, retval
);
2207 netbsd32_extattr_list_fd(struct lwp
*l
, const struct netbsd32_extattr_list_fd_args
*uap
, register_t
*retval
)
2211 syscallarg(int) attrnamespace;
2212 syscallarg(netbsd32_voidp) data;
2213 syscallarg(netbsd32_size_t) nbytes;
2215 struct sys_extattr_list_fd_args ua
;
2217 NETBSD32TO64_UAP(fd
);
2218 NETBSD32TO64_UAP(attrnamespace
);
2219 NETBSD32TOP_UAP(data
, void);
2220 NETBSD32TOX_UAP(nbytes
, size_t);
2221 return sys_extattr_list_fd(l
, &ua
, retval
);
2225 netbsd32_extattr_list_file(struct lwp
*l
, const struct netbsd32_extattr_list_file_args
*uap
, register_t
*retval
)
2228 syscallarg(const netbsd32_charp) path;
2229 syscallarg(int) attrnamespace;
2230 syscallarg(netbsd32_voidp) data;
2231 syscallarg(netbsd32_size_t) nbytes;
2233 struct sys_extattr_list_file_args ua
;
2235 NETBSD32TOP_UAP(path
, const char);
2236 NETBSD32TO64_UAP(attrnamespace
);
2237 NETBSD32TOP_UAP(data
, void);
2238 NETBSD32TOX_UAP(nbytes
, size_t);
2239 return sys_extattr_list_file(l
, &ua
, retval
);
2243 netbsd32_extattr_list_link(struct lwp
*l
, const struct netbsd32_extattr_list_link_args
*uap
, register_t
*retval
)
2246 syscallarg(const netbsd32_charp) path;
2247 syscallarg(int) attrnamespace;
2248 syscallarg(netbsd32_voidp) data;
2249 syscallarg(netbsd32_size_t) nbytes;
2251 struct sys_extattr_list_link_args ua
;
2253 NETBSD32TOP_UAP(path
, const char);
2254 NETBSD32TO64_UAP(attrnamespace
);
2255 NETBSD32TOP_UAP(data
, void);
2256 NETBSD32TOX_UAP(nbytes
, size_t);
2257 return sys_extattr_list_link(l
, &ua
, retval
);
2261 netbsd32_mlockall(struct lwp
*l
, const struct netbsd32_mlockall_args
*uap
, register_t
*retval
)
2264 syscallarg(int) flags;
2266 struct sys_mlockall_args ua
;
2268 NETBSD32TO64_UAP(flags
);
2269 return (sys_mlockall(l
, &ua
, retval
));
2273 netbsd32___clone(struct lwp
*l
, const struct netbsd32___clone_args
*uap
, register_t
*retval
)
2276 syscallarg(int) flags;
2277 syscallarg(netbsd32_voidp) stack;
2279 struct sys___clone_args ua
;
2281 NETBSD32TO64_UAP(flags
);
2282 NETBSD32TOP_UAP(stack
, void);
2283 return sys___clone(l
, &ua
, retval
);
2287 netbsd32_fsync_range(struct lwp
*l
, const struct netbsd32_fsync_range_args
*uap
, register_t
*retval
)
2291 syscallarg(int) flags;
2292 syscallarg(off_t) start;
2293 syscallarg(off_t) length;
2295 struct sys_fsync_range_args ua
;
2297 NETBSD32TO64_UAP(fd
);
2298 NETBSD32TO64_UAP(flags
);
2299 NETBSD32TO64_UAP(start
);
2300 NETBSD32TO64_UAP(length
);
2301 return (sys_fsync_range(l
, &ua
, retval
));
2305 netbsd32_rasctl(struct lwp
*l
, const struct netbsd32_rasctl_args
*uap
, register_t
*retval
)
2308 syscallarg(netbsd32_voidp) addr;
2309 syscallarg(netbsd32_size_t) len;
2312 struct sys_rasctl_args ua
;
2314 NETBSD32TOP_UAP(addr
, void *);
2315 NETBSD32TOX_UAP(len
, size_t);
2316 NETBSD32TO64_UAP(op
);
2317 return sys_rasctl(l
, &ua
, retval
);
2321 netbsd32_setxattr(struct lwp
*l
, const struct netbsd32_setxattr_args
*uap
, register_t
*retval
)
2324 syscallarg(const netbsd32_charp) path;
2325 syscallarg(const netbsd32_charp) name;
2326 syscallarg(netbsd32_voidp) value;
2327 syscallarg(netbsd32_size_t) size;
2328 syscallarg(int) flags;
2330 struct sys_setxattr_args ua
;
2331 NETBSD32TOP_UAP(path
, const char);
2332 NETBSD32TOP_UAP(name
, const char);
2333 NETBSD32TOP_UAP(value
, void);
2334 NETBSD32TOX_UAP(size
, size_t);
2335 NETBSD32TO64_UAP(flags
);
2336 return sys_setxattr(l
, &ua
, retval
);
2340 netbsd32_lsetxattr(struct lwp
*l
, const struct netbsd32_lsetxattr_args
*uap
, register_t
*retval
)
2343 syscallarg(const netbsd32_charp) path;
2344 syscallarg(const netbsd32_charp) name;
2345 syscallarg(netbsd32_voidp) value;
2346 syscallarg(netbsd32_size_t) size;
2347 syscallarg(int) flags;
2349 struct sys_lsetxattr_args ua
;
2350 NETBSD32TOP_UAP(path
, const char);
2351 NETBSD32TOP_UAP(name
, const char);
2352 NETBSD32TOP_UAP(value
, void);
2353 NETBSD32TOX_UAP(size
, size_t);
2354 NETBSD32TO64_UAP(flags
);
2355 return sys_lsetxattr(l
, &ua
, retval
);
2359 netbsd32_fsetxattr(struct lwp
*l
, const struct netbsd32_fsetxattr_args
*uap
, register_t
*retval
)
2363 syscallarg(const netbsd32_charp) name;
2364 syscallarg(netbsd32_voidp) value;
2365 syscallarg(netbsd32_size_t) size;
2366 syscallarg(int) flags;
2368 struct sys_fsetxattr_args ua
;
2369 NETBSD32TO64_UAP(fd
);
2370 NETBSD32TOP_UAP(name
, const char);
2371 NETBSD32TOP_UAP(value
, void);
2372 NETBSD32TOX_UAP(size
, size_t);
2373 NETBSD32TO64_UAP(flags
);
2374 return sys_fsetxattr(l
, &ua
, retval
);
2378 netbsd32_getxattr(struct lwp
*l
, const struct netbsd32_getxattr_args
*uap
, register_t
*retval
)
2381 syscallarg(const netbsd32_charp) path;
2382 syscallarg(const netbsd32_charp) name;
2383 syscallarg(netbsd32_voidp) value;
2384 syscallarg(netbsd32_size_t) size;
2386 struct sys_getxattr_args ua
;
2387 NETBSD32TOP_UAP(path
, const char);
2388 NETBSD32TOP_UAP(name
, const char);
2389 NETBSD32TOP_UAP(value
, void);
2390 NETBSD32TOX_UAP(size
, size_t);
2391 return sys_getxattr(l
, &ua
, retval
);
2395 netbsd32_lgetxattr(struct lwp
*l
, const struct netbsd32_lgetxattr_args
*uap
, register_t
*retval
)
2398 syscallarg(const netbsd32_charp) path;
2399 syscallarg(const netbsd32_charp) name;
2400 syscallarg(netbsd32_voidp) value;
2401 syscallarg(netbsd32_size_t) size;
2403 struct sys_lgetxattr_args ua
;
2404 NETBSD32TOP_UAP(path
, const char);
2405 NETBSD32TOP_UAP(name
, const char);
2406 NETBSD32TOP_UAP(value
, void);
2407 NETBSD32TOX_UAP(size
, size_t);
2408 return sys_lgetxattr(l
, &ua
, retval
);
2412 netbsd32_fgetxattr(struct lwp
*l
, const struct netbsd32_fgetxattr_args
*uap
, register_t
*retval
)
2416 syscallarg(const netbsd32_charp) name;
2417 syscallarg(netbsd32_voidp) value;
2418 syscallarg(netbsd32_size_t) size;
2420 struct sys_fgetxattr_args ua
;
2421 NETBSD32TO64_UAP(fd
);
2422 NETBSD32TOP_UAP(name
, const char);
2423 NETBSD32TOP_UAP(value
, void);
2424 NETBSD32TOX_UAP(size
, size_t);
2425 return sys_fgetxattr(l
, &ua
, retval
);
2429 netbsd32_listxattr(struct lwp
*l
, const struct netbsd32_listxattr_args
*uap
, register_t
*retval
)
2432 syscallarg(const netbsd32_charp) path;
2433 syscallarg(netbsd32_charp) list;
2434 syscallarg(netbsd32_size_t) size;
2436 struct sys_listxattr_args ua
;
2437 NETBSD32TOP_UAP(path
, const char);
2438 NETBSD32TOP_UAP(list
, char);
2439 NETBSD32TOX_UAP(size
, size_t);
2440 return sys_listxattr(l
, &ua
, retval
);
2444 netbsd32_llistxattr(struct lwp
*l
, const struct netbsd32_llistxattr_args
*uap
, register_t
*retval
)
2447 syscallarg(const netbsd32_charp) path;
2448 syscallarg(netbsd32_charp) list;
2449 syscallarg(netbsd32_size_t) size;
2451 struct sys_llistxattr_args ua
;
2452 NETBSD32TOP_UAP(path
, const char);
2453 NETBSD32TOP_UAP(list
, char);
2454 NETBSD32TOX_UAP(size
, size_t);
2455 return sys_llistxattr(l
, &ua
, retval
);
2459 netbsd32_flistxattr(struct lwp
*l
, const struct netbsd32_flistxattr_args
*uap
, register_t
*retval
)
2463 syscallarg(netbsd32_charp) list;
2464 syscallarg(netbsd32_size_t) size;
2466 struct sys_flistxattr_args ua
;
2467 NETBSD32TO64_UAP(fd
);
2468 NETBSD32TOP_UAP(list
, char);
2469 NETBSD32TOX_UAP(size
, size_t);
2470 return sys_flistxattr(l
, &ua
, retval
);
2474 netbsd32_removexattr(struct lwp
*l
, const struct netbsd32_removexattr_args
*uap
, register_t
*retval
)
2477 syscallarg(const netbsd32_charp) path;
2478 syscallarg(const netbsd32_charp) name;
2480 struct sys_removexattr_args ua
;
2481 NETBSD32TOP_UAP(path
, const char);
2482 NETBSD32TOP_UAP(name
, const char);
2483 return sys_removexattr(l
, &ua
, retval
);
2487 netbsd32_lremovexattr(struct lwp
*l
, const struct netbsd32_lremovexattr_args
*uap
, register_t
*retval
)
2490 syscallarg(const netbsd32_charp) path;
2491 syscallarg(const netbsd32_charp) name;
2493 struct sys_lremovexattr_args ua
;
2494 NETBSD32TOP_UAP(path
, const char);
2495 NETBSD32TOP_UAP(name
, const char);
2496 return sys_lremovexattr(l
, &ua
, retval
);
2500 netbsd32_fremovexattr(struct lwp
*l
, const struct netbsd32_fremovexattr_args
*uap
, register_t
*retval
)
2504 syscallarg(const netbsd32_charp) name;
2506 struct sys_fremovexattr_args ua
;
2507 NETBSD32TO64_UAP(fd
);
2508 NETBSD32TOP_UAP(name
, const char);
2509 return sys_fremovexattr(l
, &ua
, retval
);
2513 netbsd32___posix_fadvise50(struct lwp
*l
,
2514 const struct netbsd32___posix_fadvise50_args
*uap
, register_t
*retval
)
2518 syscallarg(int) pad;
2519 syscallarg(off_t) offset;
2520 syscallarg(off_t) len;
2521 syscallarg(int) advice;
2524 return do_posix_fadvise(SCARG(uap
, fd
), SCARG(uap
, offset
),
2525 SCARG(uap
, len
), SCARG(uap
, advice
));
2529 netbsd32__sched_setparam(struct lwp
*l
,
2530 const struct netbsd32__sched_setparam_args
*uap
,
2534 syscallarg(pid_t) pid;
2535 syscallarg(lwpid_t) lid;
2536 syscallarg(int) policy;
2537 syscallarg(const netbsd32_sched_paramp_t) params;
2539 struct sys__sched_setparam_args ua
;
2541 NETBSD32TO64_UAP(pid
);
2542 NETBSD32TO64_UAP(lid
);
2543 NETBSD32TO64_UAP(policy
);
2544 NETBSD32TOP_UAP(params
, const struct sched_param
*);
2545 return sys__sched_setparam(l
, &ua
, retval
);
2549 netbsd32__sched_getparam(struct lwp
*l
,
2550 const struct netbsd32__sched_getparam_args
*uap
,
2554 syscallarg(pid_t) pid;
2555 syscallarg(lwpid_t) lid;
2556 syscallarg(netbsd32_intp) policy;
2557 syscallarg(netbsd32_sched_paramp_t) params;
2559 struct sys__sched_getparam_args ua
;
2561 NETBSD32TO64_UAP(pid
);
2562 NETBSD32TO64_UAP(lid
);
2563 NETBSD32TOP_UAP(policy
, int *);
2564 NETBSD32TOP_UAP(params
, struct sched_param
*);
2565 return sys__sched_getparam(l
, &ua
, retval
);
2569 netbsd32__sched_setaffinity(struct lwp
*l
,
2570 const struct netbsd32__sched_setaffinity_args
*uap
,
2574 syscallarg(pid_t) pid;
2575 syscallarg(lwpid_t) lid;
2576 syscallarg(netbsd_size_t) size;
2577 syscallarg(const netbsd32_cpusetp_t) cpuset;
2579 struct sys__sched_setaffinity_args ua
;
2581 NETBSD32TO64_UAP(pid
);
2582 NETBSD32TO64_UAP(lid
);
2583 NETBSD32TOX_UAP(size
, size_t);
2584 NETBSD32TOP_UAP(cpuset
, const cpuset_t
*);
2585 return sys__sched_setaffinity(l
, &ua
, retval
);
2589 netbsd32__sched_getaffinity(struct lwp
*l
,
2590 const struct netbsd32__sched_getaffinity_args
*uap
,
2594 syscallarg(pid_t) pid;
2595 syscallarg(lwpid_t) lid;
2596 syscallarg(netbsd_size_t) size;
2597 syscallarg(netbsd32_cpusetp_t) cpuset;
2599 struct sys__sched_getaffinity_args ua
;
2601 NETBSD32TO64_UAP(pid
);
2602 NETBSD32TO64_UAP(lid
);
2603 NETBSD32TOX_UAP(size
, size_t);
2604 NETBSD32TOP_UAP(cpuset
, cpuset_t
*);
2605 return sys__sched_getaffinity(l
, &ua
, retval
);
2609 * MI indirect system call support.
2610 * Only used if the MD netbsd32_syscall.c doesn't intercept the calls.
2613 #define NETBSD32_SYSCALL
2615 #define SYS_NSYSENT NETBSD32_SYS_NSYSENT
2617 #define SYS_SYSCALL netbsd32_syscall
2618 #include "../../kern/sys_syscall.c"
2621 #define SYS_SYSCALL netbsd32____syscall
2622 #include "../../kern/sys_syscall.c"