libbpf-bootstrap icon indicating copy to clipboard operation
libbpf-bootstrap copied to clipboard

ksyscall example

Open grubeli opened this issue 3 years ago • 2 comments

Libbpf v1 introduced ksyscall option to trace syscalls, an example for the feature would be helpful

grubeli avatar Sep 04 '22 20:09 grubeli

There are a lot of test cases under tools/testing/selftests/bpf directory of Linux. You may want to check there for examples that you don't find here.

FYI https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/progs/test_probe_user.c

ThinkerYzu1 avatar Sep 23 '22 20:09 ThinkerYzu1

@ThinkerYzu1 yes, selftests can serve as an example, but having minimal self-contained and simple examples in libbpf-bootstrap is extremely helpful. I do agree that we should either add a separate ksyscall example or extend kprobe one to also show ksyscall one. So let's keep this issue for now until someone finds time to contribute such an example.

anakryiko avatar Sep 23 '22 22:09 anakryiko

we have ksyscall example now: https://github.com/libbpf/libbpf-bootstrap/blob/master/examples/c/ksyscall.bpf.c

anakryiko avatar Aug 26 '23 00:08 anakryiko