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