cleanup: fix several warnings from a Clang build

Signed-off-by: Federico Aponte <federico.aponte@sysdig.com>
This commit is contained in:
Federico Aponte 2023-12-06 00:16:28 +01:00 committed by poiana
parent 13991f1ea7
commit 44b7352180
19 changed files with 93 additions and 172 deletions

View File

@ -37,17 +37,17 @@ TEST(MacroResolver, should_resolve_macros_on_a_filter_AST)
{ {
libsinsp::filter::ast::pos_info macro_pos(12, 85, 27); libsinsp::filter::ast::pos_info macro_pos(12, 85, 27);
std::shared_ptr<libsinsp::filter::ast::expr> macro = std::move(libsinsp::filter::ast::unary_check_expr::create("test.field", "", "exists")); std::shared_ptr<libsinsp::filter::ast::expr> macro = libsinsp::filter::ast::unary_check_expr::create("test.field", "", "exists");
std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> filter_and; std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> filter_and;
filter_and.push_back(libsinsp::filter::ast::unary_check_expr::create("evt.name", "", "exists")); filter_and.push_back(libsinsp::filter::ast::unary_check_expr::create("evt.name", "", "exists"));
filter_and.push_back(libsinsp::filter::ast::not_expr::create(libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos))); filter_and.push_back(libsinsp::filter::ast::not_expr::create(libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos)));
std::shared_ptr<libsinsp::filter::ast::expr> filter = std::move(libsinsp::filter::ast::and_expr::create(filter_and)); std::shared_ptr<libsinsp::filter::ast::expr> filter = libsinsp::filter::ast::and_expr::create(filter_and);
std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> expected_and; std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> expected_and;
expected_and.push_back(libsinsp::filter::ast::unary_check_expr::create("evt.name", "", "exists")); expected_and.push_back(libsinsp::filter::ast::unary_check_expr::create("evt.name", "", "exists"));
expected_and.push_back(libsinsp::filter::ast::not_expr::create(clone(macro.get()))); expected_and.push_back(libsinsp::filter::ast::not_expr::create(clone(macro.get())));
std::shared_ptr<libsinsp::filter::ast::expr> expected = std::move(libsinsp::filter::ast::and_expr::create(expected_and)); std::shared_ptr<libsinsp::filter::ast::expr> expected = libsinsp::filter::ast::and_expr::create(expected_and);
filter_macro_resolver resolver; filter_macro_resolver resolver;
resolver.set_macro(MACRO_NAME, macro); resolver.set_macro(MACRO_NAME, macro);
@ -71,9 +71,9 @@ TEST(MacroResolver, should_resolve_macros_on_a_filter_AST_single_node)
{ {
libsinsp::filter::ast::pos_info macro_pos(12, 85, 27); libsinsp::filter::ast::pos_info macro_pos(12, 85, 27);
std::shared_ptr<libsinsp::filter::ast::expr> macro = std::move(libsinsp::filter::ast::unary_check_expr::create("test.field", "", "exists")); std::shared_ptr<libsinsp::filter::ast::expr> macro = libsinsp::filter::ast::unary_check_expr::create("test.field", "", "exists");
std::shared_ptr<libsinsp::filter::ast::expr> filter = std::move(libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos)); std::shared_ptr<libsinsp::filter::ast::expr> filter = libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos);
filter_macro_resolver resolver; filter_macro_resolver resolver;
resolver.set_macro(MACRO_NAME, macro); resolver.set_macro(MACRO_NAME, macro);
@ -102,18 +102,18 @@ TEST(MacroResolver, should_resolve_macros_on_a_filter_AST_multiple_macros)
libsinsp::filter::ast::pos_info a_macro_pos(11, 75, 43); libsinsp::filter::ast::pos_info a_macro_pos(11, 75, 43);
libsinsp::filter::ast::pos_info b_macro_pos(91, 21, 9); libsinsp::filter::ast::pos_info b_macro_pos(91, 21, 9);
std::shared_ptr<libsinsp::filter::ast::expr> a_macro = std::move(libsinsp::filter::ast::unary_check_expr::create("one.field", "", "exists")); std::shared_ptr<libsinsp::filter::ast::expr> a_macro = libsinsp::filter::ast::unary_check_expr::create("one.field", "", "exists");
std::shared_ptr<libsinsp::filter::ast::expr> b_macro = std::move(libsinsp::filter::ast::unary_check_expr::create("another.field", "", "exists")); std::shared_ptr<libsinsp::filter::ast::expr> b_macro = libsinsp::filter::ast::unary_check_expr::create("another.field", "", "exists");
std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> filter_or; std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> filter_or;
filter_or.push_back(libsinsp::filter::ast::value_expr::create(MACRO_A_NAME, a_macro_pos)); filter_or.push_back(libsinsp::filter::ast::value_expr::create(MACRO_A_NAME, a_macro_pos));
filter_or.push_back(libsinsp::filter::ast::value_expr::create(MACRO_B_NAME, b_macro_pos)); filter_or.push_back(libsinsp::filter::ast::value_expr::create(MACRO_B_NAME, b_macro_pos));
std::shared_ptr<libsinsp::filter::ast::expr> filter = std::move(libsinsp::filter::ast::or_expr::create(filter_or)); std::shared_ptr<libsinsp::filter::ast::expr> filter = libsinsp::filter::ast::or_expr::create(filter_or);
std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> expected_or; std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> expected_or;
expected_or.push_back(clone(a_macro.get())); expected_or.push_back(clone(a_macro.get()));
expected_or.push_back(clone(b_macro.get())); expected_or.push_back(clone(b_macro.get()));
std::shared_ptr<libsinsp::filter::ast::expr> expected_filter = std::move(libsinsp::filter::ast::or_expr::create(expected_or)); std::shared_ptr<libsinsp::filter::ast::expr> expected_filter = libsinsp::filter::ast::or_expr::create(expected_or);
filter_macro_resolver resolver; filter_macro_resolver resolver;
resolver.set_macro(MACRO_A_NAME, a_macro); resolver.set_macro(MACRO_A_NAME, a_macro);
@ -149,17 +149,17 @@ TEST(MacroResolver, should_resolve_macros_on_a_filter_AST_nested_macros)
std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> a_macro_and; std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> a_macro_and;
a_macro_and.push_back(libsinsp::filter::ast::unary_check_expr::create("one.field", "", "exists")); a_macro_and.push_back(libsinsp::filter::ast::unary_check_expr::create("one.field", "", "exists"));
a_macro_and.push_back(libsinsp::filter::ast::value_expr::create(MACRO_B_NAME, b_macro_pos)); a_macro_and.push_back(libsinsp::filter::ast::value_expr::create(MACRO_B_NAME, b_macro_pos));
std::shared_ptr<libsinsp::filter::ast::expr> a_macro = std::move(libsinsp::filter::ast::and_expr::create(a_macro_and)); std::shared_ptr<libsinsp::filter::ast::expr> a_macro = libsinsp::filter::ast::and_expr::create(a_macro_and);
std::shared_ptr<libsinsp::filter::ast::expr> b_macro = std::move( std::shared_ptr<libsinsp::filter::ast::expr> b_macro =
libsinsp::filter::ast::unary_check_expr::create("another.field", "", "exists")); libsinsp::filter::ast::unary_check_expr::create("another.field", "", "exists");
std::shared_ptr<libsinsp::filter::ast::expr> filter = std::move(libsinsp::filter::ast::value_expr::create(MACRO_A_NAME, a_macro_pos)); std::shared_ptr<libsinsp::filter::ast::expr> filter = libsinsp::filter::ast::value_expr::create(MACRO_A_NAME, a_macro_pos);
std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> expected_and; std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> expected_and;
expected_and.push_back(libsinsp::filter::ast::unary_check_expr::create("one.field", "", "exists")); expected_and.push_back(libsinsp::filter::ast::unary_check_expr::create("one.field", "", "exists"));
expected_and.push_back(libsinsp::filter::ast::unary_check_expr::create("another.field", "", "exists")); expected_and.push_back(libsinsp::filter::ast::unary_check_expr::create("another.field", "", "exists"));
std::shared_ptr<libsinsp::filter::ast::expr> expected_filter = std::move(libsinsp::filter::ast::and_expr::create(expected_and)); std::shared_ptr<libsinsp::filter::ast::expr> expected_filter = libsinsp::filter::ast::and_expr::create(expected_and);
filter_macro_resolver resolver; filter_macro_resolver resolver;
resolver.set_macro(MACRO_A_NAME, a_macro); resolver.set_macro(MACRO_A_NAME, a_macro);
@ -196,7 +196,7 @@ TEST(MacroResolver, should_find_unknown_macros)
std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> filter_and; std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> filter_and;
filter_and.push_back(libsinsp::filter::ast::unary_check_expr::create("evt.name", "", "exists")); filter_and.push_back(libsinsp::filter::ast::unary_check_expr::create("evt.name", "", "exists"));
filter_and.push_back(libsinsp::filter::ast::not_expr::create(libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos))); filter_and.push_back(libsinsp::filter::ast::not_expr::create(libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos)));
std::shared_ptr<libsinsp::filter::ast::expr> filter = std::move(libsinsp::filter::ast::and_expr::create(filter_and)); std::shared_ptr<libsinsp::filter::ast::expr> filter = libsinsp::filter::ast::and_expr::create(filter_and);
filter_macro_resolver resolver; filter_macro_resolver resolver;
ASSERT_FALSE(resolver.run(filter)); ASSERT_FALSE(resolver.run(filter));
@ -214,9 +214,9 @@ TEST(MacroResolver, should_find_unknown_nested_macros)
std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> a_macro_and; std::vector<std::unique_ptr<libsinsp::filter::ast::expr>> a_macro_and;
a_macro_and.push_back(libsinsp::filter::ast::unary_check_expr::create("one.field", "", "exists")); a_macro_and.push_back(libsinsp::filter::ast::unary_check_expr::create("one.field", "", "exists"));
a_macro_and.push_back(libsinsp::filter::ast::value_expr::create(MACRO_B_NAME, b_macro_pos)); a_macro_and.push_back(libsinsp::filter::ast::value_expr::create(MACRO_B_NAME, b_macro_pos));
std::shared_ptr<libsinsp::filter::ast::expr> a_macro = std::move(libsinsp::filter::ast::and_expr::create(a_macro_and)); std::shared_ptr<libsinsp::filter::ast::expr> a_macro = libsinsp::filter::ast::and_expr::create(a_macro_and);
std::shared_ptr<libsinsp::filter::ast::expr> filter = std::move(libsinsp::filter::ast::value_expr::create(MACRO_A_NAME, a_macro_pos)); std::shared_ptr<libsinsp::filter::ast::expr> filter = libsinsp::filter::ast::value_expr::create(MACRO_A_NAME, a_macro_pos);
auto expected_filter = clone(a_macro.get()); auto expected_filter = clone(a_macro.get());
filter_macro_resolver resolver; filter_macro_resolver resolver;
@ -237,9 +237,9 @@ TEST(MacroResolver, should_undefine_macro)
libsinsp::filter::ast::pos_info macro_pos_1(12, 9, 3); libsinsp::filter::ast::pos_info macro_pos_1(12, 9, 3);
libsinsp::filter::ast::pos_info macro_pos_2(9, 6, 3); libsinsp::filter::ast::pos_info macro_pos_2(9, 6, 3);
std::shared_ptr<libsinsp::filter::ast::expr> macro = std::move(libsinsp::filter::ast::unary_check_expr::create("test.field", "", "exists")); std::shared_ptr<libsinsp::filter::ast::expr> macro = libsinsp::filter::ast::unary_check_expr::create("test.field", "", "exists");
std::shared_ptr<libsinsp::filter::ast::expr> a_filter = std::move(libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos_1)); std::shared_ptr<libsinsp::filter::ast::expr> a_filter = libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos_1);
std::shared_ptr<libsinsp::filter::ast::expr> b_filter = std::move(libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos_2)); std::shared_ptr<libsinsp::filter::ast::expr> b_filter = libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos_2);
filter_macro_resolver resolver; filter_macro_resolver resolver;
resolver.set_macro(MACRO_NAME, macro); resolver.set_macro(MACRO_NAME, macro);
@ -262,8 +262,8 @@ TEST(MacroResolver, should_undefine_macro)
TEST(MacroResolver, should_clone_macro_AST) TEST(MacroResolver, should_clone_macro_AST)
{ {
libsinsp::filter::ast::pos_info macro_pos(5, 2, 8888); libsinsp::filter::ast::pos_info macro_pos(5, 2, 8888);
std::shared_ptr<libsinsp::filter::ast::unary_check_expr> macro = std::move(libsinsp::filter::ast::unary_check_expr::create("test.field", "", "exists")); std::shared_ptr<libsinsp::filter::ast::unary_check_expr> macro = libsinsp::filter::ast::unary_check_expr::create("test.field", "", "exists");
std::shared_ptr<libsinsp::filter::ast::expr> filter = std::move(libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos)); std::shared_ptr<libsinsp::filter::ast::expr> filter = libsinsp::filter::ast::value_expr::create(MACRO_NAME, macro_pos);
filter_macro_resolver resolver; filter_macro_resolver resolver;
resolver.set_macro(MACRO_NAME, macro); resolver.set_macro(MACRO_NAME, macro);

View File

@ -619,12 +619,12 @@ void falco_engine::get_json_details(
// Fill general rule information // Fill general rule information
rule_info["name"] = r.name; rule_info["name"] = r.name;
rule_info["condition"] = info.cond; rule_info["condition"] = info.cond;
rule_info["priority"] = std::move(format_priority(r.priority, false)); rule_info["priority"] = format_priority(r.priority, false);
rule_info["output"] = info.output; rule_info["output"] = info.output;
rule_info["description"] = r.description; rule_info["description"] = r.description;
rule_info["enabled"] = info.enabled; rule_info["enabled"] = info.enabled;
rule_info["source"] = r.source; rule_info["source"] = r.source;
rule_info["tags"] = std::move(sequence_to_json_array(info.tags)); rule_info["tags"] = sequence_to_json_array(info.tags);
out["info"] = std::move(rule_info); out["info"] = std::move(rule_info);
// Parse rule condition and build the non-compiled AST // Parse rule condition and build the non-compiled AST
@ -648,19 +648,19 @@ void falco_engine::get_json_details(
filter_details_resolver().run(ast.get(), details); filter_details_resolver().run(ast.get(), details);
filter_details_resolver().run(r.condition.get(), compiled_details); filter_details_resolver().run(r.condition.get(), compiled_details);
out["details"]["macros"] = std::move(sequence_to_json_array(details.macros)); out["details"]["macros"] = sequence_to_json_array(details.macros);
out["details"]["lists"] = std::move(sequence_to_json_array(details.lists)); out["details"]["lists"] = sequence_to_json_array(details.lists);
out["details"]["condition_operators"] = std::move(sequence_to_json_array(compiled_details.operators)); out["details"]["condition_operators"] = sequence_to_json_array(compiled_details.operators);
out["details"]["condition_fields"] = std::move(sequence_to_json_array(compiled_details.fields)); out["details"]["condition_fields"] = sequence_to_json_array(compiled_details.fields);
// Get fields from output string // Get fields from output string
auto fmt = create_formatter(r.source, r.output); auto fmt = create_formatter(r.source, r.output);
std::vector<std::string> out_fields; std::vector<std::string> out_fields;
fmt->get_field_names(out_fields); fmt->get_field_names(out_fields);
out["details"]["output_fields"] = std::move(sequence_to_json_array(out_fields)); out["details"]["output_fields"] = sequence_to_json_array(out_fields);
// Get fields from exceptions // Get fields from exceptions
out["details"]["exception_fields"] = std::move(sequence_to_json_array(r.exception_fields)); out["details"]["exception_fields"] = sequence_to_json_array(r.exception_fields);
// Get names and operators from exceptions // Get names and operators from exceptions
std::unordered_set<std::string> exception_names; std::unordered_set<std::string> exception_names;
@ -691,8 +691,8 @@ void falco_engine::get_json_details(
exception_operators.insert(e.comps.item); exception_operators.insert(e.comps.item);
} }
} }
out["details"]["exception_names"] = std::move(sequence_to_json_array(exception_names)); out["details"]["exception_names"] = sequence_to_json_array(exception_names);
out["details"]["exception_operators"] = std::move(sequence_to_json_array(exception_operators)); out["details"]["exception_operators"] = sequence_to_json_array(exception_operators);
// Store event types // Store event types
nlohmann::json events; nlohmann::json events;
@ -700,7 +700,7 @@ void falco_engine::get_json_details(
out["details"]["events"] = std::move(events); out["details"]["events"] = std::move(events);
// Store compiled condition and output // Store compiled condition and output
out["details"]["condition_compiled"] = std::move(libsinsp::filter::ast::as_string(r.condition.get())); out["details"]["condition_compiled"] = libsinsp::filter::ast::as_string(r.condition.get());
out["details"]["output_compiled"] = r.output; out["details"]["output_compiled"] = r.output;
// Compute the plugins that are actually used by this rule. This is involves: // Compute the plugins that are actually used by this rule. This is involves:
@ -750,10 +750,10 @@ void falco_engine::get_json_details(
filter_details_resolver().run(m.condition.get(), compiled_details); filter_details_resolver().run(m.condition.get(), compiled_details);
out["details"]["used"] = m.used; out["details"]["used"] = m.used;
out["details"]["macros"] = std::move(sequence_to_json_array(details.macros)); out["details"]["macros"] = sequence_to_json_array(details.macros);
out["details"]["lists"] = std::move(sequence_to_json_array(details.lists)); out["details"]["lists"] = sequence_to_json_array(details.lists);
out["details"]["condition_operators"] = std::move(sequence_to_json_array(compiled_details.operators)); out["details"]["condition_operators"] = sequence_to_json_array(compiled_details.operators);
out["details"]["condition_fields"] = std::move(sequence_to_json_array(compiled_details.fields)); out["details"]["condition_fields"] = sequence_to_json_array(compiled_details.fields);
// Store event types // Store event types
nlohmann::json events; nlohmann::json events;
@ -761,7 +761,7 @@ void falco_engine::get_json_details(
out["details"]["events"] = std::move(events); out["details"]["events"] = std::move(events);
// Store compiled condition // Store compiled condition
out["details"]["condition_compiled"] = std::move(libsinsp::filter::ast::as_string(m.condition.get())); out["details"]["condition_compiled"] = libsinsp::filter::ast::as_string(m.condition.get());
// Compute the plugins that are actually used by this macro. // Compute the plugins that are actually used by this macro.
// Note: macros have no specific source, we need to set an empty list of used // Note: macros have no specific source, we need to set an empty list of used
@ -769,7 +769,7 @@ void falco_engine::get_json_details(
// if a macro uses a plugin's field, we can't be sure which plugin actually // if a macro uses a plugin's field, we can't be sure which plugin actually
// is used until we resolve the macro ref in a rule providing a source for // is used until we resolve the macro ref in a rule providing a source for
// disambiguation. // disambiguation.
out["details"]["plugins"] = std::move(nlohmann::json::array()); out["details"]["plugins"] = nlohmann::json::array();
} }
void falco_engine::get_json_details( void falco_engine::get_json_details(
@ -800,9 +800,9 @@ void falco_engine::get_json_details(
list_info["items"] = std::move(items); list_info["items"] = std::move(items);
out["info"] = std::move(list_info); out["info"] = std::move(list_info);
out["details"]["used"] = l.used; out["details"]["used"] = l.used;
out["details"]["lists"] = std::move(sequence_to_json_array(lists)); out["details"]["lists"] = sequence_to_json_array(lists);
out["details"]["items_compiled"] = std::move(sequence_to_json_array(l.items)); out["details"]["items_compiled"] = sequence_to_json_array(l.items);
out["details"]["plugins"] = std::move(nlohmann::json::array()); // always empty out["details"]["plugins"] = nlohmann::json::array(); // always empty
} }
void falco_engine::get_json_evt_types( void falco_engine::get_json_evt_types(

View File

@ -63,9 +63,7 @@ private:
m_expect_macro(false), m_expect_macro(false),
m_expect_evtname(false) {} m_expect_evtname(false) {}
visitor(visitor&&) = default; visitor(visitor&&) = default;
visitor& operator = (visitor&&) = default;
visitor(const visitor&) = delete; visitor(const visitor&) = delete;
visitor& operator = (const visitor&) = delete;
void visit(libsinsp::filter::ast::and_expr* e) override; void visit(libsinsp::filter::ast::and_expr* e) override;
void visit(libsinsp::filter::ast::or_expr* e) override; void visit(libsinsp::filter::ast::or_expr* e) override;

View File

@ -103,10 +103,6 @@ class filter_macro_resolver
m_unknown_macros(unknown_macros), m_unknown_macros(unknown_macros),
m_resolved_macros(resolved_macros), m_resolved_macros(resolved_macros),
m_macros(macros) {} m_macros(macros) {}
visitor(visitor&&) = default;
visitor& operator = (visitor&&) = default;
visitor(const visitor&) = delete;
visitor& operator = (const visitor&) = delete;
std::vector<std::string> m_macros_path; std::vector<std::string> m_macros_path;
std::unique_ptr<libsinsp::filter::ast::expr> m_node_substitute; std::unique_ptr<libsinsp::filter::ast::expr> m_node_substitute;

View File

@ -562,10 +562,8 @@ rule_loader::rule_load_exception::~rule_load_exception()
{ {
} }
const char* rule_loader::rule_load_exception::what() const char* rule_loader::rule_load_exception::what() const noexcept
{ {
errstr = falco::load_result::error_code_str(ec) + ": " // const + noexcept: can't use functions that change the object or throw
+ msg.c_str(); return msg.c_str();
return errstr.c_str();
} }

View File

@ -209,18 +209,12 @@ namespace rule_loader
public: public:
rule_load_exception(falco::load_result::error_code ec, const std::string& msg, const context& ctx); rule_load_exception(falco::load_result::error_code ec, const std::string& msg, const context& ctx);
virtual ~rule_load_exception(); virtual ~rule_load_exception();
rule_load_exception(rule_load_exception&&) = default;
rule_load_exception& operator = (rule_load_exception&&) = default;
rule_load_exception(const rule_load_exception&) = default;
rule_load_exception& operator = (const rule_load_exception&) = default;
const char* what(); const char* what() const noexcept override;
falco::load_result::error_code ec; falco::load_result::error_code ec;
std::string msg; std::string msg;
context ctx; context ctx;
std::string errstr;
}; };
/*! /*!
@ -278,10 +272,6 @@ namespace rule_loader
{ {
res.reset(new result(name)); res.reset(new result(name));
} }
configuration(configuration&&) = default;
configuration& operator = (configuration&&) = default;
configuration(const configuration&) = delete;
configuration& operator = (const configuration&) = delete;
// inputs // inputs
const std::string& content; const std::string& content;

View File

@ -50,12 +50,6 @@ static void paren_item(std::string& e)
} }
} }
static inline bool is_operator_defined(const std::string& op)
{
auto ops = libsinsp::filter::parser::supported_operators();
return find(ops.begin(), ops.end(), op) != ops.end();
}
static inline bool is_operator_for_list(const std::string& op) static inline bool is_operator_for_list(const std::string& op)
{ {
auto ops = libsinsp::filter::parser::supported_operators(true); auto ops = libsinsp::filter::parser::supported_operators(true);

View File

@ -35,10 +35,6 @@ class stats_manager
public: public:
stats_manager(); stats_manager();
virtual ~stats_manager(); virtual ~stats_manager();
stats_manager(stats_manager&&) = default;
stats_manager& operator = (stats_manager&&) = default;
stats_manager(const stats_manager&) = default;
stats_manager& operator = (const stats_manager&) = default;
/*! /*!
\brief Erases the internal state and statistics data \brief Erases the internal state and statistics data

View File

@ -20,14 +20,6 @@ limitations under the License.
#include <sys/stat.h> #include <sys/stat.h>
#include <filesystem> #include <filesystem>
#ifndef CPPPATH_SEP
#ifdef _MSC_VER
#define CPPPATH_SEP "\\"
#else
#define CPPPATH_SEP "/"
#endif
#endif
using namespace falco::app; using namespace falco::app;
using namespace falco::app::actions; using namespace falco::app::actions;

View File

@ -15,8 +15,6 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
#include <nlohmann/json.hpp>
#include "actions.h" #include "actions.h"
#include "../../versions_info.h" #include "../../versions_info.h"

View File

@ -45,10 +45,6 @@ class source_sync_context
public: public:
source_sync_context(falco::semaphore& s) source_sync_context(falco::semaphore& s)
: m_finished(false), m_joined(false), m_semaphore(s) { } : m_finished(false), m_joined(false), m_semaphore(s) { }
source_sync_context(source_sync_context&&) = default;
source_sync_context& operator = (source_sync_context&&) = default;
source_sync_context(const source_sync_context&) = delete;
source_sync_context& operator = (const source_sync_context&) = delete;
inline void finish() inline void finish()
{ {
@ -102,12 +98,6 @@ private:
struct live_context struct live_context
{ {
live_context() = default;
live_context(live_context&&) = default;
live_context& operator = (live_context&&) = default;
live_context(const live_context&) = default;
live_context& operator = (const live_context&) = default;
// the name of the source of which events are processed // the name of the source of which events are processed
std::string source; std::string source;
// the result of the event processing loop // the result of the event processing loop

View File

@ -57,10 +57,6 @@ public:
m_watched_dirs(watch_dirs), m_watched_dirs(watch_dirs),
m_watched_files(watch_files) { } m_watched_files(watch_files) { }
virtual ~restart_handler(); virtual ~restart_handler();
restart_handler(restart_handler&&) = default;
restart_handler& operator = (restart_handler&&) = default;
restart_handler(const restart_handler&) = delete;
restart_handler& operator = (const restart_handler&) = delete;
bool start(std::string& err); bool start(std::string& err);
void stop(); void stop();

View File

@ -93,10 +93,6 @@ struct state
} }
~state() = default; ~state() = default;
state(state&&) = default;
state& operator = (state&&) = default;
state(const state&) = default;
state& operator = (const state&) = default;
std::string cmdline; std::string cmdline;
falco::app::options options; falco::app::options options;

View File

@ -30,13 +30,6 @@ namespace falco
class atomic_signal_handler class atomic_signal_handler
{ {
public: public:
atomic_signal_handler(): m_triggered(false), m_handled(false) { }
atomic_signal_handler(atomic_signal_handler&&) = default;
atomic_signal_handler& operator = (atomic_signal_handler&&) = default;
atomic_signal_handler(const atomic_signal_handler&) = delete;
atomic_signal_handler& operator = (const atomic_signal_handler&) = delete;
~atomic_signal_handler() = default;
/** /**
* @brief Returns true if the underlying atomic implementation * @brief Returns true if the underlying atomic implementation
* is lock-free as per C++ standard semantics. * is lock-free as per C++ standard semantics.
@ -134,7 +127,7 @@ namespace falco
private: private:
std::mutex m_mtx; std::mutex m_mtx;
std::atomic<bool> m_triggered; std::atomic<bool> m_triggered{false};
std::atomic<bool> m_handled; std::atomic<bool> m_handled{false};
}; };
}; };

View File

@ -55,45 +55,38 @@ enum class engine_kind_t : uint8_t
class falco_configuration class falco_configuration
{ {
public: public:
struct plugin_config {
typedef struct {
public:
std::string m_name; std::string m_name;
std::string m_library_path; std::string m_library_path;
std::string m_init_config; std::string m_init_config;
std::string m_open_params; std::string m_open_params;
} plugin_config; };
typedef struct { struct kmod_config {
public:
int16_t m_buf_size_preset; int16_t m_buf_size_preset;
bool m_drop_failed_exit; bool m_drop_failed_exit;
} kmod_config; };
typedef struct { struct ebpf_config {
public:
std::string m_probe_path; std::string m_probe_path;
int16_t m_buf_size_preset; int16_t m_buf_size_preset;
bool m_drop_failed_exit; bool m_drop_failed_exit;
} ebpf_config; };
typedef struct { struct modern_ebpf_config {
public:
uint16_t m_cpus_for_each_buffer; uint16_t m_cpus_for_each_buffer;
int16_t m_buf_size_preset; int16_t m_buf_size_preset;
bool m_drop_failed_exit; bool m_drop_failed_exit;
} modern_ebpf_config; };
typedef struct { struct replay_config {
public:
std::string m_capture_file; std::string m_capture_file;
} replay_config; };
typedef struct { struct gvisor_config {
public:
std::string m_config; std::string m_config;
std::string m_root; std::string m_root;
} gvisor_config; };
falco_configuration(); falco_configuration();
virtual ~falco_configuration() = default; virtual ~falco_configuration() = default;

View File

@ -65,7 +65,7 @@ falco_outputs::falco_outputs(
{ {
add_output(output); add_output(output);
} }
m_outputs_queue_num_drops = {0}; m_outputs_queue_num_drops = 0;
#ifndef __EMSCRIPTEN__ #ifndef __EMSCRIPTEN__
m_queue.set_capacity(outputs_queue_capacity); m_queue.set_capacity(outputs_queue_capacity);
m_worker_thread = std::thread(&falco_outputs::worker, this); m_worker_thread = std::thread(&falco_outputs::worker, this);

View File

@ -32,11 +32,6 @@ namespace falco
* @brief Creates a semaphore with the given initial counter value * @brief Creates a semaphore with the given initial counter value
*/ */
semaphore(int c = 0): count(c) {} semaphore(int c = 0): count(c) {}
semaphore(semaphore&&) = default;
semaphore& operator = (semaphore&&) = default;
semaphore(const semaphore&) = delete;
semaphore& operator = (const semaphore&) = delete;
~semaphore() = default;
/** /**
* @brief Increments the internal counter and unblocks acquirers * @brief Increments the internal counter and unblocks acquirers

View File

@ -20,7 +20,6 @@ limitations under the License.
#endif #endif
#include <ctime> #include <ctime>
#include <csignal> #include <csignal>
#include <nlohmann/json.hpp>
#include <atomic> #include <atomic>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
@ -302,7 +301,7 @@ void stats_writer::worker() noexcept
} }
stats_writer::collector::collector(const std::shared_ptr<stats_writer>& writer) stats_writer::collector::collector(const std::shared_ptr<stats_writer>& writer)
: m_writer(writer), m_last_tick(0), m_samples(0), : m_writer(writer), m_last_tick(0),
m_last_now(0), m_last_n_evts(0), m_last_n_drops(0), m_last_num_evts(0) m_last_now(0), m_last_n_evts(0), m_last_n_drops(0), m_last_num_evts(0)
{ {
} }

View File

@ -74,11 +74,8 @@ public:
*/ */
void get_metrics_output_fields_additional(nlohmann::json& output_fields, const std::shared_ptr<sinsp>& inspector, double stats_snapshot_time_delta_sec, const std::string& src); void get_metrics_output_fields_additional(nlohmann::json& output_fields, const std::shared_ptr<sinsp>& inspector, double stats_snapshot_time_delta_sec, const std::string& src);
std::shared_ptr<stats_writer> m_writer; std::shared_ptr<stats_writer> m_writer;
stats_writer::ticker_t m_last_tick; stats_writer::ticker_t m_last_tick;
uint64_t m_samples;
scap_stats m_last_stats;
uint64_t m_last_now; uint64_t m_last_now;
uint64_t m_last_n_evts; uint64_t m_last_n_evts;
uint64_t m_last_n_drops; uint64_t m_last_n_drops;