[PATCH] Make the exit value meaningfull
authorJens Axboe <jens.axboe@oracle.com>
Tue, 13 Feb 2007 17:20:37 +0000 (18:20 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 13 Feb 2007 17:20:37 +0000 (18:20 +0100)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c
fio.h

diff --git a/fio.c b/fio.c
index ace8c5ee09aae9e4353d9879273eaadbe1c2848d..61fd098958704473113dfa5cb6a76c795ce7f8a7 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -47,6 +47,7 @@ int temp_stall_ts;
 
 static volatile int startup_sem;
 static volatile int fio_abort;
+static int exit_value;
 
 struct io_log *agg_io_log[2];
 
@@ -811,6 +812,9 @@ static void reap_threads(int *nr_running, int *t_rate, int *m_rate)
                        continue;
                }
 
+               if (td->error)
+                       exit_value++;
+
                td_set_runstate(td, TD_REAPED);
 
                if (td->use_thread) {
@@ -1045,5 +1049,5 @@ int main(int argc, char *argv[])
                }
        }
 
-       return 0;
+       return exit_value;
 }
diff --git a/fio.h b/fio.h
index c0b92a6c6671b3afda65b5fca4499dd6eea71b6c..c15232a214e6919cfae4e43b0ef452c8d5e52cc9 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -674,6 +674,7 @@ extern void close_ioengine(struct thread_data *);
        if (!(cond)) {                  \
                fprintf(stderr, "file:%s:%d, assert %s failed\n", __FILE__, __LINE__, #cond);   \
                (td)->runstate = TD_EXITED;     \
+               (td)->error = EFAULT;           \
                exit(0);                        \
        }       \
 } while (0)