From 8e239cae8aae89f07a885ffcc985600ce9c65d5d Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 11 Aug 2010 10:29:12 -0400 Subject: [PATCH] Cleanup MSG_DONTWAIT Signed-off-by: Jens Axboe --- engines/net.c | 18 ++++-------------- os/os-aix.h | 1 + os/os.h | 4 ++++ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/engines/net.c b/engines/net.c index 9e6e789e..0566a618 100644 --- a/engines/net.c +++ b/engines/net.c @@ -223,10 +223,7 @@ static int fio_netio_splice_out(struct thread_data *td, struct io_u *io_u) static int fio_netio_send(struct thread_data *td, struct io_u *io_u) { struct netio_data *nd = td->io_ops->data; - int ret, flags = 0; -#ifdef MSG_DONTWAIT - flags = MSG_DONTWAIT; -#endif + int ret, flags = OS_MSG_DONTWAIT; do { if (nd->net_protocol == IPPROTO_UDP) { @@ -254,9 +251,7 @@ static int fio_netio_send(struct thread_data *td, struct io_u *io_u) if (ret <= 0) break; -#ifdef MSG_DONTWAIT - flags &= ~MSG_DONTWAIT; -#endif + flags &= ~OS_MSG_DONTWAIT; } while (1); return ret; @@ -281,10 +276,7 @@ static int is_udp_close(struct io_u *io_u, int len) static int fio_netio_recv(struct thread_data *td, struct io_u *io_u) { struct netio_data *nd = td->io_ops->data; - int ret, flags = 0; -#ifdef MSG_DONTWAIT - flags = MSG_DONTWAIT; -#endif + int ret, flags = OS_MSG_DONTWAIT; do { if (nd->net_protocol == IPPROTO_UDP) { @@ -307,9 +299,7 @@ static int fio_netio_recv(struct thread_data *td, struct io_u *io_u) ret = poll_wait(td, io_u->file->fd, POLLIN); if (ret <= 0) break; -#ifdef MSG_DONTWAIT - flags &= ~MSG_DONTWAIT; -#endif + flags &= ~OS_MSG_DONTWAIT; flags |= MSG_WAITALL; } while (1); diff --git a/os/os-aix.h b/os/os-aix.h index 7a646978..96d90976 100644 --- a/os/os-aix.h +++ b/os/os-aix.h @@ -13,6 +13,7 @@ #define FIO_HAVE_PSHARED_MUTEX #define OS_MAP_ANON MAP_ANON +#define OS_MSG_DONTWAIT 0 static inline int blockdev_invalidate_cache(int fd) { diff --git a/os/os.h b/os/os.h index e2bb0ba9..c8f517b6 100644 --- a/os/os.h +++ b/os/os.h @@ -37,6 +37,10 @@ #include "../lib/strsep.h" #endif +#ifdef MSG_DONTWAIT +#define OS_MSG_DONTWAIT MSG_DONTWAIT +#endif + #ifndef FIO_HAVE_FADVISE #define fadvise(fd, off, len, advice) (0) -- 2.25.1