From 6516fb0d00208f05b29f320176204957b02b23e3 Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Mon, 26 Jul 2021 12:05:57 +0200
Subject: [PATCH] Define KERNEL_VERSION
The libbpf version on RHEL9 doesn't define it.
---
libbpf-tools/biolatency.bpf.c | 2 ++
libbpf-tools/biosnoop.bpf.c | 2 ++
libbpf-tools/bitesize.bpf.c | 2 ++
3 files changed, 6 insertions(+)
diff --git a/libbpf-tools/biolatency.bpf.c b/libbpf-tools/biolatency.bpf.c
index 8d8fe584..8e6e81e2 100644
--- a/libbpf-tools/biolatency.bpf.c
+++ b/libbpf-tools/biolatency.bpf.c
@@ -9,6 +9,8 @@
#define MAX_ENTRIES 10240
+#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
+
extern int LINUX_KERNEL_VERSION __kconfig;
const volatile bool targ_per_disk = false;
diff --git a/libbpf-tools/biosnoop.bpf.c b/libbpf-tools/biosnoop.bpf.c
index 76697967..7b7cb1a4 100644
--- a/libbpf-tools/biosnoop.bpf.c
+++ b/libbpf-tools/biosnoop.bpf.c
@@ -11,6 +11,8 @@
const volatile bool targ_queued = false;
const volatile dev_t targ_dev = -1;
+#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
+
extern __u32 LINUX_KERNEL_VERSION __kconfig;
struct piddata {
diff --git a/libbpf-tools/bitesize.bpf.c b/libbpf-tools/bitesize.bpf.c
index 7b4d3f9d..5e7d9d97 100644
--- a/libbpf-tools/bitesize.bpf.c
+++ b/libbpf-tools/bitesize.bpf.c
@@ -10,6 +10,8 @@
const volatile char targ_comm[TASK_COMM_LEN] = {};
const volatile dev_t targ_dev = -1;
+#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
+
extern __u32 LINUX_KERNEL_VERSION __kconfig;
struct {
--
2.31.1