Skip to content

Commit

Permalink
delete public and shared tables
Browse files Browse the repository at this point in the history
Public and shared tables are deleted when the ebpf program that created
them is deleted.  If other programs are using such table, it remains
until it is deleted.

Signed-off-by: Mauricio Vasquez B <mauriciovasquezbernal@gmail.com>
  • Loading branch information
mauriciovasquezbernal authored and FedeParola committed Apr 26, 2021
1 parent 0ed6619 commit c2a3bf6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cc/bpf_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,16 @@ BPFModule::~BPFModule() {

if (btf_)
delete btf_;
auto it = ts_->lower_bound(Path({id_}));
while (it != ts_->upper_bound(Path({id_}))) {
// try to delete public and shared tables that are mine
if (it->second.is_shared && !it->second.is_extern) {
ts_->Delete(Path({maps_ns_, it->second.name}));
}
it++;
}

// delete all local tables
ts_->DeletePrefix(Path({id_}));
}

Expand Down

0 comments on commit c2a3bf6

Please sign in to comment.