Skip to content

Commit

Permalink
refactor(libscap): move linux metrics collection logic to scap platform
Browse files Browse the repository at this point in the history
Signed-off-by: Gianmatteo Palmieri <[email protected]>
  • Loading branch information
mrgian committed Jul 19, 2024
1 parent 4e3aebe commit cd54b89
Show file tree
Hide file tree
Showing 9 changed files with 307 additions and 288 deletions.
4 changes: 4 additions & 0 deletions userspace/libscap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ if (DEFINED SCAP_BPF_PROGS_TAIL_CALLED_MAX)
add_definitions(-DBPF_PROGS_TAIL_CALLED_MAX=${SCAP_BPF_PROGS_TAIL_CALLED_MAX})
endif()

if(NOT DEFINED SCAP_AGENT_CGROUP_MEM_PATH_ENV_VAR)
set(SCAP_AGENT_CGROUP_MEM_PATH_ENV_VAR "AGENT_CGROUP_MEM_PATH")
endif()
add_definitions(-DSCAP_AGENT_CGROUP_MEM_PATH_ENV_VAR="${SCAP_AGENT_CGROUP_MEM_PATH_ENV_VAR}")

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scap_strl_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/scap_strl_config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scap_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/scap_config.h)
Expand Down
243 changes: 243 additions & 0 deletions userspace/libscap/linux/scap_linux_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ limitations under the License.
#include <sys/stat.h>
#include <sys/utsname.h>
#include <sys/time.h>
#include <sys/times.h>
#include <unistd.h>
#include <math.h>

