Skip to content

Commit

Permalink
cleanup(libsinsp): remove CYGWING_AGENT feature gate
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo committed Jan 31, 2024
1 parent d75fb11 commit 0c05f90
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 17 deletions.
4 changes: 1 addition & 3 deletions driver/ppm_events_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ or GPL2.txt for full copies of the license.
/*
* Macros for packing in different build environments
*/
#if !defined(CYGWING_AGENT) && defined(_WIN32)
#if defined(_WIN32)
#define _packed __pragma(pack(push, 1)); __pragma(pack(pop))
#else
#define _packed __attribute__((packed))
Expand Down Expand Up @@ -2077,7 +2077,6 @@ struct ppm_evt_hdr {
/*
* IOCTL codes
*/
#ifndef CYGWING_AGENT
#define PPM_IOCTL_MAGIC 's'
// #define PPM_IOCTL_DISABLE_CAPTURE _IO(PPM_IOCTL_MAGIC, 0) Support dropped
// #define PPM_IOCTL_ENABLE_CAPTURE _IO(PPM_IOCTL_MAGIC, 1) Support dropped
Expand Down Expand Up @@ -2114,7 +2113,6 @@ struct ppm_evt_hdr {
#define PPM_IOCTL_DISABLE_TP _IO(PPM_IOCTL_MAGIC, 32)
#define PPM_IOCTL_ENABLE_DROPFAILED _IO(PPM_IOCTL_MAGIC, 33)
#define PPM_IOCTL_DISABLE_DROPFAILED _IO(PPM_IOCTL_MAGIC, 34)
#endif // CYGWING_AGENT

extern const struct ppm_name_value socket_families[];
extern const struct ppm_name_value file_flags[];
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ limitations under the License.
#include <libsinsp/event.h>
#include <libsinsp/container_info.h>

#if !defined(_WIN32) && !defined(CYGWING_AGENT) && defined(HAS_CAPTURE) && !defined(MINIMAL_BUILD) && !defined(__EMSCRIPTEN__)
#if !defined(_WIN32) && defined(HAS_CAPTURE) && !defined(MINIMAL_BUILD) && !defined(__EMSCRIPTEN__)
#include <curl/curl.h>
#include <curl/easy.h>
#include <curl/multi.h>
Expand Down
8 changes: 4 additions & 4 deletions userspace/libsinsp/dns_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.

void sinsp_dns_resolver::refresh(uint64_t erase_timeout, uint64_t base_refresh_timeout, uint64_t max_refresh_timeout, std::future<void> f_exit)
{
#if defined(HAS_CAPTURE) && !defined(CYGWING_AGENT) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
#if defined(HAS_CAPTURE) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
sinsp_dns_manager &manager = sinsp_dns_manager::get();
while(true)
{
Expand Down Expand Up @@ -80,7 +80,7 @@ void sinsp_dns_resolver::refresh(uint64_t erase_timeout, uint64_t base_refresh_t
#endif
}

#if defined(HAS_CAPTURE) && !defined(CYGWING_AGENT) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
#if defined(HAS_CAPTURE) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
inline sinsp_dns_manager::dns_info sinsp_dns_manager::resolve(const std::string &name, uint64_t ts)
{
dns_info dinfo;
Expand Down Expand Up @@ -115,7 +115,7 @@ inline sinsp_dns_manager::dns_info sinsp_dns_manager::resolve(const std::string

bool sinsp_dns_manager::match(const char *name, int af, void *addr, uint64_t ts)
{
#if defined(HAS_CAPTURE) && !defined(CYGWING_AGENT) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
#if defined(HAS_CAPTURE) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
if(!m_resolver)
{
m_resolver = std::make_unique<std::thread>(sinsp_dns_resolver::refresh, m_erase_timeout, m_base_refresh_timeout, m_max_refresh_timeout, m_exit_signal.get_future());
Expand Down Expand Up @@ -156,7 +156,7 @@ std::string sinsp_dns_manager::name_of(int af, void *addr, uint64_t ts)
{
std::string ret;

#if defined(HAS_CAPTURE) && !defined(CYGWING_AGENT) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
#if defined(HAS_CAPTURE) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
if(!m_cache.empty())
{
m_erase_mutex.lock();
Expand Down
6 changes: 3 additions & 3 deletions userspace/libsinsp/dns_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ limitations under the License.
#include <chrono>
#include <future>
#include <mutex>
#if defined(HAS_CAPTURE) && !defined(CYGWING_AGENT) && !defined(__EMSCRIPTEN__)
#if defined(HAS_CAPTURE) && !defined(__EMSCRIPTEN__)
#include "tbb/concurrent_unordered_map.h"
#endif
#include <libsinsp/sinsp.h>
Expand Down Expand Up @@ -69,7 +69,7 @@ class sinsp_dns_manager

size_t size() const
{
#if defined(HAS_CAPTURE) && !defined(CYGWING_AGENT) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
#if defined(HAS_CAPTURE) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
return m_cache.size();
#else
return 0;
Expand All @@ -91,7 +91,7 @@ class sinsp_dns_manager
sinsp_dns_manager(sinsp_dns_manager const&) = delete;
void operator=(sinsp_dns_manager const&) = delete;

#if defined(HAS_CAPTURE) && !defined(CYGWING_AGENT) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
#if defined(HAS_CAPTURE) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
struct dns_info
{
bool operator==(const dns_info &other) const
Expand Down
6 changes: 3 additions & 3 deletions userspace/libsinsp/sinsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ limitations under the License.
#include <libscap/strl.h>
#include <libscap/scap-int.h>

#if defined(HAS_CAPTURE) && !defined(CYGWING_AGENT) && !defined(MINIMAL_BUILD) && !defined(__EMSCRIPTEN__)
#if defined(HAS_CAPTURE) && !defined(MINIMAL_BUILD) && !defined(__EMSCRIPTEN__)
#include <curl/curl.h>
#endif

Expand Down Expand Up @@ -76,7 +76,7 @@ sinsp::sinsp(bool static_container, const std::string &static_id, const std::str
m_inited(false)
{
++instance_count;
#if !defined(MINIMAL_BUILD) && !defined(CYGWING_AGENT) && !defined(__EMSCRIPTEN__) && defined(HAS_CAPTURE)
#if !defined(MINIMAL_BUILD) && !defined(__EMSCRIPTEN__) && defined(HAS_CAPTURE)
// used by container_manager
curl_global_init(CURL_GLOBAL_DEFAULT);
#endif
Expand Down Expand Up @@ -158,7 +158,7 @@ sinsp::~sinsp()

m_container_manager.cleanup();

#if defined(HAS_CAPTURE) && !defined(CYGWING_AGENT) && !defined(MINIMAL_BUILD) && !defined(__EMSCRIPTEN__)
#if defined(HAS_CAPTURE) && !defined(MINIMAL_BUILD) && !defined(__EMSCRIPTEN__)
curl_global_cleanup();
if (--instance_count == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/test/dns_manager.ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
*/

#if defined(HAS_CAPTURE) && !defined(CYGWING_AGENT) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
#if defined(HAS_CAPTURE) && !defined(_WIN32) && !defined(__EMSCRIPTEN__)
#include <dns_manager.h>
#include <gtest/gtest.h>

Expand Down
2 changes: 0 additions & 2 deletions userspace/libsinsp/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,6 @@ bool sinsp_utils::glob_match(const char *pattern, const char *string, const bool
#endif
}

#ifndef CYGWING_AGENT
#ifndef _WIN32
#ifdef __GLIBC__
void sinsp_utils::bt(void)
Expand All @@ -887,7 +886,6 @@ void sinsp_utils::bt(void)
}
#endif // __GLIBC__
#endif // _WIN32
#endif // CYGWING_AGENT

bool sinsp_utils::find_first_env(std::string &out, const std::vector<std::string> &env, const std::vector<std::string> &keys)
{
Expand Down

0 comments on commit 0c05f90

Please sign in to comment.