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