A shell that runs x86_64 assembly
c
x86-64
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

syscalls.h 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. #ifndef __ASMSH_SYSCALLS_H
  2. #define __ASMSH_SYSCALLS_H
  3. #include <sys/syscall.h>
  4. typedef struct {
  5. const char *name;
  6. const unsigned int nr;
  7. } syscall_info_t;
  8. /*
  9. Generated with
  10. sed -E 's/^#define __NR_([^ ]*) .*$/\1, __NR_\1/' /usr/include/asm/unistd_64.h |\
  11. grep -Ev '^$|^#' |\
  12. tr "\n" ";" |\
  13. sed -e 's/^/{{"/' -e 's/$/}}\n/' -e 's/,/",/g' -e 's/;/},\n{"/g' -e 's/{"}//'
  14. Result might be :
  15. Copyright (C) 1995-2020 Free Software Foundation, Inc.
  16. From a file that is part of the GNU C Library.
  17. */
  18. const static syscall_info_t syscall_infos[] = {
  19. {"read", __NR_read},
  20. {"write", __NR_write},
  21. {"open", __NR_open},
  22. {"close", __NR_close},
  23. {"stat", __NR_stat},
  24. {"fstat", __NR_fstat},
  25. {"lstat", __NR_lstat},
  26. {"poll", __NR_poll},
  27. {"lseek", __NR_lseek},
  28. {"mmap", __NR_mmap},
  29. {"mprotect", __NR_mprotect},
  30. {"munmap", __NR_munmap},
  31. {"brk", __NR_brk},
  32. {"rt_sigaction", __NR_rt_sigaction},
  33. {"rt_sigprocmask", __NR_rt_sigprocmask},
  34. {"rt_sigreturn", __NR_rt_sigreturn},
  35. {"ioctl", __NR_ioctl},
  36. {"pread64", __NR_pread64},
  37. {"pwrite64", __NR_pwrite64},
  38. {"readv", __NR_readv},
  39. {"writev", __NR_writev},
  40. {"access", __NR_access},
  41. {"pipe", __NR_pipe},
  42. {"select", __NR_select},
  43. {"sched_yield", __NR_sched_yield},
  44. {"mremap", __NR_mremap},
  45. {"msync", __NR_msync},
  46. {"mincore", __NR_mincore},
  47. {"madvise", __NR_madvise},
  48. {"shmget", __NR_shmget},
  49. {"shmat", __NR_shmat},
  50. {"shmctl", __NR_shmctl},
  51. {"dup", __NR_dup},
  52. {"dup2", __NR_dup2},
  53. {"pause", __NR_pause},
  54. {"nanosleep", __NR_nanosleep},
  55. {"getitimer", __NR_getitimer},
  56. {"alarm", __NR_alarm},
  57. {"setitimer", __NR_setitimer},
  58. {"getpid", __NR_getpid},
  59. {"sendfile", __NR_sendfile},
  60. {"socket", __NR_socket},
  61. {"connect", __NR_connect},
  62. {"accept", __NR_accept},
  63. {"sendto", __NR_sendto},
  64. {"recvfrom", __NR_recvfrom},
  65. {"sendmsg", __NR_sendmsg},
  66. {"recvmsg", __NR_recvmsg},
  67. {"shutdown", __NR_shutdown},
  68. {"bind", __NR_bind},
  69. {"listen", __NR_listen},
  70. {"getsockname", __NR_getsockname},
  71. {"getpeername", __NR_getpeername},
  72. {"socketpair", __NR_socketpair},
  73. {"setsockopt", __NR_setsockopt},
  74. {"getsockopt", __NR_getsockopt},
  75. {"clone", __NR_clone},
  76. {"fork", __NR_fork},
  77. {"vfork", __NR_vfork},
  78. {"execve", __NR_execve},
  79. {"exit", __NR_exit},
  80. {"wait4", __NR_wait4},
  81. {"kill", __NR_kill},
  82. {"uname", __NR_uname},
  83. {"semget", __NR_semget},
  84. {"semop", __NR_semop},
  85. {"semctl", __NR_semctl},
  86. {"shmdt", __NR_shmdt},
  87. {"msgget", __NR_msgget},
  88. {"msgsnd", __NR_msgsnd},
  89. {"msgrcv", __NR_msgrcv},
  90. {"msgctl", __NR_msgctl},
  91. {"fcntl", __NR_fcntl},
  92. {"flock", __NR_flock},
  93. {"fsync", __NR_fsync},
  94. {"fdatasync", __NR_fdatasync},
  95. {"truncate", __NR_truncate},
  96. {"ftruncate", __NR_ftruncate},
  97. {"getdents", __NR_getdents},
  98. {"getcwd", __NR_getcwd},
  99. {"chdir", __NR_chdir},
  100. {"fchdir", __NR_fchdir},
  101. {"rename", __NR_rename},
  102. {"mkdir", __NR_mkdir},
  103. {"rmdir", __NR_rmdir},
  104. {"creat", __NR_creat},
  105. {"link", __NR_link},
  106. {"unlink", __NR_unlink},
  107. {"symlink", __NR_symlink},
  108. {"readlink", __NR_readlink},
  109. {"chmod", __NR_chmod},
  110. {"fchmod", __NR_fchmod},
  111. {"chown", __NR_chown},
  112. {"fchown", __NR_fchown},
  113. {"lchown", __NR_lchown},
  114. {"umask", __NR_umask},
  115. {"gettimeofday", __NR_gettimeofday},
  116. {"getrlimit", __NR_getrlimit},
  117. {"getrusage", __NR_getrusage},
  118. {"sysinfo", __NR_sysinfo},
  119. {"times", __NR_times},
  120. {"ptrace", __NR_ptrace},
  121. {"getuid", __NR_getuid},
  122. {"syslog", __NR_syslog},
  123. {"getgid", __NR_getgid},
  124. {"setuid", __NR_setuid},
  125. {"setgid", __NR_setgid},
  126. {"geteuid", __NR_geteuid},
  127. {"getegid", __NR_getegid},
  128. {"setpgid", __NR_setpgid},
  129. {"getppid", __NR_getppid},
  130. {"getpgrp", __NR_getpgrp},
  131. {"setsid", __NR_setsid},
  132. {"setreuid", __NR_setreuid},
  133. {"setregid", __NR_setregid},
  134. {"getgroups", __NR_getgroups},
  135. {"setgroups", __NR_setgroups},
  136. {"setresuid", __NR_setresuid},
  137. {"getresuid", __NR_getresuid},
  138. {"setresgid", __NR_setresgid},
  139. {"getresgid", __NR_getresgid},
  140. {"getpgid", __NR_getpgid},
  141. {"setfsuid", __NR_setfsuid},
  142. {"setfsgid", __NR_setfsgid},
  143. {"getsid", __NR_getsid},
  144. {"capget", __NR_capget},
  145. {"capset", __NR_capset},
  146. {"rt_sigpending", __NR_rt_sigpending},
  147. {"rt_sigtimedwait", __NR_rt_sigtimedwait},
  148. {"rt_sigqueueinfo", __NR_rt_sigqueueinfo},
  149. {"rt_sigsuspend", __NR_rt_sigsuspend},
  150. {"sigaltstack", __NR_sigaltstack},
  151. {"utime", __NR_utime},
  152. {"mknod", __NR_mknod},
  153. {"uselib", __NR_uselib},
  154. {"personality", __NR_personality},
  155. {"ustat", __NR_ustat},
  156. {"statfs", __NR_statfs},
  157. {"fstatfs", __NR_fstatfs},
  158. {"sysfs", __NR_sysfs},
  159. {"getpriority", __NR_getpriority},
  160. {"setpriority", __NR_setpriority},
  161. {"sched_setparam", __NR_sched_setparam},
  162. {"sched_getparam", __NR_sched_getparam},
  163. {"sched_setscheduler", __NR_sched_setscheduler},
  164. {"sched_getscheduler", __NR_sched_getscheduler},
  165. {"sched_get_priority_max", __NR_sched_get_priority_max},
  166. {"sched_get_priority_min", __NR_sched_get_priority_min},
  167. {"sched_rr_get_interval", __NR_sched_rr_get_interval},
  168. {"mlock", __NR_mlock},
  169. {"munlock", __NR_munlock},
  170. {"mlockall", __NR_mlockall},
  171. {"munlockall", __NR_munlockall},
  172. {"vhangup", __NR_vhangup},
  173. {"modify_ldt", __NR_modify_ldt},
  174. {"pivot_root", __NR_pivot_root},
  175. {"_sysctl", __NR__sysctl},
  176. {"prctl", __NR_prctl},
  177. {"arch_prctl", __NR_arch_prctl},
  178. {"adjtimex", __NR_adjtimex},
  179. {"setrlimit", __NR_setrlimit},
  180. {"chroot", __NR_chroot},
  181. {"sync", __NR_sync},
  182. {"acct", __NR_acct},
  183. {"settimeofday", __NR_settimeofday},
  184. {"mount", __NR_mount},
  185. {"umount2", __NR_umount2},
  186. {"swapon", __NR_swapon},
  187. {"swapoff", __NR_swapoff},
  188. {"reboot", __NR_reboot},
  189. {"sethostname", __NR_sethostname},
  190. {"setdomainname", __NR_setdomainname},
  191. {"iopl", __NR_iopl},
  192. {"ioperm", __NR_ioperm},
  193. {"create_module", __NR_create_module},
  194. {"init_module", __NR_init_module},
  195. {"delete_module", __NR_delete_module},
  196. {"get_kernel_syms", __NR_get_kernel_syms},
  197. {"query_module", __NR_query_module},
  198. {"quotactl", __NR_quotactl},
  199. {"nfsservctl", __NR_nfsservctl},
  200. {"getpmsg", __NR_getpmsg},
  201. {"putpmsg", __NR_putpmsg},
  202. {"afs_syscall", __NR_afs_syscall},
  203. {"tuxcall", __NR_tuxcall},
  204. {"security", __NR_security},
  205. {"gettid", __NR_gettid},
  206. {"readahead", __NR_readahead},
  207. {"setxattr", __NR_setxattr},
  208. {"lsetxattr", __NR_lsetxattr},
  209. {"fsetxattr", __NR_fsetxattr},
  210. {"getxattr", __NR_getxattr},
  211. {"lgetxattr", __NR_lgetxattr},
  212. {"fgetxattr", __NR_fgetxattr},
  213. {"listxattr", __NR_listxattr},
  214. {"llistxattr", __NR_llistxattr},
  215. {"flistxattr", __NR_flistxattr},
  216. {"removexattr", __NR_removexattr},
  217. {"lremovexattr", __NR_lremovexattr},
  218. {"fremovexattr", __NR_fremovexattr},
  219. {"tkill", __NR_tkill},
  220. {"time", __NR_time},
  221. {"futex", __NR_futex},
  222. {"sched_setaffinity", __NR_sched_setaffinity},
  223. {"sched_getaffinity", __NR_sched_getaffinity},
  224. {"set_thread_area", __NR_set_thread_area},
  225. {"io_setup", __NR_io_setup},
  226. {"io_destroy", __NR_io_destroy},
  227. {"io_getevents", __NR_io_getevents},
  228. {"io_submit", __NR_io_submit},
  229. {"io_cancel", __NR_io_cancel},
  230. {"get_thread_area", __NR_get_thread_area},
  231. {"lookup_dcookie", __NR_lookup_dcookie},
  232. {"epoll_create", __NR_epoll_create},
  233. {"epoll_ctl_old", __NR_epoll_ctl_old},
  234. {"epoll_wait_old", __NR_epoll_wait_old},
  235. {"remap_file_pages", __NR_remap_file_pages},
  236. {"getdents64", __NR_getdents64},
  237. {"set_tid_address", __NR_set_tid_address},
  238. {"restart_syscall", __NR_restart_syscall},
  239. {"semtimedop", __NR_semtimedop},
  240. {"fadvise64", __NR_fadvise64},
  241. {"timer_create", __NR_timer_create},
  242. {"timer_settime", __NR_timer_settime},
  243. {"timer_gettime", __NR_timer_gettime},
  244. {"timer_getoverrun", __NR_timer_getoverrun},
  245. {"timer_delete", __NR_timer_delete},
  246. {"clock_settime", __NR_clock_settime},
  247. {"clock_gettime", __NR_clock_gettime},
  248. {"clock_getres", __NR_clock_getres},
  249. {"clock_nanosleep", __NR_clock_nanosleep},
  250. {"exit_group", __NR_exit_group},
  251. {"epoll_wait", __NR_epoll_wait},
  252. {"epoll_ctl", __NR_epoll_ctl},
  253. {"tgkill", __NR_tgkill},
  254. {"utimes", __NR_utimes},
  255. {"vserver", __NR_vserver},
  256. {"mbind", __NR_mbind},
  257. {"set_mempolicy", __NR_set_mempolicy},
  258. {"get_mempolicy", __NR_get_mempolicy},
  259. {"mq_open", __NR_mq_open},
  260. {"mq_unlink", __NR_mq_unlink},
  261. {"mq_timedsend", __NR_mq_timedsend},
  262. {"mq_timedreceive", __NR_mq_timedreceive},
  263. {"mq_notify", __NR_mq_notify},
  264. {"mq_getsetattr", __NR_mq_getsetattr},
  265. {"kexec_load", __NR_kexec_load},
  266. {"waitid", __NR_waitid},
  267. {"add_key", __NR_add_key},
  268. {"request_key", __NR_request_key},
  269. {"keyctl", __NR_keyctl},
  270. {"ioprio_set", __NR_ioprio_set},
  271. {"ioprio_get", __NR_ioprio_get},
  272. {"inotify_init", __NR_inotify_init},
  273. {"inotify_add_watch", __NR_inotify_add_watch},
  274. {"inotify_rm_watch", __NR_inotify_rm_watch},
  275. {"migrate_pages", __NR_migrate_pages},
  276. {"openat", __NR_openat},
  277. {"mkdirat", __NR_mkdirat},
  278. {"mknodat", __NR_mknodat},
  279. {"fchownat", __NR_fchownat},
  280. {"futimesat", __NR_futimesat},
  281. {"newfstatat", __NR_newfstatat},
  282. {"unlinkat", __NR_unlinkat},
  283. {"renameat", __NR_renameat},
  284. {"linkat", __NR_linkat},
  285. {"symlinkat", __NR_symlinkat},
  286. {"readlinkat", __NR_readlinkat},
  287. {"fchmodat", __NR_fchmodat},
  288. {"faccessat", __NR_faccessat},
  289. {"pselect6", __NR_pselect6},
  290. {"ppoll", __NR_ppoll},
  291. {"unshare", __NR_unshare},
  292. {"set_robust_list", __NR_set_robust_list},
  293. {"get_robust_list", __NR_get_robust_list},
  294. {"splice", __NR_splice},
  295. {"tee", __NR_tee},
  296. {"sync_file_range", __NR_sync_file_range},
  297. {"vmsplice", __NR_vmsplice},
  298. {"move_pages", __NR_move_pages},
  299. {"utimensat", __NR_utimensat},
  300. {"epoll_pwait", __NR_epoll_pwait},
  301. {"signalfd", __NR_signalfd},
  302. {"timerfd_create", __NR_timerfd_create},
  303. {"eventfd", __NR_eventfd},
  304. {"fallocate", __NR_fallocate},
  305. {"timerfd_settime", __NR_timerfd_settime},
  306. {"timerfd_gettime", __NR_timerfd_gettime},
  307. {"accept4", __NR_accept4},
  308. {"signalfd4", __NR_signalfd4},
  309. {"eventfd2", __NR_eventfd2},
  310. {"epoll_create1", __NR_epoll_create1},
  311. {"dup3", __NR_dup3},
  312. {"pipe2", __NR_pipe2},
  313. {"inotify_init1", __NR_inotify_init1},
  314. {"preadv", __NR_preadv},
  315. {"pwritev", __NR_pwritev},
  316. {"rt_tgsigqueueinfo", __NR_rt_tgsigqueueinfo},
  317. {"perf_event_open", __NR_perf_event_open},
  318. {"recvmmsg", __NR_recvmmsg},
  319. {"fanotify_init", __NR_fanotify_init},
  320. {"fanotify_mark", __NR_fanotify_mark},
  321. {"prlimit64", __NR_prlimit64},
  322. {"name_to_handle_at", __NR_name_to_handle_at},
  323. {"open_by_handle_at", __NR_open_by_handle_at},
  324. {"clock_adjtime", __NR_clock_adjtime},
  325. {"syncfs", __NR_syncfs},
  326. {"sendmmsg", __NR_sendmmsg},
  327. {"setns", __NR_setns},
  328. {"getcpu", __NR_getcpu},
  329. {"process_vm_readv", __NR_process_vm_readv},
  330. {"process_vm_writev", __NR_process_vm_writev},
  331. {"kcmp", __NR_kcmp},
  332. {"finit_module", __NR_finit_module},
  333. {"sched_setattr", __NR_sched_setattr},
  334. {"sched_getattr", __NR_sched_getattr},
  335. {"renameat2", __NR_renameat2},
  336. {"seccomp", __NR_seccomp},
  337. {"getrandom", __NR_getrandom},
  338. {"memfd_create", __NR_memfd_create},
  339. {"kexec_file_load", __NR_kexec_file_load},
  340. {"bpf", __NR_bpf},
  341. {"execveat", __NR_execveat},
  342. {"userfaultfd", __NR_userfaultfd},
  343. {"membarrier", __NR_membarrier},
  344. {"mlock2", __NR_mlock2},
  345. {"copy_file_range", __NR_copy_file_range},
  346. {"preadv2", __NR_preadv2},
  347. {"pwritev2", __NR_pwritev2},
  348. {"pkey_mprotect", __NR_pkey_mprotect},
  349. {"pkey_alloc", __NR_pkey_alloc},
  350. {"pkey_free", __NR_pkey_free},
  351. {"statx", __NR_statx},
  352. {"io_pgetevents", __NR_io_pgetevents},
  353. {"rseq", __NR_rseq},
  354. {"pidfd_send_signal", __NR_pidfd_send_signal},
  355. {"io_uring_setup", __NR_io_uring_setup},
  356. {"io_uring_enter", __NR_io_uring_enter},
  357. {"io_uring_register", __NR_io_uring_register},
  358. {"open_tree", __NR_open_tree},
  359. {"move_mount", __NR_move_mount},
  360. {"fsopen", __NR_fsopen},
  361. {"fsconfig", __NR_fsconfig},
  362. {"fsmount", __NR_fsmount},
  363. {"fspick", __NR_fspick},
  364. {"pidfd_open", __NR_pidfd_open},
  365. {"clone3", __NR_clone3},
  366. {"close_range", __NR_close_range},
  367. {"openat2", __NR_openat2},
  368. {"pidfd_getfd", __NR_pidfd_getfd},
  369. {"faccessat2", __NR_faccessat2},
  370. {"process_madvise", __NR_process_madvise},
  371. };
  372. #endif