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