about summary refs log tree commit diff
path: root/pkgs/by-name/bp/bpftrace/runqlat-bt-no-includes.patch
blob: 659e4bc4bbfd9b2486c13880b26b691fd7f2c425 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From 9b5f22854297aabb924969c25af66461d8d2fcb9 Mon Sep 17 00:00:00 2001
From: Dominique Martinet <asmadeus@codewreck.org>
Date: Fri, 21 Jun 2024 21:02:09 +0900
Subject: [PATCH] tools/runqlat: provide TASK_RUNNING as a define

runqlat requires kernel headers to run even with BTF, just because of a
define.
TASK_RUNNING isn't part of the stable API but it's never changed in all
of the linux git history so let's pretend it's stable and just define
it.

If we find a way to handle kheaders again in the future we might want to
consider reverting this.

Fixes: #3255
(cherry picked from commit aa041d9d85f9ec11235c39fdcb5833412ec27083)
---
 tools/runqlat.bt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/runqlat.bt b/tools/runqlat.bt
index 3d71b76062eb..1298f399aee7 100755
--- a/tools/runqlat.bt
+++ b/tools/runqlat.bt
@@ -11,7 +11,17 @@
  * 17-Sep-2018	Brendan Gregg	Created this.
  */
 
+#ifndef BPFTRACE_HAVE_BTF
 #include <linux/sched.h>
+#else
+/*
+ * With BTF providing types, full headers are not needed.
+ * We only need to supply the preprocessor defines used in this script.
+ * TASK_RUNNING is not arch-dependant and has not changed in the linux
+ * git history (it is not part of the stable API though)
+ */
+#define TASK_RUNNING 0
+#endif
 
 BEGIN
 {
-- 
2.45.2