From: Jens Axboe Date: Thu, 24 Jan 2013 00:21:41 +0000 (-0700) Subject: Fix compile warnings on Windows X-Git-Tag: fio-2.0.14~88 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=1f81991ed356dd7257aef2c715ba9a24d9af93a5 Fix compile warnings on Windows Signed-off-by: Jens Axboe --- diff --git a/engines/net.c b/engines/net.c index eb05bccc..de7cdb54 100644 --- a/engines/net.c +++ b/engines/net.c @@ -541,7 +541,7 @@ static void fio_netio_udp_close(struct thread_data *td, struct fio_file *f) 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 @@ static int fio_netio_udp_recv_open(struct thread_data *td, struct fio_file *f) 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 @@ static int fio_netio_udp_send_open(struct thread_data *td, struct fio_file *f) 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 @@ static int fio_netio_setup_listen_inet(struct thread_data *td, short port) } 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 18de8398..f68f654c 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 fb544a17..f33a7cdf 100644 --- a/os/os.h +++ b/os/os.h @@ -137,7 +137,7 @@ typedef unsigned int socklen_t; #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 00000000..cb89cf6e --- /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 bb03c779..3607ee81 100644 --- a/server.c +++ b/server.c @@ -829,7 +829,7 @@ static int fio_init_server_ip(void) } 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;