| author | |
| committer | |
| log | e67a43a673269edf477245931c70806f4b1abae1 |
| tree | b268729e167d16567cfe331d76d24b1589606d1c |
| parent | bbcc26a9b6d8de5971f26cda01350022a1049e08 |
| parent | b78f3bf1f17c7d67ae30d95047e40efc164bf8af |
| signature |
std: fix definition of SIG_IGN, SIG_DFL, etc.10 files changed, 36 insertions(+), 37 deletions(-)
lib/std/c/darwin.zig+4-4| ... | @@ -814,10 +814,10 @@ pub const sigset_t = u32; | ... | @@ -814,10 +814,10 @@ pub const sigset_t = u32; |
| 814 | pub const empty_sigset: sigset_t = 0; | 814 | pub const empty_sigset: sigset_t = 0; |
| 815 | 815 | ||
| 816 | pub const SIG = struct { | 816 | pub const SIG = struct { |
| 817 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 817 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); |
| 818 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | 818 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); |
| 819 | pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | 819 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); |
| 820 | pub const HOLD = @intToPtr(?Sigaction.sigaction_fn, 5); | 820 | pub const HOLD = @intToPtr(?Sigaction.handler_fn, 5); |
| 821 | 821 | ||
| 822 | /// block specified signal set | 822 | /// block specified signal set |
| 823 | pub const _BLOCK = 1; | 823 | pub const _BLOCK = 1; |
lib/std/c/dragonfly.zig+3-3| ... | @@ -609,9 +609,9 @@ pub const S = struct { | ... | @@ -609,9 +609,9 @@ pub const S = struct { |
| 609 | pub const BADSIG = SIG.ERR; | 609 | pub const BADSIG = SIG.ERR; |
| 610 | 610 | ||
| 611 | pub const SIG = struct { | 611 | pub const SIG = struct { |
| 612 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | 612 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); |
| 613 | pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | 613 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); |
| 614 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 614 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); |
| 615 | 615 | ||
| 616 | pub const BLOCK = 1; | 616 | pub const BLOCK = 1; |
| 617 | pub const UNBLOCK = 2; | 617 | pub const UNBLOCK = 2; |
lib/std/c/freebsd.zig+3-3| ... | @@ -670,9 +670,9 @@ pub const SIG = struct { | ... | @@ -670,9 +670,9 @@ pub const SIG = struct { |
| 670 | pub const UNBLOCK = 2; | 670 | pub const UNBLOCK = 2; |
| 671 | pub const SETMASK = 3; | 671 | pub const SETMASK = 3; |
| 672 | 672 | ||
| 673 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | 673 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); |
| 674 | pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | 674 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); |
| 675 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 675 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); |
| 676 | 676 | ||
| 677 | pub const WORDS = 4; | 677 | pub const WORDS = 4; |
| 678 | pub const MAXSIG = 128; | 678 | pub const MAXSIG = 128; |
lib/std/c/netbsd.zig+3-3| ... | @@ -910,9 +910,9 @@ pub const winsize = extern struct { | ... | @@ -910,9 +910,9 @@ pub const winsize = extern struct { |
| 910 | const NSIG = 32; | 910 | const NSIG = 32; |
| 911 | 911 | ||
| 912 | pub const SIG = struct { | 912 | pub const SIG = struct { |
| 913 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | 913 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); |
| 914 | pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | 914 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); |
| 915 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 915 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); |
| 916 | 916 | ||
| 917 | pub const WORDS = 4; | 917 | pub const WORDS = 4; |
| 918 | pub const MAXSIG = 128; | 918 | pub const MAXSIG = 128; |
lib/std/c/openbsd.zig+5-5| ... | @@ -982,11 +982,11 @@ pub const winsize = extern struct { | ... | @@ -982,11 +982,11 @@ pub const winsize = extern struct { |
| 982 | const NSIG = 33; | 982 | const NSIG = 33; |
| 983 | 983 | ||
| 984 | pub const SIG = struct { | 984 | pub const SIG = struct { |
| 985 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | 985 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); |
| 986 | pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | 986 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); |
| 987 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 987 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); |
| 988 | pub const CATCH = @intToPtr(?Sigaction.sigaction_fn, 2); | 988 | pub const CATCH = @intToPtr(?Sigaction.handler_fn, 2); |
| 989 | pub const HOLD = @intToPtr(?Sigaction.sigaction_fn, 3); | 989 | pub const HOLD = @intToPtr(?Sigaction.handler_fn, 3); |
| 990 | 990 | ||
| 991 | pub const HUP = 1; | 991 | pub const HUP = 1; |
| 992 | pub const INT = 2; | 992 | pub const INT = 2; |
lib/std/c/solaris.zig+4-4| ... | @@ -879,10 +879,10 @@ pub const winsize = extern struct { | ... | @@ -879,10 +879,10 @@ pub const winsize = extern struct { |
| 879 | const NSIG = 75; | 879 | const NSIG = 75; |
| 880 | 880 | ||
| 881 | pub const SIG = struct { | 881 | pub const SIG = struct { |
| 882 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | 882 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); |
| 883 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 883 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); |
| 884 | pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | 884 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); |
| 885 | pub const HOLD = @intToPtr(?Sigaction.sigaction_fn, 2); | 885 | pub const HOLD = @intToPtr(?Sigaction.handler_fn, 2); |
| 886 | 886 | ||
| 887 | pub const WORDS = 4; | 887 | pub const WORDS = 4; |
| 888 | pub const MAXSIG = 75; | 888 | pub const MAXSIG = 75; |
lib/std/debug.zig+1-1| ... | @@ -1787,7 +1787,7 @@ fn resetSegfaultHandler() void { | ... | @@ -1787,7 +1787,7 @@ fn resetSegfaultHandler() void { |
| 1787 | return; | 1787 | return; |
| 1788 | } | 1788 | } |
| 1789 | var act = os.Sigaction{ | 1789 | var act = os.Sigaction{ |
| 1790 | .handler = .{ .sigaction = os.SIG.DFL }, | 1790 | .handler = .{ .handler = os.SIG.DFL }, |
| 1791 | .mask = os.empty_sigset, | 1791 | .mask = os.empty_sigset, |
| 1792 | .flags = 0, | 1792 | .flags = 0, |
| 1793 | }; | 1793 | }; |
lib/std/os.zig+3-4| ... | @@ -475,10 +475,9 @@ pub fn abort() noreturn { | ... | @@ -475,10 +475,9 @@ pub fn abort() noreturn { |
| 475 | 475 | ||
| 476 | // Install default handler so that the tkill below will terminate. | 476 | // Install default handler so that the tkill below will terminate. |
| 477 | const sigact = Sigaction{ | 477 | const sigact = Sigaction{ |
| 478 | .handler = .{ .sigaction = SIG.DFL }, | 478 | .handler = .{ .handler = SIG.DFL }, |
| 479 | .mask = undefined, | 479 | .mask = empty_sigset, |
| 480 | .flags = undefined, | 480 | .flags = 0, |
| 481 | .restorer = undefined, | ||
| 482 | }; | 481 | }; |
| 483 | sigaction(SIG.ABRT, &sigact, null) catch |err| switch (err) { | 482 | sigaction(SIG.ABRT, &sigact, null) catch |err| switch (err) { |
| 484 | error.OperationNotSupported => unreachable, | 483 | error.OperationNotSupported => unreachable, |
lib/std/os/linux.zig+9-9| ... | @@ -1945,9 +1945,9 @@ pub const SIG = if (is_mips) struct { | ... | @@ -1945,9 +1945,9 @@ pub const SIG = if (is_mips) struct { |
| 1945 | pub const SYS = 31; | 1945 | pub const SYS = 31; |
| 1946 | pub const UNUSED = SIG.SYS; | 1946 | pub const UNUSED = SIG.SYS; |
| 1947 | 1947 | ||
| 1948 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 1948 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); |
| 1949 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | 1949 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); |
| 1950 | pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | 1950 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); |
| 1951 | } else if (is_sparc) struct { | 1951 | } else if (is_sparc) struct { |
| 1952 | pub const BLOCK = 1; | 1952 | pub const BLOCK = 1; |
| 1953 | pub const UNBLOCK = 2; | 1953 | pub const UNBLOCK = 2; |
| ... | @@ -1989,9 +1989,9 @@ pub const SIG = if (is_mips) struct { | ... | @@ -1989,9 +1989,9 @@ pub const SIG = if (is_mips) struct { |
| 1989 | pub const PWR = LOST; | 1989 | pub const PWR = LOST; |
| 1990 | pub const IO = SIG.POLL; | 1990 | pub const IO = SIG.POLL; |
| 1991 | 1991 | ||
| 1992 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 1992 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); |
| 1993 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | 1993 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); |
| 1994 | pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | 1994 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); |
| 1995 | } else struct { | 1995 | } else struct { |
| 1996 | pub const BLOCK = 0; | 1996 | pub const BLOCK = 0; |
| 1997 | pub const UNBLOCK = 1; | 1997 | pub const UNBLOCK = 1; |
| ... | @@ -2032,9 +2032,9 @@ pub const SIG = if (is_mips) struct { | ... | @@ -2032,9 +2032,9 @@ pub const SIG = if (is_mips) struct { |
| 2032 | pub const SYS = 31; | 2032 | pub const SYS = 31; |
| 2033 | pub const UNUSED = SIG.SYS; | 2033 | pub const UNUSED = SIG.SYS; |
| 2034 | 2034 | ||
| 2035 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 2035 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); |
| 2036 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | 2036 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); |
| 2037 | pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | 2037 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); |
| 2038 | }; | 2038 | }; |
| 2039 | 2039 | ||
| 2040 | pub const kernel_rwf = u32; | 2040 | pub const kernel_rwf = u32; |
lib/std/os/test.zig+1-1| ... | @@ -785,7 +785,7 @@ test "sigaction" { | ... | @@ -785,7 +785,7 @@ test "sigaction" { |
| 785 | try testing.expect(signal_test_failed == false); | 785 | try testing.expect(signal_test_failed == false); |
| 786 | // Check if the handler has been correctly reset to SIG_DFL | 786 | // Check if the handler has been correctly reset to SIG_DFL |
| 787 | try os.sigaction(os.SIG.USR1, null, &old_sa); | 787 | try os.sigaction(os.SIG.USR1, null, &old_sa); |
| 788 | try testing.expectEqual(os.SIG.DFL, old_sa.handler.sigaction); | 788 | try testing.expectEqual(os.SIG.DFL, old_sa.handler.handler); |
| 789 | } | 789 | } |
| 790 | 790 | ||
| 791 | test "dup & dup2" { | 791 | test "dup & dup2" { |