#include <unistd.h>
#include <dirent.h>
#include <pthread.h>
+#include <time.h>
#include <semaphore.h>
#include <sys/shm.h>
#include <sys/mman.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"
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,
FD_SET(fds[i].fd, &exceptfds);
}
-
rc = select(nfds, &readfds, &writefds, &exceptfds, to);
if (rc != SOCKET_ERROR) {
fds[i].revents |= POLLHUP;
}
}
-
return rc;
}
return -1;
}
+in_addr_t inet_network(const char *cp)
+{
+ in_addr_t hbo;
+ in_addr_t nbo = inet_addr(cp);
+ hbo = ((nbo & 0xFF) << 24) + ((nbo & 0xFF00) << 8) + ((nbo & 0xFF0000) >> 8) + ((nbo & 0xFF000000) >> 24);
+ return hbo;
+}
+
const char* inet_ntop(int af, const void *restrict src,
char *restrict dst, socklen_t size)
{