xnu_system_call_numbers.odin 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. package darwin
  2. unix_offset_syscall :: proc(number: System_Call_Number) -> uintptr {
  3. return uintptr(number) + uintptr(0x2000000)
  4. }
  5. System_Call_Number :: enum uintptr {
  6. /* 0 syscall */
  7. exit = 1,
  8. fork = 2,
  9. read = 3,
  10. write = 4,
  11. open = 5,
  12. close = 6,
  13. wait4 = 7,
  14. /* 8 old creat */
  15. link = 9,
  16. unlink = 10,
  17. /* 11 old execv */
  18. chdir = 12,
  19. fchdir = 13,
  20. mknod = 14,
  21. chmod = 15,
  22. chown = 16,
  23. /* 17 old break */
  24. getfsstat = 18,
  25. /* 19 old lseek */
  26. getpid = 20,
  27. /* 21 old mount */
  28. /* 22 old umount */
  29. setuid = 23,
  30. getuid = 24,
  31. geteuid = 25,
  32. ptrace = 26,
  33. recvmsg = 27,
  34. sendmsg = 28,
  35. recvfrom = 29,
  36. accept = 30,
  37. getpeername = 31,
  38. getsockname = 32,
  39. access = 33,
  40. chflags = 34,
  41. fchflags = 35,
  42. sync = 36,
  43. kill = 37,
  44. /* 38 old stat */
  45. getppid = 39,
  46. /* 40 old lstat */
  47. dup = 41,
  48. pipe = 42,
  49. getegid = 43,
  50. /* 44 old profil */
  51. /* 45 old ktrace */
  52. sigaction = 46,
  53. getgid = 47,
  54. sigprocmask = 48,
  55. getlogin = 49,
  56. setlogin = 50,
  57. acct = 51,
  58. sigpending = 52,
  59. sigaltstack = 53,
  60. ioctl = 54,
  61. reboot = 55,
  62. revoke = 56,
  63. symlink = 57,
  64. readlink = 58,
  65. execve = 59,
  66. umask = 60,
  67. chroot = 61,
  68. /* 62 old fstat */
  69. /* 63 used internally and reserved */
  70. /* getpagesize = 64, invalid */
  71. msync = 65,
  72. vfork = 66,
  73. /* 67 old vread */
  74. /* 68 old vwrite */
  75. /* 69 old sbrk */
  76. /* 70 old sstk */
  77. /* 71 old mmap */
  78. /* 72 old vadvise */
  79. munmap = 73,
  80. mprotect = 74,
  81. madvise = 75,
  82. /* 76 old vhangup */
  83. /* 77 old vlimit */
  84. mincore = 78,
  85. getgroups = 79,
  86. setgroups = 80,
  87. getpgrp = 81,
  88. setpgid = 82,
  89. setitimer = 83,
  90. /* 84 old wait */
  91. swapon = 85,
  92. getitimer = 86,
  93. /* 87 old gethostname */
  94. /* 88 old sethostname */
  95. getdtablesize = 89,
  96. dup2 = 90,
  97. /* 91 old getdopt */
  98. fcntl = 92,
  99. select = 93,
  100. /* 94 old setdopt */
  101. fsync = 95,
  102. setpriority = 96,
  103. socket = 97,
  104. connect = 98,
  105. /* 99 old accept */
  106. getpriority = 100,
  107. /* 101 old send */
  108. /* 102 old recv */
  109. /* 103 old sigreturn */
  110. bind = 104,
  111. setsockopt = 105,
  112. listen = 106,
  113. /* 107 old vtimes */
  114. /* 108 old sigvec */
  115. /* 109 old sigblock */
  116. /* 110 old sigsetmask */
  117. sigsuspend = 111,
  118. /* 112 old sigstack */
  119. /* 113 old recvmsg */
  120. /* 114 old sendmsg */
  121. /* 115 old vtrace */
  122. gettimeofday = 116,
  123. getrusage = 117,
  124. getsockopt = 118,
  125. /* 119 old resuba */
  126. readv = 120,
  127. writev = 121,
  128. settimeofday = 122,
  129. fchown = 123,
  130. fchmod = 124,
  131. /* 125 old recvfrom */
  132. setreuid = 126,
  133. setregid = 127,
  134. rename = 128,
  135. /* 129 old truncate */
  136. /* 130 old ftruncate */
  137. flock = 131,
  138. mkfifo = 132,
  139. sendto = 133,
  140. shutdown = 134,
  141. socketpair = 135,
  142. mkdir = 136,
  143. rmdir = 137,
  144. utimes = 138,
  145. futimes = 139,
  146. adjtime = 140,
  147. /* 141 old getpeername */
  148. gethostuuid = 142,
  149. /* 143 old sethostid */
  150. /* 144 old getrlimit */
  151. /* 145 old setrlimit */
  152. /* 146 old killpg */
  153. setsid = 147,
  154. /* 148 old setquota */
  155. /* 149 old qquota */
  156. /* 150 old getsockname */
  157. getpgid = 151,
  158. setprivexec = 152,
  159. pread = 153,
  160. pwrite = 154,
  161. nfssvc = 155,
  162. /* 156 old getdirentries */
  163. statfs = 157,
  164. fstatfs = 158,
  165. unmount = 159,
  166. /* 160 old async_daemon */
  167. getfh = 161,
  168. /* 162 old getdomainname */
  169. /* 163 old setdomainname */
  170. /* 164 */
  171. quotactl = 165,
  172. /* 166 old exportfs */
  173. mount = 167,
  174. /* 168 old ustat */
  175. csops = 169,
  176. csops_audittoken = 170,
  177. /* 171 old wait3 */
  178. /* 172 old rpause */
  179. waitid = 173,
  180. /* 174 old getdents */
  181. /* 175 old gc_control */
  182. /* 176 old add_profil */
  183. kdebug_typefilter = 177,
  184. kdebug_trace_string = 178,
  185. kdebug_trace64 = 179,
  186. kdebug_trace = 180,
  187. setgid = 181,
  188. setegid = 182,
  189. seteuid = 183,
  190. sigreturn = 184,
  191. /* 185 old chud */
  192. thread_selfcounts = 186,
  193. fdatasync = 187,
  194. stat = 188,
  195. fstat = 189,
  196. lstat = 190,
  197. pathconf = 191,
  198. fpathconf = 192,
  199. /* 193 old getfsstat */
  200. getrlimit = 194,
  201. setrlimit = 195,
  202. getdirentries = 196,
  203. mmap = 197,
  204. /* 198 old __syscall */
  205. lseek = 199,
  206. truncate = 200,
  207. ftruncate = 201,
  208. sysctl = 202,
  209. mlock = 203,
  210. munlock = 204,
  211. undelete = 205,
  212. /* 206 old ATsocket */
  213. /* 207 old ATgetmsg */
  214. /* 208 old ATputmsg */
  215. /* 209 old ATsndreq */
  216. /* 210 old ATsndrsp */
  217. /* 211 old ATgetreq */
  218. /* 212 old ATgetrsp */
  219. /* 213 Reserved for AppleTalk */
  220. /* 214 */
  221. /* 215 */
  222. open_dprotected_np = 216,
  223. fsgetpath_ext = 217,
  224. /* 218 old lstatv */
  225. /* 219 old fstatv */
  226. getattrlist = 220,
  227. setattrlist = 221,
  228. getdirentriesattr = 222,
  229. exchangedata = 223,
  230. /* 224 old checkuseraccess or fsgetpath */
  231. searchfs = 225,
  232. delete = 226,
  233. copyfile = 227,
  234. fgetattrlist = 228,
  235. fsetattrlist = 229,
  236. poll = 230,
  237. /* 231 old watchevent */
  238. /* 232 old waitevent */
  239. /* 233 old modwatch */
  240. getxattr = 234,
  241. fgetxattr = 235,
  242. setxattr = 236,
  243. fsetxattr = 237,
  244. removexattr = 238,
  245. fremovexattr = 239,
  246. listxattr = 240,
  247. flistxattr = 241,
  248. fsctl = 242,
  249. initgroups = 243,
  250. posix_spawn = 244,
  251. ffsctl = 245,
  252. /* 246 */
  253. nfsclnt = 247,
  254. fhopen = 248,
  255. /* 249 */
  256. minherit = 250,
  257. semsys = 251,
  258. msgsys = 252,
  259. shmsys = 253,
  260. semctl = 254,
  261. semget = 255,
  262. semop = 256,
  263. /* 257 old semconfig */
  264. msgctl = 258,
  265. msgget = 259,
  266. msgsnd = 260,
  267. msgrcv = 261,
  268. shmat = 262,
  269. shmctl = 263,
  270. shmdt = 264,
  271. shmget = 265,
  272. shm_open = 266,
  273. shm_unlink = 267,
  274. sem_open = 268,
  275. sem_close = 269,
  276. sem_unlink = 270,
  277. sem_wait = 271,
  278. sem_trywait = 272,
  279. sem_post = 273,
  280. sysctlbyname = 274,
  281. /* 275 old sem_init */
  282. /* 276 old sem_destroy */
  283. open_extended = 277,
  284. umask_extended = 278,
  285. stat_extended = 279,
  286. lstat_extended = 280,
  287. fstat_extended = 281,
  288. chmod_extended = 282,
  289. fchmod_extended = 283,
  290. access_extended = 284,
  291. settid = 285,
  292. gettid = 286,
  293. setsgroups = 287,
  294. getsgroups = 288,
  295. setwgroups = 289,
  296. getwgroups = 290,
  297. mkfifo_extended = 291,
  298. mkdir_extended = 292,
  299. identitysvc = 293,
  300. shared_region_check_np = 294,
  301. /* 295 old shared_region_map_np */
  302. vm_pressure_monitor = 296,
  303. psynch_rw_longrdlock = 297,
  304. psynch_rw_yieldwrlock = 298,
  305. psynch_rw_downgrade = 299,
  306. psynch_rw_upgrade = 300,
  307. psynch_mutexwait = 301,
  308. psynch_mutexdrop = 302,
  309. psynch_cvbroad = 303,
  310. psynch_cvsignal = 304,
  311. psynch_cvwait = 305,
  312. psynch_rw_rdlock = 306,
  313. psynch_rw_wrlock = 307,
  314. psynch_rw_unlock = 308,
  315. psynch_rw_unlock2 = 309,
  316. getsid = 310,
  317. settid_with_pid = 311,
  318. psynch_cvclrprepost = 312,
  319. aio_fsync = 313,
  320. aio_return = 314,
  321. aio_suspend = 315,
  322. aio_cancel = 316,
  323. aio_error = 317,
  324. aio_read = 318,
  325. aio_write = 319,
  326. lio_listio = 320,
  327. /* 321 old __pthread_cond_wait */
  328. iopolicysys = 322,
  329. process_policy = 323,
  330. mlockall = 324,
  331. munlockall = 325,
  332. /* 326 */
  333. issetugid = 327,
  334. __pthread_kill = 328,
  335. __pthread_sigmask = 329,
  336. __sigwait = 330,
  337. __disable_threadsignal = 331,
  338. __pthread_markcancel = 332,
  339. __pthread_canceled = 333,
  340. __semwait_signal = 334,
  341. /* 335 old utrace */
  342. proc_info = 336,
  343. sendfile = 337,
  344. stat64 = 338,
  345. fstat64 = 339,
  346. lstat64 = 340,
  347. stat64_extended = 341,
  348. lstat64_extended = 342,
  349. fstat64_extended = 343,
  350. getdirentries64 = 344,
  351. statfs64 = 345,
  352. fstatfs64 = 346,
  353. getfsstat64 = 347,
  354. __pthread_chdir = 348,
  355. __pthread_fchdir = 349,
  356. audit = 350,
  357. auditon = 351,
  358. /* 352 */
  359. getauid = 353,
  360. setauid = 354,
  361. /* 355 old getaudit */
  362. /* 356 old setaudit */
  363. getaudit_addr = 357,
  364. setaudit_addr = 358,
  365. auditctl = 359,
  366. bsdthread_create = 360,
  367. bsdthread_terminate = 361,
  368. kqueue = 362,
  369. kevent = 363,
  370. lchown = 364,
  371. /* 365 old stack_snapshot */
  372. bsdthread_register = 366,
  373. workq_open = 367,
  374. workq_kernreturn = 368,
  375. kevent64 = 369,
  376. __old_semwait_signal = 370,
  377. __old_semwait_signal_nocancel = 371,
  378. thread_selfid = 372,
  379. ledger = 373,
  380. kevent_qos = 374,
  381. kevent_id = 375,
  382. /* 376 */
  383. /* 377 */
  384. /* 378 */
  385. /* 379 */
  386. __mac_execve = 380,
  387. __mac_syscall = 381,
  388. __mac_get_file = 382,
  389. __mac_set_file = 383,
  390. __mac_get_link = 384,
  391. __mac_set_link = 385,
  392. __mac_get_proc = 386,
  393. __mac_set_proc = 387,
  394. __mac_get_fd = 388,
  395. __mac_set_fd = 389,
  396. __mac_get_pid = 390,
  397. /* 391 */
  398. /* 392 */
  399. /* 393 */
  400. pselect = 394,
  401. pselect_nocancel = 395,
  402. read_nocancel = 396,
  403. write_nocancel = 397,
  404. open_nocancel = 398,
  405. close_nocancel = 399,
  406. wait4_nocancel = 400,
  407. recvmsg_nocancel = 401,
  408. sendmsg_nocancel = 402,
  409. recvfrom_nocancel = 403,
  410. accept_nocancel = 404,
  411. msync_nocancel = 405,
  412. fcntl_nocancel = 406,
  413. select_nocancel = 407,
  414. fsync_nocancel = 408,
  415. connect_nocancel = 409,
  416. sigsuspend_nocancel = 410,
  417. readv_nocancel = 411,
  418. writev_nocancel = 412,
  419. sendto_nocancel = 413,
  420. pread_nocancel = 414,
  421. pwrite_nocancel = 415,
  422. waitid_nocancel = 416,
  423. poll_nocancel = 417,
  424. msgsnd_nocancel = 418,
  425. msgrcv_nocancel = 419,
  426. sem_wait_nocancel = 420,
  427. aio_suspend_nocancel = 421,
  428. __sigwait_nocancel = 422,
  429. __semwait_signal_nocancel = 423,
  430. __mac_mount = 424,
  431. __mac_get_mount = 425,
  432. __mac_getfsstat = 426,
  433. fsgetpath = 427,
  434. audit_session_self = 428,
  435. audit_session_join = 429,
  436. fileport_makeport = 430,
  437. fileport_makefd = 431,
  438. audit_session_port = 432,
  439. pid_suspend = 433,
  440. pid_resume = 434,
  441. pid_hibernate = 435,
  442. pid_shutdown_sockets = 436,
  443. /* 437 old shared_region_slide_np */
  444. shared_region_map_and_slide_np = 438,
  445. kas_info = 439,
  446. memorystatus_control = 440,
  447. guarded_open_np = 441,
  448. guarded_close_np = 442,
  449. guarded_kqueue_np = 443,
  450. change_fdguard_np = 444,
  451. usrctl = 445,
  452. proc_rlimit_control = 446,
  453. connectx = 447,
  454. disconnectx = 448,
  455. peeloff = 449,
  456. socket_delegate = 450,
  457. telemetry = 451,
  458. proc_uuid_policy = 452,
  459. memorystatus_get_level = 453,
  460. system_override = 454,
  461. vfs_purge = 455,
  462. sfi_ctl = 456,
  463. sfi_pidctl = 457,
  464. coalition = 458,
  465. coalition_info = 459,
  466. necp_match_policy = 460,
  467. getattrlistbulk = 461,
  468. clonefileat = 462,
  469. openat = 463,
  470. openat_nocancel = 464,
  471. renameat = 465,
  472. faccessat = 466,
  473. fchmodat = 467,
  474. fchownat = 468,
  475. fstatat = 469,
  476. fstatat64 = 470,
  477. linkat = 471,
  478. unlinkat = 472,
  479. readlinkat = 473,
  480. symlinkat = 474,
  481. mkdirat = 475,
  482. getattrlistat = 476,
  483. proc_trace_log = 477,
  484. bsdthread_ctl = 478,
  485. openbyid_np = 479,
  486. recvmsg_x = 480,
  487. sendmsg_x = 481,
  488. thread_selfusage = 482,
  489. csrctl = 483,
  490. guarded_open_dprotected_np = 484,
  491. guarded_write_np = 485,
  492. guarded_pwrite_np = 486,
  493. guarded_writev_np = 487,
  494. renameatx_np = 488,
  495. mremap_encrypted = 489,
  496. netagent_trigger = 490,
  497. stack_snapshot_with_config = 491,
  498. microstackshot = 492,
  499. grab_pgo_data = 493,
  500. persona = 494,
  501. /* 495 */
  502. mach_eventlink_signal = 496,
  503. mach_eventlink_wait_until = 497,
  504. mach_eventlink_signal_wait_until = 498,
  505. work_interval_ctl = 499,
  506. getentropy = 500,
  507. necp_open = 501,
  508. necp_client_action = 502,
  509. nexus_open = 503, // for those who are intressted http://newosxbook.com/bonus/vol1ch16.html
  510. nexus_register = 504,
  511. nexus_deregister = 505,
  512. nexus_create = 506,
  513. nexus_destroy = 507,
  514. nexus_get_opt = 508,
  515. nexus_set_opt = 509,
  516. channel_open = 510,
  517. channel_get_info = 511,
  518. channel_sync = 512,
  519. channel_get_opt = 513,
  520. channel_set_opt = 514,
  521. ulock_wait = 515,
  522. ulock_wake = 516,
  523. fclonefileat = 517,
  524. fs_snapshot = 518,
  525. register_uexc_handler = 519,
  526. terminate_with_payload = 520,
  527. abort_with_payload = 521,
  528. necp_session_open = 522,
  529. necp_session_action = 523,
  530. setattrlistat = 524,
  531. net_qos_guideline = 525,
  532. fmount = 526,
  533. ntp_adjtime = 527,
  534. ntp_gettime = 528,
  535. os_fault_with_payload = 529,
  536. kqueue_workloop_ctl = 530,
  537. mach_bridge_remote_time = 531,
  538. coalition_ledger = 532,
  539. log_data = 533,
  540. memorystatus_available_memory = 534,
  541. objc_bp_assist_cfg_np = 535,
  542. shared_region_map_and_slide_2_np = 536,
  543. pivot_root = 537,
  544. task_inspect_for_pid = 538,
  545. task_read_for_pid = 539,
  546. preadv = 540,
  547. pwritev = 541,
  548. preadv_nocancel = 542,
  549. pwritev_nocancel = 543,
  550. ulock_wait2 = 544,
  551. proc_info_extended_id = 545,
  552. tracker_action = 546,
  553. debug_syscall_reject = 547,
  554. MAXSYSCALL = 548,
  555. /* invalid = 63, */
  556. }