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