First snapshot of FIO for Windows
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
diff --git a/fio.c b/fio.c
index 8dff813..2420d10 100644
--- a/fio.c
+++ b/fio.c
@@ -101,12 +101,12 @@
* if the thread is running, just let it exit
*/
if (td->runstate < TD_RUNNING)
- kill(td->pid, SIGQUIT);
+ kill(td->pid, SIGTERM);
else {
struct ioengine_ops *ops = td->io_ops;
- if (ops && (ops->flags & FIO_SIGQUIT))
- kill(td->pid, SIGQUIT);
+ if (ops && (ops->flags & FIO_SIGTERM))
+ kill(td->pid, SIGTERM);
}
}
}
@@ -161,8 +161,14 @@
evt.sigev_notify = SIGEV_THREAD;
evt.sigev_notify_function = ival_fn;
+#ifndef __CYGWIN__
if (timer_create(CLOCK_MONOTONIC, &evt, &ival_timer) < 0)
perror("timer_create");
+#else /* Windows (and thus Cygwin) doesn't have a monotonic clock */
+ if (timer_create(CLOCK_REALTIME, &evt, &ival_timer) < 0)
+ perror("timer_create");
+#endif
+
}
static void set_sig_handlers(void)
@@ -177,7 +183,7 @@
memset(&act, 0, sizeof(act));
act.sa_handler = sig_quit;
act.sa_flags = SA_RESTART;
- sigaction(SIGQUIT, &act, NULL);
+ sigaction(SIGTERM, &act, NULL);
}
/*
@@ -1352,7 +1358,7 @@
if (WIFSIGNALED(status)) {
int sig = WTERMSIG(status);
- if (sig != SIGQUIT)
+ if (sig != SIGTERM)
log_err("fio: pid=%d, got signal=%d\n",
(int) td->pid, sig);
td_set_runstate(td, TD_REAPED);
@@ -1703,7 +1709,11 @@
}
startup_mutex = fio_mutex_init(0);
+ if (startup_mutex == NULL)
+ return 1;
writeout_mutex = fio_mutex_init(1);
+ if (writeout_mutex == NULL)
+ return 1;
set_genesis_time();