diff --git a/lib/std/c/darwin.zig b/lib/std/c/darwin.zig index e7fd3cde44e82d80518f0c66bbf37e0ba5ff520e..0a65fa52429ea9a6f23fef3e08e2d56b0cf4c9b7 100644 --- a/lib/std/c/darwin.zig +++ b/lib/std/c/darwin.zig @@ -814,10 +814,10 @@ pub const sigset_t = u32; pub const empty_sigset: sigset_t = 0; pub const SIG = struct { - pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); - pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); - pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); - pub const HOLD = @intToPtr(?Sigaction.sigaction_fn, 5); + pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); + pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); + pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); + pub const HOLD = @intToPtr(?Sigaction.handler_fn, 5); /// block specified signal set pub const _BLOCK = 1; diff --git a/lib/std/c/dragonfly.zig b/lib/std/c/dragonfly.zig index 1a60f94a1ec2a402343e3bb2fb3b0527573a221a..5d7822e8e9b925e12524ee7cbca4a786bf144a5c 100644 --- a/lib/std/c/dragonfly.zig +++ b/lib/std/c/dragonfly.zig @@ -609,9 +609,9 @@ pub const S = struct { pub const BADSIG = SIG.ERR; pub const SIG = struct { - pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); - pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); - pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); + pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); + pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); + pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); pub const BLOCK = 1; pub const UNBLOCK = 2; diff --git a/lib/std/c/freebsd.zig b/lib/std/c/freebsd.zig index dac239094e4a1a640f4a72a39d205be561df3c23..6f0188698662308f2f91093c48096495c252bc7d 100644 --- a/lib/std/c/freebsd.zig +++ b/lib/std/c/freebsd.zig @@ -670,9 +670,9 @@ pub const SIG = struct { pub const UNBLOCK = 2; pub const SETMASK = 3; - pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); - pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); - pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); + pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); + pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); + pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); pub const WORDS = 4; pub const MAXSIG = 128; diff --git a/lib/std/c/netbsd.zig b/lib/std/c/netbsd.zig index 3de14da7a26af0184e14aa898ca718f2307df8ac..a8287033d75e9fa4adce7231e6917632ff80cb48 100644 --- a/lib/std/c/netbsd.zig +++ b/lib/std/c/netbsd.zig @@ -910,9 +910,9 @@ pub const winsize = extern struct { const NSIG = 32; pub const SIG = struct { - pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); - pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); - pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); + pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); + pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); + pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); pub const WORDS = 4; pub const MAXSIG = 128; diff --git a/lib/std/c/openbsd.zig b/lib/std/c/openbsd.zig index 0863cc5a5e794819c09cf0aa7ec25c8339566a1a..5c259bc41ae3c929cda4d4f56c9591dca48f218c 100644 --- a/lib/std/c/openbsd.zig +++ b/lib/std/c/openbsd.zig @@ -982,11 +982,11 @@ pub const winsize = extern struct { const NSIG = 33; pub const SIG = struct { - pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); - pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); - pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); - pub const CATCH = @intToPtr(?Sigaction.sigaction_fn, 2); - pub const HOLD = @intToPtr(?Sigaction.sigaction_fn, 3); + pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); + pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); + pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); + pub const CATCH = @intToPtr(?Sigaction.handler_fn, 2); + pub const HOLD = @intToPtr(?Sigaction.handler_fn, 3); pub const HUP = 1; pub const INT = 2; diff --git a/lib/std/c/solaris.zig b/lib/std/c/solaris.zig index 61e52cfe301d24ed9064f808f05ca5eb78556310..1e726beb75c9f4a71333de44efa35b6e24883f29 100644 --- a/lib/std/c/solaris.zig +++ b/lib/std/c/solaris.zig @@ -879,10 +879,10 @@ pub const winsize = extern struct { const NSIG = 75; pub const SIG = struct { - pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); - pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); - pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); - pub const HOLD = @intToPtr(?Sigaction.sigaction_fn, 2); + pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); + pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); + pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); + pub const HOLD = @intToPtr(?Sigaction.handler_fn, 2); pub const WORDS = 4; pub const MAXSIG = 75; diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 847298e54b5ab8459583586af79360d3df04db65..0738b5af0b63754bd20bc1efe653fa66cd49beb3 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -1787,7 +1787,7 @@ fn resetSegfaultHandler() void { return; } var act = os.Sigaction{ - .handler = .{ .sigaction = os.SIG.DFL }, + .handler = .{ .handler = os.SIG.DFL }, .mask = os.empty_sigset, .flags = 0, }; diff --git a/lib/std/os.zig b/lib/std/os.zig index 2836ddf9c9111fe2f81ef614e5b71a9c93fcefa6..984758565cf9475e954ff41c292028ca45e09323 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -475,10 +475,9 @@ pub fn abort() noreturn { // Install default handler so that the tkill below will terminate. const sigact = Sigaction{ - .handler = .{ .sigaction = SIG.DFL }, - .mask = undefined, - .flags = undefined, - .restorer = undefined, + .handler = .{ .handler = SIG.DFL }, + .mask = empty_sigset, + .flags = 0, }; sigaction(SIG.ABRT, &sigact, null) catch |err| switch (err) { error.OperationNotSupported => unreachable, diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index ae9b441b60ef78abb72aaae579291e9d1c2b98b4..539f3612f91878967433f182d2339d32978f9e23 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -1945,9 +1945,9 @@ pub const SIG = if (is_mips) struct { pub const SYS = 31; pub const UNUSED = SIG.SYS; - pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); - pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); - pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); + pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); + pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); + pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); } else if (is_sparc) struct { pub const BLOCK = 1; pub const UNBLOCK = 2; @@ -1989,9 +1989,9 @@ pub const SIG = if (is_mips) struct { pub const PWR = LOST; pub const IO = SIG.POLL; - pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); - pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); - pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); + pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); + pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); + pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); } else struct { pub const BLOCK = 0; pub const UNBLOCK = 1; @@ -2032,9 +2032,9 @@ pub const SIG = if (is_mips) struct { pub const SYS = 31; pub const UNUSED = SIG.SYS; - pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); - pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); - pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); + pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); + pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); + pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); }; pub const kernel_rwf = u32; diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index 44f8b16b9e0c97bcd8aa5f2e97bdb946dbf91ab0..a8497586f96999ec061dfbbf60cc88d394cb0fff 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -785,7 +785,7 @@ test "sigaction" { try testing.expect(signal_test_failed == false); // Check if the handler has been correctly reset to SIG_DFL try os.sigaction(os.SIG.USR1, null, &old_sa); - try testing.expectEqual(os.SIG.DFL, old_sa.handler.sigaction); + try testing.expectEqual(os.SIG.DFL, old_sa.handler.handler); } test "dup & dup2" {