Chapter 5: ksyscall build issue
ayushman4 opened this issue · comments
The chapter says ctx
is available but it doesn't seem to be able to reference it. Also, any parameters added to BPF_KSYSCALL seems to throw an error.
make
clang \
-target bpf \
-D __TARGET_ARCH_x86 \
-Wall \
-O2 -g -o hello-buffer-config.bpf.o -c hello-buffer-config.bpf.c
hello-buffer-config.bpf.c:27:31: error: expected identifier
int BPF_KPROBE_SYSCALL(hello, const char *pathname)
^
hello-buffer-config.bpf.c:36:59: error: use of undeclared identifier 'pathname'
bpf_probe_read_user_str(&data.path, sizeof(data.path), pathname);
^
hello-buffer-config.bpf.c:45:26: error: use of undeclared identifier 'ctx'
bpf_perf_event_output(ctx, &output, BPF_F_CURRENT_CPU, &data, sizeof(data));
^
3 errors generated.
make: *** [Makefile:15: hello-buffer-config.bpf.o] Error 1
Hello, I am facing the same issues. If you have solved this problem, could you tell me how to solve this, thx!
Hello, I am facing the same issues. If you have solved this problem, could you tell me how to solve this, thx!
sudo apt install -t sid libbpf-dev
was suggested in #12 (comment)