1 /*
2 * Copyright (C) 2024 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "berberis/guest_os_primitives/gen_syscall_numbers.h"
18
19 namespace berberis {
20
ToHostSyscallNumber(int nr)21 int ToHostSyscallNumber(int nr) {
22 switch (nr) {
23 case 202: // __NR_accept
24 return 43;
25 case 242: // __NR_accept4
26 return 288;
27 case 89: // __NR_acct
28 return 163;
29 case 217: // __NR_add_key
30 return 248;
31 case 171: // __NR_adjtimex
32 return 159;
33 case 200: // __NR_bind
34 return 49;
35 case 280: // __NR_bpf
36 return 321;
37 case 214: // __NR_brk
38 return 12;
39 case 90: // __NR_capget
40 return 125;
41 case 91: // __NR_capset
42 return 126;
43 case 49: // __NR_chdir
44 return 80;
45 case 51: // __NR_chroot
46 return 161;
47 case 266: // __NR_clock_adjtime
48 return 305;
49 case 114: // __NR_clock_getres
50 return 229;
51 case 113: // __NR_clock_gettime
52 return 228;
53 case 115: // __NR_clock_nanosleep
54 return 230;
55 case 112: // __NR_clock_settime
56 return 227;
57 case 220: // __NR_clone
58 return 56;
59 case 435: // __NR_clone3
60 return 435;
61 case 57: // __NR_close
62 return 3;
63 case 436: // __NR_close_range
64 return 436;
65 case 203: // __NR_connect
66 return 42;
67 case 285: // __NR_copy_file_range
68 return 326;
69 case 106: // __NR_delete_module
70 return 176;
71 case 23: // __NR_dup
72 return 32;
73 case 24: // __NR_dup3
74 return 292;
75 case 20: // __NR_epoll_create1
76 return 291;
77 case 21: // __NR_epoll_ctl
78 return 233;
79 case 22: // __NR_epoll_pwait
80 return 281;
81 case 441: // __NR_epoll_pwait2
82 return 441;
83 case 19: // __NR_eventfd2
84 return 290;
85 case 221: // __NR_execve
86 return 59;
87 case 281: // __NR_execveat
88 return 322;
89 case 93: // __NR_exit
90 return 60;
91 case 94: // __NR_exit_group
92 return 231;
93 case 48: // __NR_faccessat
94 return 269;
95 case 439: // __NR_faccessat2
96 return 439;
97 case 223: // __NR_fadvise64
98 return 221;
99 case 47: // __NR_fallocate
100 return 285;
101 case 262: // __NR_fanotify_init
102 return 300;
103 case 263: // __NR_fanotify_mark
104 return 301;
105 case 50: // __NR_fchdir
106 return 81;
107 case 52: // __NR_fchmod
108 return 91;
109 case 53: // __NR_fchmodat
110 return 268;
111 case 55: // __NR_fchown
112 return 93;
113 case 54: // __NR_fchownat
114 return 260;
115 case 25: // __NR_fcntl
116 return 72;
117 case 83: // __NR_fdatasync
118 return 75;
119 case 10: // __NR_fgetxattr
120 return 193;
121 case 273: // __NR_finit_module
122 return 313;
123 case 13: // __NR_flistxattr
124 return 196;
125 case 32: // __NR_flock
126 return 73;
127 case 16: // __NR_fremovexattr
128 return 199;
129 case 431: // __NR_fsconfig
130 return 431;
131 case 7: // __NR_fsetxattr
132 return 190;
133 case 432: // __NR_fsmount
134 return 432;
135 case 430: // __NR_fsopen
136 return 430;
137 case 433: // __NR_fspick
138 return 433;
139 case 80: // __NR_fstat
140 return 5;
141 case 44: // __NR_fstatfs
142 return 138;
143 case 82: // __NR_fsync
144 return 74;
145 case 46: // __NR_ftruncate
146 return 77;
147 case 98: // __NR_futex
148 return 202;
149 case 449: // __NR_futex_waitv
150 return 449;
151 case 236: // __NR_get_mempolicy
152 return 239;
153 case 100: // __NR_get_robust_list
154 return 274;
155 case 168: // __NR_getcpu
156 return 309;
157 case 17: // __NR_getcwd
158 return 79;
159 case 61: // __NR_getdents64
160 return 217;
161 case 177: // __NR_getegid
162 return 108;
163 case 175: // __NR_geteuid
164 return 107;
165 case 176: // __NR_getgid
166 return 104;
167 case 158: // __NR_getgroups
168 return 115;
169 case 102: // __NR_getitimer
170 return 36;
171 case 205: // __NR_getpeername
172 return 52;
173 case 155: // __NR_getpgid
174 return 121;
175 case 172: // __NR_getpid
176 return 39;
177 case 173: // __NR_getppid
178 return 110;
179 case 141: // __NR_getpriority
180 return 140;
181 case 278: // __NR_getrandom
182 return 318;
183 case 150: // __NR_getresgid
184 return 120;
185 case 148: // __NR_getresuid
186 return 118;
187 case 163: // __NR_getrlimit
188 return 97;
189 case 165: // __NR_getrusage
190 return 98;
191 case 156: // __NR_getsid
192 return 124;
193 case 204: // __NR_getsockname
194 return 51;
195 case 209: // __NR_getsockopt
196 return 55;
197 case 178: // __NR_gettid
198 return 186;
199 case 169: // __NR_gettimeofday
200 return 96;
201 case 174: // __NR_getuid
202 return 102;
203 case 8: // __NR_getxattr
204 return 191;
205 case 105: // __NR_init_module
206 return 175;
207 case 27: // __NR_inotify_add_watch
208 return 254;
209 case 26: // __NR_inotify_init1
210 return 294;
211 case 28: // __NR_inotify_rm_watch
212 return 255;
213 case 3: // __NR_io_cancel
214 return 210;
215 case 1: // __NR_io_destroy
216 return 207;
217 case 4: // __NR_io_getevents
218 return 208;
219 case 292: // __NR_io_pgetevents
220 return 333;
221 case 0: // __NR_io_setup
222 return 206;
223 case 2: // __NR_io_submit
224 return 209;
225 case 426: // __NR_io_uring_enter
226 return 426;
227 case 427: // __NR_io_uring_register
228 return 427;
229 case 425: // __NR_io_uring_setup
230 return 425;
231 case 29: // __NR_ioctl
232 return 16;
233 case 31: // __NR_ioprio_get
234 return 252;
235 case 30: // __NR_ioprio_set
236 return 251;
237 case 272: // __NR_kcmp
238 return 312;
239 case 294: // __NR_kexec_file_load
240 return 320;
241 case 104: // __NR_kexec_load
242 return 246;
243 case 219: // __NR_keyctl
244 return 250;
245 case 129: // __NR_kill
246 return 62;
247 case 445: // __NR_landlock_add_rule
248 return 445;
249 case 444: // __NR_landlock_create_ruleset
250 return 444;
251 case 446: // __NR_landlock_restrict_self
252 return 446;
253 case 9: // __NR_lgetxattr
254 return 192;
255 case 37: // __NR_linkat
256 return 265;
257 case 201: // __NR_listen
258 return 50;
259 case 11: // __NR_listxattr
260 return 194;
261 case 12: // __NR_llistxattr
262 return 195;
263 case 18: // __NR_lookup_dcookie
264 return 212;
265 case 15: // __NR_lremovexattr
266 return 198;
267 case 62: // __NR_lseek
268 return 8;
269 case 6: // __NR_lsetxattr
270 return 189;
271 case 233: // __NR_madvise
272 return 28;
273 case 235: // __NR_mbind
274 return 237;
275 case 283: // __NR_membarrier
276 return 324;
277 case 279: // __NR_memfd_create
278 return 319;
279 case 447: // __NR_memfd_secret
280 return 447;
281 case 238: // __NR_migrate_pages
282 return 256;
283 case 232: // __NR_mincore
284 return 27;
285 case 34: // __NR_mkdirat
286 return 258;
287 case 33: // __NR_mknodat
288 return 259;
289 case 228: // __NR_mlock
290 return 149;
291 case 284: // __NR_mlock2
292 return 325;
293 case 230: // __NR_mlockall
294 return 151;
295 case 222: // __NR_mmap
296 return 9;
297 case 40: // __NR_mount
298 return 165;
299 case 442: // __NR_mount_setattr
300 return 442;
301 case 429: // __NR_move_mount
302 return 429;
303 case 239: // __NR_move_pages
304 return 279;
305 case 226: // __NR_mprotect
306 return 10;
307 case 185: // __NR_mq_getsetattr
308 return 245;
309 case 184: // __NR_mq_notify
310 return 244;
311 case 180: // __NR_mq_open
312 return 240;
313 case 183: // __NR_mq_timedreceive
314 return 243;
315 case 182: // __NR_mq_timedsend
316 return 242;
317 case 181: // __NR_mq_unlink
318 return 241;
319 case 216: // __NR_mremap
320 return 25;
321 case 187: // __NR_msgctl
322 return 71;
323 case 186: // __NR_msgget
324 return 68;
325 case 188: // __NR_msgrcv
326 return 70;
327 case 189: // __NR_msgsnd
328 return 69;
329 case 227: // __NR_msync
330 return 26;
331 case 229: // __NR_munlock
332 return 150;
333 case 231: // __NR_munlockall
334 return 152;
335 case 215: // __NR_munmap
336 return 11;
337 case 264: // __NR_name_to_handle_at
338 return 303;
339 case 101: // __NR_nanosleep
340 return 35;
341 case 79: // __NR_newfstatat
342 return 262;
343 case 42: // __NR_nfsservctl
344 return 180;
345 case 265: // __NR_open_by_handle_at
346 return 304;
347 case 428: // __NR_open_tree
348 return 428;
349 case 56: // __NR_openat
350 return 257;
351 case 437: // __NR_openat2
352 return 437;
353 case 241: // __NR_perf_event_open
354 return 298;
355 case 92: // __NR_personality
356 return 135;
357 case 438: // __NR_pidfd_getfd
358 return 438;
359 case 434: // __NR_pidfd_open
360 return 434;
361 case 424: // __NR_pidfd_send_signal
362 return 424;
363 case 59: // __NR_pipe2
364 return 293;
365 case 41: // __NR_pivot_root
366 return 155;
367 case 289: // __NR_pkey_alloc
368 return 330;
369 case 290: // __NR_pkey_free
370 return 331;
371 case 288: // __NR_pkey_mprotect
372 return 329;
373 case 73: // __NR_ppoll
374 return 271;
375 case 167: // __NR_prctl
376 return 157;
377 case 67: // __NR_pread64
378 return 17;
379 case 69: // __NR_preadv
380 return 295;
381 case 286: // __NR_preadv2
382 return 327;
383 case 261: // __NR_prlimit64
384 return 302;
385 case 440: // __NR_process_madvise
386 return 440;
387 case 448: // __NR_process_mrelease
388 return 448;
389 case 270: // __NR_process_vm_readv
390 return 310;
391 case 271: // __NR_process_vm_writev
392 return 311;
393 case 72: // __NR_pselect6
394 return 270;
395 case 117: // __NR_ptrace
396 return 101;
397 case 68: // __NR_pwrite64
398 return 18;
399 case 70: // __NR_pwritev
400 return 296;
401 case 287: // __NR_pwritev2
402 return 328;
403 case 60: // __NR_quotactl
404 return 179;
405 case 443: // __NR_quotactl_fd
406 return 443;
407 case 63: // __NR_read
408 return 0;
409 case 213: // __NR_readahead
410 return 187;
411 case 78: // __NR_readlinkat
412 return 267;
413 case 65: // __NR_readv
414 return 19;
415 case 142: // __NR_reboot
416 return 169;
417 case 207: // __NR_recvfrom
418 return 45;
419 case 243: // __NR_recvmmsg
420 return 299;
421 case 212: // __NR_recvmsg
422 return 47;
423 case 234: // __NR_remap_file_pages
424 return 216;
425 case 14: // __NR_removexattr
426 return 197;
427 case 38: // __NR_renameat
428 return 264;
429 case 276: // __NR_renameat2
430 return 316;
431 case 218: // __NR_request_key
432 return 249;
433 case 128: // __NR_restart_syscall
434 return 219;
435 case 293: // __NR_rseq
436 return 334;
437 case 134: // __NR_rt_sigaction
438 return 13;
439 case 136: // __NR_rt_sigpending
440 return 127;
441 case 135: // __NR_rt_sigprocmask
442 return 14;
443 case 138: // __NR_rt_sigqueueinfo
444 return 129;
445 case 139: // __NR_rt_sigreturn
446 return 15;
447 case 133: // __NR_rt_sigsuspend
448 return 130;
449 case 137: // __NR_rt_sigtimedwait
450 return 128;
451 case 240: // __NR_rt_tgsigqueueinfo
452 return 297;
453 case 125: // __NR_sched_get_priority_max
454 return 146;
455 case 126: // __NR_sched_get_priority_min
456 return 147;
457 case 123: // __NR_sched_getaffinity
458 return 204;
459 case 275: // __NR_sched_getattr
460 return 315;
461 case 121: // __NR_sched_getparam
462 return 143;
463 case 120: // __NR_sched_getscheduler
464 return 145;
465 case 127: // __NR_sched_rr_get_interval
466 return 148;
467 case 122: // __NR_sched_setaffinity
468 return 203;
469 case 274: // __NR_sched_setattr
470 return 314;
471 case 118: // __NR_sched_setparam
472 return 142;
473 case 119: // __NR_sched_setscheduler
474 return 144;
475 case 124: // __NR_sched_yield
476 return 24;
477 case 277: // __NR_seccomp
478 return 317;
479 case 191: // __NR_semctl
480 return 66;
481 case 190: // __NR_semget
482 return 64;
483 case 193: // __NR_semop
484 return 65;
485 case 192: // __NR_semtimedop
486 return 220;
487 case 71: // __NR_sendfile
488 return 40;
489 case 269: // __NR_sendmmsg
490 return 307;
491 case 211: // __NR_sendmsg
492 return 46;
493 case 206: // __NR_sendto
494 return 44;
495 case 237: // __NR_set_mempolicy
496 return 238;
497 case 450: // __NR_set_mempolicy_home_node
498 return 450;
499 case 99: // __NR_set_robust_list
500 return 273;
501 case 96: // __NR_set_tid_address
502 return 218;
503 case 162: // __NR_setdomainname
504 return 171;
505 case 152: // __NR_setfsgid
506 return 123;
507 case 151: // __NR_setfsuid
508 return 122;
509 case 144: // __NR_setgid
510 return 106;
511 case 159: // __NR_setgroups
512 return 116;
513 case 161: // __NR_sethostname
514 return 170;
515 case 103: // __NR_setitimer
516 return 38;
517 case 268: // __NR_setns
518 return 308;
519 case 154: // __NR_setpgid
520 return 109;
521 case 140: // __NR_setpriority
522 return 141;
523 case 143: // __NR_setregid
524 return 114;
525 case 149: // __NR_setresgid
526 return 119;
527 case 147: // __NR_setresuid
528 return 117;
529 case 145: // __NR_setreuid
530 return 113;
531 case 164: // __NR_setrlimit
532 return 160;
533 case 157: // __NR_setsid
534 return 112;
535 case 208: // __NR_setsockopt
536 return 54;
537 case 170: // __NR_settimeofday
538 return 164;
539 case 146: // __NR_setuid
540 return 105;
541 case 5: // __NR_setxattr
542 return 188;
543 case 196: // __NR_shmat
544 return 30;
545 case 195: // __NR_shmctl
546 return 31;
547 case 197: // __NR_shmdt
548 return 67;
549 case 194: // __NR_shmget
550 return 29;
551 case 210: // __NR_shutdown
552 return 48;
553 case 132: // __NR_sigaltstack
554 return 131;
555 case 74: // __NR_signalfd4
556 return 289;
557 case 198: // __NR_socket
558 return 41;
559 case 199: // __NR_socketpair
560 return 53;
561 case 76: // __NR_splice
562 return 275;
563 case 43: // __NR_statfs
564 return 137;
565 case 291: // __NR_statx
566 return 332;
567 case 225: // __NR_swapoff
568 return 168;
569 case 224: // __NR_swapon
570 return 167;
571 case 36: // __NR_symlinkat
572 return 266;
573 case 81: // __NR_sync
574 return 162;
575 case 84: // __NR_sync_file_range
576 return 277;
577 case 267: // __NR_syncfs
578 return 306;
579 case 179: // __NR_sysinfo
580 return 99;
581 case 116: // __NR_syslog
582 return 103;
583 case 77: // __NR_tee
584 return 276;
585 case 131: // __NR_tgkill
586 return 234;
587 case 107: // __NR_timer_create
588 return 222;
589 case 111: // __NR_timer_delete
590 return 226;
591 case 109: // __NR_timer_getoverrun
592 return 225;
593 case 108: // __NR_timer_gettime
594 return 224;
595 case 110: // __NR_timer_settime
596 return 223;
597 case 85: // __NR_timerfd_create
598 return 283;
599 case 87: // __NR_timerfd_gettime
600 return 287;
601 case 86: // __NR_timerfd_settime
602 return 286;
603 case 153: // __NR_times
604 return 100;
605 case 130: // __NR_tkill
606 return 200;
607 case 45: // __NR_truncate
608 return 76;
609 case 166: // __NR_umask
610 return 95;
611 case 39: // __NR_umount2
612 return 166;
613 case 160: // __NR_uname
614 return 63;
615 case 35: // __NR_unlinkat
616 return 263;
617 case 97: // __NR_unshare
618 return 272;
619 case 282: // __NR_userfaultfd
620 return 323;
621 case 88: // __NR_utimensat
622 return 280;
623 case 58: // __NR_vhangup
624 return 153;
625 case 75: // __NR_vmsplice
626 return 278;
627 case 260: // __NR_wait4
628 return 61;
629 case 95: // __NR_waitid
630 return 247;
631 case 64: // __NR_write
632 return 1;
633 case 66: // __NR_writev
634 return 20;
635 default:
636 return -1;
637 }
638 }
639
ToGuestSyscallNumber(int nr)640 int ToGuestSyscallNumber(int nr) {
641 switch (nr) {
642 case 156: // __NR__sysctl - missing on riscv64
643 return -1;
644 case 43: // __NR_accept
645 return 202;
646 case 288: // __NR_accept4
647 return 242;
648 case 21: // __NR_access - missing on riscv64
649 return -1;
650 case 163: // __NR_acct
651 return 89;
652 case 248: // __NR_add_key
653 return 217;
654 case 159: // __NR_adjtimex
655 return 171;
656 case 183: // __NR_afs_syscall - missing on riscv64
657 return -1;
658 case 37: // __NR_alarm - missing on riscv64
659 return -1;
660 case 158: // __NR_arch_prctl - missing on riscv64
661 return -1;
662 case 49: // __NR_bind
663 return 200;
664 case 321: // __NR_bpf
665 return 280;
666 case 12: // __NR_brk
667 return 214;
668 case 125: // __NR_capget
669 return 90;
670 case 126: // __NR_capset
671 return 91;
672 case 80: // __NR_chdir
673 return 49;
674 case 90: // __NR_chmod - missing on riscv64
675 return -1;
676 case 92: // __NR_chown - missing on riscv64
677 return -1;
678 case 161: // __NR_chroot
679 return 51;
680 case 305: // __NR_clock_adjtime
681 return 266;
682 case 229: // __NR_clock_getres
683 return 114;
684 case 228: // __NR_clock_gettime
685 return 113;
686 case 230: // __NR_clock_nanosleep
687 return 115;
688 case 227: // __NR_clock_settime
689 return 112;
690 case 56: // __NR_clone
691 return 220;
692 case 435: // __NR_clone3
693 return 435;
694 case 3: // __NR_close
695 return 57;
696 case 436: // __NR_close_range
697 return 436;
698 case 42: // __NR_connect
699 return 203;
700 case 326: // __NR_copy_file_range
701 return 285;
702 case 85: // __NR_creat - missing on riscv64
703 return -1;
704 case 174: // __NR_create_module - missing on riscv64
705 return -1;
706 case 176: // __NR_delete_module
707 return 106;
708 case 32: // __NR_dup
709 return 23;
710 case 33: // __NR_dup2 - missing on riscv64
711 return -1;
712 case 292: // __NR_dup3
713 return 24;
714 case 213: // __NR_epoll_create - missing on riscv64
715 return -1;
716 case 291: // __NR_epoll_create1
717 return 20;
718 case 233: // __NR_epoll_ctl
719 return 21;
720 case 214: // __NR_epoll_ctl_old - missing on riscv64
721 return -1;
722 case 281: // __NR_epoll_pwait
723 return 22;
724 case 441: // __NR_epoll_pwait2
725 return 441;
726 case 232: // __NR_epoll_wait - missing on riscv64
727 return -1;
728 case 215: // __NR_epoll_wait_old - missing on riscv64
729 return -1;
730 case 284: // __NR_eventfd - missing on riscv64
731 return -1;
732 case 290: // __NR_eventfd2
733 return 19;
734 case 59: // __NR_execve
735 return 221;
736 case 322: // __NR_execveat
737 return 281;
738 case 60: // __NR_exit
739 return 93;
740 case 231: // __NR_exit_group
741 return 94;
742 case 269: // __NR_faccessat
743 return 48;
744 case 439: // __NR_faccessat2
745 return 439;
746 case 221: // __NR_fadvise64
747 return 223;
748 case 285: // __NR_fallocate
749 return 47;
750 case 300: // __NR_fanotify_init
751 return 262;
752 case 301: // __NR_fanotify_mark
753 return 263;
754 case 81: // __NR_fchdir
755 return 50;
756 case 91: // __NR_fchmod
757 return 52;
758 case 268: // __NR_fchmodat
759 return 53;
760 case 93: // __NR_fchown
761 return 55;
762 case 260: // __NR_fchownat
763 return 54;
764 case 72: // __NR_fcntl
765 return 25;
766 case 75: // __NR_fdatasync
767 return 83;
768 case 193: // __NR_fgetxattr
769 return 10;
770 case 313: // __NR_finit_module
771 return 273;
772 case 196: // __NR_flistxattr
773 return 13;
774 case 73: // __NR_flock
775 return 32;
776 case 57: // __NR_fork - missing on riscv64
777 return -1;
778 case 199: // __NR_fremovexattr
779 return 16;
780 case 431: // __NR_fsconfig
781 return 431;
782 case 190: // __NR_fsetxattr
783 return 7;
784 case 432: // __NR_fsmount
785 return 432;
786 case 430: // __NR_fsopen
787 return 430;
788 case 433: // __NR_fspick
789 return 433;
790 case 5: // __NR_fstat
791 return 80;
792 case 138: // __NR_fstatfs
793 return 44;
794 case 74: // __NR_fsync
795 return 82;
796 case 77: // __NR_ftruncate
797 return 46;
798 case 202: // __NR_futex
799 return 98;
800 case 449: // __NR_futex_waitv
801 return 449;
802 case 261: // __NR_futimesat - missing on riscv64
803 return -1;
804 case 177: // __NR_get_kernel_syms - missing on riscv64
805 return -1;
806 case 239: // __NR_get_mempolicy
807 return 236;
808 case 274: // __NR_get_robust_list
809 return 100;
810 case 211: // __NR_get_thread_area - missing on riscv64
811 return -1;
812 case 309: // __NR_getcpu
813 return 168;
814 case 79: // __NR_getcwd
815 return 17;
816 case 78: // __NR_getdents - missing on riscv64
817 return -1;
818 case 217: // __NR_getdents64
819 return 61;
820 case 108: // __NR_getegid
821 return 177;
822 case 107: // __NR_geteuid
823 return 175;
824 case 104: // __NR_getgid
825 return 176;
826 case 115: // __NR_getgroups
827 return 158;
828 case 36: // __NR_getitimer
829 return 102;
830 case 52: // __NR_getpeername
831 return 205;
832 case 121: // __NR_getpgid
833 return 155;
834 case 111: // __NR_getpgrp - missing on riscv64
835 return -1;
836 case 39: // __NR_getpid
837 return 172;
838 case 181: // __NR_getpmsg - missing on riscv64
839 return -1;
840 case 110: // __NR_getppid
841 return 173;
842 case 140: // __NR_getpriority
843 return 141;
844 case 318: // __NR_getrandom
845 return 278;
846 case 120: // __NR_getresgid
847 return 150;
848 case 118: // __NR_getresuid
849 return 148;
850 case 97: // __NR_getrlimit
851 return 163;
852 case 98: // __NR_getrusage
853 return 165;
854 case 124: // __NR_getsid
855 return 156;
856 case 51: // __NR_getsockname
857 return 204;
858 case 55: // __NR_getsockopt
859 return 209;
860 case 186: // __NR_gettid
861 return 178;
862 case 96: // __NR_gettimeofday
863 return 169;
864 case 102: // __NR_getuid
865 return 174;
866 case 191: // __NR_getxattr
867 return 8;
868 case 175: // __NR_init_module
869 return 105;
870 case 254: // __NR_inotify_add_watch
871 return 27;
872 case 253: // __NR_inotify_init - missing on riscv64
873 return -1;
874 case 294: // __NR_inotify_init1
875 return 26;
876 case 255: // __NR_inotify_rm_watch
877 return 28;
878 case 210: // __NR_io_cancel
879 return 3;
880 case 207: // __NR_io_destroy
881 return 1;
882 case 208: // __NR_io_getevents
883 return 4;
884 case 333: // __NR_io_pgetevents
885 return 292;
886 case 206: // __NR_io_setup
887 return 0;
888 case 209: // __NR_io_submit
889 return 2;
890 case 426: // __NR_io_uring_enter
891 return 426;
892 case 427: // __NR_io_uring_register
893 return 427;
894 case 425: // __NR_io_uring_setup
895 return 425;
896 case 16: // __NR_ioctl
897 return 29;
898 case 173: // __NR_ioperm - missing on riscv64
899 return -1;
900 case 172: // __NR_iopl - missing on riscv64
901 return -1;
902 case 252: // __NR_ioprio_get
903 return 31;
904 case 251: // __NR_ioprio_set
905 return 30;
906 case 312: // __NR_kcmp
907 return 272;
908 case 320: // __NR_kexec_file_load
909 return 294;
910 case 246: // __NR_kexec_load
911 return 104;
912 case 250: // __NR_keyctl
913 return 219;
914 case 62: // __NR_kill
915 return 129;
916 case 445: // __NR_landlock_add_rule
917 return 445;
918 case 444: // __NR_landlock_create_ruleset
919 return 444;
920 case 446: // __NR_landlock_restrict_self
921 return 446;
922 case 94: // __NR_lchown - missing on riscv64
923 return -1;
924 case 192: // __NR_lgetxattr
925 return 9;
926 case 86: // __NR_link - missing on riscv64
927 return -1;
928 case 265: // __NR_linkat
929 return 37;
930 case 50: // __NR_listen
931 return 201;
932 case 194: // __NR_listxattr
933 return 11;
934 case 195: // __NR_llistxattr
935 return 12;
936 case 212: // __NR_lookup_dcookie
937 return 18;
938 case 198: // __NR_lremovexattr
939 return 15;
940 case 8: // __NR_lseek
941 return 62;
942 case 189: // __NR_lsetxattr
943 return 6;
944 case 6: // __NR_lstat - missing on riscv64
945 return -1;
946 case 28: // __NR_madvise
947 return 233;
948 case 237: // __NR_mbind
949 return 235;
950 case 324: // __NR_membarrier
951 return 283;
952 case 319: // __NR_memfd_create
953 return 279;
954 case 447: // __NR_memfd_secret
955 return 447;
956 case 256: // __NR_migrate_pages
957 return 238;
958 case 27: // __NR_mincore
959 return 232;
960 case 83: // __NR_mkdir - missing on riscv64
961 return -1;
962 case 258: // __NR_mkdirat
963 return 34;
964 case 133: // __NR_mknod - missing on riscv64
965 return -1;
966 case 259: // __NR_mknodat
967 return 33;
968 case 149: // __NR_mlock
969 return 228;
970 case 325: // __NR_mlock2
971 return 284;
972 case 151: // __NR_mlockall
973 return 230;
974 case 9: // __NR_mmap
975 return 222;
976 case 154: // __NR_modify_ldt - missing on riscv64
977 return -1;
978 case 165: // __NR_mount
979 return 40;
980 case 442: // __NR_mount_setattr
981 return 442;
982 case 429: // __NR_move_mount
983 return 429;
984 case 279: // __NR_move_pages
985 return 239;
986 case 10: // __NR_mprotect
987 return 226;
988 case 245: // __NR_mq_getsetattr
989 return 185;
990 case 244: // __NR_mq_notify
991 return 184;
992 case 240: // __NR_mq_open
993 return 180;
994 case 243: // __NR_mq_timedreceive
995 return 183;
996 case 242: // __NR_mq_timedsend
997 return 182;
998 case 241: // __NR_mq_unlink
999 return 181;
1000 case 25: // __NR_mremap
1001 return 216;
1002 case 71: // __NR_msgctl
1003 return 187;
1004 case 68: // __NR_msgget
1005 return 186;
1006 case 70: // __NR_msgrcv
1007 return 188;
1008 case 69: // __NR_msgsnd
1009 return 189;
1010 case 26: // __NR_msync
1011 return 227;
1012 case 150: // __NR_munlock
1013 return 229;
1014 case 152: // __NR_munlockall
1015 return 231;
1016 case 11: // __NR_munmap
1017 return 215;
1018 case 303: // __NR_name_to_handle_at
1019 return 264;
1020 case 35: // __NR_nanosleep
1021 return 101;
1022 case 262: // __NR_newfstatat
1023 return 79;
1024 case 180: // __NR_nfsservctl
1025 return 42;
1026 case 2: // __NR_open - missing on riscv64
1027 return -1;
1028 case 304: // __NR_open_by_handle_at
1029 return 265;
1030 case 428: // __NR_open_tree
1031 return 428;
1032 case 257: // __NR_openat
1033 return 56;
1034 case 437: // __NR_openat2
1035 return 437;
1036 case 34: // __NR_pause - missing on riscv64
1037 return -1;
1038 case 298: // __NR_perf_event_open
1039 return 241;
1040 case 135: // __NR_personality
1041 return 92;
1042 case 438: // __NR_pidfd_getfd
1043 return 438;
1044 case 434: // __NR_pidfd_open
1045 return 434;
1046 case 424: // __NR_pidfd_send_signal
1047 return 424;
1048 case 22: // __NR_pipe - missing on riscv64
1049 return -1;
1050 case 293: // __NR_pipe2
1051 return 59;
1052 case 155: // __NR_pivot_root
1053 return 41;
1054 case 330: // __NR_pkey_alloc
1055 return 289;
1056 case 331: // __NR_pkey_free
1057 return 290;
1058 case 329: // __NR_pkey_mprotect
1059 return 288;
1060 case 7: // __NR_poll - missing on riscv64
1061 return -1;
1062 case 271: // __NR_ppoll
1063 return 73;
1064 case 157: // __NR_prctl
1065 return 167;
1066 case 17: // __NR_pread64
1067 return 67;
1068 case 295: // __NR_preadv
1069 return 69;
1070 case 327: // __NR_preadv2
1071 return 286;
1072 case 302: // __NR_prlimit64
1073 return 261;
1074 case 440: // __NR_process_madvise
1075 return 440;
1076 case 448: // __NR_process_mrelease
1077 return 448;
1078 case 310: // __NR_process_vm_readv
1079 return 270;
1080 case 311: // __NR_process_vm_writev
1081 return 271;
1082 case 270: // __NR_pselect6
1083 return 72;
1084 case 101: // __NR_ptrace
1085 return 117;
1086 case 182: // __NR_putpmsg - missing on riscv64
1087 return -1;
1088 case 18: // __NR_pwrite64
1089 return 68;
1090 case 296: // __NR_pwritev
1091 return 70;
1092 case 328: // __NR_pwritev2
1093 return 287;
1094 case 178: // __NR_query_module - missing on riscv64
1095 return -1;
1096 case 179: // __NR_quotactl
1097 return 60;
1098 case 443: // __NR_quotactl_fd
1099 return 443;
1100 case 0: // __NR_read
1101 return 63;
1102 case 187: // __NR_readahead
1103 return 213;
1104 case 89: // __NR_readlink - missing on riscv64
1105 return -1;
1106 case 267: // __NR_readlinkat
1107 return 78;
1108 case 19: // __NR_readv
1109 return 65;
1110 case 169: // __NR_reboot
1111 return 142;
1112 case 45: // __NR_recvfrom
1113 return 207;
1114 case 299: // __NR_recvmmsg
1115 return 243;
1116 case 47: // __NR_recvmsg
1117 return 212;
1118 case 216: // __NR_remap_file_pages
1119 return 234;
1120 case 197: // __NR_removexattr
1121 return 14;
1122 case 82: // __NR_rename - missing on riscv64
1123 return -1;
1124 case 264: // __NR_renameat
1125 return 38;
1126 case 316: // __NR_renameat2
1127 return 276;
1128 case 249: // __NR_request_key
1129 return 218;
1130 case 219: // __NR_restart_syscall
1131 return 128;
1132 case 84: // __NR_rmdir - missing on riscv64
1133 return -1;
1134 case 334: // __NR_rseq
1135 return 293;
1136 case 13: // __NR_rt_sigaction
1137 return 134;
1138 case 127: // __NR_rt_sigpending
1139 return 136;
1140 case 14: // __NR_rt_sigprocmask
1141 return 135;
1142 case 129: // __NR_rt_sigqueueinfo
1143 return 138;
1144 case 15: // __NR_rt_sigreturn
1145 return 139;
1146 case 130: // __NR_rt_sigsuspend
1147 return 133;
1148 case 128: // __NR_rt_sigtimedwait
1149 return 137;
1150 case 297: // __NR_rt_tgsigqueueinfo
1151 return 240;
1152 case 146: // __NR_sched_get_priority_max
1153 return 125;
1154 case 147: // __NR_sched_get_priority_min
1155 return 126;
1156 case 204: // __NR_sched_getaffinity
1157 return 123;
1158 case 315: // __NR_sched_getattr
1159 return 275;
1160 case 143: // __NR_sched_getparam
1161 return 121;
1162 case 145: // __NR_sched_getscheduler
1163 return 120;
1164 case 148: // __NR_sched_rr_get_interval
1165 return 127;
1166 case 203: // __NR_sched_setaffinity
1167 return 122;
1168 case 314: // __NR_sched_setattr
1169 return 274;
1170 case 142: // __NR_sched_setparam
1171 return 118;
1172 case 144: // __NR_sched_setscheduler
1173 return 119;
1174 case 24: // __NR_sched_yield
1175 return 124;
1176 case 317: // __NR_seccomp
1177 return 277;
1178 case 185: // __NR_security - missing on riscv64
1179 return -1;
1180 case 23: // __NR_select - missing on riscv64
1181 return -1;
1182 case 66: // __NR_semctl
1183 return 191;
1184 case 64: // __NR_semget
1185 return 190;
1186 case 65: // __NR_semop
1187 return 193;
1188 case 220: // __NR_semtimedop
1189 return 192;
1190 case 40: // __NR_sendfile
1191 return 71;
1192 case 307: // __NR_sendmmsg
1193 return 269;
1194 case 46: // __NR_sendmsg
1195 return 211;
1196 case 44: // __NR_sendto
1197 return 206;
1198 case 238: // __NR_set_mempolicy
1199 return 237;
1200 case 450: // __NR_set_mempolicy_home_node
1201 return 450;
1202 case 273: // __NR_set_robust_list
1203 return 99;
1204 case 205: // __NR_set_thread_area - missing on riscv64
1205 return -1;
1206 case 218: // __NR_set_tid_address
1207 return 96;
1208 case 171: // __NR_setdomainname
1209 return 162;
1210 case 123: // __NR_setfsgid
1211 return 152;
1212 case 122: // __NR_setfsuid
1213 return 151;
1214 case 106: // __NR_setgid
1215 return 144;
1216 case 116: // __NR_setgroups
1217 return 159;
1218 case 170: // __NR_sethostname
1219 return 161;
1220 case 38: // __NR_setitimer
1221 return 103;
1222 case 308: // __NR_setns
1223 return 268;
1224 case 109: // __NR_setpgid
1225 return 154;
1226 case 141: // __NR_setpriority
1227 return 140;
1228 case 114: // __NR_setregid
1229 return 143;
1230 case 119: // __NR_setresgid
1231 return 149;
1232 case 117: // __NR_setresuid
1233 return 147;
1234 case 113: // __NR_setreuid
1235 return 145;
1236 case 160: // __NR_setrlimit
1237 return 164;
1238 case 112: // __NR_setsid
1239 return 157;
1240 case 54: // __NR_setsockopt
1241 return 208;
1242 case 164: // __NR_settimeofday
1243 return 170;
1244 case 105: // __NR_setuid
1245 return 146;
1246 case 188: // __NR_setxattr
1247 return 5;
1248 case 30: // __NR_shmat
1249 return 196;
1250 case 31: // __NR_shmctl
1251 return 195;
1252 case 67: // __NR_shmdt
1253 return 197;
1254 case 29: // __NR_shmget
1255 return 194;
1256 case 48: // __NR_shutdown
1257 return 210;
1258 case 131: // __NR_sigaltstack
1259 return 132;
1260 case 282: // __NR_signalfd - missing on riscv64
1261 return -1;
1262 case 289: // __NR_signalfd4
1263 return 74;
1264 case 41: // __NR_socket
1265 return 198;
1266 case 53: // __NR_socketpair
1267 return 199;
1268 case 275: // __NR_splice
1269 return 76;
1270 case 4: // __NR_stat - missing on riscv64
1271 return -1;
1272 case 137: // __NR_statfs
1273 return 43;
1274 case 332: // __NR_statx
1275 return 291;
1276 case 168: // __NR_swapoff
1277 return 225;
1278 case 167: // __NR_swapon
1279 return 224;
1280 case 88: // __NR_symlink - missing on riscv64
1281 return -1;
1282 case 266: // __NR_symlinkat
1283 return 36;
1284 case 162: // __NR_sync
1285 return 81;
1286 case 277: // __NR_sync_file_range
1287 return 84;
1288 case 306: // __NR_syncfs
1289 return 267;
1290 case 139: // __NR_sysfs - missing on riscv64
1291 return -1;
1292 case 99: // __NR_sysinfo
1293 return 179;
1294 case 103: // __NR_syslog
1295 return 116;
1296 case 276: // __NR_tee
1297 return 77;
1298 case 234: // __NR_tgkill
1299 return 131;
1300 case 201: // __NR_time - missing on riscv64
1301 return -1;
1302 case 222: // __NR_timer_create
1303 return 107;
1304 case 226: // __NR_timer_delete
1305 return 111;
1306 case 225: // __NR_timer_getoverrun
1307 return 109;
1308 case 224: // __NR_timer_gettime
1309 return 108;
1310 case 223: // __NR_timer_settime
1311 return 110;
1312 case 283: // __NR_timerfd_create
1313 return 85;
1314 case 287: // __NR_timerfd_gettime
1315 return 87;
1316 case 286: // __NR_timerfd_settime
1317 return 86;
1318 case 100: // __NR_times
1319 return 153;
1320 case 200: // __NR_tkill
1321 return 130;
1322 case 76: // __NR_truncate
1323 return 45;
1324 case 184: // __NR_tuxcall - missing on riscv64
1325 return -1;
1326 case 95: // __NR_umask
1327 return 166;
1328 case 166: // __NR_umount2
1329 return 39;
1330 case 63: // __NR_uname
1331 return 160;
1332 case 87: // __NR_unlink - missing on riscv64
1333 return -1;
1334 case 263: // __NR_unlinkat
1335 return 35;
1336 case 272: // __NR_unshare
1337 return 97;
1338 case 134: // __NR_uselib - missing on riscv64
1339 return -1;
1340 case 323: // __NR_userfaultfd
1341 return 282;
1342 case 136: // __NR_ustat - missing on riscv64
1343 return -1;
1344 case 132: // __NR_utime - missing on riscv64
1345 return -1;
1346 case 280: // __NR_utimensat
1347 return 88;
1348 case 235: // __NR_utimes - missing on riscv64
1349 return -1;
1350 case 58: // __NR_vfork - missing on riscv64
1351 return -1;
1352 case 153: // __NR_vhangup
1353 return 58;
1354 case 278: // __NR_vmsplice
1355 return 75;
1356 case 236: // __NR_vserver - missing on riscv64
1357 return -1;
1358 case 61: // __NR_wait4
1359 return 260;
1360 case 247: // __NR_waitid
1361 return 95;
1362 case 1: // __NR_write
1363 return 64;
1364 case 20: // __NR_writev
1365 return 66;
1366 default:
1367 return -1;
1368 }
1369 }
1370
1371 } // namespace berberis
1372