diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2021-08-11 19:12:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-11 19:12:44 +0000 |
commit | 5518445f5e69a8c88684f1dcb4e78ff0f425bad0 (patch) | |
tree | 5178c3c96862e48a199bfe20d3ffa71c3bab9c92 /libnetdata/ebpf | |
parent | f7b56a5f15d0a87fe3c8be7dc3030e30ad2f6abb (diff) |
Split eBPF programs (#11401)
Diffstat (limited to 'libnetdata/ebpf')
-rw-r--r-- | libnetdata/ebpf/ebpf.c | 16 | ||||
-rw-r--r-- | libnetdata/ebpf/ebpf.h | 1 |
2 files changed, 12 insertions, 5 deletions
diff --git a/libnetdata/ebpf/ebpf.c b/libnetdata/ebpf/ebpf.c index dc2b2cfa8a..7a873b3f4d 100644 --- a/libnetdata/ebpf/ebpf.c +++ b/libnetdata/ebpf/ebpf.c @@ -541,10 +541,16 @@ static netdata_run_mode_t ebpf_select_mode(char *mode) return MODE_ENTRY; } -void ebpf_update_module_using_config(ebpf_module_t *modules) +/** + * @param modules structure that will be updated + * @param user_cfg is this an user configuration? + */ +void ebpf_update_module_using_config(ebpf_module_t *modules, int user_cfg) { - char *mode = appconfig_get(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_LOAD_MODE, EBPF_CFG_LOAD_MODE_DEFAULT); - modules->mode = ebpf_select_mode(mode); + if (user_cfg) { + char *mode = appconfig_get(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_LOAD_MODE, EBPF_CFG_LOAD_MODE_DEFAULT); + modules->mode = ebpf_select_mode(mode); + } modules->update_time = (int)appconfig_get_number(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_UPDATE_EVERY, modules->update_time); @@ -571,15 +577,17 @@ void ebpf_update_module(ebpf_module_t *em) { char filename[FILENAME_MAX+1]; ebpf_mount_config_name(filename, FILENAME_MAX, ebpf_user_config_dir, em->config_file); + int from_user = 1; if (!ebpf_load_config(em->cfg, filename)) { ebpf_mount_config_name(filename, FILENAME_MAX, ebpf_stock_config_dir, em->config_file); + from_user = 0; if (!ebpf_load_config(em->cfg, filename)) { error("Cannot load the ebpf configuration file %s", em->config_file); return; } } - ebpf_update_module_using_config(em); + ebpf_update_module_using_config(em, from_user); } //---------------------------------------------------------------------------------------------------------------------- diff --git a/libnetdata/ebpf/ebpf.h b/libnetdata/ebpf/ebpf.h index 4d856372cb..d72465bf61 100644 --- a/libnetdata/ebpf/ebpf.h +++ b/libnetdata/ebpf/ebpf.h @@ -178,7 +178,6 @@ extern struct bpf_link **ebpf_load_program(char *plugins_dir, extern void ebpf_mount_config_name(char *filename, size_t length, char *path, const char *config); extern int ebpf_load_config(struct config *config, char *filename); -extern void ebpf_update_module_using_config(ebpf_module_t *modules); extern void ebpf_update_module(ebpf_module_t *em); extern void ebpf_update_names(ebpf_specify_name_t *opt, ebpf_module_t *em); extern void ebpf_load_addresses(ebpf_addresses_t *fa, int fd); |