From a8db99db5bd053c43c40df75389b84561e31b27f Mon Sep 17 00:00:00 2001 From: Leonardo Di Giovanna Date: Tue, 4 Feb 2025 18:36:04 +0100 Subject: [PATCH] feat(falco/app): move actions not using config before `load_config` Move actions not requiring config to be loaded before `load_config` action. This avoid resource waste. Notably, `print_help` is promoted as first execution action. Moreover, set actions lists to constant expressions. Signed-off-by: Leonardo Di Giovanna --- userspace/falco/app/app.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/userspace/falco/app/app.cpp b/userspace/falco/app/app.cpp index 85870c74..77035370 100644 --- a/userspace/falco/app/app.cpp +++ b/userspace/falco/app/app.cpp @@ -53,17 +53,17 @@ bool falco::app::run(falco::app::state& s, bool& restart, std::string& errstr) { // called. Before changing the order, ensure that all // dependencies are honored (e.g. don't process events before // loading plugins, opening inspector, etc.). - std::list run_steps = { + std::list const run_steps = { + falco::app::actions::print_help, falco::app::actions::print_config_schema, falco::app::actions::print_rule_schema, - falco::app::actions::load_config, - falco::app::actions::print_help, - falco::app::actions::print_kernel_version, - falco::app::actions::print_version, - falco::app::actions::print_page_size, falco::app::actions::print_generated_gvisor_config, falco::app::actions::print_ignored_events, falco::app::actions::print_syscall_events, + falco::app::actions::load_config, + falco::app::actions::print_kernel_version, + falco::app::actions::print_version, + falco::app::actions::print_page_size, falco::app::actions::require_config_file, falco::app::actions::print_plugin_info, falco::app::actions::list_plugins, @@ -87,7 +87,7 @@ bool falco::app::run(falco::app::state& s, bool& restart, std::string& errstr) { falco::app::actions::process_events, }; - std::list teardown_steps = { + std::list const teardown_steps = { falco::app::actions::unregister_signal_handlers, falco::app::actions::stop_grpc_server, falco::app::actions::stop_webserver,