Home | History | Annotate | Line # | Download | only in netbsd32
netbsd32.h revision 1.84.4.1
      1      1.84      matt /*	$NetBSD: netbsd32.h,v 1.84.4.1 2011/03/05 20:52:54 rmind Exp $	*/
      2       1.1       mrg 
      3       1.1       mrg /*
      4      1.78       mrg  * Copyright (c) 1998, 2001, 2008 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  *
     16       1.1       mrg  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17       1.1       mrg  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18       1.1       mrg  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19       1.1       mrg  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20       1.1       mrg  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21       1.1       mrg  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22       1.1       mrg  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23       1.1       mrg  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24       1.1       mrg  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25       1.1       mrg  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26       1.1       mrg  * SUCH DAMAGE.
     27       1.1       mrg  */
     28       1.1       mrg 
     29       1.6       mrg #ifndef _COMPAT_NETBSD32_NETBSD32_H_
     30       1.6       mrg #define _COMPAT_NETBSD32_NETBSD32_H_
     31       1.3       eeh /* We need to change the size of register_t */
     32       1.3       eeh #ifdef syscallargs
     33       1.3       eeh #undef syscallargs
     34       1.3       eeh #endif
     35       1.1       mrg /*
     36       1.6       mrg  * NetBSD 32-bit compatibility module.
     37       1.1       mrg  */
     38       1.1       mrg 
     39      1.15      fvdl #include <sys/systm.h>
     40       1.1       mrg #include <sys/mount.h>
     41      1.16       mrg #include <sys/stat.h>
     42      1.29      cube #include <sys/statvfs.h>
     43      1.16       mrg #include <sys/syscallargs.h>
     44      1.11       mrg #include <sys/ipc.h>
     45      1.11       mrg #include <sys/shm.h>
     46      1.25      fvdl #include <sys/ucontext.h>
     47      1.84      matt #include <sys/ucred.h>
     48      1.51      cube #include <compat/sys/ucontext.h>
     49      1.66  christos #include <compat/sys/mount.h>
     50       1.1       mrg 
     51       1.1       mrg /*
     52      1.22       scw  * first, define the basic types we need.
     53       1.1       mrg  */
     54       1.1       mrg 
     55       1.4       mrg typedef int32_t netbsd32_long;
     56      1.72       dsl typedef uint32_t netbsd32_u_long;
     57      1.79  christos typedef int64_t netbsd32_quad;
     58       1.1       mrg 
     59      1.72       dsl typedef uint32_t netbsd32_clock_t;
     60      1.72       dsl typedef uint32_t netbsd32_size_t;
     61       1.4       mrg typedef int32_t netbsd32_ssize_t;
     62       1.4       mrg typedef int32_t netbsd32_clockid_t;
     63       1.4       mrg typedef int32_t netbsd32_key_t;
     64       1.8    kleink typedef int32_t netbsd32_intptr_t;
     65      1.72       dsl typedef uint32_t netbsd32_uintptr_t;
     66       1.1       mrg 
     67      1.67       dsl /* netbsd32_[u]int64 are machine dependant and defined below */
     68      1.67       dsl 
     69      1.22       scw /*
     70      1.22       scw  * machine depedant section; must define:
     71      1.22       scw  *	netbsd32_pointer_t
     72      1.72       dsl  *		- 32-bit pointer type, normally uint32_t but can be int32_t
     73      1.22       scw  *		  for platforms which rely on sign-extension of pointers
     74      1.22       scw  *		  such as SH-5.
     75      1.22       scw  *	NETBSD32PTR64(p32)
     76      1.22       scw  *		- Translate a 32-bit pointer into something valid in a
     77      1.22       scw  *		  64-bit context.
     78      1.22       scw  *	struct netbsd32_sigcontext
     79      1.22       scw  *		- 32bit compatibility sigcontext structure for this arch.
     80      1.22       scw  *	netbsd32_sigcontextp_t
     81      1.72       dsl  *		- type of pointer to above, normally uint32_t
     82      1.22       scw  *	void netbsd32_setregs(struct proc *p, struct exec_package *pack,
     83      1.72       dsl  *	    unsigned long stack);
     84      1.22       scw  *	int netbsd32_sigreturn(struct proc *p, void *v,
     85      1.22       scw  *	    register_t *retval);
     86      1.22       scw  *	void netbsd32_sendsig(sig_t catcher, int sig, int mask, u_long code);
     87      1.22       scw  *	char netbsd32_esigcode[], netbsd32_sigcode[]
     88      1.22       scw  *		- the above are abvious
     89      1.22       scw  *
     90      1.22       scw  * pull in the netbsd32 machine dependant header, that may help with the
     91      1.22       scw  * above, or it may be provided via the MD layer itself.
     92      1.22       scw  */
     93      1.22       scw #include <machine/netbsd32_machdep.h>
     94      1.22       scw 
     95      1.61       dsl /* netbsd32_machdep.h will have (typically) defined:
     96      1.61       dsl #define NETBSD32_POINTER_TYPE uint32_t
     97      1.61       dsl typedef	struct { NETBSD32_POINTER_TYPE i32; } netbsd32_pointer_t;
     98      1.61       dsl */
     99      1.61       dsl 
    100      1.61       dsl /*
    101      1.61       dsl  * Conversion functions for the rest of the compat32 code:
    102      1.61       dsl  *
    103      1.61       dsl  * NETBSD32PTR64()	Convert user-supplied 32bit pointer to 'void *'
    104      1.61       dsl  * NETBSD32PTR32()	Assign a 'void *' to a 32bit pointer variable
    105      1.61       dsl  * NETBSD32PTR32PLUS()	Add an integer to a 32bit pointer
    106      1.61       dsl  *
    107      1.61       dsl  * Under rare circumstances the following get used:
    108      1.61       dsl  *
    109      1.61       dsl  * NETBSD32PTR32I()	Convert 'void *' to the 32bit pointer base type.
    110      1.61       dsl  * NETBSD32IPTR64()	Convert 32bit pointer base type to 'void *'
    111      1.61       dsl  */
    112      1.61       dsl #define	NETBSD32PTR64(p32)		NETBSD32IPTR64((p32).i32)
    113      1.61       dsl #define	NETBSD32PTR32(p32, p64)		((p32).i32 = NETBSD32PTR32I(p64))
    114      1.61       dsl #define	NETBSD32PTR32PLUS(p32, incr)	((p32).i32 += incr)
    115      1.61       dsl 
    116      1.61       dsl static __inline NETBSD32_POINTER_TYPE
    117      1.61       dsl NETBSD32PTR32I(const void *p64) { return (uintptr_t)p64; }
    118      1.61       dsl static __inline void *
    119      1.61       dsl NETBSD32IPTR64(NETBSD32_POINTER_TYPE p32) { return (void *)(intptr_t)p32; }
    120      1.61       dsl 
    121      1.61       dsl /* Nothing should be using the raw type, so kill it */
    122      1.61       dsl #undef NETBSD32_POINTER_TYPE
    123      1.61       dsl 
    124      1.22       scw /*
    125      1.67       dsl  * 64 bit integers only have 4-byte alignment on some 32 bit ports,
    126      1.67       dsl  * but always have 8-byte alignment on 64 bit systems.
    127      1.67       dsl  * NETBSD32_INT64_ALIGN may be __attribute__((__aligned__(4)))
    128      1.67       dsl  */
    129      1.67       dsl typedef int64_t netbsd32_int64 NETBSD32_INT64_ALIGN;
    130      1.67       dsl typedef uint64_t netbsd32_uint64 NETBSD32_INT64_ALIGN;
    131      1.67       dsl #undef NETBSD32_INT64_ALIGN
    132      1.67       dsl 
    133      1.67       dsl /*
    134      1.22       scw  * all pointers are netbsd32_pointer_t (defined in <machine/netbsd32_machdep.h>)
    135      1.22       scw  */
    136       1.1       mrg 
    137      1.22       scw typedef netbsd32_pointer_t netbsd32_voidp;
    138      1.22       scw typedef netbsd32_pointer_t netbsd32_u_shortp;
    139      1.22       scw typedef netbsd32_pointer_t netbsd32_charp;
    140      1.22       scw typedef netbsd32_pointer_t netbsd32_u_charp;
    141      1.22       scw typedef netbsd32_pointer_t netbsd32_charpp;
    142      1.22       scw typedef netbsd32_pointer_t netbsd32_size_tp;
    143      1.22       scw typedef netbsd32_pointer_t netbsd32_intp;
    144      1.22       scw typedef netbsd32_pointer_t netbsd32_longp;
    145      1.22       scw typedef netbsd32_pointer_t netbsd32_caddrp;
    146      1.22       scw typedef netbsd32_pointer_t netbsd32_caddr;
    147      1.22       scw typedef netbsd32_pointer_t netbsd32_gid_tp;
    148      1.22       scw typedef netbsd32_pointer_t netbsd32_fsid_tp_t;
    149      1.25      fvdl typedef netbsd32_pointer_t netbsd32_lwpidp;
    150      1.25      fvdl typedef netbsd32_pointer_t netbsd32_ucontextp;
    151      1.61       dsl typedef netbsd32_pointer_t netbsd32_caddr_t;
    152      1.69        ad typedef netbsd32_pointer_t netbsd32_lwpctlp;
    153       1.1       mrg 
    154       1.1       mrg /*
    155       1.1       mrg  * now, the compatibility structures and their fake pointer types.
    156       1.1       mrg  */
    157       1.1       mrg 
    158       1.1       mrg /* from <sys/types.h> */
    159      1.22       scw typedef netbsd32_pointer_t netbsd32_fd_setp_t;
    160      1.49      cube typedef netbsd32_intptr_t netbsd32_semid_t;
    161      1.49      cube typedef netbsd32_pointer_t netbsd32_semidp_t;
    162      1.82     njoly typedef netbsd32_uint64 netbsd32_dev_t;
    163       1.1       mrg 
    164       1.1       mrg /* from <sys/uio.h> */
    165      1.22       scw typedef netbsd32_pointer_t netbsd32_iovecp_t;
    166       1.4       mrg struct netbsd32_iovec {
    167      1.72       dsl 	netbsd32_voidp	 iov_base;	/* Base address. */
    168       1.4       mrg 	netbsd32_size_t	 iov_len;	/* Length. */
    169       1.1       mrg };
    170       1.1       mrg 
    171       1.1       mrg /* from <sys/time.h> */
    172       1.4       mrg typedef int32_t netbsd32_timer_t;
    173      1.79  christos typedef	int32_t netbsd32_time50_t;
    174      1.81     njoly typedef	netbsd32_int64 netbsd32_time_t;
    175      1.36      cube typedef netbsd32_pointer_t netbsd32_timerp_t;
    176       1.1       mrg 
    177      1.79  christos typedef netbsd32_pointer_t netbsd32_timespec50p_t;
    178      1.79  christos struct netbsd32_timespec50 {
    179      1.79  christos 	netbsd32_time50_t tv_sec;			/* seconds */
    180      1.79  christos 	netbsd32_long	tv_nsec;	/* and nanoseconds */
    181      1.79  christos };
    182      1.79  christos 
    183      1.22       scw typedef netbsd32_pointer_t netbsd32_timespecp_t;
    184       1.4       mrg struct netbsd32_timespec {
    185      1.79  christos 	netbsd32_time_t tv_sec;			/* seconds */
    186       1.4       mrg 	netbsd32_long	tv_nsec;	/* and nanoseconds */
    187      1.81     njoly };
    188       1.1       mrg 
    189      1.79  christos typedef netbsd32_pointer_t netbsd32_timeval50p_t;
    190      1.79  christos struct netbsd32_timeval50 {
    191      1.79  christos 	netbsd32_time50_t	tv_sec;		/* seconds */
    192      1.79  christos 	netbsd32_long		tv_usec;	/* and microseconds */
    193      1.79  christos };
    194      1.79  christos 
    195      1.22       scw typedef netbsd32_pointer_t netbsd32_timevalp_t;
    196       1.4       mrg struct netbsd32_timeval {
    197      1.79  christos 	netbsd32_time_t	tv_sec;		/* seconds */
    198       1.4       mrg 	netbsd32_long	tv_usec;	/* and microseconds */
    199      1.81     njoly };
    200       1.1       mrg 
    201      1.22       scw typedef netbsd32_pointer_t netbsd32_timezonep_t;
    202       1.4       mrg struct netbsd32_timezone {
    203       1.1       mrg 	int	tz_minuteswest;	/* minutes west of Greenwich */
    204       1.1       mrg 	int	tz_dsttime;	/* type of dst correction */
    205       1.1       mrg };
    206       1.1       mrg 
    207      1.79  christos typedef netbsd32_pointer_t netbsd32_itimerval50p_t;
    208      1.79  christos struct	netbsd32_itimerval50 {
    209      1.79  christos 	struct	netbsd32_timeval50 it_interval;	/* timer interval */
    210      1.79  christos 	struct	netbsd32_timeval50 it_value;	/* current value */
    211      1.79  christos };
    212      1.79  christos 
    213      1.22       scw typedef netbsd32_pointer_t netbsd32_itimervalp_t;
    214       1.4       mrg struct	netbsd32_itimerval {
    215       1.4       mrg 	struct	netbsd32_timeval it_interval;	/* timer interval */
    216       1.4       mrg 	struct	netbsd32_timeval it_value;	/* current value */
    217       1.1       mrg };
    218       1.1       mrg 
    219      1.79  christos typedef netbsd32_pointer_t netbsd32_itimerspec50p_t;
    220      1.79  christos struct netbsd32_itimerspec50 {
    221      1.79  christos 	struct netbsd32_timespec50 it_interval;
    222      1.79  christos 	struct netbsd32_timespec50 it_value;
    223      1.79  christos };
    224      1.79  christos 
    225      1.36      cube typedef netbsd32_pointer_t netbsd32_itimerspecp_t;
    226      1.36      cube struct netbsd32_itimerspec {
    227      1.36      cube 	struct netbsd32_timespec it_interval;
    228      1.36      cube 	struct netbsd32_timespec it_value;
    229      1.36      cube };
    230      1.36      cube 
    231       1.1       mrg /* from <sys/mount.h> */
    232      1.22       scw typedef netbsd32_pointer_t netbsd32_fidp_t;
    233       1.1       mrg 
    234      1.22       scw typedef netbsd32_pointer_t netbsd32_fhandlep_t;
    235      1.54    martin typedef netbsd32_pointer_t netbsd32_compat_30_fhandlep_t;
    236       1.1       mrg 
    237      1.22       scw typedef netbsd32_pointer_t netbsd32_statfsp_t;
    238       1.4       mrg struct netbsd32_statfs {
    239       1.1       mrg 	short	f_type;			/* type of file system */
    240      1.72       dsl 	unsigned short	f_flags;	/* copy of mount flags */
    241       1.4       mrg 	netbsd32_long	f_bsize;	/* fundamental file system block size */
    242       1.4       mrg 	netbsd32_long	f_iosize;	/* optimal transfer block size */
    243       1.4       mrg 	netbsd32_long	f_blocks;	/* total data blocks in file system */
    244       1.4       mrg 	netbsd32_long	f_bfree;	/* free blocks in fs */
    245       1.4       mrg 	netbsd32_long	f_bavail;	/* free blocks avail to non-superuser */
    246       1.4       mrg 	netbsd32_long	f_files;	/* total file nodes in file system */
    247       1.4       mrg 	netbsd32_long	f_ffree;	/* free file nodes in fs */
    248       1.1       mrg 	fsid_t	f_fsid;			/* file system id */
    249       1.1       mrg 	uid_t	f_owner;		/* user that mounted the file system */
    250       1.4       mrg 	netbsd32_long	f_spare[4];	/* spare for later */
    251       1.1       mrg 	char	f_fstypename[MFSNAMELEN]; /* fs type name */
    252       1.1       mrg 	char	f_mntonname[MNAMELEN];	  /* directory on which mounted */
    253       1.1       mrg 	char	f_mntfromname[MNAMELEN];  /* mounted file system */
    254       1.1       mrg };
    255       1.1       mrg 
    256      1.84      matt struct netbsd32_export_args30 {
    257      1.84      matt 	int	ex_flags;		/* export related flags */
    258      1.84      matt 	uid_t	ex_root;		/* mapping for root uid */
    259      1.84      matt 	struct	uucred ex_anon;		/* mapping for anonymous user */
    260      1.84      matt 	netbsd32_pointer_t ex_addr;	/* net address to which exported */
    261      1.84      matt 	int	ex_addrlen;		/* and the net address length */
    262      1.84      matt 	netbsd32_pointer_t ex_mask;	/* mask of valid bits in saddr */
    263      1.84      matt 	int	ex_masklen;		/* and the smask length */
    264      1.84      matt 	netbsd32_charp ex_indexfile;	/* index file for WebNFS URLs */
    265      1.84      matt };
    266      1.84      matt 
    267       1.1       mrg /* from <sys/poll.h> */
    268      1.22       scw typedef netbsd32_pointer_t netbsd32_pollfdp_t;
    269       1.1       mrg 
    270       1.1       mrg /* from <sys/resource.h> */
    271      1.79  christos typedef netbsd32_pointer_t netbsd32_rusage50p_t;
    272      1.79  christos struct	netbsd32_rusage50 {
    273      1.79  christos 	struct netbsd32_timeval50 ru_utime;/* user time used */
    274      1.79  christos 	struct netbsd32_timeval50 ru_stime;/* system time used */
    275      1.79  christos 	netbsd32_long	ru_maxrss;	/* max resident set size */
    276      1.79  christos 	netbsd32_long	ru_ixrss;	/* integral shared memory size */
    277      1.79  christos 	netbsd32_long	ru_idrss;	/* integral unshared data " */
    278      1.79  christos 	netbsd32_long	ru_isrss;	/* integral unshared stack " */
    279      1.79  christos 	netbsd32_long	ru_minflt;	/* page reclaims */
    280      1.79  christos 	netbsd32_long	ru_majflt;	/* page faults */
    281      1.79  christos 	netbsd32_long	ru_nswap;	/* swaps */
    282      1.79  christos 	netbsd32_long	ru_inblock;	/* block input operations */
    283      1.79  christos 	netbsd32_long	ru_oublock;	/* block output operations */
    284      1.79  christos 	netbsd32_long	ru_msgsnd;	/* messages sent */
    285      1.79  christos 	netbsd32_long	ru_msgrcv;	/* messages received */
    286      1.79  christos 	netbsd32_long	ru_nsignals;	/* signals received */
    287      1.79  christos 	netbsd32_long	ru_nvcsw;	/* voluntary context switches */
    288      1.79  christos 	netbsd32_long	ru_nivcsw;	/* involuntary " */
    289      1.79  christos };
    290      1.79  christos 
    291      1.22       scw typedef netbsd32_pointer_t netbsd32_rusagep_t;
    292       1.4       mrg struct	netbsd32_rusage {
    293       1.4       mrg 	struct netbsd32_timeval ru_utime;/* user time used */
    294       1.4       mrg 	struct netbsd32_timeval ru_stime;/* system time used */
    295       1.4       mrg 	netbsd32_long	ru_maxrss;	/* max resident set size */
    296       1.4       mrg 	netbsd32_long	ru_ixrss;	/* integral shared memory size */
    297       1.4       mrg 	netbsd32_long	ru_idrss;	/* integral unshared data " */
    298       1.4       mrg 	netbsd32_long	ru_isrss;	/* integral unshared stack " */
    299       1.4       mrg 	netbsd32_long	ru_minflt;	/* page reclaims */
    300       1.4       mrg 	netbsd32_long	ru_majflt;	/* page faults */
    301       1.4       mrg 	netbsd32_long	ru_nswap;	/* swaps */
    302       1.4       mrg 	netbsd32_long	ru_inblock;	/* block input operations */
    303       1.4       mrg 	netbsd32_long	ru_oublock;	/* block output operations */
    304       1.4       mrg 	netbsd32_long	ru_msgsnd;	/* messages sent */
    305       1.4       mrg 	netbsd32_long	ru_msgrcv;	/* messages received */
    306       1.4       mrg 	netbsd32_long	ru_nsignals;	/* signals received */
    307       1.4       mrg 	netbsd32_long	ru_nvcsw;	/* voluntary context switches */
    308       1.4       mrg 	netbsd32_long	ru_nivcsw;	/* involuntary " */
    309       1.1       mrg };
    310       1.1       mrg 
    311      1.22       scw typedef netbsd32_pointer_t netbsd32_orlimitp_t;
    312       1.1       mrg 
    313      1.22       scw typedef netbsd32_pointer_t netbsd32_rlimitp_t;
    314      1.17       mrg 
    315      1.17       mrg struct netbsd32_loadavg {
    316      1.17       mrg 	fixpt_t	ldavg[3];
    317      1.17       mrg 	netbsd32_long	fscale;
    318      1.17       mrg };
    319       1.1       mrg 
    320       1.1       mrg /* from <sys/ipc.h> */
    321      1.22       scw typedef netbsd32_pointer_t netbsd32_ipc_permp_t;
    322       1.4       mrg struct netbsd32_ipc_perm {
    323      1.75     njoly 	uid_t		cuid;	/* creator user id */
    324      1.75     njoly 	gid_t		cgid;	/* creator group id */
    325      1.75     njoly 	uid_t		uid;	/* user id */
    326      1.75     njoly 	gid_t		gid;	/* group id */
    327      1.75     njoly 	mode_t		mode;	/* r/w permission */
    328      1.72       dsl 	unsigned short	_seq;	/* sequence # (to generate unique msg/sem/shm id) */
    329       1.9       eeh 	netbsd32_key_t	_key;	/* user specified msg/sem/shm key */
    330       1.9       eeh };
    331       1.9       eeh struct netbsd32_ipc_perm14 {
    332      1.72       dsl 	unsigned short	cuid;	/* creator user id */
    333      1.72       dsl 	unsigned short	cgid;	/* creator group id */
    334      1.72       dsl 	unsigned short	uid;	/* user id */
    335      1.72       dsl 	unsigned short	gid;	/* group id */
    336      1.72       dsl 	unsigned short	mode;	/* r/w permission */
    337      1.72       dsl 	unsigned short	seq;	/* sequence # (to generate unique msg/sem/shm id) */
    338       1.4       mrg 	netbsd32_key_t	key;	/* user specified msg/sem/shm key */
    339       1.1       mrg };
    340       1.1       mrg 
    341       1.1       mrg /* from <sys/msg.h> */
    342      1.22       scw typedef netbsd32_pointer_t netbsd32_msgp_t;
    343       1.4       mrg struct netbsd32_msg {
    344       1.4       mrg 	netbsd32_msgp_t msg_next;	/* next msg in the chain */
    345       1.4       mrg 	netbsd32_long	msg_type;	/* type of this message */
    346      1.72       dsl     					/* >0 -> type of this message */
    347      1.72       dsl     					/* 0 -> free header */
    348      1.72       dsl 	unsigned short	msg_ts;		/* size of this message */
    349      1.72       dsl 	short	msg_spot;		/* location of start of msg in buffer */
    350       1.1       mrg };
    351       1.1       mrg 
    352      1.72       dsl typedef uint32_t netbsd32_msgqnum_t;
    353       1.9       eeh typedef netbsd32_size_t netbsd32_msglen_t;
    354       1.9       eeh 
    355      1.79  christos typedef netbsd32_pointer_t netbsd32_msqid_dsp_t;
    356       1.4       mrg struct netbsd32_msqid_ds {
    357      1.72       dsl 	struct netbsd32_ipc_perm msg_perm;	/* operation permission strucure */
    358       1.9       eeh 	netbsd32_msgqnum_t	msg_qnum;	/* number of messages in the queue */
    359       1.9       eeh 	netbsd32_msglen_t	msg_qbytes;	/* max # of bytes in the queue */
    360       1.9       eeh 	pid_t		msg_lspid;	/* process ID of last msgsend() */
    361       1.9       eeh 	pid_t		msg_lrpid;	/* process ID of last msgrcv() */
    362      1.10       eeh 	netbsd32_time_t		msg_stime;	/* time of last msgsend() */
    363      1.10       eeh 	netbsd32_time_t		msg_rtime;	/* time of last msgrcv() */
    364      1.10       eeh 	netbsd32_time_t		msg_ctime;	/* time of last change */
    365       1.9       eeh 
    366       1.9       eeh 	/*
    367       1.9       eeh 	 * These members are private and used only in the internal
    368       1.9       eeh 	 * implementation of this interface.
    369       1.9       eeh 	 */
    370       1.9       eeh 	netbsd32_msgp_t _msg_first;	/* first message in the queue */
    371       1.9       eeh 	netbsd32_msgp_t	_msg_last;	/* last message in the queue */
    372      1.72       dsl 	netbsd32_msglen_t _msg_cbytes;	/* # of bytes currently in queue */
    373       1.9       eeh };
    374      1.79  christos typedef netbsd32_pointer_t netbsd32_msqid_ds50p_t;
    375      1.79  christos struct netbsd32_msqid_ds50 {
    376      1.79  christos 	struct netbsd32_ipc_perm msg_perm;	/* operation permission strucure */
    377      1.79  christos 	netbsd32_msgqnum_t	msg_qnum;	/* number of messages in the queue */
    378      1.79  christos 	netbsd32_msglen_t	msg_qbytes;	/* max # of bytes in the queue */
    379      1.79  christos 	pid_t		msg_lspid;	/* process ID of last msgsend() */
    380      1.79  christos 	pid_t		msg_lrpid;	/* process ID of last msgrcv() */
    381      1.79  christos 	int32_t		msg_stime;	/* time of last msgsend() */
    382      1.79  christos 	int32_t		msg_rtime;	/* time of last msgrcv() */
    383      1.79  christos 	int32_t		msg_ctime;	/* time of last change */
    384      1.79  christos 
    385      1.79  christos 	/*
    386      1.79  christos 	 * These members are private and used only in the internal
    387      1.79  christos 	 * implementation of this interface.
    388      1.79  christos 	 */
    389      1.79  christos 	netbsd32_msgp_t _msg_first;	/* first message in the queue */
    390      1.79  christos 	netbsd32_msgp_t	_msg_last;	/* last message in the queue */
    391      1.79  christos 	netbsd32_msglen_t _msg_cbytes;	/* # of bytes currently in queue */
    392      1.79  christos };
    393      1.79  christos 
    394      1.79  christos typedef netbsd32_pointer_t netbsd32_msqid_ds14p_t;
    395       1.9       eeh struct netbsd32_msqid_ds14 {
    396       1.9       eeh 	struct	netbsd32_ipc_perm14 msg_perm;	/* msg queue permission bits */
    397       1.4       mrg 	netbsd32_msgp_t	msg_first;	/* first message in the queue */
    398       1.4       mrg 	netbsd32_msgp_t	msg_last;	/* last message in the queue */
    399       1.4       mrg 	netbsd32_u_long	msg_cbytes;	/* number of bytes in use on the queue */
    400       1.4       mrg 	netbsd32_u_long	msg_qnum;	/* number of msgs in the queue */
    401       1.4       mrg 	netbsd32_u_long	msg_qbytes;	/* max # of bytes on the queue */
    402       1.1       mrg 	pid_t msg_lspid;		/* pid of last msgsnd() */
    403       1.1       mrg 	pid_t msg_lrpid;		/* pid of last msgrcv() */
    404      1.79  christos 	int32_t		msg_stime;	/* time of last msgsnd() */
    405       1.4       mrg 	netbsd32_long	msg_pad1;
    406      1.79  christos 	int32_t		msg_rtime;	/* time of last msgrcv() */
    407       1.4       mrg 	netbsd32_long	msg_pad2;
    408      1.79  christos 	int32_t		msg_ctime;	/* time of last msgctl() */
    409       1.4       mrg 	netbsd32_long	msg_pad3;
    410       1.4       mrg 	netbsd32_long	msg_pad4[4];
    411       1.1       mrg };
    412       1.1       mrg 
    413      1.77  wrstuden /* from  <sys/sa.h> */
    414      1.77  wrstuden typedef netbsd32_pointer_t netbsd32_sa_upcall_t;
    415      1.77  wrstuden typedef netbsd32_pointer_t netbsd32_sa_upcallp_t;
    416      1.77  wrstuden 
    417      1.77  wrstuden void    netbsd32_cpu_upcall(struct lwp *, int, int, int, void *, void *,
    418      1.77  wrstuden     void *, sa_upcall_t);
    419      1.77  wrstuden 
    420       1.1       mrg /* from <sys/sem.h> */
    421      1.22       scw typedef netbsd32_pointer_t netbsd32_semp_t;
    422       1.1       mrg 
    423      1.61       dsl typedef netbsd32_pointer_t netbsd32_semid_dsp_t;
    424       1.4       mrg struct netbsd32_semid_ds {
    425       1.4       mrg 	struct netbsd32_ipc_perm	sem_perm;/* operation permission struct */
    426       1.9       eeh 	unsigned short	sem_nsems;	/* number of sems in set */
    427      1.72       dsl 	netbsd32_time_t	sem_otime;	/* last operation time */
    428      1.72       dsl 	netbsd32_time_t	sem_ctime;	/* last change time */
    429       1.9       eeh 
    430       1.9       eeh 	/*
    431       1.9       eeh 	 * These members are private and used only in the internal
    432       1.9       eeh 	 * implementation of this interface.
    433       1.9       eeh 	 */
    434       1.9       eeh 	netbsd32_semp_t	_sem_base;	/* pointer to first semaphore in set */
    435       1.9       eeh };
    436       1.9       eeh 
    437      1.79  christos typedef netbsd32_pointer_t netbsd32_semid_ds50p_t;
    438      1.79  christos struct netbsd32_semid_ds50 {
    439      1.79  christos 	struct netbsd32_ipc_perm	sem_perm;/* operation permission struct */
    440      1.79  christos 	unsigned short	sem_nsems;	/* number of sems in set */
    441      1.79  christos 	int32_t		sem_otime;	/* last operation time */
    442      1.79  christos 	int32_t		sem_ctime;	/* last change time */
    443      1.79  christos 
    444      1.79  christos 	/*
    445      1.79  christos 	 * These members are private and used only in the internal
    446      1.79  christos 	 * implementation of this interface.
    447      1.79  christos 	 */
    448      1.79  christos 	netbsd32_semp_t	_sem_base;	/* pointer to first semaphore in set */
    449      1.79  christos };
    450      1.79  christos 
    451      1.79  christos typedef netbsd32_pointer_t netbsd32_semid_ds14p_t;
    452       1.9       eeh struct netbsd32_semid_ds14 {
    453      1.13       mrg 	struct netbsd32_ipc_perm14	sem_perm;/* operation permission struct */
    454       1.4       mrg 	netbsd32_semp_t	sem_base;	/* pointer to first semaphore in set */
    455       1.1       mrg 	unsigned short	sem_nsems;	/* number of sems in set */
    456      1.72       dsl 	netbsd32_time_t	sem_otime;	/* last operation time */
    457       1.4       mrg 	netbsd32_long	sem_pad1;	/* SVABI/386 says I need this here */
    458      1.72       dsl 	netbsd32_time_t	sem_ctime;	/* last change time */
    459       1.1       mrg 					/* Times measured in secs since */
    460       1.1       mrg 					/* 00:00:00 GMT, Jan. 1, 1970 */
    461      1.79  christos 	int32_t		sem_pad2;	/* SVABI/386 says I need this here */
    462      1.79  christos 	int32_t		sem_pad3[4];	/* SVABI/386 says I need this here */
    463       1.1       mrg };
    464       1.1       mrg 
    465      1.72       dsl typedef uint32_t netbsd32_semunu_t;
    466      1.50      cube typedef netbsd32_pointer_t netbsd32_semunp_t;
    467       1.4       mrg union netbsd32_semun {
    468      1.72       dsl 	int	val;			/* value for SETVAL */
    469      1.72       dsl 	netbsd32_semid_dsp_t buf;	/* buffer for IPC_STAT & IPC_SET */
    470       1.4       mrg 	netbsd32_u_shortp array;	/* array for GETALL & SETALL */
    471       1.1       mrg };
    472       1.1       mrg 
    473      1.79  christos typedef netbsd32_pointer_t netbsd32_semun50p_t;
    474      1.79  christos union netbsd32_semun50 {
    475      1.79  christos 	int	val;			/* value for SETVAL */
    476      1.79  christos 	netbsd32_semid_ds50p_t buf;	/* buffer for IPC_STAT & IPC_SET */
    477      1.79  christos 	netbsd32_u_shortp array;	/* array for GETALL & SETALL */
    478      1.79  christos };
    479      1.79  christos 
    480      1.22       scw typedef netbsd32_pointer_t netbsd32_sembufp_t;
    481       1.4       mrg struct netbsd32_sembuf {
    482       1.1       mrg 	unsigned short	sem_num;	/* semaphore # */
    483       1.1       mrg 	short		sem_op;		/* semaphore operation */
    484       1.1       mrg 	short		sem_flg;	/* operation flags */
    485       1.1       mrg };
    486       1.1       mrg 
    487       1.1       mrg /* from <sys/shm.h> */
    488      1.61       dsl typedef netbsd32_pointer_t netbsd32_shmid_dsp_t;
    489       1.4       mrg struct netbsd32_shmid_ds {
    490      1.72       dsl 	struct netbsd32_ipc_perm shm_perm; /* operation permission structure */
    491      1.75     njoly 	netbsd32_size_t	shm_segsz;	/* size of segment in bytes */
    492      1.11       mrg 	pid_t		shm_lpid;	/* process ID of last shm op */
    493      1.11       mrg 	pid_t		shm_cpid;	/* process ID of creator */
    494      1.11       mrg 	shmatt_t	shm_nattch;	/* number of current attaches */
    495      1.11       mrg 	netbsd32_time_t	shm_atime;	/* time of last shmat() */
    496      1.11       mrg 	netbsd32_time_t	shm_dtime;	/* time of last shmdt() */
    497      1.11       mrg 	netbsd32_time_t	shm_ctime;	/* time of last change by shmctl() */
    498      1.11       mrg 	netbsd32_voidp	_shm_internal;	/* sysv stupidity */
    499      1.11       mrg };
    500      1.11       mrg 
    501      1.79  christos typedef netbsd32_pointer_t netbsd32_shmid_ds50p_t;
    502      1.79  christos struct netbsd32_shmid_ds50 {
    503      1.79  christos 	struct netbsd32_ipc_perm shm_perm; /* operation permission structure */
    504      1.79  christos 	netbsd32_size_t	shm_segsz;	/* size of segment in bytes */
    505      1.79  christos 	pid_t		shm_lpid;	/* process ID of last shm op */
    506      1.79  christos 	pid_t		shm_cpid;	/* process ID of creator */
    507      1.79  christos 	shmatt_t	shm_nattch;	/* number of current attaches */
    508      1.79  christos 	int32_t		shm_atime;	/* time of last shmat() */
    509      1.79  christos 	int32_t		shm_dtime;	/* time of last shmdt() */
    510      1.79  christos 	int32_t		shm_ctime;	/* time of last change by shmctl() */
    511      1.79  christos 	netbsd32_voidp	_shm_internal;	/* sysv stupidity */
    512      1.79  christos };
    513      1.79  christos 
    514      1.79  christos typedef netbsd32_pointer_t netbsd32_shmid_ds14p_t;
    515      1.11       mrg struct netbsd32_shmid_ds14 {
    516      1.72       dsl 	struct netbsd32_ipc_perm14 shm_perm; /* operation permission structure */
    517       1.1       mrg 	int		shm_segsz;	/* size of segment in bytes */
    518       1.1       mrg 	pid_t		shm_lpid;	/* process ID of last shm op */
    519       1.1       mrg 	pid_t		shm_cpid;	/* process ID of creator */
    520       1.1       mrg 	short		shm_nattch;	/* number of current attaches */
    521      1.79  christos 	int32_t		shm_atime;	/* time of last shmat() */
    522      1.79  christos 	int32_t		shm_dtime;	/* time of last shmdt() */
    523      1.79  christos 	int32_t		shm_ctime;	/* time of last change by shmctl() */
    524       1.9       eeh 	netbsd32_voidp	_shm_internal;	/* sysv stupidity */
    525       1.1       mrg };
    526       1.1       mrg 
    527       1.1       mrg /* from <sys/signal.h> */
    528      1.22       scw typedef netbsd32_pointer_t netbsd32_sigsetp_t;
    529      1.22       scw typedef netbsd32_pointer_t netbsd32_sigactionp_t;
    530       1.4       mrg struct	netbsd32_sigaction {
    531      1.23    atatat 	netbsd32_voidp netbsd32_sa_handler;	/* signal handler */
    532      1.23    atatat 	sigset_t netbsd32_sa_mask;		/* signal mask to apply */
    533      1.23    atatat 	int	netbsd32_sa_flags;		/* see signal options below */
    534       1.1       mrg };
    535       1.1       mrg 
    536      1.22       scw typedef netbsd32_pointer_t netbsd32_sigaltstack13p_t;
    537       1.4       mrg struct netbsd32_sigaltstack13 {
    538      1.72       dsl 	netbsd32_charp	ss_sp;		/* signal stack base */
    539       1.1       mrg 	int	ss_size;		/* signal stack length */
    540       1.1       mrg 	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */
    541       1.1       mrg };
    542       1.1       mrg 
    543      1.22       scw typedef netbsd32_pointer_t netbsd32_sigaltstackp_t;
    544       1.4       mrg struct netbsd32_sigaltstack {
    545      1.72       dsl 	netbsd32_voidp	ss_sp;		/* signal stack base */
    546      1.72       dsl 	netbsd32_size_t	ss_size;	/* signal stack length */
    547       1.1       mrg 	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */
    548       1.1       mrg };
    549       1.1       mrg 
    550      1.22       scw typedef netbsd32_pointer_t netbsd32_sigstackp_t;
    551       1.4       mrg struct	netbsd32_sigstack {
    552      1.72       dsl 	netbsd32_voidp	ss_sp;		/* signal stack pointer */
    553       1.1       mrg 	int	ss_onstack;		/* current status */
    554       1.1       mrg };
    555       1.1       mrg 
    556      1.22       scw typedef netbsd32_pointer_t netbsd32_sigvecp_t;
    557       1.4       mrg struct	netbsd32_sigvec {
    558       1.4       mrg 	netbsd32_voidp sv_handler;	/* signal handler */
    559       1.1       mrg 	int	sv_mask;		/* signal mask to apply */
    560       1.1       mrg 	int	sv_flags;		/* see signal options below */
    561       1.1       mrg };
    562       1.1       mrg 
    563      1.37      cube typedef netbsd32_pointer_t netbsd32_siginfop_t;
    564      1.37      cube 
    565      1.36      cube union netbsd32_sigval {
    566      1.36      cube 	int	sival_int;
    567      1.36      cube 	netbsd32_voidp	sival_ptr;
    568      1.36      cube };
    569      1.36      cube 
    570      1.36      cube typedef netbsd32_pointer_t netbsd32_sigeventp_t;
    571      1.36      cube struct netbsd32_sigevent {
    572      1.36      cube 	int	sigev_notify;
    573      1.36      cube 	int	sigev_signo;
    574      1.36      cube 	union netbsd32_sigval	sigev_value;
    575      1.36      cube 	netbsd32_voidp	sigev_notify_function;
    576      1.36      cube 	netbsd32_voidp	sigev_notify_attributes;
    577      1.36      cube };
    578      1.36      cube 
    579      1.51      cube /* from <sys/sigtypes.h> */
    580      1.51      cube typedef netbsd32_pointer_t netbsd32_stackp_t;
    581      1.51      cube 
    582       1.1       mrg /* from <sys/socket.h> */
    583      1.22       scw typedef netbsd32_pointer_t netbsd32_sockaddrp_t;
    584      1.22       scw typedef netbsd32_pointer_t netbsd32_osockaddrp_t;
    585       1.1       mrg 
    586      1.22       scw typedef netbsd32_pointer_t netbsd32_msghdrp_t;
    587       1.4       mrg struct netbsd32_msghdr {
    588      1.72       dsl 	netbsd32_caddr_t msg_name;		/* optional address */
    589      1.72       dsl 	unsigned int	msg_namelen;		/* size of address */
    590       1.4       mrg 	netbsd32_iovecp_t msg_iov;		/* scatter/gather array */
    591      1.72       dsl 	unsigned int	msg_iovlen;		/* # elements in msg_iov */
    592      1.72       dsl 	netbsd32_caddr_t msg_control;		/* ancillary data, see below */
    593      1.72       dsl 	unsigned int	msg_controllen;		/* ancillary data buffer len */
    594       1.1       mrg 	int	msg_flags;		/* flags on received message */
    595       1.1       mrg };
    596       1.1       mrg 
    597      1.22       scw typedef netbsd32_pointer_t netbsd32_omsghdrp_t;
    598       1.4       mrg struct netbsd32_omsghdr {
    599      1.72       dsl 	netbsd32_caddr_t msg_name;		/* optional address */
    600      1.72       dsl 	int		 msg_namelen;		/* size of address */
    601       1.4       mrg 	netbsd32_iovecp_t msg_iov;		/* scatter/gather array */
    602      1.72       dsl 	int		 msg_iovlen;		/* # elements in msg_iov */
    603      1.72       dsl 	netbsd32_caddr_t msg_accrights;		/* access rights sent/recvd */
    604      1.72       dsl 	int		 msg_accrightslen;
    605       1.1       mrg };
    606       1.1       mrg 
    607       1.1       mrg /* from <sys/stat.h> */
    608      1.22       scw typedef netbsd32_pointer_t netbsd32_stat12p_t;
    609      1.72       dsl struct netbsd32_stat12 {		/* NetBSD-1.2 stat struct */
    610      1.82     njoly 	uint32_t	st_dev;		/* inode's device */
    611      1.73       dsl 	uint32_t	st_ino;		/* inode's number */
    612      1.73       dsl 	uint16_t	st_mode;	/* inode protection mode */
    613      1.73       dsl 	uint16_t	st_nlink;	/* number of hard links */
    614      1.73       dsl 	uid_t		st_uid;		/* user ID of the file's owner */
    615      1.73       dsl 	gid_t		st_gid;		/* group ID of the file's group */
    616      1.82     njoly 	uint32_t	st_rdev;	/* device type */
    617      1.72       dsl 	struct netbsd32_timespec st_atimespec;/* time of last access */
    618      1.72       dsl 	struct netbsd32_timespec st_mtimespec;/* time of last data modification */
    619      1.72       dsl 	struct netbsd32_timespec st_ctimespec;/* time of last file status change */
    620      1.73       dsl 	netbsd32_int64	st_size;	/* file size, in bytes */
    621      1.74       dsl 	netbsd32_int64	st_blocks;	/* blocks allocated for file */
    622      1.73       dsl 	uint32_t	st_blksize;	/* optimal blocksize for I/O */
    623      1.73       dsl 	uint32_t	st_flags;	/* user defined flags for file */
    624      1.73       dsl 	uint32_t	st_gen;		/* file generation number */
    625      1.73       dsl 	int32_t		st_lspare;
    626      1.74       dsl 	netbsd32_int64	st_qspare[2];
    627       1.1       mrg };
    628       1.1       mrg 
    629      1.22       scw typedef netbsd32_pointer_t netbsd32_stat43p_t;
    630      1.72       dsl struct netbsd32_stat43 {		/* BSD-4.3 stat struct */
    631      1.72       dsl 	uint16_t  st_dev;		/* inode's device */
    632      1.72       dsl 	uint32_t  st_ino;		/* inode's number */
    633      1.72       dsl 	uint16_t  st_mode;		/* inode protection mode */
    634      1.72       dsl 	uint16_t  st_nlink;		/* number of hard links */
    635      1.72       dsl 	uint16_t  st_uid;		/* user ID of the file's owner */
    636      1.72       dsl 	uint16_t  st_gid;		/* group ID of the file's group */
    637      1.72       dsl 	uint16_t  st_rdev;		/* device type */
    638       1.1       mrg 	int32_t	  st_size;		/* file size, in bytes */
    639      1.72       dsl 	struct netbsd32_timespec st_atimespec;/* time of last access */
    640      1.72       dsl 	struct netbsd32_timespec st_mtimespec;/* time of last data modification */
    641      1.72       dsl 	struct netbsd32_timespec st_ctimespec;/* time of last file status change */
    642       1.1       mrg 	int32_t	  st_blksize;		/* optimal blocksize for I/O */
    643       1.1       mrg 	int32_t	  st_blocks;		/* blocks allocated for file */
    644      1.72       dsl 	uint32_t  st_flags;		/* user defined flags for file */
    645      1.72       dsl 	uint32_t  st_gen;		/* file generation number */
    646       1.1       mrg };
    647      1.39  christos typedef netbsd32_pointer_t netbsd32_stat13p_t;
    648      1.39  christos struct netbsd32_stat13 {
    649      1.79  christos 	uint32_t  st_dev;		/* inode's device */
    650      1.72       dsl 	uint32_t  st_ino;		/* inode's number */
    651      1.38  christos 	mode_t	  st_mode;		/* inode protection mode */
    652      1.38  christos 	nlink_t	  st_nlink;		/* number of hard links */
    653      1.38  christos 	uid_t	  st_uid;		/* user ID of the file's owner */
    654      1.38  christos 	gid_t	  st_gid;		/* group ID of the file's group */
    655      1.79  christos 	uint32_t  st_rdev;		/* device type */
    656      1.72       dsl 	struct netbsd32_timespec st_atimespec;/* time of last access */
    657      1.72       dsl 	struct netbsd32_timespec st_mtimespec;/* time of last data modification */
    658      1.72       dsl 	struct netbsd32_timespec st_ctimespec;/* time of last file status change */
    659      1.73       dsl 	netbsd32_int64	  st_size;		/* file size, in bytes */
    660      1.73       dsl 	netbsd32_uint64  st_blocks;		/* blocks allocated for file */
    661      1.38  christos 	blksize_t st_blksize;		/* optimal blocksize for I/O */
    662      1.72       dsl 	uint32_t  st_flags;		/* user defined flags for file */
    663      1.72       dsl 	uint32_t  st_gen;		/* file generation number */
    664      1.72       dsl 	uint32_t  st_spare;		/* file generation number */
    665      1.38  christos 	struct	  netbsd32_timespec st_birthtimespec;
    666      1.72       dsl 	uint32_t  st_spare2;
    667      1.73       dsl };
    668      1.38  christos 
    669      1.79  christos typedef netbsd32_pointer_t netbsd32_stat50p_t;
    670      1.79  christos struct netbsd32_stat50 {
    671      1.79  christos 	uint32_t	st_dev;		/* inode's device */
    672      1.79  christos 	mode_t		st_mode;	/* inode protection mode */
    673      1.79  christos 	netbsd32_uint64	st_ino;		/* inode's number */
    674      1.79  christos 	nlink_t		st_nlink;	/* number of hard links */
    675      1.79  christos 	uid_t		st_uid;		/* user ID of the file's owner */
    676      1.79  christos 	gid_t		st_gid;		/* group ID of the file's group */
    677      1.79  christos 	uint32_t	st_rdev;	/* device type */
    678      1.79  christos 	struct netbsd32_timespec50 st_atimespec;/* time of last access */
    679      1.79  christos 	struct netbsd32_timespec50 st_mtimespec;/* time of last data modification */
    680      1.79  christos 	struct netbsd32_timespec50 st_ctimespec;/* time of last file status change */
    681      1.79  christos 	struct netbsd32_timespec50 st_birthtimespec; /* time of creation */
    682      1.79  christos 	netbsd32_int64	st_size;	/* file size, in bytes */
    683      1.79  christos 	netbsd32_uint64 st_blocks;	/* blocks allocated for file */
    684      1.79  christos 	blksize_t	st_blksize;	/* optimal blocksize for I/O */
    685      1.79  christos 	uint32_t	st_flags;	/* user defined flags for file */
    686      1.79  christos 	uint32_t	st_gen;		/* file generation number */
    687      1.79  christos 	uint32_t	st_spare[2];
    688      1.79  christos };
    689      1.79  christos 
    690      1.22       scw typedef netbsd32_pointer_t netbsd32_statp_t;
    691       1.4       mrg struct netbsd32_stat {
    692      1.82     njoly 	netbsd32_dev_t	st_dev;		/* inode's device */
    693      1.73       dsl 	mode_t		st_mode;	/* inode protection mode */
    694      1.73       dsl 	netbsd32_uint64	st_ino;		/* inode's number */
    695      1.73       dsl 	nlink_t		st_nlink;	/* number of hard links */
    696      1.73       dsl 	uid_t		st_uid;		/* user ID of the file's owner */
    697      1.73       dsl 	gid_t		st_gid;		/* group ID of the file's group */
    698      1.82     njoly 	netbsd32_dev_t	st_rdev;	/* device type */
    699      1.72       dsl 	struct netbsd32_timespec st_atimespec;/* time of last access */
    700      1.72       dsl 	struct netbsd32_timespec st_mtimespec;/* time of last data modification */
    701      1.72       dsl 	struct netbsd32_timespec st_ctimespec;/* time of last file status change */
    702      1.72       dsl 	struct netbsd32_timespec st_birthtimespec; /* time of creation */
    703      1.73       dsl 	netbsd32_int64	st_size;	/* file size, in bytes */
    704      1.73       dsl 	netbsd32_uint64 st_blocks;	/* blocks allocated for file */
    705      1.73       dsl 	blksize_t	st_blksize;	/* optimal blocksize for I/O */
    706      1.73       dsl 	uint32_t	st_flags;	/* user defined flags for file */
    707      1.73       dsl 	uint32_t	st_gen;		/* file generation number */
    708      1.73       dsl 	uint32_t	st_spare[2];
    709      1.73       dsl };
    710       1.1       mrg 
    711      1.29      cube /* from <sys/statvfs.h> */
    712      1.29      cube typedef netbsd32_pointer_t netbsd32_statvfsp_t;
    713      1.29      cube struct netbsd32_statvfs {
    714      1.29      cube 	netbsd32_u_long	f_flag;		/* copy of mount exported flags */
    715      1.29      cube 	netbsd32_u_long	f_bsize;	/* system block size */
    716      1.29      cube 	netbsd32_u_long	f_frsize;	/* system fragment size */
    717      1.29      cube 	netbsd32_u_long	f_iosize;	/* optimal file system block size */
    718      1.68       dsl 	netbsd32_uint64	f_blocks;	/* number of blocks in file system */
    719      1.68       dsl 	netbsd32_uint64	f_bfree;	/* free blocks avail in file system */
    720      1.68       dsl 	netbsd32_uint64	f_bavail;	/* free blocks avail to non-root */
    721      1.68       dsl 	netbsd32_uint64	f_bresvd;	/* blocks reserved for root */
    722      1.68       dsl 	netbsd32_uint64	f_files;	/* total file nodes in file system */
    723      1.68       dsl 	netbsd32_uint64	f_ffree;	/* free file nodes in file system */
    724      1.68       dsl 	netbsd32_uint64	f_favail;	/* free file nodes avail to non-root */
    725      1.68       dsl 	netbsd32_uint64	f_fresvd;	/* file nodes reserved for root */
    726      1.67       dsl 	netbsd32_uint64	f_syncreads;	/* count of sync reads since mount */
    727      1.67       dsl 	netbsd32_uint64	f_syncwrites;	/* count of sync writes since mount */
    728      1.67       dsl 	netbsd32_uint64	f_asyncreads;	/* count of async reads since mount */
    729      1.67       dsl 	netbsd32_uint64	f_asyncwrites;	/* count of async writes since mount */
    730      1.29      cube 	fsid_t		f_fsidx;	/* NetBSD compatible fsid */
    731      1.29      cube 	netbsd32_u_long	f_fsid;		/* Posix compatible fsid */
    732      1.29      cube 	netbsd32_u_long	f_namemax;	/* maximum filename length */
    733      1.29      cube 	uid_t		f_owner;	/* user that mounted the file system */
    734      1.29      cube 	uint32_t	f_spare[4];	/* spare space */
    735      1.29      cube 	char	f_fstypename[_VFS_NAMELEN]; /* fs type name */
    736      1.29      cube 	char	f_mntonname[_VFS_MNAMELEN];  /* directory on which mounted */
    737      1.29      cube 	char	f_mntfromname[_VFS_MNAMELEN];  /* mounted file system */
    738      1.67       dsl };
    739      1.29      cube 
    740       1.1       mrg /* from <sys/timex.h> */
    741      1.22       scw typedef netbsd32_pointer_t netbsd32_ntptimevalp_t;
    742      1.79  christos typedef netbsd32_pointer_t netbsd32_ntptimeval30p_t;
    743      1.79  christos typedef netbsd32_pointer_t netbsd32_ntptimeval50p_t;
    744      1.79  christos 
    745      1.53  drochner struct netbsd32_ntptimeval30 {
    746      1.79  christos 	struct netbsd32_timeval50 time;	/* current time (ro) */
    747      1.53  drochner 	netbsd32_long maxerror;	/* maximum error (us) (ro) */
    748      1.53  drochner 	netbsd32_long esterror;	/* estimated error (us) (ro) */
    749      1.53  drochner };
    750      1.79  christos struct netbsd32_ntptimeval50 {
    751      1.79  christos 	struct netbsd32_timespec50 time;	/* current time (ro) */
    752      1.79  christos 	netbsd32_long maxerror;	/* maximum error (us) (ro) */
    753      1.79  christos 	netbsd32_long esterror;	/* estimated error (us) (ro) */
    754      1.79  christos 	netbsd32_long tai;	/* TAI offset */
    755      1.79  christos 	int time_state;		/* time status */
    756      1.79  christos };
    757      1.79  christos 
    758       1.4       mrg struct netbsd32_ntptimeval {
    759      1.53  drochner 	struct netbsd32_timespec time;	/* current time (ro) */
    760       1.4       mrg 	netbsd32_long maxerror;	/* maximum error (us) (ro) */
    761       1.4       mrg 	netbsd32_long esterror;	/* estimated error (us) (ro) */
    762      1.53  drochner 	netbsd32_long tai;	/* TAI offset */
    763      1.53  drochner 	int time_state;		/* time status */
    764       1.1       mrg };
    765      1.22       scw typedef netbsd32_pointer_t netbsd32_timexp_t;
    766       1.4       mrg struct netbsd32_timex {
    767       1.1       mrg 	unsigned int modes;	/* clock mode bits (wo) */
    768       1.4       mrg 	netbsd32_long offset;	/* time offset (us) (rw) */
    769       1.4       mrg 	netbsd32_long freq;	/* frequency offset (scaled ppm) (rw) */
    770       1.4       mrg 	netbsd32_long maxerror;	/* maximum error (us) (rw) */
    771       1.4       mrg 	netbsd32_long esterror;	/* estimated error (us) (rw) */
    772       1.1       mrg 	int status;		/* clock status bits (rw) */
    773       1.4       mrg 	netbsd32_long constant;	/* pll time constant (rw) */
    774       1.4       mrg 	netbsd32_long precision;	/* clock precision (us) (ro) */
    775       1.4       mrg 	netbsd32_long tolerance;	/* clock frequency tolerance (scaled
    776       1.1       mrg 				 * ppm) (ro) */
    777       1.1       mrg 	/*
    778       1.1       mrg 	 * The following read-only structure members are implemented
    779       1.1       mrg 	 * only if the PPS signal discipline is configured in the
    780       1.1       mrg 	 * kernel.
    781       1.1       mrg 	 */
    782       1.4       mrg 	netbsd32_long ppsfreq;	/* pps frequency (scaled ppm) (ro) */
    783       1.4       mrg 	netbsd32_long jitter;	/* pps jitter (us) (ro) */
    784       1.1       mrg 	int shift;		/* interval duration (s) (shift) (ro) */
    785       1.4       mrg 	netbsd32_long stabil;	/* pps stability (scaled ppm) (ro) */
    786       1.4       mrg 	netbsd32_long jitcnt;	/* jitter limit exceeded (ro) */
    787       1.4       mrg 	netbsd32_long calcnt;	/* calibration intervals (ro) */
    788       1.4       mrg 	netbsd32_long errcnt;	/* calibration errors (ro) */
    789       1.4       mrg 	netbsd32_long stbcnt;	/* stability limit exceeded (ro) */
    790       1.1       mrg };
    791       1.1       mrg 
    792       1.1       mrg /* from <ufs/lfs/lfs.h> */
    793      1.22       scw typedef netbsd32_pointer_t netbsd32_block_infop_t;  /* XXX broken */
    794       1.1       mrg 
    795       1.1       mrg /* from <sys/utsname.h> */
    796      1.22       scw typedef netbsd32_pointer_t netbsd32_utsnamep_t;
    797       1.1       mrg 
    798       1.1       mrg /* from <compat/common/kern_info_09.c> */
    799      1.22       scw typedef netbsd32_pointer_t netbsd32_outsnamep_t;
    800      1.12       mrg 
    801      1.12       mrg /* from <arch/sparc{,64}/include/vuid_event.h> */
    802      1.12       mrg typedef struct firm_event32 {
    803      1.72       dsl 	unsigned short	id;		/* key or MS_* or LOC_[XY]_DELTA */
    804      1.72       dsl 	unsigned short	pad;		/* unused, at least by X11 */
    805      1.12       mrg 	int	value;		/* VKEY_{UP,DOWN} or locator delta */
    806      1.12       mrg 	struct netbsd32_timeval time;
    807      1.12       mrg } Firm_event32;
    808      1.25      fvdl 
    809      1.34      cube /* from <sys/uuid.h> */
    810      1.34      cube typedef netbsd32_pointer_t netbsd32_uuidp_t;
    811      1.34      cube 
    812      1.46      cube /* from <sys/event.h> */
    813      1.46      cube typedef netbsd32_pointer_t netbsd32_keventp_t;
    814      1.46      cube 
    815      1.46      cube struct netbsd32_kevent {
    816      1.46      cube 	netbsd32_uintptr_t	ident;
    817      1.46      cube 	uint32_t		filter;
    818      1.46      cube 	uint32_t		flags;
    819      1.46      cube 	uint32_t		fflags;
    820      1.73       dsl 	netbsd32_int64		data;
    821      1.46      cube 	netbsd32_intptr_t	udata;
    822      1.73       dsl };
    823      1.46      cube 
    824      1.78       mrg /* from <sys/sched.h> */
    825      1.78       mrg typedef netbsd32_pointer_t netbsd32_sched_paramp_t;
    826      1.78       mrg typedef netbsd32_pointer_t netbsd32_cpusetp_t;
    827      1.78       mrg 
    828      1.84      matt /* from <fs/cd9660/cd9660_mount.h> */
    829      1.84      matt struct netbsd32_iso_args {
    830      1.84      matt 	netbsd32_charp fspec;
    831      1.84      matt 	struct export_args30 _pad1;
    832      1.84      matt 	int	flags;
    833      1.84      matt };
    834      1.84      matt 
    835      1.84      matt /* from <ufs/ufs/ufs_mount.h> */
    836      1.84      matt struct netbsd32_ufs_args {
    837      1.84      matt 	netbsd32_charp		fspec;
    838      1.84      matt };
    839      1.84      matt 
    840      1.84      matt struct netbsd32_mfs_args {
    841      1.84      matt 	netbsd32_charp		fspec;
    842      1.84      matt 	struct netbsd32_export_args30	_pad1;
    843      1.84      matt 	netbsd32_voidp		base;
    844      1.84      matt 	netbsd32_u_long		size;
    845      1.84      matt };
    846      1.84      matt 
    847  1.84.4.1     rmind /* from <nfs/nfsmount,h> */
    848  1.84.4.1     rmind struct netbsd32_nfs_args {
    849  1.84.4.1     rmind 	int32_t		version;	/* args structure version number */
    850  1.84.4.1     rmind 	netbsd32_sockaddrp_t addr;	/* file server address */
    851  1.84.4.1     rmind 	int32_t		addrlen;	/* length of address */
    852  1.84.4.1     rmind 	int32_t		sotype;		/* Socket type */
    853  1.84.4.1     rmind 	int32_t		proto;		/* and Protocol */
    854  1.84.4.1     rmind 	netbsd32_u_charp fh;		/* File handle to be mounted */
    855  1.84.4.1     rmind 	int32_t		fhsize;		/* Size, in bytes, of fh */
    856  1.84.4.1     rmind 	int32_t		flags;		/* flags */
    857  1.84.4.1     rmind 	int32_t		wsize;		/* write size in bytes */
    858  1.84.4.1     rmind 	int32_t		rsize;		/* read size in bytes */
    859  1.84.4.1     rmind 	int32_t		readdirsize;	/* readdir size in bytes */
    860  1.84.4.1     rmind 	int32_t		timeo;		/* initial timeout in .1 secs */
    861  1.84.4.1     rmind 	int32_t		retrans;	/* times to retry send */
    862  1.84.4.1     rmind 	int32_t		maxgrouplist;	/* Max. size of group list */
    863  1.84.4.1     rmind 	int32_t		readahead;	/* # of blocks to readahead */
    864  1.84.4.1     rmind 	int32_t		leaseterm;	/* Ignored; Term (sec) of lease */
    865  1.84.4.1     rmind 	int32_t		deadthresh;	/* Retrans threshold */
    866  1.84.4.1     rmind 	netbsd32_charp	hostname;	/* server's name */
    867  1.84.4.1     rmind };
    868  1.84.4.1     rmind 
    869      1.70       dsl #if 0
    870      1.46      cube int	netbsd32_kevent(struct lwp *, void *, register_t *);
    871      1.70       dsl #endif
    872      1.46      cube 
    873       1.4       mrg /*
    874       1.4       mrg  * here are some macros to convert between netbsd32 and sparc64 types.
    875       1.1       mrg  * note that they do *NOT* act like good macros and put ()'s around all
    876       1.1       mrg  * arguments cuz this _breaks_ SCARG().
    877       1.1       mrg  */
    878       1.6       mrg #define NETBSD32TO64(s32uap, uap, name) \
    879       1.1       mrg 	    SCARG(uap, name) = SCARG(s32uap, name)
    880       1.6       mrg #define NETBSD32TOP(s32uap, uap, name, type) \
    881      1.62       dsl 	    SCARG(uap, name) = SCARG_P32(s32uap, name)
    882       1.6       mrg #define NETBSD32TOX(s32uap, uap, name, type) \
    883       1.1       mrg 	    SCARG(uap, name) = (type)SCARG(s32uap, name)
    884       1.6       mrg #define NETBSD32TOX64(s32uap, uap, name, type) \
    885      1.22       scw 	    SCARG(uap, name) = (type)(long)SCARG(s32uap, name)
    886       1.1       mrg 
    887       1.1       mrg /* and some standard versions */
    888      1.83     njoly #define	NETBSD32TO64_UAP(name)		NETBSD32TO64(uap, &ua, name)
    889      1.83     njoly #define	NETBSD32TOP_UAP(name, type)	NETBSD32TOP(uap, &ua, name, type)
    890      1.83     njoly #define	NETBSD32TOX_UAP(name, type)	NETBSD32TOX(uap, &ua, name, type)
    891      1.83     njoly #define	NETBSD32TOX64_UAP(name, type)	NETBSD32TOX64(uap, &ua, name, type)
    892      1.18       mrg 
    893      1.61       dsl #define	SCARG_P32(uap, name) NETBSD32PTR64(SCARG(uap, name))
    894      1.61       dsl 
    895      1.33      matt int	coredump_netbsd32(struct lwp *, void *);
    896       1.1       mrg 
    897       1.1       mrg /*
    898       1.1       mrg  * random other stuff
    899       1.1       mrg  */
    900       1.1       mrg #include <compat/common/compat_util.h>
    901      1.43       chs #include <compat/sys/siginfo.h>
    902      1.16       mrg 
    903      1.31      fvdl vaddr_t netbsd32_vm_default_addr(struct proc *, vaddr_t, vsize_t);
    904      1.56  christos void netbsd32_adjust_limits(struct proc *);
    905      1.31      fvdl 
    906      1.47      cube void	netbsd32_si_to_si32(siginfo32_t *, const siginfo_t *);
    907      1.47      cube void	netbsd32_si32_to_si(siginfo_t *, const siginfo32_t *);
    908      1.42       chs 
    909      1.58      cube void	startlwp32(void *);
    910      1.79  christos struct compat_50_netbsd32___semctl14_args;
    911      1.79  christos int	do_netbsd32___semctl14(struct lwp *, const struct compat_50_netbsd32___semctl14_args *, register_t *, void *);
    912      1.58      cube 
    913      1.65       dsl struct iovec *netbsd32_get_iov(struct netbsd32_iovec *, int, struct iovec *,
    914      1.65       dsl 	    int);
    915      1.65       dsl 
    916      1.28    atatat #ifdef SYSCTL_SETUP_PROTO
    917      1.28    atatat SYSCTL_SETUP_PROTO(netbsd32_sysctl_emul_setup);
    918      1.28    atatat #endif /* SYSCTL_SETUP_PROTO */
    919       1.6       mrg #endif /* _COMPAT_NETBSD32_NETBSD32_H_ */
    920