authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-27 14:57:01-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-29 06:20:51-07:00
logef55dcae675dd2048e5e404eb8bb6833d153f653
tree9b643e1c94a33958c5a22b1f5c524f0bd0a50e2a
parentbbc1c075382b3fa9f275fac097267b7c61b5a899

start: fix logic for signal hanlding when SIG.POLL does not exist

fixes a compilation failure on FreeBSD

1 files changed, 13 insertions(+), 3 deletions(-)

lib/std/start.zig+13-3
...@@ -784,9 +784,19 @@ fn maybeIgnoreSignals() void {...@@ -784,9 +784,19 @@ fn maybeIgnoreSignals() void {
784 .mask = posix.sigemptyset(),784 .mask = posix.sigemptyset(),
785 .flags = 0,785 .flags = 0,
786 };786 };
787 if (!std.options.keep_sigpoll) posix.sigaction(posix.SIG.POLL, &act, null);787
788 if (@hasField(posix.SIG, "IO") and posix.SIG.IO != posix.SIG.POLL and !std.options.keep_sigio) posix.sigaction(posix.SIG.IO, &act, null);788 if (@hasField(posix.SIG, "POLL") and !std.options.keep_sigpoll)
789 if (!std.options.keep_sigpipe) posix.sigaction(posix.SIG.PIPE, &act, null);789 posix.sigaction(posix.SIG.POLL, &act, null);
790
791 if (@hasField(posix.SIG, "IO") and
792 (!@hasField(posix.SIG, "POLL") or posix.SIG.IO != posix.SIG.POLL) and
793 !std.options.keep_sigio)
794 {
795 posix.sigaction(posix.SIG.IO, &act, null);
796 }
797
798 if (@hasField(posix.SIG, "PIPE") and !std.options.keep_sigpipe)
799 posix.sigaction(posix.SIG.PIPE, &act, null);
790}800}
791801
792fn noopSigHandler(_: i32) callconv(.c) void {}802fn noopSigHandler(_: i32) callconv(.c) void {}