Rewrite Windows signal delivery system

This commit is contained in:
Justine Tunney 2023-09-12 11:38:34 -07:00
parent 00084577a3
commit 81f391dd22
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
19 changed files with 66 additions and 333 deletions

View file

@ -47,6 +47,7 @@
#include "libc/sysv/consts/sa.h"
#include "libc/sysv/consts/sig.h"
#include "libc/sysv/errfuns.h"
#include "libc/thread/tls.h"
#ifdef SYSDEBUG
__static_yoink("strsignal"); // for kprintf()
@ -264,7 +265,13 @@ static int __sigaction(int sig, const struct sigaction *act,
__sighandrvas[sig] = rva;
__sighandflags[sig] = act->sa_flags;
if (IsWindows()) {
__sig_check_ignore(sig, rva);
if (rva == (intptr_t)SIG_IGN ||
(rva == (intptr_t)SIG_DFL && __sig_is_ignored(sig))) {
__sig.pending &= ~(1ull << (sig - 1));
if (__tls_enabled) {
__get_tls()->tib_sigpending &= ~(1ull << (sig - 1));
}
}
}
}
}