X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=engines%2Fnet.c;h=6866ba2d840465a0dfbeb85372016704c22c5ace;hb=2e03b4b2a072b79946b0ee651dff38273868473a;hp=93693f6d803233c7142e97305d8cecd32bc4ee90;hpb=664fb3bde9ed3b61d0520b6b4f3d0ba9599834b0;p=fio.git diff --git a/engines/net.c b/engines/net.c index 93693f6d..6866ba2d 100644 --- a/engines/net.c +++ b/engines/net.c @@ -223,13 +223,15 @@ 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 = MSG_DONTWAIT; + int ret, flags = OS_MSG_DONTWAIT; do { if (nd->net_protocol == IPPROTO_UDP) { + struct sockaddr *to = (struct sockaddr *) &nd->addr; + ret = sendto(io_u->file->fd, io_u->xfer_buf, - io_u->xfer_buflen, flags, &nd->addr, - sizeof(nd->addr)); + io_u->xfer_buflen, flags, to, + sizeof(*to)); } else { /* * if we are going to write more, set MSG_MORE @@ -249,7 +251,7 @@ static int fio_netio_send(struct thread_data *td, struct io_u *io_u) if (ret <= 0) break; - flags &= ~MSG_DONTWAIT; + flags &= ~OS_MSG_DONTWAIT; } while (1); return ret; @@ -274,15 +276,19 @@ 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 = MSG_DONTWAIT; + int ret, flags = OS_MSG_DONTWAIT; do { if (nd->net_protocol == IPPROTO_UDP) { +#ifdef __hpux + int len = sizeof(nd->addr); +#else socklen_t len = sizeof(nd->addr); +#endif + struct sockaddr *from = (struct sockaddr *) &nd->addr; ret = recvfrom(io_u->file->fd, io_u->xfer_buf, - io_u->xfer_buflen, flags, &nd->addr, - &len); + io_u->xfer_buflen, flags, from, &len); if (is_udp_close(io_u, ret)) { td->done = 1; return 0; @@ -297,7 +303,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; - flags &= ~MSG_DONTWAIT; + flags &= ~OS_MSG_DONTWAIT; flags |= MSG_WAITALL; } while (1); @@ -375,7 +381,11 @@ 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 if (nd->net_protocol == IPPROTO_UDP) { f->fd = nd->listenfd; @@ -408,12 +418,13 @@ static void fio_netio_udp_close(struct thread_data *td, struct fio_file *f) { struct netio_data *nd = td->io_ops->data; struct udp_close_msg msg; + struct sockaddr *to = (struct sockaddr *) &nd->addr; int ret; msg.magic = htonl(FIO_LINK_CLOSE_MAGIC); msg.cmd = htonl(FIO_LINK_CLOSE); - ret = sendto(f->fd, &msg, sizeof(msg), MSG_WAITALL, &nd->addr, + ret = sendto(f->fd, &msg, sizeof(msg), MSG_WAITALL, to, sizeof(nd->addr)); if (ret < 0) td_verror(td, errno, "sendto udp link close"); @@ -630,7 +641,7 @@ static struct ioengine_ops ioengine_splice = { .open_file = fio_netio_open_file, .close_file = generic_close_file, .flags = FIO_SYNCIO | FIO_DISKLESSIO | FIO_UNIDIR | - FIO_SIGQUIT, + FIO_SIGTERM | FIO_PIPEIO, }; #endif @@ -645,7 +656,7 @@ static struct ioengine_ops ioengine_rw = { .open_file = fio_netio_open_file, .close_file = fio_netio_close_file, .flags = FIO_SYNCIO | FIO_DISKLESSIO | FIO_UNIDIR | - FIO_SIGQUIT, + FIO_SIGTERM | FIO_PIPEIO, }; static void fio_init fio_netio_register(void)