summaryrefslogtreecommitdiffstats
path: root/libnetdata/os.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-20 04:50:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-20 04:50:01 +0000
commitcd4377fab21e0f500bef7f06543fa848a039c1e0 (patch)
treeba00a55e430c052d6bed0b61c0f8bbe8ebedd313 /libnetdata/os.c
parentReleasing debian version 1.40.1-1. (diff)
downloadnetdata-cd4377fab21e0f500bef7f06543fa848a039c1e0.tar.xz
netdata-cd4377fab21e0f500bef7f06543fa848a039c1e0.zip
Merging upstream version 1.41.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnetdata/os.c')
-rw-r--r--libnetdata/os.c36
1 files changed, 18 insertions, 18 deletions
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;