Commit Diff


commit - aae7ae921ef75fe2566a7c5a04626d0382b43d5b
commit + bc68c36644155bb8774b2646ee235d98e29bd9ad
blob - 3db04ce59e2c272a9c3493630d3fd12f38b5710a
blob + f07c4fca24711f1776399cc86227a058e8031815
--- pracomer/src/signals.zig
+++ pracomer/src/signals.zig
@@ -3,8 +3,8 @@ const builtin = @import("builtin");
 
 var signal_pipe: [2]std.posix.fd_t = undefined;
 
-fn signalHandler(sig: i32) callconv(.c) void {
-    const s: i32 = sig;
+fn signalHandler(sig: std.c.SIG) callconv(.c) void {
+    const s: i32 = @bitCast(@intFromEnum(sig));
     _ = std.c.write(signal_pipe[1], std.mem.asBytes(&s), @sizeOf(i32));
 }
 
@@ -19,8 +19,8 @@ pub fn open() !std.Io.File {
         const fd = try std.posix.signalfd(-1, &mask, std.os.linux.SFD.NONBLOCK);
         return .{ .handle = fd, .flags = .{ .nonblocking = false } };
     } else {
-        const rc = std.c.pipe(&signal_pipe);
-        switch (std.posix.errno(@intCast(rc))) {
+        const rc: c_int = @intCast(std.c.pipe(&signal_pipe));
+        switch (std.posix.errno(rc)) {
             .SUCCESS => {},
             else => |err| return std.posix.unexpectedErrno(err),
         }