X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=src%2Fcommon.c;h=72412baae286abb540b85fa44bf7543151a4b39b;hb=de8ce5a5c2efca032c02374391f48e0a9a7fe8d0;hp=57bcaaab5d73f28c30552e08c237cc0ed8677996;hpb=1bd032834799666cc6b123cf770e3a23a03dcb4c;p=netdata.git diff --git a/src/common.c b/src/common.c index 57bcaaab..72412baa 100644 --- a/src/common.c +++ b/src/common.c @@ -8,10 +8,21 @@ # define MADV_DONTFORK INHERIT_NONE #endif /* __FreeBSD__ || __APPLE__*/ -char *global_host_prefix = ""; +char *netdata_configured_hostname = NULL; +char *netdata_configured_config_dir = NULL; +char *netdata_configured_log_dir = NULL; +char *netdata_configured_plugins_dir = NULL; +char *netdata_configured_web_dir = NULL; +char *netdata_configured_cache_dir = NULL; +char *netdata_configured_varlib_dir = NULL; +char *netdata_configured_home_dir = NULL; +char *netdata_configured_host_prefix = NULL; + int enable_ksm = 1; volatile sig_atomic_t netdata_exit = 0; +const char *os_type = NETDATA_OS_TYPE; +const char *program_version = VERSION; // ---------------------------------------------------------------------------- // memory allocation functions that handle failures @@ -1093,7 +1104,7 @@ long get_system_cpus(void) { #ifdef __APPLE__ int32_t tmp_processors; - if (unlikely(GETSYSCTL("hw.logicalcpu", tmp_processors))) { + if (unlikely(GETSYSCTL_BY_NAME("hw.logicalcpu", tmp_processors))) { error("Assuming system has %d processors.", processors); } else { processors = tmp_processors; @@ -1103,7 +1114,7 @@ long get_system_cpus(void) { #elif __FreeBSD__ int32_t tmp_processors; - if (unlikely(GETSYSCTL("hw.ncpu", tmp_processors))) { + if (unlikely(GETSYSCTL_BY_NAME("hw.ncpu", tmp_processors))) { error("Assuming system has %d processors.", processors); } else { processors = tmp_processors; @@ -1113,7 +1124,7 @@ long get_system_cpus(void) { #else char filename[FILENAME_MAX + 1]; - snprintfz(filename, FILENAME_MAX, "%s/proc/stat", global_host_prefix); + snprintfz(filename, FILENAME_MAX, "%s/proc/stat", netdata_configured_host_prefix); procfile *ff = procfile_open(filename, NULL, PROCFILE_FLAG_DEFAULT); if(!ff) { @@ -1155,7 +1166,7 @@ pid_t get_system_pid_max(void) { #elif __FreeBSD__ int32_t tmp_pid_max; - if (unlikely(GETSYSCTL("kern.pid_max", tmp_pid_max))) { + if (unlikely(GETSYSCTL_BY_NAME("kern.pid_max", tmp_pid_max))) { pid_max = 99999; error("Assuming system's maximum pid is %d.", pid_max); } else { @@ -1170,7 +1181,7 @@ pid_t get_system_pid_max(void) { read = 1; char filename[FILENAME_MAX + 1]; - snprintfz(filename, FILENAME_MAX, "%s/proc/sys/kernel/pid_max", global_host_prefix); + snprintfz(filename, FILENAME_MAX, "%s/proc/sys/kernel/pid_max", netdata_configured_host_prefix); unsigned long long max = 0; if(read_single_number_file(filename, &max) != 0) {