Skip to content

Commit ecbb073

Browse files
committed
Auto merge of #2114 - voidc:syscalls, r=JohnTitor
Add more syscall constansts for Linux In #1897 (comment), there was interest in adding constants for recently added Linux syscalls. I went ahead and added consts for syscalls up until (the currently unreleased) Linux 5.12. Here is an overview: | Syscall | NR | since | | ----------------- | --- | ----- | | pidfd_send_signal | 424 | 5.1 | | io_uring_setup | 425 | 5.1 | | io_uring_enter | 426 | 5.1 | | io_uring_register | 427 | 5.1 | | open_tree | 428 | 5.2 | | move_mount | 429 | 5.2 | | fsopen | 430 | 5.2 | | fsconfig | 431 | 5.2 | | fsmount | 432 | 5.2 | | fspick | 433 | 5.2 | | pidfd_open | 434 | 5.3 | | clone3 | 435 | 5.3 | | close_range | 436 | 5.9 | | openat2 | 437 | 5.9 | | pidfd_getfd | 438 | 5.9 | | faccessat2 | 439 | 5.9 | | process_madvise | 440 | 5.10 | | epoll_pwait2 | 441 | 5.11 | | mount_setattr | 442 | 5.12 | ([source](https://github.com/torvalds/linux/blob/1e28eed17697bcf343c6743f0028cc3b5dd88bf0/include/uapi/asm-generic/unistd.h#L825-L865)) The constants are added for `-gnu` and `-musl` targets. I'm unsure to what extend they are actually present in the headers of these libraries. Support is added for all architectures except hexagon.
2 parents 56c8549 + 1698c37 commit ecbb073

File tree

24 files changed

+411
-0
lines changed

24 files changed

+411
-0
lines changed

