bcc: Allow KFUNC_PROBE to instrument function without arguments
authorHengqi Chen <chenhengqi@outlook.com>
Sun, 17 Oct 2021 15:50:09 +0000 (23:50 +0800)
committerHengqi Chen <chenhengqi@outlook.com>
Sun, 17 Oct 2021 15:50:09 +0000 (23:50 +0800)
Update KFUNC_PROBE and its family to allow instrument kernel
function without specifying arguments. Sometimes, we don't need
to bookkeep arguments at function entry, just store a timestamp.
This fix would allow this use case.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
src/cc/export/helpers.h

index cd477d6982f0a98691ef1ed5aadb67528d773fbe..5314bca019d12b863f4f957016804a076467355b 100644 (file)
@@ -1309,16 +1309,16 @@ int name(unsigned long long *ctx)                               \
 static int ____##name(unsigned long long *ctx, ##args)
 
 #define KFUNC_PROBE(event, args...) \
-        BPF_PROG(kfunc__ ## event, args)
+        BPF_PROG(kfunc__ ## event, ##args)
 
 #define KRETFUNC_PROBE(event, args...) \
-        BPF_PROG(kretfunc__ ## event, args)
+        BPF_PROG(kretfunc__ ## event, ##args)
 
 #define KMOD_RET(event, args...) \
-        BPF_PROG(kmod_ret__ ## event, args)
+        BPF_PROG(kmod_ret__ ## event, ##args)
 
 #define LSM_PROBE(event, args...) \
-        BPF_PROG(lsm__ ## event, args)
+        BPF_PROG(lsm__ ## event, ##args)
 
 #define BPF_ITER(target) \
         int bpf_iter__ ## target (struct bpf_iter__ ## target *ctx)