Skip to content

Commit

Permalink
Fix nonexistent sync_file_range2 syscall bug in aarch64,loongarch64…
Browse files Browse the repository at this point in the history
… and riscv*
  • Loading branch information
Fearyncess committed Sep 19, 2024
1 parent b4a882b commit 67bace2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/arch/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/arch/loongarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/arch/riscv32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/arch/riscv64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
26 changes: 17 additions & 9 deletions syscalls-gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 aarch64-ilp32.
"sync_file_range2",
],
}),
Source::Table(Table {
Expand Down Expand Up @@ -88,31 +87,40 @@ 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",
headers: &[
"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",
],
}),
];
}
Expand Down

0 comments on commit 67bace2

Please sign in to comment.