mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
Merge pull request #22337 from ruihe774/fix-app-mask
* std.os.linux: remove app_mask * std.posix: on libc-less linux, block all signals in raise(), not just app_mask
This commit is contained in:
commit
9dfdf35032
@ -5151,7 +5151,6 @@ pub const NSIG = if (is_mips) 128 else 65;
|
||||
pub const sigset_t = [1024 / 32]u32;
|
||||
|
||||
pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).array.len;
|
||||
pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30;
|
||||
|
||||
const k_sigaction_funcs = struct {
|
||||
const handler = ?*align(1) const fn (i32) callconv(.c) void;
|
||||
|
||||
@ -724,9 +724,12 @@ pub fn raise(sig: u8) RaiseError!void {
|
||||
}
|
||||
|
||||
if (native_os == .linux) {
|
||||
// https://git.musl-libc.org/cgit/musl/commit/?id=0bed7e0acfd34e3fb63ca0e4d99b7592571355a9
|
||||
//
|
||||
// Unlike musl, libc-less Zig std does not have any internal signals for implementation purposes, so we
|
||||
// need to block all signals on the assumption that any of them could potentially fork() in a handler.
|
||||
var set: sigset_t = undefined;
|
||||
// block application signals
|
||||
sigprocmask(SIG.BLOCK, &linux.app_mask, &set);
|
||||
sigprocmask(SIG.BLOCK, &linux.all_mask, &set);
|
||||
|
||||
const tid = linux.gettid();
|
||||
const rc = linux.tkill(tid, sig);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user