Rewrite special file handling on Windows

This change gets GNU grep working. What caused it to not work, is it
wouldn't write to an output file descriptor when its dev/ino equaled
/dev/null's. So now we invent special dev/ino values for these files
This commit is contained in:
Justine Tunney 2023-10-14 01:06:00 -07:00
parent aca2261cda
commit 2db2f40a98
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
53 changed files with 485 additions and 299 deletions

View file

@ -67,10 +67,8 @@
#include "libc/thread/itimer.internal.h"
#include "libc/thread/posixthread.internal.h"
#include "libc/thread/tls.h"
#ifdef __x86_64__
extern int64_t __wincrashearly;
void __keystroke_wipe(void);
static textwindows wontreturn void AbortFork(const char *func) {
@ -399,7 +397,7 @@ textwindows int sys_fork_nt(uint32_t dwCreationFlags) {
__tls_enabled_set(true);
// clear pending signals
tib->tib_sigpending = 0;
__sig.pending = 0;
atomic_store_explicit(&__sig.pending, 0, memory_order_relaxed);
// re-enable threads
__enable_threads();
// re-apply code morphing for function tracing