fix(userspace/falco): disable sys/time.h+inotify on windows

Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
This commit is contained in:
Roberto Scolaro 2023-10-24 17:18:25 +00:00 committed by poiana
parent af70b4e770
commit f7575292c6
2 changed files with 7 additions and 3 deletions

View File

@ -26,7 +26,7 @@ limitations under the License.
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif
#if !defined(__APPLE__) #if !defined(__APPLE__) && !defined(_WIN32)
#include <sys/inotify.h> #include <sys/inotify.h>
#endif #endif
#include <sys/select.h> #include <sys/select.h>

View File

@ -15,7 +15,9 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
#ifndef _WIN32
#include <sys/time.h> #include <sys/time.h>
#endif
#include <ctime> #include <ctime>
#include <csignal> #include <csignal>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
@ -33,7 +35,7 @@ limitations under the License.
// overflows here. Threads calling stats_writer::handle() will just // overflows here. Threads calling stats_writer::handle() will just
// check that this value changed since their last observation. // check that this value changed since their last observation.
static std::atomic<stats_writer::ticker_t> s_timer((stats_writer::ticker_t) 0); static std::atomic<stats_writer::ticker_t> s_timer((stats_writer::ticker_t) 0);
#if !defined(__APPLE__) #if !defined(__APPLE__) && !defined(_WIN32)
static timer_t s_timerid; static timer_t s_timerid;
#else #else
static uint16_t s_timerid; static uint16_t s_timerid;
@ -52,6 +54,7 @@ static void timer_handler(int signum)
bool stats_writer::init_ticker(uint32_t interval_msec, std::string &err) bool stats_writer::init_ticker(uint32_t interval_msec, std::string &err)
{ {
#if !defined(_WIN32)
#if !defined(__APPLE__) #if !defined(__APPLE__)
struct itimerspec timer = {}; struct itimerspec timer = {};
#endif #endif
@ -104,6 +107,7 @@ bool stats_writer::init_ticker(uint32_t interval_msec, std::string &err)
return false; return false;
} }
#endif #endif
#endif // !defined(_WIN32)
return true; return true;
} }
@ -160,7 +164,7 @@ stats_writer::~stats_writer()
m_file_output.close(); m_file_output.close();
} }
// delete timerID and reset timer // delete timerID and reset timer
#if !defined(__EMSCRIPTEN__) && !defined(__APPLE__) #if !defined(__EMSCRIPTEN__) && !defined(__APPLE__) && !defined(_WIN32)
if (s_timerid_exists) if (s_timerid_exists)
{ {
timer_delete(s_timerid); timer_delete(s_timerid);