Skip to content

Commit

Permalink
refactor(userspace/libsinsp): make tid collision a property of the ob…
Browse files Browse the repository at this point in the history
…server

Signed-off-by: Jason Dellaluce <[email protected]>
  • Loading branch information
jasondellaluce authored and poiana committed Jan 22, 2024
1 parent b13c5f9 commit 31fc366
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
10 changes: 2 additions & 8 deletions userspace/libsinsp/parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ void sinsp_parser::parse_clone_exit_caller(sinsp_evt *evt, int64_t child_tid)
/* If there's a listener, invoke it */
if(m_inspector->get_observer())
{
m_inspector->get_observer()->on_clone(evt, child_tinfo);
m_inspector->get_observer()->on_clone(evt, child_tinfo, tid_collision);
}

/* If we had to erase a previous entry for this tid and rebalance the table,
Expand All @@ -1446,9 +1446,6 @@ void sinsp_parser::parse_clone_exit_caller(sinsp_evt *evt, int64_t child_tid)
if(tid_collision != -1)
{
reset(evt);
#ifdef HAS_ANALYZER
m_inspector->m_tid_collisions.push_back(tid_collision);
#endif
DBG_SINSP_INFO("tid collision for %" PRIu64 "(%s)",
tid_collision,
child_tinfo->m_comm.c_str());
Expand Down Expand Up @@ -1961,7 +1958,7 @@ void sinsp_parser::parse_clone_exit_child(sinsp_evt *evt)
//
if(m_inspector->get_observer())
{
m_inspector->get_observer()->on_clone(evt, child_tinfo);
m_inspector->get_observer()->on_clone(evt, child_tinfo, tid_collision);
}

/* If we had to erase a previous entry for this tid and rebalance the table,
Expand All @@ -1972,9 +1969,6 @@ void sinsp_parser::parse_clone_exit_child(sinsp_evt *evt)
if(tid_collision != -1)
{
reset(evt);
#ifdef HAS_ANALYZER
m_inspector->m_tid_collisions.push_back(tid_collision);
#endif
/* Right now we have collisions only on the clone() caller */
DBG_SINSP_INFO("tid collision for %" PRIu64 "(%s)", tid_collision, child_tinfo->m_comm.c_str());
}
Expand Down
2 changes: 0 additions & 2 deletions userspace/libsinsp/sinsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,6 @@ VISIBILITY_PRIVATE
std::string m_filterstring;
std::shared_ptr<libsinsp::filter::ast::expr> m_internal_flt_ast;

std::vector<uint64_t> m_tid_collisions;

//
// Saved snaplen
//
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/sinsp_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class sinsp_observer
virtual void on_erase_fd(erase_fd_params* params) = 0;
virtual void on_socket_shutdown(sinsp_evt *evt) = 0;
virtual void on_execve(sinsp_evt* evt) = 0;
virtual void on_clone(sinsp_evt* evt, sinsp_threadinfo* newtinfo) = 0;
virtual void on_clone(sinsp_evt* evt, sinsp_threadinfo* newtinfo, int64_t tid_collision) = 0;
virtual void on_bind(sinsp_evt* evt) = 0;
virtual bool on_resolve_container(sinsp_container_manager* manager, sinsp_threadinfo* tinfo, bool query_os_for_missing_info) = 0;
virtual void on_socket_status_changed(sinsp_evt *evt) = 0;
Expand Down

0 comments on commit 31fc366

Please sign in to comment.