netbsd32.h revision 1.116.2.3 1 /* $NetBSD: netbsd32.h,v 1.116.2.3 2018/09/06 06:55:46 pgoyette 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 typedef netbsd32_pointer_t netbsd32_mmsghdrp_t;
719 struct netbsd32_mmsghdr {
720 struct netbsd32_msghdr msg_hdr;
721 unsigned int msg_len;
722 };
723
724 /* from <sys/stat.h> */
725 typedef netbsd32_pointer_t netbsd32_stat12p_t;
726 struct netbsd32_stat12 { /* NetBSD-1.2 stat struct */
727 uint32_t st_dev; /* inode's device */
728 uint32_t st_ino; /* inode's number */
729 uint16_t st_mode; /* inode protection mode */
730 uint16_t st_nlink; /* number of hard links */
731 uid_t st_uid; /* user ID of the file's owner */
732 gid_t st_gid; /* group ID of the file's group */
733 uint32_t st_rdev; /* device type */
734 struct netbsd32_timespec50 st_atimespec;/* time of last access */
735 struct netbsd32_timespec50 st_mtimespec;/* time of last data modification */
736 struct netbsd32_timespec50 st_ctimespec;/* time of last file status change */
737 netbsd32_int64 st_size; /* file size, in bytes */
738 netbsd32_int64 st_blocks; /* blocks allocated for file */
739 uint32_t st_blksize; /* optimal blocksize for I/O */
740 uint32_t st_flags; /* user defined flags for file */
741 uint32_t st_gen; /* file generation number */
742 int32_t st_lspare;
743 netbsd32_int64 st_qspare[2];
744 };
745
746 typedef netbsd32_pointer_t netbsd32_stat43p_t;
747 struct netbsd32_stat43 { /* BSD-4.3 stat struct */
748 uint16_t st_dev; /* inode's device */
749 uint32_t st_ino; /* inode's number */
750 uint16_t st_mode; /* inode protection mode */
751 uint16_t st_nlink; /* number of hard links */
752 uint16_t st_uid; /* user ID of the file's owner */
753 uint16_t st_gid; /* group ID of the file's group */
754 uint16_t st_rdev; /* device type */
755 int32_t st_size; /* file size, in bytes */
756 struct netbsd32_timespec50 st_atimespec;/* time of last access */
757 struct netbsd32_timespec50 st_mtimespec;/* time of last data modification */
758 struct netbsd32_timespec50 st_ctimespec;/* time of last file status change */
759 int32_t st_blksize; /* optimal blocksize for I/O */
760 int32_t st_blocks; /* blocks allocated for file */
761 uint32_t st_flags; /* user defined flags for file */
762 uint32_t st_gen; /* file generation number */
763 };
764 typedef netbsd32_pointer_t netbsd32_stat13p_t;
765 struct netbsd32_stat13 {
766 uint32_t st_dev; /* inode's device */
767 uint32_t st_ino; /* inode's number */
768 mode_t st_mode; /* inode protection mode */
769 nlink_t st_nlink; /* number of hard links */
770 uid_t st_uid; /* user ID of the file's owner */
771 gid_t st_gid; /* group ID of the file's group */
772 uint32_t st_rdev; /* device type */
773 struct netbsd32_timespec50 st_atimespec;/* time of last access */
774 struct netbsd32_timespec50 st_mtimespec;/* time of last data modification */
775 struct netbsd32_timespec50 st_ctimespec;/* time of last file status change */
776 netbsd32_int64 st_size; /* file size, in bytes */
777 netbsd32_uint64 st_blocks; /* blocks allocated for file */
778 blksize_t st_blksize; /* optimal blocksize for I/O */
779 uint32_t st_flags; /* user defined flags for file */
780 uint32_t st_gen; /* file generation number */
781 uint32_t st_spare; /* file generation number */
782 struct netbsd32_timespec50 st_birthtimespec;
783 uint32_t st_spare2;
784 };
785
786 typedef netbsd32_pointer_t netbsd32_stat50p_t;
787 struct netbsd32_stat50 {
788 uint32_t st_dev; /* inode's device */
789 mode_t st_mode; /* inode protection mode */
790 netbsd32_uint64 st_ino; /* inode's number */
791 nlink_t st_nlink; /* number of hard links */
792 uid_t st_uid; /* user ID of the file's owner */
793 gid_t st_gid; /* group ID of the file's group */
794 uint32_t st_rdev; /* device type */
795 struct netbsd32_timespec50 st_atimespec;/* time of last access */
796 struct netbsd32_timespec50 st_mtimespec;/* time of last data modification */
797 struct netbsd32_timespec50 st_ctimespec;/* time of last file status change */
798 struct netbsd32_timespec50 st_birthtimespec; /* time of creation */
799 netbsd32_int64 st_size; /* file size, in bytes */
800 netbsd32_uint64 st_blocks; /* blocks allocated for file */
801 blksize_t st_blksize; /* optimal blocksize for I/O */
802 uint32_t st_flags; /* user defined flags for file */
803 uint32_t st_gen; /* file generation number */
804 uint32_t st_spare[2];
805 };
806
807 typedef netbsd32_pointer_t netbsd32_statp_t;
808 struct netbsd32_stat {
809 netbsd32_dev_t st_dev; /* inode's device */
810 mode_t st_mode; /* inode protection mode */
811 netbsd32_uint64 st_ino; /* inode's number */
812 nlink_t st_nlink; /* number of hard links */
813 uid_t st_uid; /* user ID of the file's owner */
814 gid_t st_gid; /* group ID of the file's group */
815 netbsd32_dev_t st_rdev; /* device type */
816 struct netbsd32_timespec st_atimespec;/* time of last access */
817 struct netbsd32_timespec st_mtimespec;/* time of last data modification */
818 struct netbsd32_timespec st_ctimespec;/* time of last file status change */
819 struct netbsd32_timespec st_birthtimespec; /* time of creation */
820 netbsd32_int64 st_size; /* file size, in bytes */
821 netbsd32_uint64 st_blocks; /* blocks allocated for file */
822 blksize_t st_blksize; /* optimal blocksize for I/O */
823 uint32_t st_flags; /* user defined flags for file */
824 uint32_t st_gen; /* file generation number */
825 uint32_t st_spare[2];
826 };
827
828 /* from <sys/statvfs.h> */
829 typedef netbsd32_pointer_t netbsd32_statvfsp_t;
830 struct netbsd32_statvfs {
831 netbsd32_u_long f_flag; /* copy of mount exported flags */
832 netbsd32_u_long f_bsize; /* system block size */
833 netbsd32_u_long f_frsize; /* system fragment size */
834 netbsd32_u_long f_iosize; /* optimal file system block size */
835 netbsd32_uint64 f_blocks; /* number of blocks in file system */
836 netbsd32_uint64 f_bfree; /* free blocks avail in file system */
837 netbsd32_uint64 f_bavail; /* free blocks avail to non-root */
838 netbsd32_uint64 f_bresvd; /* blocks reserved for root */
839 netbsd32_uint64 f_files; /* total file nodes in file system */
840 netbsd32_uint64 f_ffree; /* free file nodes in file system */
841 netbsd32_uint64 f_favail; /* free file nodes avail to non-root */
842 netbsd32_uint64 f_fresvd; /* file nodes reserved for root */
843 netbsd32_uint64 f_syncreads; /* count of sync reads since mount */
844 netbsd32_uint64 f_syncwrites; /* count of sync writes since mount */
845 netbsd32_uint64 f_asyncreads; /* count of async reads since mount */
846 netbsd32_uint64 f_asyncwrites; /* count of async writes since mount */
847 fsid_t f_fsidx; /* NetBSD compatible fsid */
848 netbsd32_u_long f_fsid; /* Posix compatible fsid */
849 netbsd32_u_long f_namemax; /* maximum filename length */
850 uid_t f_owner; /* user that mounted the file system */
851 uint32_t f_spare[4]; /* spare space */
852 char f_fstypename[_VFS_NAMELEN]; /* fs type name */
853 char f_mntonname[_VFS_MNAMELEN]; /* directory on which mounted */
854 char f_mntfromname[_VFS_MNAMELEN]; /* mounted file system */
855 };
856
857 /* from <sys/timex.h> */
858 typedef netbsd32_pointer_t netbsd32_ntptimevalp_t;
859 typedef netbsd32_pointer_t netbsd32_ntptimeval30p_t;
860 typedef netbsd32_pointer_t netbsd32_ntptimeval50p_t;
861
862 struct netbsd32_ntptimeval30 {
863 struct netbsd32_timeval50 time; /* current time (ro) */
864 netbsd32_long maxerror; /* maximum error (us) (ro) */
865 netbsd32_long esterror; /* estimated error (us) (ro) */
866 };
867 struct netbsd32_ntptimeval50 {
868 struct netbsd32_timespec50 time; /* current time (ro) */
869 netbsd32_long maxerror; /* maximum error (us) (ro) */
870 netbsd32_long esterror; /* estimated error (us) (ro) */
871 netbsd32_long tai; /* TAI offset */
872 int time_state; /* time status */
873 };
874
875 struct netbsd32_ntptimeval {
876 struct netbsd32_timespec time; /* current time (ro) */
877 netbsd32_long maxerror; /* maximum error (us) (ro) */
878 netbsd32_long esterror; /* estimated error (us) (ro) */
879 netbsd32_long tai; /* TAI offset */
880 int time_state; /* time status */
881 };
882 typedef netbsd32_pointer_t netbsd32_timexp_t;
883 struct netbsd32_timex {
884 unsigned int modes; /* clock mode bits (wo) */
885 netbsd32_long offset; /* time offset (us) (rw) */
886 netbsd32_long freq; /* frequency offset (scaled ppm) (rw) */
887 netbsd32_long maxerror; /* maximum error (us) (rw) */
888 netbsd32_long esterror; /* estimated error (us) (rw) */
889 int status; /* clock status bits (rw) */
890 netbsd32_long constant; /* pll time constant (rw) */
891 netbsd32_long precision; /* clock precision (us) (ro) */
892 netbsd32_long tolerance; /* clock frequency tolerance (scaled
893 * ppm) (ro) */
894 /*
895 * The following read-only structure members are implemented
896 * only if the PPS signal discipline is configured in the
897 * kernel.
898 */
899 netbsd32_long ppsfreq; /* pps frequency (scaled ppm) (ro) */
900 netbsd32_long jitter; /* pps jitter (us) (ro) */
901 int shift; /* interval duration (s) (shift) (ro) */
902 netbsd32_long stabil; /* pps stability (scaled ppm) (ro) */
903 netbsd32_long jitcnt; /* jitter limit exceeded (ro) */
904 netbsd32_long calcnt; /* calibration intervals (ro) */
905 netbsd32_long errcnt; /* calibration errors (ro) */
906 netbsd32_long stbcnt; /* stability limit exceeded (ro) */
907 };
908
909 /* <prop/plistref.h> */
910 struct netbsd32_plistref {
911 netbsd32_pointer_t pref_plist;
912 netbsd32_size_t pref_len;
913 };
914
915 /* from <ufs/lfs/lfs.h> */
916 typedef netbsd32_pointer_t netbsd32_block_infop_t; /* XXX broken */
917
918 /* from <sys/utsname.h> */
919 typedef netbsd32_pointer_t netbsd32_utsnamep_t;
920
921 /* from <compat/common/kern_info_09.c> */
922 typedef netbsd32_pointer_t netbsd32_outsnamep_t;
923
924 /* from <arch/sparc{,64}/include/vuid_event.h> */
925 typedef struct firm_event32 {
926 unsigned short id; /* key or MS_* or LOC_[XY]_DELTA */
927 unsigned short pad; /* unused, at least by X11 */
928 int value; /* VKEY_{UP,DOWN} or locator delta */
929 struct netbsd32_timeval time;
930 } Firm_event32;
931
932 /* from <sys/uuid.h> */
933 typedef netbsd32_pointer_t netbsd32_uuidp_t;
934
935 /* from <sys/event.h> */
936 typedef netbsd32_pointer_t netbsd32_keventp_t;
937
938 struct netbsd32_kevent {
939 netbsd32_uintptr_t ident;
940 uint32_t filter;
941 uint32_t flags;
942 uint32_t fflags;
943 netbsd32_int64 data;
944 netbsd32_intptr_t udata;
945 };
946
947 /* from <sys/sched.h> */
948 typedef netbsd32_pointer_t netbsd32_sched_paramp_t;
949 typedef netbsd32_pointer_t netbsd32_cpusetp_t;
950
951 /* from <fs/tmpfs/tmpfs_args.h> */
952 struct netbsd32_tmpfs_args {
953 int ta_version;
954
955 /* Size counters. */
956 netbsd32_ino_t ta_nodes_max;
957 netbsd32_off_t ta_size_max;
958
959 /* Root node attributes. */
960 uid_t ta_root_uid;
961 gid_t ta_root_gid;
962 mode_t ta_root_mode;
963 };
964
965 /* from <fs/cd9660/cd9660_mount.h> */
966 struct netbsd32_iso_args {
967 netbsd32_charp fspec;
968 struct netbsd32_export_args30 _pad1;
969 int flags;
970 };
971
972 /* from <ufs/ufs/ufs_mount.h> */
973 struct netbsd32_ufs_args {
974 netbsd32_charp fspec;
975 };
976
977 struct netbsd32_mfs_args {
978 netbsd32_charp fspec;
979 struct netbsd32_export_args30 _pad1;
980 netbsd32_voidp base;
981 netbsd32_u_long size;
982 };
983
984 /* from <nfs/nfs.h> */
985 struct netbsd32_nfsd_args {
986 int sock;
987 netbsd32_voidp name;
988 int namelen;
989 };
990
991 typedef netbsd32_pointer_t netbsd32_nfsdp;
992 struct netbsd32_nfsd_srvargs {
993 netbsd32_nfsdp nsd_nfsd;
994 uid_t nsd_uid;
995 u_int32_t nsd_haddr;
996 struct uucred nsd_cr;
997 int nsd_authlen;
998 netbsd32_u_charp nsd_authstr;
999 int nsd_verflen;
1000 netbsd32_u_charp nsd_verfstr;
1001 struct netbsd32_timeval nsd_timestamp;
1002 u_int32_t nsd_ttl;
1003 NFSKERBKEY_T nsd_key;
1004 };
1005
1006 typedef netbsd32_pointer_t netbsd32_export_argsp;
1007 struct netbsd32_export_args {
1008 int ex_flags;
1009 uid_t ex_root;
1010 struct uucred ex_anon;
1011 netbsd32_sockaddrp_t ex_addr;
1012 int ex_addrlen;
1013 netbsd32_sockaddrp_t ex_mask;
1014 int ex_masklen;
1015 netbsd32_charp ex_indexfile;
1016 };
1017
1018 struct netbsd32_mountd_exports_list {
1019 const netbsd32_charp mel_path;
1020 netbsd32_size_t mel_nexports;
1021 netbsd32_export_argsp mel_exports;
1022 };
1023
1024 /* from <nfs/nfsmount,h> */
1025 struct netbsd32_nfs_args {
1026 int32_t version; /* args structure version number */
1027 netbsd32_sockaddrp_t addr; /* file server address */
1028 int32_t addrlen; /* length of address */
1029 int32_t sotype; /* Socket type */
1030 int32_t proto; /* and Protocol */
1031 netbsd32_u_charp fh; /* File handle to be mounted */
1032 int32_t fhsize; /* Size, in bytes, of fh */
1033 int32_t flags; /* flags */
1034 int32_t wsize; /* write size in bytes */
1035 int32_t rsize; /* read size in bytes */
1036 int32_t readdirsize; /* readdir size in bytes */
1037 int32_t timeo; /* initial timeout in .1 secs */
1038 int32_t retrans; /* times to retry send */
1039 int32_t maxgrouplist; /* Max. size of group list */
1040 int32_t readahead; /* # of blocks to readahead */
1041 int32_t leaseterm; /* Ignored; Term (sec) of lease */
1042 int32_t deadthresh; /* Retrans threshold */
1043 netbsd32_charp hostname; /* server's name */
1044 };
1045
1046 /* from <msdosfs/msdosfsmount.h> */
1047 struct netbsd32_msdosfs_args {
1048 netbsd32_charp fspec; /* blocks special holding the fs to mount */
1049 struct netbsd32_export_args30 _pad1; /* compat with old userland tools */
1050 uid_t uid; /* uid that owns msdosfs files */
1051 gid_t gid; /* gid that owns msdosfs files */
1052 mode_t mask; /* mask to be applied for msdosfs perms */
1053 int flags; /* see below */
1054
1055 /* Following items added after versioning support */
1056 int version; /* version of the struct */
1057 mode_t dirmask; /* v2: mask to be applied for msdosfs perms */
1058 int gmtoff; /* v3: offset from UTC in seconds */
1059 };
1060
1061 /* from <miscfs/genfs/layer.h> */
1062 struct netbsd32_layer_args {
1063 netbsd32_charp target; /* Target of loopback */
1064 struct netbsd32_export_args30 _pad1; /* compat with old userland tools */
1065 };
1066
1067 /* from <miscfs/nullfs/null.h> */
1068 struct netbsd32_null_args {
1069 struct netbsd32_layer_args la; /* generic layerfs args */
1070 };
1071
1072 struct netbsd32_posix_spawn_file_actions_entry {
1073 enum { FAE32_OPEN, FAE32_DUP2, FAE32_CLOSE } fae_action;
1074
1075 int fae_fildes;
1076 union {
1077 struct {
1078 netbsd32_charp path;
1079 int oflag;
1080 mode_t mode;
1081 } open;
1082 struct {
1083 int newfildes;
1084 } dup2;
1085 } fae_data;
1086 };
1087
1088 struct netbsd32_posix_spawn_file_actions {
1089 unsigned int size; /* size of fae array */
1090 unsigned int len; /* how many slots are used */
1091 netbsd32_posix_spawn_file_actions_entryp fae;
1092 };
1093
1094 struct netbsd32_modctl_load {
1095 netbsd32_charp ml_filename;
1096 int ml_flags;
1097 netbsd32_charp ml_props;
1098 netbsd32_size_t ml_propslen;
1099 };
1100
1101 struct netbsd32_mq_attr {
1102 netbsd32_long mq_flags;
1103 netbsd32_long mq_maxmsg;
1104 netbsd32_long mq_msgsize;
1105 netbsd32_long mq_curmsgs;
1106 };
1107 typedef netbsd32_pointer_t netbsd32_mq_attrp_t;
1108
1109 #if 0
1110 int netbsd32_kevent(struct lwp *, void *, register_t *);
1111 #endif
1112
1113 /*
1114 * here are some macros to convert between netbsd32 and native 64 bit types.
1115 * note that they do *NOT* act like good macros and put ()'s around all
1116 * arguments cuz this _breaks_ SCARG().
1117 */
1118 #define NETBSD32TO64(s32uap, uap, name) \
1119 SCARG(uap, name) = SCARG(s32uap, name)
1120 #define NETBSD32TOP(s32uap, uap, name, type) \
1121 SCARG(uap, name) = SCARG_P32(s32uap, name)
1122 #define NETBSD32TOX(s32uap, uap, name, type) \
1123 SCARG(uap, name) = (type)SCARG(s32uap, name)
1124 #define NETBSD32TOX64(s32uap, uap, name, type) \
1125 SCARG(uap, name) = (type)(long)SCARG(s32uap, name)
1126
1127 /* and some standard versions */
1128 #define NETBSD32TO64_UAP(name) NETBSD32TO64(uap, &ua, name)
1129 #define NETBSD32TOP_UAP(name, type) NETBSD32TOP(uap, &ua, name, type)
1130 #define NETBSD32TOX_UAP(name, type) NETBSD32TOX(uap, &ua, name, type)
1131 #define NETBSD32TOX64_UAP(name, type) NETBSD32TOX64(uap, &ua, name, type)
1132
1133 #define SCARG_P32(uap, name) NETBSD32PTR64(SCARG(uap, name))
1134
1135 struct coredump_iostate;
1136 int coredump_netbsd32(struct lwp *, struct coredump_iostate *);
1137
1138 /*
1139 * random other stuff
1140 */
1141
1142 vaddr_t netbsd32_vm_default_addr(struct proc *, vaddr_t, vsize_t, int);
1143 void netbsd32_adjust_limits(struct proc *);
1144
1145 void netbsd32_si_to_si32(siginfo32_t *, const siginfo_t *);
1146 void netbsd32_si32_to_si(siginfo_t *, const siginfo32_t *);
1147
1148 void netbsd32_ksi32_to_ksi(struct _ksiginfo *si, const struct __ksiginfo32 *si32);
1149
1150 #ifdef KTRACE
1151 void netbsd32_ktrpsig(int, sig_t, const sigset_t *, const ksiginfo_t *);
1152 #else
1153 #define netbsd32_ktrpsig NULL
1154 #endif
1155
1156
1157 void startlwp32(void *);
1158 struct compat_50_netbsd32___semctl14_args;
1159 int do_netbsd32___semctl14(struct lwp *, const struct compat_50_netbsd32___semctl14_args *, register_t *, void *);
1160
1161 struct iovec *netbsd32_get_iov(struct netbsd32_iovec *, int, struct iovec *,
1162 int);
1163
1164 #ifdef SYSCTL_SETUP_PROTO
1165 SYSCTL_SETUP_PROTO(netbsd32_sysctl_emul_setup);
1166 #endif /* SYSCTL_SETUP_PROTO */
1167 #endif /* _COMPAT_NETBSD32_NETBSD32_H_ */
1168