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