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