diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-10-28 18:45:53 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-10-29 06:20:52 -0700 |
| commit | 05b28409e7204f78e3edb32ea9c46b10e4e97cef (patch) | |
| tree | 4db0f476cbb8718941df6c07a375ee384f1b0d00 /lib/std/start.zig | |
| parent | b863f2548b95cdc8b2e2818ac3a26e553be155dc (diff) | |
| download | zig-05b28409e7204f78e3edb32ea9c46b10e4e97cef.tar.gz zig-05b28409e7204f78e3edb32ea9c46b10e4e97cef.zip | |
std.Io.Threaded: install and cleanup signal handlers
rather than in start code. delete std.options.keep_sig_io and
std.options.keep_sig_pipe
Diffstat (limited to 'lib/std/start.zig')
| -rw-r--r-- | lib/std/start.zig | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig index 79e2d93134..a563912bbc 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -651,7 +651,6 @@ inline fn callMainWithArgs(argc: usize, argv: [*][*:0]u8, envp: [][*:0]u8) u8 { std.os.argv = argv[0..argc]; std.os.environ = envp; - maybeIgnoreSignals(); std.debug.maybeEnableSegfaultHandler(); return callMain(); @@ -756,23 +755,3 @@ pub fn call_wWinMain() std.os.windows.INT { // second parameter hPrevInstance, MSDN: "This parameter is always NULL" return root.wWinMain(hInstance, null, lpCmdLine, nCmdShow); } - -fn maybeIgnoreSignals() void { - const posix = std.posix; - if (posix.Sigaction == void) return; - const act: posix.Sigaction = .{ - // Set handler to a noop function instead of `IGN` to prevent - // leaking signal disposition to a child process. - .handler = .{ .handler = noopSigHandler }, - .mask = posix.sigemptyset(), - .flags = 0, - }; - - if (@hasField(posix.SIG, "IO") and !std.options.keep_sig_io) - posix.sigaction(.IO, &act, null); - - if (@hasField(posix.SIG, "PIPE") and !std.options.keep_sig_pipe) - posix.sigaction(.PIPE, &act, null); -} - -fn noopSigHandler(_: std.posix.SIG) callconv(.c) void {} |
