update: adapt code to multi-platform builds

Co-authored-by: Rohith Raju <rohithraju488@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
Jason Dellaluce
2023-06-20 15:41:52 +00:00
committed by poiana
parent 86e76924a1
commit aa6061681d
28 changed files with 114 additions and 40 deletions

View File

@@ -29,6 +29,10 @@ set(FALCO_ENGINE_SOURCE_FILES
add_library(falco_engine STATIC ${FALCO_ENGINE_SOURCE_FILES})
if (EMSCRIPTEN)
target_compile_options(falco_engine PRIVATE "-sDISABLE_EXCEPTION_CATCHING=0")
endif()
add_dependencies(falco_engine yamlcpp njson)
if(MINIMAL_BUILD)

View File

@@ -204,7 +204,11 @@ void evttype_index_ruleset::add(
wrap->filter = filter;
if(rule.source == falco_common::syscall_source)
{
#ifdef __linux__
wrap->sc_codes = libsinsp::filter::ast::ppm_sc_codes(condition.get());
#else
wrap->sc_codes = { };
#endif
wrap->event_codes = libsinsp::filter::ast::ppm_event_codes(condition.get());
}
else

View File

@@ -769,7 +769,10 @@ void falco_engine::get_json_evt_types(libsinsp::filter::ast::expr* ast,
{
output = Json::arrayValue;
auto evtcodes = libsinsp::filter::ast::ppm_event_codes(ast);
libsinsp::events::set<ppm_sc_code> syscodes;
#ifdef __linux__
auto syscodes = libsinsp::filter::ast::ppm_sc_codes(ast);
#endif
auto syscodes_to_evt_names = libsinsp::events::sc_set_to_event_names(syscodes);
auto evtcodes_to_evt_names = libsinsp::events::event_set_to_names(evtcodes, false);
for (const auto& n : unordered_set_union(syscodes_to_evt_names, evtcodes_to_evt_names))

View File

@@ -16,7 +16,6 @@ limitations under the License.
#pragma once
#include <map>
#include <string>
#include <vector>
#include <unordered_map>