Make fixes and improvements

- Introduce __assert_disable global
- Improve strsignal() thread safety
- Make system call tracing thread safe
- Fix SO_RCVTIMEO / SO_SNDTIMEO on Windows
- Refactor DescribeFoo() functions into one place
- Fix fork() on Windows when TLS and MAP_STACK exist
- Round upwards in setsockopt(SO_RCVTIMEO) on Windows
- Disable futexes on OpenBSD which seem extremely broken
- Implement a better kludge for monotonic time on Windows
This commit is contained in:
Justine Tunney 2022-06-25 18:17:31 -07:00
parent 5d837c4e7c
commit fbc053e018
186 changed files with 1836 additions and 1325 deletions

View file

@ -26,10 +26,11 @@
#include "libc/sysv/errfuns.h"
textwindows int __wsablock(int64_t handle, struct NtOverlapped *overlapped,
uint32_t *flags, bool restartable) {
uint32_t *flags, bool restartable,
uint32_t timeout) {
uint32_t i, got;
if (WSAGetLastError() != kNtErrorIoPending) {
NTTRACE("WSARecv failed %lm");
NTTRACE("sock i/o failed %lm");
return __winsockerr();
}
for (;;) {
@ -39,10 +40,15 @@ textwindows int __wsablock(int64_t handle, struct NtOverlapped *overlapped,
NTTRACE("WSAWaitForMultipleEvents failed %lm");
return __winsockerr();
} else if (i == kNtWaitTimeout || i == kNtWaitIoCompletion) {
if (_check_interrupts(restartable, g_fds.p)) return eintr();
#if _NTTRACE
POLLTRACE("WSAWaitForMultipleEvents...");
#endif
if (_check_interrupts(restartable, g_fds.p)) {
return eintr();
}
if (timeout) {
if (timeout <= __SIG_POLLING_INTERVAL_MS) {
return eagain();
}
timeout -= __SIG_POLLING_INTERVAL_MS;
}
} else {
break;
}