ctx_.reset();
if (tables_) {
for (auto table : *tables_) {
- if (table.is_shared)
+ if (table.is_shared) {
SharedTables::instance()->remove_fd(table.name);
- else
+ } else if (!table.is_extern) {
close(table.fd);
+ }
}
}
}
++i;
}
- bool is_extern = false;
bpf_map_type map_type = BPF_MAP_TYPE_UNSPEC;
if (A->getName() == "maps/hash") {
map_type = BPF_MAP_TYPE_HASH;
} else if (A->getName() == "maps/stacktrace") {
map_type = BPF_MAP_TYPE_STACK_TRACE;
} else if (A->getName() == "maps/extern") {
- is_extern = true;
+ table.is_extern = true;
table.fd = SharedTables::instance()->lookup_fd(table.name);
table.type = SharedTables::instance()->lookup_type(table.name);
} else if (A->getName() == "maps/export") {
return true;
}
- if (!is_extern) {
+ if (!table.is_extern) {
if (map_type == BPF_MAP_TYPE_UNSPEC) {
error(Decl->getLocStart(), "unsupported map type: %0") << A->getName();
return false;