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