summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-02-12 21:16:21 -0700
committerJens Axboe <axboe@kernel.dk>2020-02-12 21:16:21 -0700
commitd0a15ca057fa3d256fd36978728d9d6daedbd919 (patch)
treec0c35c64ff2ad566104071ad766aa3951439b144
parente50243577946e152fed91133f78dd79c1e5c1141 (diff)
downloadliburing-d0a15ca057fa3d256fd36978728d9d6daedbd919.tar.gz
liburing-d0a15ca057fa3d256fd36978728d9d6daedbd919.tar.bz2
Correctly handle if __kernel_timespec is defined
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rwxr-xr-xconfigure1
-rw-r--r--src/Makefile2
-rw-r--r--src/include/liburing.h7
-rw-r--r--src/include/liburing/compat.h9
-rw-r--r--test/Makefile2
5 files changed, 12 insertions, 9 deletions
diff --git a/configure b/configure
index 2fa393f..c6cfe8e 100755
--- a/configure
+++ b/configure
@@ -209,6 +209,7 @@ print_config "__kernel_rwf_t" "$__kernel_rwf_t"
__kernel_timespec="no"
cat > $TMPC << EOF
#include <linux/time.h>
+#include <linux/time_types.h>
int main(int argc, char **argv)
{
struct __kernel_timespec ts;
diff --git a/src/Makefile b/src/Makefile
index 5d13c09..0a1b198 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,7 +4,7 @@ libdir ?= $(prefix)/lib
libdevdir ?= $(prefix)/lib
CFLAGS ?= -g -fomit-frame-pointer -O2
-override CFLAGS += -Wall -Iinclude/
+override CFLAGS += -Wall -Iinclude/ -include ../config-host.h
SO_CFLAGS=-shared -fPIC $(CFLAGS)
L_CFLAGS=$(CFLAGS)
LINK_FLAGS=
diff --git a/src/include/liburing.h b/src/include/liburing.h
index 30bee7f..7cd8fb4 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -15,13 +15,6 @@ extern "C" {
#include "liburing/io_uring.h"
#include "liburing/barrier.h"
-#ifndef CONFIG_HAVE_KERNEL_TIMESPEC
-struct __kernel_timespec {
- int64_t tv_sec;
- long long tv_nsec;
-};
-#endif
-
#ifndef CONFIG_HAVE_OPEN_HOW
struct open_how {
uint64_t flags;
diff --git a/src/include/liburing/compat.h b/src/include/liburing/compat.h
index d10d7a8..7eaad41 100644
--- a/src/include/liburing/compat.h
+++ b/src/include/liburing/compat.h
@@ -6,4 +6,13 @@
typedef int __kernel_rwf_t;
#endif
+#if !defined(CONFIG_HAVE_KERNEL_TIMESPEC)
+struct __kernel_timespec {
+ int64_t tv_sec;
+ long long tv_nsec;
+};
+#else
+#include <linux/time_types.h>
+#endif
+
#endif
diff --git a/test/Makefile b/test/Makefile
index 4a0bb4e..cf91011 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -5,7 +5,7 @@ INSTALL=install
CFLAGS ?= -g -O2
XCFLAGS =
-override CFLAGS += -Wall -D_GNU_SOURCE -L../src/ -I../src/include/
+override CFLAGS += -Wall -D_GNU_SOURCE -L../src/ -I../src/include/ -include ../config-host.h
all_targets += poll poll-cancel ring-leak fsync io_uring_setup io_uring_register \
io_uring_enter nop sq-full cq-full 35fa71a030ca-test \