Skip to content

Commit

Permalink
Merge pull request iovisor#3665 from chenhengqi/dev/kfunc-no-args
Browse files Browse the repository at this point in the history
bcc: Allow KFUNC_PROBE to instrument function without arguments
  • Loading branch information
davemarchevsky authored Oct 18, 2021
2 parents d1afbf6 + b271b8a commit 1b0eec2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/cc/export/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tools/readahead.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"""

bpf_text_kfunc = """
KFUNC_PROBE(RA_FUNC, void *unused)
KFUNC_PROBE(RA_FUNC)
{
u32 pid = bpf_get_current_pid_tgid();
u8 one = 1;
Expand All @@ -102,7 +102,7 @@
return 0;
}
KRETFUNC_PROBE(RA_FUNC, void *unused)
KRETFUNC_PROBE(RA_FUNC)
{
u32 pid = bpf_get_current_pid_tgid();
u8 zero = 0;
Expand Down
10 changes: 5 additions & 5 deletions tools/vfsstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ def usage():
"""

bpf_text_kfunc = """
KFUNC_PROBE(vfs_read, int unused) { stats_increment(S_READ); return 0; }
KFUNC_PROBE(vfs_write, int unused) { stats_increment(S_WRITE); return 0; }
KFUNC_PROBE(vfs_fsync, int unused) { stats_increment(S_FSYNC); return 0; }
KFUNC_PROBE(vfs_open, int unused) { stats_increment(S_OPEN); return 0; }
KFUNC_PROBE(vfs_create, int unused) { stats_increment(S_CREATE); return 0; }
KFUNC_PROBE(vfs_read) { stats_increment(S_READ); return 0; }
KFUNC_PROBE(vfs_write) { stats_increment(S_WRITE); return 0; }
KFUNC_PROBE(vfs_fsync) { stats_increment(S_FSYNC); return 0; }
KFUNC_PROBE(vfs_open) { stats_increment(S_OPEN); return 0; }
KFUNC_PROBE(vfs_create) { stats_increment(S_CREATE); return 0; }
"""

is_support_kfunc = BPF.support_kfunc()
Expand Down

0 comments on commit 1b0eec2

Please sign in to comment.