summaryrefslogtreecommitdiffstats
path: root/lib/util/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util/compat.h')
-rw-r--r--lib/util/compat.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/util/compat.h b/lib/util/compat.h
new file mode 100644
index 0000000..f058e9c
--- /dev/null
+++ b/lib/util/compat.h
@@ -0,0 +1,12 @@
+#ifndef __COMPAT_H
+#define __COMPAT_H
+
+#ifndef HAVE_LIBBPF_BTF__TYPE_CNT
+static __u32 btf__type_cnt(const struct btf *btf)
+{
+ /* old function didn't include 'void' type in count */
+ return btf__get_nr_types(btf) + 1;
+}
+#endif
+
+#endif