diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-25 14:45:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-25 14:48:03 +0000 |
commit | e55403ed71282d7bfd8b56df219de3c28a8af064 (patch) | |
tree | 524889e5becb81643bf8741e3082955dca076f09 /src/daemon/h2o-common.c | |
parent | Releasing debian version 1.47.5-1. (diff) | |
download | netdata-e55403ed71282d7bfd8b56df219de3c28a8af064.tar.xz netdata-e55403ed71282d7bfd8b56df219de3c28a8af064.zip |
Merging upstream version 2.0.3+dfsg:
- does not include dygraphs anymore (Closes: #923993)
- does not include pako anymore (Closes: #1042533)
- does not include dashboard binaries anymore (Closes: #1045145)
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/daemon/h2o-common.c')
-rw-r--r-- | src/daemon/h2o-common.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/daemon/h2o-common.c b/src/daemon/h2o-common.c new file mode 100644 index 000000000..aa7a3c581 --- /dev/null +++ b/src/daemon/h2o-common.c @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "common.h" + +const char *netdata_configured_hostname = NULL; +const char *netdata_configured_user_config_dir = CONFIG_DIR; +const char *netdata_configured_stock_config_dir = LIBCONFIG_DIR; +const char *netdata_configured_log_dir = LOG_DIR; +const char *netdata_configured_primary_plugins_dir = PLUGINS_DIR; +const char *netdata_configured_web_dir = WEB_DIR; +const char *netdata_configured_cache_dir = CACHE_DIR; +const char *netdata_configured_varlib_dir = VARLIB_DIR; +const char *netdata_configured_lock_dir = VARLIB_DIR "/lock"; +const char *netdata_configured_cloud_dir = VARLIB_DIR "/cloud.d"; +const char *netdata_configured_home_dir = VARLIB_DIR; +const char *netdata_configured_host_prefix = NULL; +const char *netdata_configured_timezone = NULL; +const char *netdata_configured_abbrev_timezone = NULL; +int32_t netdata_configured_utc_offset = 0; + +bool netdata_ready = false; + +long get_netdata_cpus(void) { + static long processors = 0; + + if(processors) + return processors; + + long cores_proc_stat = os_get_system_cpus_cached(false, true); + long cores_cpuset_v1 = (long)os_read_cpuset_cpus("/sys/fs/cgroup/cpuset/cpuset.cpus", cores_proc_stat); + long cores_cpuset_v2 = (long)os_read_cpuset_cpus("/sys/fs/cgroup/cpuset.cpus", cores_proc_stat); + + if(cores_cpuset_v2) + processors = cores_cpuset_v2; + else if(cores_cpuset_v1) + processors = cores_cpuset_v1; + else + processors = cores_proc_stat; + + long cores_user_configured = config_get_number(CONFIG_SECTION_GLOBAL, "cpu cores", processors); + + errno_clear(); + internal_error(true, + "System CPUs: %ld, (" + "system: %ld, cgroups cpuset v1: %ld, cgroups cpuset v2: %ld, netdata.conf: %ld" + ")" + , processors + , cores_proc_stat + , cores_cpuset_v1 + , cores_cpuset_v2 + , cores_user_configured + ); + + processors = cores_user_configured; + + if(processors < 1) + processors = 1; + + return processors; +} |