The network code depends on writev(), so implement it for Windows.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
#include <sys/uio.h>
#include <sys/resource.h>
#include <sys/poll.h>
#include <sys/uio.h>
#include <sys/resource.h>
#include <sys/poll.h>
+#include <sys/wait.h>
+#include <setjmp.h>
#include "../os-windows.h"
#include "../../lib/hweight.h"
#include "../os-windows.h"
#include "../../lib/hweight.h"
ssize_t writev(int fildes, const struct iovec *iov, int iovcnt)
{
ssize_t writev(int fildes, const struct iovec *iov, int iovcnt)
{
- log_err("%s is not implemented\n", __func__);
- errno = ENOSYS;
- return -1;
+ int i;
+ DWORD bytes_written = 0;
+ for (i = 0; i < iovcnt; i++)
+ {
+ int len = send((SOCKET)fildes, iov[i].iov_base, iov[i].iov_len, 0);
+ if (len == SOCKET_ERROR)
+ {
+ DWORD err = GetLastError();
+ errno = win_to_posix_error(err);
+ bytes_written = -1;
+ break;
+ }
+ bytes_written += len;
+ }
+
+ return bytes_written;
}
long long strtoll(const char *restrict str, char **restrict endptr,
}
long long strtoll(const char *restrict str, char **restrict endptr,
FD_SET(fds[i].fd, &exceptfds);
}
FD_SET(fds[i].fd, &exceptfds);
}
rc = select(nfds, &readfds, &writefds, &exceptfds, to);
if (rc != SOCKET_ERROR) {
rc = select(nfds, &readfds, &writefds, &exceptfds, to);
if (rc != SOCKET_ERROR) {
fds[i].revents |= POLLHUP;
}
}
fds[i].revents |= POLLHUP;
}
}
#include <inttypes.h>
#include <unistd.h>
#include <inttypes.h>
#include <unistd.h>
void *iov_base; /* Base address of a memory region for input or output */
size_t iov_len; /* The size of the memory pointed to by iov_base */
};
void *iov_base; /* Base address of a memory region for input or output */
size_t iov_len; /* The size of the memory pointed to by iov_base */
};
#define WIFEXITED(a) 0
#define WTERMSIG(a) 0
#define WEXITSTATUS(a) 0
#define WIFEXITED(a) 0
#define WTERMSIG(a) 0
#define WEXITSTATUS(a) 0
pid_t waitpid(pid_t, int *stat_loc, int options);
pid_t waitpid(pid_t, int *stat_loc, int options);