Commit 489c716c authored by Alastair Robertson's avatar Alastair Robertson

Fix build after BCC update. Add name arguments to bpf_prog_load and bpf_create_map.

parent 0f0c8317
...@@ -161,7 +161,7 @@ void AttachedProbe::load_prog() ...@@ -161,7 +161,7 @@ void AttachedProbe::load_prog()
char *log_buf = nullptr; char *log_buf = nullptr;
unsigned log_buf_size = 0; unsigned log_buf_size = 0;
progfd_ = bpf_prog_load(progtype(probe_.type), progfd_ = bpf_prog_load(progtype(probe_.type), probe_.name.c_str(),
reinterpret_cast<struct bpf_insn*>(insns), prog_len, reinterpret_cast<struct bpf_insn*>(insns), prog_len,
license, kern_version, log_buf, log_buf_size); license, kern_version, log_buf, log_buf_size);
......
...@@ -29,7 +29,7 @@ Map::Map(const std::string &name, const SizedType &type, const MapKey &key) ...@@ -29,7 +29,7 @@ Map::Map(const std::string &name, const SizedType &type, const MapKey &key)
int value_size = type.size; int value_size = type.size;
int max_entries = 128; int max_entries = 128;
int flags = 0; int flags = 0;
mapfd_ = bpf_create_map(map_type, key_size, value_size, max_entries, flags); mapfd_ = bpf_create_map(map_type, name.c_str(), key_size, value_size, max_entries, flags);
if (mapfd_ < 0) if (mapfd_ < 0)
{ {
std::cerr << "Error creating map: '" << name_ << "'" << std::endl; std::cerr << "Error creating map: '" << name_ << "'" << std::endl;
...@@ -40,8 +40,10 @@ Map::Map(enum bpf_map_type map_type) ...@@ -40,8 +40,10 @@ Map::Map(enum bpf_map_type map_type)
{ {
int key_size, value_size, max_entries, flags; int key_size, value_size, max_entries, flags;
std::string name;
if (map_type == BPF_MAP_TYPE_STACK_TRACE) if (map_type == BPF_MAP_TYPE_STACK_TRACE)
{ {
name = "stack";
key_size = 4; key_size = 4;
value_size = sizeof(uintptr_t) * MAX_STACK_SIZE; value_size = sizeof(uintptr_t) * MAX_STACK_SIZE;
max_entries = 128; max_entries = 128;
...@@ -50,6 +52,7 @@ Map::Map(enum bpf_map_type map_type) ...@@ -50,6 +52,7 @@ Map::Map(enum bpf_map_type map_type)
else if (map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY) else if (map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY)
{ {
std::vector<int> cpus = ebpf::get_online_cpus(); std::vector<int> cpus = ebpf::get_online_cpus();
name = "printf";
key_size = 4; key_size = 4;
value_size = 4; value_size = 4;
max_entries = cpus.size(); max_entries = cpus.size();
...@@ -59,7 +62,7 @@ Map::Map(enum bpf_map_type map_type) ...@@ -59,7 +62,7 @@ Map::Map(enum bpf_map_type map_type)
{ {
abort(); abort();
} }
mapfd_ = bpf_create_map(map_type, key_size, value_size, max_entries, flags); mapfd_ = bpf_create_map(map_type, name.c_str(), key_size, value_size, max_entries, flags);
if (mapfd_ < 0) if (mapfd_ < 0)
{ {
std::string name; std::string name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment