linux-headers needed fot bpf init

This commit is contained in:
springzfx
2020-05-30 02:02:03 +08:00
parent 34e5d81329
commit a1a1ed5bd9

View File

@@ -60,15 +60,11 @@ void handle_events(void *cb_cookie, void *data, int data_size) {
int execsnoop() {
debug("starting execsnoop");
ebpf::BPF bpf;
try {
auto init_res = bpf.init(BPF_PROGRAM);
if (init_res.code() != 0) {
std::cerr << init_res.msg() << std::endl;
return 1;
}
} catch (exception &e) {
error("bpf init failed, maybe linux-headers not installed: %s", e.what());
auto init_res = bpf.init(BPF_PROGRAM);
if (init_res.code() != 0) {
error("bpf init failed, maybe linux-headers not installed");
std::cerr << init_res.msg() << std::endl;
return 1;
}