[DTrace-devel] [PATCH] bpf: be less picky about the content of bpf_helper_defs.h

Kris Van Hees kris.van.hees at oracle.com
Mon May 6 19:05:26 UTC 2024


There are small differences in the format of the BPF helper definitions
in bpf_helper_defs.h in libbpf headers.  This patch allows mkHelpers to
be more accepting of these differences.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 include/mkHelpers | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/mkHelpers b/include/mkHelpers
index 1a7537ca..dc5e62c8 100755
--- a/include/mkHelpers
+++ b/include/mkHelpers
@@ -8,14 +8,15 @@ BEGIN {
 }
 
 $1 == "static" && /=/ && /[ \t]+[1-9][0-9]*[ \t]*;/ {
-	match($0, /[ \t]+[1-9][0-9]*[ \t]*;/);
-	id = substr($0, RSTART, RLENGTH - 1);
-	gsub(/[ \t]+/,"", id);
-	match($0, /\([ \t]*\*[ \t]*bpf_[_A-Za-z0-9]+/);
-	fn = substr($0, RSTART + 1, RLENGTH - 1);
-	sub(/[ \t]*\*[ \t]*bpf_/, "", fn);
+	if (match($0, /[ \t\*]bpf_[_A-Za-z0-9]+/) > 0) {
+		fn = substr($0, RSTART + 5, RLENGTH - 5);
 
-	print "#define BPF_FUNC_"fn " " id;
+		match($0, /[ \t]+[1-9][0-9]*[ \t]*;/);
+		id = substr($0, RSTART, RLENGTH - 1);
+		gsub(/[ \t]+/,"", id);
+
+		print "#define BPF_FUNC_"fn " " id;
+	}
 }
 
 END {
-- 
2.42.0




More information about the DTrace-devel mailing list