Put more thought into i/o polyfills

wait4() is now solid enough to run `make -j100` on Windows. You can now
use MSG_DONTWAIT on Windows. There was a handle leak in accept() that's
been fixed. Our WIN32 overlapped i/o code has been simplified. Priority
class now inherits into subprocesses, so the verynice command will work
and the signal mask will now be inherited by execve() and posix_spawn()
This commit is contained in:
Justine Tunney 2023-11-06 16:38:44 -08:00
parent 736fdb757a
commit e961385e55
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
52 changed files with 679 additions and 487 deletions

View file

@ -109,7 +109,7 @@ textwindows int sys_accept_nt(struct Fd *f, struct sockaddr_storage *addr,
if ((resources.handle = WSASocket(f->family, f->type, f->protocol, 0, 0,
kNtWsaFlagOverlapped)) == -1) {
client = __winsockerr();
goto WeFailed;
goto Finish;
}
// accept network connection
@ -118,7 +118,10 @@ textwindows int sys_accept_nt(struct Fd *f, struct sockaddr_storage *addr,
ssize_t bytes_received = __winsock_block(
resources.handle, 0, !!(f->flags & O_NONBLOCK), f->rcvtimeo, m,
sys_accept_nt_start, &(struct AcceptArgs){f->handle, &buffer});
if (bytes_received == -1) goto WeFailed;
if (bytes_received == -1) {
__imp_closesocket(resources.handle);
goto Finish;
}
// create file descriptor for new socket
// don't inherit the file open mode bits
@ -138,7 +141,7 @@ textwindows int sys_accept_nt(struct Fd *f, struct sockaddr_storage *addr,
memcpy(addr, &buffer.remote.addr, sizeof(*addr));
g_fds.p[client].kind = kFdSocket;
WeFailed:
Finish:
pthread_cleanup_pop(false);
__sig_unblock(m);
if (client == -1 && errno == ECONNRESET) {