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