Move os/arch/compiler headers into directories
[fio.git] / engines / syslet-rw.c
index a293e7f4715d415622f50b971ac1012a513ec9a2..7e407d785bfbcbb73125214d48e88d1bbd679c9f 100644 (file)
@@ -13,7 +13,6 @@
 #include <asm/unistd.h>
 
 #include "../fio.h"
-#include "../os.h"
 
 #ifdef FIO_HAVE_SYSLET
 
@@ -237,6 +236,11 @@ static int fio_syslet_commit(struct thread_data *td)
         */
        done = async_exec(sd->head, &sd->ahu);
 
+       if (done == (void *) -1) {
+               log_err("fio: syslets don't appear to work\n");
+               return -1;
+       }
+
        sd->head = sd->tail = NULL;
 
        if (done)
@@ -284,6 +288,19 @@ static void async_head_exit(struct syslet_data *sd)
        free(sd->ring);
 }
 
+static int check_syslet_support(struct syslet_data *sd)
+{
+       struct syslet_uatom atom;
+       void *ret;
+
+       init_atom(&atom, __NR_getpid, NULL, NULL, NULL, NULL, NULL, 0, NULL);
+       ret = async_exec(sd->head, &sd->ahu);
+       if (ret == (void *) -1)
+               return 1;
+
+       return 0;
+}
+
 static void fio_syslet_cleanup(struct thread_data *td)
 {
        struct syslet_data *sd = td->io_ops->data;
@@ -300,7 +317,6 @@ static int fio_syslet_init(struct thread_data *td)
 {
        struct syslet_data *sd;
 
-
        sd = malloc(sizeof(*sd));
        memset(sd, 0, sizeof(*sd));
        sd->events = malloc(sizeof(struct io_u *) * td->o.iodepth);
@@ -315,6 +331,13 @@ static int fio_syslet_init(struct thread_data *td)
                return 1;
        }
 
+       if (check_syslet_support(sd)) {
+               log_err("fio: syslets do not appear to work\n");
+               free(sd->events);
+               free(sd);
+               return 1;
+       }
+
        td->io_ops->data = sd;
        return 0;
 }