libc-test/build.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,6 +2654,16 @@ fn test_linux(target: &str) {
26542654
// Not yet implemented on sparc64
26552655
"SYS_clone3" if mips | sparc64 => true,
26562656

2657+
// FIXME: these syscalls were added in Linux 5.9 or later
2658+
// and are currently not included in the glibc headers.
2659+
| "SYS_close_range"
2660+
| "SYS_openat2"
2661+
| "SYS_pidfd_getfd"
2662+
| "SYS_faccessat2"
2663+
| "SYS_process_madvise"
2664+
| "SYS_epoll_pwait2"
2665+
| "SYS_mount_setattr" => true,
2666+
26572667
// Requires more recent kernel headers:
26582668
| "IFLA_PROP_LIST"
26592669
| "IFLA_ALT_IFNAME"

src/unix/linux_like/linux/gnu/b32/arm/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,8 +870,25 @@ pub const SYS_pkey_mprotect: ::c_long = 394;
870870
pub const SYS_pkey_alloc: ::c_long = 395;
871871
pub const SYS_pkey_free: ::c_long = 396;
872872
pub const SYS_statx: ::c_long = 397;
873+
pub const SYS_pidfd_send_signal: ::c_long = 424;
874+
pub const SYS_io_uring_setup: ::c_long = 425;
875+
pub const SYS_io_uring_enter: ::c_long = 426;
876+
pub const SYS_io_uring_register: ::c_long = 427;
877+
pub const SYS_open_tree: ::c_long = 428;
878+
pub const SYS_move_mount: ::c_long = 429;
879+
pub const SYS_fsopen: ::c_long = 430;
880+
pub const SYS_fsconfig: ::c_long = 431;
881+
pub const SYS_fsmount: ::c_long = 432;
882+
pub const SYS_fspick: ::c_long = 433;
873883
pub const SYS_pidfd_open: ::c_long = 434;
874884
pub const SYS_clone3: ::c_long = 435;
885+
pub const SYS_close_range: ::c_long = 436;
886+
pub const SYS_openat2: ::c_long = 437;
887+
pub const SYS_pidfd_getfd: ::c_long = 438;
888+
pub const SYS_faccessat2: ::c_long = 439;
889+
pub const SYS_process_madvise: ::c_long = 440;
890+
pub const SYS_epoll_pwait2: ::c_long = 441;
891+
pub const SYS_mount_setattr: ::c_long = 442;
875892

876893
cfg_if! {
877894
if #[cfg(libc_align)] {

src/unix/linux_like/linux/gnu/b32/mips/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,25 @@ pub const SYS_pkey_mprotect: ::c_long = 4000 + 363;
527527
pub const SYS_pkey_alloc: ::c_long = 4000 + 364;
528528
pub const SYS_pkey_free: ::c_long = 4000 + 365;
529529
pub const SYS_statx: ::c_long = 4000 + 366;
530+
pub const SYS_pidfd_send_signal: ::c_long = 4000 + 424;
531+
pub const SYS_io_uring_setup: ::c_long = 4000 + 425;
532+
pub const SYS_io_uring_enter: ::c_long = 4000 + 426;
533+
pub const SYS_io_uring_register: ::c_long = 4000 + 427;
534+
pub const SYS_open_tree: ::c_long = 4000 + 428;
535+
pub const SYS_move_mount: ::c_long = 4000 + 429;
536+
pub const SYS_fsopen: ::c_long = 4000 + 430;
537+
pub const SYS_fsconfig: ::c_long = 4000 + 431;
538+
pub const SYS_fsmount: ::c_long = 4000 + 432;
539+
pub const SYS_fspick: ::c_long = 4000 + 433;
530540
pub const SYS_pidfd_open: ::c_long = 4000 + 434;
531541
pub const SYS_clone3: ::c_long = 4000 + 435;
542+
pub const SYS_close_range: ::c_long = 4000 + 436;
543+
pub const SYS_openat2: ::c_long = 4000 + 437;
544+
pub const SYS_pidfd_getfd: ::c_long = 4000 + 438;
545+
pub const SYS_faccessat2: ::c_long = 4000 + 439;
546+
pub const SYS_process_madvise: ::c_long = 4000 + 440;
547+
pub const SYS_epoll_pwait2: ::c_long = 4000 + 441;
548+
pub const SYS_mount_setattr: ::c_long = 4000 + 442;
532549

533550
pub const O_DIRECT: ::c_int = 0x8000;
534551
pub const O_DIRECTORY: ::c_int = 0x10000;

src/unix/linux_like/linux/gnu/b32/powerpc.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,5 +874,22 @@ pub const SYS_preadv2: ::c_long = 380;
874874
pub const SYS_pwritev2: ::c_long = 381;
875875
pub const SYS_kexec_file_load: ::c_long = 382;
876876
pub const SYS_statx: ::c_long = 383;
877+
pub const SYS_pidfd_send_signal: ::c_long = 424;
878+
pub const SYS_io_uring_setup: ::c_long = 425;
879+
pub const SYS_io_uring_enter: ::c_long = 426;
880+
pub const SYS_io_uring_register: ::c_long = 427;
881+
pub const SYS_open_tree: ::c_long = 428;
882+
pub const SYS_move_mount: ::c_long = 429;
883+
pub const SYS_fsopen: ::c_long = 430;
884+
pub const SYS_fsconfig: ::c_long = 431;
885+
pub const SYS_fsmount: ::c_long = 432;
886+
pub const SYS_fspick: ::c_long = 433;
877887
pub const SYS_pidfd_open: ::c_long = 434;
878888
pub const SYS_clone3: ::c_long = 435;
889+
pub const SYS_close_range: ::c_long = 436;
890+
pub const SYS_openat2: ::c_long = 437;
891+
pub const SYS_pidfd_getfd: ::c_long = 438;
892+
pub const SYS_faccessat2: ::c_long = 439;
893+
pub const SYS_process_madvise: ::c_long = 440;
894+
pub const SYS_epoll_pwait2: ::c_long = 441;
895+
pub const SYS_mount_setattr: ::c_long = 442;

src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,3 +818,22 @@ pub const SYS_pkey_mprotect: ::c_long = 288;
818818
pub const SYS_pkey_alloc: ::c_long = 289;
819819
pub const SYS_pkey_free: ::c_long = 290;
820820
pub const SYS_statx: ::c_long = 291;
821+
pub const SYS_pidfd_send_signal: ::c_long = 424;
822+
pub const SYS_io_uring_setup: ::c_long = 425;
823+
pub const SYS_io_uring_enter: ::c_long = 426;
824+
pub const SYS_io_uring_register: ::c_long = 427;
825+
pub const SYS_open_tree: ::c_long = 428;
826+
pub const SYS_move_mount: ::c_long = 429;
827+
pub const SYS_fsopen: ::c_long = 430;
828+
pub const SYS_fsconfig: ::c_long = 431;
829+
pub const SYS_fsmount: ::c_long = 432;
830+
pub const SYS_fspick: ::c_long = 433;
831+
pub const SYS_pidfd_open: ::c_long = 434;
832+
pub const SYS_clone3: ::c_long = 435;
833+
pub const SYS_close_range: ::c_long = 436;
834+
pub const SYS_openat2: ::c_long = 437;
835+
pub const SYS_pidfd_getfd: ::c_long = 438;
836+
pub const SYS_faccessat2: ::c_long = 439;
837+
pub const SYS_process_madvise: ::c_long = 440;
838+
pub const SYS_epoll_pwait2: ::c_long = 441;
839+
pub const SYS_mount_setattr: ::c_long = 442;

src/unix/linux_like/linux/gnu/b32/sparc/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,9 +908,26 @@ pub const SYS_copy_file_range: ::c_long = 357;
908908
pub const SYS_preadv2: ::c_long = 358;
909909
pub const SYS_pwritev2: ::c_long = 359;
910910
pub const SYS_statx: ::c_long = 360;
911+
pub const SYS_pidfd_send_signal: ::c_long = 424;
912+
pub const SYS_io_uring_setup: ::c_long = 425;
913+
pub const SYS_io_uring_enter: ::c_long = 426;
914+
pub const SYS_io_uring_register: ::c_long = 427;
915+
pub const SYS_open_tree: ::c_long = 428;
916+
pub const SYS_move_mount: ::c_long = 429;
917+
pub const SYS_fsopen: ::c_long = 430;
918+
pub const SYS_fsconfig: ::c_long = 431;
919+
pub const SYS_fsmount: ::c_long = 432;
920+
pub const SYS_fspick: ::c_long = 433;
911921
pub const SYS_pidfd_open: ::c_long = 434;
912922
// Reserved in the kernel, but not actually implemented yet
913923
pub const SYS_clone3: ::c_long = 435;
924+
pub const SYS_close_range: ::c_long = 436;
925+
pub const SYS_openat2: ::c_long = 437;
926+
pub const SYS_pidfd_getfd: ::c_long = 438;
927+
pub const SYS_faccessat2: ::c_long = 439;
928+
pub const SYS_process_madvise: ::c_long = 440;
929+
pub const SYS_epoll_pwait2: ::c_long = 441;
930+
pub const SYS_mount_setattr: ::c_long = 442;
914931

915932
cfg_if! {
916933
if #[cfg(libc_align)] {

src/unix/linux_like/linux/gnu/b32/x86/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,8 +1105,25 @@ pub const SYS_pkey_mprotect: ::c_long = 380;
11051105
pub const SYS_pkey_alloc: ::c_long = 381;
11061106
pub const SYS_pkey_free: ::c_long = 382;
11071107
pub const SYS_statx: ::c_long = 383;
1108+
pub const SYS_pidfd_send_signal: ::c_long = 424;
1109+
pub const SYS_io_uring_setup: ::c_long = 425;
1110+
pub const SYS_io_uring_enter: ::c_long = 426;
1111+
pub const SYS_io_uring_register: ::c_long = 427;
1112+
pub const SYS_open_tree: ::c_long = 428;
1113+
pub const SYS_move_mount: ::c_long = 429;
1114+
pub const SYS_fsopen: ::c_long = 430;
1115+
pub const SYS_fsconfig: ::c_long = 431;
1116+
pub const SYS_fsmount: ::c_long = 432;
1117+
pub const SYS_fspick: ::c_long = 433;
11081118
pub const SYS_pidfd_open: ::c_long = 434;
11091119
pub const SYS_clone3: ::c_long = 435;
1120+
pub const SYS_close_range: ::c_long = 436;
1121+
pub const SYS_openat2: ::c_long = 437;
1122+
pub const SYS_pidfd_getfd: ::c_long = 438;
1123+
pub const SYS_faccessat2: ::c_long = 439;
1124+
pub const SYS_process_madvise: ::c_long = 440;
1125+
pub const SYS_epoll_pwait2: ::c_long = 441;
1126+
pub const SYS_mount_setattr: ::c_long = 442;
11101127

11111128
// offsets in user_regs_structs, from sys/reg.h
11121129
pub const EBX: ::c_int = 0;

src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,8 +976,25 @@ pub const SYS_pkey_mprotect: ::c_long = 288;
976976
pub const SYS_pkey_alloc: ::c_long = 289;
977977
pub const SYS_pkey_free: ::c_long = 290;
978978
pub const SYS_statx: ::c_long = 291;
979+
pub const SYS_pidfd_send_signal: ::c_long = 424;
980+
pub const SYS_io_uring_setup: ::c_long = 425;
981+
pub const SYS_io_uring_enter: ::c_long = 426;
982+
pub const SYS_io_uring_register: ::c_long = 427;
983+
pub const SYS_open_tree: ::c_long = 428;
984+
pub const SYS_move_mount: ::c_long = 429;
985+
pub const SYS_fsopen: ::c_long = 430;
986+
pub const SYS_fsconfig: ::c_long = 431;
987+
pub const SYS_fsmount: ::c_long = 432;
988+
pub const SYS_fspick: ::c_long = 433;
979989
pub const SYS_pidfd_open: ::c_long = 434;
980990
pub const SYS_clone3: ::c_long = 435;
991+
pub const SYS_close_range: ::c_long = 436;
992+
pub const SYS_openat2: ::c_long = 437;
993+
pub const SYS_pidfd_getfd: ::c_long = 438;
994+
pub const SYS_faccessat2: ::c_long = 439;
995+
pub const SYS_process_madvise: ::c_long = 440;
996+
pub const SYS_epoll_pwait2: ::c_long = 441;
997+
pub const SYS_mount_setattr: ::c_long = 442;
981998

982999
extern "C" {
9831000
pub fn sysctl(

src/unix/linux_like/linux/gnu/b64/mips64/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,25 @@ pub const SYS_pkey_mprotect: ::c_long = 5000 + 323;
577577
pub const SYS_pkey_alloc: ::c_long = 5000 + 324;
578578
pub const SYS_pkey_free: ::c_long = 5000 + 325;
579579
pub const SYS_statx: ::c_long = 5000 + 326;
580+
pub const SYS_pidfd_send_signal: ::c_long = 5000 + 424;
581+
pub const SYS_io_uring_setup: ::c_long = 5000 + 425;
582+
pub const SYS_io_uring_enter: ::c_long = 5000 + 426;
583+
pub const SYS_io_uring_register: ::c_long = 5000 + 427;
584+
pub const SYS_open_tree: ::c_long = 5000 + 428;
585+
pub const SYS_move_mount: ::c_long = 5000 + 429;
586+
pub const SYS_fsopen: ::c_long = 5000 + 430;
587+
pub const SYS_fsconfig: ::c_long = 5000 + 431;
588+
pub const SYS_fsmount: ::c_long = 5000 + 432;
589+
pub const SYS_fspick: ::c_long = 5000 + 433;
580590
pub const SYS_pidfd_open: ::c_long = 5000 + 434;
581591
pub const SYS_clone3: ::c_long = 5000 + 435;
592+
pub const SYS_close_range: ::c_long = 5000 + 436;
593+
pub const SYS_openat2: ::c_long = 5000 + 437;
594+
pub const SYS_pidfd_getfd: ::c_long = 5000 + 438;
595+
pub const SYS_faccessat2: ::c_long = 5000 + 439;
596+
pub const SYS_process_madvise: ::c_long = 5000 + 440;
597+
pub const SYS_epoll_pwait2: ::c_long = 5000 + 441;
598+
pub const SYS_mount_setattr: ::c_long = 5000 + 442;
582599

583600
pub const SFD_CLOEXEC: ::c_int = 0x080000;
584601

src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,8 +1043,25 @@ pub const SYS_preadv2: ::c_long = 380;
10431043
pub const SYS_pwritev2: ::c_long = 381;
10441044
pub const SYS_kexec_file_load: ::c_long = 382;
10451045
pub const SYS_statx: ::c_long = 383;
1046+
pub const SYS_pidfd_send_signal: ::c_long = 424;
1047+
pub const SYS_io_uring_setup: ::c_long = 425;
1048+
pub const SYS_io_uring_enter: ::c_long = 426;
1049+
pub const SYS_io_uring_register: ::c_long = 427;
1050+
pub const SYS_open_tree: ::c_long = 428;
1051+
pub const SYS_move_mount: ::c_long = 429;
1052+
pub const SYS_fsopen: ::c_long = 430;
1053+
pub const SYS_fsconfig: ::c_long = 431;
1054+
pub const SYS_fsmount: ::c_long = 432;
1055+
pub const SYS_fspick: ::c_long = 433;
10461056
pub const SYS_pidfd_open: ::c_long = 434;
10471057
pub const SYS_clone3: ::c_long = 435;
1058+
pub const SYS_close_range: ::c_long = 436;
1059+
pub const SYS_openat2: ::c_long = 437;
1060+
pub const SYS_pidfd_getfd: ::c_long = 438;
1061+
pub const SYS_faccessat2: ::c_long = 439;
1062+
pub const SYS_process_madvise: ::c_long = 440;
1063+
pub const SYS_epoll_pwait2: ::c_long = 441;
1064+
pub const SYS_mount_setattr: ::c_long = 442;
10481065

10491066
extern "C" {
10501067
pub fn sysctl(

0 commit comments

Comments
 (0)