Commit 6408d5a5 authored by Alastair Robertson's avatar Alastair Robertson

Give better error messages when unable to create special maps

parent ffd0a79c
...@@ -53,7 +53,20 @@ Map::Map(enum bpf_map_type map_type) ...@@ -53,7 +53,20 @@ Map::Map(enum bpf_map_type map_type)
mapfd_ = bpf_create_map(map_type, key_size, value_size, max_entries, flags); mapfd_ = bpf_create_map(map_type, key_size, value_size, max_entries, flags);
if (mapfd_ < 0) if (mapfd_ < 0)
{ {
std::cerr << "Error creating map: '" << name_ << "' (" << mapfd_ << ")" << std::endl; std::string name;
switch (map_type)
{
case BPF_MAP_TYPE_STACK_TRACE:
name = "stack id";
break;
case BPF_MAP_TYPE_PERF_EVENT_ARRAY:
name = "perf event";
break;
default:
abort();
}
std::cerr << "Error creating " << name << " map (" << mapfd_ << ")" << std::endl;
} }
} }
......
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