Use libnetdata/required_dummies.h in collectors. (#11971)
vkalintiris committed
Jan 18, 2022 at 10:29 UTC
63afbd76ef39ca836233354218e95a17ae67270e
10 files changed
+12
-298
collectors/apps.plugin/apps_plugin.c
+1
-31
@@ -7,37 +7,7 @@
7
*/
8
9
#include "libnetdata/libnetdata.h"
10
-
11
-// ----------------------------------------------------------------------------
12
-
13
-// callback required by fatal()
14
-void netdata_cleanup_and_exit(int ret) {
15
- exit(ret);
16
-}
17
-
18
-void send_statistics( const char *action, const char *action_result, const char *action_data) {
19
- (void) action;
20
- (void) action_result;
21
- (void) action_data;
22
- return;
23
-}
24
-// callbacks required by popen()
25
-void signals_block(void) {};
26
-void signals_unblock(void) {};
27
-void signals_reset(void) {};
28
-
29
-// callback required by eval()
30
-int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result) {
31
- (void)variable;
32
- (void)hash;
33
- (void)rc;
34
- (void)result;
35
- return 0;
36
-};
37
-
38
-// required by get_system_cpus()
39
-char *netdata_configured_host_prefix = "";
40
-
10
+#include "libnetdata/required_dummies.h"
11
12
// ----------------------------------------------------------------------------
13
// debugging
collectors/cgroups.plugin/cgroup-network.c
+1
-34
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
#include "libnetdata/libnetdata.h"
4
+#include "libnetdata/required_dummies.h"
5
6
#ifdef HAVE_SETNS
7
#ifndef _GNU_SOURCE
@@ -16,40 +17,6 @@ char *environment[] = {
17
NULL
18
};
19
19
-
20
-// ----------------------------------------------------------------------------
21
-
22
-// callback required by fatal()
23
-void netdata_cleanup_and_exit(int ret) {
24
- exit(ret);
25
-}
26
-
27
-void send_statistics( const char *action, const char *action_result, const char *action_data) {
28
- (void) action;
29
- (void) action_result;
30
- (void) action_data;
31
- return;
32
-}
33
-
34
-// callbacks required by popen()
35
-void signals_block(void) {};
36
-void signals_unblock(void) {};
37
-void signals_reset(void) {};
38
-
39
-// callback required by eval()
40
-int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result) {
41
- (void)variable;
42
- (void)hash;
43
- (void)rc;
44
- (void)result;
45
- return 0;
46
-};
47
-
48
-// required by get_system_cpus()
49
-char *netdata_configured_host_prefix = "";
50
-
51
-// ----------------------------------------------------------------------------
52
-
20
struct iface {
21
const char *device;
22
uint32_t hash;
collectors/cups.plugin/cups_plugin.c
+2
-29
@@ -7,38 +7,11 @@
7
*/
8
9
#include "libnetdata/libnetdata.h"
10
+#include "libnetdata/required_dummies.h"
11
+
12
#include <cups/cups.h>
13
#include <limits.h>
14
13
-// callback required by fatal()
14
-void netdata_cleanup_and_exit(int ret) {
15
- exit(ret);
16
-}
17
-
18
-void send_statistics( const char *action, const char *action_result, const char *action_data) {
19
- (void) action;
20
- (void) action_result;
21
- (void) action_data;
22
- return;
23
-}
24
-
25
-// callbacks required by popen()
26
-void signals_block(void) {};
27
-void signals_unblock(void) {};
28
-void signals_reset(void) {};
29
-
30
-// callback required by eval()
31
-int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result) {
32
- (void)variable;
33
- (void)hash;
34
- (void)rc;
35
- (void)result;
36
- return 0;
37
-};
38
-
39
-// required by get_system_cpus()
40
-char *netdata_configured_host_prefix = "";
41
-
15
// Variables
16
17
static int debug = 0;
collectors/ebpf.plugin/ebpf.c
+1
-38
@@ -6,45 +6,8 @@
6
7
#include "ebpf.h"
8
#include "ebpf_socket.h"
9
+#include "libnetdata/required_dummies.h"
10
10
-/*****************************************************************
11
- *
12
- * FUNCTIONS USED BY NETDATA
13
- *
14
- *****************************************************************/
15
-
16
-// callback required by eval()
17
-int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result)
18
-{
19
- UNUSED(variable);
20
- UNUSED(hash);
21
- UNUSED(rc);
22
- UNUSED(result);
23
- return 0;
24
-};
25
-
26
-void send_statistics(const char *action, const char *action_result, const char *action_data)
27
-{
28
- UNUSED(action);
29
- UNUSED(action_result);
30
- UNUSED(action_data);
31
-}
32
-
33
-// callbacks required by popen()
34
-void signals_block(void){};
35
-void signals_unblock(void){};
36
-void signals_reset(void){};
37
-
38
-// required by get_system_cpus()
39
-char *netdata_configured_host_prefix = "";
40
-
41
-// callback required by fatal()
42
-void netdata_cleanup_and_exit(int ret)
43
-{
44
- exit(ret);
45
-}
46
-
47
-// ----------------------------------------------------------------------
11
/*****************************************************************
12
*
13
* GLOBAL VARIABLES
collectors/freeipmi.plugin/freeipmi_plugin.c
+1
-33
@@ -16,6 +16,7 @@
16
*/
17
18
#include "libnetdata/libnetdata.h"
19
+#include "libnetdata/required_dummies.h"
20
21
#include <stdio.h>
22
#include <stdlib.h>
@@ -40,39 +41,6 @@
41
#define IPMI_PARSE_DEVICE_SUNBMC_STR2 "bmc"
42
#define IPMI_PARSE_DEVICE_INTELDCMI_STR "inteldcmi"
43
43
-// ----------------------------------------------------------------------------
44
-
45
-// callback required by fatal()
46
-void netdata_cleanup_and_exit(int ret) {
47
- exit(ret);
48
-}
49
-
50
-void send_statistics( const char *action, const char *action_result, const char *action_data) {
51
- (void)action;
52
- (void)action_result;
53
- (void)action_data;
54
- return;
55
-}
56
-
57
-// callbacks required by popen()
58
-void signals_block(void) {};
59
-void signals_unblock(void) {};
60
-void signals_reset(void) {};
61
-
62
-// callback required by eval()
63
-int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result) {
64
- (void)variable;
65
- (void)hash;
66
- (void)rc;
67
- (void)result;
68
- return 0;
69
-};
70
-
71
-// required by get_system_cpus()
72
-char *netdata_configured_host_prefix = "";
73
-
74
-// ----------------------------------------------------------------------------
75
-
44
#include <ipmi_monitoring.h>
45
#include <ipmi_monitoring_bitmasks.h>
46
collectors/nfacct.plugin/plugin_nfacct.c
+2
-28
@@ -1,6 +1,8 @@
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
#include "libnetdata/libnetdata.h"
4
+#include "libnetdata/required_dummies.h"
5
+
6
#include <linux/netfilter/nfnetlink_conntrack.h>
7
#include <libmnl/libmnl.h>
8
#include <libnetfilter_acct/libnetfilter_acct.h>
@@ -22,34 +24,6 @@ static inline size_t mnl_buffer_size() {
24
return (size_t)s;
25
}
26
25
-// callback required by fatal()
26
-void netdata_cleanup_and_exit(int ret) {
27
- exit(ret);
28
-}
29
-
30
-void send_statistics( const char *action, const char *action_result, const char *action_data) {
31
- (void) action;
32
- (void) action_result;
33
- (void) action_data;
34
- return;
35
-}
36
-
37
-// callbacks required by popen()
38
-void signals_block(void) {};
39
-void signals_unblock(void) {};
40
-void signals_reset(void) {};
41
-
42
-// callback required by eval()
43
-int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result) {
44
- (void)variable;
45
- (void)hash;
46
- (void)rc;
47
- (void)result;
48
- return 0;
49
-};
50
-
51
-// required by get_system_cpus()
52
-char *netdata_configured_host_prefix = "";
27
// variables
28
static int debug = 0;
29
static int netdata_update_every = 1;
collectors/perf.plugin/perf_plugin.c
+1
-31
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
#include "libnetdata/libnetdata.h"
4
+#include "libnetdata/required_dummies.h"
5
6
#include <linux/perf_event.h>
7
@@ -29,37 +30,6 @@
30
#define NETDATA_CHART_PRIO_PERF_ITLB 8825
31
#define NETDATA_CHART_PRIO_PERF_PBU 8826
32
32
-// callback required by fatal()
33
-void netdata_cleanup_and_exit(int ret) {
34
- exit(ret);
35
-}
36
-
37
-void send_statistics( const char *action, const char *action_result, const char *action_data) {
38
- (void) action;
39
- (void) action_result;
40
- (void) action_data;
41
- return;
42
-}
43
-
44
-// callbacks required by popen()
45
-void signals_block(void) {};
46
-void signals_unblock(void) {};
47
-void signals_reset(void) {};
48
-
49
-// callback required by eval()
50
-int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result) {
51
- (void)variable;
52
- (void)hash;
53
- (void)rc;
54
- (void)result;
55
- return 0;
56
-};
57
-
58
-// required by get_system_cpus()
59
-char *netdata_configured_host_prefix = "";
60
-
61
-// Variables
62
-
33
#define RRD_TYPE_PERF "perf"
34
#define RRD_FAMILY_HW "hardware"
35
#define RRD_FAMILY_SW "software"
collectors/slabinfo.plugin/slabinfo.c
+1
-34
@@ -1,7 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
-#include "libnetdata/libnetdata.h"
3
#include "daemon/common.h"
4
+#include "libnetdata/required_dummies.h"
5
6
#define PLUGIN_SLABINFO_NAME "slabinfo.plugin"
7
#define PLUGIN_SLABINFO_PROCFILE "/proc/slabinfo"
@@ -16,39 +16,6 @@
16
fprintf(stderr, ##args); \
17
fprintf(stderr, "\n"); }
18
19
-
20
-// ----------------------------------------------------------------------------
21
-
22
-// callback required by fatal()
23
-void netdata_cleanup_and_exit(int ret) {
24
- exit(ret);
25
-}
26
-
27
-void send_statistics(const char *action, const char *action_result, const char *action_data) {
28
- (void) action;
29
- (void) action_result;
30
- (void) action_data;
31
- return;
32
-}
33
-
34
-// callbacks required by popen()
35
-void signals_block(void) {};
36
-void signals_unblock(void) {};
37
-void signals_reset(void) {};
38
-
39
-// callback required by eval()
40
-int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result) {
41
- (void)variable;
42
- (void)hash;
43
- (void)rc;
44
- (void)result;
45
- return 0;
46
-};
47
-
48
-// required by get_system_cpus()
49
-char *netdata_configured_host_prefix = "";
50
-
51
-
19
int running = 1;
20
int debug = 0;
21
size_t lines_discovered = 0;
collectors/xenstat.plugin/xenstat_plugin.c
+1
-29
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
#include "libnetdata/libnetdata.h"
4
+#include "libnetdata/required_dummies.h"
5
6
#include <xenstat.h>
7
#include <libxl.h>
@@ -35,35 +36,6 @@
36
#define CHART_IS_OBSOLETE 1
37
#define CHART_IS_NOT_OBSOLETE 0
38
38
-// callback required by fatal()
39
-void netdata_cleanup_and_exit(int ret) {
40
- exit(ret);
41
-}
42
-
43
-void send_statistics( const char *action, const char *action_result, const char *action_data) {
44
- (void) action;
45
- (void) action_result;
46
- (void) action_data;
47
- return;
48
-}
49
-
50
-// callbacks required by popen()
51
-void signals_block(void) {};
52
-void signals_unblock(void) {};
53
-void signals_reset(void) {};
54
-
55
-// callback required by eval()
56
-int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result) {
57
- (void)variable;
58
- (void)hash;
59
- (void)rc;
60
- (void)result;
61
- return 0;
62
-};
63
-
64
-// required by get_system_cpus()
65
-char *netdata_configured_host_prefix = "";
66
-
39
// Variables
40
static int debug = 0;
41
static int netdata_update_every = 1;
tests/profile/test-eval.c
+1
-11
@@ -9,10 +9,9 @@
9
10
#include "config.h"
11
#include "libnetdata/libnetdata.h"
12
+#include "libnetdata/required_dummies.h"
13
#include "database/rrdcalc.h"
14
14
-void netdata_cleanup_and_exit(int ret) { exit(ret); }
15
-
15
/*
16
void indent(int level, int show) {
17
int i = level;
@@ -261,15 +260,6 @@ void print_expression(EVAL_NODE *op, const char *failed_at, int error) {
260
}
261
*/
262
264
-int health_variable_lookup(const char *variable, uint32_t hash, RRDCALC *rc, calculated_number *result) {
265
- (void)variable;
266
- (void)hash;
267
- (void)rc;
268
- (void)result;
269
-
270
- return 0;
271
-}
272
-
263
int main(int argc, char **argv) {
264
if(argc != 2) {
265
fprintf(stderr, "I need an expression (enclose it in single-quotes (') as a single parameter)\n");