diff options
author | Daniel T. Lee <danieltimlee@gmail.com> | 2020-11-24 09:03:06 +0000 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2020-11-26 19:33:35 -0800 |
commit | 4fe6641526dbee115d9d037e94a344f4f448aaa4 (patch) | |
tree | b96f1888c4586c54e1e5c9f17ccce26496d75966 /samples/bpf/task_fd_query_kern.c | |
parent | d89af13c92056c46dfc4bcb3d90efe88937c3381 (diff) |
samples: bpf: Refactor task_fd_query program with libbpf
This commit refactors the existing kprobe program with libbpf bpf
loader. To attach bpf program, this uses generic bpf_program__attach()
approach rather than using bpf_load's load_bpf_file().
To attach bpf to perf_event, instead of using previous ioctl method,
this commit uses bpf_program__attach_perf_event since it manages the
enable of perf_event and attach of BPF programs to it, which is much
more intuitive way to achieve.
Also, explicit close(fd) has been removed since event will be closed
inside bpf_link__destroy() automatically.
Furthermore, to prevent conflict of same named uprobe events, O_TRUNC
flag has been used to clear 'uprobe_events' interface.
Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20201124090310.24374-4-danieltimlee@gmail.com
Diffstat (limited to 'samples/bpf/task_fd_query_kern.c')
0 files changed, 0 insertions, 0 deletions