Skip to content
/ zig Public
forked from ziglang/zig

Commit

Permalink
std.os.linux: Remove the sparc64 workaround in fadvise().
Browse files Browse the repository at this point in the history
This does not seem to be needed anymore, and it's unclear if it was ever truly
needed or if it was just there to deal with a QEMU/strace bug.

See: ziglang#8301 (comment)
  • Loading branch information
alexrp committed Jul 9, 2024
1 parent 720e239 commit 426b048
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/std/os/linux.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2218,14 +2218,7 @@ pub fn fadvise(fd: fd_t, offset: i64, len: i64, advice: usize) usize {
// call it fadvise64 (x86, PowerPC, etc), while newer ports call it fadvise64_64 (RISC-V,
// LoongArch, etc). SPARC is the odd one out because it has both.
return syscall4(
// 64-bit SPARC (apparently?) has a broken fadvise64_64, so use its fadvise64 instead.
// TODO: I can't make sense of this. They go to the same code in the kernel, and there
// is no special-casing for SPARC in glibc and musl. I suspect a QEMU bug, which is
// really not our responsibility.
if (@hasField(SYS, "fadvise64_64") and native_arch != .sparc64)
.fadvise64_64
else
.fadvise64,
if (@hasField(SYS, "fadvise64_64")) .fadvise64_64 else .fadvise64,
@as(usize, @bitCast(@as(isize, fd))),
@as(usize, @bitCast(offset)),
@as(usize, @bitCast(len)),
Expand Down

0 comments on commit 426b048

Please sign in to comment.