From ab1bb5b7f1c3c3a7b240ab7fc8661459ecd7decb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 20 Jul 2023 06:49:55 +0200 Subject: Adding upstream version 1.41.0. Signed-off-by: Daniel Baumann --- libnetdata/os.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'libnetdata/os.c') diff --git a/libnetdata/os.c b/libnetdata/os.c index 133c02248..e6475a453 100644 --- a/libnetdata/os.c +++ b/libnetdata/os.c @@ -36,7 +36,7 @@ long get_system_cpus_with_cache(bool cache, bool for_netdata) { processors[index] = 1; if(error) - error("Assuming system has %d processors.", processors[index]); + netdata_log_error("Assuming system has %d processors.", processors[index]); } return processors[index]; @@ -49,14 +49,14 @@ long get_system_cpus_with_cache(bool cache, bool for_netdata) { procfile *ff = procfile_open(filename, NULL, PROCFILE_FLAG_DEFAULT); if(!ff) { processors[index] = 1; - error("Cannot open file '%s'. Assuming system has %ld processors.", filename, processors[index]); + netdata_log_error("Cannot open file '%s'. Assuming system has %ld processors.", filename, processors[index]); return processors[index]; } ff = procfile_readall(ff); if(!ff) { processors[index] = 1; - error("Cannot open file '%s'. Assuming system has %ld processors.", filename, processors[index]); + netdata_log_error("Cannot open file '%s'. Assuming system has %ld processors.", filename, processors[index]); return processors[index]; } @@ -75,7 +75,7 @@ long get_system_cpus_with_cache(bool cache, bool for_netdata) { if(processors[index] < 1) processors[index] = 1; - debug(D_SYSTEM, "System has %ld processors.", processors[index]); + netdata_log_debug(D_SYSTEM, "System has %ld processors.", processors[index]); return processors[index]; #endif /* __APPLE__, __FreeBSD__ */ @@ -93,7 +93,7 @@ pid_t get_system_pid_max(void) { if (unlikely(GETSYSCTL_BY_NAME("kern.pid_max", tmp_pid_max))) { pid_max = 99999; - error("Assuming system's maximum pid is %d.", pid_max); + netdata_log_error("Assuming system's maximum pid is %d.", pid_max); } else { pid_max = tmp_pid_max; } @@ -110,12 +110,12 @@ pid_t get_system_pid_max(void) { unsigned long long max = 0; if(read_single_number_file(filename, &max) != 0) { - error("Cannot open file '%s'. Assuming system supports %d pids.", filename, pid_max); + netdata_log_error("Cannot open file '%s'. Assuming system supports %d pids.", filename, pid_max); return pid_max; } if(!max) { - error("Cannot parse file '%s'. Assuming system supports %d pids.", filename, pid_max); + netdata_log_error("Cannot parse file '%s'. Assuming system supports %d pids.", filename, pid_max); return pid_max; } @@ -130,7 +130,7 @@ void get_system_HZ(void) { long ticks; if ((ticks = sysconf(_SC_CLK_TCK)) == -1) { - error("Cannot get system clock ticks"); + netdata_log_error("Cannot get system clock ticks"); } system_hz = (unsigned int) ticks; @@ -197,11 +197,11 @@ int getsysctl_by_name(const char *name, void *ptr, size_t len) { size_t nlen = len; if (unlikely(sysctlbyname(name, ptr, &nlen, NULL, 0) == -1)) { - error("FREEBSD: sysctl(%s...) failed: %s", name, strerror(errno)); + netdata_log_error("FREEBSD: sysctl(%s...) failed: %s", name, strerror(errno)); return 1; } if (unlikely(nlen != len)) { - error("FREEBSD: sysctl(%s...) expected %lu, got %lu", name, (unsigned long)len, (unsigned long)nlen); + netdata_log_error("FREEBSD: sysctl(%s...) expected %lu, got %lu", name, (unsigned long)len, (unsigned long)nlen); return 1; } return 0; @@ -215,11 +215,11 @@ int getsysctl_simple(const char *name, int *mib, size_t miblen, void *ptr, size_ return 1; if (unlikely(sysctl(mib, miblen, ptr, &nlen, NULL, 0) == -1)) { - error("FREEBSD: sysctl(%s...) failed: %s", name, strerror(errno)); + netdata_log_error("FREEBSD: sysctl(%s...) failed: %s", name, strerror(errno)); return 1; } if (unlikely(nlen != len)) { - error("FREEBSD: sysctl(%s...) expected %lu, got %lu", name, (unsigned long)len, (unsigned long)nlen); + netdata_log_error("FREEBSD: sysctl(%s...) expected %lu, got %lu", name, (unsigned long)len, (unsigned long)nlen); return 1; } @@ -234,11 +234,11 @@ int getsysctl(const char *name, int *mib, size_t miblen, void *ptr, size_t *len) return 1; if (unlikely(sysctl(mib, miblen, ptr, len, NULL, 0) == -1)) { - error("FREEBSD: sysctl(%s...) failed: %s", name, strerror(errno)); + netdata_log_error("FREEBSD: sysctl(%s...) failed: %s", name, strerror(errno)); return 1; } if (unlikely(ptr != NULL && nlen != *len)) { - error("FREEBSD: sysctl(%s...) expected %lu, got %lu", name, (unsigned long)*len, (unsigned long)nlen); + netdata_log_error("FREEBSD: sysctl(%s...) expected %lu, got %lu", name, (unsigned long)*len, (unsigned long)nlen); return 1; } @@ -249,11 +249,11 @@ int getsysctl_mib(const char *name, int *mib, size_t len) { size_t nlen = len; if (unlikely(sysctlnametomib(name, mib, &nlen) == -1)) { - error("FREEBSD: sysctl(%s...) failed: %s", name, strerror(errno)); + netdata_log_error("FREEBSD: sysctl(%s...) failed: %s", name, strerror(errno)); return 1; } if (unlikely(nlen != len)) { - error("FREEBSD: sysctl(%s...) expected %lu, got %lu", name, (unsigned long)len, (unsigned long)nlen); + netdata_log_error("FREEBSD: sysctl(%s...) expected %lu, got %lu", name, (unsigned long)len, (unsigned long)nlen); return 1; } return 0; @@ -274,11 +274,11 @@ int getsysctl_by_name(const char *name, void *ptr, size_t len) { size_t nlen = len; if (unlikely(sysctlbyname(name, ptr, &nlen, NULL, 0) == -1)) { - error("MACOS: sysctl(%s...) failed: %s", name, strerror(errno)); + netdata_log_error("MACOS: sysctl(%s...) failed: %s", name, strerror(errno)); return 1; } if (unlikely(nlen != len)) { - error("MACOS: sysctl(%s...) expected %lu, got %lu", name, (unsigned long)len, (unsigned long)nlen); + netdata_log_error("MACOS: sysctl(%s...) expected %lu, got %lu", name, (unsigned long)len, (unsigned long)nlen); return 1; } return 0; -- cgit v1.2.3