static int32_t scap_linux_close_platform(struct scap_platform* platform)
{
Expand Down Expand Up @@ -121,6 +123,246 @@ static const struct scap_platform_vtable scap_linux_platform_vtable = {
.free_platform = scap_linux_free_platform,
};

static void scap_linux_get_rss_vsz_pss_total_memory_and_open_fds(uint32_t *rss, uint32_t *vsz, uint32_t *pss, uint64_t *host_memory_used, uint64_t *host_open_fds)

Check warning on line 126 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L126

Added line #L126 was not covered by tests
{
FILE* f;
char filepath[512];
char line[512];

Check warning on line 130 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L128-L130

Added lines #L128 - L130 were not covered by tests

/*
* Get memory usage of the agent itself (referred to as calling process meaning /proc/self/)
*/

// No need for scap_get_host_root since we look at the agents' own process, accessible from it's own pid namespace (if applicable)
f = fopen("/proc/self/status", "r");

Check warning on line 137 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L137

Added line #L137 was not covered by tests
if(!f)
{
return;

Check warning on line 140 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L140

Added line #L140 was not covered by tests
}

while(fgets(line, sizeof(line), f) != NULL)
{
if(strncmp(line, "VmSize:", 7) == 0)
{
sscanf(line, "VmSize: %" SCNu32, vsz); /* memory size returned in kb */

Check warning on line 147 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L147

Added line #L147 was not covered by tests
}
else if(strncmp(line, "VmRSS:", 6) == 0)
{
sscanf(line, "VmRSS: %" SCNu32, rss); /* memory size returned in kb */

Check warning on line 151 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L151

Added line #L151 was not covered by tests
}
}
fclose(f);

Check warning on line 154 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L154

Added line #L154 was not covered by tests

// No need for scap_get_host_root since we look at the agents' own process, accessible from it's own pid namespace (if applicable)
f = fopen("/proc/self/smaps_rollup", "r");

Check warning on line 157 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L157

Added line #L157 was not covered by tests
if(!f)
{
return;
}

while(fgets(line, sizeof(line), f) != NULL)
{
if(strncmp(line, "Pss:", 4) == 0)
{
sscanf(line, "Pss: %" SCNu32, pss); /* memory size returned in kb */
break;

Check warning on line 168 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L167-L168

Added lines #L167 - L168 were not covered by tests
}
}
fclose(f);

Check warning on line 171 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L171

Added line #L171 was not covered by tests

/*
* Get total host memory usage
*/

// Using scap_get_host_root since we look at the memory usage of the underlying host
snprintf(filepath, sizeof(filepath), "%s/proc/meminfo", scap_get_host_root());
f = fopen(filepath, "r");

Check warning on line 179 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L178-L179

Added lines #L178 - L179 were not covered by tests
if(!f)
{
return;
}

uint64_t mem_total, mem_free, mem_buff, mem_cache = 0;

Check warning on line 185 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L185

Added line #L185 was not covered by tests

while(fgets(line, sizeof(line), f) != NULL)
{
if(strncmp(line, "MemTotal:", 9) == 0)
{
sscanf(line, "MemTotal: %" SCNu64, &mem_total); /* memory size returned in kb */

Check warning on line 191 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L191

Added line #L191 was not covered by tests
}
else if(strncmp(line, "MemFree:", 8) == 0)
{
sscanf(line, "MemFree: %" SCNu64, &mem_free); /* memory size returned in kb */

Check warning on line 195 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L195

Added line #L195 was not covered by tests
}
else if(strncmp(line, "Buffers:", 8) == 0)
{
sscanf(line, "Buffers: %" SCNu64, &mem_buff); /* memory size returned in kb */

Check warning on line 199 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L199

Added line #L199 was not covered by tests
}
else if(strncmp(line, "Cached:", 7) == 0)
{
sscanf(line, "Cached: %" SCNu64, &mem_cache); /* memory size returned in kb */

Check warning on line 203 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L203

Added line #L203 was not covered by tests
}
}
fclose(f);
*host_memory_used = mem_total - mem_free - mem_buff - mem_cache;

Check warning on line 207 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L206-L207

Added lines #L206 - L207 were not covered by tests

/*
* Get total number of allocated file descriptors (not all open files!)
* File descriptor is a data structure used by a program to get a handle on a file
*/

// Using scap_get_host_root since we look at the total open fds of the underlying host
snprintf(filepath, sizeof(filepath), "%s/proc/sys/fs/file-nr", scap_get_host_root());
f = fopen(filepath, "r");

Check warning on line 216 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L215-L216

Added lines #L215 - L216 were not covered by tests
if(!f)
{
return;
}
int matched_fds = fscanf(f, "%" SCNu64, host_open_fds);
fclose(f);

Check warning on line 222 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L221-L222

Added lines #L221 - L222 were not covered by tests

if (matched_fds != 1) {
return;
}
}

static void scap_linux_get_cpu_usage_and_total_procs(double start_time, double *cpu_usage_perc, double *host_cpu_usage_perc, uint32_t *host_procs_running)

Check warning on line 229 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L229

Added line #L229 was not covered by tests
{
FILE* f;
char filepath[512];
char line[512];

Check warning on line 233 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L231-L233

Added lines #L231 - L233 were not covered by tests

struct tms time;

Check warning on line 235 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L235

Added line #L235 was not covered by tests
if (times (&time) == (clock_t) -1)
{
return;

Check warning on line 238 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L238

Added line #L238 was not covered by tests
}

/* Number of clock ticks per second, often referred to as USER_HZ / jiffies. */
long hz = 100;

Check warning on line 242 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L242

Added line #L242 was not covered by tests
#ifdef _SC_CLK_TCK
if ((hz = sysconf(_SC_CLK_TCK)) < 0)
{
hz = 100;

Check warning on line 246 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L246

Added line #L246 was not covered by tests
}
#endif
/* Current uptime of the host machine in seconds.
* /proc/uptime offers higher precision w/ 2 decimals.
*/

// Using scap_get_host_root since we look at the uptime of the underlying host
snprintf(filepath, sizeof(filepath), "%s/proc/uptime", scap_get_host_root());
f = fopen(filepath, "r");

Check warning on line 255 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L254-L255

Added lines #L254 - L255 were not covered by tests
if(!f)
{
return;
}

double machine_uptime_sec = 0;
int matched_uptime = fscanf(f, "%lf", &machine_uptime_sec);
fclose(f);

Check warning on line 263 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L261-L263

Added lines #L261 - L263 were not covered by tests

if (matched_uptime != 1) {
return;
}

/*
* Get CPU usage of the agent itself (referred to as calling process meaning /proc/self/)
*/

/* Current utime is amount of processor time in user mode of calling process. Convert to seconds. */
double user_sec = (double)time.tms_utime / hz;

Check warning on line 274 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L274

Added line #L274 was not covered by tests

/* Current stime is amount of time the calling process has been scheduled in kernel mode. Convert to seconds. */
double system_sec = (double)time.tms_stime / hz;

Check warning on line 277 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L277

Added line #L277 was not covered by tests


/* CPU usage as percentage is computed by dividing the time the process uses the CPU by the
* currently elapsed time of the calling process. Compare to `ps` linux util. */
double elapsed_sec = machine_uptime_sec - start_time;

Check warning on line 282 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L282

Added line #L282 was not covered by tests
if (elapsed_sec > 0)
{
*cpu_usage_perc = (double)100.0 * (user_sec + system_sec) / elapsed_sec;
*cpu_usage_perc = round(*cpu_usage_perc * 10.0) / 10.0; // round to 1 decimal

Check warning on line 286 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L285-L286

Added lines #L285 - L286 were not covered by tests
}

/*
* Get total host CPU usage (all CPUs) as percentage and retrieve number of procs currently running.
*/

// Using scap_get_host_root since we look at the total CPU usage of the underlying host
snprintf(filepath, sizeof(filepath), "%s/proc/stat", scap_get_host_root());
f = fopen(filepath, "r");

Check warning on line 295 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L294-L295

Added lines #L294 - L295 were not covered by tests
if(!f)
{
return;
}

/* Need only first 7 columns of /proc/stat cpu line */
uint64_t user, nice, system, idle, iowait, irq, softirq = 0;

Check warning on line 302 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L302

Added line #L302 was not covered by tests
while(fgets(line, sizeof(line), f) != NULL)
{
if(strncmp(line, "cpu ", 4) == 0)
{
/* Always first line in /proc/stat file, unit: jiffies */
sscanf(line, "cpu %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64, &user, &nice, &system, &idle, &iowait, &irq, &softirq);

Check warning on line 308 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L308

Added line #L308 was not covered by tests
}
else if(strncmp(line, "procs_running ", 14) == 0)
{
sscanf(line, "procs_running %" SCNu32, host_procs_running);
break;

Check warning on line 313 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L312-L313

Added lines #L312 - L313 were not covered by tests
}
}
fclose(f);
uint64_t sum = user + nice + system + idle + iowait + irq + softirq;

Check warning on line 317 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L316-L317

Added lines #L316 - L317 were not covered by tests
if (sum > 0)
{
*host_cpu_usage_perc = 100.0 - ((idle * 100.0) / sum);
*host_cpu_usage_perc = round(*host_cpu_usage_perc * 10.0) / 10.0; // round to 1 decimal

Check warning on line 321 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L320-L321

Added lines #L320 - L321 were not covered by tests
}
}

static void scap_linux_get_container_memory_used(uint64_t *container_memory_used)

Check warning on line 325 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L325

Added line #L325 was not covered by tests
{
/* In Kubernetes `container_memory_working_set_bytes` is the memory measure the OOM killer uses
* and values from `/sys/fs/cgroup/memory/memory.usage_in_bytes` are close enough.
*
* Please note that `kubectl top pod` numbers would reflect the sum of containers in a pod and
* typically libs clients (e.g. Falco) pods contain sidekick containers that use memory as well.
* This metric accounts only for the container with the security monitoring agent running.
*/
const char* filepath = getenv(SCAP_AGENT_CGROUP_MEM_PATH_ENV_VAR);

Check warning on line 334 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L334

Added line #L334 was not covered by tests
if (filepath == NULL)
{
// No need for scap_get_host_root since we look at the container pid namespace (if applicable)
// Known collision for VM memory usage, but this default value is configurable
filepath = "/sys/fs/cgroup/memory/memory.usage_in_bytes";

Check warning on line 339 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L339

Added line #L339 was not covered by tests
}

FILE* f = fopen(filepath, "r");

Check warning on line 342 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L342

Added line #L342 was not covered by tests
if(!f)
{
return;
}

/* memory size returned in bytes */
int fscanf_matched = fscanf(f, "%" SCNu64, container_memory_used);

Check warning on line 349 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L349

Added line #L349 was not covered by tests
if (fscanf_matched != 1)
{
*container_memory_used = 0;

Check warning on line 352 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L352

Added line #L352 was not covered by tests
}

fclose(f);

Check warning on line 355 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L355

Added line #L355 was not covered by tests

return;

Check warning on line 357 in userspace/libscap/linux/scap_linux_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/linux/scap_linux_platform.c#L357

Added line #L357 was not covered by tests
}

struct scap_metrics_vtable scap_linux_metrics_vtable = {
.get_rss_vsz_pss_total_memory_and_open_fds = scap_linux_get_rss_vsz_pss_total_memory_and_open_fds,
.get_cpu_usage_and_total_procs = scap_linux_get_cpu_usage_and_total_procs,
.get_container_memory_used = scap_linux_get_container_memory_used,
};

struct scap_platform* scap_linux_alloc_platform(proc_entry_callback proc_callback, void* proc_callback_context)
{
struct scap_linux_platform* platform = calloc(1, sizeof(*platform));
Expand All @@ -132,6 +374,7 @@ struct scap_platform* scap_linux_alloc_platform(proc_entry_callback proc_callbac

struct scap_platform* generic = &platform->m_generic;
generic->m_vtable = &scap_linux_platform_vtable;
generic->m_metrics_vtable = &scap_linux_metrics_vtable;

init_proclist(&generic->m_proclist, proc_callback, proc_callback_context);

Expand Down
29 changes: 29 additions & 0 deletions userspace/libscap/scap_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,34 @@ struct scap_platform_vtable scap_generic_platform_vtable = {
.free_platform = scap_generic_free_platform,
};

static void scap_generic_get_rss_vsz_pss_total_memory_and_open_fds(uint32_t *rss, uint32_t *vsz, uint32_t *pss, uint64_t *host_memory_used, uint64_t *host_open_fds)

Check warning on line 73 in userspace/libscap/scap_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/scap_platform.c#L73

Added line #L73 was not covered by tests
{
*rss = 0;
*vsz = 0;
*pss = 0;
*host_memory_used = 0;
*host_open_fds = 0;

Check warning on line 79 in userspace/libscap/scap_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/scap_platform.c#L75-L79

Added lines #L75 - L79 were not covered by tests
}

static void scap_generic_get_cpu_usage_and_total_procs(double start_time, double *cpu_usage_perc, double *host_cpu_usage_perc, uint32_t *host_procs_running)

Check warning on line 82 in userspace/libscap/scap_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/scap_platform.c#L82

Added line #L82 was not covered by tests
{
*cpu_usage_perc = 0;
*host_cpu_usage_perc = 0;
*host_procs_running = 0;

Check warning on line 86 in userspace/libscap/scap_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/scap_platform.c#L84-L86

Added lines #L84 - L86 were not covered by tests
}

static void scap_generic_get_container_memory_used(uint64_t *container_memory_used)

Check warning on line 89 in userspace/libscap/scap_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/scap_platform.c#L89

Added line #L89 was not covered by tests
{
*container_memory_used = 0;
return;

Check warning on line 92 in userspace/libscap/scap_platform.c

View check run for this annotation

Codecov / codecov/patch

userspace/libscap/scap_platform.c#L91-L92

Added lines #L91 - L92 were not covered by tests
}

struct scap_metrics_vtable scap_generic_metrics_vtable = {
.get_rss_vsz_pss_total_memory_and_open_fds = scap_generic_get_rss_vsz_pss_total_memory_and_open_fds,
.get_cpu_usage_and_total_procs = scap_generic_get_cpu_usage_and_total_procs,
.get_container_memory_used = scap_generic_get_container_memory_used,
};

struct scap_platform* scap_generic_alloc_platform(proc_entry_callback proc_callback, void* proc_callback_context)
{
struct scap_platform* platform = calloc(1, sizeof(*platform));
Expand All @@ -80,6 +108,7 @@ struct scap_platform* scap_generic_alloc_platform(proc_entry_callback proc_callb
}

platform->m_vtable = &scap_generic_platform_vtable;
platform->m_metrics_vtable = &scap_generic_metrics_vtable;

init_proclist(&platform->m_proclist, proc_callback, proc_callback_context);

Expand Down
9 changes: 9 additions & 0 deletions userspace/libscap/scap_platform_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ struct scap_platform_vtable
void (*free_platform)(struct scap_platform* platform);
};

struct scap_metrics_vtable
{
void (*get_rss_vsz_pss_total_memory_and_open_fds)(uint32_t *rss, uint32_t *vsz, uint32_t *pss, uint64_t *host_memory_used, uint64_t *host_open_fds);
void (*get_cpu_usage_and_total_procs)(double start_time, double *cpu_usage_perc, double *host_cpu_usage_perc, uint32_t *host_procs_running);
void (*get_container_memory_used)(uint64_t *container_memory_used);
};

// the parts of the platform struct shared across all implementations
// this *must* be the first member of all implementations
// (the pointers are cast back&forth between the two)
Expand All @@ -89,6 +96,8 @@ struct scap_platform
scap_agent_info m_agent_info;
scap_machine_info m_machine_info;
struct ppm_proclist_info* m_driver_procinfo;

const struct scap_metrics_vtable* m_metrics_vtable;
};

#ifdef __cplusplus
Expand Down
5 changes: 0 additions & 5 deletions userspace/libsinsp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,6 @@ if (BUILD_LIBSINSP_EXAMPLES)
add_subdirectory(sinsp_debug)
endif()

if(NOT DEFINED SINSP_AGENT_CGROUP_MEM_PATH_ENV_VAR)
set(SINSP_AGENT_CGROUP_MEM_PATH_ENV_VAR "AGENT_CGROUP_MEM_PATH")
endif()
add_definitions(-DSINSP_AGENT_CGROUP_MEM_PATH_ENV_VAR="${SINSP_AGENT_CGROUP_MEM_PATH_ENV_VAR}")

# Build our pkg-config "Libs:" flags. For now, loop over SINSP_PKGCONFIG_LIBRARIES. If
# we ever start using pkg_search_module or pkg_check_modules in cmake/modules
# we could add each module to our "Requires:" line instead. We might need to
Expand Down
Loading

0 comments on commit cd54b89

Please sign in to comment.