Add fio_socklen_t
authorJens Axboe <axboe@kernel.dk>
Tue, 4 Oct 2011 21:50:28 +0000 (23:50 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 4 Oct 2011 21:51:48 +0000 (23:51 +0200)
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 <axboe@kernel.dk>
engines/net.c
os/os-hpux.h
os/os.h
server.c

index 6866ba2d840465a0dfbeb85372016704c22c5ace..781dd10adeb787f65689958fe09754f3517d837a 100644 (file)
@@ -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) {
 
        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,
                        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;
 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;
 
        if (nd->net_protocol == IPPROTO_UDP) {
                f->fd = nd->listenfd;
index 43098ad72d86fcc40d6d8c2860d7fa62722d3b6d..93240b364bfb528a6d2198e472291a9bca022360 100644 (file)
@@ -55,6 +55,9 @@
 #define FIO_OS_HAVE_AIOCB_TYPEDEF
 typedef struct aiocb64 os_aiocb_t;
 
 #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;
 static inline int blockdev_invalidate_cache(struct fio_file *f)
 {
        return EINVAL;
diff --git a/os/os.h b/os/os.h
index a24004b584e749ea2d830481e3ea3e8a5584e1f7..189041f5546c20e703deaeb499683963fd5a6b1f 100644 (file)
--- 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
 
 #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)
 {
 #ifdef FIO_USE_GENERIC_SWAP
 static inline uint16_t fio_swap16(uint16_t val)
 {
index 37ba5939b32c0b17371079261220f474eb53c02f..07f3216b4a53552f0dc2a1ec85edd10dcdb8aec5 100644 (file)
--- 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;
 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;
 
        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;
 {
        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");
        int sk, opt, ret;
 
        dprint(FD_NET, "starting server\n");