Fix bugs with recent change

This change makes further effort towards improving our poll()
implementation on the New Technology. The stdin worker didn't work out
so well for Python so it's not being used for now. System call tracing
with the --strace flag should now be less noisy now on Windows unless
you modify the strace.internal.h defines to turn on some optional ones
that are most useful for debugging the system call wrappers.
This commit is contained in:
Justine Tunney 2022-04-16 10:40:23 -07:00
parent 933411ba99
commit dc0ea6640e
127 changed files with 1354 additions and 866 deletions

View file

@ -29,6 +29,13 @@
/**
* Reads data to multiple buffers.
*
* This is the same thing as read() except it has multiple buffers.
* This yields a performance boost in situations where it'd be expensive
* to stitch data together using memcpy() or issuing multiple syscalls.
* This wrapper is implemented so that readv() calls where iovlen<2 may
* be passed to the kernel as read() instead. This yields a 100 cycle
* performance boost in the case of a single small iovec.
*
* @return number of bytes actually read, or -1 w/ errno
* @restartable
*/
@ -41,7 +48,11 @@ ssize_t readv(int fd, const struct iovec *iov, int iovlen) {
rc = weaken(__zipos_read)(
(struct ZiposHandle *)(intptr_t)g_fds.p[fd].handle, iov, iovlen, -1);
} else if (!IsWindows() && !IsMetal()) {
rc = sys_readv(fd, iov, iovlen);
if (iovlen == 1) {
rc = sys_read(fd, iov[0].iov_base, iov[0].iov_len);
} else {
rc = sys_readv(fd, iov, iovlen);
}
} else if (fd >= g_fds.n) {
rc = ebadf();
} else if (IsMetal()) {