summaryrefslogtreecommitdiffstats
path: root/collectors
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@netdata.cloud>2023-12-12 18:12:43 +0200
committerGitHub <noreply@github.com>2023-12-12 18:12:43 +0200
commitdc7ca8644fcca2cc7d2a165dd614d7f00bd8eb7e (patch)
treee52e7b6fffda64e13bf76f79dc072bcbab0a2ecf /collectors
parent21462af834abcdf136c53d21379e74b2c7306839 (diff)
code cleanup (#16542)
fixed minor code cleanup warnings
Diffstat (limited to 'collectors')
-rw-r--r--collectors/apps.plugin/apps_plugin.c6
-rw-r--r--collectors/cups.plugin/cups_plugin.c2
-rw-r--r--collectors/diskspace.plugin/plugin_diskspace.c4
-rw-r--r--collectors/ebpf.plugin/ebpf_cachestat.c4
-rw-r--r--collectors/ebpf.plugin/ebpf_fd.c4
-rw-r--r--collectors/ebpf.plugin/ebpf_filesystem.c2
-rw-r--r--collectors/ebpf.plugin/ebpf_process.c4
-rw-r--r--collectors/ebpf.plugin/ebpf_shm.c4
-rw-r--r--collectors/idlejitter.plugin/plugin_idlejitter.c4
-rw-r--r--collectors/perf.plugin/perf_plugin.c4
-rw-r--r--collectors/plugins.d/plugins_d.c94
-rw-r--r--collectors/plugins.d/pluginsd_parser.c87
-rw-r--r--collectors/proc.plugin/plugin_proc.c86
-rw-r--r--collectors/proc.plugin/proc_net_dev.c38
-rw-r--r--collectors/proc.plugin/proc_spl_kstat_zfs.c2
-rw-r--r--collectors/proc.plugin/sys_class_drm.c4
-rw-r--r--collectors/proc.plugin/sys_kernel_mm_ksm.c2
-rw-r--r--collectors/profile.plugin/plugin_profile.cc2
-rw-r--r--collectors/slabinfo.plugin/slabinfo.c11
-rw-r--r--collectors/systemd-journal.plugin/systemd-journal-files.c2
-rw-r--r--collectors/systemd-journal.plugin/systemd-journal.c2
21 files changed, 180 insertions, 188 deletions
diff --git a/collectors/apps.plugin/apps_plugin.c b/collectors/apps.plugin/apps_plugin.c
index a53457f187..3931dcd87f 100644
--- a/collectors/apps.plugin/apps_plugin.c
+++ b/collectors/apps.plugin/apps_plugin.c
@@ -704,7 +704,7 @@ int read_user_or_group_ids(struct user_or_group_ids *ids, struct timespec *last_
else {
if(unlikely(avl_insert(&ids->index, (avl_t *) user_or_group_id) != (void *) user_or_group_id)) {
netdata_log_error("INTERNAL ERROR: duplicate indexing of id during realloc");
- };
+ }
user_or_group_id->next = ids->root;
ids->root = user_or_group_id;
@@ -1239,11 +1239,11 @@ cleanup:
// each parameter is accessed only ONCE - so it is safe to pass function calls
// or other macros as parameters
-#define incremental_rate(rate_variable, last_kernel_variable, new_kernel_value, collected_usec, last_collected_usec) { \
+#define incremental_rate(rate_variable, last_kernel_variable, new_kernel_value, collected_usec, last_collected_usec) do { \
kernel_uint_t _new_tmp = new_kernel_value; \
(rate_variable) = (_new_tmp - (last_kernel_variable)) * (USEC_PER_SEC * RATES_DETAIL) / ((collected_usec) - (last_collected_usec)); \
(last_kernel_variable) = _new_tmp; \
- }
+ } while(0)
// the same macro for struct pid members
#define pid_incremental_rate(type, var, value) \
diff --git a/collectors/cups.plugin/cups_plugin.c b/collectors/cups.plugin/cups_plugin.c
index 827322066a..0eaae4ad25 100644
--- a/collectors/cups.plugin/cups_plugin.c
+++ b/collectors/cups.plugin/cups_plugin.c
@@ -175,7 +175,7 @@ struct job_metrics *get_job_metrics(char *dest) {
struct job_metrics new_job_metrics = { .id = ++job_id };
jm = dictionary_set(dict_dest_job_metrics, dest, &new_job_metrics, sizeof(struct job_metrics));
send_job_charts_definitions_to_netdata(dest, jm->id, false);
- };
+ }
return jm;
}
diff --git a/collectors/diskspace.plugin/plugin_diskspace.c b/collectors/diskspace.plugin/plugin_diskspace.c
index 94257810c3..af1d93ba76 100644
--- a/collectors/diskspace.plugin/plugin_diskspace.c
+++ b/collectors/diskspace.plugin/plugin_diskspace.c
@@ -148,7 +148,7 @@ static void add_basic_mountinfo(struct basic_mountinfo **root, struct mountinfo
bmi->next = *root;
*root = bmi;
-};
+}
static void free_basic_mountinfo(struct basic_mountinfo *bmi)
{
@@ -160,7 +160,7 @@ static void free_basic_mountinfo(struct basic_mountinfo *bmi)
freez(bmi);
}
-};
+}
static void free_basic_mountinfo_list(struct basic_mountinfo *root)
{
diff --git a/collectors/ebpf.plugin/ebpf_cachestat.c b/collectors/ebpf.plugin/ebpf_cachestat.c
index 5c079a7e14..59a631d4a7 100644
--- a/collectors/ebpf.plugin/ebpf_cachestat.c
+++ b/collectors/ebpf.plugin/ebpf_cachestat.c
@@ -559,8 +559,8 @@ static void ebpf_cachestat_exit(void *ptr)
ebpf_obsolete_cachestat_global(em);
#ifdef NETDATA_DEV_MODE
- if (ebpf_aral_cachestat_pid)
- ebpf_statistic_obsolete_aral_chart(em, cachestat_disable_priority);
+ if (ebpf_aral_cachestat_pid)
+ ebpf_statistic_obsolete_aral_chart(em, cachestat_disable_priority);
#endif
diff --git a/collectors/ebpf.plugin/ebpf_fd.c b/collectors/ebpf.plugin/ebpf_fd.c
index ec4c4ed658..8f7f5818f7 100644
--- a/collectors/ebpf.plugin/ebpf_fd.c
+++ b/collectors/ebpf.plugin/ebpf_fd.c
@@ -580,8 +580,8 @@ static void ebpf_fd_exit(void *ptr)
ebpf_obsolete_fd_global(em);
#ifdef NETDATA_DEV_MODE
- if (ebpf_aral_fd_pid)
- ebpf_statistic_obsolete_aral_chart(em, fd_disable_priority);
+ if (ebpf_aral_fd_pid)
+ ebpf_statistic_obsolete_aral_chart(em, fd_disable_priority);
#endif
diff --git a/collectors/ebpf.plugin/ebpf_filesystem.c b/collectors/ebpf.plugin/ebpf_filesystem.c
index b78e655324..b5c8982321 100644
--- a/collectors/ebpf.plugin/ebpf_filesystem.c
+++ b/collectors/ebpf.plugin/ebpf_filesystem.c
@@ -321,7 +321,7 @@ static inline int ebpf_fs_load_and_attach(ebpf_local_maps_t *map, struct filesys
ret = ebpf_fs_attach_kprobe(obj, functions);
if (!ret)
- map->map_fd = bpf_map__fd(obj->maps.tbl_fs);;
+ map->map_fd = bpf_map__fd(obj->maps.tbl_fs);
return ret;
}
diff --git a/collectors/ebpf.plugin/ebpf_process.c b/collectors/ebpf.plugin/ebpf_process.c
index 0cc77216e2..31b676cf6c 100644
--- a/collectors/ebpf.plugin/ebpf_process.c
+++ b/collectors/ebpf.plugin/ebpf_process.c
@@ -786,8 +786,8 @@ static void ebpf_process_exit(void *ptr)
ebpf_obsolete_process_global(em);
#ifdef NETDATA_DEV_MODE
- if (ebpf_aral_process_stat)
- ebpf_statistic_obsolete_aral_chart(em, process_disable_priority);
+ if (ebpf_aral_process_stat)
+ ebpf_statistic_obsolete_aral_chart(em, process_disable_priority);
#endif
fflush(stdout);
diff --git a/collectors/ebpf.plugin/ebpf_shm.c b/collectors/ebpf.plugin/ebpf_shm.c
index 381c482a43..fa8b08b380 100644
--- a/collectors/ebpf.plugin/ebpf_shm.c
+++ b/collectors/ebpf.plugin/ebpf_shm.c
@@ -479,8 +479,8 @@ static void ebpf_shm_exit(void *ptr)
ebpf_obsolete_shm_global(em);
#ifdef NETDATA_DEV_MODE
- if (ebpf_aral_shm_pid)
- ebpf_statistic_obsolete_aral_chart(em, shm_disable_priority);
+ if (ebpf_aral_shm_pid)
+ ebpf_statistic_obsolete_aral_chart(em, shm_disable_priority);
#endif
fflush(stdout);
diff --git a/collectors/idlejitter.plugin/plugin_idlejitter.c b/collectors/idlejitter.plugin/plugin_idlejitter.c
index d90548869f..f71c99ad13 100644
--- a/collectors/idlejitter.plugin/plugin_idlejitter.c
+++ b/collectors/idlejitter.plugin/plugin_idlejitter.c
@@ -68,9 +68,7 @@ void *cpuidlejitter_main(void *ptr) {
usec_t error = dt - sleep_ut;
error_total += error;
- if(unlikely(!iterations))
- error_min = error;
- else if(error < error_min)
+ if(unlikely(!iterations || error < error_min))
error_min = error;
if(error > error_max)
diff --git a/collectors/perf.plugin/perf_plugin.c b/collectors/perf.plugin/perf_plugin.c
index fe3b04daa6..4552bf6e42 100644
--- a/collectors/perf.plugin/perf_plugin.c
+++ b/collectors/perf.plugin/perf_plugin.c
@@ -35,8 +35,8 @@
#define RRD_FAMILY_SW "software"
#define RRD_FAMILY_CACHE "cache"
-#define NO_FD -1
-#define ALL_PIDS -1
+#define NO_FD (-1)
+#define ALL_PIDS (-1)
#define RUNNING_THRESHOLD 100
static int debug = 0;
diff --git a/collectors/plugins.d/plugins_d.c b/collectors/plugins.d/plugins_d.c
index 20061ad29c..0bcb3df632 100644
--- a/collectors/plugins.d/plugins_d.c
+++ b/collectors/plugins.d/plugins_d.c
@@ -140,67 +140,65 @@ static void pluginsd_worker_thread_handle_error(struct plugind *cd, int worker_r
static void *pluginsd_worker_thread(void *arg) {
worker_register("PLUGINSD");
- netdata_thread_cleanup_push(pluginsd_worker_thread_cleanup, arg);
+ netdata_thread_cleanup_push(pluginsd_worker_thread_cleanup, arg)
+ {
+ struct plugind *cd = (struct plugind *) arg;
+ plugin_set_running(cd);
- {
- struct plugind *cd = (struct plugind *) arg;
- plugin_set_running(cd);
+ size_t count = 0;
- size_t count = 0;
+ while(service_running(SERVICE_COLLECTORS)) {
+ FILE *fp_child_input = NULL;
+ FILE *fp_child_output = netdata_popen(cd->cmd, &cd->unsafe.pid, &fp_child_input);
- while(service_running(SERVICE_COLLECTORS)) {
- FILE *fp_child_input = NULL;
- FILE *fp_child_output = netdata_popen(cd->cmd, &cd->unsafe.pid, &fp_child_input);
-
- if(unlikely(!fp_child_input || !fp_child_output)) {
- netdata_log_error("PLUGINSD: 'host:%s', cannot popen(\"%s\", \"r\").",
- rrdhost_hostname(cd->host), cd->cmd);
- break;
- }
-
- nd_log(NDLS_DAEMON, NDLP_DEBUG,
- "PLUGINSD: 'host:%s' connected to '%s' running on pid %d",
- rrdhost_hostname(cd->host),
- cd->fullfilename, cd->unsafe.pid);
+ if(unlikely(!fp_child_input || !fp_child_output)) {
+ netdata_log_error("PLUGINSD: 'host:%s', cannot popen(\"%s\", \"r\").",
+ rrdhost_hostname(cd->host), cd->cmd);
+ break;
+ }
- const char *plugin = strrchr(cd->fullfilename, '/');
- if(plugin)
- plugin++;
- else
- plugin = cd->fullfilename;
+ nd_log(NDLS_DAEMON, NDLP_DEBUG,
+ "PLUGINSD: 'host:%s' connected to '%s' running on pid %d",
+ rrdhost_hostname(cd->host),
+ cd->fullfilename, cd->unsafe.pid);
- char module[100];
- snprintfz(module, sizeof(module), "plugins.d[%s]", plugin);
- ND_LOG_STACK lgs[] = {
- ND_LOG_FIELD_TXT(NDF_MODULE, module),
- ND_LOG_FIELD_TXT(NDF_NIDL_NODE, rrdhost_hostname(cd->host)),
- ND_LOG_FIELD_TXT(NDF_SRC_TRANSPORT, "pluginsd"),
- ND_LOG_FIELD_END(),
- };
- ND_LOG_STACK_PUSH(lgs);
+ const char *plugin = strrchr(cd->fullfilename, '/');
+ if(plugin)
+ plugin++;
+ else
+ plugin = cd->fullfilename;
- count = pluginsd_process(cd->host, cd, fp_child_input, fp_child_output, 0);
+ char module[100];
+ snprintfz(module, sizeof(module), "plugins.d[%s]", plugin);
+ ND_LOG_STACK lgs[] = {
+ ND_LOG_FIELD_TXT(NDF_MODULE, module),
+ ND_LOG_FIELD_TXT(NDF_NIDL_NODE, rrdhost_hostname(cd->host)),
+ ND_LOG_FIELD_TXT(NDF_SRC_TRANSPORT, "pluginsd"),
+ ND_LOG_FIELD_END(),
+ };
+ ND_LOG_STACK_PUSH(lgs);
- nd_log(NDLS_DAEMON, NDLP_DEBUG,
- "PLUGINSD: 'host:%s', '%s' (pid %d) disconnected after %zu successful data collections (ENDs).",
- rrdhost_hostname(cd->host), cd->fullfilename, cd->unsafe.pid, count);
+ count = pluginsd_process(cd->host, cd, fp_child_input, fp_child_output, 0);
- killpid(cd->unsafe.pid);
+ nd_log(NDLS_DAEMON, NDLP_DEBUG,
+ "PLUGINSD: 'host:%s', '%s' (pid %d) disconnected after %zu successful data collections (ENDs).",
+ rrdhost_hostname(cd->host), cd->fullfilename, cd->unsafe.pid, count);
- int worker_ret_code = netdata_pclose(fp_child_input, fp_child_output, cd->unsafe.pid);
+ killpid(cd->unsafe.pid);
- if(likely(worker_ret_code == 0))
- pluginsd_worker_thread_handle_success(cd);
- else
- pluginsd_worker_thread_handle_error(cd, worker_ret_code);
+ int worker_ret_code = netdata_pclose(fp_child_input, fp_child_output, cd->unsafe.pid);
- cd->unsafe.pid = 0;
+ if(likely(worker_ret_code == 0))
+ pluginsd_worker_thread_handle_success(cd);
+ else
+ pluginsd_worker_thread_handle_error(cd, worker_ret_code);
- if(unlikely(!plugin_is_enabled(cd)))
- break;
- }
- }
+ cd->unsafe.pid = 0;
+ if(unlikely(!plugin_is_enabled(cd)))
+ break;
+ }
+ }
netdata_thread_cleanup_pop(1);
return NULL;
}
diff --git a/collectors/plugins.d/pluginsd_parser.c b/collectors/plugins.d/pluginsd_parser.c
index 3b47c6c0fe..0620b69cf8 100644
--- a/collectors/plugins.d/pluginsd_parser.c
+++ b/collectors/plugins.d/pluginsd_parser.c
@@ -2945,56 +2945,53 @@ inline size_t pluginsd_process(RRDHOST *host, struct plugind *cd, FILE *fp_plugi
// this keeps the parser with its current value
// so, parser needs to be allocated before pushing it
- netdata_thread_cleanup_push(pluginsd_process_thread_cleanup, parser);
-
- {
- ND_LOG_STACK lgs[] = {
- ND_LOG_FIELD_CB(NDF_REQUEST, line_splitter_reconstruct_line, &parser->line),
- ND_LOG_FIELD_CB(NDF_NIDL_NODE, parser_reconstruct_node, parser),
- ND_LOG_FIELD_CB(NDF_NIDL_INSTANCE, parser_reconstruct_instance, parser),
- ND_LOG_FIELD_CB(NDF_NIDL_CONTEXT, parser_reconstruct_context, parser),
- ND_LOG_FIELD_END(),
- };
- ND_LOG_STACK_PUSH(lgs);
-
- buffered_reader_init(&parser->reader);
- BUFFER *buffer = buffer_create(sizeof(parser->reader.read_buffer) + 2, NULL);
- while(likely(service_running(SERVICE_COLLECTORS))) {
-
- if(unlikely(!buffered_reader_next_line(&parser->reader, buffer))) {
- buffered_reader_ret_t ret = buffered_reader_read_timeout(
- &parser->reader,
- fileno((FILE *) parser->fp_input),
- 2 * 60 * MSEC_PER_SEC, true
- );
-
- if(unlikely(ret != BUFFERED_READER_READ_OK))
- break;
-
- continue;
- }
-
- if(unlikely(parser_action(parser, buffer->buffer)))
- break;
+ netdata_thread_cleanup_push(pluginsd_process_thread_cleanup, parser)
+ {
+ ND_LOG_STACK lgs[] = {
+ ND_LOG_FIELD_CB(NDF_REQUEST, line_splitter_reconstruct_line, &parser->line),
+ ND_LOG_FIELD_CB(NDF_NIDL_NODE, parser_reconstruct_node, parser),
+ ND_LOG_FIELD_CB(NDF_NIDL_INSTANCE, parser_reconstruct_instance, parser),
+ ND_LOG_FIELD_CB(NDF_NIDL_CONTEXT, parser_reconstruct_context, parser),
+ ND_LOG_FIELD_END(),
+ };
+ ND_LOG_STACK_PUSH(lgs);
- buffer->len = 0;
- buffer->buffer[0] = '\0';
- }
- buffer_free(buffer);
+ buffered_reader_init(&parser->reader);
+ BUFFER *buffer = buffer_create(sizeof(parser->reader.read_buffer) + 2, NULL);
+ while(likely(service_running(SERVICE_COLLECTORS))) {
- cd->unsafe.enabled = parser->user.enabled;
- count = parser->user.data_collections_count;
+ if(unlikely(!buffered_reader_next_line(&parser->reader, buffer))) {
+ buffered_reader_ret_t ret = buffered_reader_read_timeout(
+ &parser->reader,
+ fileno((FILE *) parser->fp_input),
+ 2 * 60 * MSEC_PER_SEC, true
+ );
- if(likely(count)) {
- cd->successful_collections += count;
- cd->serial_failures = 0;
- }
- else
- cd->serial_failures++;
+ if(unlikely(ret != BUFFERED_READER_READ_OK))
+ break;
+
+ continue;
}
- // free parser with the pop function
- netdata_thread_cleanup_pop(1);
+ if(unlikely(parser_action(parser, buffer->buffer)))
+ break;
+
+ buffer->len = 0;
+ buffer->buffer[0] = '\0';
+ }
+ buffer_free(buffer);
+
+ cd->unsafe.enabled = parser->user.enabled;
+ count = parser->user.data_collections_count;
+
+ if(likely(count)) {
+ cd->successful_collections += count;
+ cd->serial_failures = 0;
+ }
+ else
+ cd->serial_failures++;
+ }
+ netdata_thread_cleanup_pop(1); // free parser with the pop function
return count;
}
diff --git a/collectors/proc.plugin/plugin_proc.c b/collectors/proc.plugin/plugin_proc.c
index 3f11aaf6c9..7742b344f4 100644
--- a/collectors/proc.plugin/plugin_proc.c
+++ b/collectors/proc.plugin/plugin_proc.c
@@ -157,59 +157,57 @@ void *proc_main(void *ptr)
netdev_thread, THREAD_NETDEV_NAME, NETDATA_THREAD_OPTION_JOINABLE, netdev_main, netdev_thread);
}
- netdata_thread_cleanup_push(proc_main_cleanup, ptr);
+ netdata_thread_cleanup_push(proc_main_cleanup, ptr)
+ {
+ config_get_boolean("plugin:proc", "/proc/pagetypeinfo", CONFIG_BOOLEAN_NO);
- {
- config_get_boolean("plugin:proc", "/proc/pagetypeinfo", CONFIG_BOOLEAN_NO);
+ // check the enabled status for each module
+ int i;
+ for(i = 0; proc_modules[i].name; i++) {
+ struct proc_module *pm = &proc_modules[i];
- // check the enabled status for each module
- int i;
- for(i = 0; proc_modules[i].name; i++) {
- struct proc_module *pm = &proc_modules[i];
+ pm->enabled = config_get_boolean("plugin:proc", pm->name, CONFIG_BOOLEAN_YES);
+ pm->rd = NULL;
- pm->enabled = config_get_boolean("plugin:proc", pm->name, CONFIG_BOOLEAN_YES);
- pm->rd = NULL;
-
- worker_register_job_name(i, proc_modules[i].dim);
- }
+ worker_register_job_name(i, proc_modules[i].dim);
+ }
- usec_t step = localhost->rrd_update_every * USEC_PER_SEC;
- heartbeat_t hb;
- heartbeat_init(&hb);
+ usec_t step = localhost->rrd_update_every * USEC_PER_SEC;
+ heartbeat_t hb;
+ heartbeat_init(&hb);
- inside_lxc_container = is_lxcfs_proc_mounted();
+ inside_lxc_container = is_lxcfs_proc_mounted();
#define LGS_MODULE_ID 0
- ND_LOG_STACK lgs[] = {
- [LGS_MODULE_ID] = ND_LOG_FIELD_TXT(NDF_MODULE, "proc.plugin"),
- ND_LOG_FIELD_END(),
- };
- ND_LOG_STACK_PUSH(lgs);
-
- while(service_running(SERVICE_COLLECTORS)) {
- worker_is_idle();
- usec_t hb_dt = heartbeat_next(&hb, step);
-
- if(unlikely(!service_running(SERVICE_COLLECTORS)))
- break;
-
- for(i = 0; proc_modules[i].name; i++) {
- if(unlikely(!service_running(SERVICE_COLLECTORS)))
- break;
-
- struct proc_module *pm = &proc_modules[i];
- if(unlikely(!pm->enabled))
- continue;
-
- worker_is_busy(i);
- lgs[LGS_MODULE_ID] = ND_LOG_FIELD_CB(NDF_MODULE, log_proc_module, pm);
- pm->enabled = !pm->func(localhost->rrd_update_every, hb_dt);
- lgs[LGS_MODULE_ID] = ND_LOG_FIELD_TXT(NDF_MODULE, "proc.plugin");
- }
- }
- }
+ ND_LOG_STACK lgs[] = {
+ [LGS_MODULE_ID] = ND_LOG_FIELD_TXT(NDF_MODULE, "proc.plugin"),
+ ND_LOG_FIELD_END(),
+ };
+ ND_LOG_STACK_PUSH(lgs);
+
+ while(service_running(SERVICE_COLLECTORS)) {
+ worker_is_idle();
+ usec_t hb_dt = heartbeat_next(&hb, step);
+
+ if(unlikely(!service_running(SERVICE_COLLECTORS)))
+ break;
+ for(i = 0; proc_modules[i].name; i++) {
+ if(unlikely(!service_running(SERVICE_COLLECTORS)))
+ break;
+
+ struct proc_module *pm = &proc_modules[i];
+ if(unlikely(!pm->enabled))
+ continue;
+
+ worker_is_busy(i);
+ lgs[LGS_MODULE_ID] = ND_LOG_FIELD_CB(NDF_MODULE, log_proc_module, pm);
+ pm->enabled = !pm->func(localhost->rrd_update_every, hb_dt);
+ lgs[LGS_MODULE_ID] = ND_LOG_FIELD_TXT(NDF_MODULE, "proc.plugin");
+ }
+ }
+ }
netdata_thread_cleanup_pop(1);
return NULL;
}
diff --git a/collectors/proc.plugin/proc_net_dev.c b/collectors/proc.plugin/proc_net_dev.c
index b39f396833..6c7364f1c0 100644
--- a/collectors/proc.plugin/proc_net_dev.c
+++ b/collectors/proc.plugin/proc_net_dev.c
@@ -1924,32 +1924,32 @@ void *netdev_main(void *ptr)
worker_register("NETDEV");
worker_register_job_name(0, "netdev");
- netdata_thread_cleanup_push(netdev_main_cleanup, ptr);
+ netdata_thread_cleanup_push(netdev_main_cleanup, ptr) {
+ rrd_collector_started();
+ rrd_function_add(localhost, NULL, "network-interfaces", 10, RRDFUNCTIONS_NETDEV_HELP, true
+ , netdev_function_net_interfaces, NULL);
- rrd_collector_started();
- rrd_function_add(localhost, NULL, "network-interfaces", 10, RRDFUNCTIONS_NETDEV_HELP, true, netdev_function_net_interfaces, NULL);
+ usec_t step = localhost->rrd_update_every * USEC_PER_SEC;
+ heartbeat_t hb;
+ heartbeat_init(&hb);
- usec_t step = localhost->rrd_update_every * USEC_PER_SEC;
- heartbeat_t hb;
- heartbeat_init(&hb);
+ while (service_running(SERVICE_COLLECTORS)) {
+ worker_is_idle();
+ usec_t hb_dt = heartbeat_next(&hb, step);
- while (service_running(SERVICE_COLLECTORS)) {
- worker_is_idle();
- usec_t hb_dt = heartbeat_next(&hb, step);
+ if (unlikely(!service_running(SERVICE_COLLECTORS)))
+ break;
- if (unlikely(!service_running(SERVICE_COLLECTORS)))
- break;
-
- cgroup_netdev_reset_all();
+ cgroup_netdev_reset_all();
- worker_is_busy(0);
+ worker_is_busy(0);
- netdata_mutex_lock(&netdev_dev_mutex);
- if(do_proc_net_dev(localhost->rrd_update_every, hb_dt))
- break;
- netdata_mutex_unlock(&netdev_dev_mutex);
+ netdata_mutex_lock(&netdev_dev_mutex);
+ if (do_proc_net_dev(localhost->rrd_update_every, hb_dt))
+ break;
+ netdata_mutex_unlock(&netdev_dev_mutex);
+ }
}
-
netdata_thread_cleanup_pop(1);
return NULL;
diff --git a/collectors/proc.plugin/proc_spl_kstat_zfs.c b/collectors/proc.plugin/proc_spl_kstat_zfs.c
index 27178b60fe..b03e3cfb58 100644
--- a/collectors/proc.plugin/proc_spl_kstat_zfs.c
+++ b/collectors/proc.plugin/proc_spl_kstat_zfs.c
@@ -357,7 +357,7 @@ int do_proc_spl_kstat_zfs_pool_state(int update_every, usec_t dt)
if (unlikely(!pool)) {
struct zfs_pool new_zfs_pool = {};
pool = dictionary_set(zfs_pools, de->d_name, &new_zfs_pool, sizeof(struct zfs_pool));
- };
+ }
pool->updated = 1;
diff --git a/collectors/proc.plugin/sys_class_drm.c b/collectors/proc.plugin/sys_class_drm.c
index 3ed1fb8757..ee597ad6c4 100644
--- a/collectors/proc.plugin/sys_class_drm.c
+++ b/collectors/proc.plugin/sys_class_drm.c
@@ -885,14 +885,14 @@ int do_sys_class_drm(int update_every, usec_t dt) {
collected_number tmp_val;
- #define set_prop_pathname(prop_filename, prop_pathname, p_ff){ \
+ #define set_prop_pathname(prop_filename, prop_pathname, p_ff) do { \
snprintfz(filename, FILENAME_MAX, "%s/%s", c->pathname, prop_filename); \
if((p_ff && !read_clk_freq_file(p_ff, filename, &tmp_val)) || \
!read_single_number_file(filename, (unsigned long long *) &tmp_val)) \
prop_pathname = strdupz(filename); \
else \
collector_info("Cannot read file '%s'", filename); \
- }
+ } while(0)
/* Initialize GPU and VRAM utilization metrics */
diff --git a/collectors/proc.plugin/sys_kernel_mm_ksm.c b/collectors/proc.plugin/sys_kernel_mm_ksm.c
index 45f1ac330a..8f43acc93b 100644
--- a/collectors/proc.plugin/sys_kernel_mm_ksm.c
+++ b/collectors/proc.plugin/sys_kernel_mm_ksm.c
@@ -13,7 +13,7 @@ typedef struct ksm_name_value {
#define PAGES_SHARING 1
#define PAGES_UNSHARED 2
#define PAGES_VOLATILE 3
-#define PAGES_TO_SCAN 4
+// #define PAGES_TO_SCAN 4
KSM_NAME_VALUE values[] = {
[PAGES_SHARED] = { "/sys/kernel/mm/ksm/pages_shared", 0ULL },
diff --git a/collectors/profile.plugin/plugin_profile.cc b/collectors/profile.plugin/plugin_profile.cc
index 5f7b22d257..f97c192a05 100644
--- a/