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$");
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>
96 #include <ddb/ddbvar.h>
99 extern struct sysent netbsd32_sysent
[];
101 extern const char * const netbsd32_syscallnames
[];
103 #ifdef __HAVE_SYSCALL_INTERN
104 void netbsd32_syscall_intern(struct proc
*);
109 #define LIMITCHECK(a, b) ((a) != RLIM_INFINITY && (a) > (b))
112 extern char netbsd32_sigcode
[], netbsd32_esigcode
[];
113 struct uvm_object
*emul_netbsd32_object
;
116 extern struct sysctlnode netbsd32_sysctl_root
;
118 struct emul emul_netbsd32
= {
119 .e_name
= "netbsd32",
120 .e_path
= "/emul/netbsd32",
121 #ifndef __HAVE_MINIMAL_EMUL
124 .e_nosys
= NETBSD32_SYS_netbsd32_syscall
,
125 .e_nsysent
= NETBSD32_SYS_NSYSENT
,
127 .e_sysent
= netbsd32_sysent
,
129 .e_syscallnames
= netbsd32_syscallnames
,
131 .e_syscallnames
= NULL
,
133 .e_sendsig
= netbsd32_sendsig
,
134 .e_trapsignal
= trapsignal
,
137 .e_sigcode
= netbsd32_sigcode
,
138 .e_esigcode
= netbsd32_esigcode
,
139 .e_sigobject
= &emul_netbsd32_object
,
145 .e_setregs
= netbsd32_setregs
,
151 #ifdef __HAVE_SYSCALL_INTERN
152 .e_syscall_intern
= netbsd32_syscall_intern
,
154 .e_syscall
= syscall
,
156 .e_sysctlovly
= &netbsd32_sysctl_root
,
158 .e_vm_default_addr
= netbsd32_vm_default_addr
,
160 #if defined(COMPAT_40) && defined(KERN_SA)
161 .e_sa
= &saemul_netbsd32
,
165 .e_ucsize
= sizeof(ucontext32_t
),
166 .e_startlwp
= startlwp32
170 * below are all the standard NetBSD system calls, in the 32bit
171 * environment, with the necessary conversions to 64bit before
172 * calling the real syscall. anything that needs special
173 * attention is handled elsewhere.
177 netbsd32_exit(struct lwp
*l
, const struct netbsd32_exit_args
*uap
, register_t
*retval
)
180 syscallarg(int) rval;
182 struct sys_exit_args ua
;
184 NETBSD32TO64_UAP(rval
);
185 return sys_exit(l
, &ua
, retval
);
189 netbsd32_read(struct lwp
*l
, const struct netbsd32_read_args
*uap
, register_t
*retval
)
193 syscallarg(netbsd32_voidp) buf;
194 syscallarg(netbsd32_size_t) nbyte;
196 struct sys_read_args ua
;
198 NETBSD32TO64_UAP(fd
);
199 NETBSD32TOP_UAP(buf
, void *);
200 NETBSD32TOX_UAP(nbyte
, size_t);
201 return sys_read(l
, &ua
, retval
);
205 netbsd32_write(struct lwp
*l
, const struct netbsd32_write_args
*uap
, register_t
*retval
)
209 syscallarg(const netbsd32_voidp) buf;
210 syscallarg(netbsd32_size_t) nbyte;
212 struct sys_write_args ua
;
214 NETBSD32TO64_UAP(fd
);
215 NETBSD32TOP_UAP(buf
, void *);
216 NETBSD32TOX_UAP(nbyte
, size_t);
217 return sys_write(l
, &ua
, retval
);
221 netbsd32_close(struct lwp
*l
, const struct netbsd32_close_args
*uap
, register_t
*retval
)
226 struct sys_close_args ua
;
228 NETBSD32TO64_UAP(fd
);
229 return sys_close(l
, &ua
, retval
);
233 netbsd32_open(struct lwp
*l
, const struct netbsd32_open_args
*uap
, register_t
*retval
)
236 syscallarg(const netbsd32_charp) path;
237 syscallarg(int) flags;
238 syscallarg(mode_t) mode;
240 struct sys_open_args ua
;
242 NETBSD32TOP_UAP(path
, const char);
243 NETBSD32TO64_UAP(flags
);
244 NETBSD32TO64_UAP(mode
);
246 return (sys_open(l
, &ua
, retval
));
250 netbsd32_link(struct lwp
*l
, const struct netbsd32_link_args
*uap
, register_t
*retval
)
253 syscallarg(const netbsd32_charp) path;
254 syscallarg(const netbsd32_charp) link;
256 struct sys_link_args ua
;
258 NETBSD32TOP_UAP(path
, const char);
259 NETBSD32TOP_UAP(link
, const char);
260 return (sys_link(l
, &ua
, retval
));
264 netbsd32_unlink(struct lwp
*l
, const struct netbsd32_unlink_args
*uap
, register_t
*retval
)
267 syscallarg(const netbsd32_charp) path;
269 struct sys_unlink_args ua
;
271 NETBSD32TOP_UAP(path
, const char);
273 return (sys_unlink(l
, &ua
, retval
));
277 netbsd32_chdir(struct lwp
*l
, const struct netbsd32_chdir_args
*uap
, register_t
*retval
)
280 syscallarg(const netbsd32_charp) path;
282 struct sys_chdir_args ua
;
284 NETBSD32TOP_UAP(path
, const char);
286 return (sys_chdir(l
, &ua
, retval
));
290 netbsd32_fchdir(struct lwp
*l
, const struct netbsd32_fchdir_args
*uap
, register_t
*retval
)
295 struct sys_fchdir_args ua
;
297 NETBSD32TO64_UAP(fd
);
299 return (sys_fchdir(l
, &ua
, retval
));
303 netbsd32___mknod50(struct lwp
*l
, const struct netbsd32___mknod50_args
*uap
, register_t
*retval
)
306 syscallarg(const netbsd32_charp) path;
307 syscallarg(mode_t) mode;
308 syscallarg(netbsd32_dev_t) dev;
311 return do_sys_mknod(l
, SCARG_P32(uap
, path
), SCARG(uap
, mode
),
312 SCARG(uap
, dev
), retval
, UIO_USERSPACE
);
316 netbsd32_chmod(struct lwp
*l
, const struct netbsd32_chmod_args
*uap
, register_t
*retval
)
319 syscallarg(const netbsd32_charp) path;
320 syscallarg(mode_t) mode;
322 struct sys_chmod_args ua
;
324 NETBSD32TOP_UAP(path
, const char);
325 NETBSD32TO64_UAP(mode
);
327 return (sys_chmod(l
, &ua
, retval
));
331 netbsd32_chown(struct lwp
*l
, const struct netbsd32_chown_args
*uap
, register_t
*retval
)
334 syscallarg(const netbsd32_charp) path;
335 syscallarg(uid_t) uid;
336 syscallarg(gid_t) gid;
338 struct sys_chown_args ua
;
340 NETBSD32TOP_UAP(path
, const char);
341 NETBSD32TO64_UAP(uid
);
342 NETBSD32TO64_UAP(gid
);
344 return (sys_chown(l
, &ua
, retval
));
348 netbsd32_break(struct lwp
*l
, const struct netbsd32_break_args
*uap
, register_t
*retval
)
351 syscallarg(netbsd32_charp) nsize;
353 struct sys_obreak_args ua
;
355 NETBSD32TOP_UAP(nsize
, char);
356 return (sys_obreak(l
, &ua
, retval
));
360 netbsd32_mount(struct lwp
*l
, const struct netbsd32_mount_args
*uap
, register_t
*retval
)
364 syscallarg(const netbsd32_charp) type;
365 syscallarg(const netbsd32_charp) path;
366 syscallarg(int) flags;
367 syscallarg(netbsd32_voidp) data;
369 struct compat_40_sys_mount_args ua
;
371 NETBSD32TOP_UAP(type
, const char);
372 NETBSD32TOP_UAP(path
, const char);
373 NETBSD32TO64_UAP(flags
);
374 NETBSD32TOP_UAP(data
, void);
375 return (compat_40_sys_mount(l
, &ua
, retval
));
382 netbsd32_unmount(struct lwp
*l
, const struct netbsd32_unmount_args
*uap
, register_t
*retval
)
385 syscallarg(const netbsd32_charp) path;
386 syscallarg(int) flags;
388 struct sys_unmount_args ua
;
390 NETBSD32TOP_UAP(path
, const char);
391 NETBSD32TO64_UAP(flags
);
392 return (sys_unmount(l
, &ua
, retval
));
396 netbsd32_setuid(struct lwp
*l
, const struct netbsd32_setuid_args
*uap
, register_t
*retval
)
399 syscallarg(uid_t) uid;
401 struct sys_setuid_args ua
;
403 NETBSD32TO64_UAP(uid
);
404 return (sys_setuid(l
, &ua
, retval
));
408 netbsd32_ptrace(struct lwp
*l
, const struct netbsd32_ptrace_args
*uap
, register_t
*retval
)
412 syscallarg(pid_t) pid;
413 syscallarg(netbsd32_voidp) addr;
414 syscallarg(int) data;
416 struct sys_ptrace_args ua
;
418 NETBSD32TO64_UAP(req
);
419 NETBSD32TO64_UAP(pid
);
420 NETBSD32TOP_UAP(addr
, void *);
421 NETBSD32TO64_UAP(data
);
423 return (*sysent
[SYS_ptrace
].sy_call
)(l
, &ua
, retval
);
427 netbsd32_accept(struct lwp
*l
, const struct netbsd32_accept_args
*uap
, register_t
*retval
)
431 syscallarg(netbsd32_sockaddrp_t) name;
432 syscallarg(netbsd32_intp) anamelen;
434 struct sys_accept_args ua
;
437 NETBSD32TOP_UAP(name
, struct sockaddr
);
438 NETBSD32TOP_UAP(anamelen
, socklen_t
);
439 return (sys_accept(l
, &ua
, retval
));
443 netbsd32_getpeername(struct lwp
*l
, const struct netbsd32_getpeername_args
*uap
, register_t
*retval
)
446 syscallarg(int) fdes;
447 syscallarg(netbsd32_sockaddrp_t) asa;
448 syscallarg(netbsd32_intp) alen;
450 struct sys_getpeername_args ua
;
452 NETBSD32TO64_UAP(fdes
);
453 NETBSD32TOP_UAP(asa
, struct sockaddr
);
454 NETBSD32TOP_UAP(alen
, socklen_t
);
455 /* NB: do the protocol specific sockaddrs need to be converted? */
456 return (sys_getpeername(l
, &ua
, retval
));
460 netbsd32_getsockname(struct lwp
*l
, const struct netbsd32_getsockname_args
*uap
, register_t
*retval
)
463 syscallarg(int) fdes;
464 syscallarg(netbsd32_sockaddrp_t) asa;
465 syscallarg(netbsd32_intp) alen;
467 struct sys_getsockname_args ua
;
469 NETBSD32TO64_UAP(fdes
);
470 NETBSD32TOP_UAP(asa
, struct sockaddr
);
471 NETBSD32TOP_UAP(alen
, socklen_t
);
472 return (sys_getsockname(l
, &ua
, retval
));
476 netbsd32_access(struct lwp
*l
, const struct netbsd32_access_args
*uap
, register_t
*retval
)
479 syscallarg(const netbsd32_charp) path;
480 syscallarg(int) flags;
482 struct sys_access_args ua
;
484 NETBSD32TOP_UAP(path
, const char);
485 NETBSD32TO64_UAP(flags
);
487 return sys_access(l
, &ua
, retval
);
491 netbsd32_chflags(struct lwp
*l
, const struct netbsd32_chflags_args
*uap
, register_t
*retval
)
494 syscallarg(const netbsd32_charp) path;
495 syscallarg(netbsd32_u_long) flags;
497 struct sys_chflags_args ua
;
499 NETBSD32TOP_UAP(path
, const char);
500 NETBSD32TO64_UAP(flags
);
502 return (sys_chflags(l
, &ua
, retval
));
506 netbsd32_fchflags(struct lwp
*l
, const struct netbsd32_fchflags_args
*uap
, register_t
*retval
)
510 syscallarg(netbsd32_u_long) flags;
512 struct sys_fchflags_args ua
;
514 NETBSD32TO64_UAP(fd
);
515 NETBSD32TO64_UAP(flags
);
517 return (sys_fchflags(l
, &ua
, retval
));
521 netbsd32_lchflags(struct lwp
*l
, const struct netbsd32_lchflags_args
*uap
, register_t
*retval
)
524 syscallarg(const char *) path;
525 syscallarg(netbsd32_u_long) flags;
527 struct sys_lchflags_args ua
;
529 NETBSD32TOP_UAP(path
, const char);
530 NETBSD32TO64_UAP(flags
);
532 return (sys_lchflags(l
, &ua
, retval
));
536 netbsd32_kill(struct lwp
*l
, const struct netbsd32_kill_args
*uap
, register_t
*retval
)
540 syscallarg(int) signum;
542 struct sys_kill_args ua
;
544 NETBSD32TO64_UAP(pid
);
545 NETBSD32TO64_UAP(signum
);
547 return (sys_kill(l
, &ua
, retval
));
551 netbsd32_dup(struct lwp
*l
, const struct netbsd32_dup_args
*uap
, register_t
*retval
)
556 struct sys_dup_args ua
;
558 NETBSD32TO64_UAP(fd
);
560 return (sys_dup(l
, &ua
, retval
));
564 netbsd32_profil(struct lwp
*l
, const struct netbsd32_profil_args
*uap
, register_t
*retval
)
567 syscallarg(netbsd32_voidp) samples;
568 syscallarg(netbsd32_size_t) size;
569 syscallarg(netbsd32_u_long) offset;
570 syscallarg(u_int) scale;
572 struct sys_profil_args ua
;
574 NETBSD32TOP_UAP(samples
, void *);
575 NETBSD32TOX_UAP(size
, size_t);
576 NETBSD32TOX_UAP(offset
, u_long
);
577 NETBSD32TO64_UAP(scale
);
578 return (sys_profil(l
, &ua
, retval
));
582 netbsd32_ktrace(struct lwp
*l
, const struct netbsd32_ktrace_args
*uap
, register_t
*retval
)
585 syscallarg(const netbsd32_charp) fname;
587 syscallarg(int) facs;
590 struct sys_ktrace_args ua
;
592 NETBSD32TOP_UAP(fname
, const char);
593 NETBSD32TO64_UAP(ops
);
594 NETBSD32TO64_UAP(facs
);
595 NETBSD32TO64_UAP(pid
);
596 return (sys_ktrace(l
, &ua
, retval
));
600 netbsd32_utrace(struct lwp
*l
, const struct netbsd32_utrace_args
*uap
, register_t
*retval
)
603 syscallarg(const netbsd32_charp) label;
604 syscallarg(netbsd32_voidp) addr;
605 syscallarg(netbsd32_size_t) len;
607 struct sys_utrace_args ua
;
609 NETBSD32TOP_UAP(label
, const char);
610 NETBSD32TOP_UAP(addr
, void);
611 NETBSD32TO64_UAP(len
);
612 return (sys_utrace(l
, &ua
, retval
));
616 netbsd32___getlogin(struct lwp
*l
, const struct netbsd32___getlogin_args
*uap
, register_t
*retval
)
619 syscallarg(netbsd32_charp) namebuf;
620 syscallarg(u_int) namelen;
622 struct sys___getlogin_args ua
;
624 NETBSD32TOP_UAP(namebuf
, char);
625 NETBSD32TO64_UAP(namelen
);
626 return (sys___getlogin(l
, &ua
, retval
));
630 netbsd32_setlogin(struct lwp
*l
, const struct netbsd32_setlogin_args
*uap
, register_t
*retval
)
633 syscallarg(const netbsd32_charp) namebuf;
635 struct sys___setlogin_args ua
;
637 NETBSD32TOP_UAP(namebuf
, char);
638 return (sys___setlogin(l
, &ua
, retval
));
642 netbsd32_acct(struct lwp
*l
, const struct netbsd32_acct_args
*uap
, register_t
*retval
)
645 syscallarg(const netbsd32_charp) path;
647 struct sys_acct_args ua
;
649 NETBSD32TOP_UAP(path
, const char);
650 return (sys_acct(l
, &ua
, retval
));
654 netbsd32_revoke(struct lwp
*l
, const struct netbsd32_revoke_args
*uap
, register_t
*retval
)
657 syscallarg(const netbsd32_charp) path;
659 struct sys_revoke_args ua
;
661 NETBSD32TOP_UAP(path
, const char);
663 return (sys_revoke(l
, &ua
, retval
));
667 netbsd32_symlink(struct lwp
*l
, const struct netbsd32_symlink_args
*uap
, register_t
*retval
)
670 syscallarg(const netbsd32_charp) path;
671 syscallarg(const netbsd32_charp) link;
673 struct sys_symlink_args ua
;
675 NETBSD32TOP_UAP(path
, const char);
676 NETBSD32TOP_UAP(link
, const char);
678 return (sys_symlink(l
, &ua
, retval
));
682 netbsd32_readlink(struct lwp
*l
, const struct netbsd32_readlink_args
*uap
, register_t
*retval
)
685 syscallarg(const netbsd32_charp) path;
686 syscallarg(netbsd32_charp) buf;
687 syscallarg(netbsd32_size_t) count;
689 struct sys_readlink_args ua
;
691 NETBSD32TOP_UAP(path
, const char);
692 NETBSD32TOP_UAP(buf
, char);
693 NETBSD32TOX_UAP(count
, size_t);
695 return (sys_readlink(l
, &ua
, retval
));
699 netbsd32_umask(struct lwp
*l
, const struct netbsd32_umask_args
*uap
, register_t
*retval
)
702 syscallarg(mode_t) newmask;
704 struct sys_umask_args ua
;
706 NETBSD32TO64_UAP(newmask
);
707 return (sys_umask(l
, &ua
, retval
));
711 netbsd32_chroot(struct lwp
*l
, const struct netbsd32_chroot_args
*uap
, register_t
*retval
)
714 syscallarg(const netbsd32_charp) path;
716 struct sys_chroot_args ua
;
718 NETBSD32TOP_UAP(path
, const char);
719 return (sys_chroot(l
, &ua
, retval
));
723 netbsd32_sbrk(struct lwp
*l
, const struct netbsd32_sbrk_args
*uap
, register_t
*retval
)
726 syscallarg(int) incr;
728 struct sys_sbrk_args ua
;
730 NETBSD32TO64_UAP(incr
);
731 return (sys_sbrk(l
, &ua
, retval
));
735 netbsd32_sstk(struct lwp
*l
, const struct netbsd32_sstk_args
*uap
, register_t
*retval
)
738 syscallarg(int) incr;
740 struct sys_sstk_args ua
;
742 NETBSD32TO64_UAP(incr
);
743 return (sys_sstk(l
, &ua
, retval
));
747 netbsd32_munmap(struct lwp
*l
, const struct netbsd32_munmap_args
*uap
, register_t
*retval
)
750 syscallarg(netbsd32_voidp) addr;
751 syscallarg(netbsd32_size_t) len;
753 struct sys_munmap_args ua
;
755 NETBSD32TOP_UAP(addr
, void);
756 NETBSD32TOX_UAP(len
, size_t);
757 return (sys_munmap(l
, &ua
, retval
));
761 netbsd32_mprotect(struct lwp
*l
, const struct netbsd32_mprotect_args
*uap
, register_t
*retval
)
764 syscallarg(netbsd32_voidp) addr;
765 syscallarg(netbsd32_size_t) len;
766 syscallarg(int) prot;
768 struct sys_mprotect_args ua
;
770 NETBSD32TOP_UAP(addr
, void);
771 NETBSD32TOX_UAP(len
, size_t);
772 NETBSD32TO64_UAP(prot
);
773 return (sys_mprotect(l
, &ua
, retval
));
777 netbsd32_madvise(struct lwp
*l
, const struct netbsd32_madvise_args
*uap
, register_t
*retval
)
780 syscallarg(netbsd32_voidp) addr;
781 syscallarg(netbsd32_size_t) len;
782 syscallarg(int) behav;
784 struct sys_madvise_args ua
;
786 NETBSD32TOP_UAP(addr
, void);
787 NETBSD32TOX_UAP(len
, size_t);
788 NETBSD32TO64_UAP(behav
);
789 return (sys_madvise(l
, &ua
, retval
));
793 netbsd32_mincore(struct lwp
*l
, const struct netbsd32_mincore_args
*uap
, register_t
*retval
)
796 syscallarg(netbsd32_voidp) addr;
797 syscallarg(netbsd32_size_t) len;
798 syscallarg(netbsd32_charp) vec;
800 struct sys_mincore_args ua
;
802 NETBSD32TOP_UAP(addr
, void *);
803 NETBSD32TOX_UAP(len
, size_t);
804 NETBSD32TOP_UAP(vec
, char);
805 return (sys_mincore(l
, &ua
, retval
));
808 /* XXX MOVE ME XXX ? */
810 netbsd32_getgroups(struct lwp
*l
, const struct netbsd32_getgroups_args
*uap
, register_t
*retval
)
813 syscallarg(int) gidsetsize;
814 syscallarg(netbsd32_gid_tp) gidset;
816 struct sys_getgroups_args ua
;
818 /* Since sizeof (gid_t) == sizeof (netbsd32_gid_t) ... */
820 NETBSD32TO64_UAP(gidsetsize
);
821 NETBSD32TOP_UAP(gidset
, gid_t
);
822 return (sys_getgroups(l
, &ua
, retval
));
826 netbsd32_setgroups(struct lwp
*l
, const struct netbsd32_setgroups_args
*uap
, register_t
*retval
)
829 syscallarg(int) gidsetsize;
830 syscallarg(const netbsd32_gid_tp) gidset;
832 struct sys_setgroups_args ua
;
834 NETBSD32TO64_UAP(gidsetsize
);
835 NETBSD32TOP_UAP(gidset
, gid_t
);
836 return (sys_setgroups(l
, &ua
, retval
));
840 netbsd32_setpgid(struct lwp
*l
, const struct netbsd32_setpgid_args
*uap
, register_t
*retval
)
844 syscallarg(int) pgid;
846 struct sys_setpgid_args ua
;
848 NETBSD32TO64_UAP(pid
);
849 NETBSD32TO64_UAP(pgid
);
850 return (sys_setpgid(l
, &ua
, retval
));
854 netbsd32_fcntl(struct lwp
*l
, const struct netbsd32_fcntl_args
*uap
, register_t
*retval
)
859 syscallarg(netbsd32_voidp) arg;
861 struct sys_fcntl_args ua
;
863 NETBSD32TO64_UAP(fd
);
864 NETBSD32TO64_UAP(cmd
);
865 NETBSD32TOP_UAP(arg
, void);
866 /* we can do this because `struct flock' doesn't change */
867 return (sys_fcntl(l
, &ua
, retval
));
871 netbsd32_dup2(struct lwp
*l
, const struct netbsd32_dup2_args
*uap
, register_t
*retval
)
874 syscallarg(int) from;
877 struct sys_dup2_args ua
;
879 NETBSD32TO64_UAP(from
);
880 NETBSD32TO64_UAP(to
);
881 return (sys_dup2(l
, &ua
, retval
));
885 netbsd32_fsync(struct lwp
*l
, const struct netbsd32_fsync_args
*uap
, register_t
*retval
)
890 struct sys_fsync_args ua
;
892 NETBSD32TO64_UAP(fd
);
893 return (sys_fsync(l
, &ua
, retval
));
897 netbsd32_setpriority(struct lwp
*l
, const struct netbsd32_setpriority_args
*uap
, register_t
*retval
)
900 syscallarg(int) which;
902 syscallarg(int) prio;
904 struct sys_setpriority_args ua
;
906 NETBSD32TO64_UAP(which
);
907 NETBSD32TO64_UAP(who
);
908 NETBSD32TO64_UAP(prio
);
909 return (sys_setpriority(l
, &ua
, retval
));
913 netbsd32___socket30(struct lwp
*l
, const struct netbsd32___socket30_args
*uap
, register_t
*retval
)
916 syscallarg(int) domain;
917 syscallarg(int) type;
918 syscallarg(int) protocol;
920 struct sys___socket30_args ua
;
922 NETBSD32TO64_UAP(domain
);
923 NETBSD32TO64_UAP(type
);
924 NETBSD32TO64_UAP(protocol
);
925 return (sys___socket30(l
, &ua
, retval
));
929 netbsd32_connect(struct lwp
*l
, const struct netbsd32_connect_args
*uap
, register_t
*retval
)
933 syscallarg(const netbsd32_sockaddrp_t) name;
934 syscallarg(int) namelen;
936 struct sys_connect_args ua
;
939 NETBSD32TOP_UAP(name
, struct sockaddr
);
940 NETBSD32TO64_UAP(namelen
);
941 return (sys_connect(l
, &ua
, retval
));
945 netbsd32_getpriority(struct lwp
*l
, const struct netbsd32_getpriority_args
*uap
, register_t
*retval
)
948 syscallarg(int) which;
951 struct sys_getpriority_args ua
;
953 NETBSD32TO64_UAP(which
);
954 NETBSD32TO64_UAP(who
);
955 return (sys_getpriority(l
, &ua
, retval
));
959 netbsd32_bind(struct lwp
*l
, const struct netbsd32_bind_args
*uap
, register_t
*retval
)
963 syscallarg(const netbsd32_sockaddrp_t) name;
964 syscallarg(int) namelen;
966 struct sys_bind_args ua
;
969 NETBSD32TOP_UAP(name
, struct sockaddr
);
970 NETBSD32TO64_UAP(namelen
);
971 return (sys_bind(l
, &ua
, retval
));
975 netbsd32_setsockopt(struct lwp
*l
, const struct netbsd32_setsockopt_args
*uap
, register_t
*retval
)
979 syscallarg(int) level;
980 syscallarg(int) name;
981 syscallarg(const netbsd32_voidp) val;
982 syscallarg(int) valsize;
984 struct sys_setsockopt_args ua
;
987 NETBSD32TO64_UAP(level
);
988 NETBSD32TO64_UAP(name
);
989 NETBSD32TOP_UAP(val
, void);
990 NETBSD32TO64_UAP(valsize
);
991 /* may be more efficient to do this inline. */
992 return (sys_setsockopt(l
, &ua
, retval
));
996 netbsd32_listen(struct lwp
*l
, const struct netbsd32_listen_args
*uap
, register_t
*retval
)
1000 syscallarg(int) backlog;
1002 struct sys_listen_args ua
;
1004 NETBSD32TO64_UAP(s
);
1005 NETBSD32TO64_UAP(backlog
);
1006 return (sys_listen(l
, &ua
, retval
));
1010 netbsd32_fchown(struct lwp
*l
, const struct netbsd32_fchown_args
*uap
, register_t
*retval
)
1014 syscallarg(uid_t) uid;
1015 syscallarg(gid_t) gid;
1017 struct sys_fchown_args ua
;
1019 NETBSD32TO64_UAP(fd
);
1020 NETBSD32TO64_UAP(uid
);
1021 NETBSD32TO64_UAP(gid
);
1022 return (sys_fchown(l
, &ua
, retval
));
1026 netbsd32_fchmod(struct lwp
*l
, const struct netbsd32_fchmod_args
*uap
, register_t
*retval
)
1030 syscallarg(mode_t) mode;
1032 struct sys_fchmod_args ua
;
1034 NETBSD32TO64_UAP(fd
);
1035 NETBSD32TO64_UAP(mode
);
1036 return (sys_fchmod(l
, &ua
, retval
));
1040 netbsd32_setreuid(struct lwp
*l
, const struct netbsd32_setreuid_args
*uap
, register_t
*retval
)
1043 syscallarg(uid_t) ruid;
1044 syscallarg(uid_t) euid;
1046 struct sys_setreuid_args ua
;
1048 NETBSD32TO64_UAP(ruid
);
1049 NETBSD32TO64_UAP(euid
);
1050 return (sys_setreuid(l
, &ua
, retval
));
1054 netbsd32_setregid(struct lwp
*l
, const struct netbsd32_setregid_args
*uap
, register_t
*retval
)
1057 syscallarg(gid_t) rgid;
1058 syscallarg(gid_t) egid;
1060 struct sys_setregid_args ua
;
1062 NETBSD32TO64_UAP(rgid
);
1063 NETBSD32TO64_UAP(egid
);
1064 return (sys_setregid(l
, &ua
, retval
));
1068 netbsd32_getsockopt(struct lwp
*l
, const struct netbsd32_getsockopt_args
*uap
, register_t
*retval
)
1072 syscallarg(int) level;
1073 syscallarg(int) name;
1074 syscallarg(netbsd32_voidp) val;
1075 syscallarg(netbsd32_intp) avalsize;
1077 struct sys_getsockopt_args ua
;
1079 NETBSD32TO64_UAP(s
);
1080 NETBSD32TO64_UAP(level
);
1081 NETBSD32TO64_UAP(name
);
1082 NETBSD32TOP_UAP(val
, void);
1083 NETBSD32TOP_UAP(avalsize
, socklen_t
);
1084 return (sys_getsockopt(l
, &ua
, retval
));
1088 netbsd32_rename(struct lwp
*l
, const struct netbsd32_rename_args
*uap
, register_t
*retval
)
1091 syscallarg(const netbsd32_charp) from;
1092 syscallarg(const netbsd32_charp) to;
1094 struct sys_rename_args ua
;
1096 NETBSD32TOP_UAP(from
, const char);
1097 NETBSD32TOP_UAP(to
, const char);
1099 return (sys_rename(l
, &ua
, retval
));
1103 netbsd32_flock(struct lwp
*l
, const struct netbsd32_flock_args
*uap
, register_t
*retval
)
1107 syscallarg(int) how;
1109 struct sys_flock_args ua
;
1111 NETBSD32TO64_UAP(fd
);
1112 NETBSD32TO64_UAP(how
);
1114 return (sys_flock(l
, &ua
, retval
));
1118 netbsd32_mkfifo(struct lwp
*l
, const struct netbsd32_mkfifo_args
*uap
, register_t
*retval
)
1121 syscallarg(const netbsd32_charp) path;
1122 syscallarg(mode_t) mode;
1124 struct sys_mkfifo_args ua
;
1126 NETBSD32TOP_UAP(path
, const char);
1127 NETBSD32TO64_UAP(mode
);
1128 return (sys_mkfifo(l
, &ua
, retval
));
1132 netbsd32_shutdown(struct lwp
*l
, const struct netbsd32_shutdown_args
*uap
, register_t
*retval
)
1136 syscallarg(int) how;
1138 struct sys_shutdown_args ua
;
1140 NETBSD32TO64_UAP(s
);
1141 NETBSD32TO64_UAP(how
);
1142 return (sys_shutdown(l
, &ua
, retval
));
1146 netbsd32_socketpair(struct lwp
*l
, const struct netbsd32_socketpair_args
*uap
, register_t
*retval
)
1149 syscallarg(int) domain;
1150 syscallarg(int) type;
1151 syscallarg(int) protocol;
1152 syscallarg(netbsd32_intp) rsv;
1154 struct sys_socketpair_args ua
;
1156 NETBSD32TO64_UAP(domain
);
1157 NETBSD32TO64_UAP(type
);
1158 NETBSD32TO64_UAP(protocol
);
1159 NETBSD32TOP_UAP(rsv
, int);
1160 /* Since we're just copying out two `int's we can do this */
1161 return (sys_socketpair(l
, &ua
, retval
));
1165 netbsd32_mkdir(struct lwp
*l
, const struct netbsd32_mkdir_args
*uap
, register_t
*retval
)
1168 syscallarg(const netbsd32_charp) path;
1169 syscallarg(mode_t) mode;
1171 struct sys_mkdir_args ua
;
1173 NETBSD32TOP_UAP(path
, const char);
1174 NETBSD32TO64_UAP(mode
);
1175 return (sys_mkdir(l
, &ua
, retval
));
1179 netbsd32_rmdir(struct lwp
*l
, const struct netbsd32_rmdir_args
*uap
, register_t
*retval
)
1182 syscallarg(const netbsd32_charp) path;
1184 struct sys_rmdir_args ua
;
1186 NETBSD32TOP_UAP(path
, const char);
1187 return (sys_rmdir(l
, &ua
, retval
));
1191 netbsd32_quotactl(struct lwp
*l
, const struct netbsd32_quotactl_args
*uap
, register_t
*retval
)
1194 syscallarg(const netbsd32_charp) path;
1195 syscallarg(int) cmd;
1196 syscallarg(int) uid;
1197 syscallarg(netbsd32_voidp) arg;
1199 struct sys_quotactl_args ua
;
1201 NETBSD32TOP_UAP(path
, const char);
1202 NETBSD32TO64_UAP(cmd
);
1203 NETBSD32TO64_UAP(uid
);
1204 NETBSD32TOP_UAP(arg
, void *);
1205 return (sys_quotactl(l
, &ua
, retval
));
1209 netbsd32_nfssvc(struct lwp
*l
, const struct netbsd32_nfssvc_args
*uap
, register_t
*retval
)
1213 syscallarg(int) flag;
1214 syscallarg(netbsd32_voidp) argp;
1216 struct sys_nfssvc_args ua
;
1218 NETBSD32TO64_UAP(flag
);
1219 NETBSD32TOP_UAP(argp
, void);
1220 return (sys_nfssvc(l
, &ua
, retval
));
1222 /* Why would we want to support a 32-bit nfsd? */
1228 netbsd32___getfh30(struct lwp
*l
, const struct netbsd32___getfh30_args
*uap
, register_t
*retval
)
1231 syscallarg(const netbsd32_charp) fname;
1232 syscallarg(netbsd32_fhandlep_t) fhp;
1233 syscallarg(netbsd32_size_tp) fh_size;
1238 struct nameidata nd
;
1239 netbsd32_size_t sz32
;
1243 * Must be super user
1245 error
= kauth_authorize_system(l
->l_cred
, KAUTH_SYSTEM_FILEHANDLE
,
1246 0, NULL
, NULL
, NULL
);
1250 NDINIT(&nd
, LOOKUP
, FOLLOW
| LOCKLEAF
| TRYEMULROOT
, UIO_USERSPACE
,
1251 SCARG_P32(uap
, fname
));
1256 error
= copyin(SCARG_P32(uap
, fh_size
), &sz32
,
1257 sizeof(netbsd32_size_t
));
1259 fh
= malloc(sz32
, M_TEMP
, M_WAITOK
);
1263 error
= vfs_composefh(vp
, fh
, &sz
);
1268 copyout(&sz
, SCARG_P32(uap
, fh_size
), sizeof(size_t));
1270 error
= copyout(&sz32
, SCARG_P32(uap
, fh_size
),
1271 sizeof(netbsd32_size_t
));
1273 error
= copyout(fh
, SCARG_P32(uap
, fhp
), sz
);
1280 netbsd32_pread(struct lwp
*l
, const struct netbsd32_pread_args
*uap
, register_t
*retval
)
1284 syscallarg(netbsd32_voidp) buf;
1285 syscallarg(netbsd32_size_t) nbyte;
1286 syscallarg(int) PAD;
1287 syscallarg(off_t) offset;
1289 struct sys_pread_args ua
;
1291 NETBSD32TO64_UAP(fd
);
1292 NETBSD32TOP_UAP(buf
, void);
1293 NETBSD32TOX_UAP(nbyte
, size_t);
1294 NETBSD32TO64_UAP(PAD
);
1295 NETBSD32TO64_UAP(offset
);
1296 return sys_pread(l
, &ua
, retval
);
1300 netbsd32_pwrite(struct lwp
*l
, const struct netbsd32_pwrite_args
*uap
, register_t
*retval
)
1304 syscallarg(const netbsd32_voidp) buf;
1305 syscallarg(netbsd32_size_t) nbyte;
1306 syscallarg(int) PAD;
1307 syscallarg(off_t) offset;
1309 struct sys_pwrite_args ua
;
1311 NETBSD32TO64_UAP(fd
);
1312 NETBSD32TOP_UAP(buf
, void);
1313 NETBSD32TOX_UAP(nbyte
, size_t);
1314 NETBSD32TO64_UAP(PAD
);
1315 NETBSD32TO64_UAP(offset
);
1316 return sys_pwrite(l
, &ua
, retval
);
1320 netbsd32_setgid(struct lwp
*l
, const struct netbsd32_setgid_args
*uap
, register_t
*retval
)
1323 syscallarg(gid_t) gid;
1325 struct sys_setgid_args ua
;
1327 NETBSD32TO64_UAP(gid
);
1328 return (sys_setgid(l
, &ua
, retval
));
1332 netbsd32_setegid(struct lwp
*l
, const struct netbsd32_setegid_args
*uap
, register_t
*retval
)
1335 syscallarg(gid_t) egid;
1337 struct sys_setegid_args ua
;
1339 NETBSD32TO64_UAP(egid
);
1340 return (sys_setegid(l
, &ua
, retval
));
1344 netbsd32_seteuid(struct lwp
*l
, const struct netbsd32_seteuid_args
*uap
, register_t
*retval
)
1347 syscallarg(gid_t) euid;
1349 struct sys_seteuid_args ua
;
1351 NETBSD32TO64_UAP(euid
);
1352 return (sys_seteuid(l
, &ua
, retval
));
1357 netbsd32_lfs_bmapv(struct lwp
*l
, const struct netbsd32_lfs_bmapv_args
*v
, register_t
*retval
)
1360 return (ENOSYS
); /* XXX */
1364 netbsd32_lfs_markv(struct lwp
*l
, const struct netbsd32_lfs_markv_args
*v
, register_t
*retval
)
1367 return (ENOSYS
); /* XXX */
1371 netbsd32_lfs_segclean(struct lwp
*l
, const struct netbsd32_lfs_segclean_args
*v
, register_t
*retval
)
1374 return (ENOSYS
); /* XXX */
1378 netbsd32___lfs_segwait50(struct lwp
*l
, const struct netbsd32___lfs_segwait50_args
*v
, register_t
*retval
)
1381 return (ENOSYS
); /* XXX */
1386 netbsd32_pathconf(struct lwp
*l
, const struct netbsd32_pathconf_args
*uap
, register_t
*retval
)
1390 syscallarg(int) name;
1392 struct sys_pathconf_args ua
;
1394 NETBSD32TOP_UAP(path
, const char);
1395 NETBSD32TO64_UAP(name
);
1396 return sys_pathconf(l
, &ua
, retval
);
1400 netbsd32_fpathconf(struct lwp
*l
, const struct netbsd32_fpathconf_args
*uap
, register_t
*retval
)
1404 syscallarg(int) name;
1406 struct sys_fpathconf_args ua
;
1408 NETBSD32TO64_UAP(fd
);
1409 NETBSD32TO64_UAP(name
);
1410 return sys_fpathconf(l
, &ua
, retval
);
1414 netbsd32_getrlimit(struct lwp
*l
, const struct netbsd32_getrlimit_args
*uap
, register_t
*retval
)
1417 syscallarg(int) which;
1418 syscallarg(netbsd32_rlimitp_t) rlp;
1420 int which
= SCARG(uap
, which
);
1422 if ((u_int
)which
>= RLIM_NLIMITS
)
1424 return (copyout(&l
->l_proc
->p_rlimit
[which
],
1425 SCARG_P32(uap
, rlp
), sizeof(struct rlimit
)));
1429 netbsd32_setrlimit(struct lwp
*l
, const struct netbsd32_setrlimit_args
*uap
, register_t
*retval
)
1432 syscallarg(int) which;
1433 syscallarg(const netbsd32_rlimitp_t) rlp;
1435 int which
= SCARG(uap
, which
);
1439 error
= copyin(SCARG_P32(uap
, rlp
), &alim
, sizeof(struct rlimit
));
1445 if (LIMITCHECK(alim
.rlim_cur
, MAXDSIZ32
))
1446 alim
.rlim_cur
= MAXDSIZ32
;
1447 if (LIMITCHECK(alim
.rlim_max
, MAXDSIZ32
))
1448 alim
.rlim_max
= MAXDSIZ32
;
1452 if (LIMITCHECK(alim
.rlim_cur
, MAXSSIZ32
))
1453 alim
.rlim_cur
= MAXSSIZ32
;
1454 if (LIMITCHECK(alim
.rlim_max
, MAXSSIZ32
))
1455 alim
.rlim_max
= MAXSSIZ32
;
1460 return (dosetrlimit(l
, l
->l_proc
, which
, &alim
));
1464 netbsd32_mmap(struct lwp
*l
, const struct netbsd32_mmap_args
*uap
, register_t
*retval
)
1467 syscallarg(netbsd32_voidp) addr;
1468 syscallarg(netbsd32_size_t) len;
1469 syscallarg(int) prot;
1470 syscallarg(int) flags;
1472 syscallarg(netbsd32_long) PAD;
1473 syscallarg(off_t) pos;
1475 struct sys_mmap_args ua
;
1478 NETBSD32TOP_UAP(addr
, void);
1479 NETBSD32TOX_UAP(len
, size_t);
1480 NETBSD32TO64_UAP(prot
);
1481 NETBSD32TO64_UAP(flags
);
1482 NETBSD32TO64_UAP(fd
);
1483 NETBSD32TOX_UAP(PAD
, long);
1484 NETBSD32TOX_UAP(pos
, off_t
);
1485 error
= sys_mmap(l
, &ua
, retval
);
1486 if ((u_long
)*retval
> (u_long
)UINT_MAX
) {
1487 printf("netbsd32_mmap: retval out of range: 0x%lx",
1489 /* Should try to recover and return an error here. */
1495 netbsd32_mremap(struct lwp
*l
, const struct netbsd32_mremap_args
*uap
, register_t
*retval
)
1498 syscallarg(void *) old_address;
1499 syscallarg(size_t) old_size;
1500 syscallarg(void *) new_address;
1501 syscallarg(size_t) new_size;
1502 syscallarg(int) flags;
1504 struct sys_mremap_args ua
;
1506 NETBSD32TOP_UAP(old_address
, void);
1507 NETBSD32TOX_UAP(old_size
, size_t);
1508 NETBSD32TOP_UAP(new_address
, void);
1509 NETBSD32TOX_UAP(new_size
, size_t);
1510 NETBSD32TO64_UAP(flags
);
1512 return sys_mremap(l
, &ua
, retval
);
1516 netbsd32_lseek(struct lwp
*l
, const struct netbsd32_lseek_args
*uap
, register_t
*retval
)
1520 syscallarg(int) PAD;
1521 syscallarg(off_t) offset;
1522 syscallarg(int) whence;
1524 struct sys_lseek_args ua
;
1526 register_t retval64
[2];
1527 register32_t retval32
[4];
1531 NETBSD32TO64_UAP(fd
);
1532 NETBSD32TO64_UAP(PAD
);
1533 NETBSD32TO64_UAP(offset
);
1534 NETBSD32TO64_UAP(whence
);
1535 rv
= sys_lseek(l
, &ua
, newpos
.retval64
);
1538 * We have to split the 64 bit value into 2 halves which will
1539 * end up in separate 32 bit registers.
1540 * This should DTRT on big and little-endian systems provided that
1541 * gcc's 'strict aliasing' tests don't decide that the retval32[]
1542 * entries can't have been assigned to, so need not be read!
1544 retval
[0] = newpos
.retval32
[0];
1545 retval
[1] = newpos
.retval32
[1];
1551 netbsd32_truncate(struct lwp
*l
, const struct netbsd32_truncate_args
*uap
, register_t
*retval
)
1554 syscallarg(const netbsd32_charp) path;
1555 syscallarg(int) PAD;
1556 syscallarg(off_t) length;
1558 struct sys_truncate_args ua
;
1560 NETBSD32TOP_UAP(path
, const char);
1561 NETBSD32TO64_UAP(PAD
);
1562 NETBSD32TO64_UAP(length
);
1563 return (sys_truncate(l
, &ua
, retval
));
1567 netbsd32_ftruncate(struct lwp
*l
, const struct netbsd32_ftruncate_args
*uap
, register_t
*retval
)
1571 syscallarg(int) PAD;
1572 syscallarg(off_t) length;
1574 struct sys_ftruncate_args ua
;
1576 NETBSD32TO64_UAP(fd
);
1577 NETBSD32TO64_UAP(PAD
);
1578 NETBSD32TO64_UAP(length
);
1579 return (sys_ftruncate(l
, &ua
, retval
));
1583 netbsd32_mlock(struct lwp
*l
, const struct netbsd32_mlock_args
*uap
, register_t
*retval
)
1586 syscallarg(const netbsd32_voidp) addr;
1587 syscallarg(netbsd32_size_t) len;
1589 struct sys_mlock_args ua
;
1591 NETBSD32TOP_UAP(addr
, const void);
1592 NETBSD32TO64_UAP(len
);
1593 return (sys_mlock(l
, &ua
, retval
));
1597 netbsd32_munlock(struct lwp
*l
, const struct netbsd32_munlock_args
*uap
, register_t
*retval
)
1600 syscallarg(const netbsd32_voidp) addr;
1601 syscallarg(netbsd32_size_t) len;
1603 struct sys_munlock_args ua
;
1605 NETBSD32TOP_UAP(addr
, const void);
1606 NETBSD32TO64_UAP(len
);
1607 return (sys_munlock(l
, &ua
, retval
));
1611 netbsd32_undelete(struct lwp
*l
, const struct netbsd32_undelete_args
*uap
, register_t
*retval
)
1614 syscallarg(const netbsd32_charp) path;
1616 struct sys_undelete_args ua
;
1618 NETBSD32TOP_UAP(path
, const char);
1619 return (sys_undelete(l
, &ua
, retval
));
1623 netbsd32_getpgid(struct lwp
*l
, const struct netbsd32_getpgid_args
*uap
, register_t
*retval
)
1626 syscallarg(pid_t) pid;
1628 struct sys_getpgid_args ua
;
1630 NETBSD32TO64_UAP(pid
);
1631 return (sys_getpgid(l
, &ua
, retval
));
1635 netbsd32_reboot(struct lwp
*l
, const struct netbsd32_reboot_args
*uap
, register_t
*retval
)
1638 syscallarg(int) opt;
1639 syscallarg(netbsd32_charp) bootstr;
1641 struct sys_reboot_args ua
;
1643 NETBSD32TO64_UAP(opt
);
1644 NETBSD32TOP_UAP(bootstr
, char);
1645 return (sys_reboot(l
, &ua
, retval
));
1648 #include <sys/poll.h>
1650 netbsd32_poll(struct lwp
*l
, const struct netbsd32_poll_args
*uap
, register_t
*retval
)
1653 syscallarg(netbsd32_pollfdp_t) fds;
1654 syscallarg(u_int) nfds;
1655 syscallarg(int) timeout;
1657 struct sys_poll_args ua
;
1659 NETBSD32TOP_UAP(fds
, struct pollfd
);
1660 NETBSD32TO64_UAP(nfds
);
1661 NETBSD32TO64_UAP(timeout
);
1663 return (sys_poll(l
, &ua
, retval
));
1667 netbsd32_fdatasync(struct lwp
*l
, const struct netbsd32_fdatasync_args
*uap
, register_t
*retval
)
1672 struct sys_fdatasync_args ua
;
1674 NETBSD32TO64_UAP(fd
);
1675 return (sys_fdatasync(l
, &ua
, retval
));
1679 netbsd32___posix_rename(struct lwp
*l
, const struct netbsd32___posix_rename_args
*uap
, register_t
*retval
)
1682 syscallarg(const netbsd32_charp) from;
1683 syscallarg(const netbsd32_charp) to;
1685 struct sys___posix_rename_args ua
;
1687 NETBSD32TOP_UAP(from
, const char);
1688 NETBSD32TOP_UAP(to
, const char);
1689 return (sys___posix_rename(l
, &ua
, retval
));
1693 netbsd32_swapctl(struct lwp
*l
, const struct netbsd32_swapctl_args
*uap
, register_t
*retval
)
1696 syscallarg(int) cmd;
1697 syscallarg(const netbsd32_voidp) arg;
1698 syscallarg(int) misc;
1700 struct sys_swapctl_args ua
;
1702 NETBSD32TO64_UAP(cmd
);
1703 NETBSD32TOP_UAP(arg
, void);
1704 NETBSD32TO64_UAP(misc
);
1705 return (sys_swapctl(l
, &ua
, retval
));
1709 netbsd32_minherit(struct lwp
*l
, const struct netbsd32_minherit_args
*uap
, register_t
*retval
)
1712 syscallarg(netbsd32_voidp) addr;
1713 syscallarg(netbsd32_size_t) len;
1714 syscallarg(int) inherit;
1716 struct sys_minherit_args ua
;
1718 NETBSD32TOP_UAP(addr
, void);
1719 NETBSD32TOX_UAP(len
, size_t);
1720 NETBSD32TO64_UAP(inherit
);
1721 return (sys_minherit(l
, &ua
, retval
));
1725 netbsd32_lchmod(struct lwp
*l
, const struct netbsd32_lchmod_args
*uap
, register_t
*retval
)
1728 syscallarg(const netbsd32_charp) path;
1729 syscallarg(mode_t) mode;
1731 struct sys_lchmod_args ua
;
1733 NETBSD32TOP_UAP(path
, const char);
1734 NETBSD32TO64_UAP(mode
);
1735 return (sys_lchmod(l
, &ua
, retval
));
1739 netbsd32_lchown(struct lwp
*l
, const struct netbsd32_lchown_args
*uap
, register_t
*retval
)
1742 syscallarg(const netbsd32_charp) path;
1743 syscallarg(uid_t) uid;
1744 syscallarg(gid_t) gid;
1746 struct sys_lchown_args ua
;
1748 NETBSD32TOP_UAP(path
, const char);
1749 NETBSD32TO64_UAP(uid
);
1750 NETBSD32TO64_UAP(gid
);
1751 return (sys_lchown(l
, &ua
, retval
));
1755 netbsd32___msync13(struct lwp
*l
, const struct netbsd32___msync13_args
*uap
, register_t
*retval
)
1758 syscallarg(netbsd32_voidp) addr;
1759 syscallarg(netbsd32_size_t) len;
1760 syscallarg(int) flags;
1762 struct sys___msync13_args ua
;
1764 NETBSD32TOP_UAP(addr
, void);
1765 NETBSD32TOX_UAP(len
, size_t);
1766 NETBSD32TO64_UAP(flags
);
1767 return (sys___msync13(l
, &ua
, retval
));
1771 netbsd32___posix_chown(struct lwp
*l
, const struct netbsd32___posix_chown_args
*uap
, register_t
*retval
)
1774 syscallarg(const netbsd32_charp) path;
1775 syscallarg(uid_t) uid;
1776 syscallarg(gid_t) gid;
1778 struct sys___posix_chown_args ua
;
1780 NETBSD32TOP_UAP(path
, const char);
1781 NETBSD32TO64_UAP(uid
);
1782 NETBSD32TO64_UAP(gid
);
1783 return (sys___posix_chown(l
, &ua
, retval
));
1787 netbsd32___posix_fchown(struct lwp
*l
, const struct netbsd32___posix_fchown_args
*uap
, register_t
*retval
)
1791 syscallarg(uid_t) uid;
1792 syscallarg(gid_t) gid;
1794 struct sys___posix_fchown_args ua
;
1796 NETBSD32TO64_UAP(fd
);
1797 NETBSD32TO64_UAP(uid
);
1798 NETBSD32TO64_UAP(gid
);
1799 return (sys___posix_fchown(l
, &ua
, retval
));
1803 netbsd32___posix_lchown(struct lwp
*l
, const struct netbsd32___posix_lchown_args
*uap
, register_t
*retval
)
1806 syscallarg(const netbsd32_charp) path;
1807 syscallarg(uid_t) uid;
1808 syscallarg(gid_t) gid;
1810 struct sys___posix_lchown_args ua
;
1812 NETBSD32TOP_UAP(path
, const char);
1813 NETBSD32TO64_UAP(uid
);
1814 NETBSD32TO64_UAP(gid
);
1815 return (sys___posix_lchown(l
, &ua
, retval
));
1819 netbsd32_getsid(struct lwp
*l
, const struct netbsd32_getsid_args
*uap
, register_t
*retval
)
1822 syscallarg(pid_t) pid;
1824 struct sys_getsid_args ua
;
1826 NETBSD32TO64_UAP(pid
);
1827 return (sys_getsid(l
, &ua
, retval
));
1831 netbsd32_fktrace(struct lwp
*l
, const struct netbsd32_fktrace_args
*uap
, register_t
*retval
)
1835 syscallarg(int) ops;
1836 syscallarg(int) facs;
1837 syscallarg(int) pid;
1839 struct sys_fktrace_args ua
;
1841 NETBSD32TOX_UAP(fd
, int);
1842 NETBSD32TO64_UAP(ops
);
1843 NETBSD32TO64_UAP(facs
);
1844 NETBSD32TO64_UAP(pid
);
1845 return (sys_fktrace(l
, &ua
, retval
));
1849 netbsd32___sigpending14(struct lwp
*l
, const struct netbsd32___sigpending14_args
*uap
, register_t
*retval
)
1852 syscallarg(sigset_t *) set;
1854 struct sys___sigpending14_args ua
;
1856 NETBSD32TOP_UAP(set
, sigset_t
);
1857 return (sys___sigpending14(l
, &ua
, retval
));
1861 netbsd32___sigprocmask14(struct lwp
*l
, const struct netbsd32___sigprocmask14_args
*uap
, register_t
*retval
)
1864 syscallarg(int) how;
1865 syscallarg(const sigset_t *) set;
1866 syscallarg(sigset_t *) oset;
1868 struct sys___sigprocmask14_args ua
;
1870 NETBSD32TO64_UAP(how
);
1871 NETBSD32TOP_UAP(set
, sigset_t
);
1872 NETBSD32TOP_UAP(oset
, sigset_t
);
1873 return (sys___sigprocmask14(l
, &ua
, retval
));
1877 netbsd32___sigsuspend14(struct lwp
*l
, const struct netbsd32___sigsuspend14_args
*uap
, register_t
*retval
)
1880 syscallarg(const sigset_t *) set;
1882 struct sys___sigsuspend14_args ua
;
1884 NETBSD32TOP_UAP(set
, sigset_t
);
1885 return (sys___sigsuspend14(l
, &ua
, retval
));
1889 netbsd32_fchroot(struct lwp
*l
, const struct netbsd32_fchroot_args
*uap
, register_t
*retval
)
1894 struct sys_fchroot_args ua
;
1896 NETBSD32TO64_UAP(fd
);
1897 return (sys_fchroot(l
, &ua
, retval
));
1901 * Open a file given a file handle.
1903 * Check permissions, allocate an open file structure,
1904 * and call the device open routine if any.
1907 netbsd32___fhopen40(struct lwp
*l
, const struct netbsd32___fhopen40_args
*uap
, register_t
*retval
)
1910 syscallarg(const netbsd32_pointer_t *) fhp;
1911 syscallarg(netbsd32_size_t) fh_size;
1912 syscallarg(int) flags;
1914 struct sys___fhopen40_args ua
;
1916 NETBSD32TOP_UAP(fhp
, fhandle_t
);
1917 NETBSD32TO64_UAP(fh_size
);
1918 NETBSD32TO64_UAP(flags
);
1919 return (sys___fhopen40(l
, &ua
, retval
));
1922 /* virtual memory syscalls */
1924 netbsd32_ovadvise(struct lwp
*l
, const struct netbsd32_ovadvise_args
*uap
, register_t
*retval
)
1927 syscallarg(int) anom;
1929 struct sys_ovadvise_args ua
;
1931 NETBSD32TO64_UAP(anom
);
1932 return (sys_ovadvise(l
, &ua
, retval
));
1936 netbsd32_adjust_limits(struct proc
*p
)
1938 static const struct {
1942 { RLIMIT_DATA
, MAXDSIZ32
},
1943 { RLIMIT_STACK
, MAXSSIZ32
},
1947 struct rlimit
*rlim
;
1950 * We can only reduce the current limits, we cannot stop external
1951 * processes from changing them (eg via sysctl) later on.
1952 * So there is no point trying to lock out such changes here.
1954 * If we assume that rlim_cur/max are accessed using atomic
1955 * operations, we don't need to lock against any other updates
1956 * that might happen if the plimit structure is shared writable
1957 * between multiple processes.
1960 /* Scan to determine is any limits are out of range */
1962 for (i
= 0; ; i
++) {
1963 if (i
>= __arraycount(lm
))
1966 rlim
= lim
->pl_rlimit
+ lm
[i
].id
;
1967 if (LIMITCHECK(rlim
->rlim_cur
, lm
[i
].lim
))
1969 if (LIMITCHECK(rlim
->rlim_max
, lm
[i
].lim
))
1973 lim_privatise(p
, false);
1976 for (i
= 0; i
< __arraycount(lm
); i
++) {
1977 rlim
= lim
->pl_rlimit
+ lm
[i
].id
;
1978 if (LIMITCHECK(rlim
->rlim_cur
, lm
[i
].lim
))
1979 rlim
->rlim_cur
= lm
[i
].lim
;
1980 if (LIMITCHECK(rlim
->rlim_max
, lm
[i
].lim
))
1981 rlim
->rlim_max
= lm
[i
].lim
;
1986 netbsd32_uuidgen(struct lwp
*l
, const struct netbsd32_uuidgen_args
*uap
, register_t
*retval
)
1989 syscallarg(netbsd32_uuidp_t) store;
1990 syscallarg(int) count;
1992 struct sys_uuidgen_args ua
;
1994 NETBSD32TOP_UAP(store
, struct uuid
);
1995 NETBSD32TO64_UAP(count
);
1996 return (sys_uuidgen(l
, &ua
, retval
));
2000 netbsd32_extattrctl(struct lwp
*l
, const struct netbsd32_extattrctl_args
*uap
, register_t
*retval
)
2003 syscallarg(const netbsd32_charp) path;
2004 syscallarg(int) cmd;
2005 syscallarg(const netbsd32_charp) filename;
2006 syscallarg(int) attrnamespace;
2007 syscallarg(const netbsd32_charp) attrname;
2009 struct sys_extattrctl_args ua
;
2011 NETBSD32TOP_UAP(path
, const char);
2012 NETBSD32TO64_UAP(cmd
);
2013 NETBSD32TOP_UAP(filename
, const char);
2014 NETBSD32TO64_UAP(attrnamespace
);
2015 NETBSD32TOP_UAP(attrname
, const char);
2016 return sys_extattrctl(l
, &ua
, retval
);
2020 netbsd32_extattr_set_fd(struct lwp
*l
, const struct netbsd32_extattr_set_fd_args
*uap
, register_t
*retval
)
2024 syscallarg(int) attrnamespace;
2025 syscallarg(const netbsd32_charp) attrname;
2026 syscallarg(const netbsd32_voidp) data;
2027 syscallarg(netbsd32_size_t) nbytes;
2029 struct sys_extattr_set_fd_args ua
;
2031 NETBSD32TO64_UAP(fd
);
2032 NETBSD32TO64_UAP(attrnamespace
);
2033 NETBSD32TOP_UAP(attrname
, const char);
2034 NETBSD32TOP_UAP(data
, const void);
2035 NETBSD32TOX_UAP(nbytes
, size_t);
2036 return sys_extattr_set_fd(l
, &ua
, retval
);
2040 netbsd32_extattr_set_file(struct lwp
*l
, const struct netbsd32_extattr_set_file_args
*uap
, register_t
*retval
)
2043 syscallarg(const netbsd32_charp) path;
2044 syscallarg(int) attrnamespace;
2045 syscallarg(const netbsd32_charp) attrname;
2046 syscallarg(const netbsd32_voidp) data;
2047 syscallarg(netbsd32_size_t) nbytes;
2049 struct sys_extattr_set_file_args ua
;
2051 NETBSD32TOP_UAP(path
, const char);
2052 NETBSD32TO64_UAP(attrnamespace
);
2053 NETBSD32TOP_UAP(attrname
, const char);
2054 NETBSD32TOP_UAP(data
, const void);
2055 NETBSD32TOX_UAP(nbytes
, size_t);
2056 return sys_extattr_set_file(l
, &ua
, retval
);
2060 netbsd32_extattr_set_link(struct lwp
*l
, const struct netbsd32_extattr_set_link_args
*uap
, register_t
*retval
)
2063 syscallarg(const netbsd32_charp) path;
2064 syscallarg(int) attrnamespace;
2065 syscallarg(const netbsd32_charp) attrname;
2066 syscallarg(const netbsd32_voidp) data;
2067 syscallarg(netbsd32_size_t) nbytes;
2069 struct sys_extattr_set_link_args ua
;
2071 NETBSD32TOP_UAP(path
, const char);
2072 NETBSD32TO64_UAP(attrnamespace
);
2073 NETBSD32TOP_UAP(attrname
, const char);
2074 NETBSD32TOP_UAP(data
, const void);
2075 NETBSD32TOX_UAP(nbytes
, size_t);
2076 return sys_extattr_set_link(l
, &ua
, retval
);
2080 netbsd32_extattr_get_fd(struct lwp
*l
, const struct netbsd32_extattr_get_fd_args
*uap
, register_t
*retval
)
2084 syscallarg(int) attrnamespace;
2085 syscallarg(const netbsd32_charp) attrname;
2086 syscallarg(netbsd32_voidp) data;
2087 syscallarg(netbsd32_size_t) nbytes;
2089 struct sys_extattr_get_fd_args ua
;
2091 NETBSD32TO64_UAP(fd
);
2092 NETBSD32TO64_UAP(attrnamespace
);
2093 NETBSD32TOP_UAP(attrname
, const char);
2094 NETBSD32TOP_UAP(data
, void);
2095 NETBSD32TOX_UAP(nbytes
, size_t);
2096 return sys_extattr_get_fd(l
, &ua
, retval
);
2100 netbsd32_extattr_get_file(struct lwp
*l
, const struct netbsd32_extattr_get_file_args
*uap
, register_t
*retval
)
2103 syscallarg(const netbsd32_charp) path;
2104 syscallarg(int) attrnamespace;
2105 syscallarg(const netbsd32_charp) attrname;
2106 syscallarg(netbsd32_voidp) data;
2107 syscallarg(netbsd32_size_t) nbytes;
2109 struct sys_extattr_get_file_args ua
;
2111 NETBSD32TOP_UAP(path
, const char);
2112 NETBSD32TO64_UAP(attrnamespace
);
2113 NETBSD32TOP_UAP(attrname
, const char);
2114 NETBSD32TOP_UAP(data
, void);
2115 NETBSD32TOX_UAP(nbytes
, size_t);
2116 return sys_extattr_get_file(l
, &ua
, retval
);
2120 netbsd32_extattr_get_link(struct lwp
*l
, const struct netbsd32_extattr_get_link_args
*uap
, register_t
*retval
)
2123 syscallarg(const netbsd32_charp) path;
2124 syscallarg(int) attrnamespace;
2125 syscallarg(const netbsd32_charp) attrname;
2126 syscallarg(netbsd32_voidp) data;
2127 syscallarg(netbsd32_size_t) nbytes;
2129 struct sys_extattr_get_link_args ua
;
2131 NETBSD32TOP_UAP(path
, const char);
2132 NETBSD32TO64_UAP(attrnamespace
);
2133 NETBSD32TOP_UAP(attrname
, const char);
2134 NETBSD32TOP_UAP(data
, void);
2135 NETBSD32TOX_UAP(nbytes
, size_t);
2136 return sys_extattr_get_link(l
, &ua
, retval
);
2140 netbsd32_extattr_delete_fd(struct lwp
*l
, const struct netbsd32_extattr_delete_fd_args
*uap
, register_t
*retval
)
2144 syscallarg(int) attrnamespace;
2145 syscallarg(const netbsd32_charp) attrname;
2147 struct sys_extattr_delete_fd_args ua
;
2149 NETBSD32TO64_UAP(fd
);
2150 NETBSD32TO64_UAP(attrnamespace
);
2151 NETBSD32TOP_UAP(attrname
, const char);
2152 return sys_extattr_delete_fd(l
, &ua
, retval
);
2156 netbsd32_extattr_delete_file(struct lwp
*l
, const struct netbsd32_extattr_delete_file_args
*uap
, register_t
*retval
)
2159 syscallarg(const netbsd32_charp) path;
2160 syscallarg(int) attrnamespace;
2161 syscallarg(const netbsd32_charp) attrname;
2163 struct sys_extattr_delete_file_args ua
;
2165 NETBSD32TOP_UAP(path
, const char);
2166 NETBSD32TO64_UAP(attrnamespace
);
2167 NETBSD32TOP_UAP(attrname
, const char);
2168 return sys_extattr_delete_file(l
, &ua
, retval
);
2172 netbsd32_extattr_delete_link(struct lwp
*l
, const struct netbsd32_extattr_delete_link_args
*uap
, register_t
*retval
)
2175 syscallarg(const netbsd32_charp) path;
2176 syscallarg(int) attrnamespace;
2177 syscallarg(const netbsd32_charp) attrname;
2179 struct sys_extattr_delete_link_args ua
;
2181 NETBSD32TOP_UAP(path
, const char);
2182 NETBSD32TO64_UAP(attrnamespace
);
2183 NETBSD32TOP_UAP(attrname
, const char);
2184 return sys_extattr_delete_link(l
, &ua
, retval
);
2188 netbsd32_extattr_list_fd(struct lwp
*l
, const struct netbsd32_extattr_list_fd_args
*uap
, register_t
*retval
)
2192 syscallarg(int) attrnamespace;
2193 syscallarg(netbsd32_voidp) data;
2194 syscallarg(netbsd32_size_t) nbytes;
2196 struct sys_extattr_list_fd_args ua
;
2198 NETBSD32TO64_UAP(fd
);
2199 NETBSD32TO64_UAP(attrnamespace
);
2200 NETBSD32TOP_UAP(data
, void);
2201 NETBSD32TOX_UAP(nbytes
, size_t);
2202 return sys_extattr_list_fd(l
, &ua
, retval
);
2206 netbsd32_extattr_list_file(struct lwp
*l
, const struct netbsd32_extattr_list_file_args
*uap
, register_t
*retval
)
2209 syscallarg(const netbsd32_charp) path;
2210 syscallarg(int) attrnamespace;
2211 syscallarg(netbsd32_voidp) data;
2212 syscallarg(netbsd32_size_t) nbytes;
2214 struct sys_extattr_list_file_args ua
;
2216 NETBSD32TOP_UAP(path
, const char);
2217 NETBSD32TO64_UAP(attrnamespace
);
2218 NETBSD32TOP_UAP(data
, void);
2219 NETBSD32TOX_UAP(nbytes
, size_t);
2220 return sys_extattr_list_file(l
, &ua
, retval
);
2224 netbsd32_extattr_list_link(struct lwp
*l
, const struct netbsd32_extattr_list_link_args
*uap
, register_t
*retval
)
2227 syscallarg(const netbsd32_charp) path;
2228 syscallarg(int) attrnamespace;
2229 syscallarg(netbsd32_voidp) data;
2230 syscallarg(netbsd32_size_t) nbytes;
2232 struct sys_extattr_list_link_args ua
;
2234 NETBSD32TOP_UAP(path
, const char);
2235 NETBSD32TO64_UAP(attrnamespace
);
2236 NETBSD32TOP_UAP(data
, void);
2237 NETBSD32TOX_UAP(nbytes
, size_t);
2238 return sys_extattr_list_link(l
, &ua
, retval
);
2242 netbsd32_mlockall(struct lwp
*l
, const struct netbsd32_mlockall_args
*uap
, register_t
*retval
)
2245 syscallarg(int) flags;
2247 struct sys_mlockall_args ua
;
2249 NETBSD32TO64_UAP(flags
);
2250 return (sys_mlockall(l
, &ua
, retval
));
2254 netbsd32___clone(struct lwp
*l
, const struct netbsd32___clone_args
*uap
, register_t
*retval
)
2257 syscallarg(int) flags;
2258 syscallarg(netbsd32_voidp) stack;
2260 struct sys___clone_args ua
;
2262 NETBSD32TO64_UAP(flags
);
2263 NETBSD32TOP_UAP(stack
, void);
2264 return sys___clone(l
, &ua
, retval
);
2268 netbsd32_fsync_range(struct lwp
*l
, const struct netbsd32_fsync_range_args
*uap
, register_t
*retval
)
2272 syscallarg(int) flags;
2273 syscallarg(off_t) start;
2274 syscallarg(off_t) length;
2276 struct sys_fsync_range_args ua
;
2278 NETBSD32TO64_UAP(fd
);
2279 NETBSD32TO64_UAP(flags
);
2280 NETBSD32TO64_UAP(start
);
2281 NETBSD32TO64_UAP(length
);
2282 return (sys_fsync_range(l
, &ua
, retval
));
2286 netbsd32_rasctl(struct lwp
*l
, const struct netbsd32_rasctl_args
*uap
, register_t
*retval
)
2289 syscallarg(netbsd32_voidp) addr;
2290 syscallarg(netbsd32_size_t) len;
2293 struct sys_rasctl_args ua
;
2295 NETBSD32TOP_UAP(addr
, void *);
2296 NETBSD32TOX_UAP(len
, size_t);
2297 NETBSD32TO64_UAP(op
);
2298 return sys_rasctl(l
, &ua
, retval
);
2302 netbsd32_setxattr(struct lwp
*l
, const struct netbsd32_setxattr_args
*uap
, register_t
*retval
)
2305 syscallarg(const netbsd32_charp) path;
2306 syscallarg(const netbsd32_charp) name;
2307 syscallarg(netbsd32_voidp) value;
2308 syscallarg(netbsd32_size_t) size;
2309 syscallarg(int) flags;
2311 struct sys_setxattr_args ua
;
2312 NETBSD32TOP_UAP(path
, const char);
2313 NETBSD32TOP_UAP(name
, const char);
2314 NETBSD32TOP_UAP(value
, void);
2315 NETBSD32TOX_UAP(size
, size_t);
2316 NETBSD32TO64_UAP(flags
);
2317 return sys_setxattr(l
, &ua
, retval
);
2321 netbsd32_lsetxattr(struct lwp
*l
, const struct netbsd32_lsetxattr_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_lsetxattr_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_lsetxattr(l
, &ua
, retval
);
2340 netbsd32_fsetxattr(struct lwp
*l
, const struct netbsd32_fsetxattr_args
*uap
, register_t
*retval
)
2344 syscallarg(const netbsd32_charp) name;
2345 syscallarg(netbsd32_voidp) value;
2346 syscallarg(netbsd32_size_t) size;
2347 syscallarg(int) flags;
2349 struct sys_fsetxattr_args ua
;
2350 NETBSD32TO64_UAP(fd
);
2351 NETBSD32TOP_UAP(name
, const char);
2352 NETBSD32TOP_UAP(value
, void);
2353 NETBSD32TOX_UAP(size
, size_t);
2354 NETBSD32TO64_UAP(flags
);
2355 return sys_fsetxattr(l
, &ua
, retval
);
2359 netbsd32_getxattr(struct lwp
*l
, const struct netbsd32_getxattr_args
*uap
, register_t
*retval
)
2362 syscallarg(const netbsd32_charp) path;
2363 syscallarg(const netbsd32_charp) name;
2364 syscallarg(netbsd32_voidp) value;
2365 syscallarg(netbsd32_size_t) size;
2367 struct sys_getxattr_args ua
;
2368 NETBSD32TOP_UAP(path
, const char);
2369 NETBSD32TOP_UAP(name
, const char);
2370 NETBSD32TOP_UAP(value
, void);
2371 NETBSD32TOX_UAP(size
, size_t);
2372 return sys_getxattr(l
, &ua
, retval
);
2376 netbsd32_lgetxattr(struct lwp
*l
, const struct netbsd32_lgetxattr_args
*uap
, register_t
*retval
)
2379 syscallarg(const netbsd32_charp) path;
2380 syscallarg(const netbsd32_charp) name;
2381 syscallarg(netbsd32_voidp) value;
2382 syscallarg(netbsd32_size_t) size;
2384 struct sys_lgetxattr_args ua
;
2385 NETBSD32TOP_UAP(path
, const char);
2386 NETBSD32TOP_UAP(name
, const char);
2387 NETBSD32TOP_UAP(value
, void);
2388 NETBSD32TOX_UAP(size
, size_t);
2389 return sys_lgetxattr(l
, &ua
, retval
);
2393 netbsd32_fgetxattr(struct lwp
*l
, const struct netbsd32_fgetxattr_args
*uap
, register_t
*retval
)
2397 syscallarg(const netbsd32_charp) name;
2398 syscallarg(netbsd32_voidp) value;
2399 syscallarg(netbsd32_size_t) size;
2401 struct sys_fgetxattr_args ua
;
2402 NETBSD32TO64_UAP(fd
);
2403 NETBSD32TOP_UAP(name
, const char);
2404 NETBSD32TOP_UAP(value
, void);
2405 NETBSD32TOX_UAP(size
, size_t);
2406 return sys_fgetxattr(l
, &ua
, retval
);
2410 netbsd32_listxattr(struct lwp
*l
, const struct netbsd32_listxattr_args
*uap
, register_t
*retval
)
2413 syscallarg(const netbsd32_charp) path;
2414 syscallarg(netbsd32_charp) list;
2415 syscallarg(netbsd32_size_t) size;
2417 struct sys_listxattr_args ua
;
2418 NETBSD32TOP_UAP(path
, const char);
2419 NETBSD32TOP_UAP(list
, char);
2420 NETBSD32TOX_UAP(size
, size_t);
2421 return sys_listxattr(l
, &ua
, retval
);
2425 netbsd32_llistxattr(struct lwp
*l
, const struct netbsd32_llistxattr_args
*uap
, register_t
*retval
)
2428 syscallarg(const netbsd32_charp) path;
2429 syscallarg(netbsd32_charp) list;
2430 syscallarg(netbsd32_size_t) size;
2432 struct sys_llistxattr_args ua
;
2433 NETBSD32TOP_UAP(path
, const char);
2434 NETBSD32TOP_UAP(list
, char);
2435 NETBSD32TOX_UAP(size
, size_t);
2436 return sys_llistxattr(l
, &ua
, retval
);
2440 netbsd32_flistxattr(struct lwp
*l
, const struct netbsd32_flistxattr_args
*uap
, register_t
*retval
)
2444 syscallarg(netbsd32_charp) list;
2445 syscallarg(netbsd32_size_t) size;
2447 struct sys_flistxattr_args ua
;
2448 NETBSD32TO64_UAP(fd
);
2449 NETBSD32TOP_UAP(list
, char);
2450 NETBSD32TOX_UAP(size
, size_t);
2451 return sys_flistxattr(l
, &ua
, retval
);
2455 netbsd32_removexattr(struct lwp
*l
, const struct netbsd32_removexattr_args
*uap
, register_t
*retval
)
2458 syscallarg(const netbsd32_charp) path;
2459 syscallarg(const netbsd32_charp) name;
2461 struct sys_removexattr_args ua
;
2462 NETBSD32TOP_UAP(path
, const char);
2463 NETBSD32TOP_UAP(name
, const char);
2464 return sys_removexattr(l
, &ua
, retval
);
2468 netbsd32_lremovexattr(struct lwp
*l
, const struct netbsd32_lremovexattr_args
*uap
, register_t
*retval
)
2471 syscallarg(const netbsd32_charp) path;
2472 syscallarg(const netbsd32_charp) name;
2474 struct sys_lremovexattr_args ua
;
2475 NETBSD32TOP_UAP(path
, const char);
2476 NETBSD32TOP_UAP(name
, const char);
2477 return sys_lremovexattr(l
, &ua
, retval
);
2481 netbsd32_fremovexattr(struct lwp
*l
, const struct netbsd32_fremovexattr_args
*uap
, register_t
*retval
)
2485 syscallarg(const netbsd32_charp) name;
2487 struct sys_fremovexattr_args ua
;
2488 NETBSD32TO64_UAP(fd
);
2489 NETBSD32TOP_UAP(name
, const char);
2490 return sys_fremovexattr(l
, &ua
, retval
);
2494 netbsd32___posix_fadvise50(struct lwp
*l
,
2495 const struct netbsd32___posix_fadvise50_args
*uap
, register_t
*retval
)
2499 syscallarg(int) PAD;
2500 syscallarg(off_t) offset;
2501 syscallarg(off_t) len;
2502 syscallarg(int) advice;
2505 *retval
= do_posix_fadvise(SCARG(uap
, fd
), SCARG(uap
, offset
),
2506 SCARG(uap
, len
), SCARG(uap
, advice
));
2512 netbsd32__sched_setparam(struct lwp
*l
,
2513 const struct netbsd32__sched_setparam_args
*uap
,
2517 syscallarg(pid_t) pid;
2518 syscallarg(lwpid_t) lid;
2519 syscallarg(int) policy;
2520 syscallarg(const netbsd32_sched_paramp_t) params;
2522 struct sys__sched_setparam_args ua
;
2524 NETBSD32TO64_UAP(pid
);
2525 NETBSD32TO64_UAP(lid
);
2526 NETBSD32TO64_UAP(policy
);
2527 NETBSD32TOP_UAP(params
, const struct sched_param
*);
2528 return sys__sched_setparam(l
, &ua
, retval
);
2532 netbsd32__sched_getparam(struct lwp
*l
,
2533 const struct netbsd32__sched_getparam_args
*uap
,
2537 syscallarg(pid_t) pid;
2538 syscallarg(lwpid_t) lid;
2539 syscallarg(netbsd32_intp) policy;
2540 syscallarg(netbsd32_sched_paramp_t) params;
2542 struct sys__sched_getparam_args ua
;
2544 NETBSD32TO64_UAP(pid
);
2545 NETBSD32TO64_UAP(lid
);
2546 NETBSD32TOP_UAP(policy
, int *);
2547 NETBSD32TOP_UAP(params
, struct sched_param
*);
2548 return sys__sched_getparam(l
, &ua
, retval
);
2552 netbsd32__sched_setaffinity(struct lwp
*l
,
2553 const struct netbsd32__sched_setaffinity_args
*uap
,
2557 syscallarg(pid_t) pid;
2558 syscallarg(lwpid_t) lid;
2559 syscallarg(netbsd_size_t) size;
2560 syscallarg(const netbsd32_cpusetp_t) cpuset;
2562 struct sys__sched_setaffinity_args ua
;
2564 NETBSD32TO64_UAP(pid
);
2565 NETBSD32TO64_UAP(lid
);
2566 NETBSD32TOX_UAP(size
, size_t);
2567 NETBSD32TOP_UAP(cpuset
, const cpuset_t
*);
2568 return sys__sched_setaffinity(l
, &ua
, retval
);
2572 netbsd32__sched_getaffinity(struct lwp
*l
,
2573 const struct netbsd32__sched_getaffinity_args
*uap
,
2577 syscallarg(pid_t) pid;
2578 syscallarg(lwpid_t) lid;
2579 syscallarg(netbsd_size_t) size;
2580 syscallarg(netbsd32_cpusetp_t) cpuset;
2582 struct sys__sched_getaffinity_args ua
;
2584 NETBSD32TO64_UAP(pid
);
2585 NETBSD32TO64_UAP(lid
);
2586 NETBSD32TOX_UAP(size
, size_t);
2587 NETBSD32TOP_UAP(cpuset
, cpuset_t
*);
2588 return sys__sched_getaffinity(l
, &ua
, retval
);
2592 * MI indirect system call support.
2593 * Only used if the MD netbsd32_syscall.c doesn't intercept the calls.
2596 #define NETBSD32_SYSCALL
2598 #define SYS_NSYSENT NETBSD32_SYS_NSYSENT
2600 #define SYS_SYSCALL netbsd32_syscall
2601 #include "../../kern/sys_syscall.c"
2604 #define SYS_SYSCALL netbsd32____syscall
2605 #include "../../kern/sys_syscall.c"