refactor(userspace/falco): add action for printing syscall events

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
Jason Dellaluce 2022-06-28 12:14:16 +00:00 committed by poiana
parent b307853e39
commit 2caadd1af5
4 changed files with 36 additions and 7 deletions

View File

@ -35,6 +35,7 @@ set(
app_actions/print_ignored_events.cpp
app_actions/print_plugin_info.cpp
app_actions/print_support.cpp
app_actions/print_syscall_events.cpp
app_actions/print_version.cpp
app_actions/start_grpc_server.cpp
app_actions/start_webserver.cpp

View File

@ -33,12 +33,5 @@ application::run_result application::list_fields()
return run_result::exit();
}
if(m_options.list_syscall_events)
{
// We know this function doesn't hold into the raw pointer value
list_events(m_state->inspector.get(), m_options.markdown);
return run_result::exit();
}
return run_result::ok();
}

View File

@ -0,0 +1,34 @@
/*
Copyright (C) 2022 The Falco Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "application.h"
#include <fields_info.h>
using namespace falco::app;
application::run_result application::print_syscall_events()
{
if(m_options.list_syscall_events)
{
// We know this function doesn't hold into the raw pointer value
std::unique_ptr<sinsp> inspector(new sinsp());
list_events(inspector.get(), m_options.markdown);
return run_result::exit();
}
return run_result::ok();
}

View File

@ -197,6 +197,7 @@ private:
run_result print_ignored_events();
run_result print_plugin_info();
run_result print_support();
run_result print_syscall_events();
run_result print_version();
run_result process_events();
#ifndef MINIMAL_BUILD