Home | History | Annotate | Download | only in vki
      1 
      2 /*--------------------------------------------------------------------*/
      3 /*--- System call numbers for Darwin.          vki-scnums-darwin.h ---*/
      4 /*--------------------------------------------------------------------*/
      5 
      6 /*
      7    This file is part of Valgrind, a dynamic binary instrumentation
      8    framework.
      9 
     10    Copyright (C) 2007-2015 Apple Inc.
     11       Greg Parker  gparker (at) apple.com
     12 
     13    This program is free software; you can redistribute it and/or
     14    modify it under the terms of the GNU General Public License as
     15    published by the Free Software Foundation; either version 2 of the
     16    License, or (at your option) any later version.
     17 
     18    This program is distributed in the hope that it will be useful, but
     19    WITHOUT ANY WARRANTY; without even the implied warranty of
     20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     21    General Public License for more details.
     22 
     23    You should have received a copy of the GNU General Public License
     24    along with this program; if not, write to the Free Software
     25    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
     26    02111-1307, USA.
     27 
     28    The GNU General Public License is contained in the file COPYING.
     29 */
     30 
     31 #ifndef __VKI_SCNUMS_DARWIN_H
     32 #define __VKI_SCNUMS_DARWIN_H
     33 
     34 
     35 // need DARWIN_10_x definitions
     36 #include "config.h"
     37 
     38 // osfmk/mach/i386/syscall_sw.h
     39 
     40 // There are two syscall number encodings in Darwin.
     41 //
     42 // The 64-bit encoding is that the top 8-bits are the syscall class.  The low
     43 // 24 are the syscall number (index) within that class.
     44 //
     45 // The 32-bit encoding is that the syscall number (index) is stored as-is and
     46 // the syscall class is encoded as the argument to the 'int' instruction used
     47 // to trigger the syscall:
     48 // - 0x80: Unix
     49 // - 0x81: Mach
     50 // - 0x82: Machine-dependent
     51 // - 0x83: Diagnostic
     52 // Furthermore, just to make life interesting, for Mach traps the number is
     53 // negative.
     54 //
     55 // Within Valgrind we only use the 64-bit encoding -- on 32-bit systems, we
     56 // convert any syscall number to 64-bit encoding when we receive it, and
     57 // convert back with VG_DARWIN_SYSNO_FOR_KERNEL when passing any syscall
     58 // number back to the kernel (__NR_something shouldn't be passed directly to
     59 // the kernel).
     60 //
     61 // Hack: x86 `int $0x80` (unix, 64-bit result) are special.
     62 // [I haven't worked out why... --njn]
     63 
     64 #define VG_DARWIN_SYSCALL_CLASS_SHIFT     24
     65 #define VG_DARWIN_SYSCALL_CLASS_MASK      (0xFF << VG_DARWIN_SYSCALL_CLASS_SHIFT)
     66 #define VG_DARWIN_SYSCALL_NUMBER_MASK     (~VG_DARWIN_SYSCALL_CLASS_MASK)
     67 
     68 #define VG_DARWIN_SYSCALL_CLASS_NONE      0       /* Invalid */
     69 #define VG_DARWIN_SYSCALL_CLASS_MACH      1       /* Mach */
     70 #define VG_DARWIN_SYSCALL_CLASS_UNIX      2       /* Unix/BSD */
     71 #define VG_DARWIN_SYSCALL_CLASS_MDEP      3       /* Machine-dependent */
     72 #define VG_DARWIN_SYSCALL_CLASS_DIAG      4       /* Diagnostics */
     73 
     74 // Macros for encoding syscall numbers in the 64-bit encoding scheme.
     75 #define VG_DARWIN_SYSCALL_CONSTRUCT_MACH(syscall_number) \
     76     ((VG_DARWIN_SYSCALL_CLASS_MACH << VG_DARWIN_SYSCALL_CLASS_SHIFT) | \
     77      (VG_DARWIN_SYSCALL_NUMBER_MASK & (syscall_number)))
     78 
     79 #define VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(syscall_number) \
     80     ((VG_DARWIN_SYSCALL_CLASS_UNIX << VG_DARWIN_SYSCALL_CLASS_SHIFT) | \
     81      (VG_DARWIN_SYSCALL_NUMBER_MASK & (syscall_number)))
     82 
     83 #define VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(syscall_number) \
     84     ((VG_DARWIN_SYSCALL_CLASS_MDEP << VG_DARWIN_SYSCALL_CLASS_SHIFT) | \
     85      (VG_DARWIN_SYSCALL_NUMBER_MASK & (syscall_number)))
     86 
     87 #define VG_DARWIN_SYSCALL_CONSTRUCT_DIAG(syscall_number) \
     88     ((VG_DARWIN_SYSCALL_CLASS_DIAG << VG_DARWIN_SYSCALL_CLASS_SHIFT) | \
     89      (VG_DARWIN_SYSCALL_NUMBER_MASK & (syscall_number)))
     90 
     91 
     92 /* Macros for decoding syscall numbers from the 64-bit encoding scheme. */
     93 #define VG_DARWIN_SYSNO_INDEX(sysno) ((sysno) & VG_DARWIN_SYSCALL_NUMBER_MASK)
     94 #define VG_DARWIN_SYSNO_CLASS(sysno) ((sysno) >> VG_DARWIN_SYSCALL_CLASS_SHIFT)
     95 
     96 
     97 /* Macros for converting syscall numbers to the form expected by the kernel.*/
     98 #if defined(VGA_x86)
     99    // This converts the 64-bit syscall number encoding, which we use
    100    // throughout Valgrind, into the 32-bit syscall number encoding, which is
    101    // suitable for passing to the (32-bit) kernel.
    102 #  define VG_DARWIN_SYSNO_FOR_KERNEL(sysno) \
    103     ((VG_DARWIN_SYSNO_CLASS(sysno) == VG_DARWIN_SYSCALL_CLASS_MACH) \
    104     ? -VG_DARWIN_SYSNO_INDEX(sysno) \
    105     :  VG_DARWIN_SYSNO_INDEX(sysno) \
    106     )
    107 
    108 #elif defined(VGA_amd64)
    109    // For 64-bit systems, we don't need to do anything to the syscall number.
    110 #  define VG_DARWIN_SYSNO_FOR_KERNEL(sysno) (sysno)
    111 
    112 #else
    113 #  error Unknown architecture
    114 #endif
    115 
    116 
    117 // mdep syscalls
    118 
    119 #if defined(VGA_x86)
    120 
    121 // osfmk/i386/machdep_call.c
    122 // DDD: the last two are BSD_CALL instead of CALL...
    123 //#define __NR_thread_get_cthread_self      VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(0)
    124 //#define __NR_thread_set_cthread_self      VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(1)
    125 // 2 is invalid
    126 #define __NR_thread_fast_set_cthread_self VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(3)
    127 //#define __NR_thread_set_user_ldt          VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(4)
    128 //#define __NR_i386_set_ldt                 VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(5)
    129 //#define __NR_i386_get_ldt                 VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(6)
    130 
    131 #elif defined(VGA_amd64)
    132 
    133 // osfmk/i386/machdep_call.c
    134 // 0, 1, 2 are invalid
    135 #define __NR_thread_fast_set_cthread_self VG_DARWIN_SYSCALL_CONSTRUCT_MDEP(3)
    136 // 4, 5, 6 are invalid
    137 
    138 #else
    139 #  error unknown architecture
    140 #endif
    141 
    142 
    143 // osfmk/mach/syscall_sw.h
    144 
    145 #define __NR_kernelrpc_mach_vm_allocate_trap         VG_DARWIN_SYSCALL_CONSTRUCT_MACH(10)
    146 
    147 #define __NR_kernelrpc_mach_vm_deallocate_trap       VG_DARWIN_SYSCALL_CONSTRUCT_MACH(12)
    148 
    149 #define __NR_kernelrpc_mach_vm_protect_trap          VG_DARWIN_SYSCALL_CONSTRUCT_MACH(14)
    150 #define __NR_kernelrpc_mach_vm_map_trap              VG_DARWIN_SYSCALL_CONSTRUCT_MACH(15)
    151 #define __NR_kernelrpc_mach_port_allocate_trap       VG_DARWIN_SYSCALL_CONSTRUCT_MACH(16)
    152 #define __NR_kernelrpc_mach_port_destroy_trap        VG_DARWIN_SYSCALL_CONSTRUCT_MACH(17)
    153 #define __NR_kernelrpc_mach_port_deallocate_trap     VG_DARWIN_SYSCALL_CONSTRUCT_MACH(18)
    154 #define __NR_kernelrpc_mach_port_mod_refs_trap       VG_DARWIN_SYSCALL_CONSTRUCT_MACH(19)
    155 #define __NR_kernelrpc_mach_port_move_member_trap    VG_DARWIN_SYSCALL_CONSTRUCT_MACH(20)
    156 #define __NR_kernelrpc_mach_port_insert_right_trap   VG_DARWIN_SYSCALL_CONSTRUCT_MACH(21)
    157 #define __NR_kernelrpc_mach_port_insert_member_trap  VG_DARWIN_SYSCALL_CONSTRUCT_MACH(22)
    158 #define __NR_kernelrpc_mach_port_extract_member_trap VG_DARWIN_SYSCALL_CONSTRUCT_MACH(23)
    159 #define __NR_kernelrpc_mach_port_construct_trap      VG_DARWIN_SYSCALL_CONSTRUCT_MACH(24)
    160 #define __NR_kernelrpc_mach_port_destruct_trap       VG_DARWIN_SYSCALL_CONSTRUCT_MACH(25)
    161 
    162 
    163 #define __NR_mach_reply_port                  VG_DARWIN_SYSCALL_CONSTRUCT_MACH(26)
    164 #define __NR_thread_self_trap                 VG_DARWIN_SYSCALL_CONSTRUCT_MACH(27)
    165 #define __NR_task_self_trap                   VG_DARWIN_SYSCALL_CONSTRUCT_MACH(28)
    166 #define __NR_host_self_trap                   VG_DARWIN_SYSCALL_CONSTRUCT_MACH(29)
    167 
    168 #define __NR_mach_msg_trap                    VG_DARWIN_SYSCALL_CONSTRUCT_MACH(31)
    169 #define __NR_mach_msg_overwrite_trap          VG_DARWIN_SYSCALL_CONSTRUCT_MACH(32)
    170 #define __NR_semaphore_signal_trap            VG_DARWIN_SYSCALL_CONSTRUCT_MACH(33)
    171 #define __NR_semaphore_signal_all_trap        VG_DARWIN_SYSCALL_CONSTRUCT_MACH(34)
    172 #define __NR_semaphore_signal_thread_trap     VG_DARWIN_SYSCALL_CONSTRUCT_MACH(35)
    173 #define __NR_semaphore_wait_trap              VG_DARWIN_SYSCALL_CONSTRUCT_MACH(36)
    174 #define __NR_semaphore_wait_signal_trap       VG_DARWIN_SYSCALL_CONSTRUCT_MACH(37)
    175 #define __NR_semaphore_timedwait_trap         VG_DARWIN_SYSCALL_CONSTRUCT_MACH(38)
    176 #define __NR_semaphore_timedwait_signal_trap  VG_DARWIN_SYSCALL_CONSTRUCT_MACH(39)
    177 
    178 #if DARWIN_VERS >= DARWIN_10_9
    179 #define __NR_kernelrpc_mach_port_guard_trap   VG_DARWIN_SYSCALL_CONSTRUCT_MACH(41)
    180 #define __NR_kernelrpc_mach_port_unguard_trap VG_DARWIN_SYSCALL_CONSTRUCT_MACH(42)
    181 #endif
    182 
    183 #if defined(VGA_x86) || DARWIN_VERS == DARWIN_10_9
    184 #define __NR_map_fd                           VG_DARWIN_SYSCALL_CONSTRUCT_MACH(43)
    185 #endif
    186 
    187 #define __NR_task_name_for_pid                VG_DARWIN_SYSCALL_CONSTRUCT_MACH(44)
    188 #define __NR_task_for_pid                     VG_DARWIN_SYSCALL_CONSTRUCT_MACH(45)
    189 #define __NR_pid_for_task                     VG_DARWIN_SYSCALL_CONSTRUCT_MACH(46)
    190 
    191 #if defined(VGA_x86)
    192 #define __NR_macx_swapon                      VG_DARWIN_SYSCALL_CONSTRUCT_MACH(48)
    193 #define __NR_macx_swapoff                     VG_DARWIN_SYSCALL_CONSTRUCT_MACH(49)
    194 #define __NR_macx_triggers                    VG_DARWIN_SYSCALL_CONSTRUCT_MACH(51)
    195 #define __NR_macx_backing_store_suspend       VG_DARWIN_SYSCALL_CONSTRUCT_MACH(52)
    196 #define __NR_macx_backing_store_recovery      VG_DARWIN_SYSCALL_CONSTRUCT_MACH(53)
    197 #endif
    198 
    199 #define __NR_swtch_pri                        VG_DARWIN_SYSCALL_CONSTRUCT_MACH(59)
    200 #define __NR_swtch                            VG_DARWIN_SYSCALL_CONSTRUCT_MACH(60)
    201 #define __NR_sched_yield  __NR_swtch  /* linux-alike name */
    202 #define __NR_syscall_thread_switch            VG_DARWIN_SYSCALL_CONSTRUCT_MACH(61)
    203 #define __NR_clock_sleep_trap                 VG_DARWIN_SYSCALL_CONSTRUCT_MACH(62)
    204 
    205 #define __NR_mach_timebase_info               VG_DARWIN_SYSCALL_CONSTRUCT_MACH(89)
    206 #define __NR_mach_wait_until                  VG_DARWIN_SYSCALL_CONSTRUCT_MACH(90)
    207 #define __NR_mk_timer_create                  VG_DARWIN_SYSCALL_CONSTRUCT_MACH(91)
    208 #define __NR_mk_timer_destroy                 VG_DARWIN_SYSCALL_CONSTRUCT_MACH(92)
    209 #define __NR_mk_timer_arm                     VG_DARWIN_SYSCALL_CONSTRUCT_MACH(93)
    210 #define __NR_mk_timer_cancel                  VG_DARWIN_SYSCALL_CONSTRUCT_MACH(94)
    211 
    212 #define __NR_iokit_user_client_trap           VG_DARWIN_SYSCALL_CONSTRUCT_MACH(100)
    213 
    214 
    215 // bsd/sys/syscall.h
    216 
    217 #define	__NR_syscall        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(0)
    218 #define	__NR_exit           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(1)
    219 #define	__NR_fork           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(2) // was UX64
    220 #define	__NR_read           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(3)
    221 #define	__NR_write          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(4)
    222 #define	__NR_open           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(5)
    223 #define	__NR_close          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(6)
    224 #define	__NR_wait4          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(7)
    225 			/* 8  old creat */
    226 #define	__NR_link           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(9)
    227 #define	__NR_unlink         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(10)
    228 			/* 11  old execv */
    229 #define	__NR_chdir          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(12)
    230 #define	__NR_fchdir         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(13)
    231 #define	__NR_mknod          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(14)
    232 #define	__NR_chmod          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(15)
    233 #define	__NR_chown          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(16)
    234 			/* 17  old break */
    235 #define	__NR_getfsstat      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(18)
    236 			/* 19  old lseek */
    237 #define	__NR_getpid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(20)
    238 			/* 21  old mount */
    239 			/* 22  old umount */
    240 #define	__NR_setuid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(23)
    241 #define	__NR_getuid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(24)
    242 #define	__NR_geteuid        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(25)
    243 #define	__NR_ptrace         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(26)
    244 #define	__NR_recvmsg        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(27)
    245 #define	__NR_sendmsg        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(28)
    246 #define	__NR_recvfrom       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(29)
    247 #define	__NR_accept         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(30)
    248 #define	__NR_getpeername    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(31)
    249 #define	__NR_getsockname    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(32)
    250 #define	__NR_access         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(33)
    251 #define	__NR_chflags        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(34)
    252 #define	__NR_fchflags       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(35)
    253 #define	__NR_sync           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(36)
    254 #define	__NR_kill           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(37)
    255 			/* 38  old stat */
    256 #define	__NR_getppid        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(39)
    257 			/* 40  old lstat */
    258 #define	__NR_dup            VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(41)
    259 #define	__NR_pipe           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(42) // was UX64
    260 #define	__NR_getegid        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(43)
    261 #define	__NR_profil         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(44)
    262 			/* 45  old ktrace */
    263 #define	__NR_sigaction      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(46)
    264 #define	__NR_getgid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(47)
    265 #define	__NR_sigprocmask    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(48)
    266 #define	__NR_getlogin       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(49)
    267 #define	__NR_setlogin       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(50)
    268 #define	__NR_acct           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(51)
    269 #define	__NR_sigpending     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(52)
    270 #define	__NR_sigaltstack    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(53)
    271 #define	__NR_ioctl          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(54)
    272 #define	__NR_reboot         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(55)
    273 #define	__NR_revoke         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(56)
    274 #define	__NR_symlink        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(57)
    275 #define	__NR_readlink       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(58)
    276 #define	__NR_execve         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(59)
    277 #define	__NR_umask          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(60)
    278 #define	__NR_chroot         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(61)
    279 			/* 62  old fstat */
    280 			/* 63  used internally , reserved */
    281 			/* 64  old getpagesize */
    282 #define	__NR_msync          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(65)
    283 #define	__NR_vfork          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(66)
    284 			/* 67  old vread */
    285 			/* 68  old vwrite */
    286 			/* 69  old sbrk */
    287 			/* 70  old sstk */
    288 			/* 71  old mmap */
    289 			/* 72  old vadvise */
    290 #define	__NR_munmap         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(73)
    291 #define	__NR_mprotect       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(74)
    292 #define	__NR_madvise        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(75)
    293 			/* 76  old vhangup */
    294 			/* 77  old vlimit */
    295 #define	__NR_mincore        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(78)
    296 #define	__NR_getgroups      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(79)
    297 #define	__NR_setgroups      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(80)
    298 #define	__NR_getpgrp        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(81)
    299 #define	__NR_setpgid        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(82)
    300 #define	__NR_setitimer      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(83)
    301 			/* 84  old wait */
    302 #define	__NR_swapon         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(85)
    303 #define	__NR_getitimer      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(86)
    304 			/* 87  old gethostname */
    305 			/* 88  old sethostname */
    306 #define	__NR_getdtablesize  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(89)
    307 #define	__NR_dup2           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(90)
    308 			/* 91  old getdopt */
    309 #define	__NR_fcntl          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(92)
    310 #define	__NR_select         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(93)
    311 			/* 94  old setdopt */
    312 #define	__NR_fsync          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(95)
    313 #define	__NR_setpriority    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(96)
    314 #define	__NR_socket         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(97)
    315 #define	__NR_connect        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(98)
    316 			/* 99  old accept */
    317 #define	__NR_getpriority    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(100)
    318 			/* 101  old send */
    319 			/* 102  old recv */
    320 			/* 103  old sigreturn */
    321 #define	__NR_bind           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(104)
    322 #define	__NR_setsockopt     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(105)
    323 #define	__NR_listen         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(106)
    324 			/* 107  old vtimes */
    325 			/* 108  old sigvec */
    326 			/* 109  old sigblock */
    327 			/* 110  old sigsetmask */
    328 #define	__NR_sigsuspend     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(111)
    329 			/* 112  old sigstack */
    330 			/* 113  old recvmsg */
    331 			/* 114  old sendmsg */
    332 			/* 115  old vtrace */
    333 #define	__NR_gettimeofday   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(116)
    334 #define	__NR_getrusage      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(117)
    335 #define	__NR_getsockopt     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(118)
    336 			/* 119  old resuba */
    337 #define	__NR_readv          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(120)
    338 #define	__NR_writev         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(121)
    339 #define	__NR_settimeofday   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(122)
    340 #define	__NR_fchown         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(123)
    341 #define	__NR_fchmod         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(124)
    342 			/* 125  old recvfrom */
    343 #define	__NR_setreuid       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(126)
    344 #define	__NR_setregid       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(127)
    345 #define	__NR_rename         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(128)
    346 			/* 129  old truncate */
    347 			/* 130  old ftruncate */
    348 #define	__NR_flock          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(131)
    349 #define	__NR_mkfifo         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(132)
    350 #define	__NR_sendto         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(133)
    351 #define	__NR_shutdown       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(134)
    352 #define	__NR_socketpair     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(135)
    353 #define	__NR_mkdir          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(136)
    354 #define	__NR_rmdir          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(137)
    355 #define	__NR_utimes         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(138)
    356 #define	__NR_futimes        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(139)
    357 #define	__NR_adjtime        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(140)
    358 			/* 141  old getpeername */
    359 #define __NR_gethostuuid    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(142)
    360 			/* 143  old sethostid */
    361 			/* 144  old getrlimit */
    362 			/* 145  old setrlimit */
    363 			/* 146  old killpg */
    364 #define	__NR_setsid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(147)
    365 			/* 148  old setquota */
    366 			/* 149  old qquota */
    367 			/* 150  old getsockname */
    368 #define	__NR_getpgid        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(151)
    369 #define	__NR_setprivexec    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(152)
    370 #define	__NR_pread          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(153)
    371 #define	__NR_pwrite         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(154)
    372 #define __NR_nfssvc         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(155)
    373 			/* 156  old getdirentries */
    374 #define	__NR_statfs         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(157)
    375 #define	__NR_fstatfs        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(158)
    376 #define	__NR_unmount        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(159)
    377 			/* 160  old async_daemon */
    378 #define __NR_getfh          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(161)
    379 			/* 162  old getdomainname */
    380 			/* 163  old setdomainname */
    381 			/* 164  */
    382 #define	__NR_quotactl       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(165)
    383 			/* 166  old exportfs */
    384 #define	__NR_mount          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(167)
    385 			/* 168  old ustat */
    386 #define __NR_csops          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(169)
    387 			/* 170  old table */
    388 			/* 171  old wait3 */
    389 			/* 172  old rpause */
    390 #define	__NR_waitid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(173)
    391 			/* 174  old getdents */
    392 			/* 175  old gc_control */
    393 #define	__NR_add_profil     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(176)
    394 			/* 177  */
    395 			/* 178  */
    396 			/* 179  */
    397 #define	__NR_kdebug_trace   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(180)
    398 #define	__NR_setgid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(181)
    399 #define	__NR_setegid        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(182)
    400 #define	__NR_seteuid        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(183)
    401 #define __NR_sigreturn      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(184)
    402 #define __NR_chud           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(185)
    403 			/* 186  */
    404 #if DARWIN_VERS >= DARWIN_10_6
    405 #define __NR_fdatasync      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(187)
    406 #else
    407 			/* 187  */
    408 #endif
    409 #define	__NR_stat           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(188)
    410 #define	__NR_fstat          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(189)
    411 #define	__NR_lstat          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(190)
    412 #define	__NR_pathconf       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(191)
    413 #define	__NR_fpathconf      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(192)
    414 			/* 193 */
    415 #define	__NR_getrlimit      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(194)
    416 #define	__NR_setrlimit      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(195)
    417 #define	__NR_getdirentries  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(196)
    418 #define	__NR_mmap           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(197)
    419 			/* 198  __syscall */
    420 #define	__NR_lseek          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(199) // was UX64
    421 #define	__NR_truncate       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(200)
    422 #define	__NR_ftruncate      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(201)
    423 #define	__NR___sysctl       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(202)
    424 #define	__NR_mlock          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(203)
    425 #define	__NR_munlock        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(204)
    426 #define	__NR_undelete       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(205)
    427 #define	__NR_ATsocket       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(206)
    428 #define	__NR_ATgetmsg       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(207)
    429 #define	__NR_ATputmsg       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(208)
    430 #define	__NR_ATPsndreq      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(209)
    431 #define	__NR_ATPsndrsp      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(210)
    432 #define	__NR_ATPgetreq      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(211)
    433 #define	__NR_ATPgetrsp      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(212)
    434 			/* 213  Reserved for AppleTalk */
    435 #if DARWIN_VERS >= DARWIN_10_6
    436                         /* 214  old kqueue_from_portset_np*/
    437                         /* 215  old kqueue_portset_np*/
    438 #else
    439 #define __NR_kqueue_from_portset_np VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(214)
    440 #define __NR_kqueue_portset_np VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(215)
    441 #endif
    442 #define	__NR_mkcomplex      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(216)
    443 #define	__NR_statv          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(217)
    444 #define	__NR_lstatv         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(218)
    445 #define	__NR_fstatv         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(219)
    446 #define	__NR_getattrlist    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(220)
    447 #define	__NR_setattrlist    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(221)
    448 #define	__NR_getdirentriesattr VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(222)
    449 #define	__NR_exchangedata   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(223)
    450 			/* 224  old checkuseraccess */
    451 #define	__NR_searchfs       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(225)
    452 #define	__NR_delete         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(226)
    453 #define	__NR_copyfile       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(227)
    454 #if DARWIN_VERS >= DARWIN_10_6
    455 #define __NR_fgetattrlist   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(228)
    456 #define __NR_fsetattrlist   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(229)
    457 #else
    458 			/* 228  */
    459 			/* 229  */
    460 #endif
    461 #define	__NR_poll           VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(230)
    462 #define	__NR_watchevent     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(231)
    463 #define	__NR_waitevent      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(232)
    464 #define	__NR_modwatch       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(233)
    465 #define	__NR_getxattr       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(234)
    466 #define	__NR_fgetxattr      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(235)
    467 #define	__NR_setxattr       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(236)
    468 #define	__NR_fsetxattr      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(237)
    469 #define	__NR_removexattr    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(238)
    470 #define	__NR_fremovexattr   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(239)
    471 #define	__NR_listxattr      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(240)
    472 #define	__NR_flistxattr     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(241)
    473 #define	__NR_fsctl          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(242)
    474 #define	__NR_initgroups     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(243)
    475 #define __NR_posix_spawn    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(244)
    476 #if DARWIN_VERS >= DARWIN_10_6
    477 #define __NR_ffsctl         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(245)
    478 #else
    479 			/* 245  */
    480 #endif
    481 			/* 246  */
    482 #define __NR_nfsclnt        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(247)
    483 #define __NR_fhopen         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(248)
    484 			/* 249  */
    485 #define	__NR_minherit       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(250)
    486 #define	__NR_semsys         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(251)
    487 #define	__NR_msgsys         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(252)
    488 #define	__NR_shmsys         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(253)
    489 #define	__NR_semctl         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(254)
    490 #define	__NR_semget         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(255)
    491 #define	__NR_semop          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(256)
    492 			/* 257  */
    493 #define	__NR_msgctl         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(258)
    494 #define	__NR_msgget         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(259)
    495 #define	__NR_msgsnd         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(260)
    496 #define	__NR_msgrcv         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(261)
    497 #define	__NR_shmat          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(262)
    498 #define	__NR_shmctl         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(263)
    499 #define	__NR_shmdt          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(264)
    500 #define	__NR_shmget         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(265)
    501 #define	__NR_shm_open       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(266)
    502 #define	__NR_shm_unlink     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(267)
    503 #define	__NR_sem_open       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(268)
    504 #define	__NR_sem_close      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(269)
    505 #define	__NR_sem_unlink     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(270)
    506 #define	__NR_sem_wait       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(271)
    507 #define	__NR_sem_trywait    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(272)
    508 #define	__NR_sem_post       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(273)
    509 
    510 #if DARWIN_VERS < DARWIN_10_10
    511 #define	__NR_sem_getvalue   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(274)
    512 #elif DARWIN_VERS >= DARWIN_10_10
    513 #define	__NR_sysctlbyname   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(274)
    514 #endif
    515 
    516 #define	__NR_sem_init       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(275)
    517 #define	__NR_sem_destroy    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(276)
    518 #define	__NR_open_extended  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(277)
    519 #define	__NR_umask_extended VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(278)
    520 #define	__NR_stat_extended  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(279)
    521 #define	__NR_lstat_extended VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(280)
    522 #define	__NR_fstat_extended VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(281)
    523 #define	__NR_chmod_extended VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(282)
    524 #define	__NR_fchmod_extended VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(283)
    525 #define	__NR_access_extended VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(284)
    526 #define	__NR_settid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(285)
    527 #define	__NR_gettid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(286)
    528 #define	__NR_setsgroups     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(287)
    529 #define	__NR_getsgroups     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(288)
    530 #define	__NR_setwgroups     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(289)
    531 #define	__NR_getwgroups     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(290)
    532 #define	__NR_mkfifo_extended VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(291)
    533 #define	__NR_mkdir_extended VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(292)
    534 #define	__NR_identitysvc    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(293)
    535 #define	__NR_shared_region_check_np VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(294)
    536 #define	__NR_shared_region_map_np   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(295)
    537 #if DARWIN_VERS >= DARWIN_10_6
    538 #define __NR_vm_pressure_monitor    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(296)
    539 #define __NR_psynch_rw_longrdlock   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(297)
    540 #define __NR_psynch_rw_yieldwrlock  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(298)
    541 #define __NR_psynch_rw_downgrade    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(299)
    542 #define __NR_psynch_rw_upgrade      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(300)
    543 #define __NR_psynch_mutexwait       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(301)
    544 #define __NR_psynch_mutexdrop       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(302)
    545 #define __NR_psynch_cvbroad         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(303)
    546 #define __NR_psynch_cvsignal        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(304)
    547 #define __NR_psynch_cvwait          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(305)
    548 #define __NR_psynch_rw_rdlock       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(306)
    549 #define __NR_psynch_rw_wrlock       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(307)
    550 #define __NR_psynch_rw_unlock       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(308)
    551 #define __NR_psynch_rw_unlock2      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(309)
    552 #else
    553 			/* 296  old load_shared_file */
    554 			/* 297  old reset_shared_file */
    555 			/* 298  old new_system_shared_regions */
    556 			/* 299  old shared_region_map_file_np */
    557 			/* 300  old shared_region_make_private_np */
    558 #define __NR___pthread_mutex_destroy  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(301)
    559 #define __NR___pthread_mutex_init     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(302)
    560 #define __NR___pthread_mutex_lock     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(303)
    561 #define __NR___pthread_mutex_trylock  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(304)
    562 #define __NR___pthread_mutex_unlock   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(305)
    563 #define __NR___pthread_cond_init      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(306)
    564 #define __NR___pthread_cond_destroy   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(307)
    565 #define __NR___pthread_cond_broadcast VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(308)
    566 #define __NR___pthread_cond_signal    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(309)
    567 #endif
    568 #define	__NR_getsid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(310)
    569 #define	__NR_settid_with_pid VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(311)
    570 #if DARWIN_VERS >= DARWIN_10_7
    571 #define __NR_psynch_cvclrprepost VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(312)
    572 #else
    573 #define __NR___pthread_cond_timedwait VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(312)
    574 #endif
    575 #define	__NR_aio_fsync      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(313)
    576 #define	__NR_aio_return     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(314)
    577 #define	__NR_aio_suspend    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(315)
    578 #define	__NR_aio_cancel     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(316)
    579 #define	__NR_aio_error      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(317)
    580 #define	__NR_aio_read       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(318)
    581 #define	__NR_aio_write      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(319)
    582 #define	__NR_lio_listio     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(320)
    583 			/* 321 */
    584 #define __NR_iopolicysys    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(322)
    585 #define __NR_process_policy VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(323)
    586 #define	__NR_mlockall       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(324)
    587 #define	__NR_munlockall     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(325)
    588 			/* 326  */
    589 #define	__NR_issetugid      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(327)
    590 #define	__NR___pthread_kill VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(328)
    591 #define	__NR___pthread_sigmask VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(329)
    592 #define	__NR___sigwait        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(330)
    593 #define	__NR___disable_threadsignal VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(331)
    594 #define	__NR___pthread_markcancel VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(332)
    595 #define	__NR___pthread_canceled VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(333)
    596 #define	__NR___semwait_signal VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(334)
    597 			/* 335  old utrace */
    598 #define __NR_proc_info      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(336)
    599 #define __NR_sendfile       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(337)
    600 #define __NR_stat64         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(338)
    601 #define __NR_fstat64        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(339)
    602 #define __NR_lstat64        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(340)
    603 #define __NR_stat64_extended VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(341)
    604 #define __NR_lstat64_extended VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(342)
    605 #define __NR_fstat64_extended VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(343)
    606 #define __NR_getdirentries64 VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(344)
    607 #define __NR_statfs64       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(345)
    608 #define __NR_fstatfs64      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(346)
    609 #define __NR_getfsstat64    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(347)
    610 #define __NR___pthread_chdir VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(348)
    611 #define __NR___pthread_fchdir VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(349)
    612 
    613 #define	__NR_audit          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(350)
    614 #define	__NR_auditon        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(351)
    615 			/* 352  */
    616 #define	__NR_getauid        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(353)
    617 #define	__NR_setauid        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(354)
    618 #define	__NR_getaudit       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(355)
    619 #define	__NR_setaudit       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(356)
    620 #define	__NR_getaudit_addr  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(357)
    621 #define	__NR_setaudit_addr  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(358)
    622 #define	__NR_auditctl       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(359)
    623 #define	__NR_bsdthread_create VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(360)
    624 #define	__NR_bsdthread_terminate VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(361)
    625 #define	__NR_kqueue         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(362)
    626 #define	__NR_kevent         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(363)
    627 #define	__NR_lchown         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(364)
    628 #define __NR_stack_snapshot VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(365)
    629 #define __NR_bsdthread_register VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(366)
    630 #define __NR_workq_open     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(367)
    631 #define __NR_workq_ops      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(368)
    632 #if DARWIN_VERS >= DARWIN_10_6
    633 #define __NR_kevent64       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(369)
    634 #else
    635 			/* 369  */
    636 #endif
    637 			/* 370  */
    638 			/* 371  */
    639 #if DARWIN_VERS >= DARWIN_10_6
    640 #define __NR___thread_selfid VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(372)  // was UX64
    641 #else
    642 			/* 372  */
    643 #endif
    644 			/* 373  */
    645 			/* 374  */
    646 			/* 375  */
    647 			/* 376  */
    648 			/* 377  */
    649 			/* 378  */
    650 			/* 379  */
    651 #define __NR___mac_execve   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(380)
    652 #define __NR___mac_syscall  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(381)
    653 #define __NR___mac_get_file VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(382)
    654 #define __NR___mac_set_file VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(383)
    655 #define __NR___mac_get_link VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(384)
    656 #define __NR___mac_set_link VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(385)
    657 #define __NR___mac_get_proc VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(386)
    658 #define __NR___mac_set_proc VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(387)
    659 #define __NR___mac_get_fd   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(388)
    660 #define __NR___mac_set_fd   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(389)
    661 #define __NR___mac_get_pid  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(390)
    662 #define __NR___mac_get_lcid VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(391)
    663 #define __NR___mac_get_lctx VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(392)
    664 #define __NR___mac_set_lctx VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(393)
    665 #define __NR_setlcid        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(394)
    666 #define __NR_getlcid        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(395)
    667 #define __NR_read_nocancel          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(396)
    668 #define __NR_write_nocancel         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(397)
    669 #define __NR_open_nocancel          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(398)
    670 #define __NR_close_nocancel         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(399)
    671 #define __NR_wait4_nocancel         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(400)
    672 #define __NR_recvmsg_nocancel       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(401)
    673 #define __NR_sendmsg_nocancel       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(402)
    674 #define __NR_recvfrom_nocancel      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(403)
    675 #define __NR_accept_nocancel        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(404)
    676 #define __NR_msync_nocancel         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(405)
    677 #define __NR_fcntl_nocancel         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(406)
    678 #define __NR_select_nocancel        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(407)
    679 #define __NR_fsync_nocancel         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(408)
    680 #define __NR_connect_nocancel       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(409)
    681 #define __NR_sigsuspend_nocancel    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(410)
    682 #define __NR_readv_nocancel         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(411)
    683 #define __NR_writev_nocancel        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(412)
    684 #define __NR_sendto_nocancel        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(413)
    685 #define __NR_pread_nocancel         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(414)
    686 #define __NR_pwrite_nocancel        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(415)
    687 #define __NR_waitid_nocancel        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(416)
    688 #define __NR_poll_nocancel          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(417)
    689 #define __NR_msgsnd_nocancel        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(418)
    690 #define __NR_msgrcv_nocancel        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(419)
    691 #define __NR_sem_wait_nocancel      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(420)
    692 #define __NR_aio_suspend_nocancel   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(421)
    693 #define __NR___sigwait_nocancel     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(422)
    694 #define __NR___semwait_signal_nocancel VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(423)
    695 #define __NR___mac_mount            VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(424)
    696 #define __NR___mac_get_mount        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(425)
    697 #define __NR___mac_getfsstat        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(426)
    698 #if DARWIN_VERS >= DARWIN_10_6
    699 #define __NR_fsgetpath              VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(427)
    700 #define __NR_audit_session_self     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(428)
    701 #define __NR_audit_session_join     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(429)
    702 #endif /* DARWIN_VERS >= DARWIN_10_6 */
    703 #if DARWIN_VERS >= DARWIN_10_9
    704 #define __NR_fileport_makeport      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(430)
    705 #define __NR_fileport_makefd        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(431)
    706 #define __NR_audit_session_port     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(432)
    707 #define __NR_pid_suspend            VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(433)
    708 #define __NR_pid_resume             VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(434)
    709 
    710 
    711 
    712 #define __NR_shared_region_map_and_slide_np  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(438)
    713 #define __NR_kas_info               VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(439)
    714 #define __NR_memorystatus_control   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(440)
    715 #define __NR_guarded_open_np        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(441)
    716 #define __NR_guarded_close_np       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(442)
    717 #define __NR_guarded_kqueue_np      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(443)
    718 #define __NR_change_fdguard_np      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(444)
    719 
    720 #define __NR_proc_rlimit_control    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(446)
    721 #define __NR_connectx               VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(447)
    722 #define __NR_disconnectx            VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(448)
    723 #define __NR_peeloff                VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(449)
    724 #define __NR_socket_delegate        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(450)
    725 #define __NR_telemetry              VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(451)
    726 #define __NR_proc_uuid_policy       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(452)
    727 #define __NR_memorystatus_get_level VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(453)
    728 #define __NR_system_override        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(454)
    729 #define __NR_vfs_purge              VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(455)
    730 #endif /* DARWIN_VERS >= DARWIN_10_9 */
    731 
    732 #if DARWIN_VERS >= DARWIN_10_10
    733 #define __NR_necp_match_policy      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(460)
    734 #define __NR_getattrlistbulk        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(461)
    735 #define __NR_readlinkat             VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(473)
    736 #define __NR_bsdthread_ctl          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(478)
    737 #define __NR_guarded_open_dprotected_np VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(484)
    738 #define __NR_guarded_write_np       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(485)
    739 #define __NR_guarded_pwrite_np      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(486)
    740 #define __NR_guarded_writev_np      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(487)
    741 			/* 488  */
    742 			/* 489  */
    743 #endif /* DARWIN_VERS >= DARWIN_10_10 */
    744 
    745 // TODO Update with OS X 10.11 kernel (xnu) source code release
    746 #if DARWIN_VERS >= DARWIN_10_11
    747 			/* 490  */
    748 			/* 491  */
    749 			/* 492  */
    750 			/* 493  */
    751 			/* 494  */
    752 			/* 495  */
    753 			/* 496  */
    754 			/* 497  */
    755 			/* 498  */
    756 			/* 499  */
    757 #endif /* DARWIN_VERS >= DARWIN_10_11 */
    758 
    759 #if DARWIN_VERS < DARWIN_10_6
    760 #define	__NR_MAXSYSCALL             VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(427)
    761 #elif DARWIN_VERS < DARWIN_10_7
    762 #define	__NR_MAXSYSCALL             VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(430)
    763 #elif DARWIN_VERS < DARWIN_10_9
    764 #define	__NR_MAXSYSCALL             VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(430)
    765 #elif DARWIN_VERS == DARWIN_10_9
    766 #define	__NR_MAXSYSCALL             VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(456)
    767 #elif DARWIN_VERS == DARWIN_10_10
    768 #define __NR_MAXSYSCALL             VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(490)
    769 #elif DARWIN_VERS == DARWIN_10_11
    770 // TODO Confirm against final release
    771 #define __NR_MAXSYSCALL             VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(500)
    772 #else
    773 #error unknown darwin version
    774 #endif
    775 
    776 #define __NR_DARWIN_FAKE_SIGRETURN (1 + __NR_MAXSYSCALL)
    777 
    778 #endif
    779