Avoid linking win32 signals impl

This shaves ~4kb off o/tiny/examples/hello2.com by avoiding linking the
WIN32 signals polyfill unless sigaction() is being used.

See #965
This commit is contained in:
Justine Tunney 2023-11-29 04:09:31 -08:00
parent 2b960bb249
commit 70155df7a9
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
8 changed files with 37 additions and 31 deletions

View file

@ -22,6 +22,7 @@
#include "libc/calls/struct/sigset.internal.h"
#include "libc/intrin/dll.h"
#include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/nt/enum/wait.h"
#include "libc/nt/events.h"
#include "libc/nt/runtime.h"
@ -76,8 +77,8 @@ static textwindows int __proc_wait(int pid, int *wstatus, int options,
if (_check_cancel() == -1) {
return -1;
}
if ((sig = __sig_get(waitmask))) {
handler_was_called = __sig_relay(sig, SI_KERNEL, waitmask);
if (_weaken(__sig_get) && (sig = _weaken(__sig_get)(waitmask))) {
handler_was_called = _weaken(__sig_relay)(sig, SI_KERNEL, waitmask);
if (_check_cancel() == -1) {
return -1; // ECANCELED because SIGTHR was just handled
}