Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:20

0001 
0002 /*--------------------------------------------------------------------*/
0003 /*--- Darwin-specific kernel interface.               vki-darwin.h ---*/
0004 /*--------------------------------------------------------------------*/
0005 
0006 /*
0007    This file is part of Valgrind, a dynamic binary instrumentation
0008    framework.
0009 
0010    Copyright (C) 2007-2017 Apple Inc.
0011       Greg Parker  gparker@apple.com
0012 
0013    This program is free software; you can redistribute it and/or
0014    modify it under the terms of the GNU General Public License as
0015    published by the Free Software Foundation; either version 2 of the
0016    License, or (at your option) any later version.
0017 
0018    This program is distributed in the hope that it will be useful, but
0019    WITHOUT ANY WARRANTY; without even the implied warranty of
0020    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0021    General Public License for more details.
0022 
0023    You should have received a copy of the GNU General Public License
0024    along with this program; if not, see <http://www.gnu.org/licenses/>.
0025 
0026    The GNU General Public License is contained in the file COPYING.
0027 */
0028 
0029 /* Unlike vki-linux, this Darwin kernel interface includes system headers
0030    directly, to avoid copyright complexity. */
0031 
0032 #ifndef __VKI_DARWIN_H
0033 #define __VKI_DARWIN_H
0034 
0035 /* struct __darwin_ucontext isn't fully declared without
0036  * this definition.  It's crazy but there it is.  */
0037 #ifndef _XOPEN_SOURCE
0038 #define _XOPEN_SOURCE 0500
0039 #endif
0040 
0041 #include <stdint.h>
0042 
0043 #define vki_int8_t int8_t
0044 #define vki_uint8_t uint8_t
0045 #define vki_int16_t int16_t
0046 #define vki_uint16_t uint16_t
0047 #define vki_int32_t int32_t
0048 #define vki_uint32_t uint32_t
0049 #define vki_int64_t int64_t
0050 #define vki_uint64_t uint64_t
0051 #define vki_intptr_t intptr_t
0052 #define vki_uintptr_t uintptr_t
0053 
0054 #include <sys/types.h>
0055 
0056 #define vki_dev_t dev_t
0057 #define vki_mode_t mode_t
0058 #define vki_ino_t ino_t
0059 #define vki_ino64_t ino64_t
0060 #define vki_nlink_t nlink_t
0061 #define vki_uid_t uid_t
0062 #define vki_gid_t gid_t
0063 #define vki_time_t time_t
0064 #define vki_off_t off_t
0065 #define vki_blkcnt_t blkcnt_t
0066 #define vki_blksize_t blksize_t
0067 #define vki_size_t size_t
0068 #define vki_ssize_t ssize_t
0069 #define vki_pid_t pid_t
0070 #define vki_socklen_t socklen_t
0071 #define vki_suseconds_t suseconds_t
0072 #define vki_caddr_t caddr_t
0073 #define vki_u_long u_long
0074 #define vki_u_short u_short
0075 #define vki_clock_t clock_t
0076 #define vki_u_int32_t u_int32_t
0077 #define vki_u_int16_t u_int16_t
0078 #define vki_pthread_t pthread_t
0079 
0080 
0081 // valgrind special
0082 
0083 // magic mmap() flags
0084 #define VKI_MAP_ANONYMOUS MAP_ANON  // linux synonym
0085 
0086 // fds for mmap(MAP_ANON), displayed by vmmap
0087 #define VM_TAG_VALGRIND VM_MAKE_TAG(239)  // SkAnonV
0088 
0089 // page sizes
0090 #define VKI_MAX_PAGE_SHIFT VKI_PAGE_SHIFT
0091 #define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
0092 
0093 // types
0094 typedef uint32_t vki_u32;
0095 
0096 // linux-like ioctl flags
0097 #define _VKI_IOC_DIR(x)     ((x) & IOC_DIRMASK)
0098 #define _VKI_IOC_SIZE(x)    IOCPARM_LEN(x)
0099 #define _VKI_IOC_NONE       IOC_VOID  /* GrP fixme correct? */
0100 #define _VKI_IOC_READ       IOC_OUT
0101 #define _VKI_IOC_WRITE      IOC_IN
0102 
0103 
0104 #include <malloc/malloc.h>
0105 
0106 #define vki_malloc_zone_t malloc_zone_t
0107 
0108 
0109 #include <sys/time.h>
0110 
0111 #define vki_timeval timeval
0112 #define vki_timeval32 timeval32
0113 #define vki_tv_sec tv_sec
0114 #define vki_tv_usec tv_usec
0115 #define vki_timespec timespec
0116 #define vki_itimerval itimerval
0117 #define vki_timezone timezone
0118 
0119 
0120 #include <sys/stat.h>
0121 
0122 #define VKI_S_ISBLK(m)  S_ISBLK(m)
0123 #define VKI_S_ISCHR(m)  S_ISCHR(m)
0124 #define VKI_S_ISDIR(m)  S_ISDIR(m)
0125 #define VKI_S_ISFIFO(m) S_ISFIFO(m)
0126 #define VKI_S_ISREG(m)  S_ISREG(m)
0127 #define VKI_S_ISLNK(m)  S_ISLNK(m)
0128 #define VKI_S_ISSOCK(m) S_ISSOCK(m)
0129 #define VKI_S_ISWHT(m)  S_ISWHT(m)
0130 #define VKI_S_ISXATTR(m) S_ISXATTR(m)
0131 
0132 #define VKI_S_IRWXU S_IRWXU
0133 #define VKI_S_IRUSR S_IRUSR
0134 #define VKI_S_IWUSR S_IWUSR
0135 #define VKI_S_IXUSR S_IXUSR
0136 #define VKI_S_IRWXG S_IRWXG
0137 #define VKI_S_IRGRP S_IRGRP
0138 #define VKI_S_IWGRP S_IWGRP
0139 #define VKI_S_IXGRP S_IXGRP
0140 #define VKI_S_IRWXO S_IRWXO
0141 #define VKI_S_IROTH S_IROTH
0142 #define VKI_S_IWOTH S_IWOTH
0143 #define VKI_S_IXOTH S_IXOTH
0144 #define VKI_S_ISUID S_ISUID
0145 #define VKI_S_ISGID S_ISGID
0146 #define VKI_S_ISVTX S_ISVTX
0147 
0148 #define vki_stat stat
0149 #define vki_stat64 stat64
0150 
0151 #define st_atime      st_atimespec.tv_sec
0152 #define st_atime_nsec st_atimespec.tv_nsec
0153 #define st_mtime      st_mtimespec.tv_sec
0154 #define st_mtime_nsec st_mtimespec.tv_nsec
0155 #define st_ctime      st_ctimespec.tv_sec
0156 #define st_ctime_nsec st_ctimespec.tv_nsec
0157 
0158 
0159 #include <sys/dirent.h>
0160 
0161 #define VKI_MAXNAMLEN MAXNAMLEN
0162 #define vki_dirent dirent
0163 
0164 
0165 #include <sys/socket.h>
0166 #define VKI_SOCK_STREAM SOCK_STREAM
0167 #define VKI_SOCK_DGRAM  SOCK_DGRAM
0168 #define VKI_SOCK_RAW    SOCK_RAW
0169 
0170 #define VKI_AF_UNIX AF_UNIX
0171 #define VKI_AF_INET AF_INET
0172 #define VKI_AF_INET6    AF_INET6
0173 
0174 #define VKI_SOL_SOCKET  SOL_SOCKET
0175 
0176 #define VKI_SO_REUSEADDR SO_REUSEADDR
0177 
0178 #define VKI_SO_SNDBUF   SO_SNDBUF
0179 #define VKI_SO_RCVBUF   SO_RCVBUF
0180 #define VKI_SO_SNDLOWAT SO_SNDLOWAT
0181 #define VKI_SO_RCVLOWAT SO_RCVLOWAT
0182 #define VKI_SO_SNDTIMEO SO_SNDTIMEO
0183 #define VKI_SO_RCVTIMEO SO_RCVTIMEO
0184 #define VKI_SO_ERROR    SO_ERROR
0185 #define VKI_SO_TYPE SO_TYPE
0186 #define VKI_SO_NREAD    SO_NREAD
0187 #define VKI_SO_NKE  SO_NKE
0188 #define VKI_SO_NOSIGPIPE    SO_NOSIGPIPE
0189 #define VKI_SO_NOADDRERR    SO_NOADDRERR
0190 #define VKI_SO_NWRITE   SO_NWRITE
0191 #define VKI_SO_LINGER_SEC   SO_LINGER_SEC
0192 
0193 #define vki_sa_family_t sa_family_t
0194 #define vki_sockaddr sockaddr
0195 #define vki_iovec iovec
0196 #define vki_msghdr msghdr
0197 #define vki_cmsghdr cmsghdr
0198 
0199 
0200 #define VKI_CMSG_ALIGN(a)   ALIGN(a)
0201 #define VKI_CMSG_DATA(cmsg) CMSG_DATA(cmsg)
0202 #define VKI_CMSG_FIRSTHDR(mhdr) CMSG_FIRSTHDR(mhdr)
0203 #define VKI_CMSG_NXTHDR(mhdr, cmsg) CMSG_NXTHDR(mhdr, cmsg)
0204 
0205 #define VKI_SCM_RIGHTS      SCM_RIGHTS
0206 #define VKI_SCM_TIMESTAMP   SCM_TIMESTAMP
0207 #define VKI_SCM_CREDS       SCM_CREDS
0208 
0209 
0210 #include <sys/un.h>
0211 
0212 #define vki_sockaddr_un sockaddr_un
0213 
0214 
0215 #include <netinet/in.h>
0216 
0217 #define vki_in_addr_t in_addr_t
0218 #define vki_in_port_t in_port_t
0219 #define vki_in_addr in_addr
0220 #define vki_sockaddr_in sockaddr_in
0221 
0222 #define VKI_INADDR_LOOPBACK INADDR_LOOPBACK
0223 
0224 
0225 // #include <netinet6/in6.h>
0226 
0227 #define vki_in6_addr in6_addr
0228 #define vki_sockaddr_in6 sockaddr_in6
0229 
0230 
0231 #include <net/if.h>
0232 
0233 #define VKI_IFNAMSIZ    IFNAMSIZ
0234 
0235 #define vki_ifdevmtu ifdevmtu
0236 #define vki_ifreq ifreq
0237 #define vki_ifr_name    ifr_name
0238 #define vki_ifr_addr    ifr_addr
0239 #define vki_ifr_dstaddr ifr_dstaddr
0240 #define vki_ifr_broadaddr   ifr_broadaddr
0241 #define vki_ifr_flags   ifr_flags
0242 #define vki_ifr_metric  ifr_metric
0243 #define vki_ifr_mtu ifr_mtu
0244 #define vki_ifr_phys    ifr_phys
0245 #define vki_ifr_media   ifr_media
0246 #define vki_ifr_data    ifr_data
0247 #define vki_ifr_devmtu  ifr_devmtu
0248 #define vki_ifr_intval  ifr_intval
0249 
0250 #define vki_ifconf ifconf
0251 #define vki_ifc_buf     ifc_buf
0252 #define vki_ifc_req     ifc_req
0253 
0254 
0255 #include <sys/fcntl.h>
0256 
0257 #define VKI_SEEK_SET    SEEK_SET
0258 #define VKI_SEEK_CUR    SEEK_CUR
0259 #define VKI_SEEK_END    SEEK_END
0260 
0261 #define VKI_O_RDONLY    O_RDONLY
0262 #define VKI_O_WRONLY    O_WRONLY
0263 #define VKI_O_RDWR  O_RDWR
0264 #define VKI_O_ACCMODE   O_ACCMODE
0265 #define VKI_O_NONBLOCK  O_NONBLOCK
0266 #define VKI_O_APPEND    O_APPEND
0267 #define VKI_O_SYNC  O_SYN
0268 #define VKI_O_SHLOCK    O_SHLOCK
0269 #define VKI_O_EXLOCK    O_EXLOCK
0270 #define VKI_O_ASYNC O_ASYNC
0271 #define VKI_O_NOFOLLOW  O_NOFOLLOW
0272 #define VKI_O_CREAT O_CREAT
0273 #define VKI_O_TRUNC O_TRUNC
0274 #define VKI_O_EXCL  O_EXCL
0275 #define VKI_O_EVTONLY   O_EVTONLY
0276 
0277 #define VKI_F_DUPFD F_DUPFD
0278 #define VKI_F_GETFD F_GETFD
0279 #define VKI_F_SETFD F_SETFD
0280 #define VKI_F_GETFL F_GETFL
0281 #define VKI_F_SETFL F_SETFL
0282 #define VKI_F_GETOWN    F_GETOWN
0283 #define VKI_F_SETOWN    F_SETOWN
0284 #define VKI_F_GETLK F_GETLK
0285 #define VKI_F_SETLK F_SETLK
0286 #define VKI_F_SETLKW    F_SETLKW
0287 #if DARWIN_VERS >= DARWIN_10_10
0288 #define VKI_F_SETLKWTIMEOUT F_SETLKWTIMEOUT
0289 #endif
0290 
0291 #define VKI_F_CHKCLEAN  F_CHKCLEAN
0292 #define VKI_F_PREALLOCATE   F_PREALLOCATE
0293 #define VKI_F_SETSIZE   F_SETSIZE
0294 #define VKI_F_RDADVISE  F_RDADVISE
0295 #define VKI_F_RDAHEAD   F_RDAHEAD
0296 #define VKI_F_READBOOTSTRAP F_READBOOTSTRAP
0297 #define VKI_F_WRITEBOOTSTRAP    F_WRITEBOOTSTRAP
0298 #define VKI_F_NOCACHE   F_NOCACHE
0299 #define VKI_F_LOG2PHYS  F_LOG2PHYS
0300 #define VKI_F_GETPATH   F_GETPATH
0301 #define VKI_F_ADDSIGS   F_ADDSIGS
0302 #if DARWIN_VERS >= DARWIN_10_9
0303 # define VKI_F_ADDFILESIGS  F_ADDFILESIGS
0304 #endif
0305 #if DARWIN_VERS >= DARWIN_10_11
0306 # define VKI_F_ADDFILESIGS_FOR_DYLD_SIM  F_ADDFILESIGS_FOR_DYLD_SIM
0307 # define VKI_F_BARRIERFSYNC              F_BARRIERFSYNC
0308 # define VKI_F_ADDFILESIGS_RETURN        F_ADDFILESIGS_RETURN
0309 #endif
0310 #define VKI_F_FULLFSYNC F_FULLFSYNC
0311 #define VKI_F_PATHPKG_CHECK F_PATHPKG_CHECK
0312 #define VKI_F_FREEZE_FS F_FREEZE_FS
0313 #define VKI_F_THAW_FS   F_THAW_FS
0314 #define VKI_F_GLOBAL_NOCACHE    F_GLOBAL_NOCACHE
0315 
0316 #define VKI_FD_CLOEXEC  FD_CLOEXEC
0317 
0318 #define vki_radvisory radvisory
0319 #define vki_fstore fstore
0320 #define vki_fbootstraptransfer fbootstraptransfer
0321 #define vki_log2phys log2phys
0322 #define vki_fsignatures_t fsignatures_t
0323 
0324 // These constants aren't in a standard header, they are from the kernel code:
0325 // xnu-1228.3.13/bsd/sys/codesign.h
0326 // Mac OS X 10.5.6 - Darwin 9.6
0327 #define VKI_CS_OPS_STATUS           0       /* return status */
0328 #define VKI_CS_OPS_MARKINVALID      1       /* invalidate process */
0329 #define VKI_CS_OPS_MARKHARD         2       /* set HARD flag */
0330 #define VKI_CS_OPS_MARKKILL         3       /* set KILL flag (sticky) */
0331 #define VKI_CS_OPS_PIDPATH          4       /* get executable's pathname */
0332 #define VKI_CS_OPS_CDHASH           5       /* get code directory hash */
0333 
0334 #include <sys/mman.h>
0335 
0336 #define VKI_PROT_NONE   PROT_NONE
0337 #define VKI_PROT_READ   PROT_READ
0338 #define VKI_PROT_WRITE  PROT_WRITE
0339 #define VKI_PROT_EXEC   PROT_EXEC
0340 
0341 #define VKI_MAP_SHARED  MAP_SHARED
0342 #define VKI_MAP_PRIVATE MAP_PRIVATE
0343 #define VKI_MAP_FIXED   MAP_FIXED
0344 #define VKI_MAP_RENAME  MAP_RENAME
0345 #define VKI_MAP_NORESERVE   MAP_NORESERVE
0346 #define VKI_MAP_RESERVED0080    MAP_RESERVED0080
0347 #define VKI_MAP_NOEXTEND    MAP_NOEXTEND
0348 #define VKI_MAP_HASSEMAPHORE    MAP_HASSEMAPHORE
0349 #define VKI_MAP_FILE    MAP_FILE
0350 #define VKI_MAP_ANON    MAP_ANON
0351 #define VKI_MAP_FAILED  MAP_FAILED
0352 
0353 
0354 #include <mach/vm_param.h>
0355 
0356 #define VKI_PAGE_SHIFT PAGE_SHIFT
0357 #define VKI_PAGE_SIZE PAGE_SIZE
0358 #define VKI_PAGE_MASK PAGE_MASK
0359 
0360 
0361 #include <sys/vmparam.h>
0362 
0363 #define VKI_USRSTACK USRSTACK
0364 #define VKI_USRSTACK64 USRSTACK64
0365 
0366 
0367 #include <mach/mach_time.h>
0368 
0369 #define vki_mach_timebase_info mach_timebase_info
0370 
0371 
0372 #include <sys/syslimits.h>
0373 
0374 #define VKI_PATH_MAX PATH_MAX
0375 
0376 
0377 #include <sys/param.h>
0378 
0379 #define VKI_MAXPATHLEN MAXPATHLEN
0380 
0381 
0382 #include <sys/signal.h>
0383 
0384 /* While we fully intend to make 'vki_sigset_t' match the native
0385    Darwin 'sigset_t', we can't just clone the Darwin sigset_t type,
0386    because it isn't an array, and the VG_(sigfillset) etc functions
0387    assume it is.  So instead define another isomorphic type, and check
0388    in VG_(vki_do_initial_consistency_checks) that it really is
0389    correct. */
0390 /* #define vki_sigset_t sigset_t */
0391 #define _VKI_NSIG_BPW   32
0392 #define _VKI_NSIG       32
0393 #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
0394 typedef struct {
0395    UInt sig[_VKI_NSIG_WORDS];
0396 } vki_sigset_t;
0397 /* and now let VG_(vki_do_initial_consistency_checks) make sure it
0398    matches 'sigset_t'. */
0399 
0400 
0401 #define VKI_SS_ONSTACK  SS_ONSTACK
0402 #define VKI_SS_DISABLE  SS_DISABLE
0403 #define VKI_MINSIGSTKSZ MINSIGSTKSZ
0404 #define VKI_SIGSTKSZ    SIGSTKSZ
0405 
0406 #define vki_stack_t        stack_t
0407 #define vki_siginfo_t      siginfo_t
0408 
0409 /* There are two versions of this.  'struct __sigaction' is used for
0410    passing sigactions to the kernel interface, and has the added
0411    complexity of requiring an extra pointer to a new demultiplexing
0412    function to be run in user space.  'struct sigaction' is used for
0413    receiving old sigactions from the kernel, and lacks this
0414    demux-function pointer.  So the type of the second and third
0415    parameters in Darwin's sys_sigaction appear to be different,
0416    respectively 'struct __sigaction*' and 'struct sigaction*'.
0417 */
0418 //#define vki_sigaction      __sigaction
0419 //#define vki_user_sigaction sigaction
0420 //#define vki_sigaltstack    sigaltstack
0421 //#define vki_sigval         sigval
0422 //#define vki_sigaction_u    sigaction_u
0423 //#define vki_sigaction     sigaction
0424 
0425 //typedef  struct __sigaction  vki_sigaction_toK_t;
0426 //typedef  struct sigaction    vki_sigaction_fromK_t;
0427 
0428 typedef
0429    struct {
0430       void* ksa_handler;
0431       void (*sa_tramp)(void*,UWord,UWord,void*,void*);
0432       vki_sigset_t sa_mask;
0433       int sa_flags;
0434    }
0435    vki_sigaction_toK_t;
0436 
0437 typedef
0438    struct {
0439       void* ksa_handler;
0440       vki_sigset_t sa_mask;
0441       int sa_flags;
0442    }
0443    vki_sigaction_fromK_t;
0444 
0445 
0446 
0447 /* and /usr/include/sys/signal.c in turn defines 'sa_handler' to
0448    be '__sigaction_u.__sa_handler' */
0449 //#define   ksa_handler      sa_handler
0450 
0451 //#define   vki_sa_sigaction sa_sigaction
0452 
0453 #define VKI_SA_ONSTACK  SA_ONSTACK
0454 #define VKI_SA_RESTART  SA_RESTART
0455 #define VKI_SA_DISABLE  SA_DISABLE
0456 #define VKI_SA_RESETHAND    SA_RESETHAND
0457 #define VKI_SA_NOCLDSTOP    SA_NOCLDSTOP
0458 #define VKI_SA_NODEFER  SA_NODEFER
0459 #define VKI_SA_NOCLDWAIT    SA_NOCLDWAIT
0460 #define VKI_SA_SIGINFO  SA_SIGINFO
0461 #define VKI_SA_USERTRAMP    SA_USERTRAMP
0462 #define VKI_SA_64REGSET SA_64REGSET
0463 #define VKI_SA_RESTORER  0 /* Darwin doesn't have this */
0464 
0465 #define VKI_SIG_BLOCK   SIG_BLOCK
0466 #define VKI_SIG_UNBLOCK SIG_UNBLOCK
0467 #define VKI_SIG_SETMASK SIG_SETMASK
0468 
0469 #define VKI_SIGHUP  SIGHUP
0470 #define VKI_SIGINT  SIGINT
0471 #define VKI_SIGQUIT SIGQUIT
0472 #define VKI_SIGILL  SIGILL
0473 #define VKI_SIGTRAP SIGTRAP
0474 #define VKI_SIGABRT SIGABRT
0475 #define VKI_SIGPOLL SIGPOLL
0476 #define VKI_SIGFPE  SIGFPE
0477 #define VKI_SIGKILL SIGKILL
0478 #define VKI_SIGBUS  SIGBUS
0479 #define VKI_SIGSEGV SIGSEGV
0480 #define VKI_SIGSYS  SIGSYS
0481 #define VKI_SIGPIPE SIGPIPE
0482 #define VKI_SIGALRM SIGALRM
0483 #define VKI_SIGTERM SIGTERM
0484 #define VKI_SIGURG  SIGURG
0485 #define VKI_SIGSTOP SIGSTOP
0486 #define VKI_SIGTSTP SIGTSTP
0487 #define VKI_SIGCONT SIGCONT
0488 #define VKI_SIGCHLD SIGCHLD
0489 #define VKI_SIGTTIN SIGTTIN
0490 #define VKI_SIGTTOU SIGTTOU
0491 #define VKI_SIGIO   SIGIO
0492 #define VKI_SIGXCPU SIGXCPU
0493 #define VKI_SIGXFSZ SIGXFSZ
0494 #define VKI_SIGVTALRM   SIGVTALRM
0495 #define VKI_SIGPROF SIGPROF
0496 #define VKI_SIGWINCH    SIGWINCH
0497 #define VKI_SIGINFO SIGINFO
0498 #define VKI_SIGUSR1 SIGUSR1
0499 #define VKI_SIGUSR2 SIGUSR2
0500 
0501 #define VKI_SIG_DFL     SIG_DFL
0502 #define VKI_SIG_IGN     SIG_IGN
0503 
0504 
0505 #define VKI_SI_USER      SI_USER
0506 #define VKI_SEGV_MAPERR  SEGV_MAPERR
0507 #define VKI_SEGV_ACCERR  SEGV_ACCERR
0508 #define VKI_ILL_ILLOPC   ILL_ILLOPC
0509 #define VKI_ILL_ILLOPN   ILL_ILLOPN
0510 #define VKI_ILL_ILLADR   ILL_ILLADR
0511 #define VKI_ILL_ILLTRP   ILL_ILLTRP
0512 #define VKI_ILL_PRVOPC   ILL_PRVOPC
0513 #define VKI_ILL_PRVREG   ILL_PRVREG
0514 #define VKI_ILL_COPROC   ILL_COPROC
0515 #define VKI_ILL_BADSTK   ILL_BADSTK
0516 #define VKI_FPE_INTDIV   FPE_INTDIV
0517 #define VKI_FPE_INTOVF   FPE_INTOVF
0518 #define VKI_FPE_FLTDIV   FPE_FLTDIV
0519 #define VKI_FPE_FLTOVF   FPE_FLTOVF
0520 #define VKI_FPE_FLTUND   FPE_FLTUND
0521 #define VKI_FPE_FLTRES   FPE_FLTRES
0522 #define VKI_FPE_FLTINV   FPE_FLTINV
0523 #define VKI_FPE_FLTSUB   FPE_FLTSUB
0524 #define VKI_BUS_ADRALN   BUS_ADRALN
0525 #define VKI_BUS_ADRERR   BUS_ADRERR
0526 #define VKI_BUS_OBJERR   BUS_OBJERR
0527 #define VKI_TRAP_BRKPT   TRAP_BRKPT
0528 #define VKI_CLD_EXITED   CLD_EXITED
0529 #define VKI_CLD_KILLED   CLD_KILLED
0530 #define VKI_CLD_DUMPED   CLD_DUMPED
0531 #define VKI_CLD_TRAPPED  CLD_TRAPPED
0532 #define VKI_CLD_STOPPED  CLD_STOPPED
0533 #define VKI_CLD_CONTINUED CLD_CONTINUED
0534 
0535 /* JRS: not 100% sure, but I think these two are correct */
0536 #define VKI_SA_ONESHOT   SA_RESETHAND
0537 #define VKI_SA_NOMASK    SA_NODEFER
0538 
0539 #define VKI_UC_SET_ALT_STACK   0x40000000
0540 #define VKI_UC_RESET_ALT_STACK 0x80000000
0541 
0542 
0543 #include <sys/errno.h>
0544 
0545 #define VKI_EPERM       EPERM
0546 #define VKI_ENOENT      ENOENT
0547 #define VKI_ESRCH       ESRCH
0548 #define VKI_EINTR       EINTR
0549 #define VKI_EIO         EIO
0550 #define VKI_ENXIO       ENXIO
0551 #define VKI_E2BIG       E2BIG
0552 #define VKI_ENOEXEC     ENOEXEC
0553 #define VKI_EBADF       EBADF
0554 #define VKI_ECHILD      ECHILD
0555 #define VKI_EDEADLK     EDEADLK
0556 #define VKI_ENOMEM      ENOMEM
0557 #define VKI_EACCES      EACCES
0558 #define VKI_EFAULT      EFAULT
0559 #define VKI_ENOTBLK     ENOTBLK
0560 #define VKI_EBUSY       EBUSY
0561 #define VKI_EEXIST      EEXIST
0562 #define VKI_EXDEV       EXDEV
0563 #define VKI_ENODEV      ENODEV
0564 #define VKI_ENOTDIR     ENOTDIR
0565 #define VKI_EISDIR      EISDIR
0566 #define VKI_EINVAL      EINVAL
0567 #define VKI_ENFILE      ENFILE
0568 #define VKI_EMFILE      EMFILE
0569 #define VKI_ENOTTY      ENOTTY
0570 #define VKI_ETXTBSY     ETXTBSY
0571 #define VKI_EFBIG       EFBIG
0572 #define VKI_ENOSPC      ENOSPC
0573 #define VKI_ESPIPE      ESPIPE
0574 #define VKI_EROFS       EROFS
0575 #define VKI_EMLINK      EMLINK
0576 #define VKI_EPIPE       EPIPE
0577 #define VKI_EDOM        EDOM
0578 #define VKI_ERANGE      ERANGE
0579 #define VKI_EAGAIN      EAGAIN
0580 #define VKI_EWOULDBLOCK     EAGAIN
0581 #define VKI_EINPROGRESS     EINPROGRESS
0582 #define VKI_EALREADY        EALREADY
0583 #define VKI_ENOTSOCK        ENOTSOCK
0584 #define VKI_EDESTADDRREQ    EDESTADDRREQ
0585 #define VKI_EMSGSIZE        EMSGSIZE
0586 #define VKI_EPROTOTYPE      EPROTOTYPE
0587 #define VKI_ENOPROTOOPT     ENOPROTOOPT
0588 #define VKI_EPROTONOSUPPORT EPROTONOSUPPORT
0589 #define VKI_ESOCKTNOSUPPORT ESOCKTNOSUPPORT
0590 #define VKI_ENOTSUP     ENOTSUP
0591 #define VKI_EPFNOSUPPORT    EPFNOSUPPORT
0592 #define VKI_EAFNOSUPPORT    EAFNOSUPPORT
0593 #define VKI_EADDRINUSE      EADDRINUSE
0594 #define VKI_EADDRNOTAVAIL   EADDRNOTAVAIL
0595 #define VKI_ENETDOWN        ENETDOWN
0596 #define VKI_ENETUNREACH     ENETUNREACH
0597 #define VKI_ENETRESET       ENETRESET
0598 #define VKI_ECONNABORTED    ECONNABORTED
0599 #define VKI_ECONNRESET      ECONNRESET
0600 #define VKI_ENOBUFS     ENOBUFS
0601 #define VKI_EISCONN     EISCONN
0602 #define VKI_ENOTCONN        ENOTCONN
0603 #define VKI_ESHUTDOWN       ESHUTDOWN
0604 #define VKI_ETOOMANYREFS    ETOOMANYREFS
0605 #define VKI_ETIMEDOUT       ETIMEDOUT
0606 #define VKI_ECONNREFUSED    ECONNREFUSED
0607 #define VKI_ELOOP       ELOOP
0608 #define VKI_ENAMETOOLONG    ENAMETOOLONG
0609 #define VKI_EHOSTDOWN       EHOSTDOWN
0610 #define VKI_EHOSTUNREACH    EHOSTUNREACH
0611 #define VKI_ENOTEMPTY       ENOTEMPTY
0612 #define VKI_EPROCLIM        EPROCLIM
0613 #define VKI_EUSERS      EUSERS
0614 #define VKI_EDQUOT      EDQUOT
0615 #define VKI_ESTALE      ESTALE
0616 #define VKI_EREMOTE     EREMOTE
0617 #define VKI_EBADRPC     EBADRPC
0618 #define VKI_ERPCMISMATCH    ERPCMISMATCH
0619 #define VKI_EPROGUNAVAIL    EPROGUNAVAIL
0620 #define VKI_EPROGMISMATCH   EPROGMISMATCH
0621 #define VKI_EPROCUNAVAIL    EPROCUNAVAIL
0622 #define VKI_ENOLCK      ENOLCK
0623 #define VKI_ENOSYS      ENOSYS
0624 #define VKI_EFTYPE      EFTYPE
0625 #define VKI_EAUTH       EAUTH
0626 #define VKI_ENEEDAUTH       ENEEDAUTH
0627 #define VKI_EPWROFF     EPWROFF
0628 #define VKI_EDEVERR     EDEVERR
0629 #define VKI_EOVERFLOW       EOVERFLOW
0630 #define VKI_EBADEXEC        EBADEXEC
0631 #define VKI_EBADARCH        EBADARCH
0632 #define VKI_ESHLIBVERS      ESHLIBVERS
0633 #define VKI_EBADMACHO       EBADMACHO
0634 #define VKI_ECANCELED       ECANCELED
0635 #define VKI_EIDRM       EIDRM
0636 #define VKI_ENOMSG      ENOMSG
0637 #define VKI_EILSEQ      EILSEQ
0638 #define VKI_ENOATTR     ENOATTR
0639 #define VKI_EBADMSG     EBADMSG
0640 #define VKI_EMULTIHOP       EMULTIHOP
0641 #define VKI_ENODATA     ENODATA
0642 #define VKI_ENOLINK     ENOLINK
0643 #define VKI_ENOSR       ENOSR
0644 #define VKI_ENOSTR      ENOSTR
0645 #define VKI_EPROTO      EPROTO
0646 #define VKI_ETIME       ETIME
0647 #define VKI_EOPNOTSUPP      EOPNOTSUPP
0648 #define VKI_ELAST       ELAST
0649 
0650 
0651 #include <sys/resource.h>
0652 
0653 #define VKI_RLIMIT_CPU      RLIMIT_CPU
0654 #define VKI_RLIMIT_FSIZE    RLIMIT_FSIZE
0655 #define VKI_RLIMIT_DATA     RLIMIT_DATA
0656 #define VKI_RLIMIT_STACK    RLIMIT_STACK
0657 #define VKI_RLIMIT_CORE     RLIMIT_CORE
0658 #define VKI_RLIMIT_AS       RLIMIT_AD
0659 #define VKI_RLIMIT_RSS      RLIMIT_AS
0660 #define VKI_RLIMIT_MEMLOCK  RLIMIT_MEMLOCK
0661 #define VKI_RLIMIT_NPROC    RLIMIT_NPROC
0662 #define VKI_RLIMIT_NOFILE   RLIMIT_NOFILE
0663 #define VKI_RLIM_NLIMITS    RLIM_NLIMITS
0664 
0665 #define vki_rlim_t rlim_t
0666 #define vki_rlimit rlimit
0667 #define vki_rusage rusage
0668 
0669 
0670 #include <sys/poll.h>
0671 
0672 #define vki_pollfd pollfd
0673 
0674 
0675 #include <sys/ipc.h>
0676 
0677 #define VKI_IPC_RMID    IPC_RMID
0678 #define VKI_IPC_SET IPC_SET
0679 #define VKI_IPC_STAT    IPC_STAT
0680 
0681 #define vki_key_t key_t
0682 #define vki_ipc_perm ipc_perm
0683 
0684 
0685 #include <sys/sem.h>
0686 
0687 #define VKI_GETNCNT GETNCNT
0688 #define VKI_GETPID  GETPID
0689 #define VKI_GETVAL  GETVAL
0690 #define VKI_GETALL  GETALL
0691 #define VKI_GETZCNT GETZCNT
0692 #define VKI_SETVAL  SETVAL
0693 #define VKI_SETALL  SETALL
0694 
0695 #define vki_sembuf sembuf
0696 #define vki_semid_ds semid_ds
0697 #define vki_semun semun
0698 
0699 
0700 #include <sys/semaphore.h>
0701 
0702 #define vki_sem_t sem_t
0703 
0704 
0705 #include <sys/mount.h>
0706 
0707 #define VKI_MFSNAMELEN  MFSNAMELEN
0708 #define VKI_MNAMELEN    MNAMELEN
0709 
0710 #define vki_fsid fsid
0711 #define vki_fsid_t fsid_t
0712 #define vki_statfs statfs
0713 #define vki_statfs64 statfs64
0714 
0715 
0716 #include <sys/select.h>
0717 
0718 #define vki_fd_set fd_set
0719 
0720 
0721 #include <sys/msgbuf.h>
0722 
0723 #define VKI_MSG_BSIZE   MSG_BSIZE
0724 #define VKI_MSG_MAGIC   MSG_MAGIC
0725 #define vki_msgbuf msgbuf
0726 
0727 
0728 #include <sys/shm.h>
0729 
0730 #define VKI_SHM_RDONLY  SHM_RDONLY
0731 #define VKI_SHM_RND SHM_RND
0732 #define VKI_SHMLBA  SHMLBA
0733 
0734 #define vki_shmid_ds shmid_ds
0735 
0736 
0737 #include <sys/times.h>
0738 
0739 #define vki_tms tms
0740 
0741 
0742 #include <sys/utsname.h>
0743 
0744 #define _VKI_SYS_NAMELEN    _SYS_NAMELEN
0745 #define vki_new_utsname utsname
0746 
0747 
0748 #include <sys/unistd.h>
0749 
0750 #define VKI_F_OK    F_OK
0751 #define VKI_X_OK    X_OK
0752 #define VKI_W_OK    W_OK
0753 #define VKI_R_OK    R_OK
0754 
0755 #define vki_accessx_descriptor         accessx_descriptor
0756 #define VKI_ACCESSX_MAX_DESCRIPTORS    ACCESSX_MAX_DESCRIPTORS
0757 
0758 #include <sys/sysctl.h>
0759 
0760 #define VKI_CTL_MAXNAME     CTL_MAXNAME
0761 
0762 #define VKI_CTL_UNSPEC      CTL_UNSPEC
0763 #define VKI_CTL_KERN        CTL_KERN
0764 #define VKI_CTL_VM      CTL_VM
0765 #define VKI_CTL_VFS     CTL_VFS
0766 #define VKI_CTL_NET     CTL_NET
0767 #define VKI_CTL_DEBUG       CTL_DEBUG
0768 #define VKI_CTL_HW      CTL_HW
0769 #define VKI_CTL_MACHDEP     CTL_MACHDEP
0770 #define VKI_CTL_USER        CTL_USER
0771 #define VKI_CTL_MAXID       CTL_MAXID
0772 
0773 #define VKI_HW_MACHINE      HW_MACHINE
0774 #define VKI_HW_MODEL        HW_MODEL
0775 #define VKI_HW_NCPU     HW_NCPU
0776 #define VKI_HW_BYTEORDER    HW_BYTEORDER
0777 #define VKI_HW_PHYSMEM      HW_PHYSMEM
0778 #define VKI_HW_USERMEM      HW_USERMEM
0779 #define VKI_HW_PAGESIZE     HW_PAGESIZE
0780 #define VKI_HW_DISKNAMES    HW_DISKNAMES
0781 #define VKI_HW_DISKSTATS    HW_DISKSTATS
0782 #define VKI_HW_EPOCH        HW_EPOCH
0783 #define VKI_HW_FLOATINGPT   HW_FLOATINGPT
0784 #define VKI_HW_MACHINE_ARCH HW_MACHINE_ARCH
0785 #define VKI_HW_VECTORUNIT   HW_VECTORUNIT
0786 #define VKI_HW_BUS_FREQ     HW_BUS_FREQ
0787 #define VKI_HW_CPU_FREQ     HW_CPU_FREQ
0788 #define VKI_HW_CACHELINE    HW_CACHELINE
0789 #define VKI_HW_L1ICACHESIZE HW_L1ICACHESIZE
0790 #define VKI_HW_L1DCACHESIZE HW_L1DCACHESIZE
0791 #define VKI_HW_L2SETTINGS   HW_L2SETTINGS
0792 #define VKI_HW_L2CACHESIZE  HW_L2CACHESIZE
0793 #define VKI_HW_L3SETTINGS   HW_L3SETTINGS
0794 #define VKI_HW_L3CACHESIZE  HW_L3CACHESIZE
0795 #define VKI_HW_TB_FREQ      HW_TB_FREQ
0796 #define VKI_HW_MEMSIZE      HW_MEMSIZE
0797 #define VKI_HW_AVAILCPU     MW_AVAILCPU
0798 #define VKI_HW_MAXID        MW_MAXID
0799 
0800 #define VKI_KERN_USRSTACK32 KERN_USRSTACK32
0801 #define VKI_KERN_USRSTACK64 KERN_USRSTACK64
0802 
0803 
0804 #include <sys/attr.h>
0805 
0806 #define vki_attrlist attrlist
0807 
0808 
0809 #include <sys/event.h>
0810 
0811 #define vki_kevent kevent
0812 #define vki_kevent64 kevent64_s
0813 
0814 // xnu_root/bsd/sys/event.h
0815 
0816 struct vki_kevent_qos_s {
0817     uint64_t    ident;      /* identifier for this event */
0818     int16_t     filter;     /* filter for event */
0819     uint16_t    flags;      /* general flags */
0820     int32_t     qos;        /* quality of service */
0821     uint64_t    udata;      /* opaque user data identifier */
0822     uint32_t    fflags;     /* filter-specific flags */
0823     uint32_t    xflags;     /* extra filter-specific flags */
0824     int64_t     data;       /* filter-specific data */
0825     uint64_t    ext[4];     /* filter-specific extensions */
0826 };
0827 
0828 #include <sys/ev.h>
0829 
0830 typedef struct eventreq vki_eventreq;
0831 
0832 
0833 #include <sys/acl.h>
0834 
0835 #define vki_kauth_filesec kauth_filesec
0836 
0837 
0838 #include <sys/ptrace.h>
0839 
0840 #define VKI_PTRACE_TRACEME   PT_TRACE_ME
0841 #define VKI_PTRACE_DETACH    PT_DETACH
0842 
0843 
0844 // sqlite/src/os_unix.c
0845 
0846 struct ByteRangeLockPB2
0847 {
0848     unsigned long long offset;        /* offset to first byte to lock */
0849     unsigned long long length;        /* nbr of bytes to lock */
0850     unsigned long long retRangeStart; /* nbr of 1st byte locked if successful */
0851     unsigned char unLockFlag;         /* 1 = unlock, 0 = lock */
0852     unsigned char startEndFlag;       /* 1=rel to end of fork, 0=rel to start */
0853     int fd;                           /* file desc to assoc this lock with */
0854 };
0855 
0856 #define afpfsByteRangeLock2FSCTL _IOWR('z', 23, struct ByteRangeLockPB2)
0857 
0858 #define vki_ByteRangeLockPB2 ByteRangeLockPB2
0859 #define VKI_afpfsByteRangeLock2FSCTL afpfsByteRangeLock2FSCTL
0860 
0861 
0862 // xnu/bsd/sys/fsctl.h
0863 
0864 #define VKI_FSIOC_SYNC_VOLUME        _IOW('A', 1, uint32_t)
0865 
0866 
0867 // libpthread/kern/workqueue_internal.h
0868 
0869 #define VKI_WQOPS_QUEUE_ADD                    1
0870 #define VKI_WQOPS_QUEUE_REMOVE                 2
0871 #define VKI_WQOPS_THREAD_RETURN                4  /* parks the thread back into the kernel */
0872 #define VKI_WQOPS_THREAD_SETCONC               8
0873 #define VKI_WQOPS_QUEUE_NEWSPISUPP            16  /* check for newer SPI support */
0874 #define VKI_WQOPS_QUEUE_REQTHREADS            32  /* request number of threads of a prio */
0875 #define VKI_WQOPS_QUEUE_REQTHREADS2           48  /* request a number of threads in a given priority bucket */
0876 #define VKI_WQOPS_THREAD_KEVENT_RETURN        64  /* parks the thread after delivering the passed kevent array */
0877 #define VKI_WQOPS_SET_EVENT_MANAGER_PRIORITY 128  /* max() in the provided priority in the the priority of the event manager */
0878 #define VKI_WQOPS_THREAD_WORKLOOP_RETURN     256  /* parks the thread after delivering the passed kevent array */
0879 #define VKI_WQOPS_SHOULD_NARROW              512  /* checks whether we should narrow our concurrency */
0880 
0881 
0882 #include <sys/ttycom.h>
0883 
0884 #define vki_winsize winsize
0885 
0886 #define VKI_TIOCMODG    TIOCMODG
0887 #define VKI_TIOCMODS    TIOCMODS
0888 #define VKI_TIOCEXCL    TIOCEXCL
0889 #define VKI_TIOCNXCL    TIOCNXCL
0890 #define VKI_TIOCFLUSH   TIOCFLUSH
0891 #define VKI_TIOCGETA    TIOCGETA
0892 #define VKI_TIOCSETA    TIOCSETA
0893 #define VKI_TIOCSETAW   TIOCSETAW
0894 #define VKI_TIOCSETAF   TIOCSETAF
0895 #define VKI_TIOCGETD    TIOCGETD
0896 #define VKI_TIOCSETD    TIOCSETD
0897 #define VKI_TIOCSBRK    TIOCSBRK
0898 #define VKI_TIOCCBRK    TIOCCBRK
0899 #define VKI_TIOCSDTR    TIOCSDTR
0900 #define VKI_TIOCCDTR    TIOCCDTR
0901 #define VKI_TIOCGPGRP   TIOCGPGRP
0902 #define VKI_TIOCSPGRP   TIOCSPGRP
0903 #define VKI_TIOCOUTQ    TIOCOUTQ
0904 #define VKI_TIOCSTI TIOCSTI
0905 #define VKI_TIOCNOTTY   TIOCNOTTY
0906 #define VKI_TIOCPKT TIOCPKT
0907 #define VKI_TIOCSTOP    TIOCSTOP
0908 #define VKI_TIOCSTART   TIOCSTART
0909 #define VKI_TIOCMSET    TIOCMSET
0910 #define VKI_TIOCMBIS    TIOCMBIS
0911 #define VKI_TIOCMBIC    TIOCMBIC
0912 #define VKI_TIOCMGET    TIOCMGET
0913 #define VKI_TIOCREMOTE  TIOCREMOTE
0914 #define VKI_TIOCGWINSZ  TIOCGWINSZ
0915 #define VKI_TIOCSWINSZ  TIOCSWINSZ
0916 #define VKI_TIOCUCNTL   TIOCUCNTL
0917 #define VKI_TIOCSTAT    TIOCSTAT
0918 #define VKI_UIOCCMD(n)  UIOCCMD(n)
0919 #define VKI_TIOCSCONS   TIOCSCONS
0920 #define VKI_TIOCCONS    TIOCCONS
0921 #define VKI_TIOCSCTTY   TIOCSCTTY
0922 #define VKI_TIOCEXT TIOCEXT
0923 #define VKI_TIOCSIG TIOCSIG
0924 #define VKI_TIOCDRAIN   TIOCDRAIN
0925 #define VKI_TIOCMSDTRWAIT   TIOCMSDTRWAIT
0926 #define VKI_TIOCMGDTRWAIT   TIOCMGDTRWAIT
0927 #define VKI_TIOCTIMESTAMP   TIOCTIMESTAMP
0928 #define VKI_TIOCDCDTIMESTAMP    TIOCDCDTIMESTAMP
0929 #define VKI_TIOCSDRAINWAIT  TIOCSDRAINWAIT
0930 #define VKI_TIOCGDRAINWAIT  TIOCGDRAINWAIT
0931 #define VKI_TIOCDSIMICROCODE    TIOCDSIMICROCODE
0932 #define VKI_TIOCPTYGRANT    TIOCPTYGRANT
0933 #define VKI_TIOCPTYGNAME    TIOCPTYGNAME
0934 #define VKI_TIOCPTYUNLK TIOCPTYUNLK
0935 
0936 
0937 #include <sys/filio.h>
0938 
0939 #define VKI_FIOCLEX FIOCLEX
0940 #define VKI_FIONCLEX    FIONCLEX
0941 #define VKI_FIONREAD    FIONREAD
0942 #define VKI_FIONBIO FIONBIO
0943 #define VKI_FIOASYNC    FIOASYNC
0944 #define VKI_FIOSETOWN   FIOSETOWN
0945 #define VKI_FIOGETOWN   FIOGETOWN
0946 #define VKI_FIODTYPE    FIODTYPE
0947 
0948 
0949 #include <sys/sockio.h>
0950 
0951 #define VKI_SIOCSHIWAT  SIOCSHIWAT
0952 #define VKI_SIOCGHIWAT  SIOCGHIWAT
0953 #define VKI_SIOCSLOWAT  SIOCSLOWAT
0954 #define VKI_SIOCGLOWAT  SIOCGLOWAT
0955 #define VKI_SIOCATMARK  SIOCATMARK
0956 #define VKI_SIOCSPGRP   SIOCSPGRP
0957 #define VKI_SIOCGPGRP   SIOCGPGRP
0958 
0959 #define VKI_SIOCSIFADDR     SIOCSIFADDR
0960 #define VKI_OSIOCGIFADDR    OSIOCGIFADDR
0961 #define VKI_SIOCSIFDSTADDR  SIOCSIFDSTADDR
0962 #define VKI_OSIOCGIFDSTADDR OSIOCGIFDSTADDR
0963 #define VKI_SIOCSIFFLAGS    SIOCSIFFLAGS
0964 #define VKI_SIOCGIFFLAGS    SIOCGIFFLAGS
0965 #define VKI_OSIOCGIFBRDADDR OSIOCGIFBRDADDR
0966 #define VKI_SIOCSIFBRDADDR  SIOCSIFBRDADDR
0967 #define VKI_OSIOCGIFCONF    OSIOCGIFCONF
0968 #define VKI_OSIOCGIFNETMASK OSIOCGIFNETMASK
0969 #define VKI_SIOCSIFNETMASK  SIOCSIFNETMASK
0970 #define VKI_SIOCGIFMETRIC   SIOCGIFMETRIC
0971 #define VKI_SIOCSIFMETRIC   SIOCSIFMETRIC
0972 #define VKI_SIOCDIFADDR     SIOCDIFADDR
0973 #define VKI_SIOCAIFADDR     SIOCAIFADDR
0974 #define VKI_SIOCGETVIFCNT   SIOCGETVIFCNT
0975 #define VKI_SIOCGETSGCNT    SIOCGETSGCNT
0976 #define VKI_SIOCALIFADDR    SIOCALIFADDR
0977 #define VKI_SIOCGLIFADDR    SIOCGLIFADDR
0978 #define VKI_SIOCDLIFADDR    SIOCDLIFADDR
0979 
0980 #define VKI_SIOCGIFADDR     SIOCGIFADDR
0981 #define VKI_SIOCGIFDSTADDR  SIOCGIFDSTADDR
0982 #define VKI_SIOCGIFBRDADDR  SIOCGIFBRDADDR
0983 #define VKI_SIOCGIFCONF     SIOCGIFCONF
0984 #define VKI_SIOCGIFNETMASK  SIOCGIFNETMASK
0985 #define VKI_SIOCAUTOADDR    SIOCAUTOADDR
0986 #define VKI_SIOCAUTONETMASK SIOCAUTONETMASK
0987 #define VKI_SIOCARPIPLL     SIOCARPIPLL
0988 
0989 #define VKI_SIOCADDMULTI    SIOCADDMULTI
0990 #define VKI_SIOCDELMULTI    SIOCDELMULTI
0991 #define VKI_SIOCGIFMTU      SIOCGIFMTU
0992 #define VKI_SIOCSIFMTU      SIOCSIFMTU
0993 #define VKI_SIOCGIFPHYS     SIOCGIFPHYS
0994 #define VKI_SIOCSIFPHYS     SIOCSIFPHYS
0995 #define VKI_SIOCSIFMEDIA    SIOCSIFMEDIA
0996 #define VKI_SIOCGIFMEDIA    SIOCGIFMEDIA
0997 #define VKI_SIOCSIFGENERIC  SIOCSIFGENERIC
0998 #define VKI_SIOCGIFGENERIC  SIOCGIFGENERIC
0999 #define VKI_SIOCRSLVMULTI       SIOCRSLVMULTI
1000 
1001 #define VKI_SIOCSIFLLADDR   SIOCSIFLLADDR
1002 #define VKI_SIOCGIFSTATUS   SIOCGIFSTATUS
1003 #define VKI_SIOCSIFPHYADDR      SIOCSIFPHYADDR
1004 #define VKI_SIOCGIFPSRCADDR SIOCGIFPSRCADDR
1005 #define VKI_SIOCGIFPDSTADDR SIOCGIFPDSTADDR
1006 #define VKI_SIOCDIFPHYADDR  SIOCDIFPHYADDR
1007 #define VKI_SIOCSLIFPHYADDR SIOCSLIFPHYADDR
1008 #define VKI_SIOCGLIFPHYADDR SIOCGLIFPHYADDR
1009 
1010 #define VKI_SIOCGIFDEVMTU   SIOCGIFDEVMTU
1011 #define VKI_SIOCSIFALTMTU   SIOCSIFALTMTU
1012 #define VKI_SIOCGIFALTMTU   SIOCGIFALTMTU
1013 #define VKI_SIOCSIFBOND     SIOCSIFBOND
1014 #define VKI_SIOCGIFBOND     SIOCGIFBOND
1015 #define VKI_SIOCIFCREATE    SIOCIFCREATE
1016 #define VKI_SIOCIFDESTROY   SIOCIFDESTROY
1017 #define VKI_SIOCSIFVLAN     SIOCSIFVLAN
1018 #define VKI_SIOCGIFVLAN     SIOCGIFVLAN
1019 
1020 #define VKI_SIOCSETVLAN     SIOCSIFVLAN
1021 #define VKI_SIOCGETVLAN     SIOCGIFVLAN
1022 
1023 #define VKI_SIOCGIFASYNCMAP     SIOCGIFASYNCMAP
1024 #define VKI_SIOCSIFASYNCMAP     SIOCSIGASYNCMAP
1025 
1026 
1027 #include <sys/dtrace.h>
1028 
1029 #define VKI_DTRACEHIOC_REMOVE   DTRACEHIOC_REMOVE
1030 #define VKI_DTRACEHIOC_ADDDOF   DTRACEHIOC_ADDDOF
1031 
1032 
1033 #include <net/bpf.h>
1034 
1035 #define vki_bpf_program bpf_program
1036 #define vki_bf_len bf_len
1037 #define vki_bf_insns bf_insns
1038 #define vki_bpf_dltlist bpf_dltlist
1039 #define vki_bfl_len bfl_len
1040 #define vki_bfl_list bfl_list
1041 
1042 #define VKI_BIOCSETF        BIOCSETF
1043 #define VKI_BIOCFLUSH       BIOCFLUSH
1044 #define VKI_BIOCPROMISC     BIOCPROMISC
1045 #define VKI_BIOCSETIF       BIOCSETIF
1046 #define VKI_BIOCSRTIMEOUT   BIOCSRTIMEOUT
1047 #define VKI_BIOCGDLTLIST    BIOCGDLTLIST
1048 
1049 
1050 #include <sys/ucontext.h>
1051 
1052 /* quite why sys/ucontext.h provides a 'struct __darwin_ucontext'
1053    but no 'struct ucontext' beats me. -- JRS */
1054 #define vki_ucontext __darwin_ucontext
1055 
1056 
1057 #include <sys/termios.h>
1058 
1059 #define vki_termios termios
1060 
1061 
1062 #include <uuid/uuid.h>
1063 
1064 #define vki_uuid_t uuid_t
1065 
1066 
1067 #include <bsm/audit.h>
1068 
1069 #define VKI_A_GETPOLICY A_GETPOLICY 
1070 #define VKI_A_SETPOLICY A_SETPOLICY 
1071 #define VKI_A_GETKMASK  A_GETKMASK  
1072 #define VKI_A_SETKMASK  A_SETKMASK  
1073 #define VKI_A_GETQCTRL  A_GETQCTRL  
1074 #define VKI_A_SETQCTRL  A_SETQCTRL  
1075 #define VKI_A_GETCWD    A_GETCWD    
1076 #define VKI_A_GETCAR    A_GETCAR    
1077 #define VKI_A_GETSTAT   A_GETSTAT   
1078 #define VKI_A_SETSTAT   A_SETSTAT   
1079 #define VKI_A_SETUMASK  A_SETUMASK  
1080 #define VKI_A_SETSMASK  A_SETSMASK  
1081 #define VKI_A_GETCOND   A_GETCOND   
1082 #define VKI_A_SETCOND   A_SETCOND   
1083 #define VKI_A_GETCLASS  A_GETCLASS  
1084 #define VKI_A_SETCLASS  A_SETCLASS  
1085 #define VKI_A_GETPINFO  A_GETPINFO  
1086 #define VKI_A_SETPMASK  A_SETPMASK  
1087 #define VKI_A_SETFSIZE  A_SETFSIZE  
1088 #define VKI_A_GETFSIZE  A_GETFSIZE  
1089 #define VKI_A_GETPINFO_ADDR A_GETPINFO_ADDR 
1090 #define VKI_A_GETKAUDIT A_GETKAUDIT 
1091 #define VKI_A_SETKAUDIT A_SETKAUDIT 
1092 #if DARWIN_VERS >= DARWIN_10_6
1093 #define VKI_A_SENDTRIGGER A_SENDTRIGGER
1094 #define VKI_A_GETSINFO_ADDR A_GETSINFO_ADDR
1095 #endif
1096 
1097 
1098 #include <sys/aio.h>
1099 
1100 #define vki_aiocb aiocb
1101 
1102 
1103 #include <netinet/tcp.h>
1104 
1105 #define VKI_TCP_NODELAY  TCP_NODELAY
1106 
1107 
1108 #include <netinet/in.h>
1109 
1110 #define VKI_IPPROTO_TCP  IPPROTO_TCP
1111 
1112 
1113 // XXX: for some reason when I #include <sys/kernel_types.h> I get a syntax
1114 // error.  Hmm.  So just define things ourselves.
1115 //#include <sys/kernel_types.h>
1116 
1117 //#define vki_errno_t
1118 typedef int vki_errno_t;
1119 
1120 
1121 /* necp stuff.  This doesn't appear to exist in any user space include
1122    file. */
1123 #if DARWIN_VERS == DARWIN_10_10
1124 struct vki_necp_aggregate_result {
1125    vki_u_int32_t field1;
1126    unsigned int  field2;
1127    vki_u_int32_t field3;
1128    vki_u_int32_t field4;
1129    vki_uuid_t    field5;
1130    u_int32_t     field6;
1131    u_int32_t     field7;
1132 };
1133 #endif /* DARWIN_VERS == DARWIN_10_10 */
1134 
1135 #if DARWIN_VERS >= DARWIN_10_12
1136 // ulock_wake & ulock_wait operations
1137 #define VKI_UL_OPCODE_MASK      0x000000FF
1138 #define VKI_UL_FLAGS_MASK       0xFFFFFF00
1139 #define VKI_UL_COMPARE_AND_WAIT 1
1140 #define VKI_UL_UNFAIR_LOCK      2
1141 // ulock_wake & ulock_wait flags
1142 #define ULF_NO_ERRNO            0x01000000
1143 
1144 // ulock_wait flags
1145 #define WKI_ULF_WAIT_WORKQ_DATA_CONTENTION  0x00010000
1146 #endif /* DARWIN_VERS >= DARWIN_10_12 */
1147 
1148 #endif