Auto limit open files if we get EMFILE

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.h b/fio.h
index 1b8a66d..76d7ea4 100644
--- a/fio.h
+++ b/fio.h
@@ -865,4 +865,10 @@
 	}	\
 } while (0)
 
+static inline void clear_error(struct thread_data *td)
+{
+	td->error = 0;
+	td->verror[0] = '\0';
+}
+
 #endif