diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2021-02-25 16:17:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-25 16:17:36 +0000 |
commit | 2bddc7a0f4ad406bf45f526a853b3d025839bc3b (patch) | |
tree | 88d38e782653dea812965005f993fc6cca4cb116 /libnetdata | |
parent | 01a978b1b64491ce65843624450aae7bc9da714e (diff) |
Ebpf support new collectors (#10680)
Extend original support from kprobe for all available eBPF programs and allow `eBPF.plugin` to use some Netdata features.
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/ebpf/ebpf.c | 4 | ||||
-rw-r--r-- | libnetdata/ebpf/ebpf.h | 1 |
2 files changed, 4 insertions, 1 deletions
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 |