// SPDX-License-Identifier: GPL-3.0-or-later
#include <sys/time.h>
#include <sys/resource.h>
#include <ifaddrs.h>
#include "ebpf.h"
#include "ebpf_socket.h"
/*****************************************************************
*
* FUNCTIONS USED BY NETDATA
*
*****************************************************************/
// callback required by eval()
int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result)
{
UNUSED(variable);
UNUSED(hash);
UNUSED(rc);
UNUSED(result);
return 0;
};
void send_statistics(const char *action, const char *action_result, const char *action_data)
{
UNUSED(action);
UNUSED(action_result);
UNUSED(action_data);
}
// 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);
}
// ----------------------------------------------------------------------
/*****************************************************************
*
* GLOBAL VARIABLES
*
*****************************************************************/
char *ebpf_plugin_dir = PLUGINS_DIR;
static char *ebpf_configured_log_dir = LOG_DIR;
char *ebpf_algorithms[] = {"absolute", "incremental"};
int update_every = 1;
static int thread_finished = 0;
int close_ebpf_plugin = 0;
struct config collector_config = { .first_section = NULL,
.last_section = NULL,
.mutex = NETDATA_MUTEX_INITIALIZER,
.index = { .avl_tree = { .root = NULL, .compar = appconfig_section_compare },
.rwlock = AVL_LOCK_INITIALIZER } };
int running_on_kernel = 0;
char kernel_string[64];
int ebpf_nprocs;
static int isrh;
uint32_t finalized_threads = 1;
pthread_mutex_t lock;
pthread_mutex_t collect_data_mutex;
pthread_cond_t collect_data_cond_var;
ebpf_module_t ebpf_modules[] = {
{ .thread_name = "process", .config_name = "process", .enabled = 0, .start_routine = ebpf_process_thread,
.update_time = 1, .global_charts = 1, .apps_charts = 1, .mode = MODE_ENTRY,
.optional = 0, .apps_routine = ebpf_process_create_apps_charts },
{ .thread_name = "socket", .config_name = "socket", .enabled = 0, .start_routine = ebpf_socket_thread,
.update_time = 1,