Thread creation code cleanup (#20732)
* nd_thread create function return type from void* to void * More changes * More fixes * Fix winsrv cleanup function * Fix ipmi compilation * Fix mongodb collector
Stelios Fragkakis committed
Jul 29, 2025 at 17:30 UTC
acc1d2ff707bddeaae5aeca4ab7e61f88433110b
115 files changed
+190
-395
src/aclk/aclk.c
+2
-3
@@ -794,7 +794,7 @@ static int aclk_attempt_to_connect(mqtt_wss_client client)
794
*
795
* @return It always returns NULL
796
*/
797
-void *aclk_main(void *ptr)
797
+void aclk_main(void *ptr)
798
{
799
struct netdata_static_thread *static_thread = ptr;
800
@@ -840,7 +840,7 @@ void *aclk_main(void *ptr)
840
if (proxy_type == PROXY_TYPE_SOCKS5) {
841
netdata_log_error("ACLK: SOCKS5 proxy is not supported by ACLK-NG yet.");
842
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
843
- return NULL;
843
+ return;
844
}
845
846
aclk_init_rx_msg_handlers();
@@ -916,7 +916,6 @@ exit:
916
freez(aclk_env);
917
}
918
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
919
- return NULL;
919
}
920
921
bool aclk_host_state_update_auto(RRDHOST *host) {
src/aclk/aclk.h
-2
@@ -82,8 +82,6 @@ extern time_t aclk_block_until;
82
extern int aclk_connection_counter;
83
extern ACLK_DISCONNECT_ACTION disconnect_req;
84
85
-void *aclk_main(void *ptr);
86
-
85
extern struct aclk_shared_state {
86
// To wait for `disconnect` message PUBACK
87
// when shutting down
src/collectors/cgroups.plugin/cgroup-discovery.c
+1
-2
@@ -1287,7 +1287,7 @@ static inline void discovery_find_all_cgroups() {
1287
netdata_log_debug(D_CGROUP, "done searching for cgroups");
1288
}
1289
1290
-void *cgroup_discovery_worker(void *ptr)
1290
+void cgroup_discovery_worker(void *ptr)
1291
{
1292
UNUSED(ptr);
1293
uv_thread_set_name_np("P[cgroupsdisc]");
@@ -1342,5 +1342,4 @@ void *cgroup_discovery_worker(void *ptr)
1342
worker_unregister();
1343
service_exits();
1344
__atomic_store_n(&discovery_thread.exited,1,__ATOMIC_RELAXED);
1345
- return NULL;
1345
}
src/collectors/cgroups.plugin/cgroup-internals.h
+1
-1
@@ -274,7 +274,7 @@ extern char cgroup_chart_id_prefix[];
274
extern char services_chart_id_prefix[];
275
extern uv_mutex_t cgroup_root_mutex;
276
277
-void *cgroup_discovery_worker(void *ptr);
277
+void cgroup_discovery_worker(void *ptr);
278
279
extern bool is_inside_k8s;
280
extern long system_page_size;
src/collectors/cgroups.plugin/sys_fs_cgroup.c
+5
-10
@@ -1364,7 +1364,7 @@ void cgroup_read_host_total_ram() {
1364
procfile_close(ff);
1365
}
1366
1367
-void *cgroups_main(void *ptr) {
1367
+void cgroups_main(void *ptr) {
1368
CLEANUP_FUNCTION_REGISTER(cgroup_main_cleanup) cleanup_ptr = ptr;
1369
1370
worker_register("CGROUPS");
@@ -1383,7 +1383,7 @@ void *cgroups_main(void *ptr) {
1383
1384
if (uv_mutex_init(&cgroup_root_mutex)) {
1385
collector_error("CGROUP: cannot initialize mutex for the main cgroup list");
1386
- goto exit;
1386
+ return;
1387
}
1388
1389
// we register this only on localhost
@@ -1394,18 +1394,18 @@ void *cgroups_main(void *ptr) {
1394
1395
if (uv_mutex_init(&discovery_thread.mutex)) {
1396
collector_error("CGROUP: cannot initialize mutex for discovery thread");
1397
- goto exit;
1397
+ return;
1398
}
1399
if (uv_cond_init(&discovery_thread.cond_var)) {
1400
collector_error("CGROUP: cannot initialize conditional variable for discovery thread");
1401
- goto exit;
1401
+ return;
1402
}
1403
1404
discovery_thread.thread = nd_thread_create("CGDISCOVER", NETDATA_THREAD_OPTION_DEFAULT, cgroup_discovery_worker, NULL);
1405
1406
if (!discovery_thread.thread) {
1407
collector_error("CGROUP: cannot create thread worker");
1408
- goto exit;
1408
+ return;
1409
}
1410
1411
rrd_function_add_inline(localhost, NULL, "containers-vms", 10,
@@ -1465,9 +1465,4 @@ void *cgroups_main(void *ptr) {
1465
worker_is_idle();
1466
uv_mutex_unlock(&cgroup_root_mutex);
1467
}
1468
-
1469
- // uv_thread_join(&discovery_thread.thread);
1470
-
1471
-exit:
1472
- return NULL;
1468
}
src/collectors/debugfs.plugin/debugfs_plugin.h
+1
-1
@@ -9,7 +9,7 @@
9
10
extern netdata_mutex_t stdout_mutex;
11
12
-void *libsensors_thread(void *ptr);
12
+void libsensors_thread(void *ptr);
13
14
int do_module_numa_extfrag(int update_every, const char *name);
15
int do_module_zswap(int update_every, const char *name);
src/collectors/debugfs.plugin/module-libsensors.c
+1
-3
@@ -1214,7 +1214,7 @@ static int sensors_collect_data(void) {
1214
static bool libsensors_running = false;
1215
static int libsensors_update_every = 1;
1216
1217
-void *libsensors_thread(void *ptr __maybe_unused) {
1217
+void libsensors_thread(void *ptr __maybe_unused) {
1218
int update_every = libsensors_update_every;
1219
1220
FILE *fp = NULL;
@@ -1312,8 +1312,6 @@ cleanup:
1312
1313
dictionary_destroy(sensors_dict);
1314
sensors_dict = NULL;
1315
-
1316
- return NULL;
1315
}
1316
1317
static ND_THREAD *libsensors = NULL;
src/collectors/diskspace.plugin/plugin_diskspace.c
+2
-6
@@ -523,7 +523,7 @@ struct slow_worker_data {
523
int update_every;
524
};
525
526
-void *diskspace_slow_worker(void *ptr)
526
+void diskspace_slow_worker(void *ptr)
527
{
528
struct slow_worker_data *data = (struct slow_worker_data *)ptr;
529
@@ -597,8 +597,6 @@ void *diskspace_slow_worker(void *ptr)
597
netdata_mutex_unlock(&slow_mountinfo_mutex);
598
599
worker_unregister();
600
-
601
- return NULL;
600
}
601
602
static void diskspace_main_cleanup(void *ptr) {
@@ -843,7 +841,7 @@ static int diskspace_function_mount_points(BUFFER *wb, const char *function __ma
841
return HTTP_RESP_OK;
842
}
843
846
-void *diskspace_main(void *ptr) {
844
+void diskspace_main(void *ptr) {
845
worker_register("DISKSPACE");
846
worker_register_job_name(WORKER_JOB_MOUNTINFO, "mountinfo");
847
worker_register_job_name(WORKER_JOB_MOUNTPOINT, "mountpoint");
@@ -924,6 +922,4 @@ void *diskspace_main(void *ptr) {
922
923
// cleanup
924
diskspace_main_cleanup(ptr);
927
-
928
- return NULL;
925
}
src/collectors/ebpf.plugin/ebpf.h
+2
-2
@@ -179,8 +179,8 @@ typedef struct ebpf_tracepoint {
179
enum ebpf_algorithms_list { NETDATA_EBPF_ABSOLUTE_IDX, NETDATA_EBPF_INCREMENTAL_IDX };
180
181
// Threads
182
-void *ebpf_process_thread(void *ptr);
183
-void *ebpf_socket_thread(void *ptr);
182
+void ebpf_process_thread(void *ptr);
183
+void ebpf_socket_thread(void *ptr);
184
185
// Common variables
186
extern pthread_mutex_t lock;
src/collectors/ebpf.plugin/ebpf_cachestat.c
+3
-7
@@ -880,12 +880,12 @@ void ebpf_cachestat_resume_apps_data()
880
*
881
* @return It always return NULL
882
*/
883
-void *ebpf_read_cachestat_thread(void *ptr)
883
+void ebpf_read_cachestat_thread(void *ptr)
884
{
885
ebpf_module_t *em = (ebpf_module_t *)ptr;
886
int collect_pid = (em->apps_charts || em->cgroup_charts);
887
if (!collect_pid)
888
- return NULL;
888
+ return;
889
890
int maps_per_core = em->maps_per_core;
891
int update_every = em->update_every;
@@ -921,8 +921,6 @@ void *ebpf_read_cachestat_thread(void *ptr)
921
em->running_time = running_time;
922
pthread_mutex_unlock(&ebpf_exit_cleanup);
923
}
924
-
925
- return NULL;
924
}
925
926
/**
@@ -1718,7 +1716,7 @@ static int ebpf_cachestat_load_bpf(ebpf_module_t *em)
1716
*
1717
* @return It always return NULL
1718
*/
1721
-void *ebpf_cachestat_thread(void *ptr)
1719
+void ebpf_cachestat_thread(void *ptr)
1720
{
1721
ebpf_module_t *em = (ebpf_module_t *)ptr;
1722
@@ -1766,6 +1764,4 @@ void *ebpf_cachestat_thread(void *ptr)
1764
1765
endcachestat:
1766
ebpf_update_disabled_plugin_stats(em);
1769
-
1770
- return NULL;
1767
}
src/collectors/ebpf.plugin/ebpf_cachestat.h
+1
-1
@@ -66,7 +66,7 @@ enum cachestat_indexes {
66
67
enum cachestat_tables { NETDATA_CACHESTAT_GLOBAL_STATS, NETDATA_CACHESTAT_PID_STATS, NETDATA_CACHESTAT_CTRL };
68
69
-void *ebpf_cachestat_thread(void *ptr);
69
+void ebpf_cachestat_thread(void *ptr);
70
71
extern struct config cachestat_config;
72
extern netdata_ebpf_targets_t cachestat_targets[];
src/collectors/ebpf.plugin/ebpf_cgroup.c
+1
-3
@@ -376,7 +376,7 @@ void ebpf_create_charts_on_systemd(ebpf_systemd_args_t *chart)
376
*
377
* @return It always returns NULL.
378
*/
379
-void *ebpf_cgroup_integration(void *ptr __maybe_unused)
379
+void ebpf_cgroup_integration(void *ptr __maybe_unused)
380
{
381
int counter = NETDATA_EBPF_CGROUP_UPDATE - 1;
382
heartbeat_t hb;
@@ -395,6 +395,4 @@ void *ebpf_cgroup_integration(void *ptr __maybe_unused)
395
ebpf_parse_cgroup_shm_data();
396
}
397
}
398
-
399
- return NULL;
398
}
src/collectors/ebpf.plugin/ebpf_cgroup.h
+1
-1
@@ -86,7 +86,7 @@ typedef struct ebpf_systemd_args {
86
void ebpf_map_cgroup_shared_memory();
87
void ebpf_parse_cgroup_shm_data();
88
void ebpf_create_charts_on_systemd(ebpf_systemd_args_t *chart);
89
-void *ebpf_cgroup_integration(void *ptr);
89
+void ebpf_cgroup_integration(void *ptr);
90
void ebpf_unmap_cgroup_shared_memory();
91
extern int send_cgroup_chart;
92
src/collectors/ebpf.plugin/ebpf_dcstat.c
+3
-7
@@ -680,7 +680,7 @@ static void ebpf_update_dc_cgroup()
680
*
681
* @return It always return NULL
682
*/
683
-void *ebpf_read_dcstat_thread(void *ptr)
683
+void ebpf_read_dcstat_thread(void *ptr)
684
{
685
ebpf_module_t *em = (ebpf_module_t *)ptr;
686
@@ -689,7 +689,7 @@ void *ebpf_read_dcstat_thread(void *ptr)
689
int collect_pid = (em->apps_charts || em->cgroup_charts);
690
int cgroups = em->cgroup_charts;
691
if (!collect_pid)
692
- return NULL;
692
+ return;
693
694
int counter = update_every - 1;
695
@@ -722,8 +722,6 @@ void *ebpf_read_dcstat_thread(void *ptr)
722
em->running_time = running_time;
723
pthread_mutex_unlock(&ebpf_exit_cleanup);
724
}
725
-
726
- return NULL;
725
}
726
727
/**
@@ -1493,7 +1491,7 @@ static int ebpf_dcstat_load_bpf(ebpf_module_t *em)
1491
*
1492
* @return It always returns NULL
1493
*/
1496
-void *ebpf_dcstat_thread(void *ptr)
1494
+void ebpf_dcstat_thread(void *ptr)
1495
{
1496
ebpf_module_t *em = (ebpf_module_t *)ptr;
1497
CLEANUP_FUNCTION_REGISTER(ebpf_dcstat_exit) cleanup_ptr = em;
@@ -1538,6 +1536,4 @@ void *ebpf_dcstat_thread(void *ptr)
1536
1537
enddcstat:
1538
ebpf_update_disabled_plugin_stats(em);
1541
-
1542
- return NULL;
1539
}
src/collectors/ebpf.plugin/ebpf_dcstat.h
+1
-1
@@ -65,7 +65,7 @@ enum directory_cache_counters {
65
66
enum directory_cache_targets { NETDATA_DC_TARGET_LOOKUP_FAST, NETDATA_DC_TARGET_D_LOOKUP };
67
68
-void *ebpf_dcstat_thread(void *ptr);
68
+void ebpf_dcstat_thread(void *ptr);
69
void ebpf_dcstat_create_apps_charts(struct ebpf_module *em, void *ptr);
70
void ebpf_dcstat_release(netdata_publish_dcstat_t *stat);
71
extern struct config dcstat_config;
src/collectors/ebpf.plugin/ebpf_disk.c
+1
-3
@@ -914,7 +914,7 @@ static int ebpf_disk_load_bpf(ebpf_module_t *em)
914
*
915
* @return It always return NULL
916
*/
917
-void *ebpf_disk_thread(void *ptr)
917
+void ebpf_disk_thread(void *ptr)
918
{
919
ebpf_module_t *em = (ebpf_module_t *)ptr;
920
@@ -960,6 +960,4 @@ void *ebpf_disk_thread(void *ptr)
960
961
enddisk:
962
ebpf_update_disabled_plugin_stats(em);
963
-
964
- return NULL;
963
}
src/collectors/ebpf.plugin/ebpf_disk.h
+1
-1
@@ -72,6 +72,6 @@ typedef struct netdata_ebpf_publish_disk {
72
73
extern struct config disk_config;
74
75
-void *ebpf_disk_thread(void *ptr);
75
+void ebpf_disk_thread(void *ptr);
76
77
#endif /* NETDATA_EBPF_DISK_H */
src/collectors/ebpf.plugin/ebpf_fd.c
+3
-7
@@ -822,7 +822,7 @@ static void ebpf_update_fd_cgroup()
822
*
823
* @return It always return NULL
824
*/
825
-void *ebpf_read_fd_thread(void *ptr)
825
+void ebpf_read_fd_thread(void *ptr)
826
{
827
ebpf_module_t *em = (ebpf_module_t *)ptr;
828
@@ -830,7 +830,7 @@ void *ebpf_read_fd_thread(void *ptr)
830
int update_every = em->update_every;
831
int collect_pid = (em->apps_charts || em->cgroup_charts);
832
if (!collect_pid)
833
- return NULL;
833
+ return;
834
835
int counter = update_every - 1;
836
@@ -865,8 +865,6 @@ void *ebpf_read_fd_thread(void *ptr)
865
em->running_time = running_time;
866
pthread_mutex_unlock(&ebpf_exit_cleanup);
867
}
868
-
869
- return NULL;
868
}
869
870
/**
@@ -1529,7 +1527,7 @@ static int ebpf_fd_load_bpf(ebpf_module_t *em)
1527
*
1528
* @return It always returns NULL
1529
*/
1532
-void *ebpf_fd_thread(void *ptr)
1530
+void ebpf_fd_thread(void *ptr)
1531
{
1532
ebpf_module_t *em = (ebpf_module_t *)ptr;
1533
@@ -1564,6 +1562,4 @@ void *ebpf_fd_thread(void *ptr)
1562
1563
endfd:
1564
ebpf_update_disabled_plugin_stats(em);
1567
-
1568
- return NULL;
1565
}
src/collectors/ebpf.plugin/ebpf_fd.h
+1
-1
@@ -77,7 +77,7 @@ enum fd_close_syscall {
77
78
#define NETDATA_EBPF_MAX_FD_TARGETS 2
79
80
-void *ebpf_fd_thread(void *ptr);
80
+void ebpf_fd_thread(void *ptr);
81
void ebpf_fd_create_apps_charts(struct ebpf_module *em, void *ptr);
82
void ebpf_fd_release(netdata_fd_stat_t *stat);
83
extern struct config fd_config;
src/collectors/ebpf.plugin/ebpf_filesystem.c
+1
-3
@@ -1164,7 +1164,7 @@ static void ebpf_set_maps()
1164
*
1165
* @return It always return NULL
1166
*/
1167
-void *ebpf_filesystem_thread(void *ptr)
1167
+void ebpf_filesystem_thread(void *ptr)
1168
{
1169
ebpf_module_t *em = (ebpf_module_t *)ptr;
1170
@@ -1205,6 +1205,4 @@ void *ebpf_filesystem_thread(void *ptr)
1205
1206
endfilesystem:
1207
ebpf_update_disabled_plugin_stats(em);
1208
-
1209
- return NULL;
1208
}
src/collectors/ebpf.plugin/ebpf_filesystem.h
+1
-1
@@ -50,7 +50,7 @@ enum netdata_filesystem_localfs_idx {
50
NETDATA_FS_LOCALFS_END,
51
};
52
53
-void *ebpf_filesystem_thread(void *ptr);
53
+void ebpf_filesystem_thread(void *ptr);
54
extern struct config fs_config;
55
56
#endif /* NETDATA_EBPF_FILESYSTEM_H */
src/collectors/ebpf.plugin/ebpf_functions.c
+1
-3
@@ -801,7 +801,7 @@ close_and_send:
801
*
802
* @return always NULL.
803
*/
804
-void *ebpf_function_thread(void *ptr)
804
+void ebpf_function_thread(void *ptr)
805
{
806
(void)ptr;
807
@@ -830,6 +830,4 @@ void *ebpf_function_thread(void *ptr)
830
break;
831
}
832
}
833
-
834
- return NULL;
833
}
src/collectors/ebpf.plugin/ebpf_functions.h
+1
-1
@@ -33,6 +33,6 @@ static inline void EBPF_PLUGIN_FUNCTIONS(const char *NAME, const char *DESC, int
33
#define EBPF_FUNCTION_SOCKET_RESET "reset"
34
#define EBPF_FUNCTION_SOCKET_INTERFACES "interfaces"
35
36
-void *ebpf_function_thread(void *ptr);
36
+void ebpf_function_thread(void *ptr);
37
38
#endif
src/collectors/ebpf.plugin/ebpf_hardirq.c
+1
-3
@@ -598,7 +598,7 @@ static int ebpf_hardirq_load_bpf(ebpf_module_t *em)
598
* @param ptr a `ebpf_module_t *`.
599
* @return always NULL.
600
*/
601
-void *ebpf_hardirq_thread(void *ptr)
601
+void ebpf_hardirq_thread(void *ptr)
602
{
603
ebpf_module_t *em = (ebpf_module_t *)ptr;
604
@@ -622,6 +622,4 @@ void *ebpf_hardirq_thread(void *ptr)
622
623
endhardirq:
624
ebpf_update_disabled_plugin_stats(em);
625
-
626
- return NULL;
625
}
src/collectors/ebpf.plugin/ebpf_hardirq.h
+1
-1
@@ -74,6 +74,6 @@ typedef struct hardirq_static_val {
74
#define NETDATA_EBPF_SYSTEM_HARDIRQ_LATENCY_CTX "system.hardirq_latency"
75
76
extern struct config hardirq_config;
77
-void *ebpf_hardirq_thread(void *ptr);
77
+void ebpf_hardirq_thread(void *ptr);
78
79
#endif /* NETDATA_EBPF_HARDIRQ_H */
src/collectors/ebpf.plugin/ebpf_mdflush.c
+1
-3
@@ -409,7 +409,7 @@ static int ebpf_mdflush_load_bpf(ebpf_module_t *em)
409
* @param ptr a `ebpf_module_t *`.
410
* @return always NULL.
411
*/
412
-void *ebpf_mdflush_thread(void *ptr)
412
+void ebpf_mdflush_thread(void *ptr)
413
{
414
ebpf_module_t *em = (ebpf_module_t *)ptr;
415
CLEANUP_FUNCTION_REGISTER(mdflush_exit) cleanup_ptr = em;
@@ -436,6 +436,4 @@ void *ebpf_mdflush_thread(void *ptr)
436
endmdflush:
437
freez(md_flush_request);
438
ebpf_update_disabled_plugin_stats(em);
439
-
440
- return NULL;
439
}
src/collectors/ebpf.plugin/ebpf_mdflush.h
+1
-1
@@ -40,7 +40,7 @@ enum netdata_mdflush_targets {
40
NETDATA_MD_FLUSH_END
41
};
42
43
-void *ebpf_mdflush_thread(void *ptr);
43
+void ebpf_mdflush_thread(void *ptr);
44
45
extern struct config mdflush_config;
46
extern netdata_ebpf_targets_t mdflush_targets[];
src/collectors/ebpf.plugin/ebpf_mount.c
+1
-3
@@ -497,7 +497,7 @@ static int ebpf_mount_load_bpf(ebpf_module_t *em)
497
*
498
* @return It always returns NULL
499
*/
500
-void *ebpf_mount_thread(void *ptr)
500
+void ebpf_mount_thread(void *ptr)
501
{
502
ebpf_module_t *em = ptr;
503
CLEANUP_FUNCTION_REGISTER(ebpf_mount_exit) cleanup_ptr = em;
@@ -531,6 +531,4 @@ void *ebpf_mount_thread(void *ptr)
531
532
endmount:
533
ebpf_update_disabled_plugin_stats(em);
534
-
535
- return NULL;
534
}
src/collectors/ebpf.plugin/ebpf_mount.h
+1
-1
@@ -35,7 +35,7 @@ enum netdata_mount_syscalls {
35
};
36
37
extern struct config mount_config;
38
-void *ebpf_mount_thread(void *ptr);
38
+void ebpf_mount_thread(void *ptr);
39
extern netdata_ebpf_targets_t mount_targets[];
40
41
#endif /* NETDATA_EBPF_MOUNT_H */
src/collectors/ebpf.plugin/ebpf_oomkill.c
+1
-3
@@ -555,7 +555,7 @@ void ebpf_oomkill_create_apps_charts(struct ebpf_module *em, void *ptr)
555
* @param ptr a `ebpf_module_t *`.
556
* @return always NULL.
557
*/
558
-void *ebpf_oomkill_thread(void *ptr)
558
+void ebpf_oomkill_thread(void *ptr)
559
{
560
ebpf_module_t *em = (ebpf_module_t *)ptr;
561
@@ -603,6 +603,4 @@ void *ebpf_oomkill_thread(void *ptr)
603
604
endoomkill:
605
ebpf_update_disabled_plugin_stats(em);
606
-
607
- return NULL;
606
}
src/collectors/ebpf.plugin/ebpf_oomkill.h
+1
-1
@@ -31,7 +31,7 @@ typedef uint8_t oomkill_ebpf_val_t;
31
#define NETDATA_SYSTEMD_OOMKILLS_CONTEXT "systemd.oomkills"
32
33
extern struct config oomkill_config;
34
-void *ebpf_oomkill_thread(void *ptr);
34
+void ebpf_oomkill_thread(void *ptr);
35
void ebpf_oomkill_create_apps_charts(struct ebpf_module *em, void *ptr);
36
37
#endif /* NETDATA_EBPF_OOMKILL_H */
src/collectors/ebpf.plugin/ebpf_process.c
+1
-3
@@ -1525,7 +1525,7 @@ static int ebpf_process_enable_tracepoints()
1525
*
1526
* @return It always return NULL
1527
*/
1528
-void *ebpf_process_thread(void *ptr)
1528
+void ebpf_process_thread(void *ptr)
1529
{
1530
ebpf_module_t *em = (ebpf_module_t *)ptr;
1531
@@ -1573,6 +1573,4 @@ void *ebpf_process_thread(void *ptr)
1573
pthread_mutex_lock(&ebpf_exit_cleanup);
1574
ebpf_update_disabled_plugin_stats(em);
1575
pthread_mutex_unlock(&ebpf_exit_cleanup);
1576
-
1577
- return NULL;
1576
}
src/collectors/ebpf.plugin/ebpf_shm.c
+3
-7
@@ -1078,7 +1078,7 @@ void ebpf_shm_resume_apps_data()
1078
*
1079
* @return It always return NULL
1080
*/
1081
-void *ebpf_read_shm_thread(void *ptr)
1081
+void ebpf_read_shm_thread(void *ptr)
1082
{
1083
ebpf_module_t *em = (ebpf_module_t *)ptr;
1084
@@ -1086,7 +1086,7 @@ void *ebpf_read_shm_thread(void *ptr)
1086
int update_every = em->update_every;
1087
int collect_pid = (em->apps_charts || em->cgroup_charts);
1088
if (!collect_pid)
1089
- return NULL;
1089
+ return;
1090
1091
int counter = update_every - 1;
1092
@@ -1120,8 +1120,6 @@ void *ebpf_read_shm_thread(void *ptr)
1120
em->running_time = running_time;
1121
pthread_mutex_unlock(&ebpf_exit_cleanup);
1122
}
1123
-
1124
- return NULL;
1123
}
1124
1125
/**
@@ -1355,7 +1353,7 @@ static int ebpf_shm_load_bpf(ebpf_module_t *em)
1353
* @param ptr a pointer to `struct ebpf_module`
1354
* @return It always return NULL
1355
*/
1358
-void *ebpf_shm_thread(void *ptr)
1356
+void ebpf_shm_thread(void *ptr)
1357
{
1358
pids_fd[NETDATA_EBPF_PIDS_SHM_IDX] = -1;
1359
ebpf_module_t *em = (ebpf_module_t *)ptr;
@@ -1401,6 +1399,4 @@ void *ebpf_shm_thread(void *ptr)
1399
1400
endshm:
1401
ebpf_update_disabled_plugin_stats(em);
1404
-
1405
- return NULL;
1402
}
src/collectors/ebpf.plugin/ebpf_shm.h
+1
-1
@@ -41,7 +41,7 @@ enum shm_counters {
41
NETDATA_SHM_END
42
};
43
44
-void *ebpf_shm_thread(void *ptr);
44
+void ebpf_shm_thread(void *ptr);
45
void ebpf_shm_create_apps_charts(struct ebpf_module *em, void *ptr);
46
void ebpf_shm_release(netdata_publish_shm_t *stat);
47
extern netdata_ebpf_targets_t shm_targets[];
src/collectors/ebpf.plugin/ebpf_socket.c
+4
-7
@@ -1952,7 +1952,7 @@ static void ebpf_update_socket_cgroup()
1952
*
1953
* @return It always return NULL
1954
*/
1955
-void *ebpf_read_socket_thread(void *ptr)
1955
+void ebpf_read_socket_thread(void *ptr)
1956
{
1957
ebpf_module_t *em = (ebpf_module_t *)ptr;
1958
@@ -1962,7 +1962,7 @@ void *ebpf_read_socket_thread(void *ptr)
1962
int counter = update_every - 1;
1963
int collect_pid = (em->apps_charts || em->cgroup_charts);
1964
if (!collect_pid)
1965
- return NULL;
1965
+ return;
1966
1967
uint32_t running_time = 0;
1968
uint32_t lifetime = em->lifetime;
@@ -1984,8 +1984,6 @@ void *ebpf_read_socket_thread(void *ptr)
1984
1985
counter = 0;
1986
}
1987
-
1988
- return NULL;
1987
}
1988
1989
/**
@@ -2995,7 +2993,7 @@ static int ebpf_socket_load_bpf(ebpf_module_t *em)
2993
*
2994
* @return It always return NULL
2995
*/
2998
-void *ebpf_socket_thread(void *ptr)
2996
+void ebpf_socket_thread(void *ptr)
2997
{
2998
pids_fd[NETDATA_EBPF_PIDS_SOCKET_IDX] = -1;
2999
ebpf_module_t *em = (ebpf_module_t *)ptr;
@@ -3004,7 +3002,7 @@ void *ebpf_socket_thread(void *ptr)
3002
3003
if (em->enabled > NETDATA_THREAD_EBPF_FUNCTION_RUNNING) {
3004
collector_error("There is already a thread %s running", em->info.thread_name);
3007
- return NULL;
3005
+ return;
3006
}
3007
3008
em->maps = socket_maps;
@@ -3065,5 +3063,4 @@ void *ebpf_socket_thread(void *ptr)
3063
3064
endsocket:
3065
ebpf_update_disabled_plugin_stats(em);
3068
- return NULL;
3066
}
src/collectors/ebpf.plugin/ebpf_socket_ipc.c
+1
-2
@@ -34,7 +34,7 @@ static bool ebpf_ipc_should_stop(void)
34
return false;
35
}
36
37
-void *ebpf_socket_thread_ipc(void *ptr)
37
+void ebpf_socket_thread_ipc(void *ptr)
38
{
39
(void)ptr;
40
@@ -61,5 +61,4 @@ void *ebpf_socket_thread_ipc(void *ptr)
61
ptr,
62
0 // We are going to use UDP
63
);
64
- return NULL;
64
}
src/collectors/ebpf.plugin/ebpf_socket_ipc.h
+1
-1
@@ -26,7 +26,7 @@ enum ebpf_integration_list {
26
27
extern LISTEN_SOCKETS ipc_sockets;
28
extern sem_t *shm_mutex_ebpf_integration;
29
-void *ebpf_socket_thread_ipc(void *ptr);
29
+void ebpf_socket_thread_ipc(void *ptr);
30
void netdata_integration_cleanup_shm();
31
32
#endif /* NETDATA_EBPF_SOCKET_IPC_H_ */
src/collectors/ebpf.plugin/ebpf_softirq.c
+1
-3
@@ -251,7 +251,7 @@ static void softirq_collector(ebpf_module_t *em)
251
* @param ptr a `ebpf_module_t *`.
252
* @return always NULL.
253
*/
254
-void *ebpf_softirq_thread(void *ptr)
254
+void ebpf_softirq_thread(void *ptr)
255
{
256
ebpf_module_t *em = ptr;
257
@@ -275,6 +275,4 @@ void *ebpf_softirq_thread(void *ptr)
275
276
endsoftirq:
277
ebpf_update_disabled_plugin_stats(em);
278
-
279
- return NULL;
278
}
src/collectors/ebpf.plugin/ebpf_softirq.h
+1
-1
@@ -31,6 +31,6 @@ typedef struct sofirq_val {
31
} softirq_val_t;
32
33
extern struct config softirq_config;
34
-void *ebpf_softirq_thread(void *ptr);
34
+void ebpf_softirq_thread(void *ptr);
35
36
#endif /* NETDATA_EBPF_SOFTIRQ_H */
src/collectors/ebpf.plugin/ebpf_swap.c
+3
-7
@@ -595,7 +595,7 @@ static void ebpf_read_swap_apps_table(int maps_per_core)
595
*
596
* @return It always return NULL
597
*/
598
-void *ebpf_read_swap_thread(void *ptr)
598
+void ebpf_read_swap_thread(void *ptr)
599
{
600
ebpf_module_t *em = (ebpf_module_t *)ptr;
601
@@ -603,7 +603,7 @@ void *ebpf_read_swap_thread(void *ptr)
603
int update_every = em->update_every;
604
int collect_pid = (em->apps_charts || em->cgroup_charts);
605
if (!collect_pid)
606
- return NULL;
606
+ return;
607
608
int counter = update_every - 1;
609
@@ -638,8 +638,6 @@ void *ebpf_read_swap_thread(void *ptr)
638
em->running_time = running_time;
639
pthread_mutex_unlock(&ebpf_exit_cleanup);
640
}
641
-
642
- return NULL;
641
}
642
643
/**
@@ -1182,7 +1180,7 @@ static int ebpf_swap_set_internal_value()
1180
*
1181
* @return It always return NULL
1182
*/
1185
-void *ebpf_swap_thread(void *ptr)
1183
+void ebpf_swap_thread(void *ptr)
1184
{
1185
ebpf_module_t *em = (ebpf_module_t *)ptr;
1186
@@ -1227,6 +1225,4 @@ void *ebpf_swap_thread(void *ptr)
1225
1226
endswap:
1227
ebpf_update_disabled_plugin_stats(em);
1230
-
1231
- return NULL;
1228
}
src/collectors/ebpf.plugin/ebpf_swap.h
+1
-1
@@ -34,7 +34,7 @@ enum swap_counters {
34
NETDATA_SWAP_END
35
};
36
37
-void *ebpf_swap_thread(void *ptr);
37
+void ebpf_swap_thread(void *ptr);
38
void ebpf_swap_create_apps_charts(struct ebpf_module *em, void *ptr);
39
40
extern struct config swap_config;
src/collectors/ebpf.plugin/ebpf_sync.c
+1
-3
@@ -755,7 +755,7 @@ static void ebpf_set_sync_maps()
755
*
756
* @return It always return NULL
757
*/
758
-void *ebpf_sync_thread(void *ptr)
758
+void ebpf_sync_thread(void *ptr)
759
{
760
ebpf_module_t *em = (ebpf_module_t *)ptr;
761
@@ -795,6 +795,4 @@ void *ebpf_sync_thread(void *ptr)
795
796
endsync:
797
ebpf_update_disabled_plugin_stats(em);
798
-
799
- return NULL;
798
}
src/collectors/ebpf.plugin/ebpf_sync.h
+1
-1
@@ -48,7 +48,7 @@ enum netdata_sync_charts {
48
49
enum netdata_sync_table { NETDATA_SYNC_GLOBAL_TABLE };
50
51
-void *ebpf_sync_thread(void *ptr);
51
+void ebpf_sync_thread(void *ptr);
52
extern struct config sync_config;
53
extern netdata_ebpf_targets_t sync_targets[];
54
src/collectors/ebpf.plugin/ebpf_vfs.c
+3
-7
@@ -2304,7 +2304,7 @@ void ebpf_vfs_resume_apps_data()
2304
*
2305
* @return It always return NULL
2306
*/
2307
-void *ebpf_read_vfs_thread(void *ptr)
2307
+void ebpf_read_vfs_thread(void *ptr)
2308
{
2309
ebpf_module_t *em = (ebpf_module_t *)ptr;
2310
@@ -2312,7 +2312,7 @@ void *ebpf_read_vfs_thread(void *ptr)
2312
int update_every = em->update_every;
2313
int collect_pid = (em->apps_charts || em->cgroup_charts);
2314
if (!collect_pid)
2315
- return NULL;
2315
+ return;
2316
2317
int counter = update_every - 1;
2318
@@ -2346,8 +2346,6 @@ void *ebpf_read_vfs_thread(void *ptr)
2346
em->running_time = running_time;
2347
pthread_mutex_unlock(&ebpf_exit_cleanup);
2348
}
2349
-
2350
- return NULL;
2349
}
2350
2351
/**
@@ -2914,7 +2912,7 @@ static int ebpf_vfs_load_bpf(ebpf_module_t *em)
2912
*
2913
* @return It always return NULL
2914
*/
2917
-void *ebpf_vfs_thread(void *ptr)
2915
+void ebpf_vfs_thread(void *ptr)
2916
{
2917
pids_fd[NETDATA_EBPF_PIDS_VFS_IDX] = -1;
2918
ebpf_module_t *em = (ebpf_module_t *)ptr;
@@ -2964,6 +2962,4 @@ void *ebpf_vfs_thread(void *ptr)
2962
2963
endvfs:
2964
ebpf_update_disabled_plugin_stats(em);
2967
-
2968
- return NULL;
2965
}
src/collectors/ebpf.plugin/ebpf_vfs.h
+1
-1
@@ -135,7 +135,7 @@ enum netdata_vfs_calls_name {
135
NETDATA_VFS_END_LIST
136
};
137
138
-void *ebpf_vfs_thread(void *ptr);
138
+void ebpf_vfs_thread(void *ptr);
139
void ebpf_vfs_create_apps_charts(struct ebpf_module *em, void *ptr);
140
void ebpf_vfs_release(netdata_publish_vfs_t *stat);
141
extern netdata_ebpf_targets_t vfs_targets[];
src/collectors/ebpf.plugin/libbpf_api/ebpf.h
+1
-1
@@ -317,7 +317,7 @@ typedef struct ebpf_module {
317
318
// Helpers used with plugin
319
struct {
320
- void *(*start_routine)(void *); // the thread function
320
+ void (*start_routine)(void *); // the thread function
321
void (*apps_routine)(struct ebpf_module *em, void *ptr); // the apps charts
322
void (*fnct_routine)(BUFFER *bf, struct ebpf_module *em); // the function used for exteernal requests
323
const char *fcnt_name; // name given to cloud
src/collectors/freeipmi.plugin/freeipmi_plugin.c
+2
-4
@@ -1196,7 +1196,7 @@ struct ipmi_collection_thread {
1196
struct netdata_ipmi_state state;
1197
};
1198
1199
-void *netdata_ipmi_collection_thread(void *ptr) {
1199
+void netdata_ipmi_collection_thread(void *ptr) {
1200
struct ipmi_collection_thread *t = ptr;
1201
1202
if(t->debug) fprintf(stderr, "%s: calling initialize_ipmi_config() for %s\n",
@@ -1219,7 +1219,7 @@ void *netdata_ipmi_collection_thread(void *ptr) {
1219
t->state.sel.last_iteration_ut = 0;
1220
}
1221
1222
- return ptr;
1222
+ return;
1223
}
1224
else {
1225
if(t->type & IPMI_COLLECT_TYPE_SENSORS) {
@@ -1291,8 +1291,6 @@ void *netdata_ipmi_collection_thread(void *ptr) {
1291
t->state = tmp_state;
1292
spinlock_unlock(&t->spinlock);
1293
}
1294
-
1295
- return ptr;
1294
}
1295
1296
// ----------------------------------------------------------------------------
src/collectors/idlejitter.plugin/plugin_idlejitter.c
+1
-3
@@ -15,7 +15,7 @@ static void cpuidlejitter_main_cleanup(void *pptr) {
15
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
16
}
17
18
-void *cpuidlejitter_main(void *ptr) {
18
+void cpuidlejitter_main(void *ptr) {
19
CLEANUP_FUNCTION_REGISTER(cpuidlejitter_main_cleanup) cleanup_ptr = ptr;
20
21
worker_register("IDLEJITTER");
@@ -84,7 +84,5 @@ void *cpuidlejitter_main(void *ptr) {
84
rrdset_done(st);
85
}
86
}
87
-
88
- return NULL;
87
}
88
src/collectors/macos.plugin/plugin_macos.c
+1
-3
@@ -37,7 +37,7 @@ static void macos_main_cleanup(void *pptr)
37
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
38
}
39
40
-void *macos_main(void *ptr)
40
+void macos_main(void *ptr)
41
{
42
CLEANUP_FUNCTION_REGISTER(macos_main_cleanup) cleanup_ptr = ptr;
43
@@ -77,6 +77,4 @@ void *macos_main(void *ptr)
77
break;
78
}
79
}
80
-
81
- return NULL;
80
}
src/collectors/proc.plugin/plugin_proc.c
+1
-3
@@ -207,7 +207,7 @@ static bool log_proc_module(BUFFER *wb, void *data) {
207
return true;
208
}
209
210
-void *proc_main(void *ptr)
210
+void proc_main(void *ptr)
211
{
212
CLEANUP_FUNCTION_REGISTER(proc_main_cleanup) cleanup_ptr = ptr;
213
@@ -270,8 +270,6 @@ void *proc_main(void *ptr)
270
lgs[LGS_MODULE_ID] = ND_LOG_FIELD_TXT(NDF_MODULE, "proc.plugin");
271
}
272
}
273
-
274
- return NULL;
273
}
274
275
int get_numa_node_count(void)
src/collectors/proc.plugin/plugin_proc.h
+1
-1
@@ -9,7 +9,7 @@
9
#define PLUGIN_PROC_NAME PLUGIN_PROC_CONFIG_NAME ".plugin"
10
11
#define THREAD_NETDEV_NAME "P[proc netdev]"
12
-void *netdev_main(void *ptr_is_null);
12
+void netdev_main(void *ptr_is_null);
13
14
int do_proc_net_wireless(int update_every, usec_t dt);
15
int do_proc_diskstats(int update_every, usec_t dt);
src/collectors/proc.plugin/proc_net_dev.c
+1
-3
@@ -1711,7 +1711,7 @@ static void netdev_main_cleanup(void *pptr) {
1711
worker_unregister();
1712
}
1713
1714
-void *netdev_main(void *ptr_is_null __maybe_unused)
1714
+void netdev_main(void *ptr_is_null __maybe_unused)
1715
{
1716
CLEANUP_FUNCTION_REGISTER(netdev_main_cleanup) cleanup_ptr = (void *)0x01;
1717
@@ -1746,6 +1746,4 @@ void *netdev_main(void *ptr_is_null __maybe_unused)
1746
break;
1747
netdata_mutex_unlock(&netdev_mutex);
1748
}
1749
-
1750
- return NULL;
1749
}
src/collectors/profile.plugin/plugin_profile.cc
+1
-2
@@ -174,10 +174,9 @@ private:
174
std::vector<RRDDIM *> Dimensions;
175
};
176
177
-static void *subprofile_main(void* Arg) {
177
+static void subprofile_main(void* Arg) {
178
Profiler *P = reinterpret_cast<Profiler *>(Arg);
179
P->run();
180
- return nullptr;
180
}
181
182
static void profile_main_cleanup(void *pptr) {
src/collectors/statsd.plugin/statsd.c
+1
-3
@@ -1100,7 +1100,7 @@ static bool statsd_should_stop(void) {
1100
return !service_running(SERVICE_COLLECTORS);
1101
}
1102
1103
-void *statsd_collector_thread(void *ptr) {
1103
+void statsd_collector_thread(void *ptr) {
1104
struct collection_thread_status *status = ptr;
1105
spinlock_lock(&status->spinlock);
1106
status->initializing = false;
@@ -1150,8 +1150,6 @@ void *statsd_collector_thread(void *ptr) {
1150
, ptr // timer_data
1151
, status->max_sockets
1152
);
1153
-
1154
- return NULL;
1153
}
1154
1155
src/collectors/systemd-journal.plugin/systemd-internals.h
+1
-1
@@ -138,7 +138,7 @@ void nd_journal_file_update_header(const char *filename, struct nd_journal_file
138
void nd_sd_journal_annotations_init(void);
139
void nd_sd_journal_transform_message_id(FACETS *facets, BUFFER *wb, FACETS_TRANSFORMATION_SCOPE scope, void *data);
140
141
-void *nd_journal_watcher_main(void *arg);
141
+void nd_journal_watcher_main(void *arg);
142
void nd_journal_watcher_restart(void);
143
144
static inline bool parse_journal_field(
src/collectors/systemd-journal.plugin/systemd-journal-watcher.c
+2
-4
@@ -537,7 +537,7 @@ static bool process_inotify_events(struct buffered_reader *reader, Watcher *watc
537
return unmount_event;
538
}
539
540
-void *nd_journal_watcher_main(void *arg __maybe_unused)
540
+void nd_journal_watcher_main(void *arg __maybe_unused)
541
{
542
while (1) {
543
size_t journal_watcher_session_id = __atomic_load_n(&journal_watcher_wanted_session_id, __ATOMIC_RELAXED);
@@ -555,7 +555,7 @@ void *nd_journal_watcher_main(void *arg __maybe_unused)
555
if (inotifyFd < 0) {
556
nd_log(NDLS_COLLECTORS, NDLP_ERR, "inotify_init() failed.");
557
free_watches(&watcher, inotifyFd);
558
- return NULL;
558
+ return;
559
}
560
561
for (unsigned i = 0; i < MAX_JOURNAL_DIRECTORIES; i++) {
@@ -610,6 +610,4 @@ void *nd_journal_watcher_main(void *arg __maybe_unused)
610
611
sleep_usec(2 * USEC_PER_SEC);
612
}
613
-
614
- return NULL;
613
}
src/collectors/tc.plugin/plugin_tc.c
+5
-8
@@ -872,7 +872,7 @@ static void tc_main_cleanup(void *pptr) {
872
#error WORKER_UTILIZATION_MAX_JOB_TYPES has to be at least 10
873
#endif
874
875
-void *tc_main(void *ptr) {
875
+void tc_main(void *ptr) {
876
CLEANUP_FUNCTION_REGISTER(tc_main_cleanup) cleanup_ptr = ptr;
877
878
worker_register("TC");
@@ -922,7 +922,7 @@ void *tc_main(void *ptr) {
922
tc_child_instance = spawn_popen_run(command);
923
if(!tc_child_instance) {
924
collector_error("TC: Cannot popen(\"%s\", \"r\").", command);
925
- goto cleanup;
925
+ return;
926
}
927
928
char buffer[TC_LINE_MAX+1] = "";
@@ -1143,18 +1143,15 @@ void *tc_main(void *ptr) {
1143
}
1144
1145
if(unlikely(!service_running(SERVICE_COLLECTORS)))
1146
- goto cleanup;
1146
+ return;
1147
1148
if(code == 1 || code == 127) {
1149
// 1 = DISABLE
1150
// 127 = cannot even run it
1151
collector_error("TC: tc-qos-helper.sh exited with code %d. Disabling it.", code);
1152
- goto cleanup;
1152
+ return;
1153
}
1154
1155
sleep((unsigned int) localhost->rrd_update_every);
1156
- }
1157
-
1158
-cleanup: ; // added semi-colon to prevent older gcc error: label at end of compound statement
1159
- return NULL;
1156
+ };
1157
}
src/collectors/timex.plugin/plugin_timex.c
+2
-5
@@ -47,7 +47,7 @@ static void timex_main_cleanup(void *pptr)
47
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
48
}
49
50
-void *timex_main(void *ptr)
50
+void timex_main(void *ptr)
51
{
52
CLEANUP_FUNCTION_REGISTER(timex_main_cleanup) cleanup_ptr = ptr;
53
@@ -65,7 +65,7 @@ void *timex_main(void *ptr)
65
66
if (unlikely(do_sync == CONFIG_BOOLEAN_NO && do_offset == CONFIG_BOOLEAN_NO)) {
67
netdata_log_info("No charts to show");
68
- goto exit;
68
+ return;
69
}
70
71
usec_t step = update_every * USEC_PER_SEC;
@@ -184,9 +184,6 @@ void *timex_main(void *ptr)
184
rrdset_done(st_offset);
185
}
186
}
187
-
188
-exit:
189
- return NULL;
187
}
188
189
#endif // !defined(OS_MACOS) || (MAC_OS_X_VERSION_MIN_REQUIRED >= 101300)
src/collectors/windows.plugin/perflib-mssql.c
+1
-3
@@ -1124,7 +1124,7 @@ int dict_mssql_query_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value,
1124
return 1;
1125
}
1126
1127
-void *netdata_mssql_queries(void *ptr __maybe_unused)
1127
+static void netdata_mssql_queries(void *ptr __maybe_unused)
1128
{
1129
heartbeat_t hb;
1130
heartbeat_init(&hb, USEC_PER_SEC);
@@ -1138,8 +1138,6 @@ void *netdata_mssql_queries(void *ptr __maybe_unused)
1138
1139
dictionary_sorted_walkthrough_read(mssql_instances, dict_mssql_query_cb, &update_every);
1140
}
1141
-
1142
- return NULL;
1141
}
1142
1143
static ND_THREAD *mssql_queries_thread = NULL;
src/collectors/windows.plugin/windows_plugin.c
+2
-5
@@ -217,7 +217,7 @@ static bool log_windows_module(BUFFER *wb, void *data)
217
return true;
218
}
219
220
-static void *windows_plugin_thread_worker(void *ptr __maybe_unused)
220
+static void windows_plugin_thread_worker(void *ptr __maybe_unused)
221
{
222
struct proc_module *mod = ptr;
223
heartbeat_t hb;
@@ -239,11 +239,9 @@ static void *windows_plugin_thread_worker(void *ptr __maybe_unused)
239
mod->func(update_every, now - last);
240
last = now;
241
}
242
-
243
- return NULL;
242
}
243
246
-void *win_plugin_main(void *ptr)
244
+void win_plugin_main(void *ptr)
245
{
246
worker_register("WIN");
247
@@ -324,5 +322,4 @@ void *win_plugin_main(void *ptr)
322
nd_thread_join(pm->thread);
323
}
324
}
327
- return NULL;
325
}
src/collectors/windows.plugin/windows_plugin.h
+1
-1
@@ -15,7 +15,7 @@
15
#define MEGA_FACTOR (1048576)
16
#endif
17
18
-void *win_plugin_main(void *ptr);
18
+void win_plugin_main(void *ptr);
19
20
extern char windows_shared_buffer[8192];
21
src/daemon/config/netdata-conf-db.c
+1
-2
@@ -105,10 +105,9 @@ struct dbengine_initialization {
105
int ret;
106
};
107
108
-void *dbengine_tier_init(void *ptr) {
108
+void dbengine_tier_init(void *ptr) {
109
struct dbengine_initialization *dbi = ptr;
110
dbi->ret = rrdeng_init(NULL, dbi->path, dbi->disk_space_mb, dbi->tier, dbi->retention_seconds);
111
- return ptr;
111
}
112
113
RRD_BACKFILL get_dbengine_backfill(RRD_BACKFILL backfill)
src/daemon/daemon-shutdown-watcher.c
+1
-3
@@ -112,7 +112,7 @@ static void watcher_wait_for_step(const watcher_step_id_t step_id, usec_t shutdo
112
}
113
}
114
115
-void *watcher_main(void *arg)
115
+void watcher_main(void *arg)
116
{
117
UNUSED(arg);
118
@@ -159,8 +159,6 @@ void *watcher_main(void *arg)
159
160
daemon_status_file_shutdown_step(NULL, buffer_tostring(steps_timings));
161
daemon_status_file_update_status(DAEMON_STATUS_EXITED);
162
-
163
- return NULL;
162
}
163
164
void watcher_thread_start() {
src/daemon/daemon-shutdown.c
+1
-2
@@ -98,10 +98,9 @@ void cancel_main_threads(void) {
98
}
99
100
#ifdef ENABLE_DBENGINE
101
-static void *rrdeng_exit_background(void *ptr) {
101
+static void rrdeng_exit_background(void *ptr) {
102
struct rrdengine_instance *ctx = ptr;
103
rrdeng_exit(ctx);
104
- return NULL;
104
}
105
106
static void rrdeng_quiesce_all()
src/daemon/daemon-systemd-watcher.c
+1
-2
@@ -135,7 +135,7 @@ finish:
135
sd_bus_unref(bus);
136
}
137
138
-void *systemd_watcher_thread(void *arg) {
138
+void systemd_watcher_thread(void *arg) {
139
struct netdata_static_thread *static_thread = arg;
140
141
service_register(NULL, NULL, NULL);
@@ -145,5 +145,4 @@ void *systemd_watcher_thread(void *arg) {
145
service_exits();
146
worker_unregister();
147
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
148
- return NULL;
148
}
src/daemon/daemon-systemd-watcher.h
+1
-1
@@ -3,6 +3,6 @@
3
#ifndef NETDATA_DAEMON_SYSTEMD_WATCHER_H
4
#define NETDATA_DAEMON_SYSTEMD_WATCHER_H
5
6
-void *systemd_watcher_thread(void *arg);
6
+void systemd_watcher_thread(void *arg);
7
8
#endif //NETDATA_DAEMON_SYSTEMD_WATCHER_H
src/daemon/dyncfg/dyncfg-unittest.c
+1
-3
@@ -165,7 +165,7 @@ static int dyncfg_unittest_action(struct dyncfg_unittest_action *a) {
165
return rc;
166
}
167
168
-static void *dyncfg_unittest_thread_action(void *ptr) {
168
+static void dyncfg_unittest_thread_action(void *ptr __maybe_unused) {
169
while(!nd_thread_signaled_to_cancel()) {
170
struct dyncfg_unittest_action *a = NULL;
171
spinlock_lock(&dyncfg_unittest_data.spinlock);
@@ -179,8 +179,6 @@ static void *dyncfg_unittest_thread_action(void *ptr) {
179
else
180
sleep_usec(10 * USEC_PER_MS);
181
}
182
-
183
- return ptr;
182
}
183
184
static int dyncfg_unittest_execute_cb(struct rrd_function_execute *rfe, void *data) {
src/daemon/pulse/pulse.c
+4
-12
@@ -52,7 +52,7 @@ static void pulse_register_workers(void) {
52
worker_register_job_name(WORKER_JOB_MEMORY_EXTENDED, "memory extended");
53
}
54
55
-void *pulse_thread_main(void *ptr) {
55
+void pulse_thread_main(void *ptr) {
56
struct netdata_static_thread *static_thread = ptr;
57
pulse_register_workers();
58
@@ -139,14 +139,12 @@ void *pulse_thread_main(void *ptr) {
139
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
140
worker_unregister();
141
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
142
-
143
- return NULL;
142
}
143
144
// ---------------------------------------------------------------------------------------------------------------------
145
// pulse sqlite3 thread
146
149
-void *pulse_thread_sqlite3_main(void *ptr) {
147
+void pulse_thread_sqlite3_main(void *ptr) {
148
struct netdata_static_thread *static_thread = ptr;
149
pulse_register_workers();
150
@@ -182,14 +180,12 @@ void *pulse_thread_sqlite3_main(void *ptr) {
180
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
181
worker_unregister();
182
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
185
-
186
- return NULL;
183
}
184
185
// ---------------------------------------------------------------------------------------------------------------------
186
// pulse workers thread
187
192
-void *pulse_thread_workers_main(void *ptr) {
188
+void pulse_thread_workers_main(void *ptr) {
189
struct netdata_static_thread *static_thread = ptr;
190
pulse_register_workers();
191
@@ -226,14 +222,12 @@ void *pulse_thread_workers_main(void *ptr) {
222
pulse_workers_cleanup();
223
worker_unregister();
224
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
229
-
230
- return NULL;
225
}
226
227
// ---------------------------------------------------------------------------------------------------------------------
228
// pulse workers thread
229
236
-void *pulse_thread_memory_extended_main(void *ptr) {
230
+void pulse_thread_memory_extended_main(void *ptr) {
231
struct netdata_static_thread *static_thread = ptr;
232
pulse_register_workers();
233
@@ -274,6 +268,4 @@ void *pulse_thread_memory_extended_main(void *ptr) {
268
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
269
worker_unregister();
270
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
277
-
278
- return NULL;
271
}
src/daemon/pulse/pulse.h
+4
-4
@@ -28,10 +28,10 @@ extern bool pulse_extended_enabled;
28
#include "pulse-network.h"
29
#include "pulse-parents.h"
30
31
-void *pulse_thread_main(void *ptr);
32
-void *pulse_thread_sqlite3_main(void *ptr);
33
-void *pulse_thread_workers_main(void *ptr);
34
-void *pulse_thread_memory_extended_main(void *ptr);
31
+void pulse_thread_main(void *ptr);
32
+void pulse_thread_sqlite3_main(void *ptr);
33
+void pulse_thread_workers_main(void *ptr);
34
+void pulse_thread_memory_extended_main(void *ptr);
35
36
#define p1_add_fetch(variable, value) __atomic_add_fetch(variable, value, __ATOMIC_RELAXED)
37
#define p1_sub_fetch(variable, value) __atomic_sub_fetch(variable, value, __ATOMIC_RELAXED)
src/daemon/static_threads.c
+11
-12
@@ -7,17 +7,15 @@
7
#include "daemon-systemd-watcher.h"
8
#endif
9
10
-void *aclk_main(void *ptr);
11
-void *analytics_main(void *ptr);
12
-void *cpuidlejitter_main(void *ptr);
13
-void *health_main(void *ptr);
14
-void *pluginsd_main(void *ptr);
15
-void *service_main(void *ptr);
16
-void *statsd_main(void *ptr);
17
-void *profile_main(void *ptr);
18
-void *replication_thread_main(void *ptr);
19
-
20
-extern bool pulse_enabled;
10
+void aclk_main(void *ptr);
11
+void analytics_main(void *ptr);
12
+void cpuidlejitter_main(void *ptr);
13
+void health_main(void *ptr);
14
+void pluginsd_main(void *ptr);
15
+void service_main(void *ptr);
16
+void statsd_main(void *ptr);
17
+void profile_main(void *ptr);
18
+void replication_thread_main(void *ptr);
19
20
const struct netdata_static_thread static_threads_common[] = {
21
{
@@ -133,7 +131,8 @@ const struct netdata_static_thread static_threads_common[] = {
131
.enabled = 0,
132
.thread = NULL,
133
.init_routine = NULL,
136
- .start_routine = stream_sender_start_localhost},
134
+ .start_routine = stream_sender_start_localhost
135
+ },
136
{
137
.name = "WEB[1]",
138
.config_section = NULL,
src/daemon/static_threads_freebsd.c
+2
-2
@@ -2,8 +2,8 @@
2
3
#include "common.h"
4
5
-void *freebsd_main(void *ptr);
6
-void *timex_main(void *ptr);
5
+void freebsd_main(void *ptr);
6
+void timex_main(void *ptr);
7
8
static const struct netdata_static_thread static_threads_freebsd[] = {
9
{
src/daemon/static_threads_linux.c
+5
-5
@@ -2,11 +2,11 @@
2
3
#include "common.h"
4
5
-void *cgroups_main(void *ptr);
6
-void *proc_main(void *ptr);
7
-void *diskspace_main(void *ptr);
8
-void *tc_main(void *ptr);
9
-void *timex_main(void *ptr);
5
+void cgroups_main(void *ptr);
6
+void proc_main(void *ptr);
7
+void diskspace_main(void *ptr);
8
+void tc_main(void *ptr);
9
+void timex_main(void *ptr);
10
11
static const struct netdata_static_thread static_threads_linux[] = {
12
{
src/daemon/static_threads_macos.c
+2
-2
@@ -4,10 +4,10 @@
4
5
#include <AvailabilityMacros.h>
6
7
-void *macos_main(void *ptr);
7
+void macos_main(void *ptr);
8
9
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
10
- void *timex_main(void *ptr);
10
+ void timex_main(void *ptr);
11
#endif
12
13
static const struct netdata_static_thread static_threads_macos[] = {
src/daemon/static_threads_windows.c
+1
-1
@@ -2,7 +2,7 @@
2
3
#include "common.h"
4
5
-void *win_plugin_main(void *ptr);
5
+void win_plugin_main(void *ptr);
6
7
static const struct netdata_static_thread static_threads_windows[] = {
8
{
src/daemon/winsvc.cc
+1
-3
@@ -86,7 +86,7 @@ static HANDLE CreateEventHandle(const char *msg)
86
return h;
87
}
88
89
-static void *call_netdata_cleanup(void *arg)
89
+static void call_netdata_cleanup(void *arg)
90
{
91
DWORD controlCode = *((DWORD *)arg);
92
@@ -118,8 +118,6 @@ static void *call_netdata_cleanup(void *arg)
118
// Set status to stopped
119
netdata_service_log("Reporting the service as stopped...");
120
ReportSvcStatus(SERVICE_STOPPED, 0, 0, 0);
121
-
122
- return nullptr;
121
}
122
123
static void WINAPI ServiceControlHandler(DWORD controlCode)
src/database/contexts/rrdcontext-worker.c
+1
-3
@@ -1013,7 +1013,7 @@ static void rrdcontext_main_cleanup(void *pptr) {
1013
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
1014
}
1015
1016
-void *rrdcontext_main(void *ptr) {
1016
+void rrdcontext_main(void *ptr) {
1017
CLEANUP_FUNCTION_REGISTER(rrdcontext_main_cleanup) cleanup_ptr = ptr;
1018
1019
worker_register("RRDCONTEXT");
@@ -1094,6 +1094,4 @@ void *rrdcontext_main(void *ptr) {
1094
worker_set_metric(WORKER_JOB_HUB_QUEUE_SIZE, (NETDATA_DOUBLE)hub_queued_contexts_for_all_hosts);
1095
worker_set_metric(WORKER_JOB_PP_QUEUE_SIZE, (NETDATA_DOUBLE)pp_queued_contexts_for_all_hosts);
1096
}
1097
-
1098
- return NULL;
1097
}
src/database/contexts/rrdcontext.h
+1
-1
@@ -127,7 +127,7 @@ void rrdcontext_hub_stop_streaming_command(void *cmd);
127
// public API for threads
128
129
void rrdcontext_db_rotation(void);
130
-void *rrdcontext_main(void *);
130
+void rrdcontext_main(void *);
131
132
// ----------------------------------------------------------------------------
133
// public API for queries
src/database/engine/cache.c
+1
-2
@@ -1926,7 +1926,7 @@ void free_all_unreferenced_clean_pages(PGC *cache) {
1926
evict_pages(cache, 0, 0, true, true);
1927
}
1928
1929
-static void *pgc_evict_thread(void *ptr) {
1929
+static void pgc_evict_thread(void *ptr) {
1930
static usec_t last_malloc_release_ut = 0;
1931
1932
PGC *cache = ptr;
@@ -1968,7 +1968,6 @@ static void *pgc_evict_thread(void *ptr) {
1968
}
1969
1970
worker_unregister();
1971
- return NULL;
1971
}
1972
1973
// ----------------------------------------------------------------------------
src/database/engine/mrg-unittest.c
+1
-3
@@ -16,7 +16,7 @@ struct mrg_stress {
16
size_t updates;
17
};
18
19
-static void *mrg_stress(void *ptr) {
19
+static void mrg_stress(void *ptr) {
20
struct mrg_stress *t = ptr;
21
MRG *mrg = t->mrg;
22
@@ -48,8 +48,6 @@ static void *mrg_stress(void *ptr) {
48
__atomic_add_fetch(&t->updates, 1, __ATOMIC_RELAXED);
49
}
50
}
51
-
52
- return ptr;
51
}
52
53
int mrg_unittest(void) {
src/database/engine/rrdengine.c
+2
-4
@@ -1524,7 +1524,7 @@ struct mrg_load_thread {
1524
size_t max_running_threads = 0;
1525
size_t running_threads = 0;
1526
1527
-void *journalfile_v2_populate_retention_to_mrg_worker(void *arg)
1527
+void journalfile_v2_populate_retention_to_mrg_worker(void *arg)
1528
{
1529
struct mrg_load_thread *mlt = arg;
1530
uv_sem_wait(mlt->sem);
@@ -1548,7 +1548,6 @@ void *journalfile_v2_populate_retention_to_mrg_worker(void *arg)
1548
1549
// Signal completion - this needs to be last
1550
__atomic_store_n(&mlt->finished, true, __ATOMIC_RELEASE);
1551
- return NULL;
1551
}
1552
1553
static void after_populate_mrg(struct rrdengine_instance *ctx __maybe_unused, void *data __maybe_unused, struct completion *completion __maybe_unused, uv_work_t* req __maybe_unused, int status __maybe_unused) {
@@ -2277,7 +2276,7 @@ void rrdeng_calculate_tier_disk_space_percentage(void)
2276
#define NOT_INDEXING_FILES(ctx) \
2277
(!__atomic_load_n(&(ctx)->atomic.migration_to_v2_running, __ATOMIC_RELAXED))
2278
2280
-void *dbengine_event_loop(void* arg) {
2279
+void dbengine_event_loop(void* arg) {
2280
sanity_check();
2281
uv_thread_set_name_np("DBENGINE");
2282
service_register(NULL, NULL, NULL);
@@ -2514,7 +2513,6 @@ void *dbengine_event_loop(void* arg) {
2513
nd_log(NDLS_DAEMON, NDLP_DEBUG, "Shutting down dbengine thread");
2514
(void) uv_loop_close(&main->loop);
2515
worker_unregister();
2517
- return NULL;
2516
}
2517
2518
void dbengine_shutdown()
src/database/engine/rrdengine.h
+1
-1
@@ -487,7 +487,7 @@ bool rrdeng_ctx_tier_cap_exceeded(struct rrdengine_instance *ctx);
487
int init_rrd_files(struct rrdengine_instance *ctx);
488
void finalize_rrd_files(struct rrdengine_instance *ctx);
489
bool rrdeng_dbengine_spawn(struct rrdengine_instance *ctx);
490
-void *dbengine_event_loop(void *arg);
490
+void dbengine_event_loop(void *arg);
491
492
typedef void (*enqueue_callback_t)(struct rrdeng_cmd *cmd);
493
typedef void (*dequeue_callback_t)(struct rrdeng_cmd *cmd);
src/database/sqlite/sqlite_aclk.c
+1
-2
@@ -594,7 +594,7 @@ static void timer_cb(uv_timer_t *handle)
594
#define ACLK_JOBS_ARE_RUNNING \
595
(config->aclk_queries_running || config->alert_push_running || config->aclk_batch_job_is_running)
596
597
-static void *aclk_synchronization_event_loop(void *arg)
597
+static void aclk_synchronization_event_loop(void *arg)
598
{
599
struct aclk_sync_config_s *config = arg;
600
uv_thread_set_name_np("ACLKSYNC");
@@ -915,7 +915,6 @@ static void *aclk_synchronization_event_loop(void *arg)
915
worker_unregister();
916
service_exits();
917
completion_mark_complete(&config->start_stop_complete);
918
- return NULL;
918
}
919
920
static void aclk_initialize_event_loop(void)
src/database/sqlite/sqlite_metadata.c
+4
-8
@@ -1741,13 +1741,13 @@ __thread sqlite3 *db_meta_thread = NULL;
1741
__thread sqlite3 *db_context_thread = NULL;
1742
__thread bool main_context_thread = false;
1743
1744
-static void *restore_host_context(void *arg)
1744
+static void restore_host_context(void *arg)
1745
{
1746
struct host_context_load_thread *hclt = arg;
1747
RRDHOST *host = hclt->host;
1748
1749
if (!host)
1750
- return NULL;
1750
+ return;
1751
1752
if (!db_meta_thread) {
1753
if (hclt->db_meta_thread) {
@@ -1794,7 +1794,6 @@ static void *restore_host_context(void *arg)
1794
}
1795
1796
__atomic_store_n(&hclt->finished, true, __ATOMIC_RELEASE);
1797
- return NULL;
1797
}
1798
1799
// Callback after scan of hosts is done
@@ -2457,7 +2456,7 @@ static void start_metadata_hosts(uv_work_t *req)
2456
#define SHUTDOWN_SLEEP_INTERVAL_MS (100)
2457
#define CMD_POOL_SIZE (32768)
2458
2460
-static void *metadata_event_loop(void *arg)
2459
+static void metadata_event_loop(void *arg)
2460
{
2461
struct meta_config_s *config = arg;
2462
uv_thread_set_name_np(EVENT_LOOP_NAME);
@@ -2713,8 +2712,6 @@ static void *metadata_event_loop(void *arg)
2712
worker_unregister();
2713
service_exits();
2714
completion_mark_complete(&config->start_stop_complete);
2716
-
2717
- return NULL;
2715
}
2716
2717
void metadata_sync_shutdown(void)
@@ -2949,7 +2946,7 @@ void get_agent_event_time_median_init(void) {
2946
// unitests
2947
//
2948
2952
-static void *unittest_queue_metadata(void *arg) {
2949
+static void unittest_queue_metadata(void *arg) {
2950
struct thread_unittest *tu = arg;
2951
2952
cmd_data_t cmd;
@@ -2963,7 +2960,6 @@ static void *unittest_queue_metadata(void *arg) {
2960
metadata_enq_cmd(&cmd, true);
2961
sleep_usec(10000);
2962
} while (!__atomic_load_n(&tu->join, __ATOMIC_RELAXED));
2966
- return arg;
2963
}
2964
2965
static void *metadata_unittest_threads(void)
src/exporting/exporting_engine.c
+3
-6
@@ -184,19 +184,19 @@ static void exporting_main_cleanup(void *pptr)
184
*
185
* @return It always returns NULL.
186
*/
187
-void *exporting_main(void *ptr)
187
+void exporting_main(void *ptr)
188
{
189
CLEANUP_FUNCTION_REGISTER(exporting_main_cleanup) cleanup_ptr = ptr;
190
191
engine = read_exporting_config();
192
if (!engine) {
193
netdata_log_info("EXPORTING: no exporting connectors configured");
194
- goto cleanup;
194
+ return;
195
}
196
197
if (init_connectors(engine) != 0) {
198
netdata_log_error("EXPORTING: cannot initialize exporting connectors");
199
- goto cleanup;
199
+ return;
200
}
201
202
RRDSET *st_main_rusage = NULL;
@@ -221,7 +221,4 @@ void *exporting_main(void *ptr)
221
#endif
222
}
223
service_exits();
224
-
225
-cleanup:
226
- return NULL;
224
}
src/exporting/exporting_engine.h
+3
-3
@@ -196,7 +196,7 @@ struct stats {
196
struct instance {
197
struct instance_config config;
198
void *buffer;
199
- void *(*worker)(void *instance_p);
199
+ void (*worker)(void *instance_p);
200
struct stats stats;
201
202
int scheduled;
@@ -252,7 +252,7 @@ struct engine {
252
253
extern struct instance *prometheus_exporter_instance;
254
255
-void *exporting_main(void *ptr);
255
+void exporting_main(void *ptr);
256
257
struct engine *read_exporting_config();
258
EXPORTING_CONNECTOR_TYPE exporting_select_type(const char *type);
@@ -291,7 +291,7 @@ int exporting_discard_response(BUFFER *buffer, struct instance *instance);
291
void simple_connector_receive_response(int *sock, struct instance *instance);
292
void simple_connector_send_buffer(
293
int *sock, int *failures, struct instance *instance, BUFFER *header, BUFFER *buffer, size_t buffered_metrics);
294
-void *simple_connector_worker(void *instance_p);
294
+void simple_connector_worker(void *instance_p);
295
296
void create_main_rusage_chart(RRDSET **st_rusage, RRDDIM **rd_user, RRDDIM **rd_system);
297
void send_main_rusage(RRDSET *st_rusage, RRDDIM *rd_user, RRDDIM *rd_system);
src/exporting/init_connectors.c
-2
@@ -230,6 +230,4 @@ void simple_connector_init(struct instance *instance)
230
231
buffer_free(auth_string);
232
}
233
-
234
- return;
233
}
src/exporting/mongodb/mongodb.c
+1
-2
@@ -276,7 +276,7 @@ void mongodb_cleanup(struct instance *instance)
276
*
277
* @param instance_p an instance data structure.
278
*/
279
-void *mongodb_connector_worker(void *instance_p)
279
+void mongodb_connector_worker(void *instance_p)
280
{
281
struct instance *instance = (struct instance *)instance_p;
282
#ifdef NETDATA_INTERNAL_CHECKS
@@ -389,5 +389,4 @@ void *mongodb_connector_worker(void *instance_p)
389
}
390
391
mongodb_cleanup(instance);
392
- return NULL;
392
}
src/exporting/mongodb/mongodb.h
+1
-1
@@ -30,6 +30,6 @@ void mongodb_cleanup(struct instance *instance);
30
31
int init_mongodb_instance(struct instance *instance);
32
int format_batch_mongodb(struct instance *instance);
33
-void *mongodb_connector_worker(void *instance_p);
33
+void mongodb_connector_worker(void *instance_p);
34
35
#endif //NETDATA_EXPORTING_MONGODB_H
src/exporting/send_data.c
+1
-3
@@ -205,7 +205,7 @@ void simple_connector_send_buffer(
205
*
206
* @param instance_p an instance data structure.
207
*/
208
-void *simple_connector_worker(void *instance_p)
208
+void simple_connector_worker(void *instance_p)
209
{
210
struct instance *instance = (struct instance*)instance_p;
211
struct simple_connector_data *connector_specific_data = instance->connector_specific_data;
@@ -390,6 +390,4 @@ void *simple_connector_worker(void *instance_p)
390
#endif
391
392
simple_connector_cleanup(instance);
393
-
394
- return NULL;
393
}
src/libnetdata/aral/aral.c
+1
-3
@@ -1406,7 +1406,7 @@ static inline struct aral_unittest_entry *unittest_aral_malloc(ARAL *ar, bool ma
1406
return t;
1407
}
1408
1409
-static void *aral_test_thread(void *ptr) {
1409
+static void aral_test_thread(void *ptr) {
1410
struct aral_unittest_config *auc = ptr;
1411
ARAL *ar = auc->ar;
1412
size_t elements = auc->elements;
@@ -1504,8 +1504,6 @@ static void *aral_test_thread(void *ptr) {
1504
} while(!auc->single_threaded && !__atomic_load_n(&auc->stop, __ATOMIC_RELAXED));
1505
1506
freez(pointers);
1507
-
1508
- return ptr;
1507
}
1508
1509
int aral_stress_test(size_t threads, size_t elements, size_t seconds) {
src/libnetdata/dictionary/dictionary-unittest.c
+3
-9
@@ -573,7 +573,7 @@ struct thread_unittest {
573
struct dictionary_stats stats;
574
};
575
576
-static void *unittest_dict_thread(void *arg) {
576
+static void unittest_dict_thread(void *arg) {
577
struct thread_unittest *tu = arg;
578
for(; 1 ;) {
579
if(__atomic_load_n(&tu->join, __ATOMIC_RELAXED))
@@ -661,8 +661,6 @@ static void *unittest_dict_thread(void *arg) {
661
}
662
}
663
}
664
-
665
- return arg;
664
}
665
666
static int dictionary_unittest_threads() {
@@ -767,7 +765,7 @@ struct thread_view_unittest {
765
int dups;
766
};
767
770
-static void *unittest_dict_master_thread(void *arg) {
768
+static void unittest_dict_master_thread(void *arg) {
769
struct thread_view_unittest *tv = arg;
770
771
DICTIONARY_ITEM *item = NULL;
@@ -803,11 +801,9 @@ static void *unittest_dict_master_thread(void *arg) {
801
item = NULL;
802
loops = 0;
803
}
806
-
807
- return arg;
804
}
805
810
-static void *unittest_dict_view_thread(void *arg) {
806
+static void unittest_dict_view_thread(void *arg) {
807
struct thread_view_unittest *tv = arg;
808
809
DICTIONARY_ITEM *m_item = NULL;
@@ -837,8 +833,6 @@ static void *unittest_dict_view_thread(void *arg) {
833
834
dictionary_acquired_item_release(tv->view, v_item);
835
}
840
-
841
- return arg;
836
}
837
838
static struct dictionary_stats stats_master = { 0 };
src/libnetdata/functions_evloop/functions_evloop.c
+2
-4
@@ -83,7 +83,7 @@ static void rrd_functions_worker_canceller(void *data) {
83
pthread_mutex_unlock(&wg->worker_mutex);
84
}
85
86
-static void *rrd_functions_worker_globals_worker_main(void *arg) {
86
+static void rrd_functions_worker_globals_worker_main(void *arg) {
87
struct functions_evloop_globals *wg = arg;
88
89
nd_thread_register_canceller(rrd_functions_worker_canceller, wg);
@@ -138,8 +138,6 @@ static void *rrd_functions_worker_globals_worker_main(void *arg) {
138
else
139
last_acquired = false;
140
}
141
-
142
- return NULL;
141
}
142
143
static void worker_add_job(struct functions_evloop_globals *wg, const char *keyword, char *transaction, char *function, char *timeout_s, BUFFER *payload, const char *access, const char *source) {
@@ -302,7 +300,7 @@ static bool rrd_function_worker_global_process_input(struct functions_evloop_glo
300
return false;
301
}
302
305
-static void *rrd_functions_worker_globals_reader_main(void *arg) {
303
+static void rrd_functions_worker_globals_reader_main(void *arg) {
304
struct functions_evloop_globals *wg = arg;
305
306
buffered_reader_init(&wg->reader);
src/libnetdata/local-sockets/local-sockets.h
+1
-3
@@ -1602,7 +1602,7 @@ struct local_sockets_namespace_worker {
1602
uint64_t inode;
1603
};
1604
1605
-static inline void *local_sockets_get_namespace_sockets_worker(void *arg) {
1605
+static inline void local_sockets_get_namespace_sockets_worker(void *arg) {
1606
struct local_sockets_namespace_worker *data = arg;
1607
LS_STATE *ls = data->ls;
1608
const uint64_t inode = data->inode;
@@ -1627,8 +1627,6 @@ static inline void *local_sockets_get_namespace_sockets_worker(void *arg) {
1627
}
1628
1629
spinlock_unlock(&ls->spinlock);
1630
-
1631
- return NULL;
1630
}
1631
1632
static inline void local_sockets_namespaces(LS_STATE *ls) {
src/libnetdata/locks/benchmark-rw.c
+1
-3
@@ -106,7 +106,7 @@ static void wait_for_start(pthread_cond_t *cond, pthread_mutex_t *mutex, uint64_
106
pthread_mutex_unlock(mutex);
107
}
108
109
-static void* benchmark_thread(void *arg) {
109
+static void benchmark_thread(void *arg) {
110
thread_context_t *ctx = (thread_context_t *)arg;
111
rwlock_control_t *control = ctx->control;
112
@@ -166,8 +166,6 @@ static void* benchmark_thread(void *arg) {
166
__atomic_store_n(&control->stats[ctx->thread_id].operations, operations, __ATOMIC_RELEASE);
167
__atomic_store_n(&control->stats[ctx->thread_id].ready, 1, __ATOMIC_RELEASE);
168
}
169
-
170
- return NULL;
169
}
170
171
static void print_summary(const summary_stats_t *summary) {
src/libnetdata/locks/benchmark.c
+1
-3
@@ -88,7 +88,7 @@ static void wait_for_signal(pthread_cond_t *cond, pthread_mutex_t *mutex, uint64
88
pthread_mutex_unlock(mutex);
89
}
90
91
-static void* benchmark_thread(void *arg) {
91
+static void benchmark_thread(void *arg) {
92
thread_context_t *ctx = (thread_context_t *)arg;
93
thread_stats_t *stats = &ctx->control->stats[ctx->thread_id];
94
thread_control_t *thread_control = &ctx->control->thread_controls[ctx->thread_id];
@@ -166,8 +166,6 @@ static void* benchmark_thread(void *arg) {
166
__atomic_store_n(&stats->locks, local_counter, __ATOMIC_RELEASE);
167
__atomic_store_n(&stats->ready, 1, __ATOMIC_RELEASE);
168
}
169
-
170
- return NULL;
169
}
170
171
static void print_thread_stats(const char *test_name, int threads, thread_context_t *contexts,
src/libnetdata/locks/waitq.c
+1
-3
@@ -150,7 +150,7 @@ static const char *priority_to_string(WAITQ_PRIORITY p) {
150
}
151
}
152
153
-static void *stress_thread(void *arg) {
153
+static void stress_thread(void *arg) {
154
struct thread_args *args = arg;
155
156
THREAD_STATS *stats = args->stats;
@@ -172,8 +172,6 @@ static void *stress_thread(void *arg) {
172
173
waitq_release(wq);
174
}
175
-
176
- return NULL;
175
}
176
177
static void print_thread_stats(THREAD_STATS *stats, size_t count, usec_t duration) {
src/libnetdata/spawn_server/log-forwarder.c
+2
-4
@@ -23,7 +23,7 @@ typedef struct LOG_FORWARDER {
23
bool running;
24
} LOG_FORWARDER;
25
26
-static void *log_forwarder_thread_func(void *arg);
26
+static void log_forwarder_thread_func(void *arg);
27
28
// --------------------------------------------------------------------------------------------------------------------
29
// helper functions
@@ -230,7 +230,7 @@ static inline size_t log_forwarder_remove_deleted_unsafe(LOG_FORWARDER *lf) {
230
return entries;
231
}
232
233
-static void *log_forwarder_thread_func(void *arg) {
233
+static void log_forwarder_thread_func(void *arg) {
234
LOG_FORWARDER *lf = (LOG_FORWARDER *)arg;
235
236
while (1) {
@@ -333,6 +333,4 @@ static void *log_forwarder_thread_func(void *arg) {
333
log_forwarder_remove_deleted_unsafe(lf);
334
spinlock_unlock(&lf->spinlock);
335
close(lf->pipe_fds[PIPE_READ]);
336
-
337
- return NULL;
336
}
src/libnetdata/string/string.c
+1
-3
@@ -487,7 +487,7 @@ struct thread_unittest {
487
int dups;
488
};
489
490
-static void *string_thread(void *arg) {
490
+static void string_thread(void *arg) {
491
struct thread_unittest *tu = arg;
492
493
for(; 1 ;) {
@@ -504,8 +504,6 @@ static void *string_thread(void *arg) {
504
505
string_freez(s);
506
}
507
-
508
- return arg;
507
}
508
509
static char **string_unittest_generate_names(size_t entries) {
src/libnetdata/threads/threads.c
+4
-4
@@ -19,8 +19,8 @@ struct nd_thread {
19
void *arg;
20
pid_t tid;
21
char tag[ND_THREAD_TAG_MAX + 1];
22
- void *ret; // the return value of start routine
23
- void *(*start_routine) (void *);
22
+ //void *ret; // the return value of start routine
23
+ void (*start_routine) (void *);
24
NETDATA_THREAD_OPTIONS options;
25
uv_thread_t thread;
26
bool cancel_atomic;
@@ -364,7 +364,7 @@ static void nd_thread_starting_point(void *ptr) {
364
spinlock_unlock(&threads_globals.running.spinlock);
365
366
// run the thread code
367
- nti->ret = nti->start_routine(nti->arg);
367
+ nti->start_routine(nti->arg);
368
369
nd_thread_exit(nti);
370
}
@@ -397,7 +397,7 @@ static int create_uv_thread(uv_thread_t *thread, uv_thread_cb thread_func, void
397
return err;
398
}
399
400
-ND_THREAD *nd_thread_create(const char *tag, NETDATA_THREAD_OPTIONS options, void *(*start_routine)(void *), void *arg)
400
+ND_THREAD *nd_thread_create(const char *tag, NETDATA_THREAD_OPTIONS options, void (*start_routine)(void *), void *arg)
401
{
402
ND_THREAD *nti = callocz(1, sizeof(*nti));
403
spinlock_init(&nti->canceller.spinlock);
src/libnetdata/threads/threads.h
+2
-2
@@ -47,7 +47,7 @@ struct netdata_static_thread {
47
void (*init_routine) (void);
48
49
// the threaded worker
50
- void *(*start_routine) (void *);
50
+ void (*start_routine) (void *);
51
52
// the environment variable to create
53
char *env_name;
@@ -72,7 +72,7 @@ size_t netdata_threads_init(void);
72
void netdata_threads_set_stack_size(size_t stacksize);
73
void netdata_threads_init_for_external_plugins(size_t stacksize);
74
75
-ND_THREAD *nd_thread_create(const char *tag, NETDATA_THREAD_OPTIONS options, void *(*start_routine) (void *), void *arg);
75
+ND_THREAD *nd_thread_create(const char *tag, NETDATA_THREAD_OPTIONS options, void (*start_routine) (void *), void *arg);
76
int nd_thread_join(ND_THREAD * nti);
77
ND_THREAD *nd_thread_self(void);
78
bool nd_thread_is_me(ND_THREAD *nti);
src/libnetdata/uuid/uuidmap.c
+1
-3
@@ -310,7 +310,7 @@ typedef struct thread_stats {
310
size_t cycles;
311
} THREAD_STATS;
312
313
-static void *concurrent_test_thread(void *arg) {
313
+static void concurrent_test_thread(void *arg) {
314
THREAD_STATS *stats = arg;
315
nd_uuid_t test_uuid = {
316
0x12, 0x34, 0x56, 0x78,
@@ -359,8 +359,6 @@ static void *concurrent_test_thread(void *arg) {
359
360
stats->cycles++;
361
}
362
-
363
- return NULL;
362
}
363
364
static int uuidmap_concurrent_unittest(void) {
src/ml/ml.cc
+2
-7
@@ -946,8 +946,7 @@ ml_host_detect_once(ml_host_t *host)
946
}
947
}
948
949
-void *
950
-ml_detect_main(void *arg)
949
+void ml_detect_main(void *arg)
950
{
951
UNUSED(arg);
952
@@ -992,8 +991,6 @@ ml_detect_main(void *arg)
991
}
992
Cfg.training_stop = true;
993
finalize_self_prepared_sql_statements();
995
-
996
- return NULL;
994
}
995
996
static void ml_flush_pending_models(ml_worker_t *worker) {
@@ -1082,7 +1079,7 @@ static enum ml_worker_result ml_worker_add_existing_model(ml_worker_t *worker, m
1079
return ML_WORKER_RESULT_OK;
1080
}
1081
1085
-void *ml_train_main(void *arg) {
1082
+void ml_train_main(void *arg) {
1083
ml_worker_t *worker = (ml_worker_t *) arg;
1084
1085
char worker_name[1024];
@@ -1221,6 +1218,4 @@ void *ml_train_main(void *arg) {
1218
std::this_thread::sleep_for(std::chrono::microseconds{remaining_ut});
1219
}
1220
finalize_self_prepared_sql_statements();
1224
-
1225
- return NULL;
1221
}
src/ml/ml_private.h
+2
-2
@@ -8,8 +8,8 @@
8
9
#include "ml_config.h"
10
11
-void *ml_train_main(void *arg);
12
-void *ml_detect_main(void *arg);
11
+void ml_train_main(void *arg);
12
+void ml_detect_main(void *arg);
13
14
extern sqlite3 *ml_db;
15
extern const char *db_models_create_table;
src/plugins.d/plugins_d.c
+1
-2
@@ -120,7 +120,7 @@ static void pluginsd_worker_thread_handle_error(struct plugind *cd, int worker_r
120
#undef SERIAL_FAILURES_THRESHOLD
121
122
123
-static void *pluginsd_worker_thread(void *arg) {
123
+static void pluginsd_worker_thread(void *arg) {
124
struct plugind *cd = (struct plugind *) arg;
125
126
worker_register("PLUGINSD");
@@ -196,7 +196,6 @@ static void *pluginsd_worker_thread(void *arg) {
196
spawn_popen_kill(pi, 3 * MSEC_PER_SEC);
197
198
worker_unregister();
199
- return NULL;
199
}
200
201
static void pluginsd_main_cleanup(void *pptr) {
src/streaming/stream-connector.c
+1
-3
@@ -511,7 +511,7 @@ static void stream_connector_remove(struct sender_state *s) {
511
stream_sender_remove(s, reason);
512
}
513
514
-static void *stream_connector_thread(void *ptr) {
514
+static void stream_connector_thread(void *ptr) {
515
struct connector *sc = ptr;
516
sc->tid = gettid_cached();
517
@@ -625,8 +625,6 @@ static void *stream_connector_thread(void *ptr) {
625
worker_set_metric(WORKER_SENDER_CONNECTOR_JOB_FAILED_NODES, (NETDATA_DOUBLE)failed_nodes);
626
worker_set_metric(WORKER_SENDER_CONNECTOR_JOB_CANCELLED_NODES, (NETDATA_DOUBLE)cancelled_nodes);
627
}
628
-
629
- return NULL;
628
}
629
630
void stream_connector_remove_host(RRDHOST *host) {
src/streaming/stream-replication-sender.c
+1
-3
@@ -1641,7 +1641,7 @@ static void replication_worker_cleanup(void *pptr) {
1641
worker_unregister();
1642
}
1643
1644
-static void *replication_worker_thread(void *ptr __maybe_unused) {
1644
+static void replication_worker_thread(void *ptr __maybe_unused) {
1645
CLEANUP_FUNCTION_REGISTER(replication_worker_cleanup) cleanup_ptr = (void *)0x1;
1646
replication_initialize_workers(false);
1647
@@ -1659,8 +1659,6 @@ static void *replication_worker_thread(void *ptr __maybe_unused) {
1659
sleep_usec(1 * USEC_PER_SEC);
1660
}
1661
}
1662
-
1663
- return NULL;
1662
}
1663
1664
static void replication_main_cleanup(void *pptr) {
src/streaming/stream-sender-api.c
+4
-4
@@ -105,10 +105,10 @@ void stream_sender_start_host(struct rrdhost *host) {
105
stream_sender_add_to_connector_queue(host);
106
}
107
108
-void *stream_sender_start_localhost(void *ptr __maybe_unused) {
109
- if(!localhost) return NULL;
110
- stream_sender_start_host(localhost);
111
- return NULL;
108
+void stream_sender_start_localhost(void *ptr __maybe_unused)
109
+{
110
+ if (!localhost)
111
+ return stream_sender_start_host(localhost);
112
}
113
114
// Either the receiver lost the connection or the host is being destroyed.
src/streaming/stream-thread.c
+2
-4
@@ -389,7 +389,7 @@ static bool stream_thread_process_poll_slot(struct stream_thread *sth, nd_poll_r
389
return false;
390
}
391
392
-void *stream_thread(void *ptr) {
392
+void stream_thread(void *ptr) {
393
struct stream_thread *sth = ptr;
394
395
nd_thread_can_run_sql(false);
@@ -490,7 +490,7 @@ void *stream_thread(void *ptr) {
490
nd_log(NDLS_DAEMON, NDLP_ERR, "STREAM THREAD[%zu]: cannot create required pipe.", sth->id);
491
sth->pipe.fds[PIPE_READ] = -1;
492
sth->pipe.fds[PIPE_WRITE] = -1;
493
- return NULL;
493
+ return;
494
}
495
496
sth->tid = gettid_cached();
@@ -653,8 +653,6 @@ void *stream_thread(void *ptr) {
653
worker_unregister();
654
655
rrd_collector_finished();
656
-
657
- return NULL;
656
}
657
658
// --------------------------------------------------------------------------------------------------------------------
src/streaming/stream.h
+1
-1
@@ -16,7 +16,7 @@ struct receiver_state;
16
#include "stream-parents.h"
17
18
// starting and stopping senders
19
-void *stream_sender_start_localhost(void *ptr);
19
+void stream_sender_start_localhost(void *ptr);
20
void stream_sender_start_host(struct rrdhost *host);
21
void stream_sender_signal_to_stop_and_wait(struct rrdhost *host, STREAM_HANDSHAKE reason, bool wait);
22
void stream_connector_remove_host(RRDHOST *host);
src/web/api/queries/backfill.c
+3
-7
@@ -152,7 +152,7 @@ static void backfill_dim_work_free(bool successful, struct backfill_dim_work *bd
152
153
#define LOG_WARNING_EVERY 10
154
155
-void *backfill_worker_thread(void *ptr) {
155
+void backfill_worker_thread(void *ptr) {
156
bool main_thread = (ptr == (void *)0x01);
157
size_t warning = LOG_WARNING_EVERY;
158
bool timeout = false;
@@ -205,13 +205,11 @@ void *backfill_worker_thread(void *ptr) {
205
}
206
207
worker_unregister();
208
-
209
- return NULL;
208
}
209
212
-void *backfill_thread(void *ptr) {
210
+void backfill_thread(void *ptr) {
211
struct netdata_static_thread *static_thread = ptr;
214
- if(!static_thread) return NULL;
212
+ if(!static_thread) return;
213
214
nd_thread_tag_set("BACKFILL[0]");
215
@@ -259,7 +257,5 @@ void *backfill_thread(void *ptr) {
257
completion_destroy(&backfill_globals.completion);
258
259
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
262
-
263
- return NULL;
260
}
261
src/web/api/queries/backfill.h
+1
-1
@@ -18,7 +18,7 @@ struct backfill_request_data {
18
19
typedef bool (*backfill_callback_t)(size_t successful_dims, size_t failed_dims, struct backfill_request_data *brd);
20
21
-void *backfill_thread(void *ptr);
21
+void backfill_thread(void *ptr);
22
bool backfill_request_add(RRDSET *st, backfill_callback_t cb, struct backfill_request_data *data);
23
24
#endif //NETDATA_BACKFILL_H
src/web/server/static/static-threaded.c
+2
-36
@@ -282,7 +282,7 @@ static bool web_server_should_stop(void) {
282
return !service_running(SERVICE_WEB_SERVER);
283
}
284
285
-void *socket_listen_main_static_threaded_worker(void *ptr) {
285
+void socket_listen_main_static_threaded_worker(void *ptr) {
286
worker_private = ptr;
287
spinlock_lock(&worker_private->spinlock);
288
worker_private->initializing = false;
@@ -315,8 +315,6 @@ void *socket_listen_main_static_threaded_worker(void *ptr) {
315
, ptr // timer_data
316
, worker_private->max_sockets
317
);
318
-
319
- return NULL;
318
}
319
320
@@ -329,36 +327,6 @@ static void socket_listen_main_static_threaded_cleanup(void *pptr) {
327
328
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
329
332
-// int i, found = 0;
333
-// usec_t max = 2 * USEC_PER_SEC, step = 50000;
334
-//
335
-// // we start from 1, - 0 is self
336
-// for(i = 1; i < static_threaded_workers_count; i++) {
337
-// if(static_workers_private_data[i].running) {
338
-// found++;
339
-// netdata_log_info("stopping worker %d", i + 1);
340
-// nd_thread_signal_cancel(static_workers_private_data[i].thread);
341
-// }
342
-// else
343
-// netdata_log_info("found stopped worker %d", i + 1);
344
-// }
345
-//
346
-// while(found && max > 0) {
347
-// max -= step;
348
-// netdata_log_info("Waiting %d static web threads to finish...", found);
349
-// sleep_usec(step);
350
-// found = 0;
351
-//
352
-// // we start from 1, - 0 is self
353
-// for(i = 1; i < static_threaded_workers_count; i++) {
354
-// if (static_workers_private_data[i].running)
355
-// found++;
356
-// }
357
-// }
358
-//
359
-// if(found)
360
-// netdata_log_error("%d static web threads are taking too long to finish. Giving up.", found);
361
-
330
netdata_log_info("closing all web server sockets...");
331
listen_sockets_close(&api_sockets);
332
@@ -380,7 +348,7 @@ static void socket_listen_main_static_threaded_cleanup(void *pptr) {
348
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
349
}
350
383
-void *socket_listen_main_static_threaded(void *ptr) {
351
+void socket_listen_main_static_threaded(void *ptr) {
352
CLEANUP_FUNCTION_REGISTER(socket_listen_main_static_threaded_cleanup) cleanup_ptr = ptr;
353
web_server_mode = WEB_SERVER_MODE_STATIC_THREADED;
354
@@ -422,6 +390,4 @@ void *socket_listen_main_static_threaded(void *ptr) {
390
// and the main one
391
static_workers_private_data[0].max_sockets = max_sockets / static_threaded_workers_count;
392
socket_listen_main_static_threaded_worker((void *)&static_workers_private_data[0]);
425
-
426
- return NULL;
393
}
src/web/server/static/static-threaded.h
+1
-1
@@ -5,7 +5,7 @@
5
6
#include "web/server/web_server.h"
7
8
-void *socket_listen_main_static_threaded(void *ptr);
8
+void socket_listen_main_static_threaded(void *ptr);
9
void web_server_remove_current_socket_from_poll(void);
10
11
#endif //NETDATA_WEB_SERVER_STATIC_THREADED_H
src/web/websocket/websocket-internal.h
+1
-1
@@ -201,7 +201,7 @@ void websocket_threads_init(void);
201
void websocket_threads_join(void);
202
bool websocket_thread_send_command(WEBSOCKET_THREAD *wth, uint8_t cmd, uint32_t id);
203
bool websocket_thread_send_broadcast(WEBSOCKET_THREAD *wth, WEBSOCKET_OPCODE opcode, const char *message);
204
-void *websocket_thread(void *ptr);
204
+void websocket_thread(void *ptr);
205
void websocket_thread_enqueue_client(WEBSOCKET_THREAD *wth, struct websocket_server_client *wsc);
206
bool websocket_thread_update_client_poll_flags(struct websocket_server_client *wsc);
207
src/web/websocket/websocket-thread.c
+1
-3
@@ -319,7 +319,7 @@ static void websocket_thread_process_commands(WEBSOCKET_THREAD *wth) {
319
}
320
321
// Thread main function
322
-void *websocket_thread(void *ptr) {
322
+void websocket_thread(void *ptr) {
323
WEBSOCKET_THREAD *wth = (WEBSOCKET_THREAD *)ptr;
324
wth->tid = gettid_uncached();
325
@@ -521,6 +521,4 @@ void *websocket_thread(void *ptr) {
521
spinlock_lock(&wth->spinlock);
522
wth->running = false;
523
spinlock_unlock(&wth->spinlock);
524
-
525
- return NULL;
524
}