From 2bddc7a0f4ad406bf45f526a853b3d025839bc3b Mon Sep 17 00:00:00 2001 From: thiagoftsm Date: Thu, 25 Feb 2021 16:17:36 +0000 Subject: Ebpf support new collectors (#10680) Extend original support from kprobe for all available eBPF programs and allow `eBPF.plugin` to use some Netdata features. --- libnetdata/ebpf/ebpf.c | 4 +++- libnetdata/ebpf/ebpf.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'libnetdata') diff --git a/libnetdata/ebpf/ebpf.c b/libnetdata/ebpf/ebpf.c index a9ff21f693..4af5182249 100644 --- a/libnetdata/ebpf/ebpf.c +++ b/libnetdata/ebpf/ebpf.c @@ -295,7 +295,9 @@ struct bpf_link **ebpf_load_program(char *plugins_dir, ebpf_module_t *em, char * return NULL; snprintf(lpath, 4096, "%s/%s", plugins_dir, lname); - if (bpf_prog_load(lpath, BPF_PROG_TYPE_KPROBE, obj, &prog_fd)) { + // We are using BPF_PROG_TYPE_UNSPEC instead a specific type for bpf_prog_load to define the type + // according the eBPF program loaded + if (bpf_prog_load(lpath, BPF_PROG_TYPE_UNSPEC, obj, &prog_fd)) { em->enabled = CONFIG_BOOLEAN_NO; info("Cannot load program: %s", lpath); return NULL; diff --git a/libnetdata/ebpf/ebpf.h b/libnetdata/ebpf/ebpf.h index d4faccffd2..7ff5c48bd8 100644 --- a/libnetdata/ebpf/ebpf.h +++ b/libnetdata/ebpf/ebpf.h @@ -87,6 +87,7 @@ typedef struct ebpf_module { netdata_run_mode_t mode; uint32_t thread_id; int optional; + void (*apps_routine)(struct ebpf_module *em, void *ptr); } ebpf_module_t; #define NETDATA_MAX_PROBES 64 -- cgit v1.2.3