From b0fdb31c26256aa110a5ac6c395f845770952faa Mon Sep 17 00:00:00 2001 From: Andrea Terzolo Date: Tue, 3 Oct 2023 17:39:22 +0200 Subject: [PATCH] fix: fix build on windows Signed-off-by: Andrea Terzolo --- userspace/libsinsp/pod_regex.h | 20 +++++++++++++++++++ .../test/classes/sinsp_threadinfo.cpp | 3 ++- userspace/libsinsp/threadinfo.cpp | 3 +++ userspace/libsinsp/threadinfo.h | 3 --- 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 userspace/libsinsp/pod_regex.h diff --git a/userspace/libsinsp/pod_regex.h b/userspace/libsinsp/pod_regex.h new file mode 100644 index 0000000000..80bdf03fd6 --- /dev/null +++ b/userspace/libsinsp/pod_regex.h @@ -0,0 +1,20 @@ +/* +Copyright (C) 2023 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. + +*/ + +#pragma once + +#define RGX_POD "(pod[a-z0-9]{8}[-_][a-z0-9]{4}[-_][a-z0-9]{4}[-_][a-z0-9]{4}[-_][a-z0-9]{12})" diff --git a/userspace/libsinsp/test/classes/sinsp_threadinfo.cpp b/userspace/libsinsp/test/classes/sinsp_threadinfo.cpp index 685f4198a7..bebaab2cea 100644 --- a/userspace/libsinsp/test/classes/sinsp_threadinfo.cpp +++ b/userspace/libsinsp/test/classes/sinsp_threadinfo.cpp @@ -16,6 +16,8 @@ limitations under the License. */ #include +#include +#include "pod_regex.h" TEST(sinsp_threadinfo, get_main_thread) { @@ -129,7 +131,6 @@ TEST_F(sinsp_with_test_input, THRD_INFO_assign_children_to_a_nullptr) // This test asserts that our regex is solid against all possible cgroup layouts TEST(sinsp_threadinfo, check_pod_uid_regex) { - // RGX_POD is defined in `threadinfo.h` re2::RE2 pattern(RGX_POD, re2::RE2::POSIX); // CgroupV1, driver cgroup diff --git a/userspace/libsinsp/threadinfo.cpp b/userspace/libsinsp/threadinfo.cpp index 3d4e5fa9a4..0fafa60d50 100644 --- a/userspace/libsinsp/threadinfo.cpp +++ b/userspace/libsinsp/threadinfo.cpp @@ -31,6 +31,9 @@ limitations under the License. #include "tracer_emitter.h" #endif +#include +#include "pod_regex.h" + constexpr static const char* s_thread_table_name = "threads"; extern sinsp_evttables g_infotables; diff --git a/userspace/libsinsp/threadinfo.h b/userspace/libsinsp/threadinfo.h index eb39eeaecd..62e1fa9881 100644 --- a/userspace/libsinsp/threadinfo.h +++ b/userspace/libsinsp/threadinfo.h @@ -39,9 +39,6 @@ struct iovec { #include "internal_metrics.h" #include "state/table.h" #include "thread_group_info.h" -#include - -#define RGX_POD "(pod[a-z0-9]{8}[-_][a-z0-9]{4}[-_][a-z0-9]{4}[-_][a-z0-9]{4}[-_][a-z0-9]{12})" class sinsp_delays_info; class sinsp_tracerparser;