From 73e62f22ecf25e58db343a45dfce35fccd8a4fa3 Mon Sep 17 00:00:00 2001 From: Koakuma Date: Sat, 24 Oct 2020 19:58:01 +0700 Subject: Fix sigaction(2) call on sparc64 --- lib/std/os/linux.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/std') diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index a17c99a6a9..bb8ce00efe 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -818,7 +818,12 @@ pub fn sigaction(sig: u6, noalias act: *const Sigaction, noalias oact: ?*Sigacti var ksa_old: k_sigaction = undefined; const ksa_mask_size = @sizeOf(@TypeOf(ksa_old.mask)); @memcpy(@ptrCast([*]u8, &ksa.mask), @ptrCast([*]const u8, &act.mask), ksa_mask_size); - const result = syscall4(.rt_sigaction, sig, @ptrToInt(&ksa), @ptrToInt(&ksa_old), ksa_mask_size); + const result = switch (builtin.arch) { + // The sparc version of rt_sigaction needs the restorer function to be passed as an argument too. + .sparc, .sparcv9 => syscall5(.rt_sigaction, sig, + @ptrToInt(&ksa), @ptrToInt(&ksa_old), @ptrToInt(ksa.restorer), ksa_mask_size), + else => syscall4(.rt_sigaction, sig, @ptrToInt(&ksa), @ptrToInt(&ksa_old), ksa_mask_size), + }; const err = getErrno(result); if (err != 0) { return result; -- cgit v1.2.3