Skip to content

Commit f1b6729

Browse files
committed
std.process.Child: use linux.sigprocmask instead of posix.sigprocmask
otherwise libc may silently ignore some RT signals for NPTL
1 parent 91c0bd3 commit f1b6729

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/std/process/Child.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,14 +616,14 @@ fn spawnPosixChildHelper(arg: usize) callconv(.c) u8 {
616616
if (native_os == .linux and child_arg.sigmask != null) {
617617
std.debug.assert(linux.SIG.DFL == null);
618618
for (1..linux.NSIG) |sig| {
619-
var old_act: posix.Sigaction = undefined;
619+
var old_act: linux.Sigaction = undefined;
620620
const new_act = mem.zeroes(posix.Sigaction);
621621
_ = linux.sigaction(@intCast(sig), &new_act, &old_act);
622622
if (old_act.handler.handler == linux.SIG.IGN) {
623623
_ = linux.sigaction(@intCast(sig), &old_act, null);
624624
}
625625
}
626-
posix.sigprocmask(posix.SIG.SETMASK, child_arg.sigmask, null);
626+
std.debug.assert(linux.sigprocmask(linux.SIG.SETMASK, child_arg.sigmask, null) == 0);
627627
}
628628

629629
const err = switch (child_arg.self.expand_arg0) {
@@ -789,8 +789,8 @@ fn spawnPosix(self: *ChildProcess) SpawnError!void {
789789
// We need to block signals here because we share VM with child before exec.
790790
// Signal handlers may mess up our memory.
791791
var old_mask: posix.sigset_t = undefined;
792-
posix.sigprocmask(posix.SIG.SETMASK, &linux.all_mask, &old_mask);
793-
defer posix.sigprocmask(posix.SIG.SETMASK, &old_mask, null);
792+
std.debug.assert(linux.sigprocmask(linux.SIG.SETMASK, &linux.all_mask, &old_mask) == 0);
793+
defer std.debug.assert(linux.sigprocmask(linux.SIG.SETMASK, &old_mask, null) == 0);
794794
child_arg.sigmask = &old_mask;
795795
rc = linux.clone(spawnPosixChildHelper, @intFromPtr(stack.ptr) + stack_size, linux.CLONE.VM | linux.CLONE.VFORK | linux.SIG.CHLD, @intFromPtr(&child_arg), null, 0, null);
796796
switch (linux.E.init(rc)) {

0 commit comments

Comments
 (0)