From f73615170bfa0255a51144a3d315439a23e27ecd Mon Sep 17 00:00:00 2001 From: "Lain \"Fearyncess\" Yang" Date: Sat, 14 Sep 2024 18:40:09 +0800 Subject: [PATCH] Fix nonexistent `sync_file_range2` syscall bug in aarch64,loongarch64 and riscv* --- src/arch/aarch64.rs | 4 ++-- src/arch/loongarch64.rs | 4 ++-- src/arch/riscv32.rs | 4 ++-- src/arch/riscv64.rs | 4 ++-- syscalls-gen/src/main.rs | 26 +++++++++++++++++--------- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/arch/aarch64.rs b/src/arch/aarch64.rs index 56a8a91..030d798 100644 --- a/src/arch/aarch64.rs +++ b/src/arch/aarch64.rs @@ -172,8 +172,8 @@ syscall_enum! { fsync = 82, /// See [fdatasync(2)](https://man7.org/linux/man-pages/man2/fdatasync.2.html) for more info on this syscall. fdatasync = 83, - /// See [sync_file_range2(2)](https://man7.org/linux/man-pages/man2/sync_file_range2.2.html) for more info on this syscall. - sync_file_range2 = 84, + /// See [sync_file_range(2)](https://man7.org/linux/man-pages/man2/sync_file_range.2.html) for more info on this syscall. + sync_file_range = 84, /// See [timerfd_create(2)](https://man7.org/linux/man-pages/man2/timerfd_create.2.html) for more info on this syscall. timerfd_create = 85, /// See [timerfd_settime(2)](https://man7.org/linux/man-pages/man2/timerfd_settime.2.html) for more info on this syscall. diff --git a/src/arch/loongarch64.rs b/src/arch/loongarch64.rs index 9e64e64..4dc114c 100644 --- a/src/arch/loongarch64.rs +++ b/src/arch/loongarch64.rs @@ -172,8 +172,8 @@ syscall_enum! { fsync = 82, /// See [fdatasync(2)](https://man7.org/linux/man-pages/man2/fdatasync.2.html) for more info on this syscall. fdatasync = 83, - /// See [sync_file_range2(2)](https://man7.org/linux/man-pages/man2/sync_file_range2.2.html) for more info on this syscall. - sync_file_range2 = 84, + /// See [sync_file_range(2)](https://man7.org/linux/man-pages/man2/sync_file_range.2.html) for more info on this syscall. + sync_file_range = 84, /// See [timerfd_create(2)](https://man7.org/linux/man-pages/man2/timerfd_create.2.html) for more info on this syscall. timerfd_create = 85, /// See [timerfd_settime(2)](https://man7.org/linux/man-pages/man2/timerfd_settime.2.html) for more info on this syscall. diff --git a/src/arch/riscv32.rs b/src/arch/riscv32.rs index 5ee16af..b80b112 100644 --- a/src/arch/riscv32.rs +++ b/src/arch/riscv32.rs @@ -172,8 +172,8 @@ syscall_enum! { fsync = 82, /// See [fdatasync(2)](https://man7.org/linux/man-pages/man2/fdatasync.2.html) for more info on this syscall. fdatasync = 83, - /// See [sync_file_range2(2)](https://man7.org/linux/man-pages/man2/sync_file_range2.2.html) for more info on this syscall. - sync_file_range2 = 84, + /// See [sync_file_range(2)](https://man7.org/linux/man-pages/man2/sync_file_range.2.html) for more info on this syscall. + sync_file_range = 84, /// See [timerfd_create(2)](https://man7.org/linux/man-pages/man2/timerfd_create.2.html) for more info on this syscall. timerfd_create = 85, /// See [timerfd_settime(2)](https://man7.org/linux/man-pages/man2/timerfd_settime.2.html) for more info on this syscall. diff --git a/src/arch/riscv64.rs b/src/arch/riscv64.rs index 4f1284b..c891721 100644 --- a/src/arch/riscv64.rs +++ b/src/arch/riscv64.rs @@ -172,8 +172,8 @@ syscall_enum! { fsync = 82, /// See [fdatasync(2)](https://man7.org/linux/man-pages/man2/fdatasync.2.html) for more info on this syscall. fdatasync = 83, - /// See [sync_file_range2(2)](https://man7.org/linux/man-pages/man2/sync_file_range2.2.html) for more info on this syscall. - sync_file_range2 = 84, + /// See [sync_file_range(2)](https://man7.org/linux/man-pages/man2/sync_file_range.2.html) for more info on this syscall. + sync_file_range = 84, /// See [timerfd_create(2)](https://man7.org/linux/man-pages/man2/timerfd_create.2.html) for more info on this syscall. timerfd_create = 85, /// See [timerfd_settime(2)](https://man7.org/linux/man-pages/man2/timerfd_settime.2.html) for more info on this syscall. diff --git a/syscalls-gen/src/main.rs b/syscalls-gen/src/main.rs index a59177c..eaea44e 100644 --- a/syscalls-gen/src/main.rs +++ b/syscalls-gen/src/main.rs @@ -47,10 +47,9 @@ lazy_static! { //"arch/arm64/include/asm/unistd.h", ], blocklist: &[ - // This syscall was renamed to `sync_file_range2` on aarch64. - // Thus, only `sync_file_range2` should appear in the syscall - // table. - "sync_file_range", + // NOTE: On aarch64 platforms, `sync_file_range2` only provides + // compatibility for aarch32. + "sync_file_range2", ], }), Source::Table(Table { @@ -88,14 +87,18 @@ lazy_static! { path: "arch/s390/kernel/syscalls/syscall.tbl", abi: &[ABI::COMMON, ABI::B64], }), - // For riscv32 and riscv64, see aarch64's explanation. Source::Header(Header { arch: "riscv32", headers: &[ "include/uapi/asm-generic/unistd.h", "arch/riscv/include/uapi/asm/unistd.h", ], - blocklist: &["sync_file_range"], + blocklist: &[ + // It doesn't have defines `__NR_sync_file_range2` or + // `__ARCH_WANT_SYNC_FILE_RANGE2` in + // `arch/riscv/include/uapi/asm/unistd.h` header file + "sync_file_range2", + ], }), Source::Header(Header { arch: "riscv64", @@ -103,16 +106,21 @@ lazy_static! { "include/uapi/asm-generic/unistd.h", "arch/riscv/include/uapi/asm/unistd.h", ], - blocklist: &["sync_file_range"], + blocklist: &[ + // For riscv64, see riscv32's explanation. + "sync_file_range2", + ], }), - // For loongarch64, see aarch64's explanation. Source::Header(Header { arch: "loongarch64", headers: &[ "include/uapi/asm-generic/unistd.h", "arch/loongarch/include/uapi/asm/unistd.h", ], - blocklist: &["sync_file_range"], + blocklist: &[ + // For loongarch64, see riscv32's explanation. + "sync_file_range2", + ], }), ]; }