// SPDX-License-Identifier: GPL-3.0-or-later
#include <sys/time.h>
#include <sys/resource.h>
#include "ebpf.h"
// callback required by eval()
int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result) {
(void)variable;
(void)hash;
(void)rc;
(void)result;
return 0;
};
void send_statistics( const char *action, const char *action_result, const char *action_data) {
(void) action;
(void) action_result;
(void) action_data;
return;
}
// callbacks required by popen()
void signals_block(void) {};
void signals_unblock(void) {};
void signals_reset(void) {};
// required by get_system_cpus()
char *netdata_configured_host_prefix = "";
// callback required by fatal()
void netdata_cleanup_and_exit(int ret) {
exit(ret);
}
// ----------------------------------------------------------------------
//Netdata eBPF library
void *libnetdata = NULL;
int (*load_bpf_file)(char *, int) = NULL;
int (*set_bpf_perf_event)(int, int);
int (*perf_event_unmap)(struct perf_event_mmap_page *, size_t);
int (*perf_event_mmap_header)(int, struct perf_event_mmap_page **, int);
void (*netdata_perf_loop_multi)(int *, struct perf_event_mmap_page **, int, int *, int (*nsb)(void *, int), int);
int *map_fd = NULL;
//Perf event variables
static int pmu_fd[NETDATA_MAX_PROCESSOR];
static struct perf_event_mmap_page *headers[NETDATA_MAX_PROCESSOR];
int page_cnt = 8;
//Libbpf (It is necessary to have at least kernel 4.10)
int (*bpf_map_lookup_elem)(int, const void *, void *);
static char *plugin_dir = PLUGINS_DIR;
static char *user_config_dir = CONFIG_DIR;
static char *stock_config_dir = LIBCONFIG_DIR;
static char *netdata_configured_log_dir = LOG_DIR;
FILE *developer_log = NULL;
//Global vectors
netdata_syscall_stat_t *aggregated_data = NULL;
netdata_publish_syscall_t *publish_aggregated = NULL;
static int update_every = 1;
static int thread_finished = 0;
static int close_plugin = 0;
static netdata_run_mode_t mode = MODE_ENTRY;
static int debug_log = 0;
static int use_stdout = 0;
struct config collector_config;
static int mykernel = 0;
static int nprocs;
static int isrh;
netdata_idx_t *