update(ci,cmake): add support for emscripten build

Signed-off-by: rohith-raju <rohithraju488@gmail.com>
This commit is contained in:
rohith-raju 2023-06-28 09:22:29 +00:00 committed by poiana
parent 105f2f6ee3
commit e8ee850dee
2 changed files with 5 additions and 2 deletions

View File

@ -36,7 +36,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
list(APPEND FALCO_UNIT_TESTS_SOURCES
falco/test_atomic_signal_handler.cpp
falco/app/actions/test_configure_interesting_sets.cpp
falco/app/actions/test_configure_syscall_buffer.cpp)
falco/app/actions/test_configure_syscall_buffer_num.cpp)
endif()
set(FALCO_UNIT_TESTS_INCLUDES

View File

@ -57,19 +57,22 @@ bool stats_writer::init_ticker(uint32_t interval_msec, std::string &err)
sev.sigev_notify = SIGEV_SIGNAL;
sev.sigev_signo = SIGALRM;
sev.sigev_value.sival_ptr = &timerid;
#ifndef __EMSCRIPTEN__
if (timer_create(CLOCK_MONOTONIC, &sev, &timerid) == -1) {
err = std::string("Could not create periodic timer: ") + strerror(errno);
return false;
}
#endif
timer.it_value.tv_sec = interval_msec / 1000;
timer.it_value.tv_nsec = (interval_msec % 1000) * 1000 * 1000;
timer.it_interval = timer.it_value;
#ifndef __EMSCRIPTEN__
if (timer_settime(timerid, 0, &timer, NULL) == -1) {
err = std::string("Could not set up periodic timer: ") + strerror(errno);
return false;
}
#endif
return true;
}