diff --git a/lib/std/os/bits/darwin.zig b/lib/std/os/bits/darwin.zig index a6dbff8453..8bd40ed9a3 100644 --- a/lib/std/os/bits/darwin.zig +++ b/lib/std/os/bits/darwin.zig @@ -126,6 +126,11 @@ pub const timespec = extern struct { pub const sigset_t = u32; pub const empty_sigset: sigset_t = 0; +pub const SIG_ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); +pub const SIG_DFL = @intToPtr(?Sigaction.sigaction_fn, 0); +pub const SIG_IGN = @intToPtr(?Sigaction.sigaction_fn, 1); +pub const SIG_HOLD = @intToPtr(?Sigaction.sigaction_fn, 5); + pub const siginfo_t = extern struct { signo: c_int, errno: c_int, diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index bbc6c968f1..59116e1bbd 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -672,8 +672,11 @@ test "sigaction" { // Check that we can read it back correctly. os.sigaction(os.SIGUSR1, null, &old_sa); testing.expectEqual(S.handler, old_sa.handler.sigaction.?); - testing.expect((old_sa.flags & os.SA_RESETHAND) != 0); + testing.expect((old_sa.flags & os.SA_SIGINFO) != 0); // Invoke the handler. try os.raise(os.SIGUSR1); testing.expect(signal_test_failed == false); + // Check if the handler has been correctly reset to SIG_DFL + os.sigaction(os.SIGUSR1, null, &old_sa); + testing.expectEqual(os.SIG_DFL, old_sa.handler.sigaction); }