aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/compat
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-06-24 05:02:51 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-06-24 05:02:51 +0200
commit1bb9daf94b9344684d3d5f196b5c9240f8454916 (patch)
treed8a0c646891b21a179340253323e9aeaf1110878 /src/compat
parentglobal: use fast boottime instead of normal boottime (diff)
downloadwireguard-monolithic-historical-1bb9daf94b9344684d3d5f196b5c9240f8454916.tar.xz
wireguard-monolithic-historical-1bb9daf94b9344684d3d5f196b5c9240f8454916.zip
compat: more robust ktime backport
This is needed for frankenkernels, like android-common.
Diffstat (limited to 'src/compat')
-rw-r--r--src/compat/compat.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/compat/compat.h b/src/compat/compat.h
index d08557f..2c1b663 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -327,7 +327,7 @@ static inline int get_random_bytes_wait(void *buf, int nbytes)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) && !defined(ISRHEL7)
-#include <linux/ktime.h>
+#include <linux/hrtimer.h>
static inline u64 ktime_get_boot_ns(void)
{
return ktime_to_ns(ktime_get_boottime());
@@ -335,11 +335,16 @@ static inline u64 ktime_get_boot_ns(void)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
-#include <linux/ktime.h>
-static inline u64 ktime_get_boot_fast_ns(void)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
+#include <linux/hrtimer.h>
+#else
+#include <linux/timekeeping.h>
+#endif
+static inline u64 __wgcompat_ktime_get_boot_fast_ns(void)
{
return ktime_get_boot_ns();
}
+#define ktime_get_boot_fast_ns __wgcompat_ktime_get_boot_fast_ns
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)