Add epoll and do more release readiness changes

This change also pays off some of the remaining technical debt with
stdio, file descriptors, and memory managemnt polyfills.
This commit is contained in:
Justine Tunney 2020-11-28 12:01:51 -08:00
parent a9ea949df8
commit 3e4fd4b0ad
271 changed files with 5706 additions and 1365 deletions

View file

@ -22,6 +22,7 @@
#include "libc/nt/files.h"
#include "libc/nt/winsock.h"
#include "libc/sock/internal.h"
#include "libc/sock/yoink.inc"
#include "libc/sysv/consts/fio.h"
#include "libc/sysv/consts/sock.h"
#include "libc/sysv/errfuns.h"
@ -31,20 +32,20 @@ textwindows int accept$nt(struct Fd *fd, void *addr, uint32_t *addrsize,
int client;
uint32_t yes;
assert(fd->kind == kFdSocket);
if ((client = createfd()) == -1) return -1;
if ((client = __getemptyfd()) == -1) return -1;
if ((g_fds.p[client].handle = WSAAccept(fd->handle, addr, (int32_t *)addrsize,
NULL, NULL)) != -1) {
if (flags & SOCK_NONBLOCK) {
yes = 1;
if (__ioctlsocket$nt(g_fds.p[client].handle, FIONBIO, &yes) == -1) {
__closesocket$nt(g_fds.p[client].handle);
return winsockerr();
return __winsockerr();
}
}
g_fds.p[client].kind = kFdSocket;
g_fds.p[client].flags = flags;
return client;
} else {
return winsockerr();
return __winsockerr();
}
}