4 * Copyright (c) 1998, 2001, 2008 Matthew R. Green
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #ifndef _COMPAT_NETBSD32_NETBSD32_H_
30 #define _COMPAT_NETBSD32_NETBSD32_H_
31 /* We need to change the size of register_t */
36 * NetBSD 32-bit compatibility module.
39 #include <sys/systm.h>
40 #include <sys/mount.h>
42 #include <sys/statvfs.h>
43 #include <sys/syscallargs.h>
46 #include <sys/ucontext.h>
47 #include <sys/ucred.h>
48 #include <compat/sys/ucontext.h>
49 #include <compat/sys/mount.h>
52 * first, define the basic types we need.
55 typedef int32_t netbsd32_long
;
56 typedef uint32_t netbsd32_u_long
;
57 typedef int64_t netbsd32_quad
;
59 typedef uint32_t netbsd32_clock_t
;
60 typedef uint32_t netbsd32_size_t
;
61 typedef int32_t netbsd32_ssize_t
;
62 typedef int32_t netbsd32_clockid_t
;
63 typedef int32_t netbsd32_key_t
;
64 typedef int32_t netbsd32_intptr_t
;
65 typedef uint32_t netbsd32_uintptr_t
;
67 /* netbsd32_[u]int64 are machine dependant and defined below */
70 * machine depedant section; must define:
72 * - 32-bit pointer type, normally uint32_t but can be int32_t
73 * for platforms which rely on sign-extension of pointers
76 * - Translate a 32-bit pointer into something valid in a
78 * struct netbsd32_sigcontext
79 * - 32bit compatibility sigcontext structure for this arch.
80 * netbsd32_sigcontextp_t
81 * - type of pointer to above, normally uint32_t
82 * void netbsd32_setregs(struct proc *p, struct exec_package *pack,
83 * unsigned long stack);
84 * int netbsd32_sigreturn(struct proc *p, void *v,
85 * register_t *retval);
86 * void netbsd32_sendsig(sig_t catcher, int sig, int mask, u_long code);
87 * char netbsd32_esigcode[], netbsd32_sigcode[]
88 * - the above are abvious
90 * pull in the netbsd32 machine dependant header, that may help with the
91 * above, or it may be provided via the MD layer itself.
93 #include <machine/netbsd32_machdep.h>
95 /* netbsd32_machdep.h will have (typically) defined:
96 #define NETBSD32_POINTER_TYPE uint32_t
97 typedef struct { NETBSD32_POINTER_TYPE i32; } netbsd32_pointer_t;
101 * Conversion functions for the rest of the compat32 code:
103 * NETBSD32PTR64() Convert user-supplied 32bit pointer to 'void *'
104 * NETBSD32PTR32() Assign a 'void *' to a 32bit pointer variable
105 * NETBSD32PTR32PLUS() Add an integer to a 32bit pointer
107 * Under rare circumstances the following get used:
109 * NETBSD32PTR32I() Convert 'void *' to the 32bit pointer base type.
110 * NETBSD32IPTR64() Convert 32bit pointer base type to 'void *'
112 #define NETBSD32PTR64(p32) NETBSD32IPTR64((p32).i32)
113 #define NETBSD32PTR32(p32, p64) ((p32).i32 = NETBSD32PTR32I(p64))
114 #define NETBSD32PTR32PLUS(p32, incr) ((p32).i32 += incr)
116 static __inline NETBSD32_POINTER_TYPE
117 NETBSD32PTR32I(const void *p64
) { return (uintptr_t)p64
; }
118 static __inline
void *
119 NETBSD32IPTR64(NETBSD32_POINTER_TYPE p32
) { return (void *)(intptr_t)p32
; }
121 /* Nothing should be using the raw type, so kill it */
122 #undef NETBSD32_POINTER_TYPE
125 * 64 bit integers only have 4-byte alignment on some 32 bit ports,
126 * but always have 8-byte alignment on 64 bit systems.
127 * NETBSD32_INT64_ALIGN may be __attribute__((__aligned__(4)))
129 typedef int64_t netbsd32_int64 NETBSD32_INT64_ALIGN
;
130 typedef uint64_t netbsd32_uint64 NETBSD32_INT64_ALIGN
;
131 #undef NETBSD32_INT64_ALIGN
134 * all pointers are netbsd32_pointer_t (defined in <machine/netbsd32_machdep.h>)
137 typedef netbsd32_pointer_t netbsd32_voidp
;
138 typedef netbsd32_pointer_t netbsd32_u_shortp
;
139 typedef netbsd32_pointer_t netbsd32_charp
;
140 typedef netbsd32_pointer_t netbsd32_u_charp
;
141 typedef netbsd32_pointer_t netbsd32_charpp
;
142 typedef netbsd32_pointer_t netbsd32_size_tp
;
143 typedef netbsd32_pointer_t netbsd32_intp
;
144 typedef netbsd32_pointer_t netbsd32_longp
;
145 typedef netbsd32_pointer_t netbsd32_caddrp
;
146 typedef netbsd32_pointer_t netbsd32_caddr
;
147 typedef netbsd32_pointer_t netbsd32_gid_tp
;
148 typedef netbsd32_pointer_t netbsd32_fsid_tp_t
;
149 typedef netbsd32_pointer_t netbsd32_lwpidp
;
150 typedef netbsd32_pointer_t netbsd32_ucontextp
;
151 typedef netbsd32_pointer_t netbsd32_caddr_t
;
152 typedef netbsd32_pointer_t netbsd32_lwpctlp
;
155 * now, the compatibility structures and their fake pointer types.
158 /* from <sys/types.h> */
159 typedef netbsd32_pointer_t netbsd32_fd_setp_t
;
160 typedef netbsd32_intptr_t netbsd32_semid_t
;
161 typedef netbsd32_pointer_t netbsd32_semidp_t
;
162 typedef netbsd32_uint64 netbsd32_dev_t
;
164 /* from <sys/uio.h> */
165 typedef netbsd32_pointer_t netbsd32_iovecp_t
;
166 struct netbsd32_iovec
{
167 netbsd32_voidp iov_base
; /* Base address. */
168 netbsd32_size_t iov_len
; /* Length. */
171 /* from <sys/time.h> */
172 typedef int32_t netbsd32_timer_t
;
173 typedef int32_t netbsd32_time50_t
;
174 typedef netbsd32_int64 netbsd32_time_t
;
175 typedef netbsd32_pointer_t netbsd32_timerp_t
;
177 typedef netbsd32_pointer_t netbsd32_timespec50p_t
;
178 struct netbsd32_timespec50
{
179 netbsd32_time50_t tv_sec
; /* seconds */
180 netbsd32_long tv_nsec
; /* and nanoseconds */
183 typedef netbsd32_pointer_t netbsd32_timespecp_t
;
184 struct netbsd32_timespec
{
185 netbsd32_time_t tv_sec
; /* seconds */
186 netbsd32_long tv_nsec
; /* and nanoseconds */
189 typedef netbsd32_pointer_t netbsd32_timeval50p_t
;
190 struct netbsd32_timeval50
{
191 netbsd32_time50_t tv_sec
; /* seconds */
192 netbsd32_long tv_usec
; /* and microseconds */
195 typedef netbsd32_pointer_t netbsd32_timevalp_t
;
196 struct netbsd32_timeval
{
197 netbsd32_time_t tv_sec
; /* seconds */
198 netbsd32_long tv_usec
; /* and microseconds */
201 typedef netbsd32_pointer_t netbsd32_timezonep_t
;
202 struct netbsd32_timezone
{
203 int tz_minuteswest
; /* minutes west of Greenwich */
204 int tz_dsttime
; /* type of dst correction */
207 typedef netbsd32_pointer_t netbsd32_itimerval50p_t
;
208 struct netbsd32_itimerval50
{
209 struct netbsd32_timeval50 it_interval
; /* timer interval */
210 struct netbsd32_timeval50 it_value
; /* current value */
213 typedef netbsd32_pointer_t netbsd32_itimervalp_t
;
214 struct netbsd32_itimerval
{
215 struct netbsd32_timeval it_interval
; /* timer interval */
216 struct netbsd32_timeval it_value
; /* current value */
219 typedef netbsd32_pointer_t netbsd32_itimerspec50p_t
;
220 struct netbsd32_itimerspec50
{
221 struct netbsd32_timespec50 it_interval
;
222 struct netbsd32_timespec50 it_value
;
225 typedef netbsd32_pointer_t netbsd32_itimerspecp_t
;
226 struct netbsd32_itimerspec
{
227 struct netbsd32_timespec it_interval
;
228 struct netbsd32_timespec it_value
;
231 /* from <sys/mount.h> */
232 typedef netbsd32_pointer_t netbsd32_fidp_t
;
234 typedef netbsd32_pointer_t netbsd32_fhandlep_t
;
235 typedef netbsd32_pointer_t netbsd32_compat_30_fhandlep_t
;
237 typedef netbsd32_pointer_t netbsd32_statfsp_t
;
238 struct netbsd32_statfs
{
239 short f_type
; /* type of file system */
240 unsigned short f_flags
; /* copy of mount flags */
241 netbsd32_long f_bsize
; /* fundamental file system block size */
242 netbsd32_long f_iosize
; /* optimal transfer block size */
243 netbsd32_long f_blocks
; /* total data blocks in file system */
244 netbsd32_long f_bfree
; /* free blocks in fs */
245 netbsd32_long f_bavail
; /* free blocks avail to non-superuser */
246 netbsd32_long f_files
; /* total file nodes in file system */
247 netbsd32_long f_ffree
; /* free file nodes in fs */
248 fsid_t f_fsid
; /* file system id */
249 uid_t f_owner
; /* user that mounted the file system */
250 netbsd32_long f_spare
[4]; /* spare for later */
251 char f_fstypename
[MFSNAMELEN
]; /* fs type name */
252 char f_mntonname
[MNAMELEN
]; /* directory on which mounted */
253 char f_mntfromname
[MNAMELEN
]; /* mounted file system */
256 struct netbsd32_export_args30
{
257 int ex_flags
; /* export related flags */
258 uid_t ex_root
; /* mapping for root uid */
259 struct uucred ex_anon
; /* mapping for anonymous user */
260 netbsd32_pointer_t ex_addr
; /* net address to which exported */
261 int ex_addrlen
; /* and the net address length */
262 netbsd32_pointer_t ex_mask
; /* mask of valid bits in saddr */
263 int ex_masklen
; /* and the smask length */
264 netbsd32_charp ex_indexfile
; /* index file for WebNFS URLs */
267 /* from <sys/poll.h> */
268 typedef netbsd32_pointer_t netbsd32_pollfdp_t
;
270 /* from <sys/resource.h> */
271 typedef netbsd32_pointer_t netbsd32_rusage50p_t
;
272 struct netbsd32_rusage50
{
273 struct netbsd32_timeval50 ru_utime
;/* user time used */
274 struct netbsd32_timeval50 ru_stime
;/* system time used */
275 netbsd32_long ru_maxrss
; /* max resident set size */
276 netbsd32_long ru_ixrss
; /* integral shared memory size */
277 netbsd32_long ru_idrss
; /* integral unshared data " */
278 netbsd32_long ru_isrss
; /* integral unshared stack " */
279 netbsd32_long ru_minflt
; /* page reclaims */
280 netbsd32_long ru_majflt
; /* page faults */
281 netbsd32_long ru_nswap
; /* swaps */
282 netbsd32_long ru_inblock
; /* block input operations */
283 netbsd32_long ru_oublock
; /* block output operations */
284 netbsd32_long ru_msgsnd
; /* messages sent */
285 netbsd32_long ru_msgrcv
; /* messages received */
286 netbsd32_long ru_nsignals
; /* signals received */
287 netbsd32_long ru_nvcsw
; /* voluntary context switches */
288 netbsd32_long ru_nivcsw
; /* involuntary " */
291 typedef netbsd32_pointer_t netbsd32_rusagep_t
;
292 struct netbsd32_rusage
{
293 struct netbsd32_timeval ru_utime
;/* user time used */
294 struct netbsd32_timeval ru_stime
;/* system time used */
295 netbsd32_long ru_maxrss
; /* max resident set size */
296 netbsd32_long ru_ixrss
; /* integral shared memory size */
297 netbsd32_long ru_idrss
; /* integral unshared data " */
298 netbsd32_long ru_isrss
; /* integral unshared stack " */
299 netbsd32_long ru_minflt
; /* page reclaims */
300 netbsd32_long ru_majflt
; /* page faults */
301 netbsd32_long ru_nswap
; /* swaps */
302 netbsd32_long ru_inblock
; /* block input operations */
303 netbsd32_long ru_oublock
; /* block output operations */
304 netbsd32_long ru_msgsnd
; /* messages sent */
305 netbsd32_long ru_msgrcv
; /* messages received */
306 netbsd32_long ru_nsignals
; /* signals received */
307 netbsd32_long ru_nvcsw
; /* voluntary context switches */
308 netbsd32_long ru_nivcsw
; /* involuntary " */
311 typedef netbsd32_pointer_t netbsd32_orlimitp_t
;
313 typedef netbsd32_pointer_t netbsd32_rlimitp_t
;
315 struct netbsd32_loadavg
{
317 netbsd32_long fscale
;
320 /* from <sys/ipc.h> */
321 typedef netbsd32_pointer_t netbsd32_ipc_permp_t
;
322 struct netbsd32_ipc_perm
{
323 uid_t cuid
; /* creator user id */
324 gid_t cgid
; /* creator group id */
325 uid_t uid
; /* user id */
326 gid_t gid
; /* group id */
327 mode_t mode
; /* r/w permission */
328 unsigned short _seq
; /* sequence # (to generate unique msg/sem/shm id) */
329 netbsd32_key_t _key
; /* user specified msg/sem/shm key */
331 struct netbsd32_ipc_perm14
{
332 unsigned short cuid
; /* creator user id */
333 unsigned short cgid
; /* creator group id */
334 unsigned short uid
; /* user id */
335 unsigned short gid
; /* group id */
336 unsigned short mode
; /* r/w permission */
337 unsigned short seq
; /* sequence # (to generate unique msg/sem/shm id) */
338 netbsd32_key_t key
; /* user specified msg/sem/shm key */
341 /* from <sys/msg.h> */
342 typedef netbsd32_pointer_t netbsd32_msgp_t
;
343 struct netbsd32_msg
{
344 netbsd32_msgp_t msg_next
; /* next msg in the chain */
345 netbsd32_long msg_type
; /* type of this message */
346 /* >0 -> type of this message */
347 /* 0 -> free header */
348 unsigned short msg_ts
; /* size of this message */
349 short msg_spot
; /* location of start of msg in buffer */
352 typedef uint32_t netbsd32_msgqnum_t
;
353 typedef netbsd32_size_t netbsd32_msglen_t
;
355 typedef netbsd32_pointer_t netbsd32_msqid_dsp_t
;
356 struct netbsd32_msqid_ds
{
357 struct netbsd32_ipc_perm msg_perm
; /* operation permission strucure */
358 netbsd32_msgqnum_t msg_qnum
; /* number of messages in the queue */
359 netbsd32_msglen_t msg_qbytes
; /* max # of bytes in the queue */
360 pid_t msg_lspid
; /* process ID of last msgsend() */
361 pid_t msg_lrpid
; /* process ID of last msgrcv() */
362 netbsd32_time_t msg_stime
; /* time of last msgsend() */
363 netbsd32_time_t msg_rtime
; /* time of last msgrcv() */
364 netbsd32_time_t msg_ctime
; /* time of last change */
367 * These members are private and used only in the internal
368 * implementation of this interface.
370 netbsd32_msgp_t _msg_first
; /* first message in the queue */
371 netbsd32_msgp_t _msg_last
; /* last message in the queue */
372 netbsd32_msglen_t _msg_cbytes
; /* # of bytes currently in queue */
374 typedef netbsd32_pointer_t netbsd32_msqid_ds50p_t
;
375 struct netbsd32_msqid_ds50
{
376 struct netbsd32_ipc_perm msg_perm
; /* operation permission strucure */
377 netbsd32_msgqnum_t msg_qnum
; /* number of messages in the queue */
378 netbsd32_msglen_t msg_qbytes
; /* max # of bytes in the queue */
379 pid_t msg_lspid
; /* process ID of last msgsend() */
380 pid_t msg_lrpid
; /* process ID of last msgrcv() */
381 int32_t msg_stime
; /* time of last msgsend() */
382 int32_t msg_rtime
; /* time of last msgrcv() */
383 int32_t msg_ctime
; /* time of last change */
386 * These members are private and used only in the internal
387 * implementation of this interface.
389 netbsd32_msgp_t _msg_first
; /* first message in the queue */
390 netbsd32_msgp_t _msg_last
; /* last message in the queue */
391 netbsd32_msglen_t _msg_cbytes
; /* # of bytes currently in queue */
394 typedef netbsd32_pointer_t netbsd32_msqid_ds14p_t
;
395 struct netbsd32_msqid_ds14
{
396 struct netbsd32_ipc_perm14 msg_perm
; /* msg queue permission bits */
397 netbsd32_msgp_t msg_first
; /* first message in the queue */
398 netbsd32_msgp_t msg_last
; /* last message in the queue */
399 netbsd32_u_long msg_cbytes
; /* number of bytes in use on the queue */
400 netbsd32_u_long msg_qnum
; /* number of msgs in the queue */
401 netbsd32_u_long msg_qbytes
; /* max # of bytes on the queue */
402 pid_t msg_lspid
; /* pid of last msgsnd() */
403 pid_t msg_lrpid
; /* pid of last msgrcv() */
404 int32_t msg_stime
; /* time of last msgsnd() */
405 netbsd32_long msg_pad1
;
406 int32_t msg_rtime
; /* time of last msgrcv() */
407 netbsd32_long msg_pad2
;
408 int32_t msg_ctime
; /* time of last msgctl() */
409 netbsd32_long msg_pad3
;
410 netbsd32_long msg_pad4
[4];
413 /* from <sys/sa.h> */
414 typedef netbsd32_pointer_t netbsd32_sa_upcall_t
;
415 typedef netbsd32_pointer_t netbsd32_sa_upcallp_t
;
417 void netbsd32_cpu_upcall(struct lwp
*, int, int, int, void *, void *,
418 void *, sa_upcall_t
);
420 /* from <sys/sem.h> */
421 typedef netbsd32_pointer_t netbsd32_semp_t
;
423 typedef netbsd32_pointer_t netbsd32_semid_dsp_t
;
424 struct netbsd32_semid_ds
{
425 struct netbsd32_ipc_perm sem_perm
;/* operation permission struct */
426 unsigned short sem_nsems
; /* number of sems in set */
427 netbsd32_time_t sem_otime
; /* last operation time */
428 netbsd32_time_t sem_ctime
; /* last change time */
431 * These members are private and used only in the internal
432 * implementation of this interface.
434 netbsd32_semp_t _sem_base
; /* pointer to first semaphore in set */
437 typedef netbsd32_pointer_t netbsd32_semid_ds50p_t
;
438 struct netbsd32_semid_ds50
{
439 struct netbsd32_ipc_perm sem_perm
;/* operation permission struct */
440 unsigned short sem_nsems
; /* number of sems in set */
441 int32_t sem_otime
; /* last operation time */
442 int32_t sem_ctime
; /* last change time */
445 * These members are private and used only in the internal
446 * implementation of this interface.
448 netbsd32_semp_t _sem_base
; /* pointer to first semaphore in set */
451 typedef netbsd32_pointer_t netbsd32_semid_ds14p_t
;
452 struct netbsd32_semid_ds14
{
453 struct netbsd32_ipc_perm14 sem_perm
;/* operation permission struct */
454 netbsd32_semp_t sem_base
; /* pointer to first semaphore in set */
455 unsigned short sem_nsems
; /* number of sems in set */
456 netbsd32_time_t sem_otime
; /* last operation time */
457 netbsd32_long sem_pad1
; /* SVABI/386 says I need this here */
458 netbsd32_time_t sem_ctime
; /* last change time */
459 /* Times measured in secs since */
460 /* 00:00:00 GMT, Jan. 1, 1970 */
461 int32_t sem_pad2
; /* SVABI/386 says I need this here */
462 int32_t sem_pad3
[4]; /* SVABI/386 says I need this here */
465 typedef uint32_t netbsd32_semunu_t
;
466 typedef netbsd32_pointer_t netbsd32_semunp_t
;
467 union netbsd32_semun
{
468 int val
; /* value for SETVAL */
469 netbsd32_semid_dsp_t buf
; /* buffer for IPC_STAT & IPC_SET */
470 netbsd32_u_shortp array
; /* array for GETALL & SETALL */
473 typedef netbsd32_pointer_t netbsd32_semun50p_t
;
474 union netbsd32_semun50
{
475 int val
; /* value for SETVAL */
476 netbsd32_semid_ds50p_t buf
; /* buffer for IPC_STAT & IPC_SET */
477 netbsd32_u_shortp array
; /* array for GETALL & SETALL */
480 typedef netbsd32_pointer_t netbsd32_sembufp_t
;
481 struct netbsd32_sembuf
{
482 unsigned short sem_num
; /* semaphore # */
483 short sem_op
; /* semaphore operation */
484 short sem_flg
; /* operation flags */
487 /* from <sys/shm.h> */
488 typedef netbsd32_pointer_t netbsd32_shmid_dsp_t
;
489 struct netbsd32_shmid_ds
{
490 struct netbsd32_ipc_perm shm_perm
; /* operation permission structure */
491 netbsd32_size_t shm_segsz
; /* size of segment in bytes */
492 pid_t shm_lpid
; /* process ID of last shm op */
493 pid_t shm_cpid
; /* process ID of creator */
494 shmatt_t shm_nattch
; /* number of current attaches */
495 netbsd32_time_t shm_atime
; /* time of last shmat() */
496 netbsd32_time_t shm_dtime
; /* time of last shmdt() */
497 netbsd32_time_t shm_ctime
; /* time of last change by shmctl() */
498 netbsd32_voidp _shm_internal
; /* sysv stupidity */
501 typedef netbsd32_pointer_t netbsd32_shmid_ds50p_t
;
502 struct netbsd32_shmid_ds50
{
503 struct netbsd32_ipc_perm shm_perm
; /* operation permission structure */
504 netbsd32_size_t shm_segsz
; /* size of segment in bytes */
505 pid_t shm_lpid
; /* process ID of last shm op */
506 pid_t shm_cpid
; /* process ID of creator */
507 shmatt_t shm_nattch
; /* number of current attaches */
508 int32_t shm_atime
; /* time of last shmat() */
509 int32_t shm_dtime
; /* time of last shmdt() */
510 int32_t shm_ctime
; /* time of last change by shmctl() */
511 netbsd32_voidp _shm_internal
; /* sysv stupidity */
514 typedef netbsd32_pointer_t netbsd32_shmid_ds14p_t
;
515 struct netbsd32_shmid_ds14
{
516 struct netbsd32_ipc_perm14 shm_perm
; /* operation permission structure */
517 int shm_segsz
; /* size of segment in bytes */
518 pid_t shm_lpid
; /* process ID of last shm op */
519 pid_t shm_cpid
; /* process ID of creator */
520 short shm_nattch
; /* number of current attaches */
521 int32_t shm_atime
; /* time of last shmat() */
522 int32_t shm_dtime
; /* time of last shmdt() */
523 int32_t shm_ctime
; /* time of last change by shmctl() */
524 netbsd32_voidp _shm_internal
; /* sysv stupidity */
527 /* from <sys/signal.h> */
528 typedef netbsd32_pointer_t netbsd32_sigsetp_t
;
529 typedef netbsd32_pointer_t netbsd32_sigactionp_t
;
530 struct netbsd32_sigaction
{
531 netbsd32_voidp netbsd32_sa_handler
; /* signal handler */
532 sigset_t netbsd32_sa_mask
; /* signal mask to apply */
533 int netbsd32_sa_flags
; /* see signal options below */
536 typedef netbsd32_pointer_t netbsd32_sigaltstack13p_t
;
537 struct netbsd32_sigaltstack13
{
538 netbsd32_charp ss_sp
; /* signal stack base */
539 int ss_size
; /* signal stack length */
540 int ss_flags
; /* SS_DISABLE and/or SS_ONSTACK */
543 typedef netbsd32_pointer_t netbsd32_sigaltstackp_t
;
544 struct netbsd32_sigaltstack
{
545 netbsd32_voidp ss_sp
; /* signal stack base */
546 netbsd32_size_t ss_size
; /* signal stack length */
547 int ss_flags
; /* SS_DISABLE and/or SS_ONSTACK */
550 typedef netbsd32_pointer_t netbsd32_sigstackp_t
;
551 struct netbsd32_sigstack
{
552 netbsd32_voidp ss_sp
; /* signal stack pointer */
553 int ss_onstack
; /* current status */
556 typedef netbsd32_pointer_t netbsd32_sigvecp_t
;
557 struct netbsd32_sigvec
{
558 netbsd32_voidp sv_handler
; /* signal handler */
559 int sv_mask
; /* signal mask to apply */
560 int sv_flags
; /* see signal options below */
563 typedef netbsd32_pointer_t netbsd32_siginfop_t
;
565 union netbsd32_sigval
{
567 netbsd32_voidp sival_ptr
;
570 typedef netbsd32_pointer_t netbsd32_sigeventp_t
;
571 struct netbsd32_sigevent
{
574 union netbsd32_sigval sigev_value
;
575 netbsd32_voidp sigev_notify_function
;
576 netbsd32_voidp sigev_notify_attributes
;
579 /* from <sys/sigtypes.h> */
580 typedef netbsd32_pointer_t netbsd32_stackp_t
;
582 /* from <sys/socket.h> */
583 typedef netbsd32_pointer_t netbsd32_sockaddrp_t
;
584 typedef netbsd32_pointer_t netbsd32_osockaddrp_t
;
586 typedef netbsd32_pointer_t netbsd32_msghdrp_t
;
587 struct netbsd32_msghdr
{
588 netbsd32_caddr_t msg_name
; /* optional address */
589 unsigned int msg_namelen
; /* size of address */
590 netbsd32_iovecp_t msg_iov
; /* scatter/gather array */
591 unsigned int msg_iovlen
; /* # elements in msg_iov */
592 netbsd32_caddr_t msg_control
; /* ancillary data, see below */
593 unsigned int msg_controllen
; /* ancillary data buffer len */
594 int msg_flags
; /* flags on received message */
597 typedef netbsd32_pointer_t netbsd32_omsghdrp_t
;
598 struct netbsd32_omsghdr
{
599 netbsd32_caddr_t msg_name
; /* optional address */
600 int msg_namelen
; /* size of address */
601 netbsd32_iovecp_t msg_iov
; /* scatter/gather array */
602 int msg_iovlen
; /* # elements in msg_iov */
603 netbsd32_caddr_t msg_accrights
; /* access rights sent/recvd */
604 int msg_accrightslen
;
607 /* from <sys/stat.h> */
608 typedef netbsd32_pointer_t netbsd32_stat12p_t
;
609 struct netbsd32_stat12
{ /* NetBSD-1.2 stat struct */
610 uint32_t st_dev
; /* inode's device */
611 uint32_t st_ino
; /* inode's number */
612 uint16_t st_mode
; /* inode protection mode */
613 uint16_t st_nlink
; /* number of hard links */
614 uid_t st_uid
; /* user ID of the file's owner */
615 gid_t st_gid
; /* group ID of the file's group */
616 uint32_t st_rdev
; /* device type */
617 struct netbsd32_timespec st_atimespec
;/* time of last access */
618 struct netbsd32_timespec st_mtimespec
;/* time of last data modification */
619 struct netbsd32_timespec st_ctimespec
;/* time of last file status change */
620 netbsd32_int64 st_size
; /* file size, in bytes */
621 netbsd32_int64 st_blocks
; /* blocks allocated for file */
622 uint32_t st_blksize
; /* optimal blocksize for I/O */
623 uint32_t st_flags
; /* user defined flags for file */
624 uint32_t st_gen
; /* file generation number */
626 netbsd32_int64 st_qspare
[2];
629 typedef netbsd32_pointer_t netbsd32_stat43p_t
;
630 struct netbsd32_stat43
{ /* BSD-4.3 stat struct */
631 uint16_t st_dev
; /* inode's device */
632 uint32_t st_ino
; /* inode's number */
633 uint16_t st_mode
; /* inode protection mode */
634 uint16_t st_nlink
; /* number of hard links */
635 uint16_t st_uid
; /* user ID of the file's owner */
636 uint16_t st_gid
; /* group ID of the file's group */
637 uint16_t st_rdev
; /* device type */
638 int32_t st_size
; /* file size, in bytes */
639 struct netbsd32_timespec st_atimespec
;/* time of last access */
640 struct netbsd32_timespec st_mtimespec
;/* time of last data modification */
641 struct netbsd32_timespec st_ctimespec
;/* time of last file status change */
642 int32_t st_blksize
; /* optimal blocksize for I/O */
643 int32_t st_blocks
; /* blocks allocated for file */
644 uint32_t st_flags
; /* user defined flags for file */
645 uint32_t st_gen
; /* file generation number */
647 typedef netbsd32_pointer_t netbsd32_stat13p_t
;
648 struct netbsd32_stat13
{
649 uint32_t st_dev
; /* inode's device */
650 uint32_t st_ino
; /* inode's number */
651 mode_t st_mode
; /* inode protection mode */
652 nlink_t st_nlink
; /* number of hard links */
653 uid_t st_uid
; /* user ID of the file's owner */
654 gid_t st_gid
; /* group ID of the file's group */
655 uint32_t st_rdev
; /* device type */
656 struct netbsd32_timespec st_atimespec
;/* time of last access */
657 struct netbsd32_timespec st_mtimespec
;/* time of last data modification */
658 struct netbsd32_timespec st_ctimespec
;/* time of last file status change */
659 netbsd32_int64 st_size
; /* file size, in bytes */
660 netbsd32_uint64 st_blocks
; /* blocks allocated for file */
661 blksize_t st_blksize
; /* optimal blocksize for I/O */
662 uint32_t st_flags
; /* user defined flags for file */
663 uint32_t st_gen
; /* file generation number */
664 uint32_t st_spare
; /* file generation number */
665 struct netbsd32_timespec st_birthtimespec
;
669 typedef netbsd32_pointer_t netbsd32_stat50p_t
;
670 struct netbsd32_stat50
{
671 uint32_t st_dev
; /* inode's device */
672 mode_t st_mode
; /* inode protection mode */
673 netbsd32_uint64 st_ino
; /* inode's number */
674 nlink_t st_nlink
; /* number of hard links */
675 uid_t st_uid
; /* user ID of the file's owner */
676 gid_t st_gid
; /* group ID of the file's group */
677 uint32_t st_rdev
; /* device type */
678 struct netbsd32_timespec50 st_atimespec
;/* time of last access */
679 struct netbsd32_timespec50 st_mtimespec
;/* time of last data modification */
680 struct netbsd32_timespec50 st_ctimespec
;/* time of last file status change */
681 struct netbsd32_timespec50 st_birthtimespec
; /* time of creation */
682 netbsd32_int64 st_size
; /* file size, in bytes */
683 netbsd32_uint64 st_blocks
; /* blocks allocated for file */
684 blksize_t st_blksize
; /* optimal blocksize for I/O */
685 uint32_t st_flags
; /* user defined flags for file */
686 uint32_t st_gen
; /* file generation number */
687 uint32_t st_spare
[2];
690 typedef netbsd32_pointer_t netbsd32_statp_t
;
691 struct netbsd32_stat
{
692 netbsd32_dev_t st_dev
; /* inode's device */
693 mode_t st_mode
; /* inode protection mode */
694 netbsd32_uint64 st_ino
; /* inode's number */
695 nlink_t st_nlink
; /* number of hard links */
696 uid_t st_uid
; /* user ID of the file's owner */
697 gid_t st_gid
; /* group ID of the file's group */
698 netbsd32_dev_t st_rdev
; /* device type */
699 struct netbsd32_timespec st_atimespec
;/* time of last access */
700 struct netbsd32_timespec st_mtimespec
;/* time of last data modification */
701 struct netbsd32_timespec st_ctimespec
;/* time of last file status change */
702 struct netbsd32_timespec st_birthtimespec
; /* time of creation */
703 netbsd32_int64 st_size
; /* file size, in bytes */
704 netbsd32_uint64 st_blocks
; /* blocks allocated for file */
705 blksize_t st_blksize
; /* optimal blocksize for I/O */
706 uint32_t st_flags
; /* user defined flags for file */
707 uint32_t st_gen
; /* file generation number */
708 uint32_t st_spare
[2];
711 /* from <sys/statvfs.h> */
712 typedef netbsd32_pointer_t netbsd32_statvfsp_t
;
713 struct netbsd32_statvfs
{
714 netbsd32_u_long f_flag
; /* copy of mount exported flags */
715 netbsd32_u_long f_bsize
; /* system block size */
716 netbsd32_u_long f_frsize
; /* system fragment size */
717 netbsd32_u_long f_iosize
; /* optimal file system block size */
718 netbsd32_uint64 f_blocks
; /* number of blocks in file system */
719 netbsd32_uint64 f_bfree
; /* free blocks avail in file system */
720 netbsd32_uint64 f_bavail
; /* free blocks avail to non-root */
721 netbsd32_uint64 f_bresvd
; /* blocks reserved for root */
722 netbsd32_uint64 f_files
; /* total file nodes in file system */
723 netbsd32_uint64 f_ffree
; /* free file nodes in file system */
724 netbsd32_uint64 f_favail
; /* free file nodes avail to non-root */
725 netbsd32_uint64 f_fresvd
; /* file nodes reserved for root */
726 netbsd32_uint64 f_syncreads
; /* count of sync reads since mount */
727 netbsd32_uint64 f_syncwrites
; /* count of sync writes since mount */
728 netbsd32_uint64 f_asyncreads
; /* count of async reads since mount */
729 netbsd32_uint64 f_asyncwrites
; /* count of async writes since mount */
730 fsid_t f_fsidx
; /* NetBSD compatible fsid */
731 netbsd32_u_long f_fsid
; /* Posix compatible fsid */
732 netbsd32_u_long f_namemax
; /* maximum filename length */
733 uid_t f_owner
; /* user that mounted the file system */
734 uint32_t f_spare
[4]; /* spare space */
735 char f_fstypename
[_VFS_NAMELEN
]; /* fs type name */
736 char f_mntonname
[_VFS_MNAMELEN
]; /* directory on which mounted */
737 char f_mntfromname
[_VFS_MNAMELEN
]; /* mounted file system */
740 /* from <sys/timex.h> */
741 typedef netbsd32_pointer_t netbsd32_ntptimevalp_t
;
742 typedef netbsd32_pointer_t netbsd32_ntptimeval30p_t
;
743 typedef netbsd32_pointer_t netbsd32_ntptimeval50p_t
;
745 struct netbsd32_ntptimeval30
{
746 struct netbsd32_timeval50 time
; /* current time (ro) */
747 netbsd32_long maxerror
; /* maximum error (us) (ro) */
748 netbsd32_long esterror
; /* estimated error (us) (ro) */
750 struct netbsd32_ntptimeval50
{
751 struct netbsd32_timespec50 time
; /* current time (ro) */
752 netbsd32_long maxerror
; /* maximum error (us) (ro) */
753 netbsd32_long esterror
; /* estimated error (us) (ro) */
754 netbsd32_long tai
; /* TAI offset */
755 int time_state
; /* time status */
758 struct netbsd32_ntptimeval
{
759 struct netbsd32_timespec time
; /* current time (ro) */
760 netbsd32_long maxerror
; /* maximum error (us) (ro) */
761 netbsd32_long esterror
; /* estimated error (us) (ro) */
762 netbsd32_long tai
; /* TAI offset */
763 int time_state
; /* time status */
765 typedef netbsd32_pointer_t netbsd32_timexp_t
;
766 struct netbsd32_timex
{
767 unsigned int modes
; /* clock mode bits (wo) */
768 netbsd32_long offset
; /* time offset (us) (rw) */
769 netbsd32_long freq
; /* frequency offset (scaled ppm) (rw) */
770 netbsd32_long maxerror
; /* maximum error (us) (rw) */
771 netbsd32_long esterror
; /* estimated error (us) (rw) */
772 int status
; /* clock status bits (rw) */
773 netbsd32_long constant
; /* pll time constant (rw) */
774 netbsd32_long precision
; /* clock precision (us) (ro) */
775 netbsd32_long tolerance
; /* clock frequency tolerance (scaled
778 * The following read-only structure members are implemented
779 * only if the PPS signal discipline is configured in the
782 netbsd32_long ppsfreq
; /* pps frequency (scaled ppm) (ro) */
783 netbsd32_long jitter
; /* pps jitter (us) (ro) */
784 int shift
; /* interval duration (s) (shift) (ro) */
785 netbsd32_long stabil
; /* pps stability (scaled ppm) (ro) */
786 netbsd32_long jitcnt
; /* jitter limit exceeded (ro) */
787 netbsd32_long calcnt
; /* calibration intervals (ro) */
788 netbsd32_long errcnt
; /* calibration errors (ro) */
789 netbsd32_long stbcnt
; /* stability limit exceeded (ro) */
792 /* from <ufs/lfs/lfs.h> */
793 typedef netbsd32_pointer_t netbsd32_block_infop_t
; /* XXX broken */
795 /* from <sys/utsname.h> */
796 typedef netbsd32_pointer_t netbsd32_utsnamep_t
;
798 /* from <compat/common/kern_info_09.c> */
799 typedef netbsd32_pointer_t netbsd32_outsnamep_t
;
801 /* from <arch/sparc{,64}/include/vuid_event.h> */
802 typedef struct firm_event32
{
803 unsigned short id
; /* key or MS_* or LOC_[XY]_DELTA */
804 unsigned short pad
; /* unused, at least by X11 */
805 int value
; /* VKEY_{UP,DOWN} or locator delta */
806 struct netbsd32_timeval time
;
809 /* from <sys/uuid.h> */
810 typedef netbsd32_pointer_t netbsd32_uuidp_t
;
812 /* from <sys/event.h> */
813 typedef netbsd32_pointer_t netbsd32_keventp_t
;
815 struct netbsd32_kevent
{
816 netbsd32_uintptr_t ident
;
821 netbsd32_intptr_t udata
;
824 /* from <sys/sched.h> */
825 typedef netbsd32_pointer_t netbsd32_sched_paramp_t
;
826 typedef netbsd32_pointer_t netbsd32_cpusetp_t
;
828 /* from <fs/cd9660/cd9660_mount.h> */
829 struct netbsd32_iso_args
{
830 netbsd32_charp fspec
;
831 struct export_args30 _pad1
;
835 /* from <ufs/ufs/ufs_mount.h> */
836 struct netbsd32_ufs_args
{
837 netbsd32_charp fspec
;
840 struct netbsd32_mfs_args
{
841 netbsd32_charp fspec
;
842 struct netbsd32_export_args30 _pad1
;
844 netbsd32_u_long size
;
848 int netbsd32_kevent(struct lwp
*, void *, register_t
*);
852 * here are some macros to convert between netbsd32 and sparc64 types.
853 * note that they do *NOT* act like good macros and put ()'s around all
854 * arguments cuz this _breaks_ SCARG().
856 #define NETBSD32TO64(s32uap, uap, name) \
857 SCARG(uap, name) = SCARG(s32uap, name)
858 #define NETBSD32TOP(s32uap, uap, name, type) \
859 SCARG(uap, name) = SCARG_P32(s32uap, name)
860 #define NETBSD32TOX(s32uap, uap, name, type) \
861 SCARG(uap, name) = (type)SCARG(s32uap, name)
862 #define NETBSD32TOX64(s32uap, uap, name, type) \
863 SCARG(uap, name) = (type)(long)SCARG(s32uap, name)
865 /* and some standard versions */
866 #define NETBSD32TO64_UAP(name) NETBSD32TO64(uap, &ua, name)
867 #define NETBSD32TOP_UAP(name, type) NETBSD32TOP(uap, &ua, name, type)
868 #define NETBSD32TOX_UAP(name, type) NETBSD32TOX(uap, &ua, name, type)
869 #define NETBSD32TOX64_UAP(name, type) NETBSD32TOX64(uap, &ua, name, type)
871 #define SCARG_P32(uap, name) NETBSD32PTR64(SCARG(uap, name))
873 int coredump_netbsd32(struct lwp
*, void *);
878 #include <compat/common/compat_util.h>
879 #include <compat/sys/siginfo.h>
881 vaddr_t
netbsd32_vm_default_addr(struct proc
*, vaddr_t
, vsize_t
);
882 void netbsd32_adjust_limits(struct proc
*);
884 void netbsd32_si_to_si32(siginfo32_t
*, const siginfo_t
*);
885 void netbsd32_si32_to_si(siginfo_t
*, const siginfo32_t
*);
887 void startlwp32(void *);
888 struct compat_50_netbsd32___semctl14_args
;
889 int do_netbsd32___semctl14(struct lwp
*, const struct compat_50_netbsd32___semctl14_args
*, register_t
*, void *);
891 struct iovec
*netbsd32_get_iov(struct netbsd32_iovec
*, int, struct iovec
*,
894 #ifdef SYSCTL_SETUP_PROTO
895 SYSCTL_SETUP_PROTO(netbsd32_sysctl_emul_setup
);
896 #endif /* SYSCTL_SETUP_PROTO */
897 #endif /* _COMPAT_NETBSD32_NETBSD32_H_ */