Home | History | Annotate | Line # | Download | only in netbsd32
netbsd32.h revision 1.114
      1 /*	$NetBSD: netbsd32.h,v 1.114 2016/11/13 13:52:41 rin Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  * SUCH DAMAGE.
     27  */
     28 
     29 #ifndef _COMPAT_NETBSD32_NETBSD32_H_
     30 #define _COMPAT_NETBSD32_NETBSD32_H_
     31 /* We need to change the size of register_t */
     32 #ifdef syscallargs
     33 #undef syscallargs
     34 #endif
     35 /*
     36  * NetBSD 32-bit compatibility module.
     37  */
     38 
     39 #include <sys/param.h> /* precautionary upon removal from ucred.h */
     40 #include <sys/systm.h>
     41 #include <sys/mount.h>
     42 #include <sys/stat.h>
     43 #include <sys/statvfs.h>
     44 #include <sys/syscallargs.h>
     45 #include <sys/ipc.h>
     46 #include <sys/shm.h>
     47 #include <sys/ucontext.h>
     48 #include <sys/ucred.h>
     49 #include <compat/sys/ucontext.h>
     50 #include <compat/sys/mount.h>
     51 #include <compat/sys/signal.h>
     52 
     53 #include <nfs/rpcv2.h>
     54 
     55 /*
     56  * first, define the basic types we need.
     57  */
     58 
     59 typedef int32_t netbsd32_long;
     60 typedef uint32_t netbsd32_u_long;
     61 typedef int64_t netbsd32_quad;
     62 
     63 typedef uint32_t netbsd32_clock_t;
     64 typedef uint32_t netbsd32_size_t;
     65 typedef int32_t netbsd32_ssize_t;
     66 typedef int32_t netbsd32_clockid_t;
     67 typedef int32_t netbsd32_key_t;
     68 typedef int32_t netbsd32_intptr_t;
     69 typedef uint32_t netbsd32_uintptr_t;
     70 
     71 /* netbsd32_[u]int64 are machine dependent and defined below */
     72 
     73 /*
     74  * machine dependant section; must define:
     75  *	netbsd32_pointer_t
     76  *		- 32-bit pointer type, normally uint32_t but can be int32_t
     77  *		  for platforms which rely on sign-extension of pointers
     78  *		  such as SH-5.
     79  *	NETBSD32PTR64(p32)
     80  *		- Translate a 32-bit pointer into something valid in a
     81  *		  64-bit context.
     82  *	struct netbsd32_sigcontext
     83  *		- 32bit compatibility sigcontext structure for this arch.
     84  *	netbsd32_sigcontextp_t
     85  *		- type of pointer to above, normally uint32_t
     86  *	void netbsd32_setregs(struct proc *p, struct exec_package *pack,
     87  *	    unsigned long stack);
     88  *	int netbsd32_sigreturn(struct proc *p, void *v,
     89  *	    register_t *retval);
     90  *	void netbsd32_sendsig(sig_t catcher, int sig, int mask, u_long code);
     91  *	char netbsd32_esigcode[], netbsd32_sigcode[]
     92  *		- the above are abvious
     93  *
     94  * pull in the netbsd32 machine dependent header, that may help with the
     95  * above, or it may be provided via the MD layer itself.
     96  */
     97 #include <machine/netbsd32_machdep.h>
     98 
     99 /* netbsd32_machdep.h will have (typically) defined:
    100 #define NETBSD32_POINTER_TYPE uint32_t
    101 typedef	struct { NETBSD32_POINTER_TYPE i32; } netbsd32_pointer_t;
    102 */
    103 
    104 /*
    105  * Conversion functions for the rest of the compat32 code:
    106  *
    107  * NETBSD32PTR64()	Convert user-supplied 32bit pointer to 'void *'
    108  * NETBSD32PTR32()	Assign a 'void *' to a 32bit pointer variable
    109  * NETBSD32PTR32PLUS()	Add an integer to a 32bit pointer
    110  *
    111  * Under rare circumstances the following get used:
    112  *
    113  * NETBSD32PTR32I()	Convert 'void *' to the 32bit pointer base type.
    114  * NETBSD32IPTR64()	Convert 32bit pointer base type to 'void *'
    115  */
    116 #define	NETBSD32PTR64(p32)		NETBSD32IPTR64((p32).i32)
    117 #define	NETBSD32PTR32(p32, p64)		((p32).i32 = NETBSD32PTR32I(p64))
    118 #define	NETBSD32PTR32PLUS(p32, incr)	((p32).i32 += incr)
    119 
    120 static __inline NETBSD32_POINTER_TYPE
    121 NETBSD32PTR32I(const void *p64) { return (uintptr_t)p64; }
    122 static __inline void *
    123 NETBSD32IPTR64(NETBSD32_POINTER_TYPE p32) { return (void *)(intptr_t)p32; }
    124 
    125 /* Nothing should be using the raw type, so kill it */
    126 #undef NETBSD32_POINTER_TYPE
    127 
    128 /*
    129  * 64 bit integers only have 4-byte alignment on some 32 bit ports,
    130  * but always have 8-byte alignment on 64 bit systems.
    131  * NETBSD32_INT64_ALIGN may be __attribute__((__aligned__(4)))
    132  */
    133 typedef int64_t netbsd32_int64 NETBSD32_INT64_ALIGN;
    134 typedef uint64_t netbsd32_uint64 NETBSD32_INT64_ALIGN;
    135 #undef NETBSD32_INT64_ALIGN
    136 
    137 /*
    138  * all pointers are netbsd32_pointer_t (defined in <machine/netbsd32_machdep.h>)
    139  */
    140 
    141 typedef netbsd32_pointer_t netbsd32_voidp;
    142 typedef netbsd32_pointer_t netbsd32_u_shortp;
    143 typedef netbsd32_pointer_t netbsd32_charp;
    144 typedef netbsd32_pointer_t netbsd32_u_charp;
    145 typedef netbsd32_pointer_t netbsd32_charpp;
    146 typedef netbsd32_pointer_t netbsd32_size_tp;
    147 typedef netbsd32_pointer_t netbsd32_intp;
    148 typedef netbsd32_pointer_t netbsd32_uintp;
    149 typedef netbsd32_pointer_t netbsd32_longp;
    150 typedef netbsd32_pointer_t netbsd32_caddrp;
    151 typedef netbsd32_pointer_t netbsd32_caddr;
    152 typedef netbsd32_pointer_t netbsd32_gid_tp;
    153 typedef netbsd32_pointer_t netbsd32_fsid_tp_t;
    154 typedef netbsd32_pointer_t netbsd32_lwpidp;
    155 typedef netbsd32_pointer_t netbsd32_ucontextp;
    156 typedef netbsd32_pointer_t netbsd32_caddr_t;
    157 typedef netbsd32_pointer_t netbsd32_lwpctlp;
    158 typedef netbsd32_pointer_t netbsd32_pid_tp;
    159 typedef netbsd32_pointer_t netbsd32_psetidp_t;
    160 
    161 /*
    162  * now, the compatibility structures and their fake pointer types.
    163  */
    164 
    165 /* from <sys/types.h> */
    166 typedef netbsd32_pointer_t netbsd32_fd_setp_t;
    167 typedef netbsd32_intptr_t netbsd32_semid_t;
    168 typedef netbsd32_pointer_t netbsd32_semidp_t;
    169 typedef netbsd32_uint64 netbsd32_dev_t;
    170 typedef netbsd32_int64 netbsd32_off_t;
    171 typedef netbsd32_uint64 netbsd32_ino_t;
    172 
    173 /* from <sys/spawn.h> */
    174 typedef netbsd32_pointer_t netbsd32_posix_spawn_file_actionsp;
    175 typedef netbsd32_pointer_t netbsd32_posix_spawnattrp;
    176 typedef netbsd32_pointer_t netbsd32_posix_spawn_file_actions_entryp;
    177 
    178 /* from <sys/uio.h> */
    179 typedef netbsd32_pointer_t netbsd32_iovecp_t;
    180 struct netbsd32_iovec {
    181 	netbsd32_voidp	 iov_base;	/* Base address. */
    182 	netbsd32_size_t	 iov_len;	/* Length. */
    183 };
    184 
    185 /* from <sys/time.h> */
    186 typedef int32_t netbsd32_timer_t;
    187 typedef	int32_t netbsd32_time50_t;
    188 typedef	netbsd32_int64 netbsd32_time_t;
    189 typedef netbsd32_pointer_t netbsd32_timerp_t;
    190 typedef netbsd32_pointer_t netbsd32_clockidp_t;
    191 
    192 typedef netbsd32_pointer_t netbsd32_timespec50p_t;
    193 struct netbsd32_timespec50 {
    194 	netbsd32_time50_t tv_sec;			/* seconds */
    195 	netbsd32_long	tv_nsec;	/* and nanoseconds */
    196 };
    197 
    198 typedef netbsd32_pointer_t netbsd32_timespecp_t;
    199 struct netbsd32_timespec {
    200 	netbsd32_time_t tv_sec;			/* seconds */
    201 	netbsd32_long	tv_nsec;	/* and nanoseconds */
    202 };
    203 
    204 typedef netbsd32_pointer_t netbsd32_timeval50p_t;
    205 struct netbsd32_timeval50 {
    206 	netbsd32_time50_t	tv_sec;		/* seconds */
    207 	netbsd32_long		tv_usec;	/* and microseconds */
    208 };
    209 
    210 typedef netbsd32_pointer_t netbsd32_timevalp_t;
    211 struct netbsd32_timeval {
    212 	netbsd32_time_t	tv_sec;		/* seconds */
    213 	suseconds_t	tv_usec;	/* and microseconds */
    214 };
    215 
    216 typedef netbsd32_pointer_t netbsd32_timezonep_t;
    217 struct netbsd32_timezone {
    218 	int	tz_minuteswest;	/* minutes west of Greenwich */
    219 	int	tz_dsttime;	/* type of dst correction */
    220 };
    221 
    222 typedef netbsd32_pointer_t netbsd32_itimerval50p_t;
    223 struct	netbsd32_itimerval50 {
    224 	struct	netbsd32_timeval50 it_interval;	/* timer interval */
    225 	struct	netbsd32_timeval50 it_value;	/* current value */
    226 };
    227 
    228 typedef netbsd32_pointer_t netbsd32_itimervalp_t;
    229 struct	netbsd32_itimerval {
    230 	struct	netbsd32_timeval it_interval;	/* timer interval */
    231 	struct	netbsd32_timeval it_value;	/* current value */
    232 };
    233 
    234 typedef netbsd32_pointer_t netbsd32_itimerspec50p_t;
    235 struct netbsd32_itimerspec50 {
    236 	struct netbsd32_timespec50 it_interval;
    237 	struct netbsd32_timespec50 it_value;
    238 };
    239 
    240 typedef netbsd32_pointer_t netbsd32_itimerspecp_t;
    241 struct netbsd32_itimerspec {
    242 	struct netbsd32_timespec it_interval;
    243 	struct netbsd32_timespec it_value;
    244 };
    245 
    246 /* from <sys/mount.h> */
    247 typedef netbsd32_pointer_t netbsd32_fidp_t;
    248 
    249 typedef netbsd32_pointer_t netbsd32_fhandlep_t;
    250 typedef netbsd32_pointer_t netbsd32_compat_30_fhandlep_t;
    251 
    252 typedef netbsd32_pointer_t netbsd32_statfsp_t;
    253 struct netbsd32_statfs {
    254 	short	f_type;			/* type of file system */
    255 	unsigned short	f_flags;	/* copy of mount flags */
    256 	netbsd32_long	f_bsize;	/* fundamental file system block size */
    257 	netbsd32_long	f_iosize;	/* optimal transfer block size */
    258 	netbsd32_long	f_blocks;	/* total data blocks in file system */
    259 	netbsd32_long	f_bfree;	/* free blocks in fs */
    260 	netbsd32_long	f_bavail;	/* free blocks avail to non-superuser */
    261 	netbsd32_long	f_files;	/* total file nodes in file system */
    262 	netbsd32_long	f_ffree;	/* free file nodes in fs */
    263 	fsid_t	f_fsid;			/* file system id */
    264 	uid_t	f_owner;		/* user that mounted the file system */
    265 	netbsd32_long	f_spare[4];	/* spare for later */
    266 	char	f_fstypename[MFSNAMELEN]; /* fs type name */
    267 	char	f_mntonname[MNAMELEN];	  /* directory on which mounted */
    268 	char	f_mntfromname[MNAMELEN];  /* mounted file system */
    269 };
    270 
    271 struct netbsd32_export_args30 {
    272 	int	ex_flags;		/* export related flags */
    273 	uid_t	ex_root;		/* mapping for root uid */
    274 	struct	uucred ex_anon;		/* mapping for anonymous user */
    275 	netbsd32_pointer_t ex_addr;	/* net address to which exported */
    276 	int	ex_addrlen;		/* and the net address length */
    277 	netbsd32_pointer_t ex_mask;	/* mask of valid bits in saddr */
    278 	int	ex_masklen;		/* and the smask length */
    279 	netbsd32_charp ex_indexfile;	/* index file for WebNFS URLs */
    280 };
    281 
    282 /* from <sys/poll.h> */
    283 typedef netbsd32_pointer_t netbsd32_pollfdp_t;
    284 
    285 /* from <sys/ptrace.h> */
    286 typedef netbsd32_pointer_t netbsd32_ptrace_io_descp_t;
    287 struct netbsd32_ptrace_io_desc {
    288 	int	piod_op;		/* I/O operation */
    289 	netbsd32_voidp piod_offs;	/* child offset */
    290 	netbsd32_voidp piod_addr;	/* parent offset */
    291 	netbsd32_size_t piod_len;	/* request length (in) /
    292 					   actual count (out) */
    293 };
    294 
    295 /* from <sys/quotactl.h> */
    296 typedef netbsd32_pointer_t netbsd32_quotactlargsp_t;
    297 struct netbsd32_quotactlargs {
    298 	unsigned qc_op;
    299 	union {
    300 		struct {
    301 			netbsd32_pointer_t qc_info;
    302 		} stat;
    303 		struct {
    304 			int qc_idtype;
    305 			netbsd32_pointer_t qc_info;
    306 		} idtypestat;
    307 		struct {
    308 			int qc_objtype;
    309 			netbsd32_pointer_t qc_info;
    310 		} objtypestat;
    311 		struct {
    312 			netbsd32_pointer_t qc_key;
    313 			netbsd32_pointer_t qc_val;
    314 		} get;
    315 		struct {
    316 			netbsd32_pointer_t qc_key;
    317 			netbsd32_pointer_t qc_val;
    318 		} put;
    319 		struct {
    320 			netbsd32_pointer_t qc_key;
    321 		} del;
    322 		struct {
    323 			netbsd32_pointer_t qc_cursor;
    324 		} cursoropen;
    325 		struct {
    326 			netbsd32_pointer_t qc_cursor;
    327 		} cursorclose;
    328 		struct {
    329 			netbsd32_pointer_t qc_cursor;
    330 			int qc_idtype;
    331 		} cursorskipidtype;
    332 		struct {
    333 			netbsd32_pointer_t qc_cursor;
    334 			netbsd32_pointer_t qc_keys;
    335 			netbsd32_pointer_t qc_vals;
    336 			unsigned qc_maxnum;
    337 			netbsd32_pointer_t qc_ret;
    338 		} cursorget;
    339 		struct {
    340 			netbsd32_pointer_t qc_cursor;
    341 			netbsd32_pointer_t qc_ret;
    342 		} cursoratend;
    343 		struct {
    344 			netbsd32_pointer_t qc_cursor;
    345 		} cursorrewind;
    346 		struct {
    347 			int qc_idtype;
    348 			netbsd32_pointer_t qc_quotafile;
    349 		} quotaon;
    350 		struct {
    351 			int qc_idtype;
    352 		} quotaoff;
    353 	} u;
    354 };
    355 
    356 /* from <sys/resource.h> */
    357 typedef netbsd32_pointer_t netbsd32_rusage50p_t;
    358 struct	netbsd32_rusage50 {
    359 	struct netbsd32_timeval50 ru_utime;/* user time used */
    360 	struct netbsd32_timeval50 ru_stime;/* system time used */
    361 	netbsd32_long	ru_maxrss;	/* max resident set size */
    362 	netbsd32_long	ru_ixrss;	/* integral shared memory size */
    363 	netbsd32_long	ru_idrss;	/* integral unshared data " */
    364 	netbsd32_long	ru_isrss;	/* integral unshared stack " */
    365 	netbsd32_long	ru_minflt;	/* page reclaims */
    366 	netbsd32_long	ru_majflt;	/* page faults */
    367 	netbsd32_long	ru_nswap;	/* swaps */
    368 	netbsd32_long	ru_inblock;	/* block input operations */
    369 	netbsd32_long	ru_oublock;	/* block output operations */
    370 	netbsd32_long	ru_msgsnd;	/* messages sent */
    371 	netbsd32_long	ru_msgrcv;	/* messages received */
    372 	netbsd32_long	ru_nsignals;	/* signals received */
    373 	netbsd32_long	ru_nvcsw;	/* voluntary context switches */
    374 	netbsd32_long	ru_nivcsw;	/* involuntary " */
    375 };
    376 
    377 typedef netbsd32_pointer_t netbsd32_rusagep_t;
    378 struct	netbsd32_rusage {
    379 	struct netbsd32_timeval ru_utime;/* user time used */
    380 	struct netbsd32_timeval ru_stime;/* system time used */
    381 	netbsd32_long	ru_maxrss;	/* max resident set size */
    382 	netbsd32_long	ru_ixrss;	/* integral shared memory size */
    383 	netbsd32_long	ru_idrss;	/* integral unshared data " */
    384 	netbsd32_long	ru_isrss;	/* integral unshared stack " */
    385 	netbsd32_long	ru_minflt;	/* page reclaims */
    386 	netbsd32_long	ru_majflt;	/* page faults */
    387 	netbsd32_long	ru_nswap;	/* swaps */
    388 	netbsd32_long	ru_inblock;	/* block input operations */
    389 	netbsd32_long	ru_oublock;	/* block output operations */
    390 	netbsd32_long	ru_msgsnd;	/* messages sent */
    391 	netbsd32_long	ru_msgrcv;	/* messages received */
    392 	netbsd32_long	ru_nsignals;	/* signals received */
    393 	netbsd32_long	ru_nvcsw;	/* voluntary context switches */
    394 	netbsd32_long	ru_nivcsw;	/* involuntary " */
    395 };
    396 
    397 typedef netbsd32_pointer_t netbsd32_wrusagep_t;
    398 struct netbsd32_wrusage {
    399 	struct netbsd32_rusage	wru_self;
    400 	struct netbsd32_rusage	wru_children;
    401 };
    402 
    403 typedef netbsd32_pointer_t netbsd32_orlimitp_t;
    404 
    405 typedef netbsd32_pointer_t netbsd32_rlimitp_t;
    406 
    407 struct netbsd32_loadavg {
    408 	fixpt_t	ldavg[3];
    409 	netbsd32_long	fscale;
    410 };
    411 
    412 /* from <sys/swap.h> */
    413 struct netbsd32_swapent {
    414 	netbsd32_dev_t	se_dev;		/* device id */
    415 	int	se_flags;		/* flags */
    416 	int	se_nblks;		/* total blocks */
    417 	int	se_inuse;		/* blocks in use */
    418 	int	se_priority;		/* priority of this device */
    419 	char	se_path[PATH_MAX+1];	/* path	name */
    420 };
    421 
    422 /* from <sys/ipc.h> */
    423 typedef netbsd32_pointer_t netbsd32_ipc_permp_t;
    424 struct netbsd32_ipc_perm {
    425 	uid_t		cuid;	/* creator user id */
    426 	gid_t		cgid;	/* creator group id */
    427 	uid_t		uid;	/* user id */
    428 	gid_t		gid;	/* group id */
    429 	mode_t		mode;	/* r/w permission */
    430 	unsigned short	_seq;	/* sequence # (to generate unique msg/sem/shm id) */
    431 	netbsd32_key_t	_key;	/* user specified msg/sem/shm key */
    432 };
    433 struct netbsd32_ipc_perm14 {
    434 	unsigned short	cuid;	/* creator user id */
    435 	unsigned short	cgid;	/* creator group id */
    436 	unsigned short	uid;	/* user id */
    437 	unsigned short	gid;	/* group id */
    438 	unsigned short	mode;	/* r/w permission */
    439 	unsigned short	seq;	/* sequence # (to generate unique msg/sem/shm id) */
    440 	netbsd32_key_t	key;	/* user specified msg/sem/shm key */
    441 };
    442 
    443 /* from <sys/msg.h> */
    444 typedef netbsd32_pointer_t netbsd32_msgp_t;
    445 struct netbsd32_msg {
    446 	netbsd32_msgp_t msg_next;	/* next msg in the chain */
    447 	netbsd32_long	msg_type;	/* type of this message */
    448     					/* >0 -> type of this message */
    449     					/* 0 -> free header */
    450 	unsigned short	msg_ts;		/* size of this message */
    451 	short	msg_spot;		/* location of start of msg in buffer */
    452 };
    453 
    454 typedef uint32_t netbsd32_msgqnum_t;
    455 typedef netbsd32_size_t netbsd32_msglen_t;
    456 
    457 typedef netbsd32_pointer_t netbsd32_msqid_dsp_t;
    458 struct netbsd32_msqid_ds {
    459 	struct netbsd32_ipc_perm msg_perm;	/* operation permission strucure */
    460 	netbsd32_msgqnum_t	msg_qnum;	/* number of messages in the queue */
    461 	netbsd32_msglen_t	msg_qbytes;	/* max # of bytes in the queue */
    462 	pid_t		msg_lspid;	/* process ID of last msgsend() */
    463 	pid_t		msg_lrpid;	/* process ID of last msgrcv() */
    464 	netbsd32_time_t		msg_stime;	/* time of last msgsend() */
    465 	netbsd32_time_t		msg_rtime;	/* time of last msgrcv() */
    466 	netbsd32_time_t		msg_ctime;	/* time of last change */
    467 
    468 	/*
    469 	 * These members are private and used only in the internal
    470 	 * implementation of this interface.
    471 	 */
    472 	netbsd32_msgp_t _msg_first;	/* first message in the queue */
    473 	netbsd32_msgp_t	_msg_last;	/* last message in the queue */
    474 	netbsd32_msglen_t _msg_cbytes;	/* # of bytes currently in queue */
    475 };
    476 typedef netbsd32_pointer_t netbsd32_msqid_ds50p_t;
    477 struct netbsd32_msqid_ds50 {
    478 	struct netbsd32_ipc_perm msg_perm;	/* operation permission strucure */
    479 	netbsd32_msgqnum_t	msg_qnum;	/* number of messages in the queue */
    480 	netbsd32_msglen_t	msg_qbytes;	/* max # of bytes in the queue */
    481 	pid_t		msg_lspid;	/* process ID of last msgsend() */
    482 	pid_t		msg_lrpid;	/* process ID of last msgrcv() */
    483 	int32_t		msg_stime;	/* time of last msgsend() */
    484 	int32_t		msg_rtime;	/* time of last msgrcv() */
    485 	int32_t		msg_ctime;	/* time of last change */
    486 
    487 	/*
    488 	 * These members are private and used only in the internal
    489 	 * implementation of this interface.
    490 	 */
    491 	netbsd32_msgp_t _msg_first;	/* first message in the queue */
    492 	netbsd32_msgp_t	_msg_last;	/* last message in the queue */
    493 	netbsd32_msglen_t _msg_cbytes;	/* # of bytes currently in queue */
    494 };
    495 
    496 typedef netbsd32_pointer_t netbsd32_msqid_ds14p_t;
    497 struct netbsd32_msqid_ds14 {
    498 	struct	netbsd32_ipc_perm14 msg_perm;	/* msg queue permission bits */
    499 	netbsd32_msgp_t	msg_first;	/* first message in the queue */
    500 	netbsd32_msgp_t	msg_last;	/* last message in the queue */
    501 	netbsd32_u_long	msg_cbytes;	/* number of bytes in use on the queue */
    502 	netbsd32_u_long	msg_qnum;	/* number of msgs in the queue */
    503 	netbsd32_u_long	msg_qbytes;	/* max # of bytes on the queue */
    504 	pid_t msg_lspid;		/* pid of last msgsnd() */
    505 	pid_t msg_lrpid;		/* pid of last msgrcv() */
    506 	int32_t		msg_stime;	/* time of last msgsnd() */
    507 	netbsd32_long	msg_pad1;
    508 	int32_t		msg_rtime;	/* time of last msgrcv() */
    509 	netbsd32_long	msg_pad2;
    510 	int32_t		msg_ctime;	/* time of last msgctl() */
    511 	netbsd32_long	msg_pad3;
    512 	netbsd32_long	msg_pad4[4];
    513 };
    514 
    515 /* from <sys/sem.h> */
    516 typedef netbsd32_pointer_t netbsd32_semp_t;
    517 
    518 typedef netbsd32_pointer_t netbsd32_semid_dsp_t;
    519 struct netbsd32_semid_ds {
    520 	struct netbsd32_ipc_perm	sem_perm;/* operation permission struct */
    521 	unsigned short	sem_nsems;	/* number of sems in set */
    522 	netbsd32_time_t	sem_otime;	/* last operation time */
    523 	netbsd32_time_t	sem_ctime;	/* last change time */
    524 
    525 	/*
    526 	 * These members are private and used only in the internal
    527 	 * implementation of this interface.
    528 	 */
    529 	netbsd32_semp_t	_sem_base;	/* pointer to first semaphore in set */
    530 };
    531 
    532 typedef netbsd32_pointer_t netbsd32_semid_ds50p_t;
    533 struct netbsd32_semid_ds50 {
    534 	struct netbsd32_ipc_perm	sem_perm;/* operation permission struct */
    535 	unsigned short	sem_nsems;	/* number of sems in set */
    536 	int32_t		sem_otime;	/* last operation time */
    537 	int32_t		sem_ctime;	/* last change time */
    538 
    539 	/*
    540 	 * These members are private and used only in the internal
    541 	 * implementation of this interface.
    542 	 */
    543 	netbsd32_semp_t	_sem_base;	/* pointer to first semaphore in set */
    544 };
    545 
    546 typedef netbsd32_pointer_t netbsd32_semid_ds14p_t;
    547 struct netbsd32_semid_ds14 {
    548 	struct netbsd32_ipc_perm14	sem_perm;/* operation permission struct */
    549 	netbsd32_semp_t	sem_base;	/* pointer to first semaphore in set */
    550 	unsigned short	sem_nsems;	/* number of sems in set */
    551 	netbsd32_time_t	sem_otime;	/* last operation time */
    552 	netbsd32_long	sem_pad1;	/* SVABI/386 says I need this here */
    553 	netbsd32_time_t	sem_ctime;	/* last change time */
    554 					/* Times measured in secs since */
    555 					/* 00:00:00 GMT, Jan. 1, 1970 */
    556 	int32_t		sem_pad2;	/* SVABI/386 says I need this here */
    557 	int32_t		sem_pad3[4];	/* SVABI/386 says I need this here */
    558 };
    559 
    560 typedef uint32_t netbsd32_semunu_t;
    561 typedef netbsd32_pointer_t netbsd32_semunp_t;
    562 union netbsd32_semun {
    563 	int	val;			/* value for SETVAL */
    564 	netbsd32_semid_dsp_t buf;	/* buffer for IPC_STAT & IPC_SET */
    565 	netbsd32_u_shortp array;	/* array for GETALL & SETALL */
    566 };
    567 
    568 typedef netbsd32_pointer_t netbsd32_semun50p_t;
    569 union netbsd32_semun50 {
    570 	int	val;			/* value for SETVAL */
    571 	netbsd32_semid_ds50p_t buf;	/* buffer for IPC_STAT & IPC_SET */
    572 	netbsd32_u_shortp array;	/* array for GETALL & SETALL */
    573 };
    574 
    575 typedef netbsd32_pointer_t netbsd32_sembufp_t;
    576 struct netbsd32_sembuf {
    577 	unsigned short	sem_num;	/* semaphore # */
    578 	short		sem_op;		/* semaphore operation */
    579 	short		sem_flg;	/* operation flags */
    580 };
    581 
    582 /* from <sys/shm.h> */
    583 typedef netbsd32_pointer_t netbsd32_shmid_dsp_t;
    584 struct netbsd32_shmid_ds {
    585 	struct netbsd32_ipc_perm shm_perm; /* operation permission structure */
    586 	netbsd32_size_t	shm_segsz;	/* size of segment in bytes */
    587 	pid_t		shm_lpid;	/* process ID of last shm op */
    588 	pid_t		shm_cpid;	/* process ID of creator */
    589 	shmatt_t	shm_nattch;	/* number of current attaches */
    590 	netbsd32_time_t	shm_atime;	/* time of last shmat() */
    591 	netbsd32_time_t	shm_dtime;	/* time of last shmdt() */
    592 	netbsd32_time_t	shm_ctime;	/* time of last change by shmctl() */
    593 	netbsd32_voidp	_shm_internal;	/* sysv stupidity */
    594 };
    595 
    596 typedef netbsd32_pointer_t netbsd32_shmid_ds50p_t;
    597 struct netbsd32_shmid_ds50 {
    598 	struct netbsd32_ipc_perm shm_perm; /* operation permission structure */
    599 	netbsd32_size_t	shm_segsz;	/* size of segment in bytes */
    600 	pid_t		shm_lpid;	/* process ID of last shm op */
    601 	pid_t		shm_cpid;	/* process ID of creator */
    602 	shmatt_t	shm_nattch;	/* number of current attaches */
    603 	int32_t		shm_atime;	/* time of last shmat() */
    604 	int32_t		shm_dtime;	/* time of last shmdt() */
    605 	int32_t		shm_ctime;	/* time of last change by shmctl() */
    606 	netbsd32_voidp	_shm_internal;	/* sysv stupidity */
    607 };
    608 
    609 typedef netbsd32_pointer_t netbsd32_shmid_ds14p_t;
    610 struct netbsd32_shmid_ds14 {
    611 	struct netbsd32_ipc_perm14 shm_perm; /* operation permission structure */
    612 	int		shm_segsz;	/* size of segment in bytes */
    613 	pid_t		shm_lpid;	/* process ID of last shm op */
    614 	pid_t		shm_cpid;	/* process ID of creator */
    615 	short		shm_nattch;	/* number of current attaches */
    616 	int32_t		shm_atime;	/* time of last shmat() */
    617 	int32_t		shm_dtime;	/* time of last shmdt() */
    618 	int32_t		shm_ctime;	/* time of last change by shmctl() */
    619 	netbsd32_voidp	_shm_internal;	/* sysv stupidity */
    620 };
    621 
    622 /* from <sys/signal.h> */
    623 typedef netbsd32_pointer_t netbsd32_sigsetp_t;
    624 typedef netbsd32_pointer_t netbsd32_sigactionp_t;
    625 struct	netbsd32_sigaction13 {
    626 	netbsd32_voidp netbsd32_sa_handler;	/* signal handler */
    627 	sigset13_t netbsd32_sa_mask;		/* signal mask to apply */
    628 	int	netbsd32_sa_flags;		/* see signal options below */
    629 };
    630 
    631 struct	netbsd32_sigaction {
    632 	netbsd32_voidp netbsd32_sa_handler;	/* signal handler */
    633 	sigset_t netbsd32_sa_mask;		/* signal mask to apply */
    634 	int	netbsd32_sa_flags;		/* see signal options below */
    635 };
    636 
    637 typedef netbsd32_pointer_t netbsd32_sigaltstack13p_t;
    638 struct netbsd32_sigaltstack13 {
    639 	netbsd32_charp	ss_sp;		/* signal stack base */
    640 	int	ss_size;		/* signal stack length */
    641 	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */
    642 };
    643 
    644 typedef netbsd32_pointer_t netbsd32_sigaltstackp_t;
    645 struct netbsd32_sigaltstack {
    646 	netbsd32_voidp	ss_sp;		/* signal stack base */
    647 	netbsd32_size_t	ss_size;	/* signal stack length */
    648 	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */
    649 };
    650 
    651 typedef netbsd32_pointer_t netbsd32_sigstackp_t;
    652 struct	netbsd32_sigstack {
    653 	netbsd32_voidp	ss_sp;		/* signal stack pointer */
    654 	int	ss_onstack;		/* current status */
    655 };
    656 
    657 typedef netbsd32_pointer_t netbsd32_sigvecp_t;
    658 struct	netbsd32_sigvec {
    659 	netbsd32_voidp sv_handler;	/* signal handler */
    660 	int	sv_mask;		/* signal mask to apply */
    661 	int	sv_flags;		/* see signal options below */
    662 };
    663 
    664 typedef netbsd32_pointer_t netbsd32_siginfop_t;
    665 
    666 union netbsd32_sigval {
    667 	int	sival_int;
    668 	netbsd32_voidp	sival_ptr;
    669 };
    670 
    671 typedef netbsd32_pointer_t netbsd32_sigeventp_t;
    672 struct netbsd32_sigevent {
    673 	int	sigev_notify;
    674 	int	sigev_signo;
    675 	union netbsd32_sigval	sigev_value;
    676 	netbsd32_voidp	sigev_notify_function;
    677 	netbsd32_voidp	sigev_notify_attributes;
    678 };
    679 
    680 /* from <sys/sigtypes.h> */
    681 typedef netbsd32_pointer_t netbsd32_stackp_t;
    682 
    683 /* from <sys/socket.h> */
    684 typedef netbsd32_pointer_t netbsd32_sockaddrp_t;
    685 typedef netbsd32_pointer_t netbsd32_osockaddrp_t;
    686 typedef netbsd32_pointer_t netbsd32_socklenp_t;
    687 
    688 typedef netbsd32_pointer_t netbsd32_msghdrp_t;
    689 struct netbsd32_msghdr {
    690 	netbsd32_caddr_t msg_name;		/* optional address */
    691 	unsigned int	msg_namelen;		/* size of address */
    692 	netbsd32_iovecp_t msg_iov;		/* scatter/gather array */
    693 	unsigned int	msg_iovlen;		/* # elements in msg_iov */
    694 	netbsd32_caddr_t msg_control;		/* ancillary data, see below */
    695 	unsigned int	msg_controllen;		/* ancillary data buffer len */
    696 	int	msg_flags;		/* flags on received message */
    697 };
    698 
    699 typedef netbsd32_pointer_t netbsd32_omsghdrp_t;
    700 struct netbsd32_omsghdr {
    701 	netbsd32_caddr_t msg_name;		/* optional address */
    702 	int		 msg_namelen;		/* size of address */
    703 	netbsd32_iovecp_t msg_iov;		/* scatter/gather array */
    704 	int		 msg_iovlen;		/* # elements in msg_iov */
    705 	netbsd32_caddr_t msg_accrights;		/* access rights sent/recvd */
    706 	int		 msg_accrightslen;
    707 };
    708 
    709 /* from <sys/stat.h> */
    710 typedef netbsd32_pointer_t netbsd32_stat12p_t;
    711 struct netbsd32_stat12 {		/* NetBSD-1.2 stat struct */
    712 	uint32_t	st_dev;		/* inode's device */
    713 	uint32_t	st_ino;		/* inode's number */
    714 	uint16_t	st_mode;	/* inode protection mode */
    715 	uint16_t	st_nlink;	/* number of hard links */
    716 	uid_t		st_uid;		/* user ID of the file's owner */
    717 	gid_t		st_gid;		/* group ID of the file's group */
    718 	uint32_t	st_rdev;	/* device type */
    719 	struct netbsd32_timespec50 st_atimespec;/* time of last access */
    720 	struct netbsd32_timespec50 st_mtimespec;/* time of last data modification */
    721 	struct netbsd32_timespec50 st_ctimespec;/* time of last file status change */
    722 	netbsd32_int64	st_size;	/* file size, in bytes */
    723 	netbsd32_int64	st_blocks;	/* blocks allocated for file */
    724 	uint32_t	st_blksize;	/* optimal blocksize for I/O */
    725 	uint32_t	st_flags;	/* user defined flags for file */
    726 	uint32_t	st_gen;		/* file generation number */
    727 	int32_t		st_lspare;
    728 	netbsd32_int64	st_qspare[2];
    729 };
    730 
    731 typedef netbsd32_pointer_t netbsd32_stat43p_t;
    732 struct netbsd32_stat43 {		/* BSD-4.3 stat struct */
    733 	uint16_t  st_dev;		/* inode's device */
    734 	uint32_t  st_ino;		/* inode's number */
    735 	uint16_t  st_mode;		/* inode protection mode */
    736 	uint16_t  st_nlink;		/* number of hard links */
    737 	uint16_t  st_uid;		/* user ID of the file's owner */
    738 	uint16_t  st_gid;		/* group ID of the file's group */
    739 	uint16_t  st_rdev;		/* device type */
    740 	int32_t	  st_size;		/* file size, in bytes */
    741 	struct netbsd32_timespec50 st_atimespec;/* time of last access */
    742 	struct netbsd32_timespec50 st_mtimespec;/* time of last data modification */
    743 	struct netbsd32_timespec50 st_ctimespec;/* time of last file status change */
    744 	int32_t	  st_blksize;		/* optimal blocksize for I/O */
    745 	int32_t	  st_blocks;		/* blocks allocated for file */
    746 	uint32_t  st_flags;		/* user defined flags for file */
    747 	uint32_t  st_gen;		/* file generation number */
    748 };
    749 typedef netbsd32_pointer_t netbsd32_stat13p_t;
    750 struct netbsd32_stat13 {
    751 	uint32_t  st_dev;		/* inode's device */
    752 	uint32_t  st_ino;		/* inode's number */
    753 	mode_t	  st_mode;		/* inode protection mode */
    754 	nlink_t	  st_nlink;		/* number of hard links */
    755 	uid_t	  st_uid;		/* user ID of the file's owner */
    756 	gid_t	  st_gid;		/* group ID of the file's group */
    757 	uint32_t  st_rdev;		/* device type */
    758 	struct netbsd32_timespec50 st_atimespec;/* time of last access */
    759 	struct netbsd32_timespec50 st_mtimespec;/* time of last data modification */
    760 	struct netbsd32_timespec50 st_ctimespec;/* time of last file status change */
    761 	netbsd32_int64	  st_size;		/* file size, in bytes */
    762 	netbsd32_uint64  st_blocks;		/* blocks allocated for file */
    763 	blksize_t st_blksize;		/* optimal blocksize for I/O */
    764 	uint32_t  st_flags;		/* user defined flags for file */
    765 	uint32_t  st_gen;		/* file generation number */
    766 	uint32_t  st_spare;		/* file generation number */
    767 	struct	  netbsd32_timespec50 st_birthtimespec;
    768 	uint32_t  st_spare2;
    769 };
    770 
    771 typedef netbsd32_pointer_t netbsd32_stat50p_t;
    772 struct netbsd32_stat50 {
    773 	uint32_t	st_dev;		/* inode's device */
    774 	mode_t		st_mode;	/* inode protection mode */
    775 	netbsd32_uint64	st_ino;		/* inode's number */
    776 	nlink_t		st_nlink;	/* number of hard links */
    777 	uid_t		st_uid;		/* user ID of the file's owner */
    778 	gid_t		st_gid;		/* group ID of the file's group */
    779 	uint32_t	st_rdev;	/* device type */
    780 	struct netbsd32_timespec50 st_atimespec;/* time of last access */
    781 	struct netbsd32_timespec50 st_mtimespec;/* time of last data modification */
    782 	struct netbsd32_timespec50 st_ctimespec;/* time of last file status change */
    783 	struct netbsd32_timespec50 st_birthtimespec; /* time of creation */
    784 	netbsd32_int64	st_size;	/* file size, in bytes */
    785 	netbsd32_uint64 st_blocks;	/* blocks allocated for file */
    786 	blksize_t	st_blksize;	/* optimal blocksize for I/O */
    787 	uint32_t	st_flags;	/* user defined flags for file */
    788 	uint32_t	st_gen;		/* file generation number */
    789 	uint32_t	st_spare[2];
    790 };
    791 
    792 typedef netbsd32_pointer_t netbsd32_statp_t;
    793 struct netbsd32_stat {
    794 	netbsd32_dev_t	st_dev;		/* inode's device */
    795 	mode_t		st_mode;	/* inode protection mode */
    796 	netbsd32_uint64	st_ino;		/* inode's number */
    797 	nlink_t		st_nlink;	/* number of hard links */
    798 	uid_t		st_uid;		/* user ID of the file's owner */
    799 	gid_t		st_gid;		/* group ID of the file's group */
    800 	netbsd32_dev_t	st_rdev;	/* device type */
    801 	struct netbsd32_timespec st_atimespec;/* time of last access */
    802 	struct netbsd32_timespec st_mtimespec;/* time of last data modification */
    803 	struct netbsd32_timespec st_ctimespec;/* time of last file status change */
    804 	struct netbsd32_timespec st_birthtimespec; /* time of creation */
    805 	netbsd32_int64	st_size;	/* file size, in bytes */
    806 	netbsd32_uint64 st_blocks;	/* blocks allocated for file */
    807 	blksize_t	st_blksize;	/* optimal blocksize for I/O */
    808 	uint32_t	st_flags;	/* user defined flags for file */
    809 	uint32_t	st_gen;		/* file generation number */
    810 	uint32_t	st_spare[2];
    811 };
    812 
    813 /* from <sys/statvfs.h> */
    814 typedef netbsd32_pointer_t netbsd32_statvfsp_t;
    815 struct netbsd32_statvfs {
    816 	netbsd32_u_long	f_flag;		/* copy of mount exported flags */
    817 	netbsd32_u_long	f_bsize;	/* system block size */
    818 	netbsd32_u_long	f_frsize;	/* system fragment size */
    819 	netbsd32_u_long	f_iosize;	/* optimal file system block size */
    820 	netbsd32_uint64	f_blocks;	/* number of blocks in file system */
    821 	netbsd32_uint64	f_bfree;	/* free blocks avail in file system */
    822 	netbsd32_uint64	f_bavail;	/* free blocks avail to non-root */
    823 	netbsd32_uint64	f_bresvd;	/* blocks reserved for root */
    824 	netbsd32_uint64	f_files;	/* total file nodes in file system */
    825 	netbsd32_uint64	f_ffree;	/* free file nodes in file system */
    826 	netbsd32_uint64	f_favail;	/* free file nodes avail to non-root */
    827 	netbsd32_uint64	f_fresvd;	/* file nodes reserved for root */
    828 	netbsd32_uint64	f_syncreads;	/* count of sync reads since mount */
    829 	netbsd32_uint64	f_syncwrites;	/* count of sync writes since mount */
    830 	netbsd32_uint64	f_asyncreads;	/* count of async reads since mount */
    831 	netbsd32_uint64	f_asyncwrites;	/* count of async writes since mount */
    832 	fsid_t		f_fsidx;	/* NetBSD compatible fsid */
    833 	netbsd32_u_long	f_fsid;		/* Posix compatible fsid */
    834 	netbsd32_u_long	f_namemax;	/* maximum filename length */
    835 	uid_t		f_owner;	/* user that mounted the file system */
    836 	uint32_t	f_spare[4];	/* spare space */
    837 	char	f_fstypename[_VFS_NAMELEN]; /* fs type name */
    838 	char	f_mntonname[_VFS_MNAMELEN];  /* directory on which mounted */
    839 	char	f_mntfromname[_VFS_MNAMELEN];  /* mounted file system */
    840 };
    841 
    842 /* from <sys/timex.h> */
    843 typedef netbsd32_pointer_t netbsd32_ntptimevalp_t;
    844 typedef netbsd32_pointer_t netbsd32_ntptimeval30p_t;
    845 typedef netbsd32_pointer_t netbsd32_ntptimeval50p_t;
    846 
    847 struct netbsd32_ntptimeval30 {
    848 	struct netbsd32_timeval50 time;	/* current time (ro) */
    849 	netbsd32_long maxerror;	/* maximum error (us) (ro) */
    850 	netbsd32_long esterror;	/* estimated error (us) (ro) */
    851 };
    852 struct netbsd32_ntptimeval50 {
    853 	struct netbsd32_timespec50 time;	/* current time (ro) */
    854 	netbsd32_long maxerror;	/* maximum error (us) (ro) */
    855 	netbsd32_long esterror;	/* estimated error (us) (ro) */
    856 	netbsd32_long tai;	/* TAI offset */
    857 	int time_state;		/* time status */
    858 };
    859 
    860 struct netbsd32_ntptimeval {
    861 	struct netbsd32_timespec time;	/* current time (ro) */
    862 	netbsd32_long maxerror;	/* maximum error (us) (ro) */
    863 	netbsd32_long esterror;	/* estimated error (us) (ro) */
    864 	netbsd32_long tai;	/* TAI offset */
    865 	int time_state;		/* time status */
    866 };
    867 typedef netbsd32_pointer_t netbsd32_timexp_t;
    868 struct netbsd32_timex {
    869 	unsigned int modes;	/* clock mode bits (wo) */
    870 	netbsd32_long offset;	/* time offset (us) (rw) */
    871 	netbsd32_long freq;	/* frequency offset (scaled ppm) (rw) */
    872 	netbsd32_long maxerror;	/* maximum error (us) (rw) */
    873 	netbsd32_long esterror;	/* estimated error (us) (rw) */
    874 	int status;		/* clock status bits (rw) */
    875 	netbsd32_long constant;	/* pll time constant (rw) */
    876 	netbsd32_long precision;	/* clock precision (us) (ro) */
    877 	netbsd32_long tolerance;	/* clock frequency tolerance (scaled
    878 				 * ppm) (ro) */
    879 	/*
    880 	 * The following read-only structure members are implemented
    881 	 * only if the PPS signal discipline is configured in the
    882 	 * kernel.
    883 	 */
    884 	netbsd32_long ppsfreq;	/* pps frequency (scaled ppm) (ro) */
    885 	netbsd32_long jitter;	/* pps jitter (us) (ro) */
    886 	int shift;		/* interval duration (s) (shift) (ro) */
    887 	netbsd32_long stabil;	/* pps stability (scaled ppm) (ro) */
    888 	netbsd32_long jitcnt;	/* jitter limit exceeded (ro) */
    889 	netbsd32_long calcnt;	/* calibration intervals (ro) */
    890 	netbsd32_long errcnt;	/* calibration errors (ro) */
    891 	netbsd32_long stbcnt;	/* stability limit exceeded (ro) */
    892 };
    893 
    894 /* <prop/plistref.h> */
    895 struct netbsd32_plistref {
    896 	netbsd32_pointer_t pref_plist;
    897 	netbsd32_size_t pref_len;
    898 };
    899 
    900 /* from <ufs/lfs/lfs.h> */
    901 typedef netbsd32_pointer_t netbsd32_block_infop_t;  /* XXX broken */
    902 
    903 /* from <sys/utsname.h> */
    904 typedef netbsd32_pointer_t netbsd32_utsnamep_t;
    905 
    906 /* from <compat/common/kern_info_09.c> */
    907 typedef netbsd32_pointer_t netbsd32_outsnamep_t;
    908 
    909 /* from <arch/sparc{,64}/include/vuid_event.h> */
    910 typedef struct firm_event32 {
    911 	unsigned short	id;		/* key or MS_* or LOC_[XY]_DELTA */
    912 	unsigned short	pad;		/* unused, at least by X11 */
    913 	int	value;		/* VKEY_{UP,DOWN} or locator delta */
    914 	struct netbsd32_timeval time;
    915 } Firm_event32;
    916 
    917 /* from <sys/uuid.h> */
    918 typedef netbsd32_pointer_t netbsd32_uuidp_t;
    919 
    920 /* from <sys/event.h> */
    921 typedef netbsd32_pointer_t netbsd32_keventp_t;
    922 
    923 struct netbsd32_kevent {
    924 	netbsd32_uintptr_t	ident;
    925 	uint32_t		filter;
    926 	uint32_t		flags;
    927 	uint32_t		fflags;
    928 	netbsd32_int64		data;
    929 	netbsd32_intptr_t	udata;
    930 };
    931 
    932 /* from <sys/sched.h> */
    933 typedef netbsd32_pointer_t netbsd32_sched_paramp_t;
    934 typedef netbsd32_pointer_t netbsd32_cpusetp_t;
    935 
    936 /* from <fs/tmpfs/tmpfs_args.h> */
    937 struct netbsd32_tmpfs_args {
    938         int                     ta_version;
    939 
    940         /* Size counters. */
    941         netbsd32_ino_t          ta_nodes_max;
    942         netbsd32_off_t          ta_size_max;
    943 
    944         /* Root node attributes. */
    945         uid_t                   ta_root_uid;
    946         gid_t                   ta_root_gid;
    947         mode_t                  ta_root_mode;
    948 };
    949 
    950 /* from <fs/cd9660/cd9660_mount.h> */
    951 struct netbsd32_iso_args {
    952 	netbsd32_charp fspec;
    953 	struct export_args30 _pad1;
    954 	int	flags;
    955 };
    956 
    957 /* from <ufs/ufs/ufs_mount.h> */
    958 struct netbsd32_ufs_args {
    959 	netbsd32_charp		fspec;
    960 };
    961 
    962 struct netbsd32_mfs_args {
    963 	netbsd32_charp		fspec;
    964 	struct netbsd32_export_args30	_pad1;
    965 	netbsd32_voidp		base;
    966 	netbsd32_u_long		size;
    967 };
    968 
    969 /* from <nfs/nfs.h> */
    970 struct netbsd32_nfsd_args {
    971 	int		sock;
    972 	netbsd32_voidp	name;
    973 	int		namelen;
    974 };
    975 
    976 typedef netbsd32_pointer_t netbsd32_nfsdp;
    977 struct netbsd32_nfsd_srvargs {
    978 	netbsd32_nfsdp	nsd_nfsd;
    979 	uid_t		nsd_uid;
    980 	u_int32_t	nsd_haddr;
    981 	struct uucred	nsd_cr;
    982 	int		nsd_authlen;
    983 	netbsd32_u_charp nsd_authstr;
    984 	int		nsd_verflen;
    985 	netbsd32_u_charp nsd_verfstr;
    986 	struct netbsd32_timeval	nsd_timestamp;
    987 	u_int32_t	nsd_ttl;
    988 	NFSKERBKEY_T	nsd_key;
    989 };
    990 
    991 typedef netbsd32_pointer_t netbsd32_export_argsp;
    992 struct netbsd32_export_args {
    993 	int		ex_flags;
    994 	uid_t		ex_root;
    995 	struct uucred	ex_anon;
    996 	netbsd32_sockaddrp_t ex_addr;
    997 	int		ex_addrlen;
    998 	netbsd32_sockaddrp_t ex_mask;
    999 	int		ex_masklen;
   1000 	netbsd32_charp	ex_indexfile;
   1001 };
   1002 
   1003 struct netbsd32_mountd_exports_list {
   1004 	const netbsd32_charp	mel_path;
   1005 	netbsd32_size_t		mel_nexports;
   1006 	netbsd32_export_argsp	mel_exports;
   1007 };
   1008 
   1009 /* no struct export_args30 yet */
   1010 
   1011 /* from <nfs/nfsmount,h> */
   1012 struct netbsd32_nfs_args {
   1013 	int32_t		version;	/* args structure version number */
   1014 	netbsd32_sockaddrp_t addr;	/* file server address */
   1015 	int32_t		addrlen;	/* length of address */
   1016 	int32_t		sotype;		/* Socket type */
   1017 	int32_t		proto;		/* and Protocol */
   1018 	netbsd32_u_charp fh;		/* File handle to be mounted */
   1019 	int32_t		fhsize;		/* Size, in bytes, of fh */
   1020 	int32_t		flags;		/* flags */
   1021 	int32_t		wsize;		/* write size in bytes */
   1022 	int32_t		rsize;		/* read size in bytes */
   1023 	int32_t		readdirsize;	/* readdir size in bytes */
   1024 	int32_t		timeo;		/* initial timeout in .1 secs */
   1025 	int32_t		retrans;	/* times to retry send */
   1026 	int32_t		maxgrouplist;	/* Max. size of group list */
   1027 	int32_t		readahead;	/* # of blocks to readahead */
   1028 	int32_t		leaseterm;	/* Ignored; Term (sec) of lease */
   1029 	int32_t		deadthresh;	/* Retrans threshold */
   1030 	netbsd32_charp	hostname;	/* server's name */
   1031 };
   1032 
   1033 /* from <msdosfs/msdosfsmount.h> */
   1034 struct netbsd32_msdosfs_args {
   1035 	netbsd32_charp	fspec;		/* blocks special holding the fs to mount */
   1036 	struct	netbsd32_export_args30 _pad1; /* compat with old userland tools */
   1037 	uid_t	uid;		/* uid that owns msdosfs files */
   1038 	gid_t	gid;		/* gid that owns msdosfs files */
   1039 	mode_t  mask;		/* mask to be applied for msdosfs perms */
   1040 	int	flags;		/* see below */
   1041 
   1042 	/* Following items added after versioning support */
   1043 	int	version;	/* version of the struct */
   1044 	mode_t  dirmask;	/* v2: mask to be applied for msdosfs perms */
   1045 	int	gmtoff;		/* v3: offset from UTC in seconds */
   1046 };
   1047 
   1048 struct netbsd32_posix_spawn_file_actions_entry {
   1049 	enum { FAE32_OPEN, FAE32_DUP2, FAE32_CLOSE } fae_action;
   1050 
   1051 	int fae_fildes;
   1052 	union {
   1053 		struct {
   1054 			netbsd32_charp path;
   1055 			int oflag;
   1056 			mode_t mode;
   1057 		} open;
   1058 		struct {
   1059 			int newfildes;
   1060 		} dup2;
   1061 	} fae_data;
   1062 };
   1063 
   1064 struct netbsd32_posix_spawn_file_actions {
   1065 	unsigned int size;	/* size of fae array */
   1066 	unsigned int len;	/* how many slots are used */
   1067 	netbsd32_posix_spawn_file_actions_entryp fae;
   1068 };
   1069 
   1070 struct netbsd32_modctl_load {
   1071 	netbsd32_charp ml_filename;
   1072 	int ml_flags;
   1073 	netbsd32_charp ml_props;
   1074 	netbsd32_size_t ml_propslen;
   1075 };
   1076 
   1077 struct netbsd32_mq_attr {
   1078 	netbsd32_long	mq_flags;
   1079 	netbsd32_long	mq_maxmsg;
   1080 	netbsd32_long	mq_msgsize;
   1081 	netbsd32_long	mq_curmsgs;
   1082 };
   1083 typedef netbsd32_pointer_t netbsd32_mq_attrp_t;
   1084 
   1085 #if 0
   1086 int	netbsd32_kevent(struct lwp *, void *, register_t *);
   1087 #endif
   1088 
   1089 /*
   1090  * here are some macros to convert between netbsd32 and native 64 bit types.
   1091  * note that they do *NOT* act like good macros and put ()'s around all
   1092  * arguments cuz this _breaks_ SCARG().
   1093  */
   1094 #define NETBSD32TO64(s32uap, uap, name) \
   1095 	    SCARG(uap, name) = SCARG(s32uap, name)
   1096 #define NETBSD32TOP(s32uap, uap, name, type) \
   1097 	    SCARG(uap, name) = SCARG_P32(s32uap, name)
   1098 #define NETBSD32TOX(s32uap, uap, name, type) \
   1099 	    SCARG(uap, name) = (type)SCARG(s32uap, name)
   1100 #define NETBSD32TOX64(s32uap, uap, name, type) \
   1101 	    SCARG(uap, name) = (type)(long)SCARG(s32uap, name)
   1102 
   1103 /* and some standard versions */
   1104 #define	NETBSD32TO64_UAP(name)		NETBSD32TO64(uap, &ua, name)
   1105 #define	NETBSD32TOP_UAP(name, type)	NETBSD32TOP(uap, &ua, name, type)
   1106 #define	NETBSD32TOX_UAP(name, type)	NETBSD32TOX(uap, &ua, name, type)
   1107 #define	NETBSD32TOX64_UAP(name, type)	NETBSD32TOX64(uap, &ua, name, type)
   1108 
   1109 #define	SCARG_P32(uap, name) NETBSD32PTR64(SCARG(uap, name))
   1110 
   1111 struct coredump_iostate;
   1112 int	coredump_netbsd32(struct lwp *, struct coredump_iostate *);
   1113 
   1114 /*
   1115  * random other stuff
   1116  */
   1117 #include <compat/common/compat_util.h>
   1118 #include <compat/sys/siginfo.h>
   1119 
   1120 vaddr_t netbsd32_vm_default_addr(struct proc *, vaddr_t, vsize_t, int);
   1121 void netbsd32_adjust_limits(struct proc *);
   1122 
   1123 void	netbsd32_si_to_si32(siginfo32_t *, const siginfo_t *);
   1124 void	netbsd32_ksi32_to_ksi(struct _ksiginfo *si, const struct __ksiginfo32 *si32);
   1125 
   1126 #ifdef KTRACE
   1127 void netbsd32_ktrpsig(int, sig_t, const sigset_t *, const ksiginfo_t *);
   1128 #else
   1129 #define netbsd32_ktrpsig NULL
   1130 #endif
   1131 
   1132 
   1133 void	startlwp32(void *);
   1134 struct compat_50_netbsd32___semctl14_args;
   1135 int	do_netbsd32___semctl14(struct lwp *, const struct compat_50_netbsd32___semctl14_args *, register_t *, void *);
   1136 
   1137 struct iovec *netbsd32_get_iov(struct netbsd32_iovec *, int, struct iovec *,
   1138 	    int);
   1139 
   1140 #ifdef SYSCTL_SETUP_PROTO
   1141 SYSCTL_SETUP_PROTO(netbsd32_sysctl_emul_setup);
   1142 #endif /* SYSCTL_SETUP_PROTO */
   1143 #endif /* _COMPAT_NETBSD32_NETBSD32_H_ */
   1144