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