diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2022-08-05 15:07:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-05 15:07:46 +0000 |
commit | b8eaf108538615e45346ba8edec6a2fcce16298e (patch) | |
tree | 049ec79e83448d38d6b9694c27e2004dbdfe1ef1 /libnetdata/ebpf | |
parent | 4b115f20b4ec20ff29d7f506f23d7afb83c6f88f (diff) |
Remove SIGSEGV and SIGABRT (ebpf.plugin) (#13407)
Diffstat (limited to 'libnetdata/ebpf')
-rw-r--r-- | libnetdata/ebpf/ebpf.c | 4 | ||||
-rw-r--r-- | libnetdata/ebpf/ebpf.h | 47 |
2 files changed, 48 insertions, 3 deletions
diff --git a/libnetdata/ebpf/ebpf.c b/libnetdata/ebpf/ebpf.c index ffb602307c..c48f2f24ec 100644 --- a/libnetdata/ebpf/ebpf.c +++ b/libnetdata/ebpf/ebpf.c @@ -608,7 +608,7 @@ static void ebpf_update_maps(ebpf_module_t *em, struct bpf_object *obj) void ebpf_update_controller(int fd, ebpf_module_t *em) { uint32_t key = NETDATA_CONTROLLER_APPS_ENABLED; - uint32_t value = em->apps_charts | em->cgroup_charts; + uint32_t value = (em->apps_charts & NETDATA_EBPF_APPS_FLAG_YES) | em->cgroup_charts; int ret = bpf_map_update_elem(fd, &key, &value, 0); if (ret) error("Add key(%u) for controller table failed.", key); @@ -969,7 +969,7 @@ void ebpf_update_module_using_config(ebpf_module_t *modules) EBPF_CFG_UPDATE_EVERY, modules->update_every); modules->apps_charts = appconfig_get_boolean(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_APPLICATION, - modules->apps_charts); + (int) (modules->apps_charts & NETDATA_EBPF_APPS_FLAG_YES)); modules->cgroup_charts = appconfig_get_boolean(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_CGROUP, modules->cgroup_charts); diff --git a/libnetdata/ebpf/ebpf.h b/libnetdata/ebpf/ebpf.h index 0173ad281a..55b68a51e9 100644 --- a/libnetdata/ebpf/ebpf.h +++ b/libnetdata/ebpf/ebpf.h @@ -213,6 +213,12 @@ typedef struct ebpf_plugin_stats { uint32_t trampolines; // Number of trampolines used } ebpf_plugin_stats_t; +typedef enum netdata_apps_integration_flags { + NETDATA_EBPF_APPS_FLAG_NO, + NETDATA_EBPF_APPS_FLAG_YES, + NETDATA_EBPF_APPS_FLAG_CHART_CREATED +} netdata_apps_integration_flags_t; + typedef struct ebpf_module { const char *thread_name; const char *config_name; @@ -220,7 +226,7 @@ typedef struct ebpf_module { void *(*start_routine)(void *); int update_every; int global_charts; - int apps_charts; + netdata_apps_integration_flags_t apps_charts; int cgroup_charts; netdata_run_mode_t mode; uint32_t thread_id; @@ -234,6 +240,8 @@ typedef struct ebpf_module { uint64_t kernels; netdata_ebpf_load_mode_t load; netdata_ebpf_targets_t *targets; + struct bpf_link **probe_links; + struct bpf_object *objects; } ebpf_module_t; extern int ebpf_get_kernel_version(); @@ -267,6 +275,43 @@ typedef struct netdata_ebpf_histogram { uint64_t histogram[NETDATA_EBPF_HIST_MAX_BINS]; } netdata_ebpf_histogram_t; +typedef struct ebpf_filesystem_partitions { + char *filesystem; + char *optional_filesystem; + char *family; + char *family_name; + struct bpf_object *objects; + struct bpf_link **probe_links; + + netdata_ebpf_histogram_t hread; + netdata_ebpf_histogram_t hwrite; + netdata_ebpf_histogram_t hopen; + netdata_ebpf_histogram_t hadditional; + + uint32_t flags; + uint32_t enabled; + + ebpf_addresses_t addresses; + uint64_t kernels; +} ebpf_filesystem_partitions_t; + +typedef struct ebpf_sync_syscalls { + char *syscall; + int enabled; + uint32_t flags; + + // BTF structure + struct bpf_object *objects; + struct bpf_link **probe_links; + + // BPF structure +#ifdef LIBBPF_MAJOR_VERSION + struct sync_bpf *sync_obj; +#else + void *sync_obj; +#endif +} ebpf_sync_syscalls_t; + extern void ebpf_histogram_dimension_cleanup(char **ptr, size_t length); // Tracepoint helpers |