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

@ -26,7 +26,7 @@
#include "libc/macros.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/errfuns.h"
#include "libc/zipos/zipos.h"
#include "libc/zipos/zipos.internal.h"
/**
* Reads from file at offset, thus avoiding superfluous lseek().
@ -42,12 +42,12 @@
ssize_t pread(int fd, void *buf, size_t size, int64_t offset) {
ssize_t rc;
if (fd == -1 || offset < 0) return einval();
if (isfdkind(fd, kFdZip)) {
if (__isfdkind(fd, kFdZip)) {
rc = weaken(__zipos_read)(
(struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, buf, size, offset);
} else if (!IsWindows()) {
rc = pread$sysv(fd, buf, size, offset);
} else if (isfdkind(fd, kFdFile)) {
} else if (__isfdkind(fd, kFdFile)) {
rc = read$nt(&g_fds.p[fd], (struct iovec[]){{buf, size}}, 1, offset);
} else {
rc = ebadf();