Merge branch 'filestat3' of https://github.com/kusumi/fio
[fio.git] / oslib / statx.c
diff --git a/oslib/statx.c b/oslib/statx.c
new file mode 100644 (file)
index 0000000..1ca81ad
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef CONFIG_HAVE_STATX
+#include "statx.h"
+
+#ifdef CONFIG_HAVE_STATX_SYSCALL
+#include <unistd.h>
+#include <sys/syscall.h>
+
+int statx(int dfd, const char *pathname, int flags, unsigned int mask,
+         struct statx *buffer)
+{
+       return syscall(__NR_statx, dfd, pathname, flags, mask, buffer);
+}
+#else
+#include <errno.h>
+
+int statx(int dfd, const char *pathname, int flags, unsigned int mask,
+         struct statx *buffer)
+{
+       errno = EINVAL;
+       return -1;
+}
+#endif
+#endif