commit 73e62f22ecf25e58db343a45dfce35fccd8a4fa3 (tree)
parent 792526c0bd45754bced18298573ad2a145a7141e
Author: Koakuma <koachan@protonmail.com>
Date: Sat, 24 Oct 2020 19:58:01 +0700
Fix sigaction(2) call on sparc64
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git 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;