Skip to content

Commit

Permalink
samples: bpf: Replace symbol compare of trace_event
Browse files Browse the repository at this point in the history
Previously, when this sample is added, commit 1c47910
("samples/bpf: add perf_event+bpf example"), a symbol 'sys_read' and
'sys_write' has been used without no prefixes. But currently there are
no exact symbols with these under kallsyms and this leads to failure.

This commit changes exact compare to substring compare to keep compatible
with exact symbol or prefixed symbol.

Fixes: 1c47910 ("samples/bpf: add perf_event+bpf example")
Signed-off-by: Daniel T. Lee <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
DanielTimLee authored and Alexei Starovoitov committed Dec 11, 2019
1 parent 7f193c2 commit bba1b2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/bpf/trace_event_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ static void print_ksym(__u64 addr)
}

printf("%s;", sym->name);
if (!strcmp(sym->name, "sys_read"))
if (!strstr(sym->name, "sys_read"))
sys_read_seen = true;
else if (!strcmp(sym->name, "sys_write"))
else if (!strstr(sym->name, "sys_write"))
sys_write_seen = true;
}

Expand Down

0 comments on commit bba1b2a

Please sign in to comment.