std.os.linux: Remove the sparc64 workaround in fadvise().

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: https://github.com/ziglang/zig/pull/8301#issuecomment-2184995749
This commit is contained in:
Alex Rønne Petersen 2024-06-23 19:23:17 +02:00
parent 890433e292
commit 43410cdfe9
No known key found for this signature in database

View File

@ -2272,14 +2272,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)),