From: Jens Axboe Date: Tue, 4 Oct 2011 21:50:28 +0000 (+0200) Subject: Add fio_socklen_t X-Git-Tag: fio-1.99~12 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=5ba13ea6968cf2773f10d34376afe28ef81aeee5 Add fio_socklen_t HPUX decides to be different yet again, add an OS typedef to handle this instead of ifdefs in the code. Signed-off-by: Jens Axboe --- diff --git a/engines/net.c b/engines/net.c index 6866ba2d..781dd10a 100644 --- a/engines/net.c +++ b/engines/net.c @@ -280,11 +280,7 @@ static int fio_netio_recv(struct thread_data *td, struct io_u *io_u) do { if (nd->net_protocol == IPPROTO_UDP) { -#ifdef __hpux - int len = sizeof(nd->addr); -#else - socklen_t len = sizeof(nd->addr); -#endif + fio_socklen_t len = sizeof(nd->addr); struct sockaddr *from = (struct sockaddr *) &nd->addr; ret = recvfrom(io_u->file->fd, io_u->xfer_buf, @@ -381,11 +377,7 @@ static int fio_netio_connect(struct thread_data *td, struct fio_file *f) static int fio_netio_accept(struct thread_data *td, struct fio_file *f) { struct netio_data *nd = td->io_ops->data; -#ifdef __hpux - int socklen = sizeof(nd->addr); -#else - socklen_t socklen = sizeof(nd->addr); -#endif + fio_socklen_t socklen = sizeof(nd->addr); if (nd->net_protocol == IPPROTO_UDP) { f->fd = nd->listenfd; diff --git a/os/os-hpux.h b/os/os-hpux.h index 43098ad7..93240b36 100644 --- a/os/os-hpux.h +++ b/os/os-hpux.h @@ -55,6 +55,9 @@ #define FIO_OS_HAVE_AIOCB_TYPEDEF typedef struct aiocb64 os_aiocb_t; +#define FIO_OS_HAVE_SOCKLEN_T +typedef int fio_socklen_t; + static inline int blockdev_invalidate_cache(struct fio_file *f) { return EINVAL; diff --git a/os/os.h b/os/os.h index a24004b5..189041f5 100644 --- a/os/os.h +++ b/os/os.h @@ -115,6 +115,10 @@ typedef unsigned long os_cpu_mask_t; #define FIO_MAX_JOBS 2048 #endif +#ifndef FIO_OS_HAVE_SOCKLEN_T +typedef socklen_t fio_socklen_t; +#endif + #ifdef FIO_USE_GENERIC_SWAP static inline uint16_t fio_swap16(uint16_t val) { diff --git a/server.c b/server.c index 37ba5939..07f3216b 100644 --- a/server.c +++ b/server.c @@ -400,7 +400,7 @@ void fio_server_idle_loop(void) static int accept_loop(int listen_sk) { struct sockaddr_in addr; - socklen_t len = sizeof(addr); + fio_socklen_t len = sizeof(addr); struct pollfd pfd; int ret, sk, flags, exitval = 0; @@ -631,7 +631,7 @@ static int fio_server(void) { struct sockaddr_in saddr_in; struct sockaddr addr; - socklen_t len; + fio_socklen_t len; int sk, opt, ret; dprint(FD_NET, "starting server\n");