From f7632c89ded6cb8a6608e9423096333217a43935 Mon Sep 17 00:00:00 2001 From: Jason Dellaluce Date: Wed, 21 Feb 2024 10:32:52 +0000 Subject: [PATCH] update(userspace/libsinsp): apply reviews suggestions Co-authored-by: Federico Di Pierro Co-authored-by: Mauro Ezequiel Moltrasio Signed-off-by: Jason Dellaluce --- userspace/libsinsp/container.h | 8 ++++++++ userspace/libsinsp/eventformatter.cpp | 6 +++--- userspace/libsinsp/eventformatter.h | 2 +- userspace/libsinsp/sinsp.h | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/userspace/libsinsp/container.h b/userspace/libsinsp/container.h index aa13e075320..18faef5e0dd 100644 --- a/userspace/libsinsp/container.h +++ b/userspace/libsinsp/container.h @@ -222,6 +222,14 @@ class sinsp_container_manager : return engine_lookup == container_lookups->second.end(); } + /** + * \brief get the list of container engines in the inspector + * + * @return a pointer to the list of container engines + */ + std::list>* get_container_engines() { + return &m_container_engines; + } uint64_t m_last_flush_time_ns; std::string container_to_json(const sinsp_container_info& container_info); diff --git a/userspace/libsinsp/eventformatter.cpp b/userspace/libsinsp/eventformatter.cpp index 0025c67e00c..97bfd9d7c4a 100644 --- a/userspace/libsinsp/eventformatter.cpp +++ b/userspace/libsinsp/eventformatter.cpp @@ -99,7 +99,7 @@ void sinsp_evt_formatter::set_format(output_format of, const std::string& fmt) auto newtkn = std::make_unique(lfmt.substr(last_nontoken_str_start, j - last_nontoken_str_start)); m_tokens.emplace_back(std::make_pair("", newtkn.get())); m_tokenlens.push_back(0); - m_chks_to_free.push_back(std::move(newtkn)); + m_checks.push_back(std::move(newtkn)); } if(j == lfmtlen - 1) @@ -156,7 +156,7 @@ void sinsp_evt_formatter::set_format(output_format of, const std::string& fmt) m_tokens.emplace_back(std::make_pair(std::string(fstart, fsize), chk.get())); m_tokenlens.push_back(toklen); - m_chks_to_free.push_back(std::move(chk)); + m_checks.push_back(std::move(chk)); last_nontoken_str_start = j + 1; } @@ -166,7 +166,7 @@ void sinsp_evt_formatter::set_format(output_format of, const std::string& fmt) { auto chk = std::make_unique(lfmt.substr(last_nontoken_str_start, j - last_nontoken_str_start)); m_tokens.emplace_back(std::make_pair("", chk.get())); - m_chks_to_free.emplace_back(std::move(chk)); + m_checks.emplace_back(std::move(chk)); m_tokenlens.push_back(0); } } diff --git a/userspace/libsinsp/eventformatter.h b/userspace/libsinsp/eventformatter.h index 49261fb2b67..e28d86b32ca 100644 --- a/userspace/libsinsp/eventformatter.h +++ b/userspace/libsinsp/eventformatter.h @@ -120,7 +120,7 @@ class SINSP_PUBLIC sinsp_evt_formatter sinsp* m_inspector; filter_check_list &m_available_checks; bool m_require_all_values; - std::vector> m_chks_to_free; + std::vector> m_checks; Json::Value m_root; Json::FastWriter m_writer; diff --git a/userspace/libsinsp/sinsp.h b/userspace/libsinsp/sinsp.h index d5f11d0dec5..eab132b1b78 100644 --- a/userspace/libsinsp/sinsp.h +++ b/userspace/libsinsp/sinsp.h @@ -857,7 +857,7 @@ class SINSP_PUBLIC sinsp : public capture_stats_source m_get_procs_cpu_from_driver = get_procs_cpu_from_driver; } - sinsp_parser* get_parser() + inline sinsp_parser* get_parser() { return m_parser.get(); }