diff options
author | Costa Tsaousis <costa@tsaousis.gr> | 2018-10-17 17:18:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-17 17:18:59 +0300 |
commit | ca4c305969e4fdfd2ceea3b8b93c32ad74ebf66d (patch) | |
tree | 7895ed67c0453de6635ab1f8faf98923da813576 /libnetdata/config | |
parent | ad3ff17ac19546d24812daa6f0eca62301e296fa (diff) |
moved stream.conf initialization after log files have been open; fixes #4403 (#4422)
Diffstat (limited to 'libnetdata/config')
-rw-r--r-- | libnetdata/config/appconfig.c | 27 | ||||
-rw-r--r-- | libnetdata/config/appconfig.h | 25 |
2 files changed, 2 insertions, 50 deletions
diff --git a/libnetdata/config/appconfig.c b/libnetdata/config/appconfig.c index 079891725b..4115384465 100644 --- a/libnetdata/config/appconfig.c +++ b/libnetdata/config/appconfig.c @@ -42,31 +42,6 @@ struct section { // readers are protected using the rwlock in avl_tree_lock }; -static int appconfig_section_compare(void *a, void *b); - -struct config netdata_config = { - .sections = NULL, - .mutex = NETDATA_MUTEX_INITIALIZER, - .index = { - .avl_tree = { - .root = NULL, - .compar = appconfig_section_compare - }, - .rwlock = AVL_LOCK_INITIALIZER - } -}; - -struct config stream_config = { - .sections = NULL, - .mutex = NETDATA_MUTEX_INITIALIZER, - .index = { - .avl_tree = { - .root = NULL, - .compar = appconfig_section_compare - }, - .rwlock = AVL_LOCK_INITIALIZER - } -}; // ---------------------------------------------------------------------------- // locking @@ -112,7 +87,7 @@ static struct config_option *appconfig_option_index_find(struct section *co, con // ---------------------------------------------------------------------------- // config sections index -static int appconfig_section_compare(void *a, void *b) { +int appconfig_section_compare(void *a, void *b) { if(((struct section *)a)->hash < ((struct section *)b)->hash) return -1; else if(((struct section *)a)->hash > ((struct section *)b)->hash) return 1; else return strcmp(((struct section *)a)->name, ((struct section *)b)->name); diff --git a/libnetdata/config/appconfig.h b/libnetdata/config/appconfig.h index bd37171e6c..ff30cd3217 100644 --- a/libnetdata/config/appconfig.h +++ b/libnetdata/config/appconfig.h @@ -102,10 +102,6 @@ struct config { avl_tree_lock index; }; -extern struct config - netdata_config, - stream_config; - #define CONFIG_BOOLEAN_NO 0 #define CONFIG_BOOLEAN_YES 1 @@ -132,25 +128,6 @@ extern int appconfig_move(struct config *root, const char *section_old, const ch extern void appconfig_generate(struct config *root, BUFFER *wb, int only_changed); -// ---------------------------------------------------------------------------- -// shortcuts for the default netdata configuration - -#define config_load(filename, overwrite_used) appconfig_load(&netdata_config, filename, overwrite_used) -#define config_get(section, name, default_value) appconfig_get(&netdata_config, section, name, default_value) -#define config_get_number(section, name, value) appconfig_get_number(&netdata_config, section, name, value) -#define config_get_float(section, name, value) appconfig_get_float(&netdata_config, section, name, value) -#define config_get_boolean(section, name, value) appconfig_get_boolean(&netdata_config, section, name, value) -#define config_get_boolean_ondemand(section, name, value) appconfig_get_boolean_ondemand(&netdata_config, section, name, value) - -#define config_set(section, name, default_value) appconfig_set(&netdata_config, section, name, default_value) -#define config_set_default(section, name, value) appconfig_set_default(&netdata_config, section, name, value) -#define config_set_number(section, name, value) appconfig_set_number(&netdata_config, section, name, value) -#define config_set_float(section, name, value) appconfig_set_float(&netdata_config, section, name, value) -#define config_set_boolean(section, name, value) appconfig_set_boolean(&netdata_config, section, name, value) - -#define config_exists(section, name) appconfig_exists(&netdata_config, section, name) -#define config_move(section_old, name_old, section_new, name_new) appconfig_move(&netdata_config, section_old, name_old, section_new, name_new) - -#define config_generate(buffer, only_changed) appconfig_generate(&netdata_config, buffer, only_changed) +extern int appconfig_section_compare(void *a, void *b); #endif /* NETDATA_CONFIG_H */ |