File indexing completed on 2025-01-18 10:13:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 #ifndef VKI_FREEBSD_H
0046 #define VKI_FREEBSD_H
0047
0048
0049
0050
0051
0052 #if defined(VGA_x86)
0053 # include "vki-machine-types-x86-freebsd.h"
0054 #elif defined(VGA_amd64)
0055 # include "vki-machine-types-amd64-freebsd.h"
0056 #else
0057 # error Unknown platform
0058 #endif
0059
0060 #include <sys/fcntl.h>
0061 #include <sys/param.h>
0062
0063
0064
0065
0066
0067
0068 typedef unsigned long __vki_fd_mask;
0069
0070 #undef __VKI_NFDBITS
0071 #define __VKI_NFDBITS (8 * sizeof(__vki_fd_mask))
0072
0073 #undef __VKI_FD_SETSIZE
0074 #define __VKI_FD_SETSIZE 1024U
0075
0076 #undef __VKI_FDSET_LONGS
0077 #define __VKI_FDSET_LONGS (__VKI_FD_SETSIZE/__VKI_NFDBITS)
0078
0079 #undef __VKI_FDELT
0080 #define __VKI_FDELT(d) ((d) / __VKI_NFDBITS)
0081
0082 #undef __VKI_FDMASK
0083 #define __VKI_FDMASK(d) (1UL << ((d) % __VKI_NFDBITS))
0084
0085 typedef struct {
0086 unsigned long fds_bits [__VKI_FDSET_LONGS];
0087 } __vki_fd_set;
0088
0089
0090
0091
0092
0093 typedef long __vki_key_t;
0094 typedef long __vki_suseconds_t;
0095 typedef struct __timer *__vki_timer_t;
0096 typedef struct __mq *__vki_mqd_t;
0097
0098
0099 typedef vki_uint32_t __vki_blksize_t;
0100 typedef vki_int64_t __vki_blkcnt_t;
0101 typedef vki_int32_t __vki_clockid_t;
0102 typedef vki_int32_t __vki_ct_rune_t;
0103 typedef vki_uint32_t __vki_fflags_t;
0104 typedef vki_uint64_t __vki_fsblkcnt_t;
0105 typedef vki_uint64_t __vki_fsfilcnt_t;
0106 typedef vki_uint32_t __vki_gid_t;
0107 typedef vki_int64_t __vki_id_t;
0108 typedef vki_uint32_t __vki_ino_t;
0109 typedef vki_int32_t __vki_lwpid_t;
0110 typedef vki_uint16_t __vki_mode_t;
0111 typedef vki_uint16_t __vki_nlink_t;
0112 typedef vki_int64_t __vki_off_t;
0113 typedef vki_int32_t __vki_pid_t;
0114 typedef vki_int64_t __vki_rlim_t;
0115 typedef vki_uint8_t __vki_sa_family_t;
0116 typedef vki_uint32_t __vki_socklen_t;
0117 typedef vki_uint32_t __vki_uid_t;
0118 typedef vki_int32_t __vki_useconds_t;
0119 typedef __vki_ct_rune_t __vki_rune_t;
0120 typedef __vki_ct_rune_t __vki_wchar_t;
0121 typedef __vki_ct_rune_t __vki_wint_t;
0122 typedef vki_uint32_t __vki_dev_t;
0123 typedef vki_uint32_t __vki_fixpt_t;
0124
0125
0126
0127
0128
0129
0130 typedef vki_uint8_t vki_u_int8_t;
0131 typedef vki_uint16_t vki_u_int16_t;
0132 typedef vki_uint32_t vki_u_int32_t;
0133 typedef vki_uint64_t vki_u_int64_t;
0134
0135 typedef vki_uint64_t vki_u_quad_t;
0136 typedef vki_int64_t vki_quad_t;
0137 typedef __vki_caddr_t vki_caddr_t;
0138 typedef __const __vki_caddr_t vki_c_caddr_t;
0139 typedef __volatile __vki_caddr_t vki_v_caddr_t;
0140
0141 typedef __vki_blksize_t vki_blksize_t;
0142 typedef __vki_blkcnt_t vki_blkcnt_t;
0143 typedef __vki_clock_t vki_clock_t;
0144 typedef __vki_clockid_t vki_clockid_t;
0145 typedef __vki_dev_t vki_dev_t;
0146 typedef __vki_fflags_t vki_fflags_t;
0147 typedef __vki_fixpt_t vki_fixpt_t;
0148 typedef __vki_fsblkcnt_t vki_fsblkcnt_t;
0149 typedef __vki_fsfilcnt_t vki_fsfilcnt_t;
0150 typedef __vki_gid_t vki_gid_t;
0151 typedef vki_uint32_t vki_in_addr_t;
0152 typedef vki_uint16_t vki_in_port_t;
0153 typedef __vki_id_t vki_id_t;
0154 typedef __vki_ino_t vki_ino_t;
0155 typedef __vki_key_t vki_key_t;
0156 typedef __vki_lwpid_t vki_lwpid_t;
0157 typedef __vki_mode_t vki_mode_t;
0158 typedef __vki_nlink_t vki_nlink_t;
0159 typedef __vki_off_t vki_off_t;
0160 typedef __vki_pid_t vki_pid_t;
0161 typedef __vki_register_t vki_register_t;
0162 typedef __vki_rlim_t vki_rlim_t;
0163 typedef __vki_segsz_t vki_segsz_t;
0164 typedef __vki_size_t vki_size_t;
0165 typedef __vki_ssize_t vki_ssize_t;
0166 typedef __vki_suseconds_t vki_suseconds_t;
0167 typedef __vki_time_t vki_time_t;
0168 typedef __vki_timer_t vki_timer_t;
0169 typedef __vki_mqd_t vki_mqd_t;
0170 typedef __vki_u_register_t vki_u_register_t;
0171 typedef __vki_uid_t vki_uid_t;
0172 typedef __vki_useconds_t vki_useconds_t;
0173 typedef int vki_cpuwhich_t;
0174 typedef int vki_cpulevel_t;
0175 typedef int vki_cpusetid_t;
0176
0177
0178 typedef __vki_vm_offset_t vki_vm_offset_t;
0179 typedef __vki_vm_ooffset_t vki_vm_ooffset_t;
0180 typedef __vki_vm_paddr_t vki_vm_paddr_t;
0181 typedef __vki_vm_pindex_t vki_vm_pindex_t;
0182 typedef __vki_vm_size_t vki_vm_size_t;
0183
0184
0185
0186
0187
0188 typedef __vki_fd_set vki_fd_set;
0189
0190
0191
0192
0193
0194 #if defined(VGA_x86)
0195 # include "vki-x86-freebsd.h"
0196 #elif defined(VGA_amd64)
0197 # include "vki-amd64-freebsd.h"
0198 #else
0199 # error Unknown platform
0200 #endif
0201
0202
0203
0204
0205 #ifndef ELFMAG
0206 #define ELFMAG "\177ELF"
0207 #endif
0208 #ifndef SELFMAG
0209 #define SELFMAG 4
0210 #endif
0211
0212
0213 #if !defined(ELF_NOTE_GNU)
0214 #define ELF_NOTE_GNU "GNU"
0215 #endif
0216
0217
0218 #define VKI_ELF_NOTE_ROUNDSIZE 4
0219
0220
0221
0222
0223
0224
0225 #define VKI_PATH_MAX 1024
0226
0227
0228
0229
0230
0231
0232 struct vki_timespec {
0233 vki_time_t tv_sec;
0234 long tv_nsec;
0235 };
0236
0237 struct vki_itimerspec {
0238 struct vki_timespec it_interval;
0239 struct vki_timespec it_value;
0240 };
0241
0242
0243
0244
0245
0246 struct vki_timeval {
0247 vki_time_t tv_sec;
0248 vki_suseconds_t tv_usec;
0249 };
0250
0251
0252
0253
0254
0255 #define VKI_CLOCK_REALTIME 0
0256 #define VKI_CLOCK_MONOTONIC 1
0257 #define VKI_CLOCK_PROCESS_CPUTIME_ID 2
0258 #define VKI_CLOCK_THREAD_CPUTIME_ID 3
0259
0260 struct vki_timezone {
0261 int tz_minuteswest;
0262 int tz_dsttime;
0263 };
0264
0265 struct vki_itimerval {
0266 struct vki_timeval it_interval;
0267 struct vki_timeval it_value;
0268 };
0269
0270
0271
0272
0273
0274 struct vki_ntptimeval {
0275 struct vki_timespec time;
0276 long maxerror;
0277 long esterror;
0278 long tai;
0279 int time_state;
0280 };
0281
0282 struct vki_timex {
0283 unsigned int modes;
0284 long offset;
0285 long freq;
0286 long maxerror;
0287 long esterror;
0288 int status;
0289 long constant;
0290 long precision;
0291 long tolerance;
0292
0293
0294 long ppsfreq;
0295 long jitter;
0296 int shift;
0297 long stabil;
0298 long jitcnt;
0299 long calcnt;
0300 long errcnt;
0301 long stbcnt;
0302 };
0303
0304 #define MOD_OFFSET 0x0001
0305 #define MOD_FREQUENCY 0x0002
0306 #define MOD_MAXERROR 0x0004
0307 #define MOD_ESTERROR 0x0008
0308 #define MOD_STATUS 0x0010
0309 #define MOD_TIMECONST 0x0020
0310 #define MOD_PPSMAX 0x0040
0311 #define MOD_TAI 0x0080
0312 #define MOD_MICRO 0x1000
0313 #define MOD_NANO 0x2000
0314 #define MOD_CLKB 0x4000
0315 #define MOD_CLKA 0x8000
0316
0317
0318
0319
0320
0321 struct vki_tms {
0322 vki_clock_t tms_utime;
0323 vki_clock_t tms_stime;
0324 vki_clock_t tms_cutime;
0325 vki_clock_t tms_cstime;
0326 };
0327
0328
0329
0330
0331
0332
0333 struct vki_freebsd11_stat {
0334 vki_dev_t st_dev;
0335 vki_ino_t st_ino;
0336 vki_mode_t st_mode;
0337 vki_nlink_t st_nlink;
0338 vki_uid_t st_uid;
0339 vki_gid_t st_gid;
0340 vki_dev_t st_rdev;
0341 #if 0
0342 struct vki_timespec st_atimespec;
0343 struct vki_timespec st_mtimespec;
0344 struct vki_timespec st_ctimespec;
0345 #else
0346 vki_time_t st_atime;
0347 long st_atime_nsec;
0348 vki_time_t st_mtime;
0349 long st_mtime_nsec;
0350 vki_time_t st_ctime;
0351 long st_ctime_nsec;
0352 #endif
0353 vki_off_t st_size;
0354 vki_blkcnt_t st_blocks;
0355 vki_blksize_t st_blksize;
0356 vki_fflags_t st_flags;
0357 vki_uint32_t st_gen;
0358 vki_int32_t st_lspare;
0359 struct vki_timespec st_birthtimespec;
0360 unsigned int :
0361 (8 / 2) * (16 - (int)sizeof(struct vki_timespec));
0362 unsigned int :
0363 (8 / 2) * (16 - (int)sizeof(struct vki_timespec));
0364 };
0365
0366 #if defined(VGP_x86_freebsd)
0367 #define VKI_STAT_TIME_T_EXT 1
0368 #endif
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378 struct vki_stat {
0379
0380 vki_uint64_t st_dev;
0381
0382 vki_uint64_t st_ino;
0383
0384 vki_uint64_t st_nlink;
0385 vki_mode_t st_mode;
0386 vki_int16_t st_padding0;
0387 vki_uid_t st_uid;
0388 vki_gid_t st_gid;
0389 vki_int32_t st_padding1;
0390
0391 vki_uint64_t st_rdev;
0392 #ifdef VKI_STAT_TIME_T_EXT
0393 vki_int32_t st_atim_ext;
0394 #endif
0395
0396 vki_time_t st_atime;
0397 long st_atime_nsec;
0398 #ifdef VKI_STAT_TIME_T_EXT
0399 vki_int32_t st_mtim_ext;
0400 #endif
0401
0402 vki_time_t st_mtime;
0403 long st_mtime_nsec;
0404 #ifdef VKI_STAT_TIME_T_EXT
0405 vki_int32_t st_ctim_ext;
0406 #endif
0407
0408 vki_time_t st_ctime;
0409 long st_ctime_nsec;
0410 #ifdef VKI_STAT_TIME_T_EXT
0411 vki_int32_t st_btim_ext;
0412 #endif
0413
0414 vki_time_t st_btime;
0415 long st_btime_nsec;
0416 vki_off_t st_size;
0417 vki_blkcnt_t st_blocks;
0418 vki_blksize_t st_blksize;
0419 vki_fflags_t st_flags;
0420 vki_uint64_t st_gen;
0421 vki_uint64_t st_spare[10];
0422 };
0423
0424
0425
0426
0427
0428
0429
0430 struct vki_sched_param {
0431 int sched_priority;
0432 };
0433
0434
0435
0436
0437
0438 #define VKI_SIG_BLOCK 1
0439 #define VKI_SIG_UNBLOCK 2
0440 #define VKI_SIG_SETMASK 3
0441
0442 #define VKI_SIG_DFL ((__vki_sighandler_t)0)
0443 #define VKI_SIG_IGN ((__vki_sighandler_t)1)
0444 #define VKI_SIG_ERR ((__vki_sighandler_t)-1)
0445
0446 typedef void __vki_signalfn_t(int);
0447 typedef __vki_signalfn_t *__vki_sighandler_t;
0448
0449 #define VKI_SIGHUP 1
0450 #define VKI_SIGINT 2
0451 #define VKI_SIGQUIT 3
0452 #define VKI_SIGILL 4
0453 #define VKI_SIGTRAP 5
0454 #define VKI_SIGABRT 6
0455 #define VKI_SIGEMT 7
0456 #define VKI_SIGFPE 8
0457 #define VKI_SIGKILL 9
0458 #define VKI_SIGBUS 10
0459 #define VKI_SIGSEGV 11
0460 #define VKI_SIGSYS 12
0461 #define VKI_SIGPIPE 13
0462 #define VKI_SIGALRM 14
0463 #define VKI_SIGTERM 15
0464 #define VKI_SIGURG 16
0465 #define VKI_SIGSTOP 17
0466 #define VKI_SIGTSTP 18
0467 #define VKI_SIGCONT 19
0468 #define VKI_SIGCHLD 20
0469 #define VKI_SIGTTIN 21
0470 #define VKI_SIGTTOU 22
0471 #define VKI_SIGIO 23
0472 #define VKI_SIGXCPU 24
0473 #define VKI_SIGXFSZ 25
0474 #define VKI_SIGVTALRM 26
0475 #define VKI_SIGPROF 27
0476 #define VKI_SIGWINCH 28
0477 #define VKI_SIGINFO 29
0478 #define VKI_SIGUSR1 30
0479 #define VKI_SIGUSR2 31
0480 #define VKI_SIGTHR 32
0481 #define VKI_SIGLIBRT 33
0482
0483 #define VKI_SIGRTMIN 65
0484 #define VKI_SIGRTMAX 126
0485
0486 #define VKI_SA_ONSTACK 0x0001
0487 #define VKI_SA_RESTART 0x0002
0488 #define VKI_SA_RESETHAND 0x0004
0489 #define VKI_SA_NOCLDSTOP 0x0008
0490 #define VKI_SA_NODEFER 0x0010
0491 #define VKI_SA_NOCLDWAIT 0x0020
0492 #define VKI_SA_SIGINFO 0x0040
0493 #define VKI_SA_RESTORER 0
0494
0495 #define VKI_SS_ONSTACK 0x0001
0496 #define VKI_SS_DISABLE 0x0004
0497
0498 #define VKI_SA_ONESHOT VKI_SA_RESETHAND
0499 #define VKI_SA_NOMASK VKI_SA_NODEFER
0500
0501 struct vki_sigaction {
0502 __vki_sighandler_t ksa_handler;
0503 int sa_flags;
0504 vki_sigset_t sa_mask;
0505 };
0506
0507 typedef struct vki_sigaltstack {
0508 void *ss_sp;
0509 vki_size_t ss_size;
0510 int ss_flags;
0511 } vki_stack_t;
0512
0513 typedef union vki_sigval {
0514 int sival_int;
0515 void *sival_ptr;
0516 } vki_sigval_t;
0517
0518 typedef struct vki_siginfo {
0519 int si_signo;
0520 int si_errno;
0521 int si_code;
0522 vki_pid_t si_pid;
0523 vki_uid_t si_uid;
0524 int si_status;
0525 void *si_addr;
0526 vki_sigval_t si_value;
0527
0528 #ifdef si_band
0529 #undef si_band
0530 #endif
0531 long si_band;
0532 int __spare__[7];
0533 } vki_siginfo_t;
0534
0535
0536
0537
0538 #define VKI_SI_USER 0x10001
0539 #define VKI_SI_QUEUE 0x10002
0540 #define VKI_SI_TIMER 0x10003
0541 #define VKI_SI_ASYNCIO 0x10004
0542 #define VKI_SI_MESGQ 0x10005
0543 #define VKI_SI_KERNEL 0x10006
0544 #define VKI_SI_LWP 0x10007
0545
0546
0547
0548 #define VKI_ILL_ILLOPC 1
0549 #define VKI_ILL_ILLOPN 2
0550 #define VKI_ILL_ILLADR 3
0551 #define VKI_ILL_ILLTRP 4
0552 #define VKI_ILL_PRVOPC 5
0553 #define VKI_ILL_PRVREG 6
0554 #define VKI_ILL_COPROC 7
0555 #define VKI_ILL_BADSTK 8
0556
0557
0558
0559
0560 #define VKI_FPE_INTOVF 1
0561 #define VKI_FPE_INTDIV 2
0562 #define VKI_FPE_FLTDIV 3
0563 #define VKI_FPE_FLTOVF 4
0564 #define VKI_FPE_FLTUND 5
0565 #define VKI_FPE_FLTRES 6
0566 #define VKI_FPE_FLTINV 7
0567 #define VKI_FPE_FLTSUB 8
0568
0569
0570
0571
0572 #define VKI_SEGV_MAPERR 1
0573 #define VKI_SEGV_ACCERR 2
0574
0575 #define VKI_SEGV_PAGE_FAULT 12
0576
0577
0578
0579
0580 #define VKI_BUS_ADRALN 1
0581 #define VKI_BUS_ADRERR 2
0582 #define VKI_BUS_OBJERR 3
0583 #define VKI_BUS_OOMERR 100
0584
0585
0586
0587
0588 #define VKI_TRAP_BRKPT 1
0589 #define VKI_TRAP_TRACE 2
0590 #define VKI_TRAP_DTRACE 3
0591 #define VKI_TRAP_CAP 4
0592
0593
0594
0595
0596 #define VKI_CLD_EXITED 1
0597 #define VKI_CLD_KILLED 2
0598 #define VKI_CLD_DUMPED 3
0599 #define VKI_CLD_TRAPPED 4
0600 #define VKI_CLD_STOPPED 5
0601 #define VKI_CLD_CONTINUED 6
0602
0603 #if 0
0604 typedef struct vki_sigevent {
0605 int sigev_notify;
0606 int sigev_signo;
0607 vki_sigval_t sigev_value;
0608 union {
0609 int _threadid;
0610
0611 struct {
0612 void (*_function)(vki_sigval_t);
0613 void *_attribute;
0614 } _sigev_thread;
0615 long __spare__[8];
0616 } _sigev_un;
0617 } vki_sigevent_t;
0618 #endif
0619
0620 struct vki_sigevent {
0621 int sigev_notify;
0622 union {
0623 int __sigev_signo;
0624 int __sigev_notify_kqueue;
0625 } __sigev_u;
0626 vki_sigval_t sigev_value;
0627 };
0628 #if 0
0629 #define sigev_signo __sigev_u.__sigev_signo
0630 #define sigev_notify_kqueue __sigev_u.__sigev_notify_kqueue
0631 #endif
0632
0633
0634
0635
0636
0637 struct vki_iovec {
0638 void *iov_base;
0639 __vki_size_t iov_len;
0640 };
0641
0642
0643
0644
0645
0646 typedef __vki_sa_family_t vki_sa_family_t;
0647 typedef __vki_socklen_t vki_socklen_t;
0648
0649 struct vki_sockaddr {
0650 vki_uint8_t sa_len;
0651 vki_sa_family_t sa_family;
0652 char sa_data[14];
0653 };
0654
0655 struct vki_msghdr {
0656 void * msg_name;
0657 vki_socklen_t msg_namelen;
0658 struct vki_iovec * msg_iov;
0659 int msg_iovlen;
0660 void * msg_control;
0661 vki_socklen_t msg_controllen;
0662 int msg_flags;
0663 };
0664
0665 struct vki_cmsghdr {
0666 vki_socklen_t cmsg_len;
0667 int cmsg_level;
0668 int cmsg_type;
0669 };
0670
0671 #define __VKI_CMSG_NXTHDR(ctl, len, cmsg) __vki_cmsg_nxthdr((ctl),(len),(cmsg))
0672 #define VKI_CMSG_NXTHDR(mhdr, cmsg) vki_cmsg_nxthdr((mhdr), (cmsg))
0673
0674 #define VKI_CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
0675
0676 #define VKI_CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + VKI_CMSG_ALIGN(sizeof(struct vki_cmsghdr))))
0677
0678 #define __VKI_CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct vki_cmsghdr) ? \
0679 (struct vki_cmsghdr *)(ctl) : \
0680 (struct vki_cmsghdr *)NULL)
0681 #define VKI_CMSG_FIRSTHDR(msg) __VKI_CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
0682
0683
0684
0685 static __inline struct vki_cmsghdr * __vki_cmsg_nxthdr(void *__ctl, vki_socklen_t __size,
0686 struct vki_cmsghdr *__cmsg)
0687 {
0688 struct vki_cmsghdr * __ptr;
0689
0690 __ptr = (struct vki_cmsghdr*)(((unsigned char *) __cmsg) + VKI_CMSG_ALIGN(__cmsg->cmsg_len));
0691 if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
0692 return (struct vki_cmsghdr *)0;
0693
0694 return __ptr;
0695 }
0696
0697 static __inline struct vki_cmsghdr * vki_cmsg_nxthdr (struct vki_msghdr *__msg, struct vki_cmsghdr *__cmsg)
0698 {
0699 return __vki_cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
0700 }
0701
0702 #define VKI_SCM_RIGHTS 0x01
0703
0704 #define VKI_AF_UNIX 1
0705 #define VKI_AF_INET 2
0706 #define VKI_AF_INET6 28
0707
0708 #define VKI_MSG_NOSIGNAL 0x20000
0709
0710 #define VKI_SOL_SOCKET 0xffff
0711
0712 #define VKI_SO_TYPE 0x1008
0713
0714 #define VKI_SOCK_STREAM 1
0715
0716 #include <netinet/tcp.h>
0717
0718 #define VKI_TCP_NODELAY TCP_NODELAY
0719
0720 #include <netinet/in.h>
0721
0722 #define VKI_IPPROTO_TCP IPPROTO_TCP
0723
0724 struct vki_sf_hdtr {
0725 struct iovec *headers;
0726 int hdr_cnt;
0727 struct iovec *trailers;
0728 int trl_cnt;
0729 };
0730
0731
0732
0733
0734
0735
0736 struct vki_in_addr {
0737 vki_in_addr_t s_addr;
0738 };
0739
0740
0741 #define __VKI_SOCK_SIZE__ 16
0742 struct vki_sockaddr_in {
0743 vki_uint8_t sin_len;
0744 vki_sa_family_t sin_family;
0745 vki_in_port_t sin_port;
0746 struct vki_in_addr sin_addr;
0747 char sin_zero[8];
0748 };
0749
0750
0751
0752
0753
0754 struct vki_in6_addr {
0755 union {
0756 vki_uint8_t u6_addr8[16];
0757 vki_uint16_t u6_addr16[8];
0758 vki_uint32_t u6_addr32[4];
0759 } vki_in6_u;
0760 #define vki_s6_addr vki_in6_u.u6_addr8
0761 #define vki_s6_addr16 vki_in6_u.u6_addr16
0762 #define vki_s6_addr32 vki_in6_u.u6_addr32
0763 };
0764
0765 struct vki_sockaddr_in6 {
0766 vki_uint8_t sin6_len;
0767 vki_sa_family_t sin6_family;
0768 vki_uint16_t sin6_port;
0769 vki_uint32_t sin6_flowinfo;
0770 struct vki_in6_addr sin6_addr;
0771 vki_uint32_t sin6_scope_id;
0772 };
0773
0774
0775
0776
0777
0778 #define VKI_UNIX_PATH_MAX 104
0779
0780 struct vki_sockaddr_un {
0781 unsigned char sun_len;
0782 vki_sa_family_t sun_family;
0783 char sun_path[VKI_UNIX_PATH_MAX];
0784 };
0785
0786
0787
0788
0789
0790 struct vki___aiocb_private {
0791 long status;
0792 long error;
0793 void *kernelinfo;
0794 };
0795
0796 typedef struct vki_aiocb {
0797 int aio_fildes;
0798 vki_off_t aio_offset;
0799 volatile void *aio_buf;
0800 vki_size_t aio_nbytes;
0801 int __spare__[2];
0802 void *__spare2__;
0803 int aio_lio_opcode;
0804 int aio_reqprio;
0805 struct vki___aiocb_private _aiocb_private;
0806 struct vki_sigevent aio_sigevent;
0807 } aiocb_t;
0808
0809 #define VKI_LIO_NOP 0x0
0810 #define VKI_LIO_WRITE 0x1
0811 #define VKI_LIO_READ 0x2
0812
0813 #define VKI_LIO_NOWAIT 0x0
0814 #define VKI_LIO_WAIT 0x1
0815
0816
0817 #define VKI_LIO_NOWAIT 0x0
0818
0819
0820
0821
0822
0823 typedef struct vki_fsid {
0824 vki_int32_t val[2];
0825 } vki_fsid_t;
0826 #define VKI_OMFSNAMELEN 16
0827 #define VKI_OMNAMELEN (88 - 2 * sizeof(long))
0828 #define VKI_MFSNAMELEN 16
0829 #define VKI_FREEBSD11_MNAMELEN 88
0830
0831 struct vki_freebsd11_statfs {
0832 vki_uint32_t f_version;
0833 vki_uint32_t f_type;
0834 vki_uint64_t f_flags;
0835 vki_uint64_t f_bsize;
0836 vki_uint64_t f_iosize;
0837 vki_uint64_t f_blocks;
0838 vki_uint64_t f_bfree;
0839 vki_int64_t f_bavail;
0840 vki_uint64_t f_files;
0841 vki_int64_t f_ffree;
0842 vki_uint64_t f_syncwrites;
0843 vki_uint64_t f_asyncwrites;
0844 vki_uint64_t f_syncreads;
0845 vki_uint64_t f_asyncreads;
0846 vki_uint64_t f_spare[10];
0847 vki_uint32_t f_namemax;
0848 vki_uid_t f_owner;
0849 vki_fsid_t f_fsid;
0850 char f_charspare[80];
0851 char f_fstypename[VKI_OMFSNAMELEN];
0852 char f_mntfromname[VKI_FREEBSD11_MNAMELEN];
0853 char f_mntonname[VKI_FREEBSD11_MNAMELEN];
0854 };
0855
0856
0857 #define MAXFIDSZ 16
0858
0859 struct vki_fid {
0860 vki_uint16_t fid_len;
0861 vki_uint16_t fid_reserved;
0862 char fid_data[MAXFIDSZ];
0863 };
0864
0865 struct vki_fhandle {
0866 vki_fsid_t fh_fsid;
0867 struct vki_fid fh_fid;
0868 };
0869
0870
0871 #define VKI_MNAMELEN 1024
0872 struct vki_statfs {
0873 vki_uint32_t f_version;
0874 vki_uint32_t f_type;
0875 vki_uint64_t f_flags;
0876 vki_uint64_t f_bsize;
0877 vki_uint64_t f_iosize;
0878 vki_uint64_t f_blocks;
0879 vki_uint64_t f_bfree;
0880 vki_int64_t f_bavail;
0881 vki_uint64_t f_files;
0882 vki_int64_t f_ffree;
0883 vki_uint64_t f_syncwrites;
0884 vki_uint64_t f_asyncwrites;
0885 vki_uint64_t f_syncreads;
0886 vki_uint64_t f_asyncreads;
0887 vki_uint64_t f_spare[10];
0888 vki_uint32_t f_namemax;
0889 vki_uid_t f_owner;
0890 vki_fsid_t f_fsid;
0891 char f_charspare[80];
0892 char f_fstypename[VKI_MFSNAMELEN];
0893 char f_mntfromname[VKI_MNAMELEN];
0894 char f_mntonname[VKI_MNAMELEN];
0895 };
0896
0897 typedef struct vki_fhandle vki_fhandle_t;
0898
0899
0900
0901
0902
0903 struct vki_winsize {
0904 unsigned short ws_row;
0905 unsigned short ws_col;
0906 unsigned short ws_xpixel;
0907 unsigned short ws_ypixel;
0908 };
0909
0910
0911
0912
0913
0914
0915 typedef unsigned int vki_tcflag_t;
0916 typedef unsigned char vki_cc_t;
0917 typedef unsigned int vki_speed_t;
0918
0919 #define VKI_NCCS 20
0920 struct vki_termios {
0921 vki_tcflag_t c_iflag;
0922 vki_tcflag_t c_oflag;
0923 vki_tcflag_t c_cflag;
0924 vki_tcflag_t c_lflag;
0925 vki_cc_t c_cc[VKI_NCCS];
0926 vki_speed_t c_ispeed;
0927 vki_speed_t c_ospeed;
0928 };
0929
0930
0931
0932
0933
0934
0935
0936
0937
0938
0939
0940 #define _VKI_IOC_BASEBITS 16
0941 #define _VKI_IOC_NRBITS 8
0942 #define _VKI_IOC_TYPEBITS 8
0943
0944 #define _VKI_IOC_SIZEBITS 13
0945 #define _VKI_IOC_DIRBITS 3
0946
0947 #define _VKI_IOC_BASEMASK ((1ul << _VKI_IOC_BASEBITS)-1)
0948 #define _VKI_IOC_NRMASK ((1ul << _VKI_IOC_NRBITS)-1)
0949 #define _VKI_IOC_TYPEMASK ((1ul << _VKI_IOC_TYPEBITS)-1)
0950 #define _VKI_IOC_SIZEMASK ((1ul << _VKI_IOC_SIZEBITS)-1)
0951 #define _VKI_IOC_DIRMASK ((1ul << _VKI_IOC_DIRBITS)-1)
0952
0953 #define _VKI_IOC_BASESHIFT 0
0954 #define _VKI_IOC_NRSHIFT 0
0955 #define _VKI_IOC_TYPESHIFT (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
0956 #define _VKI_IOC_SIZESHIFT (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
0957 #define _VKI_IOC_DIRSHIFT (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
0958
0959 #define _VKI_IOC_NONE 1U
0960 #define _VKI_IOC_READ 2U
0961 #define _VKI_IOC_WRITE 4U
0962 #define _VKI_IOC_RDWR 6U
0963
0964 #define _VKI_IOC(dir,type,nr,size) \
0965 (((dir) << _VKI_IOC_DIRSHIFT) | \
0966 ((type) << _VKI_IOC_TYPESHIFT) | \
0967 ((nr) << _VKI_IOC_NRSHIFT) | \
0968 ((size) << _VKI_IOC_SIZESHIFT))
0969
0970
0971 extern unsigned int __vki_invalid_size_argument_for_IOC;
0972 #define _VKI_IOC_TYPECHECK(t) \
0973 ((sizeof(t) == sizeof(t[1]) && \
0974 sizeof(t) < (1 << _VKI_IOC_SIZEBITS)) ? \
0975 sizeof(t) : __vki_invalid_size_argument_for_IOC)
0976
0977
0978 #define _VKI_IO(type,nr) _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
0979 #define _VKI_IOR(type,nr,size) _VKI_IOC(_VKI_IOC_READ,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0980 #define _VKI_IOW(type,nr,size) _VKI_IOC(_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0981 #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0982
0983
0984 #define _VKI_IOC_DIR(nr) (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
0985 #define _VKI_IOC_TYPE(nr) (((nr) >> _VKI_IOC_TYPESHIFT) & _VKI_IOC_TYPEMASK)
0986 #define _VKI_IOC_NR(nr) (((nr) >> _VKI_IOC_NRSHIFT) & _VKI_IOC_NRMASK)
0987 #define _VKI_IOC_SIZE(nr) (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
0988 #define _VKI_IOC_BASE(nr) (((nr) >> _VKI_IOC_BASESHIFT) & _VKI_IOC_BASEMASK)
0989
0990
0991
0992
0993
0994 #define VKI_GRND_NONBLOCK 0x1
0995
0996
0997
0998
0999
1000 #if 0
1001 #define VKI_TCGETS 0x5401
1002 #define VKI_TCSETS 0x5402
1003 #define VKI_TCSETSW 0x5403
1004 #define VKI_TCSETSF 0x5404
1005 #define VKI_TCGETA 0x5405 y
1006 #define VKI_TCSETA 0x5406 y
1007 #define VKI_TCSETAW 0x5407 y
1008 #define VKI_TCSETAF 0x5408 y
1009 #define VKI_TCSBRK 0x5409
1010 #define VKI_TCXONC 0x540A
1011 #define VKI_TCFLSH 0x540B y
1012 #define VKI_TIOCSCTTY 0x540E
1013 #define VKI_TIOCGPGRP 0x540F y
1014 #define VKI_TIOCSPGRP 0x5410 y
1015 #define VKI_TIOCOUTQ 0x5411
1016 #define VKI_TIOCGWINSZ 0x5413 y
1017 #define VKI_TIOCSWINSZ 0x5414 y
1018 #define VKI_TIOCMGET 0x5415 y
1019 #define VKI_TIOCMBIS 0x5416 y
1020 #define VKI_TIOCMBIC 0x5417 y
1021 #define VKI_TIOCMSET 0x5418 y
1022 #define VKI_FIONREAD 0x541B
1023 #define VKI_TIOCLINUX 0x541C
1024 #define VKI_FIONBIO 0x5421
1025 #define VKI_TCSBRKP 0x5425
1026 #define VKI_TIOCGPTN _VKI_IOR('T',0x30, unsigned int)
1027 #define VKI_TIOCSPTLCK _VKI_IOW('T',0x31, int)
1028
1029 #define VKI_FIOASYNC 0x5452
1030 #define VKI_TIOCSERGETLSR 0x5459
1031
1032 #define VKI_TIOCGICOUNT 0x545D
1033 #endif
1034
1035 #define VKI_TIOCFLUSH _VKI_IOW('t', 16, int);
1036 #define VKI_TIOCGETA _VKI_IOR('t', 19, struct vki_termios)
1037 #define VKI_TIOCSETA _VKI_IOR('t', 20, struct vki_termios)
1038 #define VKI_TIOCSETAW _VKI_IOR('t', 21, struct vki_termios)
1039 #define VKI_TIOCSETAF _VKI_IOR('t', 22, struct vki_termios)
1040
1041 #define _VKI_TIOCPTMASTER _VKI_IO('t', 28)
1042
1043 #define VKI_TIOCSWINSZ _VKI_IOW('t', 103, struct vki_winsize)
1044 #define VKI_TIOCGWINSZ _VKI_IOR('t', 104, struct vki_winsize)
1045
1046 #define VKI_TIOCMGET _VKI_IOR('t', 106, int)
1047 #define VKI_TIOCMBIC _VKI_IOW('t', 107, int)
1048 #define VKI_TIOCMBIS _VKI_IOW('t', 108, int)
1049 #define VKI_TIOCMSET _VKI_IOW('t', 109, int)
1050 #define VKI_TIOCSTART _VKI_IO('t', 110)
1051 #define VKI_TIOCSTOP _VKI_IO('t', 111)
1052 #define VKI_TIOCPKT _VKI_IOW('t', 112, int)
1053
1054 #define VKI_TIOCSPGRP _VKI_IOW('t', 118, int)
1055 #define VKI_TIOCGPGRP _VKI_IOR('t', 119, int)
1056 #define VKI_TIOCCBRK _VKI_IO('t', 122)
1057 #define VKI_TIOCSBRK _VKI_IO('t', 123)
1058
1059
1060
1061
1062
1063
1064 #define VKI_FIOCLEX _VKI_IO('f', 1)
1065 #define VKI_FIONCLEX _VKI_IO('f', 2)
1066 #define VKI_FIONREAD _VKI_IOR('f', 127, int)
1067 #define VKI_FIONBIO _VKI_IOW('f', 126, int)
1068 #define VKI_FIOASYNC _VKI_IOW('f', 125, int)
1069 #define VKI_FIOSETOWN _VKI_IOW('f', 124, int)
1070 #define VKI_FIOGETOWN _VKI_IOW('f', 123, int)
1071
1072
1073 #if 0
1074
1075
1076
1077 #define VKI_IFNAMSIZ 16
1078
1079 struct vki_ifmediareq {
1080 char ifm_name[VKI_IFNAMSIZ];
1081 int ifm_current;
1082 int ifm_mask;
1083 int ifm_status;
1084 int ifm_active;
1085 int ifm_count;
1086 int *ifm_ulist;
1087 };
1088
1089
1090
1091
1092
1093 #define VKI_SIOCGIFMEDIA _VKI_IOWR('i', 56, struct vki_ifmediareq)
1094 #endif
1095
1096
1097
1098
1099
1100 #define VKI_POLLIN 0x0001
1101
1102 struct vki_pollfd {
1103 int fd;
1104 short events;
1105 short revents;
1106 };
1107
1108
1109
1110
1111 struct vki_kevent_freebsd11 {
1112 vki_uintptr_t ident;
1113 vki_int16_t filter;
1114 vki_uint16_t flags;
1115 vki_uint32_t fflags;
1116 vki_intptr_t data;
1117 void *udata;
1118 };
1119
1120 struct vki_kevent {
1121 vki_uintptr_t ident;
1122 vki_int16_t filter;
1123 vki_uint16_t flags;
1124 vki_uint32_t fflags;
1125 vki_int64_t data;
1126 void *udata;
1127 vki_uint64_t ext[4];
1128 };
1129
1130
1131
1132
1133
1134
1135
1136
1137 #define VKI_RUSAGE_SELF 0
1138 #define VKI_RUSAGE_CHILDREN -1
1139 #define VKI_RUSAGE_THREAD 1
1140
1141 struct vki_rusage {
1142 struct vki_timeval ru_utime;
1143 struct vki_timeval ru_stime;
1144 long ru_maxrss;
1145 long ru_ixrss;
1146 long ru_idrss;
1147 long ru_isrss;
1148 long ru_minflt;
1149 long ru_majflt;
1150 long ru_nswap;
1151 long ru_inblock;
1152 long ru_oublock;
1153 long ru_msgsnd;
1154 long ru_msgrcv;
1155 long ru_nsignals;
1156 long ru_nvcsw;
1157 long ru_nivcsw;
1158 };
1159
1160 struct vki_rlimit {
1161 vki_rlim_t rlim_cur;
1162 vki_rlim_t rlim_max;
1163 };
1164
1165 #define VKI_RLIMIT_DATA 2
1166 #define VKI_RLIMIT_STACK 3
1167 #define VKI_RLIMIT_CORE 4
1168 #define VKI_RLIMIT_NOFILE 8
1169
1170 struct vki___wrusage {
1171 struct vki_rusage wru_self;
1172 struct vki_rusage wru_children;
1173 };
1174
1175
1176
1177
1178
1179
1180 #define VKI_PRSTATUS_VERSION 1
1181 struct vki_elf_prstatus {
1182 int pr_version;
1183 vki_size_t pr_statussz;
1184 vki_size_t pr_gregsetsz;
1185 vki_size_t pr_fpregsetsz;
1186 int pr_osreldate;
1187 int pr_cursig;
1188 vki_pid_t pr_pid;
1189 vki_elf_gregset_t pr_reg;
1190 };
1191
1192 #define VKI_ELF_PRARGSZ (80)
1193 #define VKI_MAXCOMLEN (16)
1194
1195 #define VKI_PRPSINFO_VERSION 1
1196 struct vki_elf_prpsinfo {
1197 int pr_version;
1198 vki_size_t pr_psinfosz;
1199 char pr_fname[VKI_MAXCOMLEN+1];
1200 char pr_psargs[VKI_ELF_PRARGSZ];
1201 };
1202
1203
1204
1205
1206
1207 struct vki_mq_attr {
1208 long mq_flags;
1209 long mq_maxmsg;
1210 long mq_msgsize;
1211 long mq_curmsgs;
1212 };
1213
1214
1215
1216
1217
1218 #define VKI_UCF_SWAPPED 1
1219
1220 struct vki_ucontext {
1221 vki_sigset_t uc_sigmask;
1222 struct vki_mcontext uc_mcontext;
1223 struct vki_ucontext *uc_link;
1224 vki_stack_t uc_stack;
1225 int uc_flags;
1226 unsigned int __spare__[4];
1227 };
1228
1229
1230
1231
1232
1233 #define VKI_SYS_NMLN 32
1234
1235 struct vki_utsname {
1236 char sysname[VKI_SYS_NMLN];
1237 char nodename[VKI_SYS_NMLN];
1238 char release[VKI_SYS_NMLN];
1239 char version[VKI_SYS_NMLN];
1240 char machine[VKI_SYS_NMLN];
1241 };
1242
1243 #define VKI_IPC_CREAT 00001000
1244 #define VKI_IPC_EXCL 00002000
1245 #define VKI_IPC_NOWAIT 00004000
1246
1247 #define VKI_IPC_RMID 0
1248 #define VKI_IPC_SET 1
1249 #define VKI_IPC_STAT 2
1250 #define VKI_IPC_INFO 3
1251
1252
1253
1254
1255
1256 struct vki_ipc_perm_old {
1257 unsigned short cuid;
1258 unsigned short cgid;
1259 unsigned short uid;
1260 unsigned short gid;
1261 unsigned short mode;
1262 unsigned short seq;
1263 vki_key_t key;
1264 };
1265
1266 struct vki_ipc_perm {
1267 vki_uid_t cuid;
1268 vki_gid_t cgid;
1269 vki_uid_t uid;
1270 vki_gid_t gid;
1271 vki_mode_t mode;
1272 unsigned short seq;
1273 vki_key_t key;
1274 };
1275
1276
1277
1278
1279
1280 #define VKI_GETALL 6
1281 #define VKI_SETVAL 8
1282 #define VKI_SETALL 9
1283 #define VKI_SEM_STAT 10
1284 #define VKI_SEM_INFO 11
1285
1286 struct vki_semid_ds_old {
1287 struct vki_ipc_perm_old sem_perm;
1288 struct sem *__sem_base;
1289 unsigned short sem_nsems;
1290 vki_time_t sem_otime;
1291 long sem_pad1;
1292 vki_time_t sem_ctime;
1293 long sem_pad2;
1294 long sem_pad3[4];
1295 };
1296
1297
1298
1299 struct vki_semid_ds {
1300 struct vki_ipc_perm sem_perm;
1301
1302 void*sem_base;
1303 unsigned short sem_nsems;
1304 vki_time_t sem_otime;
1305 vki_time_t sem_ctime;
1306 long sem_pad2;
1307 long sem_pad3[4];
1308 };
1309
1310 struct vki_sembuf {
1311 vki_uint16_t sem_num;
1312 vki_int16_t sem_op;
1313 vki_int16_t sem_flg;
1314 };
1315
1316 union vki_semun {
1317 int val;
1318 struct vki_semid_ds *buf;
1319 vki_uint16_t *array;
1320 };
1321
1322
1323
1324
1325
1326
1327 #define VKI_ERESTART -1
1328 #define VKI_EPERM 1
1329 #define VKI_ENOENT 2
1330 #define VKI_ESRCH 3
1331 #define VKI_EINTR 4
1332 #define VKI_EIO 5
1333 #define VKI_ENXIO 6
1334 #define VKI_E2BIG 7
1335 #define VKI_ENOEXEC 8
1336 #define VKI_EBADF 9
1337 #define VKI_ECHILD 10
1338 #define VKI_EDEADLK 11
1339 #define VKI_ENOMEM 12
1340 #define VKI_EACCES 13
1341 #define VKI_EFAULT 14
1342 #define VKI_ENOTBLK 15
1343 #define VKI_EBUSY 16
1344 #define VKI_EEXIST 17
1345 #define VKI_EXDEV 18
1346 #define VKI_ENODEV 19
1347 #define VKI_ENOTDIR 20
1348 #define VKI_EISDIR 21
1349 #define VKI_EINVAL 22
1350 #define VKI_ENFILE 23
1351 #define VKI_EMFILE 24
1352 #define VKI_ENOTTY 25
1353 #define VKI_ETXTBSY 26
1354 #define VKI_EFBIG 27
1355 #define VKI_ENOSPC 28
1356 #define VKI_ESPIPE 29
1357 #define VKI_EROFS 30
1358 #define VKI_EMLINK 31
1359 #define VKI_EPIPE 32
1360 #define VKI_EDOM 33
1361 #define VKI_ERANGE 34
1362 #define VKI_EAGAIN 35
1363 #define VKI_EWOULDBLOCK VKI_EAGAIN
1364 #define VKI_EINPROGRESS 36
1365 #define VKI_EALREADY 37
1366 #define VKI_ENOTSOCK 38
1367 #define VKI_EDESTADDRREQ 39
1368 #define VKI_EMSGSIZE 40
1369 #define VKI_EPROTOTYPE 41
1370 #define VKI_ENOPROTOOPT 42
1371 #define VKI_EPROTONOSUPPORT 43
1372 #define VKI_ESOCKTNOSUPPORT 44
1373 #define VKI_EOPNOTSUPP 45
1374 #define VKI_ENOTSUP VKI_EOPNOTSUPP
1375 #define VKI_EPFNOSUPPORT 46
1376 #define VKI_EAFNOSUPPORT 47
1377 #define VKI_EADDRINUSE 48
1378 #define VKI_EADDRNOTAVAIL 49
1379 #define VKI_ENETDOWN 50
1380 #define VKI_ENETUNREACH 51
1381 #define VKI_ENETRESET 52
1382 #define VKI_ECONNABORTED 53
1383 #define VKI_ECONNRESET 54
1384 #define VKI_ENOBUFS 55
1385 #define VKI_EISCONN 56
1386 #define VKI_ENOTCONN 57
1387 #define VKI_ESHUTDOWN 58
1388 #define VKI_ETOOMANYREFS 59
1389 #define VKI_ETIMEDOUT 60
1390 #define VKI_ECONNREFUSED 61
1391 #define VKI_ELOOP 62
1392 #define VKI_ENAMETOOLONG 63
1393 #define VKI_EHOSTDOWN 64
1394 #define VKI_EHOSTUNREACH 65
1395 #define VKI_ENOTEMPTY 66
1396 #define VKI_EPROCLIM 67
1397 #define VKI_EUSERS 68
1398 #define VKI_EDQUOT 69
1399 #define VKI_ESTALE 70
1400 #define VKI_EREMOTE 71
1401 #define VKI_EBADRPC 72
1402 #define VKI_ERPCMISMATCH 73
1403 #define VKI_EPROGUNAVAIL 74
1404 #define VKI_EPROGMISMATCH 75
1405 #define VKI_EPROCUNAVAIL 76
1406 #define VKI_ENOLCK 77
1407 #define VKI_ENOSYS 78
1408 #define VKI_EFTYPE 79
1409 #define VKI_EAUTH 80
1410 #define VKI_ENEEDAUTH 81
1411 #define VKI_EIDRM 82
1412 #define VKI_ENOMSG 83
1413 #define VKI_EOVERFLOW 84
1414 #define VKI_ECANCELED 85
1415 #define VKI_EILSEQ 86
1416 #define VKI_ENOATTR 87
1417 #define VKI_EDOOFUS 88
1418 #define VKI_EBADMSG 89
1419 #define VKI_EMULTIHOP 90
1420 #define VKI_ENOLINK 91
1421 #define VKI_EPROTO 92
1422 #define VKI_ENOTCAPABLE 93
1423 #define VKI_ECAPMODE 94
1424
1425
1426
1427
1428
1429 #define VKI_WNOHANG 0x00000001
1430
1431 typedef enum vki_idtype {
1432 VKI_P_PID,
1433 VKI_P_PPID,
1434 VKI_P_PGID,
1435 VKI_P_SID,
1436 VKI_P_CID,
1437 VKI_P_UID,
1438 VKI_P_GID,
1439 VKI_P_ALL,
1440 VKI_P_LWPID,
1441 VKI_P_TASKID,
1442 VKI_P_PROJID,
1443 VLI_P_POOLID,
1444 VKI_P_JAILID,
1445 VKI_P_CTID,
1446 VKI_P_CPUID,
1447 VKI_P_PSETID
1448 } vki_idtype_t;
1449
1450
1451
1452
1453
1454 #define VKI_PROT_NONE 0x00
1455 #define VKI_PROT_READ 0x01
1456 #define VKI_PROT_WRITE 0x02
1457 #define VKI_PROT_EXEC 0x04
1458
1459 #define VKI_MAP_SHARED 0x01
1460 #define VKI_MAP_PRIVATE 0x02
1461 #define VKI_MAP_FIXED 0x10
1462 #define VKI_MAP_NORESERVE 0x0040
1463 #define VKI_MAP_STACK 0x400
1464 #define VKI_MAP_ANON 0x1000
1465 #define VKI_MAP_ANONYMOUS VKI_MAP_ANON
1466
1467
1468
1469
1470
1471 #define VKI_S_IFMT 00170000
1472
1473 #define VKI_S_IFWHT 0160000
1474 #define VKI_S_IFSOCK 0140000
1475 #define VKI_S_IFLNK 0120000
1476 #define VKI_S_IFREG 0100000
1477 #define VKI_S_IFBLK 0060000
1478 #define VKI_S_IFDIR 0040000
1479 #define VKI_S_IFCHR 0020000
1480 #define VKI_S_IFIFO 0010000
1481 #define VKI_S_ISUID 0004000
1482 #define VKI_S_ISGID 0002000
1483 #define VKI_S_ISTXT 0001000
1484
1485 #define VKI_S_ISLNK(m) (((m) & VKI_S_IFMT) == VKI_S_IFLNK)
1486 #define VKI_S_ISREG(m) (((m) & VKI_S_IFMT) == VKI_S_IFREG)
1487 #define VKI_S_ISDIR(m) (((m) & VKI_S_IFMT) == VKI_S_IFDIR)
1488 #define VKI_S_ISCHR(m) (((m) & VKI_S_IFMT) == VKI_S_IFCHR)
1489 #define VKI_S_ISBLK(m) (((m) & VKI_S_IFMT) == VKI_S_IFBLK)
1490 #define VKI_S_ISFIFO(m) (((m) & VKI_S_IFMT) == VKI_S_IFIFO)
1491 #define VKI_S_ISSOCK(m) (((m) & VKI_S_IFMT) == VKI_S_IFSOCK)
1492 #define VKI_S_ISWHT(m) (((m) & VKI_S_IFMT) == VKI_S_IFWHT)
1493
1494 #define VKI_S_IRWXU 00700
1495 #define VKI_S_IRUSR 00400
1496 #define VKI_S_IWUSR 00200
1497 #define VKI_S_IXUSR 00100
1498
1499 #define VKI_S_IRWXG 00070
1500 #define VKI_S_IRGRP 00040
1501 #define VKI_S_IWGRP 00020
1502 #define VKI_S_IXGRP 00010
1503
1504 #define VKI_S_IRWXO 00007
1505 #define VKI_S_IROTH 00004
1506 #define VKI_S_IWOTH 00002
1507 #define VKI_S_IXOTH 00001
1508
1509
1510
1511
1512
1513
1514 struct vki_dirent {
1515 vki_uint32_t d_fileno;
1516 vki_uint16_t d_reclen;
1517 vki_uint8_t d_type;
1518 vki_uint8_t d_namelen;
1519 char vki_d_name[256];
1520 };
1521
1522
1523
1524
1525
1526 #define VKI_O_RDONLY O_RDONLY
1527 #define VKI_O_WRONLY O_WRONLY
1528 #define VKI_O_RDWR O_RDWR
1529
1530 #define VKI_FREAD FREAD
1531 #define VKI_WRITE WRITE
1532
1533 #define VKI_O_NONBLOCK O_NONBLOCK
1534 #define VKI_O_APPEND O_APPEND
1535 #define VKI_O_CREAT O_CREAT
1536 #define VKI_O_TRUNC O_TRUNC
1537 #define VKI_O_EXCL O_EXCL
1538 #define VKI_O_DIRECTORY O_DIRECTORY
1539 #define VKI_O_EXEC O_EXEC
1540 #define VKI_O_SEARCH O_EXEC
1541
1542 #define VKI_AT_FDCWD AT_FDCWD
1543
1544 #define VKI_F_DUPFD 0
1545 #define VKI_F_GETFD 1
1546 #define VKI_F_SETFD 2
1547 #define VKI_F_GETFL 3
1548 #define VKI_F_SETFL 4
1549 #define VKI_F_SETOWN 5
1550 #define VKI_F_GETOWN 6
1551 #define VKI_F_OGETLK 7
1552 #define VKI_F_OSETLK 8
1553 #define VKI_F_OSETLKW 9
1554 #define VKI_F_DUP2FD 10
1555 #define VKI_F_GETLK 11
1556 #define VKI_F_SETLK 12
1557 #define VKI_F_SETLKW 13
1558 #define VKI_F_SETLK_REMOTE 14
1559 #define VKI_F_READAHEAD 15
1560 #define VKI_F_RDAHEAD 16
1561 #define VKI_F_DUPFD_CLOEXEC 17
1562 #define VKI_F_DUP2FD_CLOEXEC 18
1563 #define VKI_F_ADD_SEALS 19
1564 #define VKI_F_GET_SEALS 20
1565 #define VKI_F_ISUNIONSTACK 21
1566
1567 #define VKI_F_KINFO 22
1568
1569
1570 #define VKI_FD_CLOEXEC 1
1571
1572
1573 #define VKI_F_SEAL_SEAL 0x0001
1574 #define VKI_F_SEAL_SHRINK 0x0002
1575 #define VKI_F_SEAL_GROW 0x0004
1576 #define VKI_F_SEAL_WRITE 0x0008
1577
1578
1579
1580
1581
1582 #define VKI_SEEK_SET 0
1583 #define VKI_SEEK_CUR 1
1584 #define VKI_SEEK_END 2
1585
1586 #define VKI_F_OK 0
1587 #define VKI_X_OK 0x01
1588 #define VKI_W_OK 0x02
1589 #define VKI_R_OK 0x04
1590
1591
1592
1593
1594
1595 #if 0
1596 #define VKI_MSGSND 11
1597 #define VKI_MSGRCV 12
1598 #define VKI_MSGGET 13
1599 #define VKI_MSGCTL 14
1600 #endif
1601
1602 typedef unsigned long vki_msglen_t;
1603 typedef unsigned long vki_msgqnum_t;
1604
1605 struct vki_msqid_ds_old {
1606 struct vki_ipc_perm_old msg_perm;
1607 struct vki_msg *msg_first;
1608 struct vki_msg *msg_last;
1609 vki_msglen_t msg_cbytes;
1610 vki_msgqnum_t msg_qnum;
1611 vki_msglen_t msg_qbytes;
1612 vki_pid_t msg_lspid;
1613 vki_pid_t msg_lrpid;
1614 vki_time_t msg_stime;
1615 vki_uint32_t msg_pad1;
1616 vki_time_t msg_rtime;
1617 vki_uint32_t msg_pad2;
1618 vki_time_t msg_ctime;
1619 vki_uint32_t msg_pad3;
1620 vki_uint32_t msg_pad4[4];
1621 };
1622
1623 struct vki_msqid_ds {
1624 struct vki_ipc_perm msg_perm;
1625 struct vki_msg *msg_first;
1626 struct vki_msg *msg_last;
1627 vki_msglen_t msg_cbytes;
1628 vki_msgqnum_t msg_qnum;
1629 vki_msglen_t msg_qbytes;
1630 vki_pid_t msg_lspid;
1631 vki_pid_t msg_lrpid;
1632 vki_time_t msg_stime;
1633 vki_time_t msg_rtime;
1634 vki_time_t msg_ctime;
1635 };
1636
1637
1638 struct vki_msgbuf {
1639 long mtype;
1640 char mtext[1];
1641 };
1642
1643
1644
1645
1646
1647
1648 struct vki_shmid_ds_old {
1649 struct vki_ipc_perm_old shm_perm;
1650 int shm_segsz;
1651 vki_pid_t shm_lpid;
1652 vki_pid_t shm_cpid;
1653 short shm_nattch;
1654 vki_time_t shm_atime;
1655 vki_time_t shm_dtime;
1656 vki_time_t shm_ctime;
1657 void *shm_internal;
1658 };
1659
1660
1661 struct vki_shmid_ds {
1662 struct vki_ipc_perm shm_perm;
1663 vki_size_t shm_segsz;
1664 vki_pid_t shm_lpid;
1665 vki_pid_t shm_cpid;
1666 int shm_nattch;
1667 vki_time_t shm_atime;
1668 vki_time_t shm_dtime;
1669 vki_time_t shm_ctime;
1670 };
1671
1672 #define VKI_SHMLBA VKI_PAGE_SIZE
1673 #define VKI_SHM_RDONLY 010000
1674 #define VKI_SHM_ANON (1UL)
1675
1676 #if 0
1677 #define VKI_SHMAT 21
1678 #define VKI_SHMDT 22
1679 #define VKI_SHMGET 23
1680 #define VKI_SHMCTL 24
1681 #endif
1682
1683 #if 0
1684
1685
1686
1687
1688 #define VKI_SIOCOUTQ VKI_TIOCOUTQ
1689
1690 #define VKI_SIOCADDRT 0x890B
1691 #define VKI_SIOCDELRT 0x890C
1692
1693 #define VKI_SIOCGIFNAME 0x8910
1694 #define VKI_SIOCGIFCONF 0x8912
1695 #define VKI_SIOCGIFFLAGS 0x8913
1696 #define VKI_SIOCSIFFLAGS 0x8914
1697 #define VKI_SIOCGIFADDR 0x8915
1698 #define VKI_SIOCSIFADDR 0x8916
1699 #define VKI_SIOCGIFDSTADDR 0x8917
1700 #define VKI_SIOCSIFDSTADDR 0x8918
1701 #define VKI_SIOCGIFBRDADDR 0x8919
1702 #define VKI_SIOCSIFBRDADDR 0x891a
1703 #define VKI_SIOCGIFNETMASK 0x891b
1704 #define VKI_SIOCSIFNETMASK 0x891c
1705 #define VKI_SIOCGIFMETRIC 0x891d
1706 #define VKI_SIOCSIFMETRIC 0x891e
1707 #define VKI_SIOCGIFMTU 0x8921
1708 #define VKI_SIOCSIFMTU 0x8922
1709 #define VKI_SIOCSIFHWADDR 0x8924
1710 #define VKI_SIOCGIFHWADDR 0x8927
1711 #define VKI_SIOCGIFINDEX 0x8933
1712
1713 #define VKI_SIOCGIFTXQLEN 0x8942
1714 #define VKI_SIOCSIFTXQLEN 0x8943
1715
1716 #define VKI_SIOCGMIIPHY 0x8947
1717 #define VKI_SIOCGMIIREG 0x8948
1718 #define VKI_SIOCSMIIREG 0x8949
1719
1720 #define VKI_SIOCDARP 0x8953
1721 #define VKI_SIOCGARP 0x8954
1722 #define VKI_SIOCSARP 0x8955
1723
1724 #define VKI_SIOCDRARP 0x8960
1725 #define VKI_SIOCGRARP 0x8961
1726 #define VKI_SIOCSRARP 0x8962
1727
1728 #define VKI_SIOCGIFMAP 0x8970
1729 #define VKI_SIOCSIFMAP 0x8971
1730
1731
1732
1733
1734
1735 #define VKI_GIO_FONT 0x4B60
1736 #define VKI_PIO_FONT 0x4B61
1737
1738 #define VKI_GIO_FONTX 0x4B6B
1739 #define VKI_PIO_FONTX 0x4B6C
1740 struct vki_consolefontdesc {
1741 unsigned short charcount;
1742 unsigned short charheight;
1743 char __user *chardata;
1744 };
1745
1746 #define VKI_PIO_FONTRESET 0x4B6D
1747
1748 #define VKI_GIO_CMAP 0x4B70
1749 #define VKI_PIO_CMAP 0x4B71
1750
1751 #define VKI_KIOCSOUND 0x4B2F
1752 #define VKI_KDMKTONE 0x4B30
1753
1754 #define VKI_KDGETLED 0x4B31
1755 #define VKI_KDSETLED 0x4B32
1756
1757 #define VKI_KDGKBTYPE 0x4B33
1758
1759 #define VKI_KDADDIO 0x4B34
1760 #define VKI_KDDELIO 0x4B35
1761 #define VKI_KDENABIO 0x4B36
1762 #define VKI_KDDISABIO 0x4B37
1763
1764 #define VKI_KDSETMODE 0x4B3A
1765 #define VKI_KDGETMODE 0x4B3B
1766
1767 #define VKI_KDMAPDISP 0x4B3C
1768 #define VKI_KDUNMAPDISP 0x4B3D
1769
1770 #define VKI_E_TABSZ 256
1771 #define VKI_GIO_SCRNMAP 0x4B40
1772 #define VKI_PIO_SCRNMAP 0x4B41
1773 #define VKI_GIO_UNISCRNMAP 0x4B69
1774 #define VKI_PIO_UNISCRNMAP 0x4B6A
1775
1776 #define VKI_GIO_UNIMAP 0x4B66
1777 #define VKI_PIO_UNIMAP 0x4B67
1778 #define VKI_PIO_UNIMAPCLR 0x4B68
1779
1780 #define VKI_KDGKBMODE 0x4B44
1781 #define VKI_KDSKBMODE 0x4B45
1782
1783 #define VKI_KDGKBMETA 0x4B62
1784 #define VKI_KDSKBMETA 0x4B63
1785
1786 #define VKI_KDGKBLED 0x4B64
1787 #define VKI_KDSKBLED 0x4B65
1788
1789 struct vki_kbentry {
1790 unsigned char kb_table;
1791 unsigned char kb_index;
1792 unsigned short kb_value;
1793 };
1794 #define VKI_KDGKBENT 0x4B46
1795 #define VKI_KDSKBENT 0x4B47
1796
1797 struct vki_kbsentry {
1798 unsigned char kb_func;
1799 unsigned char kb_string[512];
1800 };
1801 #define VKI_KDGKBSENT 0x4B48
1802 #define VKI_KDSKBSENT 0x4B49
1803
1804 struct vki_kbdiacr {
1805 unsigned char diacr, base, result;
1806 };
1807 struct vki_kbdiacrs {
1808 unsigned int kb_cnt;
1809 struct vki_kbdiacr kbdiacr[256];
1810 };
1811 #define VKI_KDGKBDIACR 0x4B4A
1812 #define VKI_KDSKBDIACR 0x4B4B
1813
1814 struct vki_kbkeycode {
1815 unsigned int scancode, keycode;
1816 };
1817 #define VKI_KDGETKEYCODE 0x4B4C
1818 #define VKI_KDSETKEYCODE 0x4B4D
1819
1820 #define VKI_KDSIGACCEPT 0x4B4E
1821
1822 struct vki_kbd_repeat {
1823 int delay;
1824 int period;
1825
1826 };
1827 #define VKI_KDKBDREP 0x4B52
1828
1829
1830 #define VKI_KDFONTOP 0x4B72
1831
1832
1833
1834
1835
1836 typedef __vki_kernel_uid32_t vki_qid_t;
1837
1838 #endif
1839
1840
1841
1842
1843
1844 #define VKI_PTRACE_TRACEME 0
1845 #define VKI_PTRACE_READ_I 1
1846 #define VKI_PTRACE_READ_D 2
1847
1848 #define VKI_PTRACE_WRITE_I 4
1849 #define VKI_PTRACE_WRITE_D 5
1850
1851 #define VKI_PTRACE_CONTINUE 7
1852 #define VKI_PTRACE_KILL 8
1853 #define VKI_PTRACE_STEP 9
1854 #define VKI_PTRACE_ATTACH 10
1855 #define VKI_PTRACE_DETACH 11
1856 #define VKI_PTRACE_IO 12
1857 #define VKI_PTRACE_LWPINFO 13
1858 #define VKI_PTRACE_GETNUMLWPS 14
1859 #define VKI_PTRACE_GETLWPLIST 15
1860 #define VKI_PTRACE_CLEARSTEP 16
1861 #define VKI_PTRACE_SETSTEP 17
1862 #define VKI_PTRACE_SUSPEND 18
1863 #define VKI_PTRACE_RESUME 19
1864 #define VKI_PTRACE_TO_SCE 20
1865 #define VKI_PTRACE_TO_SCX 21
1866 #define VKI_PTRACE_SYSCALL 22
1867
1868 #define VKI_PTRACE_GETREGS 33
1869 #define VKI_PTRACE_SETREGS 34
1870 #define VKI_PTRACE_GETFPREGS 35
1871 #define VKI_PTRACE_SETFPREGS 36
1872 #define VKI_PTRACE_GETDBREGS 37
1873 #define VKI_PTRACE_SETDBREGS 38
1874
1875 #define VKI_PTRACE_VM_TIMESTAMP 40
1876 #define VKI_PTRACE_VM_ENTRY 41
1877
1878 #define VKI_PTRACE_FIRSTMACH 64
1879
1880 struct vki_ptrace_io_desc {
1881 int piod_op;
1882 void * piod_offs;
1883 void * piod_addr;
1884 vki_size_t piod_len;
1885 };
1886 #define VKI_PIOD_READ_D 1
1887 #define VKI_PIOD_WRITE_D 2
1888 #define VKI_PIOD_READ_I 3
1889 #define VKI_PIOD_WRITE_I 4
1890
1891 struct vki_ptrace_lwpinfo {
1892 vki_lwpid_t pl_lwpid;
1893 int pl_event;
1894 #define VKI_PL_EVENT_NONE 0
1895 #define VKI_PL_EVENT_SIGNAL 1
1896 int pl_flags;
1897 #define VKI_FLAG_SA 0x01
1898 #define VKI_FLAG_BOUND 0x02
1899 vki_sigset_t pl_sigmask;
1900 vki_sigset_t pl_siglist;
1901 };
1902
1903 struct vki_ptrace_vm_entry {
1904 int pve_entry;
1905 int pve_timestamp;
1906 unsigned long pve_start;
1907 unsigned long pve_end;
1908 unsigned long pve_offset;
1909 unsigned int pve_prot;
1910 unsigned int pve_pathlen;
1911 long pve_fileid;
1912 vki_uint32_t pve_fsid;
1913 char *pve_path;
1914 };
1915
1916 #endif
1917
1918
1919
1920
1921
1922
1923 #define VKI_I386_GET_FSBASE 7
1924 #define VKI_I386_SET_FSBASE 8
1925 #define VKI_I386_GET_GSBASE 9
1926 #define VKI_I386_SET_GSBASE 10
1927 #define VKI_I386_GET_XFPUSTATE 11
1928
1929 #define VKI_AMD64_GET_FSBASE 128
1930 #define VKI_AMD64_SET_FSBASE 129
1931 #define VKI_AMD64_GET_GSBASE 130
1932 #define VKI_AMD64_SET_GSBASE 131
1933 #define VKI_AMD64_GET_XFPUSTATE 132
1934
1935
1936
1937
1938
1939 #define VKI_MAXMODNAME 32
1940
1941 typedef union vki_modspecific {
1942 vki_int32_t intval;
1943 vki_uint32_t u_intval;
1944 #if defined(VGP_x86_freebsd)
1945 vki_int32_t longval;
1946 vki_uint32_t u_longval;
1947 #elif defined(VGP_amd64_freebsd)
1948 vki_int64_t longval;
1949 vki_uint64_t u_longval;
1950 #else
1951 #error Unknown platform
1952 #endif
1953 } vki_modspecific_t;
1954
1955 struct vki_module_stat {
1956 int version;
1957 char name[VKI_MAXMODNAME];
1958 int refs;
1959 int id;
1960 vki_modspecific_t data;
1961 };
1962
1963
1964
1965
1966
1967 struct vki_rtprio {
1968 vki_uint16_t type;
1969 vki_uint16_t prio;
1970 };
1971
1972 #define VKI_RTP_LOOKUP 0
1973 #define VKI_RTP_SET 1
1974
1975
1976
1977
1978
1979 struct vki_umtx {
1980 unsigned long u_owner;
1981 };
1982
1983 struct vki_umutex {
1984 vki_lwpid_t m_owner;
1985 vki_uint32_t m_flags;
1986 vki_uint32_t m_ceilings[2];
1987 vki_uint32_t m_spare[4];
1988 };
1989
1990 struct vki_ucond {
1991 vki_uint32_t c_has_waiters;
1992 vki_uint32_t c_flags;
1993 vki_uint32_t c_spare[2];
1994 };
1995
1996 struct vki_urwlock {
1997 vki_uint32_t rw_state;
1998 vki_uint32_t rw_flags;
1999 vki_uint32_t rw_blocked_readers;
2000 vki_uint32_t rw_blocked_writers;
2001 vki_uint32_t rw_spare[4];
2002 };
2003
2004 struct vki_usem {
2005 vki_uint32_t has_waiters;
2006 vki_uint32_t count;
2007 vki_uint32_t flags;
2008 };
2009
2010 struct vki_umtx_time {
2011 struct vki_timespec timeout;
2012 vki_uint32_t flags;
2013 vki_uint32_t clockid;
2014 };
2015
2016 struct vki_usem2 {
2017 vki_uint32_t count;
2018 vki_uint32_t flags;
2019 };
2020
2021 struct vki_umtx_robust_lists_params {
2022 vki_uintptr_t robust_list_offset;
2023 vki_uintptr_t robust_priv_list_offset;
2024 vki_uintptr_t robust_inact_offset;
2025 };
2026
2027 #define VKI_UMTX_OP_LOCK 0
2028 #define VKI_UMTX_OP_UNLOCK 1
2029 #define VKI_UMTX_OP_WAIT 2
2030 #define VKI_UMTX_OP_WAKE 3
2031 #define VKI_UMTX_OP_MUTEX_TRYLOCK 4
2032 #define VKI_UMTX_OP_MUTEX_LOCK 5
2033 #define VKI_UMTX_OP_MUTEX_UNLOCK 6
2034 #define VKI_UMTX_OP_SET_CEILING 7
2035 #define VKI_UMTX_OP_CV_WAIT 8
2036 #define VKI_UMTX_OP_CV_SIGNAL 9
2037 #define VKI_UMTX_OP_CV_BROADCAST 10
2038 #define VKI_UMTX_OP_WAIT_UINT 11
2039 #define VKI_UMTX_OP_RW_RDLOCK 12
2040 #define VKI_UMTX_OP_RW_WRLOCK 13
2041 #define VKI_UMTX_OP_RW_UNLOCK 14
2042 #define VKI_UMTX_OP_WAIT_UINT_PRIVATE 15
2043 #define VKI_UMTX_OP_WAKE_PRIVATE 16
2044 #define VKI_UMTX_OP_MUTEX_WAIT 17
2045 #define VKI_UMTX_OP_MUTEX_WAKE 18
2046 #define VKI_UMTX_OP_SEM_WAIT 19
2047 #define VKI_UMTX_OP_SEM_WAKE 20
2048 #define VKI_UMTX_OP_NWAKE_PRIVATE 21
2049 #define VKI_UMTX_OP_MUTEX_WAKE2 22
2050 #define VKI_UMTX_OP_SEM2_WAIT 23
2051 #define VKI_UMTX_OP_SEM2_WAKE 24
2052 #define VKI_UMTX_OP_SHM 25
2053 #define VKI_UMTX_OP_ROBUST_LISTS 26
2054 #define VKI_UMTX_OP_MAX 27
2055
2056
2057
2058
2059
2060
2061 struct vki_acl_entry {
2062 int ae_tag;
2063 vki_uid_t ae_uid;
2064 vki_mode_t ae_perm;
2065 };
2066
2067 #define VKI_ACL_MAX_ENTRIES 32
2068 struct vki_acl {
2069 int acl_cnt;
2070 struct vki_acl_entry acl_entry[VKI_ACL_MAX_ENTRIES];
2071 };
2072
2073
2074
2075
2076
2077
2078 struct vki_uuid {
2079 vki_uint32_t time_low;
2080 vki_uint16_t time_mid;
2081 vki_uint16_t time_hi_and_version;
2082 vki_uint8_t clock_seq_hi_and_reserved;
2083 vki_uint8_t clock_seq_low;
2084 vki_uint8_t node[6];
2085 };
2086
2087
2088
2089
2090
2091 #define VKI__SS_MAXSIZE 128U
2092 #define VKI__SS_ALIGNSIZE (sizeof(__int64_t))
2093 #define VKI__SS_PAD1SIZE (VKI__SS_ALIGNSIZE - sizeof(unsigned char) - \
2094 sizeof(vki_sa_family_t))
2095 #define VKI__SS_PAD2SIZE (VKI__SS_MAXSIZE - sizeof(unsigned char) - \
2096 sizeof(sa_family_t) - VKI__SS_PAD1SIZE - VKI__SS_ALIGNSIZE)
2097
2098 struct vki_sockaddr_storage {
2099 unsigned char vki_ss_len;
2100 vki_sa_family_t vki_ss_family;
2101 char vki___ss_pad1[VKI__SS_PAD1SIZE];
2102 __int64_t vki___ss_align;
2103 char vki___ss_pad2VKI_[_SS_PAD2SIZE];
2104 };
2105
2106
2107
2108
2109
2110 #define VKI_CAP_RIGHTS_VERSION_00 0
2111 #define VKI_CAP_RIGHTS_VERSION VKI_CAP_RIGHTS_VERSION_00
2112
2113 struct vki_cap_rights {
2114 vki_uint64_t cki_cr_rights[VKI_CAP_RIGHTS_VERSION + 2];
2115 };
2116
2117 typedef struct vki_cap_rights vki_cap_rights_t;
2118
2119
2120
2121
2122
2123
2124 #define VKI_KVME_TYPE_NONE 0
2125 #define VKI_KVME_TYPE_DEFAULT 1
2126 #define VKI_KVME_TYPE_VNODE 2
2127 #define VKI_KVME_TYPE_SWAP 3
2128 #define VKI_KVME_TYPE_DEVICE 4
2129 #define VKI_KVME_TYPE_PHYS 5
2130 #define VKI_KVME_TYPE_DEAD 6
2131 #define VKI_KVME_TYPE_UNKNOWN 255
2132
2133 #define VKI_KVME_PROT_READ 0x00000001
2134 #define VKI_KVME_PROT_WRITE 0x00000002
2135 #define VKI_KVME_PROT_EXEC 0x00000004
2136
2137 #define VKI_KVME_FLAG_COW 0x00000001
2138 #define VKI_KVME_FLAG_NEEDS_COPY 0x00000002
2139
2140 struct vki_kinfo_vmentry {
2141 int kve_structsize;
2142 int kve_type;
2143 ULong kve_start;
2144 ULong kve_end;
2145 ULong kve_offset;
2146 ULong kve_fileid;
2147 UInt kve_fsid_freebsd11;
2148 int kve_flags;
2149 int kve_resident;
2150 int kve_private_resident;
2151 int kve_protection;
2152 int kve_ref_count;
2153 int kve_shadow_count;
2154 int kve_vn_type;
2155 ULong kve_vn_size;
2156 UInt kve_vn_rdev_freebsd11;
2157 UShort kve_vn_mode;
2158 UShort kve_status;
2159 ULong kve_vn_fsid;
2160 ULong kve_vn_rdev;
2161 int _kve_ispare[8];
2162 char kve_path[VKI_PATH_MAX];
2163 };
2164
2165 #define VKI_KINFO_FILE_SIZE 1392
2166
2167 struct vki_kinfo_file {
2168 int vki_kf_structsize;
2169 int vki_kf_type;
2170 int vki_kf_fd;
2171 int vki_kf_ref_count;
2172 int vki_kf_flags;
2173 int vki_kf_pad0;
2174 Off64T vki_kf_offset;
2175 union {
2176 struct {
2177
2178 int vki_kf_vnode_type;
2179 int vki_kf_sock_domain;
2180 int vki_kf_sock_type;
2181 int kf_sock_protocol;
2182 struct vki_sockaddr_storage vki_kf_sa_local;
2183 struct vki_sockaddr_storage vki_kf_sa_peer;
2184 };
2185 union {
2186 struct {
2187
2188 vki_uint32_t vki_kf_sock_sendq;
2189
2190 int vki_kf_sock_domain0;
2191
2192 int vki_kf_sock_type0;
2193
2194 int vki_kf_sock_protocol0;
2195
2196 struct vki_sockaddr_storage vki_kf_sa_local;
2197
2198 struct vki_sockaddr_storage vki_kf_sa_peer;
2199
2200 vki_uint64_t vki_kf_sock_pcb;
2201
2202 vki_uint64_t vki_kf_sock_inpcb;
2203
2204 vki_uint64_t vki_kf_sock_unpconn;
2205
2206 vki_uint16_t vki_kf_sock_snd_sb_state;
2207
2208 vki_uint16_t vki_kf_sock_rcv_sb_state;
2209
2210 vki_uint32_t vki_kf_sock_recvq;
2211 } vki_kf_sock;
2212 struct {
2213
2214 int vki_kf_file_type;
2215
2216 int vki_kf_spareint[3];
2217 vki_uint64_t vki_kf_spareint64[30];
2218
2219 vki_uint64_t vki_kf_file_fsid;
2220
2221 vki_uint64_t vki_kf_file_rdev;
2222
2223 vki_uint64_t vki_kf_file_fileid;
2224
2225 vki_uint64_t vki_kf_file_size;
2226
2227 vki_uint32_t vki_kf_file_fsid_freebsd11;
2228
2229 vki_uint32_t kf_file_rdev_freebsd11;
2230
2231 vki_uint16_t vki_kf_file_mode;
2232
2233 vki_uint16_t vki_kf_file_pad0;
2234 vki_uint32_t kf_file_pad1;
2235 } kf_file;
2236 struct {
2237 vki_uint32_t vki_kf_spareint[4];
2238 vki_uint64_t vki_kf_spareint64[32];
2239 vki_uint32_t vki_kf_sem_value;
2240 vki_uint16_t vki_kf_sem_mode;
2241 } kf_sem;
2242 struct {
2243 vki_uint32_t vki_kf_spareint[4];
2244 vki_uint64_t vki_kf_spareint64[32];
2245 vki_uint64_t vki_kf_pipe_addr;
2246 vki_uint64_t vki_kf_pipe_peer;
2247 vki_uint32_t vki_kf_pipe_buffer_cnt;
2248
2249 vki_uint32_t vki_kf_pipe_pad0[3];
2250 } kf_pipe;
2251 struct {
2252 vki_uint32_t vki_kf_spareint[4];
2253 vki_uint64_t vki_kf_spareint64[32];
2254 vki_uint32_t vki_kf_pts_dev_freebsd11;
2255 vki_uint32_t vki_kf_pts_pad0;
2256 vki_uint64_t vki_kf_pts_dev;
2257
2258 vki_uint32_t vki_kf_pts_pad1[4];
2259 } kf_pts;
2260 struct {
2261 vki_uint32_t vki_kf_spareint[4];
2262 vki_uint64_t vki_kf_spareint64[32];
2263 vki_pid_t vki_kf_pid;
2264 } vki_kf_proc;
2265 struct {
2266 vki_uint64_t vki_kf_eventfd_value;
2267 vki_uint32_t vki_kf_eventfd_flags;
2268 } vki_kf_eventfd;
2269 } vki_kf_un;
2270 };
2271 vki_uint16_t vki_kf_status;
2272 vki_uint16_t vki_kf_pad1;
2273 int vki__kf_ispare0;
2274 vki_cap_rights_t vki_kf_cap_rights;
2275 vki_uint64_t vki__kf_cap_spare;
2276
2277 char vki_kf_path[VKI_PATH_MAX];
2278 };
2279
2280
2281
2282
2283 #define VKI_KENV_GET 0
2284 #define VKI_KENV_SET 1
2285 #define VKI_KENV_UNSET 2
2286 #define VKI_KENV_DUMP 3
2287
2288
2289
2290
2291
2292 #include <sys/types.h>
2293 #include <sys/sysctl.h>
2294
2295 #define VKI_CTL_KERN CTL_KERN
2296 #define VKI_CTL_HW CTL_HW
2297 #define VKI_KERN_PROC KERN_PROC
2298 #define VKI_KERN_PROC_VMMAP KERN_PROC_VMMAP
2299 #define VKI_KERN_PROC_FILEDESC KERN_PROC_FILEDESC
2300 #define VKI_HW_MACHINE HW_MACHINE
2301
2302
2303
2304
2305
2306 struct vki_thr_param {
2307 void (*start_func)(void *);
2308 void *arg;
2309 char *stack_base;
2310 vki_size_t stack_size;
2311 char *tls_base;
2312 vki_size_t tls_size;
2313 long *child_tid;
2314 long *parent_tid;
2315 int flags;
2316 struct vki_rtprio *rtp;
2317 void *spare[3];
2318 };
2319
2320
2321
2322
2323
2324 struct vki_kld_file_stat {
2325 int version;
2326 char name[MAXPATHLEN];
2327 int refs;
2328 int id;
2329 vki_caddr_t address;
2330 vki_size_t size;
2331 char pathname[MAXPATHLEN];
2332 };
2333
2334
2335 struct vki_kld_sym_lookup {
2336 int version;
2337 char *symname;
2338 unsigned long symvalue;
2339 vki_size_t symsize;
2340 };
2341
2342 #if !defined(VKI_INIT_ARCH_ELF_STATE)
2343
2344
2345
2346
2347
2348 struct vki_arch_elf_state {
2349 };
2350
2351 # define VKI_INIT_ARCH_ELF_STATE { }
2352
2353 #endif
2354
2355
2356
2357
2358
2359 #define VKI_Q_QUOTAON 0x0100
2360 #define VKI_Q_QUOTAOFF 0x0200
2361 #define VKI_Q_GETQUOTA32 0x0300
2362 #define VKI_Q_SETQUOTA32 0x0400
2363 #define VKI_Q_SETUSE32 0x0500
2364 #define VKI_Q_SYNC 0x0600
2365 #define VKI_Q_GETQUOTA 0x0700
2366 #define VKI_Q_SETQUOTA 0x0800
2367 #define VKI_Q_SETUSE 0x0900
2368 #define VKI_Q_GETQUOTASIZE 0x0A00
2369
2370
2371
2372
2373
2374 #define VKI_BITSET_BITS (sizeof(long) * 8)
2375
2376 #define vki__howmany(x, y) (((x) + ((y) - 1)) / (y))
2377
2378 #define vki__bitset_words(_s) (vki__howmany(_s, VKI_BITSET_BITS))
2379
2380 #define VKI_BITSET_DEFINE(t, _s) \
2381 struct t { \
2382 long __bits[vki__bitset_words((_s))]; \
2383 }
2384
2385
2386
2387
2388
2389 #define VKI_DOMAINSET_MAXSIZE 256
2390
2391 #ifndef VKI_DOMAINSET_SETSIZE
2392 #define VKI_DOMAINSET_SETSIZE VKI_DOMAINSET_MAXSIZE
2393 #endif
2394
2395 VKI_BITSET_DEFINE(vki_domainset, VKI_DOMAINSET_SETSIZE);
2396
2397 typedef struct vki_domainset vki_domainset_t;
2398
2399
2400
2401
2402
2403 #define VKI_PROC_SPROTECT 1
2404 #define VKI_PROC_REAP_ACQUIRE 2
2405 #define VKI_PROC_REAP_RELEASE 3
2406 #define VKI_PROC_REAP_STATUS 4
2407 #define VKI_PROC_REAP_GETPIDS 5
2408 #define VKI_PROC_REAP_KILL 6
2409 #define VKI_PROC_TRACE_CTL 7
2410 #define VKI_PROC_TRACE_STATUS 8
2411 #define VKI_PROC_TRAPCAP_CTL 9
2412 #define VKI_PROC_TRAPCAP_STATUS 10
2413 #define VKI_PROC_PDEATHSIG_CTL 11
2414 #define VKI_PROC_PDEATHSIG_STATUS 12
2415 #define VKI_PROC_ASLR_CTL 13
2416 #define VKI_PROC_ASLR_STATUS 14
2417 #define VKI_PROC_STACKGAP_CTL 17
2418 #define VKI_PROC_STACKGAP_STATUS 18
2419 #define VKI_PROC_NO_NEW_PRIVS_CTL 19
2420 #define VKI_PROC_NO_NEW_PRIVS_STATUS 20
2421 #define VKI_PROC_WXMAP_CTL 21
2422 #define VKI_PROC_WXMAP_STATUS 22
2423
2424 struct vki_procctl_reaper_status {
2425 u_int rs_flags;
2426 u_int rs_children;
2427 u_int rs_descendants;
2428 vki_pid_t rs_reaper;
2429 vki_pid_t rs_pid;
2430 u_int rs_pad0[15];
2431 };
2432
2433 struct vki_procctl_reaper_pidinfo;
2434
2435 struct vki_procctl_reaper_pids {
2436 u_int rp_count;
2437 u_int rp_pad0[15];
2438 struct vki_procctl_reaper_pidinfo *rp_pids;
2439 };
2440
2441 struct vki_procctl_reaper_kill {
2442 int rk_sig;
2443 u_int rk_flags;
2444 vki_pid_t rk_subtree;
2445 u_int rk_killed;
2446 vki_pid_t rk_fpid;
2447 u_int rk_pad0[15];
2448 };
2449
2450
2451
2452
2453
2454 struct vki_jail {
2455 uint32_t version;
2456 char *path;
2457 char *hostname;
2458 char *jailname;
2459 uint32_t ip4s;
2460 uint32_t ip6s;
2461 struct in_addr *ip4;
2462 struct in6_addr *ip6;
2463 };
2464
2465
2466
2467
2468
2469 struct vki_ps_strings {
2470 char** ps_argvstr;
2471 unsigned int ps_nargvstr;
2472
2473 char** ps_envstr;
2474 unsigned int ps_nenvstr;
2475 };
2476
2477
2478
2479
2480
2481 #define VKI_AT_NULL 0
2482 #define VKI_AT_PS_STRINGS 32
2483
2484 #define VKI_NT_FREEBSD_ABI_TAG 1
2485 #define VKI_NT_FREEBSD_FEATURE_CTL 4
2486 #define VKI_NT_FREEBSD_FCTL_WXNEEDED 0x00000008
2487
2488
2489 #if 0
2490
2491
2492
2493
2494
2495 typedef unsigned long vki_u_long;
2496 typedef unsigned int vki_u_int;
2497 #define VKI_PCI_MAXNAMELEN 16
2498
2499 typedef enum {
2500 VKI_PCI_GETCONF_LAST_DEVICE,
2501 VKI_PCI_GETCONF_LIST_CHANGED,
2502 VKI_PCI_GETCONF_MORE_DEVS,
2503 VKI_PCI_GETCONF_ERROR
2504 } vki_pci_getconf_status;
2505
2506 typedef enum {
2507 VKI_PCI_GETCONF_NO_MATCH = 0x0000,
2508 VKI_PCI_GETCONF_MATCH_DOMAIN = 0x0001,
2509 VKI_PCI_GETCONF_MATCH_BUS = 0x0002,
2510 VKI_PCI_GETCONF_MATCH_DEV = 0x0004,
2511 VKI_PCI_GETCONF_MATCH_FUNC = 0x0008,
2512 VKI_PCI_GETCONF_MATCH_NAME = 0x0010,
2513 VKI_PCI_GETCONF_MATCH_UNIT = 0x0020,
2514 VKI_PCI_GETCONF_MATCH_VENDOR = 0x0040,
2515 VKI_PCI_GETCONF_MATCH_DEVICE = 0x0080,
2516 VKI_PCI_GETCONF_MATCH_CLASS = 0x0100
2517 } vki_pci_getconf_flags;
2518
2519 struct vki_pcisel {
2520 vki_uint32_t pc_domain;
2521 vki_uint8_t pc_bus;
2522 vki_uint8_t pc_dev;
2523 vki_uint8_t pc_func;
2524 };
2525
2526 struct vki_pci_conf {
2527 struct vki_pcisel pc_sel;
2528 vki_uint8_t pc_hdr;
2529 vki_uint16_t pc_subvendor;
2530 vki_uint16_t pc_subdevice;
2531
2532 vki_uint16_t pc_vendor;
2533 vki_uint16_t pc_device;
2534
2535 vki_uint8_t pc_class;
2536 vki_uint8_t pc_subclass;
2537 vki_uint8_t pc_progif;
2538 vki_uint8_t pc_revid;
2539 char pd_name[VKI_PCI_MAXNAMELEN + 1];
2540 vki_u_long pd_unit;
2541 };
2542
2543 struct vki_pci_match_conf {
2544 struct vki_pcisel pc_sel;
2545 char pd_name[VKI_PCI_MAXNAMELEN + 1];
2546 vki_u_long pd_unit;
2547 vki_uint16_t pc_vendor;
2548 vki_uint16_t pc_device;
2549 vki_uint8_t pc_class;
2550 vki_pci_getconf_flags flags;
2551 };
2552
2553 struct vki_pci_conf_io {
2554 vki_uint32_t pat_buf_len;
2555 vki_uint32_t num_patterns;
2556 struct vki_pci_match_conf *patterns;
2557 vki_uint32_t match_buf_len;
2558 vki_uint32_t num_matches;
2559 struct vki_pci_conf *matches;
2560 vki_uint32_t offset;
2561 vki_uint32_t generation;
2562 vki_pci_getconf_status status;
2563 };
2564
2565 #define VKI_PCIOCGETCONF _VKI_IOWR('p', 5, struct vki_pci_conf_io)
2566
2567
2568
2569
2570
2571 #define VKI_CAM_MAX_CDBLEN 16
2572
2573 typedef unsigned int vki_path_id_t;
2574 typedef unsigned int vki_target_id_t;
2575 typedef unsigned int vki_lun_id_t;
2576
2577 typedef struct {
2578 vki_uint32_t priority;
2579 vki_uint32_t generation;
2580 int index;
2581 } vki_cam_pinfo;
2582
2583
2584
2585
2586
2587
2588 struct vki_ata_params {
2589 vki_u_int16_t config;
2590 vki_u_int16_t cylinders;
2591 vki_u_int16_t specconf;
2592 vki_u_int16_t heads;
2593 vki_u_int16_t obsolete4;
2594 vki_u_int16_t obsolete5;
2595 vki_u_int16_t sectors;
2596 vki_u_int16_t vendor7[3];
2597 vki_u_int8_t serial[20];
2598 vki_u_int16_t retired20;
2599 vki_u_int16_t retired21;
2600 vki_u_int16_t obsolete22;
2601 vki_u_int8_t revision[8];
2602 vki_u_int8_t model[40];
2603 vki_u_int16_t sectors_intr;
2604 vki_u_int16_t usedmovsd;
2605 vki_u_int16_t capabilities1;
2606 vki_u_int16_t capabilities2;
2607 vki_u_int16_t retired_piomode;
2608 vki_u_int16_t retired_dmamode;
2609 vki_u_int16_t atavalid;
2610 vki_u_int16_t current_cylinders;
2611 vki_u_int16_t current_heads;
2612 vki_u_int16_t current_sectors;
2613 vki_u_int16_t current_size_1;
2614 vki_u_int16_t current_size_2;
2615 vki_u_int16_t multi;
2616 vki_u_int16_t lba_size_1;
2617 vki_u_int16_t lba_size_2;
2618 vki_u_int16_t obsolete62;
2619 vki_u_int16_t mwdmamodes;
2620 vki_u_int16_t apiomodes;
2621
2622 vki_u_int16_t mwdmamin;
2623 vki_u_int16_t mwdmarec;
2624 vki_u_int16_t pioblind;
2625 vki_u_int16_t pioiordy;
2626 vki_u_int16_t support3;
2627 vki_u_int16_t reserved70;
2628 vki_u_int16_t rlsovlap;
2629 vki_u_int16_t rlsservice;
2630 vki_u_int16_t reserved73;
2631 vki_u_int16_t reserved74;
2632 vki_u_int16_t queue;
2633 vki_u_int16_t satacapabilities;
2634 vki_u_int16_t satacapabilities2;
2635 vki_u_int16_t satasupport;
2636 vki_u_int16_t sataenabled;
2637 vki_u_int16_t version_major;
2638 vki_u_int16_t version_minor;
2639
2640 struct {
2641 vki_u_int16_t command1;
2642 vki_u_int16_t command2;
2643 vki_u_int16_t extension;
2644 } __packed support, enabled;
2645
2646 vki_u_int16_t udmamodes;
2647 vki_u_int16_t erase_time;
2648 vki_u_int16_t enhanced_erase_time;
2649 vki_u_int16_t apm_value;
2650 vki_u_int16_t master_passwd_revision;
2651 vki_u_int16_t hwres;
2652 vki_u_int16_t acoustic;
2653 vki_u_int16_t stream_min_req_size;
2654 vki_u_int16_t stream_transfer_time;
2655 vki_u_int16_t stream_access_latency;
2656 vki_u_int32_t stream_granularity;
2657 vki_u_int16_t lba_size48_1;
2658 vki_u_int16_t lba_size48_2;
2659 vki_u_int16_t lba_size48_3;
2660 vki_u_int16_t lba_size48_4;
2661 vki_u_int16_t reserved104;
2662 vki_u_int16_t max_dsm_blocks;
2663 vki_u_int16_t pss;
2664 vki_u_int16_t isd;
2665 vki_u_int16_t wwn[4];
2666 vki_u_int16_t reserved112[5];
2667 vki_u_int16_t lss_1;
2668 vki_u_int16_t lss_2;
2669 vki_u_int16_t support2;
2670 vki_u_int16_t enabled2;
2671 vki_u_int16_t reserved121[6];
2672 vki_u_int16_t removable_status;
2673 vki_u_int16_t security_status;
2674 vki_u_int16_t reserved129[31];
2675 vki_u_int16_t cfa_powermode1;
2676 vki_u_int16_t reserved161;
2677 vki_u_int16_t cfa_kms_support;
2678 vki_u_int16_t cfa_trueide_modes;
2679 vki_u_int16_t cfa_memory_modes;
2680 vki_u_int16_t reserved165[4];
2681 vki_u_int16_t support_dsm;
2682 vki_u_int16_t reserved170[6];
2683 vki_u_int8_t media_serial[60];
2684 vki_u_int16_t sct;
2685 vki_u_int16_t reserved206[2];
2686 vki_u_int16_t lsalign;
2687 vki_u_int16_t wrv_sectors_m3_1;
2688 vki_u_int16_t wrv_sectors_m3_2;
2689 vki_u_int16_t wrv_sectors_m2_1;
2690 vki_u_int16_t wrv_sectors_m2_2;
2691 vki_u_int16_t nv_cache_caps;
2692 vki_u_int16_t nv_cache_size_1;
2693 vki_u_int16_t nv_cache_size_2;
2694 vki_u_int16_t media_rotation_rate;
2695 vki_u_int16_t reserved218;
2696 vki_u_int16_t nv_cache_opt;
2697 vki_u_int16_t wrv_mode;
2698 vki_u_int16_t reserved221;
2699 vki_u_int16_t transport_major;
2700 vki_u_int16_t transport_minor;
2701 vki_u_int16_t reserved224[31];
2702 vki_u_int16_t integrity;
2703 } __packed;
2704
2705
2706
2707
2708
2709 struct vki_callout_handle {
2710 struct vki_callout *callout;
2711 };
2712
2713
2714
2715
2716
2717
2718 struct vki_scsi_sense_data {
2719 vki_u_int8_t error_code;
2720 vki_u_int8_t segment;
2721 vki_u_int8_t flags;
2722 vki_u_int8_t info[4];
2723 vki_u_int8_t extra_len;
2724 vki_u_int8_t cmd_spec_info[4];
2725 vki_u_int8_t add_sense_code;
2726 vki_u_int8_t add_sense_code_qual;
2727 vki_u_int8_t fru;
2728 vki_u_int8_t sense_key_spec[3];
2729 vki_u_int8_t extra_bytes[14];
2730 #define VKI_SSD_FULL_SIZE sizeof(struct vki_scsi_sense_data)
2731 };
2732
2733 struct vki_scsi_inquiry_data {
2734 vki_uint8_t device;
2735 vki_uint8_t dev_qual2;
2736 vki_uint8_t version;
2737 vki_uint8_t response_format;
2738 vki_uint8_t additional_length;
2739 vki_uint8_t spc3_flags;
2740 vki_uint8_t spc2_flags;
2741 vki_uint8_t flags;
2742 #define VKI_SID_VENDOR_SIZE 8
2743 char vendor[VKI_SID_VENDOR_SIZE];
2744 #define VKI_SID_PRODUCT_SIZE 16
2745 char product[VKI_SID_PRODUCT_SIZE];
2746 #define VKI_SID_REVISION_SIZE 4
2747 char revision[VKI_SID_REVISION_SIZE];
2748 #define VKI_SID_VENDOR_SPECIFIC_0_SIZE 20
2749 vki_uint8_t vendor_specific0[VKI_SID_VENDOR_SPECIFIC_0_SIZE];
2750 vki_uint8_t spi3data;
2751 vki_uint8_t reserved2;
2752
2753
2754
2755 vki_uint8_t version1[2];
2756 vki_uint8_t version2[2];
2757 vki_uint8_t version3[2];
2758 vki_uint8_t version4[2];
2759 vki_uint8_t version5[2];
2760 vki_uint8_t version6[2];
2761 vki_uint8_t version7[2];
2762 vki_uint8_t version8[2];
2763
2764 vki_uint8_t reserved3[22];
2765
2766 #define VKI_SID_VENDOR_SPECIFIC_1_SIZE 160
2767 vki_uint8_t vendor_specific1[VKI_SID_VENDOR_SPECIFIC_1_SIZE];
2768 };
2769
2770
2771
2772
2773
2774 #define SLIST_ENTRY(type) \
2775 struct { \
2776 struct type *sle_next; \
2777 }
2778
2779 #define LIST_ENTRY(type) \
2780 struct { \
2781 struct type *le_next; \
2782 struct type **le_prev; \
2783 }
2784
2785 #define STAILQ_ENTRY(type) \
2786 struct { \
2787 struct type *stqe_next; \
2788 }
2789
2790 struct qm_trace {
2791 unsigned long lastline;
2792 unsigned long prevline;
2793 const char *lastfile;
2794 const char *prevfile;
2795 };
2796
2797 #define TRACEBUF struct qm_trace trace;
2798
2799 #define TAILQ_ENTRY(type) \
2800 struct { \
2801 struct type *tqe_next; \
2802 struct type **tqe_prev; \
2803 TRACEBUF \
2804 }
2805
2806
2807
2808
2809
2810
2811 #define VKI_CAM_VERSION 0x15
2812
2813 typedef union {
2814 LIST_ENTRY(vki_ccb_hdr) le;
2815 SLIST_ENTRY(vki_ccb_hdr) sle;
2816 TAILQ_ENTRY(vki_ccb_hdr) tqe;
2817 STAILQ_ENTRY(vki_ccb_hdr) stqe;
2818 } vki_camq_entry;
2819
2820 typedef enum {
2821
2822 VKI_XPT_FC_QUEUED = 0x100,
2823
2824 VKI_XPT_FC_USER_CCB = 0x200,
2825 VKI_XPT_FC_XPT_ONLY = 0x400,
2826
2827 VKI_XPT_FC_DEV_QUEUED = 0x800 | VKI_XPT_FC_QUEUED,
2828
2829
2830 VKI_XPT_NOOP = 0x00,
2831
2832 VKI_XPT_SCSI_IO = 0x01 | VKI_XPT_FC_DEV_QUEUED,
2833
2834 VKI_XPT_GDEV_TYPE = 0x02,
2835
2836 VKI_XPT_GDEVLIST = 0x03,
2837
2838 VKI_XPT_PATH_INQ = 0x04,
2839
2840 VKI_XPT_REL_SIMQ = 0x05,
2841
2842 VKI_XPT_SASYNC_CB = 0x06,
2843
2844 VKI_XPT_SDEV_TYPE = 0x07,
2845
2846 VKI_XPT_SCAN_BUS = 0x08 | VKI_XPT_FC_QUEUED | VKI_XPT_FC_USER_CCB
2847 | VKI_XPT_FC_XPT_ONLY,
2848
2849 VKI_XPT_DEV_MATCH = 0x09 | VKI_XPT_FC_XPT_ONLY,
2850
2851 VKI_XPT_DEBUG = 0x0a,
2852
2853 VKI_XPT_PATH_STATS = 0x0b,
2854
2855 VKI_XPT_GDEV_STATS = 0x0c,
2856
2857 VKI_XPT_FREEZE_QUEUE = 0x0d,
2858
2859
2860 VKI_XPT_ABORT = 0x10,
2861
2862 VKI_XPT_RESET_BUS = 0x11 | VKI_XPT_FC_XPT_ONLY,
2863
2864 VKI_XPT_RESET_DEV = 0x12 | VKI_XPT_FC_DEV_QUEUED,
2865
2866 VKI_XPT_TERM_IO = 0x13,
2867
2868 VKI_XPT_SCAN_LUN = 0x14 | VKI_XPT_FC_QUEUED | VKI_XPT_FC_USER_CCB
2869 | VKI_XPT_FC_XPT_ONLY,
2870
2871 VKI_XPT_GET_TRAN_SETTINGS = 0x15,
2872
2873
2874
2875
2876 VKI_XPT_SET_TRAN_SETTINGS = 0x16,
2877
2878
2879
2880
2881 VKI_XPT_CALC_GEOMETRY = 0x17,
2882
2883
2884
2885
2886
2887 VKI_XPT_ATA_IO = 0x18 | VKI_XPT_FC_DEV_QUEUED,
2888
2889 VKI_XPT_GET_SIM_KNOB = 0x18,
2890
2891
2892
2893
2894 VKI_XPT_SET_SIM_KNOB = 0x19,
2895
2896
2897
2898
2899 VKI_XPT_ENG_INQ = 0x20 | VKI_XPT_FC_XPT_ONLY,
2900
2901 VKI_XPT_ENG_EXEC = 0x21 | VKI_XPT_FC_DEV_QUEUED,
2902
2903
2904
2905 VKI_XPT_EN_LUN = 0x30,
2906
2907 VKI_XPT_TARGET_IO = 0x31 | VKI_XPT_FC_DEV_QUEUED,
2908
2909 VKI_XPT_ACCEPT_TARGET_IO = 0x32 | VKI_XPT_FC_QUEUED | VKI_XPT_FC_USER_CCB,
2910
2911 VKI_XPT_CONT_TARGET_IO = 0x33 | VKI_XPT_FC_DEV_QUEUED,
2912
2913 VKI_XPT_IMMED_NOTIFY = 0x34 | VKI_XPT_FC_QUEUED | VKI_XPT_FC_USER_CCB,
2914
2915 VKI_XPT_NOTIFY_ACK = 0x35,
2916
2917 VKI_XPT_IMMEDIATE_NOTIFY = 0x36 | VKI_XPT_FC_QUEUED | VKI_XPT_FC_USER_CCB,
2918
2919 VKI_XPT_NOTIFY_ACKNOWLEDGE = 0x37 | VKI_XPT_FC_QUEUED | VKI_XPT_FC_USER_CCB,
2920
2921
2922
2923 VKI_XPT_VUNIQUE = 0x80
2924 } vki_xpt_opcode;
2925
2926
2927
2928 typedef enum {
2929 VKI_CAM_CDB_POINTER = 0x00000001,
2930 VKI_CAM_QUEUE_ENABLE = 0x00000002,
2931 VKI_CAM_CDB_LINKED = 0x00000004,
2932 VKI_CAM_NEGOTIATE = 0x00000008,
2933
2934
2935
2936 VKI_CAM_SCATTER_VALID = 0x00000010,
2937 VKI_CAM_DIS_AUTOSENSE = 0x00000020,
2938 VKI_CAM_DIR_RESV = 0x00000000,
2939 VKI_CAM_DIR_IN = 0x00000040,
2940 VKI_CAM_DIR_OUT = 0x00000080,
2941 VKI_CAM_DIR_NONE = 0x000000C0,
2942 VKI_CAM_DIR_MASK = 0x000000C0,
2943 VKI_CAM_SOFT_RST_OP = 0x00000100,
2944 VKI_CAM_ENG_SYNC = 0x00000200,
2945 VKI_CAM_DEV_QFRZDIS = 0x00000400,
2946 VKI_CAM_DEV_QFREEZE = 0x00000800,
2947 VKI_CAM_HIGH_POWER = 0x00001000,
2948 VKI_CAM_SENSE_PTR = 0x00002000,
2949 VKI_CAM_SENSE_PHYS = 0x00004000,
2950 VKI_CAM_TAG_ACTION_VALID = 0x00008000,
2951 VKI_CAM_PASS_ERR_RECOVER = 0x00010000,
2952 VKI_CAM_DIS_DISCONNECT = 0x00020000,
2953 VKI_CAM_SG_LIST_PHYS = 0x00040000,
2954 VKI_CAM_MSG_BUF_PHYS = 0x00080000,
2955 VKI_CAM_SNS_BUF_PHYS = 0x00100000,
2956 VKI_CAM_DATA_PHYS = 0x00200000,
2957 VKI_CAM_CDB_PHYS = 0x00400000,
2958 VKI_CAM_ENG_SGLIST = 0x00800000,
2959
2960
2961 VKI_CAM_DIS_AUTOSRP = 0x01000000,
2962 VKI_CAM_DIS_AUTODISC = 0x02000000,
2963 VKI_CAM_TGT_CCB_AVAIL = 0x04000000,
2964 VKI_CAM_TGT_PHASE_MODE = 0x08000000,
2965 VKI_CAM_MSGB_VALID = 0x10000000,
2966 VKI_CAM_STATUS_VALID = 0x20000000,
2967 VKI_CAM_DATAB_VALID = 0x40000000,
2968
2969
2970 VKI_CAM_SEND_SENSE = 0x08000000,
2971 VKI_CAM_TERM_IO = 0x10000000,
2972 VKI_CAM_DISCONNECT = 0x20000000,
2973 VKI_CAM_SEND_STATUS = 0x40000000
2974 } vki_ccb_flags;
2975
2976 typedef union {
2977 void *ptr;
2978 vki_u_long field;
2979 vki_uint8_t bytes[sizeof(vki_uintptr_t)];
2980 } vki_ccb_priv_entry;
2981
2982 #define VKI_IOCDBLEN VKI_CAM_MAX_CDBLEN
2983 #define VKI_CCB_PERIPH_PRIV_SIZE 2
2984 #define VKI_CCB_SIM_PRIV_SIZE 2
2985
2986 typedef union {
2987 vki_ccb_priv_entry entries[VKI_CCB_PERIPH_PRIV_SIZE];
2988 vki_uint8_t bytes[VKI_CCB_PERIPH_PRIV_SIZE * sizeof(vki_ccb_priv_entry)];
2989 } vki_ccb_ppriv_area;
2990
2991 typedef union {
2992 vki_ccb_priv_entry entries[VKI_CCB_SIM_PRIV_SIZE];
2993 vki_uint8_t bytes[VKI_CCB_SIM_PRIV_SIZE * sizeof(vki_ccb_priv_entry)];
2994 } vki_ccb_spriv_area;
2995
2996 union vki_ccb;
2997 struct vki_cam_periph;
2998
2999 struct vki_ccb_hdr {
3000 vki_cam_pinfo pinfo;
3001 vki_camq_entry xpt_links;
3002 vki_camq_entry sim_links;
3003 vki_camq_entry periph_links;
3004 vki_uint32_t retry_count;
3005 void (*cbfcnp)(struct vki_cam_periph *, union vki_ccb *);
3006
3007 vki_xpt_opcode func_code;
3008 vki_uint32_t status;
3009 struct vki_cam_path *path;
3010 vki_path_id_t path_id;
3011 vki_target_id_t target_id;
3012 vki_lun_id_t target_lun;
3013 vki_uint32_t flags;
3014 vki_ccb_ppriv_area periph_priv;
3015 vki_ccb_spriv_area sim_priv;
3016 vki_uint32_t timeout;
3017
3018
3019
3020
3021
3022 struct vki_callout_handle timeout_ch;
3023 };
3024
3025 typedef union {
3026 vki_u_int8_t *cdb_ptr;
3027
3028 vki_u_int8_t cdb_bytes[VKI_IOCDBLEN];
3029 } vki_cdb_t;
3030
3031
3032
3033
3034
3035
3036 struct vki_ccb_scsiio {
3037 struct vki_ccb_hdr ccb_h;
3038 union vki_ccb *next_ccb;
3039 vki_u_int8_t *req_map;
3040 vki_u_int8_t *data_ptr;
3041 vki_u_int32_t dxfer_len;
3042
3043 struct vki_scsi_sense_data sense_data;
3044 vki_u_int8_t sense_len;
3045 vki_u_int8_t cdb_len;
3046 vki_u_int16_t sglist_cnt;
3047 vki_u_int8_t scsi_status;
3048 vki_u_int8_t sense_resid;
3049 vki_u_int32_t resid;
3050 vki_cdb_t cdb_io;
3051 vki_u_int8_t *msg_ptr;
3052 vki_u_int16_t msg_len;
3053 vki_u_int8_t tag_action;
3054
3055
3056
3057
3058
3059 vki_u_int tag_id;
3060 vki_u_int init_id;
3061 };
3062
3063 typedef enum {
3064 VKI_CAM_DEV_MATCH_LAST,
3065 VKI_CAM_DEV_MATCH_MORE,
3066 VKI_CAM_DEV_MATCH_LIST_CHANGED,
3067 VKI_CAM_DEV_MATCH_SIZE_ERROR,
3068 VKI_CAM_DEV_MATCH_ERROR
3069 } vki_ccb_dev_match_status;
3070
3071
3072 struct vki_dev_match_pattern;
3073
3074 typedef enum {
3075 VKI_DEV_MATCH_PERIPH,
3076 VKI_DEV_MATCH_DEVICE,
3077 VKI_DEV_MATCH_BUS
3078 } vki_dev_match_type;
3079
3080 #define VKI_DEV_IDLEN 16
3081
3082 struct vki_periph_match_result {
3083 char periph_name[VKI_DEV_IDLEN];
3084 vki_uint32_t unit_number;
3085 vki_path_id_t path_id;
3086 vki_target_id_t target_id;
3087 vki_lun_id_t target_lun;
3088 };
3089
3090 typedef enum {
3091 VKI_PROTO_UNKNOWN,
3092 VKI_PROTO_UNSPECIFIED,
3093 VKI_PROTO_SCSI,
3094 VKI_PROTO_ATA,
3095 VKI_PROTO_ATAPI,
3096 VKI_PROTO_SATAPM,
3097 } vki_cam_proto;
3098
3099 typedef enum {
3100 VKI_DEV_RESULT_NOFLAG = 0x00,
3101 VKI_DEV_RESULT_UNCONFIGURED = 0x01
3102 } vki_dev_result_flags;
3103
3104
3105 struct vki_device_match_result {
3106 vki_path_id_t path_id;
3107 vki_target_id_t target_id;
3108 vki_lun_id_t target_lun;
3109 vki_cam_proto protocol;
3110 struct vki_scsi_inquiry_data inq_data;
3111 struct vki_ata_params ident_data;
3112 vki_dev_result_flags flags;
3113 };
3114
3115 struct vki_bus_match_result {
3116 vki_path_id_t path_id;
3117 char dev_name[VKI_DEV_IDLEN];
3118 vki_uint32_t unit_number;
3119 vki_uint32_t bus_id;
3120 };
3121
3122 union vki_match_result {
3123 struct vki_periph_match_result periph_result;
3124 struct vki_device_match_result device_result;
3125 struct vki_bus_match_result bus_result;
3126 };
3127
3128 struct vki_dev_match_result {
3129 vki_dev_match_type type;
3130 union vki_match_result result;
3131 };
3132
3133 typedef enum {
3134 VKI_CAM_DEV_POS_NONE = 0x000,
3135 VKI_CAM_DEV_POS_BUS = 0x001,
3136 VKI_CAM_DEV_POS_TARGET = 0x002,
3137 VKI_CAM_DEV_POS_DEVICE = 0x004,
3138 VKI_CAM_DEV_POS_PERIPH = 0x008,
3139 VKI_CAM_DEV_POS_PDPTR = 0x010,
3140 VKI_CAM_DEV_POS_TYPEMASK = 0xf00,
3141 VKI_CAM_DEV_POS_EDT = 0x100,
3142 VKI_CAM_DEV_POS_PDRV = 0x200
3143 } vki_dev_pos_type;
3144
3145 struct vki_ccb_dm_cookie {
3146 void *bus;
3147 void *target;
3148 void *device;
3149 void *periph;
3150 void *pdrv;
3151 };
3152
3153 struct vki_ccb_dev_position {
3154 vki_u_int generations[4];
3155 #define VKI_CAM_BUS_GENERATION 0x00
3156 #define VKI_CAM_TARGET_GENERATION 0x01
3157 #define VKI_CAM_DEV_GENERATION 0x02
3158 #define VKI_CAM_PERIPH_GENERATION 0x03
3159 vki_dev_pos_type position_type;
3160 struct vki_ccb_dm_cookie cookie;
3161 };
3162
3163 struct vki_ccb_dev_match {
3164 struct vki_ccb_hdr ccb_h;
3165 vki_ccb_dev_match_status status;
3166 vki_uint32_t num_patterns;
3167 vki_uint32_t pattern_buf_len;
3168 struct vki_dev_match_pattern *patterns;
3169 vki_uint32_t num_matches;
3170 vki_uint32_t match_buf_len;
3171 struct vki_dev_match_result *matches;
3172 struct vki_ccb_dev_position pos;
3173 };
3174
3175
3176
3177
3178
3179
3180
3181 union vki_ccb {
3182
3183 struct vki_ccb_hdr ccb_h;
3184 struct vki_ccb_scsiio csio;
3185 #if 0
3186 struct ccb_getdev cgd;
3187 struct ccb_getdevlist cgdl;
3188 struct ccb_pathinq cpi;
3189 struct ccb_relsim crs;
3190 struct ccb_setasync csa;
3191 struct ccb_setdev csd;
3192 struct ccb_pathstats cpis;
3193 struct ccb_getdevstats cgds;
3194 #endif
3195 struct vki_ccb_dev_match cdm;
3196 #if 0
3197 struct ccb_trans_settings cts;
3198 struct ccb_calc_geometry ccg;
3199 struct ccb_sim_knob knob;
3200 struct ccb_abort cab;
3201 struct ccb_resetbus crb;
3202 struct ccb_resetdev crd;
3203 struct ccb_termio tio;
3204 struct ccb_accept_tio atio;
3205 struct ccb_scsiio ctio;
3206 struct ccb_en_lun cel;
3207 struct ccb_immed_notify cin;
3208 struct ccb_notify_ack cna;
3209 struct ccb_immediate_notify cin1;
3210 struct ccb_notify_acknowledge cna2;
3211 struct ccb_eng_inq cei;
3212 struct ccb_eng_exec cee;
3213 struct ccb_rescan crcn;
3214 struct ccb_debug cdbg;
3215 struct ccb_ataio ataio;
3216 #endif
3217 char make_union_right_size[0x4A8];
3218 };
3219
3220 #define VKI_CAMIOCOMMAND _VKI_IOWR(VKI_CAM_VERSION, 2, union vki_ccb)
3221
3222 #endif
3223
3224
3225