Skip to content

Commit 92624de

Browse files
authored
Fix nonexistent sync_file_range2 syscall bug in aarch64,loongarch64 and riscv* (#55)
1 parent b4a882b commit 92624de

File tree

5 files changed

+25
-17
lines changed

5 files changed

+25
-17
lines changed

src/arch/aarch64.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ syscall_enum! {
172172
fsync = 82,
173173
/// See [fdatasync(2)](https://man7.org/linux/man-pages/man2/fdatasync.2.html) for more info on this syscall.
174174
fdatasync = 83,
175-
/// See [sync_file_range2(2)](https://man7.org/linux/man-pages/man2/sync_file_range2.2.html) for more info on this syscall.
176-
sync_file_range2 = 84,
175+
/// See [sync_file_range(2)](https://man7.org/linux/man-pages/man2/sync_file_range.2.html) for more info on this syscall.
176+
sync_file_range = 84,
177177
/// See [timerfd_create(2)](https://man7.org/linux/man-pages/man2/timerfd_create.2.html) for more info on this syscall.
178178
timerfd_create = 85,
179179
/// See [timerfd_settime(2)](https://man7.org/linux/man-pages/man2/timerfd_settime.2.html) for more info on this syscall.

src/arch/loongarch64.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ syscall_enum! {
172172
fsync = 82,
173173
/// See [fdatasync(2)](https://man7.org/linux/man-pages/man2/fdatasync.2.html) for more info on this syscall.
174174
fdatasync = 83,
175-
/// See [sync_file_range2(2)](https://man7.org/linux/man-pages/man2/sync_file_range2.2.html) for more info on this syscall.
176-
sync_file_range2 = 84,
175+
/// See [sync_file_range(2)](https://man7.org/linux/man-pages/man2/sync_file_range.2.html) for more info on this syscall.
176+
sync_file_range = 84,
177177
/// See [timerfd_create(2)](https://man7.org/linux/man-pages/man2/timerfd_create.2.html) for more info on this syscall.
178178
timerfd_create = 85,
179179
/// See [timerfd_settime(2)](https://man7.org/linux/man-pages/man2/timerfd_settime.2.html) for more info on this syscall.

src/arch/riscv32.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ syscall_enum! {
172172
fsync = 82,
173173
/// See [fdatasync(2)](https://man7.org/linux/man-pages/man2/fdatasync.2.html) for more info on this syscall.
174174
fdatasync = 83,
175-
/// See [sync_file_range2(2)](https://man7.org/linux/man-pages/man2/sync_file_range2.2.html) for more info on this syscall.
176-
sync_file_range2 = 84,
175+
/// See [sync_file_range(2)](https://man7.org/linux/man-pages/man2/sync_file_range.2.html) for more info on this syscall.
176+
sync_file_range = 84,
177177
/// See [timerfd_create(2)](https://man7.org/linux/man-pages/man2/timerfd_create.2.html) for more info on this syscall.
178178
timerfd_create = 85,
179179
/// See [timerfd_settime(2)](https://man7.org/linux/man-pages/man2/timerfd_settime.2.html) for more info on this syscall.

src/arch/riscv64.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ syscall_enum! {
172172
fsync = 82,
173173
/// See [fdatasync(2)](https://man7.org/linux/man-pages/man2/fdatasync.2.html) for more info on this syscall.
174174
fdatasync = 83,
175-
/// See [sync_file_range2(2)](https://man7.org/linux/man-pages/man2/sync_file_range2.2.html) for more info on this syscall.
176-
sync_file_range2 = 84,
175+
/// See [sync_file_range(2)](https://man7.org/linux/man-pages/man2/sync_file_range.2.html) for more info on this syscall.
176+
sync_file_range = 84,
177177
/// See [timerfd_create(2)](https://man7.org/linux/man-pages/man2/timerfd_create.2.html) for more info on this syscall.
178178
timerfd_create = 85,
179179
/// See [timerfd_settime(2)](https://man7.org/linux/man-pages/man2/timerfd_settime.2.html) for more info on this syscall.

syscalls-gen/src/main.rs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ lazy_static! {
4747
//"arch/arm64/include/asm/unistd.h",
4848
],
4949
blocklist: &[
50-
// This syscall was renamed to `sync_file_range2` on aarch64.
51-
// Thus, only `sync_file_range2` should appear in the syscall
52-
// table.
53-
"sync_file_range",
50+
// NOTE: On aarch64 platforms, `sync_file_range2` only provides
51+
// compatibility for aarch32.
52+
"sync_file_range2",
5453
],
5554
}),
5655
Source::Table(Table {
@@ -88,31 +87,40 @@ lazy_static! {
8887
path: "arch/s390/kernel/syscalls/syscall.tbl",
8988
abi: &[ABI::COMMON, ABI::B64],
9089
}),
91-
// For riscv32 and riscv64, see aarch64's explanation.
9290
Source::Header(Header {
9391
arch: "riscv32",
9492
headers: &[
9593
"include/uapi/asm-generic/unistd.h",
9694
"arch/riscv/include/uapi/asm/unistd.h",
9795
],
98-
blocklist: &["sync_file_range"],
96+
blocklist: &[
97+
// It doesn't have defines `__NR_sync_file_range2` or
98+
// `__ARCH_WANT_SYNC_FILE_RANGE2` in
99+
// `arch/riscv/include/uapi/asm/unistd.h` header file
100+
"sync_file_range2",
101+
],
99102
}),
100103
Source::Header(Header {
101104
arch: "riscv64",
102105
headers: &[
103106
"include/uapi/asm-generic/unistd.h",
104107
"arch/riscv/include/uapi/asm/unistd.h",
105108
],
106-
blocklist: &["sync_file_range"],
109+
blocklist: &[
110+
// For riscv64, see riscv32's explanation.
111+
"sync_file_range2",
112+
],
107113
}),
108-
// For loongarch64, see aarch64's explanation.
109114
Source::Header(Header {
110115
arch: "loongarch64",
111116
headers: &[
112117
"include/uapi/asm-generic/unistd.h",
113118
"arch/loongarch/include/uapi/asm/unistd.h",
114119
],
115-
blocklist: &["sync_file_range"],
120+
blocklist: &[
121+
// For loongarch64, see riscv32's explanation.
122+
"sync_file_range2",
123+
],
116124
}),
117125
];
118126
}

0 commit comments

Comments
 (0)