diff --git a/userspace/libscap/settings.h b/userspace/libscap/settings.h index cbc0b5787e..d1a5cb77b1 100644 --- a/userspace/libscap/settings.h +++ b/userspace/libscap/settings.h @@ -4,4 +4,4 @@ // #define INCLUDE_UNKNOWN_SOCKET_FDS -#define USE_ZLIB +#undef USE_ZLIB diff --git a/userspace/libsinsp/sinsp.cpp b/userspace/libsinsp/sinsp.cpp index 3da4470710..cdd7a1d680 100644 --- a/userspace/libsinsp/sinsp.cpp +++ b/userspace/libsinsp/sinsp.cpp @@ -669,8 +669,27 @@ sinsp_threadinfo* sinsp::get_thread(int64_t tid, bool query_os_if_not_found, boo newti.m_exe = ""; newti.m_uid = 0xffffffff; newti.m_gid = 0xffffffff; + newti.m_nchilds = 0; } + // + // Since this thread is created out of thin air, we need to + // properly set its reference count, by scanning the table + // + threadinfo_map_t* pttable = &m_thread_manager->m_threadtable; + threadinfo_map_iterator_t it; + + for(it = pttable->begin(); it != pttable->end(); ++it) + { + if(it->second.m_pid == tid) + { + newti.m_nchilds++; + } + } + + // + // Done. Add the new thread to the list. + // m_thread_manager->add_thread(newti); sinsp_proc = m_thread_manager->get_thread(tid, lookup_only); } diff --git a/userspace/libsinsp/threadinfo.cpp b/userspace/libsinsp/threadinfo.cpp index 2390bb5924..d806f6637c 100644 --- a/userspace/libsinsp/threadinfo.cpp +++ b/userspace/libsinsp/threadinfo.cpp @@ -172,6 +172,7 @@ void sinsp_threadinfo::init(const scap_threadinfo* pi) m_vmswap_kb = pi->vmswap_kb; m_pfmajor = pi->pfmajor; m_pfminor = pi->pfminor; + m_nchilds = 0; HASH_ITER(hh, pi->fdlist, fdi, tfdi) {