mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-01 22:58:12 +00:00
refactor(cmake): selectively remove sources on win32
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
This commit is contained in:
@@ -53,9 +53,7 @@ set(
|
|||||||
logger.cpp
|
logger.cpp
|
||||||
falco_outputs.cpp
|
falco_outputs.cpp
|
||||||
outputs_file.cpp
|
outputs_file.cpp
|
||||||
outputs_program.cpp
|
|
||||||
outputs_stdout.cpp
|
outputs_stdout.cpp
|
||||||
outputs_syslog.cpp
|
|
||||||
event_drops.cpp
|
event_drops.cpp
|
||||||
stats_writer.cpp
|
stats_writer.cpp
|
||||||
versions_info.cpp
|
versions_info.cpp
|
||||||
@@ -90,6 +88,14 @@ if(USE_BUNDLED_DEPS)
|
|||||||
list(APPEND FALCO_DEPENDENCIES yamlcpp)
|
list(APPEND FALCO_DEPENDENCIES yamlcpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
list(
|
||||||
|
APPEND FALCO_SOURCES
|
||||||
|
outputs_program.cpp
|
||||||
|
outputs_syslog.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT MINIMAL_BUILD)
|
||||||
list(
|
list(
|
||||||
APPEND FALCO_SOURCES
|
APPEND FALCO_SOURCES
|
||||||
|
@@ -27,9 +27,11 @@ limitations under the License.
|
|||||||
#include "watchdog.h"
|
#include "watchdog.h"
|
||||||
|
|
||||||
#include "outputs_file.h"
|
#include "outputs_file.h"
|
||||||
#include "outputs_program.h"
|
|
||||||
#include "outputs_stdout.h"
|
#include "outputs_stdout.h"
|
||||||
|
#if !defined(_WIN32)
|
||||||
|
#include "outputs_program.h"
|
||||||
#include "outputs_syslog.h"
|
#include "outputs_syslog.h"
|
||||||
|
#endif
|
||||||
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__) && !defined(MINIMAL_BUILD)
|
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__) && !defined(MINIMAL_BUILD)
|
||||||
#include "outputs_http.h"
|
#include "outputs_http.h"
|
||||||
#include "outputs_grpc.h"
|
#include "outputs_grpc.h"
|
||||||
@@ -100,10 +102,12 @@ void falco_outputs::add_output(falco::outputs::config oc)
|
|||||||
{
|
{
|
||||||
oo = new falco::outputs::output_stdout();
|
oo = new falco::outputs::output_stdout();
|
||||||
}
|
}
|
||||||
|
#ifndef _WIN32
|
||||||
else if(oc.name == "syslog")
|
else if(oc.name == "syslog")
|
||||||
{
|
{
|
||||||
oo = new falco::outputs::output_syslog();
|
oo = new falco::outputs::output_syslog();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__) && !defined(MINIMAL_BUILD)
|
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__) && !defined(MINIMAL_BUILD)
|
||||||
else if(oc.name == "http")
|
else if(oc.name == "http")
|
||||||
{
|
{
|
||||||
|
@@ -20,7 +20,6 @@ limitations under the License.
|
|||||||
|
|
||||||
void falco::outputs::output_program::open_pfile()
|
void falco::outputs::output_program::open_pfile()
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
if(m_pfile == nullptr)
|
if(m_pfile == nullptr)
|
||||||
{
|
{
|
||||||
m_pfile = popen(m_oc.options["program"].c_str(), "w");
|
m_pfile = popen(m_oc.options["program"].c_str(), "w");
|
||||||
@@ -30,7 +29,6 @@ void falco::outputs::output_program::open_pfile()
|
|||||||
setvbuf(m_pfile, NULL, _IONBF, 0);
|
setvbuf(m_pfile, NULL, _IONBF, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void falco::outputs::output_program::output(const message *msg)
|
void falco::outputs::output_program::output(const message *msg)
|
||||||
@@ -47,13 +45,11 @@ void falco::outputs::output_program::output(const message *msg)
|
|||||||
|
|
||||||
void falco::outputs::output_program::cleanup()
|
void falco::outputs::output_program::cleanup()
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
if(m_pfile != nullptr)
|
if(m_pfile != nullptr)
|
||||||
{
|
{
|
||||||
pclose(m_pfile);
|
pclose(m_pfile);
|
||||||
m_pfile = nullptr;
|
m_pfile = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void falco::outputs::output_program::reopen()
|
void falco::outputs::output_program::reopen()
|
||||||
|
@@ -16,14 +16,10 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "outputs_syslog.h"
|
#include "outputs_syslog.h"
|
||||||
#ifndef _WIN32
|
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
void falco::outputs::output_syslog::output(const message *msg)
|
void falco::outputs::output_syslog::output(const message *msg)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
// Syslog output should not have any trailing newline
|
// Syslog output should not have any trailing newline
|
||||||
::syslog(msg->priority, "%s", msg->msg.c_str());
|
::syslog(msg->priority, "%s", msg->msg.c_str());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user