summaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/mmap.c1
-rw-r--r--engines/net.c34
-rw-r--r--engines/sync.c1
3 files changed, 29 insertions, 7 deletions
diff --git a/engines/mmap.c b/engines/mmap.c
index 3e1e6c8d..5b55a811 100644
--- a/engines/mmap.c
+++ b/engines/mmap.c
@@ -9,7 +9,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
-#include <assert.h>
#include <sys/mman.h>
#include "../fio.h"
diff --git a/engines/net.c b/engines/net.c
index 137c5799..0efd3369 100644
--- a/engines/net.c
+++ b/engines/net.c
@@ -41,6 +41,7 @@ static int fio_netio_prep(struct thread_data *td, struct io_u *io_u)
return 0;
}
+#ifdef FIO_HAVE_SPLICE
static int splice_io_u(int fdin, int fdout, unsigned int len)
{
int bytes = 0;
@@ -161,6 +162,19 @@ static int fio_netio_splice_out(struct thread_data *td, struct io_u *io_u)
return ret;
}
+#else
+static int fio_netio_splice_in(struct thread_data *td, struct io_u *io_u)
+{
+ errno = -EOPNOTSUPP;
+ return -1;
+}
+
+static int fio_netio_splice_out(struct thread_data *td, struct io_u *io_u)
+{
+ errno = -EOPNOTSUPP;
+ return -1;
+}
+#endif
static int fio_netio_send(struct thread_data *td, struct io_u *io_u)
{
@@ -169,8 +183,10 @@ static int fio_netio_send(struct thread_data *td, struct io_u *io_u)
/*
* if we are going to write more, set MSG_MORE
*/
+#ifdef MSG_MORE
if (td->this_io_bytes[DDIR_WRITE] + io_u->xfer_buflen < td->o.size)
flags = MSG_MORE;
+#endif
return send(io_u->file->fd, io_u->xfer_buf, io_u->xfer_buflen, flags);
}
@@ -430,6 +446,7 @@ static int fio_netio_setup(struct thread_data *td)
return 0;
}
+#ifdef FIO_HAVE_SPLICE
static int fio_netio_setup_splice(struct thread_data *td)
{
struct netio_data *nd;
@@ -448,12 +465,12 @@ static int fio_netio_setup_splice(struct thread_data *td)
return 1;
}
-static struct ioengine_ops ioengine_rw = {
- .name = "net",
+static struct ioengine_ops ioengine_splice = {
+ .name = "netsplice",
.version = FIO_IOOPS_VERSION,
.prep = fio_netio_prep,
.queue = fio_netio_queue,
- .setup = fio_netio_setup,
+ .setup = fio_netio_setup_splice,
.init = fio_netio_init,
.cleanup = fio_netio_cleanup,
.open_file = fio_netio_open_file,
@@ -461,13 +478,14 @@ static struct ioengine_ops ioengine_rw = {
.flags = FIO_SYNCIO | FIO_DISKLESSIO | FIO_UNIDIR |
FIO_SIGQUIT,
};
+#endif
-static struct ioengine_ops ioengine_splice = {
- .name = "netsplice",
+static struct ioengine_ops ioengine_rw = {
+ .name = "net",
.version = FIO_IOOPS_VERSION,
.prep = fio_netio_prep,
.queue = fio_netio_queue,
- .setup = fio_netio_setup_splice,
+ .setup = fio_netio_setup,
.init = fio_netio_init,
.cleanup = fio_netio_cleanup,
.open_file = fio_netio_open_file,
@@ -479,11 +497,15 @@ static struct ioengine_ops ioengine_splice = {
static void fio_init fio_netio_register(void)
{
register_ioengine(&ioengine_rw);
+#ifdef FIO_HAVE_SPLICE
register_ioengine(&ioengine_splice);
+#endif
}
static void fio_exit fio_netio_unregister(void)
{
unregister_ioengine(&ioengine_rw);
+#ifdef FIO_HAVE_SPLICE
unregister_ioengine(&ioengine_splice);
+#endif
}
diff --git a/engines/sync.c b/engines/sync.c
index e966846c..561e77ba 100644
--- a/engines/sync.c
+++ b/engines/sync.c
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <sys/uio.h>
#include <errno.h>
#include <assert.h>