Fix compile warnings on Windows
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/engines/net.c b/engines/net.c
index eb05bcc..de7cdb5 100644
--- a/engines/net.c
+++ b/engines/net.c
@@ -541,7 +541,7 @@
msg.magic = htonl(FIO_LINK_OPEN_CLOSE_MAGIC);
msg.cmd = htonl(FIO_LINK_CLOSE);
- ret = sendto(f->fd, &msg, sizeof(msg), MSG_WAITALL, to,
+ ret = sendto(f->fd, (void *) &msg, sizeof(msg), MSG_WAITALL, to,
sizeof(nd->addr));
if (ret < 0)
td_verror(td, errno, "sendto udp link close");
@@ -569,7 +569,7 @@
socklen_t len = sizeof(nd->addr);
int ret;
- ret = recvfrom(f->fd, &msg, sizeof(msg), MSG_WAITALL, to, &len);
+ ret = recvfrom(f->fd, (void *) &msg, sizeof(msg), MSG_WAITALL, to, &len);
if (ret < 0) {
td_verror(td, errno, "sendto udp link open");
return ret;
@@ -595,7 +595,7 @@
msg.magic = htonl(FIO_LINK_OPEN_CLOSE_MAGIC);
msg.cmd = htonl(FIO_LINK_OPEN);
- ret = sendto(f->fd, &msg, sizeof(msg), MSG_WAITALL, to,
+ ret = sendto(f->fd, (void *) &msg, sizeof(msg), MSG_WAITALL, to,
sizeof(nd->addr));
if (ret < 0) {
td_verror(td, errno, "sendto udp link open");
@@ -743,7 +743,7 @@
}
opt = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)&opt, sizeof(opt)) < 0) {
td_verror(td, errno, "setsockopt");
return 1;
}
diff --git a/os/os-windows.h b/os/os-windows.h
index 18de839..f68f654 100644
--- a/os/os-windows.h
+++ b/os/os-windows.h
@@ -15,6 +15,8 @@
#include "../file.h"
#include "../log.h"
+#include "windows/posix.h"
+
#define FIO_HAVE_ODIRECT
#define FIO_HAVE_CPU_AFFINITY
#define FIO_HAVE_CHARDEV_SIZE
@@ -36,9 +38,6 @@
#define fio_swap32(x) _byteswap_ulong(x)
#define fio_swap64(x) _byteswap_uint64(x)
-typedef off_t off64_t;
-typedef int clockid_t;
-
typedef DWORD_PTR os_cpu_mask_t;
#define CLOCK_REALTIME 1
diff --git a/os/os.h b/os/os.h
index fb544a1..f33a7cd 100644
--- a/os/os.h
+++ b/os/os.h
@@ -137,7 +137,7 @@
#endif
#ifndef FIO_OS_HAS_CTIME_R
-#define os_ctime_r(x, y, z) ctime_r((x), (y))
+#define os_ctime_r(x, y, z) (void) ctime_r((x), (y))
#endif
#ifdef FIO_USE_GENERIC_SWAP
diff --git a/os/windows/posix.h b/os/windows/posix.h
new file mode 100644
index 0000000..cb89cf6
--- /dev/null
+++ b/os/windows/posix.h
@@ -0,0 +1,10 @@
+#ifndef FIO_WINDOWS_POSIX_H
+#define FIO_WINDOWS_POSIX_H
+
+typedef off_t off64_t;
+typedef int clockid_t;
+
+extern int clock_gettime(clockid_t clock_id, struct timespec *tp);
+extern int inet_aton(const char *, struct in_addr *);
+
+#endif
diff --git a/server.c b/server.c
index bb03c77..3607ee8 100644
--- a/server.c
+++ b/server.c
@@ -829,7 +829,7 @@
}
opt = 1;
- if (setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
+ if (setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, sizeof(opt)) < 0) {
log_err("fio: setsockopt: %s\n", strerror(errno));
close(sk);
return -1;