diff --git a/src/cc/api/BPF.cc b/src/cc/api/BPF.cc index dfda5b7b808c..90467d1203d0 100644 --- a/src/cc/api/BPF.cc +++ b/src/cc/api/BPF.cc @@ -15,7 +15,6 @@ */ #include -#include #include #include #include @@ -417,8 +416,6 @@ StatusTuple BPF::open_perf_event(const std::string& name, name.c_str()); perf_event_arrays_[name] = new BPFPerfEventArray(it->second); } - if (type != PERF_TYPE_RAW && type != PERF_TYPE_HARDWARE) - return StatusTuple(-1, "open_perf_event unsupported type"); auto table = perf_event_arrays_[name]; TRY2(table->open_all_cpu(type, config)); return StatusTuple(0); diff --git a/src/cc/api/BPFTable.cc b/src/cc/api/BPFTable.cc index f936c704341f..d9c2164d63df 100644 --- a/src/cc/api/BPFTable.cc +++ b/src/cc/api/BPFTable.cc @@ -107,7 +107,7 @@ BPFStackTable::~BPFStackTable() { } void BPFStackTable::clear_table_non_atomic() { - for (int i = 0; i < capacity(); i++) { + for (int i = 0; size_t(i) < capacity(); i++) { remove(&i); } } diff --git a/src/cc/libbpf.c b/src/cc/libbpf.c index 5d40a70593e9..0752dbefd0f6 100644 --- a/src/cc/libbpf.c +++ b/src/cc/libbpf.c @@ -1054,7 +1054,8 @@ int bpf_attach_perf_event(int progfd, uint32_t ev_type, uint32_t ev_config, struct perf_event_attr attr = {}; attr.type = ev_type; attr.config = ev_config; - attr.inherit = 1; + if (pid > 0) + attr.inherit = 1; if (sample_freq > 0) { attr.freq = 1; attr.sample_freq = sample_freq;