[PATCH] Final FreeBSD compile fixups

It actually builds now!
diff --git a/ioengines.c b/ioengines.c
index 7b1c1bd..b086b60 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -15,20 +15,12 @@
 #include <errno.h>
 #include <assert.h>
 #include <time.h>
+#include <string.h>
 #include <sys/mman.h>
 #include <sys/poll.h>
 #include "fio.h"
 #include "os.h"
 
-#ifdef FIO_HAVE_LIBAIO
-
-#define ev_to_iou(ev)	(struct io_u *) ((unsigned long) (ev)->obj)
-
-static int fio_io_sync(struct thread_data *td)
-{
-	return fsync(td->fd);
-}
-
 static int fill_timespec(struct timespec *ts)
 {
 #ifdef _POSIX_TIMERS
@@ -60,6 +52,15 @@
 	return sec + nsec;
 }
 
+static int fio_io_sync(struct thread_data *td)
+{
+	return fsync(td->fd);
+}
+
+#ifdef FIO_HAVE_LIBAIO
+
+#define ev_to_iou(ev)	(struct io_u *) ((unsigned long) (ev)->obj)
+
 struct libaio_data {
 	io_context_t aio_ctx;
 	struct io_event *aio_events;
@@ -374,7 +375,7 @@
 	if ((unsigned int) ret != io_u->buflen) {
 		if (ret > 0) {
 			io_u->resid = io_u->buflen - ret;
-			io_u->error = ENODATA;
+			io_u->error = EIO;
 		} else
 			io_u->error = errno;
 	}