Skip to content

Commit

Permalink
new(libsinsp): add api for clean suppress comms and tids
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
  • Loading branch information
therealbobo committed Apr 2, 2024
1 parent 10b8139 commit 3bbae8d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
10 changes: 10 additions & 0 deletions userspace/libsinsp/sinsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,16 @@ bool sinsp::suppress_events_tid(int64_t tid)
return true;
}

void sinsp::clear_suppress_events_comm()
{
m_suppress.clear_suppress_comm();
}

void sinsp::clear_suppress_events_tid()
{
m_suppress.clear_suppress_tid();
}

bool sinsp::check_suppressed(int64_t tid) const
{
return m_suppress.is_suppressed_tid(tid);
Expand Down
4 changes: 4 additions & 0 deletions userspace/libsinsp/sinsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,10 @@ class SINSP_PUBLIC sinsp : public capture_stats_source

bool suppress_events_tid(int64_t tid);

void clear_suppress_events_comm();

void clear_suppress_events_tid();

bool check_suppressed(int64_t tid) const;

void set_docker_socket_path(std::string socket_path);
Expand Down
10 changes: 10 additions & 0 deletions userspace/libsinsp/sinsp_suppress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ void libsinsp::sinsp_suppress::suppress_tid(uint64_t tid)
m_suppressed_tids.emplace(tid);
}

void libsinsp::sinsp_suppress::clear_suppress_comm()
{
m_suppressed_comms.clear();
}

void libsinsp::sinsp_suppress::clear_suppress_tid()
{
m_suppressed_tids.clear();
}

bool libsinsp::sinsp_suppress::check_suppressed_comm(uint64_t tid, const std::string &comm)
{
if(m_suppressed_comms.find(comm) != m_suppressed_comms.end())
Expand Down
6 changes: 5 additions & 1 deletion userspace/libsinsp/sinsp_suppress.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class sinsp_suppress

void suppress_tid(uint64_t tid);

void clear_suppress_comm();

void clear_suppress_tid();

bool check_suppressed_comm(uint64_t tid, const std::string& comm);

int32_t process_event(scap_evt* e);
Expand All @@ -53,4 +57,4 @@ class sinsp_suppress
uint64_t m_num_suppressed_events = 0;
};

}
}

0 comments on commit 3bbae8d

Please sign in to comment.