daemon cleanup (#4231)
* c code cleanup; eliminate all errors and warning under clion * removed old server API * removed obsolete "file" API command * included common.h everywhere * fix for github syntax highlighting * enable CLion to build all netdata binaries * added locks verification to cmake
Costa Tsaousis committed
Sep 20, 2018 at 19:45 UTC
2b14e31befc080c7c65fd4c53ed22852f28796de
162 files changed
+378
-989
CMakeLists.txt
+17
-7
@@ -8,7 +8,7 @@ project(netdata C)
8
9
find_package (Threads)
10
11
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat-signedness -Werror=format-security -DNETDATA_INTERNAL_CHECKS=1 -fstack-protector-all")
11
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat-signedness -Werror=format-security -DNETDATA_INTERNAL_CHECKS=1 -DNETDATA_VERIFY_LOCKS=1 -fstack-protector-all")
12
13
set(NETDATA_FREEBSD_FILES
14
src/plugin_freebsd.c
@@ -136,8 +136,6 @@ set(NETDATA_COMMON_FILES
136
src/rrd.h
137
src/rrd2json.c
138
src/rrd2json.h
139
- src/rrd2json_api_old.c
140
- src/rrd2json_api_old.h
139
src/rrdcalc.c
140
src/rrdcalctemplate.c
141
src/rrddim.c
@@ -167,8 +165,6 @@ set(NETDATA_COMMON_FILES
165
src/unit_test.h
166
src/url.c
167
src/url.h
170
- src/web_api_old.c
171
- src/web_api_old.h
168
src/web_api_v1.c
169
src/web_api_v1.h
170
src/web_buffer.c
@@ -188,6 +184,8 @@ set(APPS_PLUGIN_SOURCE_FILES
184
src/apps_plugin.c
185
src/avl.c
186
src/avl.h
187
+ src/adaptive_resortable_list.c
188
+ src/adaptive_resortable_list.h
189
src/common.c
190
src/common.h
191
src/clocks.c
@@ -199,6 +197,8 @@ set(APPS_PLUGIN_SOURCE_FILES
197
src/log.h
198
src/procfile.c
199
src/procfile.h
200
+ src/threads.c
201
+ src/threads.h
202
src/web_buffer.c
203
src/web_buffer.h
204
config.h
@@ -217,6 +217,8 @@ set(FREEIPMI_PLUGIN_SOURCE_FILES
217
src/log.h
218
src/procfile.c
219
src/procfile.h
220
+ src/threads.c
221
+ src/threads.h
222
config.h
223
)
224
@@ -231,8 +233,16 @@ set(CGROUP_NETWORK_SOURCE_FILES
233
src/locks.h
234
src/log.c
235
src/log.h
236
+ src/popen.c
237
+ src/popen.h
238
src/procfile.c
239
src/procfile.h
240
+ src/signals.c
241
+ src/signals.h
242
+ src/storage_number.c
243
+ src/storage_number.h
244
+ src/threads.c
245
+ src/threads.h
246
src/web_buffer.c
247
src/web_buffer.h
248
config.h
@@ -252,10 +262,10 @@ add_executable(netdata_macos ${NETDATA_COMMON_FILES} ${NETDATA_MACOS_FILES})
262
target_link_libraries (netdata_macos m z uuid ${CMAKE_THREAD_LIBS_INIT})
263
264
add_executable(apps.plugin ${APPS_PLUGIN_SOURCE_FILES} src/inlined.h)
255
-target_link_libraries (apps.plugin m ${CMAKE_THREAD_LIBS_INIT})
265
+target_link_libraries (apps.plugin m cap ${CMAKE_THREAD_LIBS_INIT})
266
267
add_executable(freeipmi.plugin ${FREEIPMI_PLUGIN_SOURCE_FILES})
258
-target_link_libraries (freeipmi.plugin ipmimonitoring)
268
+target_link_libraries (freeipmi.plugin ipmimonitoring ${CMAKE_THREAD_LIBS_INIT})
269
270
add_executable(cgroup-network ${CGROUP_NETWORK_SOURCE_FILES})
271
target_link_libraries (cgroup-network m ${CMAKE_THREAD_LIBS_INIT})
src/Makefile.am
-4
@@ -104,8 +104,6 @@ netdata_SOURCES = \
104
rrd.h \
105
rrd2json.c \
106
rrd2json.h \
107
- rrd2json_api_old.c \
108
- rrd2json_api_old.h \
107
rrdcalc.c \
108
rrdcalctemplate.c \
109
rrddim.c \
@@ -135,8 +133,6 @@ netdata_SOURCES = \
133
unit_test.h \
134
url.c \
135
url.h \
138
- web_api_old.c \
139
- web_api_old.h \
136
web_api_v1.c \
137
web_api_v1.h \
138
web_buffer.c \
src/adaptive_resortable_list.c
+2
-1
@@ -1,5 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
-#include "adaptive_resortable_list.h"
2
+
3
+#include "common.h"
4
5
// the default processor() of the ARL
6
// can be overwritten at arl_create()
src/adaptive_resortable_list.h
+2
-3
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_ADAPTIVE_RESORTABLE_LIST_H
3
-#define NETDATA_ADAPTIVE_RESORTABLE_LIST_H
4
+#define NETDATA_ADAPTIVE_RESORTABLE_LIST_H 1
5
6
/*
7
* ADAPTIVE RE-SORTABLE LIST
@@ -38,8 +39,6 @@
39
* ONCE IN THE SOURCE DATA SET.
40
*/
41
41
-#include "common.h"
42
-
42
#define ARL_ENTRY_FLAG_FOUND 0x01 // the entry has been found in the source data
43
#define ARL_ENTRY_FLAG_EXPECTED 0x02 // the entry is expected by the program
44
#define ARL_ENTRY_FLAG_DYNAMIC 0x04 // the entry was dynamically allocated, from source data
src/appconfig.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define CONFIG_FILE_LINE_MAX ((CONFIG_MAX_NAME + CONFIG_MAX_VALUE + 1024) * 2)
src/appconfig.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_CONFIG_H
4
#define NETDATA_CONFIG_H 1
5
src/avl.c
+31
-30
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: LGPL-3.0+
2
+
3
#include "common.h"
4
5
/* ------------------------------------------------------------------------- */
@@ -44,7 +45,7 @@ avl *avl_insert(avl_tree *tree, avl *item) {
45
avl *p, *q; /* Iterator, and parent. */
46
avl *n; /* Newly inserted node. */
47
avl *w; /* New root of rebalanced subtree. */
47
- int dir; /* Direction to descend. */
48
+ unsigned char dir; /* Direction to descend. */
49
50
unsigned char da[AVL_MAX_HEIGHT]; /* Cached comparison results. */
51
int k = 0; /* Number of cached results. */
@@ -61,7 +62,7 @@ avl *avl_insert(avl_tree *tree, avl *item) {
62
63
if (p->avl_balance != 0)
64
z = q, y = p, k = 0;
64
- da[k++] = dir = (cmp > 0);
65
+ da[k++] = dir = (unsigned char)(cmp > 0);
66
}
67
68
n = q->avl_link[dir] = item;
@@ -149,7 +150,7 @@ avl *avl_remove(avl_tree *tree, avl *item) {
150
k = 0;
151
p = (avl *) &tree->root;
152
for(cmp = -1; cmp != 0; cmp = tree->compar(item, p)) {
152
- int dir = (cmp > 0);
153
+ unsigned char dir = (unsigned char)(cmp > 0);
154
155
pa[k] = p;
156
da[k++] = dir;
@@ -283,7 +284,7 @@ avl *avl_remove(avl_tree *tree, avl *item) {
284
// ---------------------------
285
// traversing
286
286
-int avl_walker(avl *node, int (*callback)(void *entry, void *data), void *data) {
287
+int avl_walker(avl *node, int (*callback)(void * /*entry*/, void * /*data*/), void *data) {
288
int total = 0, ret = 0;
289
290
if(node->avl_link[0]) {
@@ -305,9 +306,9 @@ int avl_walker(avl *node, int (*callback)(void *entry, void *data), void *data)
306
return total;
307
}
308
308
-int avl_traverse(avl_tree *t, int (*callback)(void *entry, void *data), void *data) {
309
- if(t->root)
310
- return avl_walker(t->root, callback, data);
309
+int avl_traverse(avl_tree *tree, int (*callback)(void * /*entry*/, void * /*data*/), void *data) {
310
+ if(tree->root)
311
+ return avl_walker(tree->root, callback, data);
312
else
313
return 0;
314
}
@@ -348,16 +349,16 @@ void avl_unlock(avl_tree_lock *t) {
349
// ---------------------------
350
// operations with locking
351
351
-void avl_init_lock(avl_tree_lock *t, int (*compar)(void *a, void *b)) {
352
- avl_init(&t->avl_tree, compar);
352
+void avl_init_lock(avl_tree_lock *tree, int (*compar)(void * /*a*/, void * /*b*/)) {
353
+ avl_init(&tree->avl_tree, compar);
354
355
#ifndef AVL_WITHOUT_PTHREADS
356
int lock;
357
358
#ifdef AVL_LOCK_WITH_MUTEX
358
- lock = netdata_mutex_init(&t->mutex, NULL);
359
+ lock = netdata_mutex_init(&tree->mutex, NULL);
360
#else
360
- lock = netdata_rwlock_init(&t->rwlock);
361
+ lock = netdata_rwlock_init(&tree->rwlock);
362
#endif
363
364
if(lock != 0)
@@ -366,38 +367,38 @@ void avl_init_lock(avl_tree_lock *t, int (*compar)(void *a, void *b)) {
367
#endif /* AVL_WITHOUT_PTHREADS */
368
}
369
369
-avl *avl_search_lock(avl_tree_lock *t, avl *a) {
370
- avl_read_lock(t);
371
- avl *ret = avl_search(&t->avl_tree, a);
372
- avl_unlock(t);
370
+avl *avl_search_lock(avl_tree_lock *tree, avl *item) {
371
+ avl_read_lock(tree);
372
+ avl *ret = avl_search(&tree->avl_tree, item);
373
+ avl_unlock(tree);
374
return ret;
375
}
376
376
-avl * avl_remove_lock(avl_tree_lock *t, avl *a) {
377
- avl_write_lock(t);
378
- avl *ret = avl_remove(&t->avl_tree, a);
379
- avl_unlock(t);
377
+avl * avl_remove_lock(avl_tree_lock *tree, avl *item) {
378
+ avl_write_lock(tree);
379
+ avl *ret = avl_remove(&tree->avl_tree, item);
380
+ avl_unlock(tree);
381
return ret;
382
}
383
383
-avl *avl_insert_lock(avl_tree_lock *t, avl *a) {
384
- avl_write_lock(t);
385
- avl * ret = avl_insert(&t->avl_tree, a);
386
- avl_unlock(t);
384
+avl *avl_insert_lock(avl_tree_lock *tree, avl *item) {
385
+ avl_write_lock(tree);
386
+ avl * ret = avl_insert(&tree->avl_tree, item);
387
+ avl_unlock(tree);
388
return ret;
389
}
390
390
-int avl_traverse_lock(avl_tree_lock *t, int (*callback)(void *entry, void *data), void *data) {
391
+int avl_traverse_lock(avl_tree_lock *tree, int (*callback)(void * /*entry*/, void * /*data*/), void *data) {
392
int ret;
392
- avl_read_lock(t);
393
- ret = avl_traverse(&t->avl_tree, callback, data);
394
- avl_unlock(t);
393
+ avl_read_lock(tree);
394
+ ret = avl_traverse(&tree->avl_tree, callback, data);
395
+ avl_unlock(tree);
396
return ret;
397
}
398
398
-void avl_init(avl_tree *t, int (*compar)(void *a, void *b)) {
399
- t->root = NULL;
400
- t->compar = compar;
399
+void avl_init(avl_tree *tree, int (*compar)(void * /*a*/, void * /*b*/)) {
400
+ tree->root = NULL;
401
+ tree->compar = compar;
402
}
403
404
// ------------------
src/avl.h
+10
-10
@@ -57,31 +57,31 @@ typedef struct avl_tree_lock {
57
* a is linked directly to the tree, so it has to
58
* be properly allocated by the caller.
59
*/
60
-avl *avl_insert_lock(avl_tree_lock *t, avl *a) NEVERNULL WARNUNUSED;
61
-avl *avl_insert(avl_tree *t, avl *a) NEVERNULL WARNUNUSED;
60
+avl *avl_insert_lock(avl_tree_lock *tree, avl *item) NEVERNULL WARNUNUSED;
61
+avl *avl_insert(avl_tree *tree, avl *item) NEVERNULL WARNUNUSED;
62
63
/* Remove an element a from the AVL tree t
64
* returns a pointer to the removed element
65
* or NULL if an element equal to a is not found
66
* (equal as returned by t->compar())
67
*/
68
-avl *avl_remove_lock(avl_tree_lock *t, avl *a) WARNUNUSED;
69
-avl *avl_remove(avl_tree *t, avl *a) WARNUNUSED;
68
+avl *avl_remove_lock(avl_tree_lock *tree, avl *item) WARNUNUSED;
69
+avl *avl_remove(avl_tree *tree, avl *item) WARNUNUSED;
70
71
/* Find the element into the tree that equal to a
72
* (equal as returned by t->compar())
73
* returns NULL is no element is equal to a
74
*/
75
-avl *avl_search_lock(avl_tree_lock *t, avl *a);
76
-avl *avl_search(avl_tree *t, avl *a);
75
+avl *avl_search_lock(avl_tree_lock *tree, avl *item);
76
+avl *avl_search(avl_tree *tree, avl *item);
77
78
/* Initialize the avl_tree_lock
79
*/
80
-void avl_init_lock(avl_tree_lock *t, int (*compar)(void *a, void *b));
81
-void avl_init(avl_tree *t, int (*compar)(void *a, void *b));
80
+void avl_init_lock(avl_tree_lock *tree, int (*compar)(void *a, void *b));
81
+void avl_init(avl_tree *tree, int (*compar)(void *a, void *b));
82
83
84
-int avl_traverse_lock(avl_tree_lock *t, int (*callback)(void *entry, void *data), void *data);
85
-int avl_traverse(avl_tree *t, int (*callback)(void *entry, void *data), void *data);
84
+int avl_traverse_lock(avl_tree_lock *tree, int (*callback)(void *entry, void *data), void *data);
85
+int avl_traverse(avl_tree *tree, int (*callback)(void *entry, void *data), void *data);
86
87
#endif /* avl.h */
src/backend_prometheus.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// ----------------------------------------------------------------------------
src/backend_prometheus.h
+1
-1
@@ -1,7 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
3
#ifndef NETDATA_BACKEND_PROMETHEUS_H
4
-#define NETDATA_BACKEND_PROMETHEUS_H
4
+#define NETDATA_BACKEND_PROMETHEUS_H 1
5
6
typedef enum prometheus_output_flags {
7
PROMETHEUS_OUTPUT_NONE = 0,
src/backends.c
+9
-8
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// ----------------------------------------------------------------------------
@@ -653,8 +654,8 @@ void *backends_main(void *ptr) {
654
chart_transmission_failures = 0,
655
chart_data_lost_events = 0,
656
chart_lost_bytes = 0,
656
- chart_backend_reconnects = 0,
657
- chart_backend_latency = 0;
657
+ chart_backend_reconnects = 0;
658
+ // chart_backend_latency = 0;
659
660
RRDSET *chart_metrics = rrdset_create_localhost("netdata", "backend_metrics", NULL, "backend", NULL, "Netdata Buffered Metrics", "metrics", "backends", NULL, 130600, global_backend_update_every, RRDSET_TYPE_LINE);
661
rrddim_add(chart_metrics, "buffered", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
@@ -794,8 +795,8 @@ void *backends_main(void *ptr) {
795
chart_transmission_failures =
796
chart_data_lost_events =
797
chart_lost_bytes =
797
- chart_backend_reconnects =
798
- chart_backend_latency = 0;
798
+ chart_backend_reconnects = 0;
799
+ // chart_backend_latency = 0;
800
801
if(unlikely(netdata_exit)) break;
802
@@ -845,13 +846,13 @@ void *backends_main(void *ptr) {
846
// if we are not connected, connect to a backend server
847
848
if(unlikely(sock == -1)) {
848
- usec_t start_ut = now_monotonic_usec();
849
+ // usec_t start_ut = now_monotonic_usec();
850
size_t reconnects = 0;
851
852
sock = connect_to_one_of(destination, default_port, &timeout, &reconnects, NULL, 0);
853
854
chart_backend_reconnects += reconnects;
854
- chart_backend_latency += now_monotonic_usec() - start_ut;
855
+ // chart_backend_latency += now_monotonic_usec() - start_ut;
856
}
857
858
if(unlikely(netdata_exit)) break;
@@ -861,14 +862,14 @@ void *backends_main(void *ptr) {
862
863
if(likely(sock != -1)) {
864
size_t len = buffer_strlen(b);
864
- usec_t start_ut = now_monotonic_usec();
865
+ // usec_t start_ut = now_monotonic_usec();
866
int flags = 0;
867
#ifdef MSG_NOSIGNAL
868
flags += MSG_NOSIGNAL;
869
#endif
870
871
ssize_t written = send(sock, buffer_tostring(b), len, flags);
871
- chart_backend_latency += now_monotonic_usec() - start_ut;
872
+ // chart_backend_latency += now_monotonic_usec() - start_ut;
873
if(written != -1 && (size_t)written == len) {
874
// we sent the data successfully
875
chart_transmission_successes++;
src/backends.h
+4
-3
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_BACKENDS_H
4
#define NETDATA_BACKENDS_H 1
5
@@ -21,15 +22,15 @@ extern const char *global_backend_prefix;
22
23
extern void *backends_main(void *ptr);
24
24
-extern int backends_can_send_rrdset(BACKEND_OPTIONS options, RRDSET *st);
25
-extern BACKEND_OPTIONS backend_parse_data_source(const char *source, BACKEND_OPTIONS mode);
25
+extern int backends_can_send_rrdset(BACKEND_OPTIONS backend_options, RRDSET *st);
26
+extern BACKEND_OPTIONS backend_parse_data_source(const char *source, BACKEND_OPTIONS backend_options);
27
28
extern calculated_number backend_calculate_value_from_stored_data(
29
RRDSET *st // the chart
30
, RRDDIM *rd // the dimension
31
, time_t after // the start timestamp
32
, time_t before // the end timestamp
32
- , uint32_t options // BACKEND_SOURCE_* bitmap
33
+ , uint32_t backend_options // BACKEND_SOURCE_* bitmap
34
, time_t *first_timestamp // the timestamp of the first point used in this response
35
, time_t *last_timestamp // the timestamp that should be reported to backend
36
);
src/cgroup-network.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
#include <libgen.h>
5
src/clocks.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#ifndef HAVE_CLOCK_GETTIME
src/clocks.h
+2
-1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_CLOCKS_H
4
#define NETDATA_CLOCKS_H 1
5
@@ -109,7 +110,7 @@ extern time_t now_boottime_sec(void);
110
extern usec_t now_boottime_usec(void);
111
112
112
-extern usec_t timeval_usec(struct timeval *ts);
113
+extern usec_t timeval_usec(struct timeval *tv);
114
extern msec_t timeval_msec(struct timeval *tv);
115
116
extern usec_t dt_usec(struct timeval *now, struct timeval *old);
src/common.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#ifdef __APPLE__
src/common.h
+12
-12
@@ -258,6 +258,18 @@
258
259
#define GUID_LEN 36
260
261
+// ----------------------------------------------------------------------------
262
+
263
+typedef enum rrdcalc_status {
264
+ RRDCALC_STATUS_REMOVED = -2,
265
+ RRDCALC_STATUS_UNDEFINED = -1,
266
+ RRDCALC_STATUS_UNINITIALIZED = 0,
267
+ RRDCALC_STATUS_CLEAR = 1,
268
+ RRDCALC_STATUS_RAISED = 2,
269
+ RRDCALC_STATUS_WARNING = 3,
270
+ RRDCALC_STATUS_CRITICAL = 4
271
+} RRDCALC_STATUS;
272
+
273
// ----------------------------------------------------------------------------
274
// netdata include files
275
@@ -295,16 +307,6 @@
307
#define NETDATA_OS_TYPE "linux"
308
#endif /* __FreeBSD__, __APPLE__*/
309
298
-typedef enum rrdcalc_status {
299
- RRDCALC_STATUS_REMOVED = -2,
300
- RRDCALC_STATUS_UNDEFINED = -1,
301
- RRDCALC_STATUS_UNINITIALIZED = 0,
302
- RRDCALC_STATUS_CLEAR = 1,
303
- RRDCALC_STATUS_RAISED = 2,
304
- RRDCALC_STATUS_WARNING = 3,
305
- RRDCALC_STATUS_CRITICAL = 4
306
-} RRDCALC_STATUS;
307
-
310
#include "eval.h"
311
#include "health.h"
312
@@ -315,7 +317,6 @@ typedef enum rrdcalc_status {
317
#include "plugins_d.h"
318
#include "statsd.h"
319
#include "rrd2json.h"
318
-#include "rrd2json_api_old.h"
320
#include "web_client.h"
321
#include "web_server.h"
322
#include "registry.h"
@@ -330,7 +331,6 @@ typedef enum rrdcalc_status {
331
#include "adaptive_resortable_list.h"
332
#include "rrdpush.h"
333
#include "web_api_v1.h"
333
-#include "web_api_old.h"
334
335
extern char *netdata_configured_hostname;
336
extern char *netdata_configured_config_dir;
src/daemon.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
#include <sched.h>
5
src/daemon.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_DAEMON_H
4
#define NETDATA_DAEMON_H 1
5
src/dictionary.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// ----------------------------------------------------------------------------
src/dictionary.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_DICTIONARY_H
4
#define NETDATA_DICTIONARY_H 1
5
src/eval.c
+25
-24
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// ----------------------------------------------------------------------------
@@ -1058,33 +1059,33 @@ static inline EVAL_NODE *parse_full_expression(const char **string, int *error)
1059
// ----------------------------------------------------------------------------
1060
// public API
1061
1061
-int expression_evaluate(EVAL_EXPRESSION *exp) {
1062
- exp->error = EVAL_ERROR_OK;
1062
+int expression_evaluate(EVAL_EXPRESSION *expression) {
1063
+ expression->error = EVAL_ERROR_OK;
1064
1064
- buffer_reset(exp->error_msg);
1065
- exp->result = eval_node(exp, (EVAL_NODE *)exp->nodes, &exp->error);
1065
+ buffer_reset(expression->error_msg);
1066
+ expression->result = eval_node(expression, (EVAL_NODE *)expression->nodes, &expression->error);
1067
1067
- if(unlikely(isnan(exp->result))) {
1068
- if(exp->error == EVAL_ERROR_OK)
1069
- exp->error = EVAL_ERROR_VALUE_IS_NAN;
1068
+ if(unlikely(isnan(expression->result))) {
1069
+ if(expression->error == EVAL_ERROR_OK)
1070
+ expression->error = EVAL_ERROR_VALUE_IS_NAN;
1071
}
1071
- else if(unlikely(isinf(exp->result))) {
1072
- if(exp->error == EVAL_ERROR_OK)
1073
- exp->error = EVAL_ERROR_VALUE_IS_INFINITE;
1072
+ else if(unlikely(isinf(expression->result))) {
1073
+ if(expression->error == EVAL_ERROR_OK)
1074
+ expression->error = EVAL_ERROR_VALUE_IS_INFINITE;
1075
}
1075
- else if(unlikely(exp->error == EVAL_ERROR_UNKNOWN_VARIABLE)) {
1076
+ else if(unlikely(expression->error == EVAL_ERROR_UNKNOWN_VARIABLE)) {
1077
// although there is an unknown variable
1078
// the expression was evaluated successfully
1078
- exp->error = EVAL_ERROR_OK;
1079
+ expression->error = EVAL_ERROR_OK;
1080
}
1081
1081
- if(exp->error != EVAL_ERROR_OK) {
1082
- exp->result = NAN;
1082
+ if(expression->error != EVAL_ERROR_OK) {
1083
+ expression->result = NAN;
1084
1084
- if(buffer_strlen(exp->error_msg))
1085
- buffer_strcat(exp->error_msg, "; ");
1085
+ if(buffer_strlen(expression->error_msg))
1086
+ buffer_strcat(expression->error_msg, "; ");
1087
1087
- buffer_sprintf(exp->error_msg, "failed to evaluate expression with error %d (%s)", exp->error, expression_strerror(exp->error));
1088
+ buffer_sprintf(expression->error_msg, "failed to evaluate expression with error %d (%s)", expression->error, expression_strerror(expression->error));
1089
return 0;
1090
}
1091
@@ -1135,14 +1136,14 @@ EVAL_EXPRESSION *expression_parse(const char *string, const char **failed_at, in
1136
return exp;
1137
}
1138
1138
-void expression_free(EVAL_EXPRESSION *exp) {
1139
- if(!exp) return;
1139
+void expression_free(EVAL_EXPRESSION *expression) {
1140
+ if(!expression) return;
1141
1141
- if(exp->nodes) eval_node_free((EVAL_NODE *)exp->nodes);
1142
- freez((void *)exp->source);
1143
- freez((void *)exp->parsed_as);
1144
- buffer_free(exp->error_msg);
1145
- freez(exp);
1142
+ if(expression->nodes) eval_node_free((EVAL_NODE *)expression->nodes);
1143
+ freez((void *)expression->source);
1144
+ freez((void *)expression->parsed_as);
1145
+ buffer_free(expression->error_msg);
1146
+ freez(expression);
1147
}
1148
1149
const char *expression_strerror(int error) {
src/eval.h
+3
-2
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_EVAL_H
3
-#define NETDATA_EVAL_H
4
+#define NETDATA_EVAL_H 1
5
6
#define EVAL_MAX_VARIABLE_NAME_LENGTH 300
7
@@ -60,7 +61,7 @@ typedef struct eval_expression {
61
extern EVAL_EXPRESSION *expression_parse(const char *string, const char **failed_at, int *error);
62
63
// free all resources allocated for an expression
63
-extern void expression_free(EVAL_EXPRESSION *op);
64
+extern void expression_free(EVAL_EXPRESSION *expression);
65
66
// convert an error code to a message
67
extern const char *expression_strerror(int error);
src/freebsd_devstat.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#include <sys/devicestat.h>
src/freebsd_getifaddrs.c
+2
@@ -1,3 +1,5 @@
1
+// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#include <ifaddrs.h>
src/freebsd_getmntinfo.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#include <sys/mount.h>
src/freebsd_ipfw.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#include <netinet/ip_fw.h>
src/freebsd_kstat_zfs.c
+2
@@ -1,5 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
+
5
#include "zfs_common.h"
6
7
extern struct arcstats arcstats;
src/freebsd_sysctl.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#include <sys/vmmeter.h>
src/global_statistics.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
volatile struct global_statistics global_statistics = {
src/global_statistics.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_GLOBAL_STATISTICS_H
4
#define NETDATA_GLOBAL_STATISTICS_H 1
5
src/health.c
+3
-2
@@ -1,8 +1,9 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_HEALTH_INTERNALS
4
#include "common.h"
5
5
-int default_health_enabled = 1;
6
+unsigned int default_health_enabled = 1;
7
8
// ----------------------------------------------------------------------------
9
// health initialization
@@ -16,7 +17,7 @@ inline char *health_config_dir(void) {
17
void health_init(void) {
18
debug(D_HEALTH, "Health configuration initializing");
19
19
- if(!(default_health_enabled = config_get_boolean(CONFIG_SECTION_HEALTH, "enabled", 1))) {
20
+ if(!(default_health_enabled = (unsigned int)config_get_boolean(CONFIG_SECTION_HEALTH, "enabled", default_health_enabled))) {
21
debug(D_HEALTH, "Health is disabled.");
22
return;
23
}
src/health.h
+3
-2
@@ -1,8 +1,9 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_HEALTH_H
3
-#define NETDATA_HEALTH_H
4
+#define NETDATA_HEALTH_H 1
5
5
-extern int default_health_enabled;
6
+extern unsigned int default_health_enabled;
7
8
extern int rrdvar_compare(void *a, void *b);
9
src/health_config.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_HEALTH_INTERNALS
4
#include "common.h"
5
src/health_json.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_HEALTH_INTERNALS
4
#include "common.h"
5
src/health_log.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_HEALTH_INTERNALS
4
#include "common.h"
5
src/inlined.h
+2
-3
@@ -1,8 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
-#ifndef NETDATA_INLINED_H
3
-#define NETDATA_INLINED_H
2
5
-#include "common.h"
3
+#ifndef NETDATA_INLINED_H
4
+#define NETDATA_INLINED_H 1
5
6
#ifdef KERNEL_32BIT
7
typedef uint32_t kernel_uint_t;
src/ipc.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#include <sys/sem.h>
src/ipc.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_PLUGIN_IPC_H
4
#define NETDATA_PLUGIN_IPC_H 1
5
src/locks.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// ----------------------------------------------------------------------------
src/locks.h
+2
-1
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_LOCKS_H
3
-#define NETDATA_LOCKS_H
4
+#define NETDATA_LOCKS_H 1
5
6
typedef pthread_mutex_t netdata_mutex_t;
7
#define NETDATA_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
src/log.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
int web_server_is_multithreaded = 1;
src/log.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_LOG_H
4
#define NETDATA_LOG_H 1
5
src/macos_fw.c
+2
@@ -1,5 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
+
5
#include <CoreFoundation/CoreFoundation.h>
6
#include <IOKit/IOKitLib.h>
7
#include <IOKit/storage/IOBlockStorageDriver.h>
src/macos_mach_smi.c
+2
@@ -1,5 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
+
5
#include <mach/mach.h>
6
7
int do_macos_mach_smi(int update_every, usec_t dt) {
src/macos_sysctl.c
+2
@@ -1,5 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
+
5
#include <Availability.h>
6
#include <sys/sysctl.h>
7
// NEEDED BY: do_bandwidth
src/main.c
+7
-4
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
extern void *cgroups_main(void *ptr);
@@ -147,7 +148,7 @@ void web_server_config_options(void) {
148
}
149
150
150
-int killpid(pid_t pid, int sig)
151
+int killpid(pid_t pid, int signal)
152
{
153
int ret = -1;
154
debug(D_EXIT, "Request to kill pid %d", pid);
@@ -170,7 +171,7 @@ int killpid(pid_t pid, int sig)
171
}
172
else {
173
errno = 0;
173
- ret = kill(pid, sig);
174
+ ret = kill(pid, signal);
175
if(ret == -1) {
176
switch(errno) {
177
case ESRCH:
@@ -194,7 +195,8 @@ int killpid(pid_t pid, int sig)
195
void cancel_main_threads() {
196
error_log_limit_unlimited();
197
197
- int i, found = 0, max = 5 * USEC_PER_SEC, step = 100000;
198
+ int i, found = 0;
199
+ usec_t max = 5 * USEC_PER_SEC, step = 100000;
200
for (i = 0; static_threads[i].name != NULL ; i++) {
201
if(static_threads[i].enabled == NETDATA_MAIN_THREAD_RUNNING) {
202
info("EXIT: Stopping master thread: %s", static_threads[i].name);
@@ -324,7 +326,8 @@ int help(int exitcode) {
326
327
// TODO: Remove this function with the nix major release.
328
void remove_option(int opt_index, int *argc, char **argv) {
327
- int i = opt_index;
329
+ int i;
330
+
331
// remove the options.
332
do {
333
*argc = *argc - 1;
src/main.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_MAIN_H
4
#define NETDATA_MAIN_H 1
5
src/plugin_checks.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#ifdef NETDATA_INTERNAL_CHECKS
src/plugin_checks.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_PLUGIN_CHECKS_H
4
#define NETDATA_PLUGIN_CHECKS_H 1
5
src/plugin_freebsd.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
static struct freebsd_module {
src/plugin_freebsd.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_PLUGIN_FREEBSD_H
4
#define NETDATA_PLUGIN_FREEBSD_H 1
5
src/plugin_idlejitter.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define CPU_IDLEJITTER_SLEEP_TIME_MS 20
src/plugin_idlejitter.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_PLUGIN_IDLEJITTER_H
4
#define NETDATA_PLUGIN_IDLEJITTER_H 1
5
src/plugin_macos.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
static void macos_main_cleanup(void *ptr) {
src/plugin_macos.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_PLUGIN_MACOS_H
4
#define NETDATA_PLUGIN_MACOS_H 1
5
src/plugin_nfacct.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#ifdef INTERNAL_PLUGIN_NFACCT
src/plugin_nfacct.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_NFACCT_H
4
#define NETDATA_NFACCT_H 1
5
src/plugin_proc.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
static struct proc_module {
src/plugin_proc.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_PLUGIN_PROC_H
4
#define NETDATA_PLUGIN_PROC_H 1
5
src/plugin_proc_diskspace.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define DELAULT_EXCLUDED_PATHS "/proc/* /sys/* /var/run/user/* /run/user/* /snap/* /var/lib/docker/*"
src/plugin_proc_diskspace.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_PLUGIN_PROC_DISKSPACE_H
4
#define NETDATA_PLUGIN_PROC_DISKSPACE_H
5
src/plugin_tc.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define RRD_TYPE_TC "tc"
src/plugin_tc.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_PLUGIN_TC_H
4
#define NETDATA_PLUGIN_TC_H 1
5
src/plugins_d.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
char *plugin_directories[PLUGINSD_MAX_DIRECTORIES] = { NULL };
src/plugins_d.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_PLUGINS_D_H
4
#define NETDATA_PLUGINS_D_H 1
5
src/popen.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
/*
src/popen.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_POPEN_H
4
#define NETDATA_POPEN_H 1
5
src/proc_diskstats.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define RRD_TYPE_DISK "disk"
src/proc_interrupts.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define MAX_INTERRUPT_NAME 50
src/proc_loadavg.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// linux calculates this once every 5 seconds
src/proc_meminfo.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
int do_proc_meminfo(int update_every, usec_t dt) {
src/proc_net_dev.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// ----------------------------------------------------------------------------
src/proc_net_ip_vs_stats.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define RRD_TYPE_NET_IPVS "ipvs"
src/proc_net_netstat.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
unsigned long long tcpext_TCPSynRetrans;
src/proc_net_rpc_nfs.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
struct nfs_procs {
src/proc_net_rpc_nfsd.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
struct nfsd_procs {
src/proc_net_sctp_snmp.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
int do_proc_net_sctp_snmp(int update_every, usec_t dt) {
src/proc_net_snmp.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define RRD_TYPE_NET_SNMP "ipv4"
src/proc_net_snmp6.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define RRD_TYPE_NET_SNMP6 "ipv6"
src/proc_net_sockstat.c
+4
-3
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
static struct proc_net_sockstat {
@@ -57,9 +58,9 @@ static int read_tcp_mem(void) {
58
59
// fprintf(stderr, "TCP MEM low = %llu, pressure = %llu, high = %llu\n", low, pressure, high);
60
60
- rrdvar_custom_host_variable_set(localhost, tcp_mem_low_threshold, low * sysconf(_SC_PAGESIZE) / 1024);
61
- rrdvar_custom_host_variable_set(localhost, tcp_mem_pressure_threshold, pressure * sysconf(_SC_PAGESIZE) / 1024);
62
- rrdvar_custom_host_variable_set(localhost, tcp_mem_high_threshold, high * sysconf(_SC_PAGESIZE) / 1024);
61
+ rrdvar_custom_host_variable_set(localhost, tcp_mem_low_threshold, low * sysconf(_SC_PAGESIZE) / 1024.0);
62
+ rrdvar_custom_host_variable_set(localhost, tcp_mem_pressure_threshold, pressure * sysconf(_SC_PAGESIZE) / 1024.0);
63
+ rrdvar_custom_host_variable_set(localhost, tcp_mem_high_threshold, high * sysconf(_SC_PAGESIZE) / 1024.0);
64
65
return 0;
66
}
src/proc_net_sockstat6.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
static struct proc_net_sockstat6 {
src/proc_net_softnet_stat.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
static inline char *softnet_column_name(size_t column) {
src/proc_net_stat_conntrack.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define RRD_TYPE_NET_STAT_NETFILTER "netfilter"
src/proc_net_stat_synproxy.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define RRD_TYPE_NET_STAT_NETFILTER "netfilter"
src/proc_self_mountinfo.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// ----------------------------------------------------------------------------
src/proc_self_mountinfo.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_PROC_SELF_MOUNTINFO_H
4
#define NETDATA_PROC_SELF_MOUNTINFO_H 1
5
src/proc_softirqs.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define MAX_INTERRUPT_NAME 50
src/proc_spl_kstat_zfs.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
#include "zfs_common.h"
5
src/proc_stat.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
struct per_core_single_number_file {
src/proc_sys_kernel_random_entropy_avail.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
int do_proc_sys_kernel_random_entropy_avail(int update_every, usec_t dt) {
src/proc_uptime.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
static inline collected_number uptime_from_boottime(void) {
src/proc_vmstat.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
int do_proc_vmstat(int update_every, usec_t dt) {
src/procfile.c
+1
-1
@@ -1,6 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
3
-#include "procfile.h"
4
5
#define PF_PREFIX "PROCFILE"
6
src/procfile.h
-1
@@ -23,7 +23,6 @@
23
* - a J1900 celeron processor can process 23.000+ files / sec.
24
*/
25
26
-
26
#ifndef NETDATA_PROCFILE_H
27
#define NETDATA_PROCFILE_H 1
28
src/registry.c
+1
-1
@@ -1,6 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
-#include "common.h"
2
3
+#include "common.h"
4
#include "registry_internals.h"
5
6
#define REGISTRY_STATUS_OK "ok"
src/registry.h
-1
@@ -46,7 +46,6 @@
46
// (i.e. start tracking them only when they access a non-demo machine)
47
// - [DONE] do not track custom dashboards by default
48
49
-
49
#ifndef NETDATA_REGISTRY_H
50
#define NETDATA_REGISTRY_H 1
51
src/registry_db.c
+2
@@ -1,4 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
+#include "common.h"
4
#include "registry_internals.h"
5
6
int registry_db_should_be_saved(void) {
src/registry_init.c
+2
@@ -1,4 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
+#include "common.h"
4
#include "registry_internals.h"
5
6
int registry_init(void) {
src/registry_internals.c
+2
@@ -1,4 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
+#include "common.h"
4
#include "registry_internals.h"
5
6
struct registry registry;
src/registry_internals.h
+1
-2
@@ -1,8 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
-#include "common.h"
2
3
#ifndef NETDATA_REGISTRY_INTERNALS_H_H
5
-#define NETDATA_REGISTRY_INTERNALS_H_H
4
+#define NETDATA_REGISTRY_INTERNALS_H_H 1
5
6
#define REGISTRY_URL_FLAGS_DEFAULT 0x00
7
#define REGISTRY_URL_FLAGS_EXPIRED 0x01
src/registry_log.c
+2
@@ -1,4 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
+#include "common.h"
4
#include "registry_internals.h"
5
6
void registry_log(char action, REGISTRY_PERSON *p, REGISTRY_MACHINE *m, REGISTRY_URL *u, char *name) {
src/registry_machine.c
+2
@@ -1,4 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
+#include "common.h"
4
#include "registry_internals.h"
5
6
// ----------------------------------------------------------------------------
src/registry_machine.h
+2
-3
@@ -1,8 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
-#ifndef NETDATA_REGISTRY_MACHINE_H
3
-#define NETDATA_REGISTRY_MACHINE_H
2
5
-#include "registry_internals.h"
3
+#ifndef NETDATA_REGISTRY_MACHINE_H
4
+#define NETDATA_REGISTRY_MACHINE_H 1
5
6
// ----------------------------------------------------------------------------
7
// MACHINE structures
src/registry_person.c
+2
@@ -1,4 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
+#include "common.h"
4
#include "registry_internals.h"
5
6
// ----------------------------------------------------------------------------
src/registry_person.h
+2
-3
@@ -1,8 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
-#ifndef NETDATA_REGISTRY_PERSON_H
3
-#define NETDATA_REGISTRY_PERSON_H
2
5
-#include "registry_internals.h"
3
+#ifndef NETDATA_REGISTRY_PERSON_H
4
+#define NETDATA_REGISTRY_PERSON_H 1
5
6
// ----------------------------------------------------------------------------
7
// PERSON structures
src/registry_url.c
+2
@@ -1,4 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
+#include "common.h"
4
#include "registry_internals.h"
5
6
// ----------------------------------------------------------------------------
src/registry_url.h
+2
-3
@@ -1,8 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
-#ifndef NETDATA_REGISTRY_URL_H
3
-#define NETDATA_REGISTRY_URL_H
2
5
-#include "registry_internals.h"
3
+#ifndef NETDATA_REGISTRY_URL_H
4
+#define NETDATA_REGISTRY_URL_H 1
5
6
// ----------------------------------------------------------------------------
7
// URL structures
src/rrd.c
+1
@@ -1,5 +1,6 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
#define NETDATA_RRD_INTERNALS 1
3
+
4
#include "common.h"
5
6
// ----------------------------------------------------------------------------
src/rrd.h
+3
-2
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_RRD_H
4
#define NETDATA_RRD_H 1
5
@@ -567,8 +568,8 @@ extern RRDHOST *rrdhost_find_or_create(
568
, int update_every
569
, long history
570
, RRD_MEMORY_MODE mode
570
- , int health_enabled
571
- , int rrdpush_enabled
571
+ , unsigned int health_enabled
572
+ , unsigned int rrdpush_enabled
573
, char *rrdpush_destination
574
, char *rrdpush_api_key
575
);
src/rrd2json.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
void rrd_stats_api_v1_chart_with_data(RRDSET *st, BUFFER *wb, size_t *dimensions_count, size_t *memory_used)
src/rrd2json.h
+29
-6
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_RRD2JSON_H
4
#define NETDATA_RRD2JSON_H 1
5
@@ -72,12 +73,34 @@ extern void rrd_stats_api_v1_charts(RRDHOST *host, BUFFER *wb);
73
extern void rrd_stats_api_v1_charts_allmetrics_json(RRDHOST *host, BUFFER *wb);
74
extern void rrd_stats_api_v1_charts_allmetrics_shell(RRDHOST *host, BUFFER *wb);
75
75
-extern int rrdset2anything_api_v1(RRDSET *st, BUFFER *out, BUFFER *dimensions, uint32_t format, long points
76
- , long long after, long long before, int group_method, long group_time, uint32_t options
77
- , time_t *latest_timestamp);
76
+extern int rrdset2anything_api_v1(
77
+ RRDSET *st
78
+ , BUFFER *wb
79
+ , BUFFER *dimensions
80
+ , uint32_t format
81
+ , long points
82
+ , long long after
83
+ , long long before
84
+ , int group_method
85
+ , long group_time
86
+ , uint32_t options
87
+ , time_t *latest_timestamp
88
+);
89
79
-extern int rrdset2value_api_v1(RRDSET *st, BUFFER *wb, calculated_number *n, const char *dimensions, long points
80
- , long long after, long long before, int group_method, long group_time, uint32_t options
81
- , time_t *db_after, time_t *db_before, int *value_is_null);
90
+extern int rrdset2value_api_v1(
91
+ RRDSET *st
92
+ , BUFFER *wb
93
+ , calculated_number *n
94
+ , const char *dimensions
95
+ , long points
96
+ , long long after
97
+ , long long before
98
+ , int group_method
99
+ , long group_time
100
+ , uint32_t options
101
+ , time_t *db_after
102
+ , time_t *db_before
103
+ , int *value_is_null
104
+);
105
106
#endif /* NETDATA_RRD2JSON_H */
src/rrd2json_api_old.c
deleted
-488
@@ -1,488 +0,0 @@
1
-// SPDX-License-Identifier: GPL-3.0+
2
-#include "common.h"
3
-
4
-unsigned long rrdset_info2json_api_old(RRDSET *st, char *options, BUFFER *wb) {
5
- time_t now = now_realtime_sec();
6
-
7
- rrdset_rdlock(st);
8
-
9
- st->last_accessed_time = now;
10
-
11
- buffer_sprintf(wb,
12
- "\t\t{\n"
13
- "\t\t\t\"id\": \"%s\",\n"
14
- "\t\t\t\"name\": \"%s\",\n"
15
- "\t\t\t\"type\": \"%s\",\n"
16
- "\t\t\t\"family\": \"%s\",\n"
17
- "\t\t\t\"context\": \"%s\",\n"
18
- "\t\t\t\"title\": \"%s (%s)\",\n"
19
- "\t\t\t\"priority\": %ld,\n"
20
- "\t\t\t\"enabled\": %d,\n"
21
- "\t\t\t\"units\": \"%s\",\n"
22
- "\t\t\t\"url\": \"/data/%s/%s\",\n"
23
- "\t\t\t\"chart_type\": \"%s\",\n"
24
- "\t\t\t\"counter\": %lu,\n"
25
- "\t\t\t\"entries\": %ld,\n"
26
- "\t\t\t\"first_entry_t\": %ld,\n"
27
- "\t\t\t\"last_entry\": %lu,\n"
28
- "\t\t\t\"last_entry_t\": %ld,\n"
29
- "\t\t\t\"last_entry_secs_ago\": %ld,\n"
30
- "\t\t\t\"update_every\": %d,\n"
31
- "\t\t\t\"isdetail\": %d,\n"
32
- "\t\t\t\"usec_since_last_update\": %llu,\n"
33
- "\t\t\t\"collected_total\": " TOTAL_NUMBER_FORMAT ",\n"
34
- "\t\t\t\"last_collected_total\": " TOTAL_NUMBER_FORMAT ",\n"
35
- "\t\t\t\"dimensions\": [\n"
36
- , st->id
37
- , st->name
38
- , st->type
39
- , st->family
40
- , st->context
41
- , st->title, st->name
42
- , st->priority
43
- , rrdset_flag_check(st, RRDSET_FLAG_ENABLED)?1:0
44
- , st->units
45
- , st->name, options?options:""
46
- , rrdset_type_name(st->chart_type)
47
- , st->counter
48
- , st->entries
49
- , rrdset_first_entry_t(st)
50
- , rrdset_last_slot(st)
51
- , rrdset_last_entry_t(st)
52
- , (now < rrdset_last_entry_t(st)) ? (time_t)0 : now - rrdset_last_entry_t(st)
53
- , st->update_every
54
- , rrdset_flag_check(st, RRDSET_FLAG_DETAIL)?1:0
55
- , st->usec_since_last_update
56
- , st->collected_total
57
- , st->last_collected_total
58
- );
59
-
60
- unsigned long memory = st->memsize;
61
-
62
- RRDDIM *rd;
63
- rrddim_foreach_read(rd, st) {
64
-
65
- memory += rd->memsize;
66
-
67
- buffer_sprintf(wb,
68
- "\t\t\t\t{\n"
69
- "\t\t\t\t\t\"id\": \"%s\",\n"
70
- "\t\t\t\t\t\"name\": \"%s\",\n"
71
- "\t\t\t\t\t\"entries\": %ld,\n"
72
- "\t\t\t\t\t\"isHidden\": %d,\n"
73
- "\t\t\t\t\t\"algorithm\": \"%s\",\n"
74
- "\t\t\t\t\t\"multiplier\": " COLLECTED_NUMBER_FORMAT ",\n"
75
- "\t\t\t\t\t\"divisor\": " COLLECTED_NUMBER_FORMAT ",\n"
76
- "\t\t\t\t\t\"last_entry_t\": %ld,\n"
77
- "\t\t\t\t\t\"collected_value\": " COLLECTED_NUMBER_FORMAT ",\n"
78
- "\t\t\t\t\t\"calculated_value\": " CALCULATED_NUMBER_FORMAT ",\n"
79
- "\t\t\t\t\t\"last_collected_value\": " COLLECTED_NUMBER_FORMAT ",\n"
80
- "\t\t\t\t\t\"last_calculated_value\": " CALCULATED_NUMBER_FORMAT ",\n"
81
- "\t\t\t\t\t\"memory\": %lu\n"
82
- "\t\t\t\t}%s\n"
83
- , rd->id
84
- , rd->name
85
- , rd->entries
86
- , rrddim_flag_check(rd, RRDDIM_FLAG_HIDDEN)?1:0
87
- , rrd_algorithm_name(rd->algorithm)
88
- , rd->multiplier
89
- , rd->divisor
90
- , rd->last_collected_time.tv_sec
91
- , rd->collected_value
92
- , rd->calculated_value
93
- , rd->last_collected_value
94
- , rd->last_calculated_value
95
- , rd->memsize
96
- , rd->next?",":""
97
- );
98
- }
99
-
100
- buffer_sprintf(wb,
101
- "\t\t\t],\n"
102
- "\t\t\t\"memory\" : %lu\n"
103
- "\t\t}"
104
- , memory
105
- );
106
-
107
- rrdset_unlock(st);
108
- return memory;
109
-}
110
-
111
-#define RRD_GRAPH_JSON_HEADER "{\n\t\"charts\": [\n"
112
-#define RRD_GRAPH_JSON_FOOTER "\n\t]\n}\n"
113
-
114
-void rrd_graph2json_api_old(RRDSET *st, char *options, BUFFER *wb)
115
-{
116
- buffer_strcat(wb, RRD_GRAPH_JSON_HEADER);
117
- rrdset_info2json_api_old(st, options, wb);
118
- buffer_strcat(wb, RRD_GRAPH_JSON_FOOTER);
119
-}
120
-
121
-void rrd_all2json_api_old(RRDHOST *host, BUFFER *wb)
122
-{
123
- unsigned long memory = 0;
124
- long c = 0;
125
- RRDSET *st;
126
-
127
- time_t now = now_realtime_sec();
128
-
129
- buffer_strcat(wb, RRD_GRAPH_JSON_HEADER);
130
-
131
- rrdhost_rdlock(host);
132
- rrdset_foreach_read(st, host) {
133
- if(rrdset_is_available_for_viewers(st)) {
134
- if(c) buffer_strcat(wb, ",\n");
135
- memory += rrdset_info2json_api_old(st, NULL, wb);
136
-
137
- c++;
138
- st->last_accessed_time = now;
139
- }
140
- }
141
- rrdhost_unlock(host);
142
-
143
- buffer_sprintf(wb, "\n\t],\n"
144
- "\t\"hostname\": \"%s\",\n"
145
- "\t\"update_every\": %d,\n"
146
- "\t\"history\": %ld,\n"
147
- "\t\"memory\": %lu\n"
148
- "}\n"
149
- , host->hostname
150
- , host->rrd_update_every
151
- , host->rrd_history_entries
152
- , memory
153
- );
154
-}
155
-
156
-time_t rrdset2json_api_old(
157
- int type
158
- , RRDSET *st
159
- , BUFFER *wb
160
- , long points
161
- , long group
162
- , int group_method
163
- , time_t after
164
- , time_t before
165
- , int only_non_zero
166
-) {
167
- int c;
168
- rrdset_rdlock(st);
169
-
170
- st->last_accessed_time = now_realtime_sec();
171
-
172
- // -------------------------------------------------------------------------
173
- // switch from JSON to google JSON
174
-
175
- char kq[2] = "\"";
176
- char sq[2] = "\"";
177
- switch(type) {
178
- case DATASOURCE_DATATABLE_JSON:
179
- case DATASOURCE_DATATABLE_JSONP:
180
- kq[0] = '\0';
181
- sq[0] = '\'';
182
- break;
183
-
184
- case DATASOURCE_JSON:
185
- default:
186
- break;
187
- }
188
-
189
-
190
- // -------------------------------------------------------------------------
191
- // validate the parameters
192
-
193
- if(points < 1) points = 1;
194
- if(group < 1) group = 1;
195
-
196
- if(before == 0 || before > rrdset_last_entry_t(st)) before = rrdset_last_entry_t(st);
197
- if(after == 0 || after < rrdset_first_entry_t(st)) after = rrdset_first_entry_t(st);
198
-
199
- // ---
200
-
201
- // our return value (the last timestamp printed)
202
- // this is required to detect re-transmit in google JSONP
203
- time_t last_timestamp = 0;
204
-
205
-
206
- // -------------------------------------------------------------------------
207
- // find how many dimensions we have
208
-
209
- int dimensions = 0;
210
- RRDDIM *rd;
211
- rrddim_foreach_read(rd, st) dimensions++;
212
- if(!dimensions) {
213
- rrdset_unlock(st);
214
- buffer_strcat(wb, "No dimensions yet.");
215
- return 0;
216
- }
217
-
218
-
219
- // -------------------------------------------------------------------------
220
- // prepare various strings, to speed up the loop
221
-
222
- char overflow_annotation[201]; snprintfz(overflow_annotation, 200, ",{%sv%s:%sRESET OR OVERFLOW%s},{%sv%s:%sThe counters have been wrapped.%s}", kq, kq, sq, sq, kq, kq, sq, sq);
223
- char normal_annotation[201]; snprintfz(normal_annotation, 200, ",{%sv%s:null},{%sv%s:null}", kq, kq, kq, kq);
224
- char pre_date[51]; snprintfz(pre_date, 50, " {%sc%s:[{%sv%s:%s", kq, kq, kq, kq, sq);
225
- char post_date[21]; snprintfz(post_date, 20, "%s}", sq);
226
- char pre_value[21]; snprintfz(pre_value, 20, ",{%sv%s:", kq, kq);
227
- char post_value[21]; strcpy(post_value, "}");
228
-
229
-
230
- // -------------------------------------------------------------------------
231
- // checks for debugging
232
-
233
- if(rrdset_flag_check(st, RRDSET_FLAG_DEBUG)) {
234
- debug(D_RRD_STATS, "%s first_entry_t = %ld, last_entry_t = %ld, duration = %ld, after = %ld, before = %ld, duration = %ld, entries_to_show = %ld, group = %ld"
235
- , st->id
236
- , rrdset_first_entry_t(st)
237
- , rrdset_last_entry_t(st)
238
- , rrdset_last_entry_t(st) - rrdset_first_entry_t(st)
239
- , after
240
- , before
241
- , before - after
242
- , points
243
- , group
244
- );
245
-
246
- if(before < after)
247
- debug(D_RRD_STATS, "WARNING: %s The newest value in the database (%ld) is earlier than the oldest (%ld)", st->name, before, after);
248
-
249
- if((before - after) > st->entries * st->update_every)
250
- debug(D_RRD_STATS, "WARNING: %s The time difference between the oldest and the newest entries (%ld) is higher than the capacity of the database (%ld)", st->name, before - after, st->entries * st->update_every);
251
- }
252
-
253
-
254
- // -------------------------------------------------------------------------
255
- // temp arrays for keeping values per dimension
256
-
257
- calculated_number group_values[dimensions]; // keep sums when grouping
258
- int print_hidden[dimensions]; // keep hidden flags
259
- int found_non_zero[dimensions];
260
- int found_non_existing[dimensions];
261
-
262
- // initialize them
263
- for( rd = st->dimensions, c = 0 ; rd && c < dimensions ; rd = rd->next, c++) {
264
- group_values[c] = 0;
265
- print_hidden[c] = rrddim_flag_check(rd, RRDDIM_FLAG_HIDDEN)?1:0;
266
- found_non_zero[c] = 0;
267
- found_non_existing[c] = 0;
268
- }
269
-
270
-
271
- // error("OLD: points=%d after=%d before=%d group=%d, duration=%d", entries_to_show, before - (st->update_every * group * entries_to_show), before, group, before - after + 1);
272
- // rrd2array(st, entries_to_show, before - (st->update_every * group * entries_to_show), before, group_method, only_non_zero);
273
- // rrd2rrdr(st, entries_to_show, before - (st->update_every * group * entries_to_show), before, group_method);
274
-
275
- // -------------------------------------------------------------------------
276
- // remove dimensions that contain only zeros
277
-
278
- int max_loop = 1;
279
- if(only_non_zero) max_loop = 2;
280
-
281
- for(; max_loop ; max_loop--) {
282
-
283
- // -------------------------------------------------------------------------
284
- // print the JSON header
285
-
286
- buffer_sprintf(wb, "{\n %scols%s:\n [\n", kq, kq);
287
- buffer_sprintf(wb, " {%sid%s:%s%s,%slabel%s:%stime%s,%spattern%s:%s%s,%stype%s:%sdatetime%s},\n", kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, sq, sq);
288
- buffer_sprintf(wb, " {%sid%s:%s%s,%slabel%s:%s%s,%spattern%s:%s%s,%stype%s:%sstring%s,%sp%s:{%srole%s:%sannotation%s}},\n", kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, kq, kq, sq, sq);
289
- buffer_sprintf(wb, " {%sid%s:%s%s,%slabel%s:%s%s,%spattern%s:%s%s,%stype%s:%sstring%s,%sp%s:{%srole%s:%sannotationText%s}}", kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, sq, sq, kq, kq, kq, kq, sq, sq);
290
-
291
- // print the header for each dimension
292
- // and update the print_hidden array for the dimensions that should be hidden
293
- int pc = 0;
294
- for( rd = st->dimensions, c = 0 ; rd && c < dimensions ; rd = rd->next, c++) {
295
- if(!print_hidden[c]) {
296
- pc++;
297
- buffer_sprintf(wb, ",\n {%sid%s:%s%s,%slabel%s:%s%s%s,%spattern%s:%s%s,%stype%s:%snumber%s}", kq, kq, sq, sq, kq, kq, sq, rd->name, sq, kq, kq, sq, sq, kq, kq, sq, sq);
298
- }
299
- }
300
- if(!pc) {
301
- buffer_sprintf(wb, ",\n {%sid%s:%s%s,%slabel%s:%s%s%s,%spattern%s:%s%s,%stype%s:%snumber%s}", kq, kq, sq, sq, kq, kq, sq, "no data", sq, kq, kq, sq, sq, kq, kq, sq, sq);
302
- }
303
-
304
- // print the begin of row data
305
- buffer_sprintf(wb, "\n ],\n %srows%s:\n [\n", kq, kq);
306
-
307
-
308
- // -------------------------------------------------------------------------
309
- // the main loop
310
-
311
- int annotate_reset = 0;
312
- int annotation_count = 0;
313
-
314
- long t = rrdset_time2slot(st, before),
315
- stop_at_t = rrdset_time2slot(st, after),
316
- stop_now = 0;
317
-
318
- t -= t % group;
319
-
320
- time_t now = rrdset_slot2time(st, t),
321
- dt = st->update_every;
322
-
323
- long count = 0, printed = 0, group_count = 0;
324
- last_timestamp = 0;
325
-
326
- if(unlikely(rrdset_flag_check(st, RRDSET_FLAG_DEBUG)))
327
- debug(D_RRD_STATS, "%s: REQUEST after:%u before:%u, points:%ld, group:%ld, CHART cur:%ld first: %u last:%u, CALC start_t:%ld, stop_t:%ld"
328
- , st->id
329
- , (uint32_t)after
330
- , (uint32_t)before
331
- , points
332
- , group
333
- , st->current_entry
334
- , (uint32_t)rrdset_first_entry_t(st)
335
- , (uint32_t)rrdset_last_entry_t(st)
336
- , t
337
- , stop_at_t
338
- );
339
-
340
- long counter = 0;
341
- for(; !stop_now ; now -= dt, t--, counter++) {
342
- if(t < 0) t = st->entries - 1;
343
- if(t == stop_at_t) stop_now = counter;
344
-
345
- int print_this = 0;
346
-
347
- if(unlikely(rrdset_flag_check(st, RRDSET_FLAG_DEBUG)))
348
- debug(D_RRD_STATS, "%s t = %ld, count = %ld, group_count = %ld, printed = %ld, now = %ld, %s %s"
349
- , st->id
350
- , t
351
- , count + 1
352
- , group_count + 1
353
- , printed
354
- , now
355
- , (group_count + 1 == group)?"PRINT":" - "
356
- , (now >= after && now <= before)?"RANGE":" - "
357
- );
358
-
359
-
360
- // make sure we return data in the proper time range
361
- if(now > before) continue;
362
- if(now < after) break;
363
-
364
- //if(rrdset_slot2time(st, t) != now)
365
- // error("%s: slot=%ld, now=%ld, slot2time=%ld, diff=%ld, last_entry_t=%ld, rrdset_last_slot=%ld", st->id, t, now, rrdset_slot2time(st,t), now - rrdset_slot2time(st,t), rrdset_last_entry_t(st), rrdset_last_slot(st));
366
-
367
- count++;
368
- group_count++;
369
-
370
- // check if we have to print this now
371
- if(group_count == group) {
372
- if(printed >= points) {
373
- // debug(D_RRD_STATS, "Already printed all rows. Stopping.");
374
- break;
375
- }
376
-
377
- // generate the local date time
378
- struct tm tmbuf, *tm = localtime_r(&now, &tmbuf);
379
- if(!tm) { error("localtime() failed."); continue; }
380
- if(now > last_timestamp) last_timestamp = now;
381
-
382
- if(printed) buffer_strcat(wb, "]},\n");
383
- buffer_strcat(wb, pre_date);
384
- buffer_jsdate(wb, tm->tm_year + 1900, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
385
- buffer_strcat(wb, post_date);
386
-
387
- print_this = 1;
388
- }
389
-
390
- // do the calculations
391
- for(rd = st->dimensions, c = 0 ; rd && c < dimensions ; rd = rd->next, c++) {
392
- storage_number n = rd->values[t];
393
- calculated_number value = unpack_storage_number(n);
394
-
395
- if(!does_storage_number_exist(n)) {
396
- value = 0.0;
397
- found_non_existing[c]++;
398
- }
399
- if(did_storage_number_reset(n)) annotate_reset = 1;
400
-
401
- switch(group_method) {
402
- case GROUP_MAX:
403
- if(abs(value) > abs(group_values[c])) group_values[c] = value;
404
- break;
405
-
406
- case GROUP_SUM:
407
- group_values[c] += value;
408
- break;
409
-
410
- default:
411
- case GROUP_AVERAGE:
412
- group_values[c] += value;
413
- if(print_this) group_values[c] /= ( group_count - found_non_existing[c] );
414
- break;
415
- }
416
- }
417
-
418
- if(print_this) {
419
- if(annotate_reset) {
420
- annotation_count++;
421
- buffer_strcat(wb, overflow_annotation);
422
- annotate_reset = 0;
423
- }
424
- else
425
- buffer_strcat(wb, normal_annotation);
426
-
427
- pc = 0;
428
- for(c = 0 ; c < dimensions ; c++) {
429
- if(found_non_existing[c] == group_count) {
430
- // all entries are non-existing
431
- pc++;
432
- buffer_strcat(wb, pre_value);
433
- buffer_strcat(wb, "null");
434
- buffer_strcat(wb, post_value);
435
- }
436
- else if(!print_hidden[c]) {
437
- pc++;
438
- buffer_strcat(wb, pre_value);
439
- buffer_rrd_value(wb, group_values[c]);
440
- buffer_strcat(wb, post_value);
441
-
442
- if(group_values[c]) found_non_zero[c]++;
443
- }
444
-
445
- // reset them for the next loop
446
- group_values[c] = 0;
447
- found_non_existing[c] = 0;
448
- }
449
-
450
- // if all dimensions are hidden, print a null
451
- if(!pc) {
452
- buffer_strcat(wb, pre_value);
453
- buffer_strcat(wb, "null");
454
- buffer_strcat(wb, post_value);
455
- }
456
-
457
- printed++;
458
- group_count = 0;
459
- }
460
- }
461
-
462
- if(printed) buffer_strcat(wb, "]}");
463
- buffer_strcat(wb, "\n ]\n}\n");
464
-
465
- if(only_non_zero && max_loop > 1) {
466
- int changed = 0;
467
- for(rd = st->dimensions, c = 0 ; rd && c < dimensions ; rd = rd->next, c++) {
468
- group_values[c] = 0;
469
- found_non_existing[c] = 0;
470
-
471
- if(!print_hidden[c] && !found_non_zero[c]) {
472
- changed = 1;
473
- print_hidden[c] = 1;
474
- }
475
- }
476
-
477
- if(changed) buffer_flush(wb);
478
- else break;
479
- }
480
- else break;
481
-
482
- } // max_loop
483
-
484
- debug(D_RRD_STATS, "RRD_STATS_JSON: %s total %zu bytes", st->name, wb->len);
485
-
486
- rrdset_unlock(st);
487
- return last_timestamp;
488
-}
src/rrd2json_api_old.h
deleted
-15
@@ -1,15 +0,0 @@
1
-// SPDX-License-Identifier: GPL-3.0+
2
-#ifndef NETDATA_RRD2JSON_API_OLD_H
3
-#define NETDATA_RRD2JSON_API_OLD_H
4
-
5
-extern unsigned long rrdset_info2json_api_old(RRDSET *st, char *options, BUFFER *wb);
6
-
7
-extern void rrd_graph2json_api_old(RRDSET *st, char *options, BUFFER *wb);
8
-
9
-extern void rrd_all2json_api_old(RRDHOST *host, BUFFER *wb);
10
-
11
-extern time_t rrdset2json_api_old(int type, RRDSET *st, BUFFER *wb, long entries_to_show, long group, int group_method
12
- , time_t after, time_t before, int only_non_zero);
13
-
14
-
15
-#endif //NETDATA_RRD2JSON_API_OLD_H
src/rrdcalc.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_HEALTH_INTERNALS
4
#include "common.h"
5
src/rrdcalctemplate.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_HEALTH_INTERNALS
4
#include "common.h"
5
src/rrddim.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_RRD_INTERNALS 1
4
#include "common.h"
5
src/rrddimvar.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_HEALTH_INTERNALS
4
#include "common.h"
5
src/rrdfamily.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_RRD_INTERNALS 1
4
#include "common.h"
5
src/rrdhost.c
+6
-5
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_RRD_INTERNALS 1
4
#include "common.h"
5
@@ -117,8 +118,8 @@ RRDHOST *rrdhost_create(const char *hostname,
118
int update_every,
119
long entries,
120
RRD_MEMORY_MODE memory_mode,
120
- int health_enabled,
121
- int rrdpush_enabled,
121
+ unsigned int health_enabled,
122
+ unsigned int rrdpush_enabled,
123
char *rrdpush_destination,
124
char *rrdpush_api_key,
125
int is_localhost
@@ -133,7 +134,7 @@ RRDHOST *rrdhost_create(const char *hostname,
134
host->rrd_history_entries = align_entries_to_pagesize(memory_mode, entries);
135
host->rrd_memory_mode = memory_mode;
136
host->health_enabled = (memory_mode == RRD_MEMORY_MODE_NONE)? 0 : health_enabled;
136
- host->rrdpush_send_enabled = (rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key);
137
+ host->rrdpush_send_enabled = (rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key) ? 1 : 0;
138
host->rrdpush_send_destination = (host->rrdpush_send_enabled)?strdupz(rrdpush_destination):NULL;
139
host->rrdpush_send_api_key = (host->rrdpush_send_enabled)?strdupz(rrdpush_api_key):NULL;
140
@@ -324,8 +325,8 @@ RRDHOST *rrdhost_find_or_create(
325
, int update_every
326
, long history
327
, RRD_MEMORY_MODE mode
327
- , int health_enabled
328
- , int rrdpush_enabled
328
+ , unsigned int health_enabled
329
+ , unsigned int rrdpush_enabled
330
, char *rrdpush_destination
331
, char *rrdpush_api_key
332
) {
src/rrdpush.c
+5
-4
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
/*
@@ -31,12 +32,12 @@ typedef enum {
32
RRDPUSH_MULTIPLE_CONNECTIONS_DENY_NEW
33
} RRDPUSH_MULTIPLE_CONNECTIONS_STRATEGY;
34
34
-int default_rrdpush_enabled = 0;
35
+unsigned int default_rrdpush_enabled = 0;
36
char *default_rrdpush_destination = NULL;
37
char *default_rrdpush_api_key = NULL;
38
39
int rrdpush_init() {
39
- default_rrdpush_enabled = appconfig_get_boolean(&stream_config, CONFIG_SECTION_STREAM, "enabled", default_rrdpush_enabled);
40
+ default_rrdpush_enabled = (unsigned int)appconfig_get_boolean(&stream_config, CONFIG_SECTION_STREAM, "enabled", default_rrdpush_enabled);
41
default_rrdpush_destination = appconfig_get(&stream_config, CONFIG_SECTION_STREAM, "destination", "");
42
default_rrdpush_api_key = appconfig_get(&stream_config, CONFIG_SECTION_STREAM, "api key", "");
43
rrdhost_free_orphan_time = config_get_number(CONFIG_SECTION_GLOBAL, "cleanup orphan hosts after seconds", rrdhost_free_orphan_time);
@@ -798,8 +799,8 @@ static int rrdpush_receive(int fd
799
, update_every
800
, history
801
, mode
801
- , (health_enabled != CONFIG_BOOLEAN_NO)
802
- , (rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key)
802
+ , (unsigned int)(health_enabled != CONFIG_BOOLEAN_NO)
803
+ , (unsigned int)(rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key)
804
, rrdpush_destination
805
, rrdpush_api_key
806
);
src/rrdpush.h
+3
-2
@@ -1,8 +1,9 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_RRDPUSH_H
3
-#define NETDATA_RRDPUSH_H
4
+#define NETDATA_RRDPUSH_H 1
5
5
-extern int default_rrdpush_enabled;
6
+extern unsigned int default_rrdpush_enabled;
7
extern char *default_rrdpush_destination;
8
extern char *default_rrdpush_api_key;
9
extern unsigned int remote_clock_resync_iterations;
src/rrdset.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_RRD_INTERNALS 1
4
#include "common.h"
5
src/rrdsetvar.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_HEALTH_INTERNALS
4
#include "common.h"
5
src/rrdvar.c
+3
-2
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#define NETDATA_HEALTH_INTERNALS
4
#include "common.h"
5
@@ -126,7 +127,7 @@ void rrdvar_free_remaining_variables(RRDHOST *host, avl_tree_lock *tree_lock) {
127
// ----------------------------------------------------------------------------
128
// CUSTOM HOST VARIABLES
129
129
-inline int rrdvar_callback_for_all_host_variables(RRDHOST *host, int (*callback)(void *rrdvar, void *data), void *data) {
130
+inline int rrdvar_callback_for_all_host_variables(RRDHOST *host, int (*callback)(void * /*rrdvar*/, void * /*data*/), void *data) {
131
return avl_traverse_lock(&host->rrdvar_root_index, callback, data);
132
}
133
@@ -172,7 +173,7 @@ void rrdvar_custom_host_variable_set(RRDHOST *host, RRDVAR *rv, calculated_numbe
173
}
174
}
175
175
-int foreach_host_variable_callback(RRDHOST *host, int (*callback)(RRDVAR *rv, void *data), void *data) {
176
+int foreach_host_variable_callback(RRDHOST *host, int (*callback)(RRDVAR * /*rv*/, void * /*data*/), void *data) {
177
return avl_traverse_lock(&host->rrdvar_root_index, (int (*)(void *, void *))callback, data);
178
}
179
src/signals.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
typedef enum signal_action {
src/signals.h
+2
-1
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_SIGNALS_H
3
-#define NETDATA_SIGNALS_H
4
+#define NETDATA_SIGNALS_H 1
5
6
extern void signals_init(void);
7
extern void signals_block(void);
src/simple_pattern.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
struct simple_pattern {
src/simple_pattern.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_SIMPLE_PATTERN_H
4
#define NETDATA_SIMPLE_PATTERN_H
5
src/socket.c
+26
-21
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// --------------------------------------------------------------------------------------------------------------------
@@ -46,12 +47,14 @@ int sock_setreuse(int fd, int reuse) {
47
}
48
49
int sock_setreuse_port(int fd, int reuse) {
49
- int ret = -1;
50
+ int ret;
51
52
#ifdef SO_REUSEPORT
53
ret = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &reuse, sizeof(reuse));
54
if(ret == -1 && errno != ENOPROTOOPT)
55
error("failed to set SO_REUSEPORT on socket %d", fd);
56
+#else
57
+ ret = -1;
58
#endif
59
60
return ret;
@@ -81,7 +84,7 @@ int sock_enlarge_out(int fd) {
84
85
// --------------------------------------------------------------------------------------------------------------------
86
84
-char *strdup_client_description(int family, const char *protocol, const char *ip, int port) {
87
+char *strdup_client_description(int family, const char *protocol, const char *ip, uint16_t port) {
88
char buffer[100 + 1];
89
90
switch(family) {
@@ -149,7 +152,7 @@ int create_listen_socket_unix(const char *path, int listen_backlog) {
152
return sock;
153
}
154
152
-int create_listen_socket4(int socktype, const char *ip, int port, int listen_backlog) {
155
+int create_listen_socket4(int socktype, const char *ip, uint16_t port, int listen_backlog) {
156
int sock;
157
158
debug(D_LISTENER, "LISTENER: IPv4 creating new listening socket on ip '%s' port %d, socktype %d", ip, port, socktype);
@@ -245,7 +248,7 @@ int create_listen_socket6(int socktype, uint32_t scope_id, const char *ip, int p
248
return sock;
249
}
250
248
-static inline int listen_sockets_add(LISTEN_SOCKETS *sockets, int fd, int family, int socktype, const char *protocol, const char *ip, int port) {
251
+static inline int listen_sockets_add(LISTEN_SOCKETS *sockets, int fd, int family, int socktype, const char *protocol, const char *ip, uint16_t port) {
252
if(sockets->opened >= MAX_LISTEN_FDS) {
253
error("LISTENER: Too many listening sockets. Failed to add listening %s socket at ip '%s' port %d, protocol %s, socktype %d", protocol, ip, port, protocol, socktype);
254
close(fd);
@@ -297,7 +300,7 @@ void listen_sockets_close(LISTEN_SOCKETS *sockets) {
300
sockets->failed = 0;
301
}
302
300
-static inline int bind_to_this(LISTEN_SOCKETS *sockets, const char *definition, int default_port, int listen_backlog) {
303
+static inline int bind_to_this(LISTEN_SOCKETS *sockets, const char *definition, uint16_t default_port, int listen_backlog) {
304
int added = 0;
305
struct addrinfo hints;
306
struct addrinfo *result = NULL, *rp = NULL;
@@ -397,10 +400,10 @@ static inline int bind_to_this(LISTEN_SOCKETS *sockets, const char *definition,
400
401
for (rp = result; rp != NULL; rp = rp->ai_next) {
402
int fd = -1;
400
- int family = -1;
403
+ int family;
404
405
char rip[INET_ADDRSTRLEN + INET6_ADDRSTRLEN] = "INVALID";
403
- int rport = default_port;
406
+ uint16_t rport = default_port;
407
408
family = rp->ai_addr->sa_family;
409
switch (family) {
@@ -447,12 +450,14 @@ int listen_sockets_setup(LISTEN_SOCKETS *sockets) {
450
451
sockets->backlog = (int) config_get_number(sockets->config_section, "listen backlog", sockets->backlog);
452
450
- int old_port = sockets->default_port;
451
- sockets->default_port = (int) config_get_number(sockets->config_section, "default port", sockets->default_port);
452
- if(sockets->default_port < 1 || sockets->default_port > 65535) {
453
- error("LISTENER: Invalid listen port %d given. Defaulting to %d.", sockets->default_port, old_port);
454
- sockets->default_port = (int) config_set_number(sockets->config_section, "default port", old_port);
453
+ long long int old_port = sockets->default_port;
454
+ long long int new_port = config_get_number(sockets->config_section, "default port", sockets->default_port);
455
+ if(new_port < 1 || new_port > 65535) {
456
+ error("LISTENER: Invalid listen port %lld given. Defaulting to %lld.", new_port, old_port);
457
+ sockets->default_port = (uint16_t) config_set_number(sockets->config_section, "default port", old_port);
458
}
459
+ else sockets->default_port = (uint16_t)new_port;
460
+
461
debug(D_OPTIONS, "LISTENER: Default listen port set to %d.", sockets->default_port);
462
463
char *s = config_get(sockets->config_section, "bind to", sockets->default_bind_to);
@@ -969,10 +974,10 @@ inline POLLINFO *poll_add_fd(POLLJOB *p
974
, uint32_t flags
975
, const char *client_ip
976
, const char *client_port
972
- , void *(*add_callback)(POLLINFO *pi, short int *events, void *data)
973
- , void (*del_callback)(POLLINFO *pi)
974
- , int (*rcv_callback)(POLLINFO *pi, short int *events)
975
- , int (*snd_callback)(POLLINFO *pi, short int *events)
977
+ , void *(*add_callback)(POLLINFO * /*pi*/, short int * /*events*/, void * /*data*/)
978
+ , void (*del_callback)(POLLINFO * /*pi*/)
979
+ , int (*rcv_callback)(POLLINFO * /*pi*/, short int * /*events*/)
980
+ , int (*snd_callback)(POLLINFO * /*pi*/, short int * /*events*/)
981
, void *data
982
) {
983
debug(D_POLLFD, "POLLFD: ADD: request to add fd %d, slots = %zu, used = %zu, min = %zu, max = %zu, next free = %zd", fd, p->slots, p->used, p->min, p->max, p->first_free?(ssize_t)p->first_free->slot:(ssize_t)-1);
@@ -1350,11 +1355,11 @@ static void poll_events_process(POLLJOB *p, POLLINFO *pi, struct pollfd *pf, sho
1355
}
1356
1357
void poll_events(LISTEN_SOCKETS *sockets
1353
- , void *(*add_callback)(POLLINFO *pi, short int *events, void *data)
1354
- , void (*del_callback)(POLLINFO *pi)
1355
- , int (*rcv_callback)(POLLINFO *pi, short int *events)
1356
- , int (*snd_callback)(POLLINFO *pi, short int *events)
1357
- , void (*tmr_callback)(void *timer_data)
1358
+ , void *(*add_callback)(POLLINFO * /*pi*/, short int * /*events*/, void * /*data*/)
1359
+ , void (*del_callback)(POLLINFO * /*pi*/)
1360
+ , int (*rcv_callback)(POLLINFO * /*pi*/, short int * /*events*/)
1361
+ , int (*snd_callback)(POLLINFO * /*pi*/, short int * /*events*/)
1362
+ , void (*tmr_callback)(void * /*timer_data*/)
1363
, SIMPLE_PATTERN *access_list
1364
, void *data
1365
, time_t tcp_request_timeout_seconds
src/socket.h
+3
-2
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_SOCKET_H
4
#define NETDATA_SOCKET_H
5
@@ -9,7 +10,7 @@
10
typedef struct listen_sockets {
11
const char *config_section; // the netdata configuration section to read settings from
12
const char *default_bind_to; // the default bind to configuration string
12
- int default_port; // the default port to use
13
+ uint16_t default_port; // the default port to use
14
int backlog; // the default listen backlog to use
15
16
size_t opened; // the number of sockets opened
@@ -20,7 +21,7 @@ typedef struct listen_sockets {
21
int fds_families[MAX_LISTEN_FDS]; // the family of the open sockets (AF_UNIX, AF_INET, AF_INET6)
22
} LISTEN_SOCKETS;
23
23
-extern char *strdup_client_description(int family, const char *protocol, const char *ip, int port);
24
+extern char *strdup_client_description(int family, const char *protocol, const char *ip, uint16_t port);
25
26
extern int listen_sockets_setup(LISTEN_SOCKETS *sockets);
27
extern void listen_sockets_close(LISTEN_SOCKETS *sockets);
src/statistical.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// --------------------------------------------------------------------------------------------------------------------
src/statistical.h
+2
-1
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_STATISTICAL_H
3
-#define NETDATA_STATISTICAL_H
4
+#define NETDATA_STATISTICAL_H 1
5
6
extern LONG_DOUBLE average(const LONG_DOUBLE *series, size_t entries);
7
extern LONG_DOUBLE moving_average(const LONG_DOUBLE *series, size_t entries, size_t period);
src/statsd.c
+5
-4
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define STATSD_CHART_PREFIX "statsd"
@@ -262,13 +263,13 @@ static struct statsd {
263
SIMPLE_PATTERN *charts_for;
264
265
size_t tcp_idle_timeout;
265
- size_t decimal_detail;
266
+ collected_number decimal_detail;
267
size_t private_charts;
268
size_t max_private_charts;
269
size_t max_private_charts_hard;
270
RRD_MEMORY_MODE private_charts_memory_mode;
271
long private_charts_rrd_history_entries;
271
- int private_charts_hidden;
272
+ unsigned int private_charts_hidden:1;
273
274
STATSD_APP *apps;
275
size_t recvmmsg_size;
@@ -2186,9 +2187,9 @@ void *statsd_main(void *ptr) {
2187
statsd.max_private_charts_hard = (size_t)config_get_number(CONFIG_SECTION_STATSD, "max private charts hard limit", (long long)statsd.max_private_charts * 5);
2188
statsd.private_charts_memory_mode = rrd_memory_mode_id(config_get(CONFIG_SECTION_STATSD, "private charts memory mode", rrd_memory_mode_name(default_rrd_memory_mode)));
2189
statsd.private_charts_rrd_history_entries = (int)config_get_number(CONFIG_SECTION_STATSD, "private charts history", default_rrd_history_entries);
2189
- statsd.decimal_detail = (size_t)config_get_number(CONFIG_SECTION_STATSD, "decimal detail", (long long int)statsd.decimal_detail);
2190
+ statsd.decimal_detail = (collected_number)config_get_number(CONFIG_SECTION_STATSD, "decimal detail", (long long int)statsd.decimal_detail);
2191
statsd.tcp_idle_timeout = (size_t) config_get_number(CONFIG_SECTION_STATSD, "disconnect idle tcp clients after seconds", (long long int)statsd.tcp_idle_timeout);
2191
- statsd.private_charts_hidden = (int)config_get_boolean(CONFIG_SECTION_STATSD, "private charts hidden", statsd.private_charts_hidden);
2192
+ statsd.private_charts_hidden = (unsigned int)config_get_boolean(CONFIG_SECTION_STATSD, "private charts hidden", statsd.private_charts_hidden);
2193
2194
statsd.histogram_percentile = (double)config_get_float(CONFIG_SECTION_STATSD, "histograms and timers percentile (percentThreshold)", statsd.histogram_percentile);
2195
if(isless(statsd.histogram_percentile, 0) || isgreater(statsd.histogram_percentile, 100)) {
src/statsd.h
+2
-1
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_STATSD_H
3
-#define NETDATA_STATSD_H
4
+#define NETDATA_STATSD_H 1
5
6
#define STATSD_LISTEN_PORT 8125
7
#define STATSD_LISTEN_BACKLOG 4096
src/storage_number.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
storage_number pack_storage_number(calculated_number value, uint32_t flags)
src/storage_number.h
+2
-1
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_STORAGE_NUMBER_H
3
-#define NETDATA_STORAGE_NUMBER_H
4
+#define NETDATA_STORAGE_NUMBER_H 1
5
6
#ifdef NETDATA_WITHOUT_LONG_DOUBLE
7
src/sys_devices_system_edac_mc.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
struct mc {
src/sys_devices_system_node.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
struct node {
src/sys_fs_btrfs.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
typedef struct btrfs_disk {
src/sys_fs_cgroup.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// ----------------------------------------------------------------------------
src/sys_kernel_mm_ksm.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
typedef struct ksm_name_value {
src/threads.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
static size_t default_stacksize = 0, wanted_stacksize = 0;
src/threads.h
+2
-1
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_THREADS_H
3
-#define NETDATA_THREADS_H
4
+#define NETDATA_THREADS_H 1
5
6
extern pid_t gettid(void);
7
src/unit_test.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
static int check_number_printing(void) {
src/unit_test.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_UNIT_TEST_H
4
#define NETDATA_UNIT_TEST_H 1
5
src/url.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// ----------------------------------------------------------------------------
src/url.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_URL_H
4
#define NETDATA_URL_H 1
5
src/web_api_old.c
deleted
-238
@@ -1,238 +0,0 @@
1
-// SPDX-License-Identifier: GPL-3.0+
2
-#include "common.h"
3
-
4
-int web_client_api_old_data_request(RRDHOST *host, struct web_client *w, char *url, int datasource_type) {
5
- if(!url || !*url) {
6
- buffer_flush(w->response.data);
7
- buffer_sprintf(w->response.data, "Incomplete request.");
8
- return 400;
9
- }
10
-
11
- RRDSET *st = NULL;
12
-
13
- char *args = strchr(url, '?');
14
- if(args) {
15
- *args='\0';
16
- args = &args[1];
17
- }
18
-
19
- // get the name of the data to show
20
- char *tok = mystrsep(&url, "/");
21
- if(!tok) tok = "";
22
-
23
- // do we have such a data set?
24
- if(*tok) {
25
- debug(D_WEB_CLIENT, "%llu: Searching for RRD data with name '%s'.", w->id, tok);
26
- st = rrdset_find_byname(host, tok);
27
- if(!st) st = rrdset_find(host, tok);
28
- }
29
-
30
- if(!st) {
31
- // we don't have it
32
- // try to send a file with that name
33
- buffer_flush(w->response.data);
34
- return(mysendfile(w, tok));
35
- }
36
-
37
- // we have it
38
- debug(D_WEB_CLIENT, "%llu: Found RRD data with name '%s'.", w->id, tok);
39
-
40
- // how many entries does the client want?
41
- int lines = (int)st->entries;
42
- int group_count = 1;
43
- time_t after = 0, before = 0;
44
- int group_method = GROUP_AVERAGE;
45
- int nonzero = 0;
46
-
47
- if(url) {
48
- // parse the lines required
49
- tok = mystrsep(&url, "/");
50
- if(tok) lines = str2i(tok);
51
- if(lines < 1) lines = 1;
52
- }
53
- if(url) {
54
- // parse the group count required
55
- tok = mystrsep(&url, "/");
56
- if(tok && *tok) group_count = str2i(tok);
57
- if(group_count < 1) group_count = 1;
58
- //if(group_count > save_history / 20) group_count = save_history / 20;
59
- }
60
- if(url) {
61
- // parse the grouping method required
62
- tok = mystrsep(&url, "/");
63
- if(tok && *tok) {
64
- if(strcmp(tok, "max") == 0) group_method = GROUP_MAX;
65
- else if(strcmp(tok, "average") == 0) group_method = GROUP_AVERAGE;
66
- else if(strcmp(tok, "sum") == 0) group_method = GROUP_SUM;
67
- else debug(D_WEB_CLIENT, "%llu: Unknown group method '%s'", w->id, tok);
68
- }
69
- }
70
- if(url) {
71
- // parse after time
72
- tok = mystrsep(&url, "/");
73
- if(tok && *tok) after = str2ul(tok);
74
- if(after < 0) after = 0;
75
- }
76
- if(url) {
77
- // parse before time
78
- tok = mystrsep(&url, "/");
79
- if(tok && *tok) before = str2ul(tok);
80
- if(before < 0) before = 0;
81
- }
82
- if(url) {
83
- // parse nonzero
84
- tok = mystrsep(&url, "/");
85
- if(tok && *tok && strcmp(tok, "nonzero") == 0) nonzero = 1;
86
- }
87
-
88
- w->response.data->contenttype = CT_APPLICATION_JSON;
89
- buffer_flush(w->response.data);
90
-
91
- char *google_version = "0.6";
92
- char *google_reqId = "0";
93
- char *google_sig = "0";
94
- char *google_out = "json";
95
- char *google_responseHandler = "google.visualization.Query.setResponse";
96
- char *google_outFileName = NULL;
97
- time_t last_timestamp_in_data = 0;
98
- if(datasource_type == DATASOURCE_DATATABLE_JSON || datasource_type == DATASOURCE_DATATABLE_JSONP) {
99
-
100
- w->response.data->contenttype = CT_APPLICATION_X_JAVASCRIPT;
101
-
102
- while(args) {
103
- tok = mystrsep(&args, "&");
104
- if(tok && *tok) {
105
- char *name = mystrsep(&tok, "=");
106
- if(name && *name && strcmp(name, "tqx") == 0) {
107
- char *key = mystrsep(&tok, ":");
108
- char *value = mystrsep(&tok, ";");
109
- if(key && value && *key && *value) {
110
- if(strcmp(key, "version") == 0)
111
- google_version = value;
112
-
113
- else if(strcmp(key, "reqId") == 0)
114
- google_reqId = value;
115
-
116
- else if(strcmp(key, "sig") == 0)
117
- google_sig = value;
118
-
119
- else if(strcmp(key, "out") == 0)
120
- google_out = value;
121
-
122
- else if(strcmp(key, "responseHandler") == 0)
123
- google_responseHandler = value;
124
-
125
- else if(strcmp(key, "outFileName") == 0)
126
- google_outFileName = value;
127
- }
128
- }
129
- }
130
- }
131
-
132
- debug(D_WEB_CLIENT_ACCESS, "%llu: GOOGLE JSONP: version = '%s', reqId = '%s', sig = '%s', out = '%s', responseHandler = '%s', outFileName = '%s'",
133
- w->id, google_version, google_reqId, google_sig, google_out, google_responseHandler, google_outFileName
134
- );
135
-
136
- if(datasource_type == DATASOURCE_DATATABLE_JSONP) {
137
- last_timestamp_in_data = strtoul(google_sig, NULL, 0);
138
-
139
- // check the client wants json
140
- if(strcmp(google_out, "json") != 0) {
141
- buffer_sprintf(w->response.data,
142
- "%s({version:'%s',reqId:'%s',status:'error',errors:[{reason:'invalid_query',message:'output format is not supported',detailed_message:'the format %s requested is not supported by netdata.'}]});",
143
- google_responseHandler, google_version, google_reqId, google_out);
144
- return 200;
145
- }
146
- }
147
- }
148
-
149
- if(datasource_type == DATASOURCE_DATATABLE_JSONP) {
150
- buffer_sprintf(w->response.data,
151
- "%s({version:'%s',reqId:'%s',status:'ok',sig:'%ld',table:",
152
- google_responseHandler, google_version, google_reqId, st->last_updated.tv_sec);
153
- }
154
-
155
- debug(D_WEB_CLIENT_ACCESS, "%llu: Sending RRD data '%s' (id %s, %d lines, %d group, %d group_method, %ld after, %ld before).",
156
- w->id, st->name, st->id, lines, group_count, group_method, after, before);
157
-
158
- time_t timestamp_in_data = rrdset2json_api_old(datasource_type, st, w->response.data, lines, group_count
159
- , group_method, (unsigned long) after, (unsigned long) before
160
- , nonzero);
161
-
162
- if(datasource_type == DATASOURCE_DATATABLE_JSONP) {
163
- if(timestamp_in_data > last_timestamp_in_data)
164
- buffer_strcat(w->response.data, "});");
165
-
166
- else {
167
- // the client already has the latest data
168
- buffer_flush(w->response.data);
169
- buffer_sprintf(w->response.data,
170
- "%s({version:'%s',reqId:'%s',status:'error',errors:[{reason:'not_modified',message:'Data not modified'}]});",
171
- google_responseHandler, google_version, google_reqId);
172
- }
173
- }
174
-
175
- return 200;
176
-}
177
-
178
-inline int web_client_api_old_data_request_json(RRDHOST *host, struct web_client *w, char *url) {
179
- return web_client_api_old_data_request(host, w, url, DATASOURCE_JSON);
180
-}
181
-
182
-inline int web_client_api_old_data_request_jsonp(RRDHOST *host, struct web_client *w, char *url) {
183
- return web_client_api_old_data_request(host, w, url, DATASOURCE_DATATABLE_JSONP);
184
-}
185
-
186
-inline int web_client_api_old_graph_request(RRDHOST *host, struct web_client *w, char *url) {
187
- // get the name of the data to show
188
- char *tok = mystrsep(&url, "/?&");
189
- if(tok && *tok) {
190
- debug(D_WEB_CLIENT, "%llu: Searching for RRD data with name '%s'.", w->id, tok);
191
-
192
- // do we have such a data set?
193
- RRDSET *st = rrdset_find_byname(host, tok);
194
- if(!st) st = rrdset_find(host, tok);
195
- if(!st) {
196
- // we don't have it
197
- // try to send a file with that name
198
- buffer_flush(w->response.data);
199
- return mysendfile(w, tok);
200
- }
201
- st->last_accessed_time = now_realtime_sec();
202
-
203
- debug(D_WEB_CLIENT_ACCESS, "%llu: Sending %s.json of RRD_STATS...", w->id, st->name);
204
- w->response.data->contenttype = CT_APPLICATION_JSON;
205
- buffer_flush(w->response.data);
206
- rrd_graph2json_api_old(st, url, w->response.data);
207
- return 200;
208
- }
209
-
210
- buffer_flush(w->response.data);
211
- buffer_strcat(w->response.data, "Graph name?\r\n");
212
- return 400;
213
-}
214
-
215
-inline int web_client_api_old_list_request(RRDHOST *host, struct web_client *w, char *url) {
216
- (void)url;
217
-
218
- buffer_flush(w->response.data);
219
- RRDSET *st;
220
-
221
- rrdhost_rdlock(host);
222
- rrdset_foreach_read(st, host) {
223
- if(rrdset_is_available_for_viewers(st))
224
- buffer_sprintf(w->response.data, "%s\n", st->name);
225
- }
226
- rrdhost_unlock(host);
227
-
228
- return 200;
229
-}
230
-
231
-inline int web_client_api_old_all_json(RRDHOST *host, struct web_client *w, char *url) {
232
- (void)url;
233
-
234
- w->response.data->contenttype = CT_APPLICATION_JSON;
235
- buffer_flush(w->response.data);
236
- rrd_all2json_api_old(host, w->response.data);
237
- return 200;
238
-}
src/web_api_old.h
deleted
-14
@@ -1,14 +0,0 @@
1
-// SPDX-License-Identifier: GPL-3.0+
2
-#ifndef NETDATA_WEB_API_OLD_H
3
-#define NETDATA_WEB_API_OLD_H
4
-
5
-#include "common.h"
6
-
7
-extern int web_client_api_old_data_request(RRDHOST *host, struct web_client *w, char *url, int datasource_type);
8
-extern int web_client_api_old_data_request_json(RRDHOST *host, struct web_client *w, char *url);
9
-extern int web_client_api_old_data_request_jsonp(RRDHOST *host, struct web_client *w, char *url);
10
-extern int web_client_api_old_graph_request(RRDHOST *host, struct web_client *w, char *url);
11
-extern int web_client_api_old_list_request(RRDHOST *host, struct web_client *w, char *url);
12
-extern int web_client_api_old_all_json(RRDHOST *host, struct web_client *w, char *url);
13
-
14
-#endif //NETDATA_WEB_API_OLD_H
src/web_api_v1.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
static struct {
src/web_api_v1.h
+2
-1
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_WEB_API_V1_H
3
-#define NETDATA_WEB_API_V1_H
4
+#define NETDATA_WEB_API_V1_H 1
5
6
extern int web_client_api_request_v1_data_group(char *name, int def);
7
extern uint32_t web_client_api_request_v1_data_options(char *o);
src/web_buffer.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define BUFFER_OVERFLOW_EOF "EOF"
src/web_buffer.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_WEB_BUFFER_H
4
#define NETDATA_WEB_BUFFER_H 1
5
src/web_buffer_svg.c
+2
-1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
#define BADGE_HORIZONTAL_PADDING 4
@@ -10,7 +11,7 @@
11
* https://github.com/badges/shields/blob/master/measure-text.js
12
*/
13
13
-double verdana11_widths[256] = {
14
+static double verdana11_widths[256] = {
15
[0] = 0.0,
16
[1] = 0.0,
17
[2] = 0.0,
src/web_buffer_svg.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_WEB_BUFFER_SVG_H
4
#define NETDATA_WEB_BUFFER_SVG_H 1
5
src/web_client.c
+2
-35
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// this is an async I/O implementation of the web server request parser
@@ -342,10 +343,6 @@ int mysendfile(struct web_client *w, char *filename) {
343
// skip leading slashes
344
while (*filename == '/') filename++;
345
345
- // if the filename contain known paths, skip them
346
- if(strncmp(filename, WEB_PATH_FILE "/", strlen(WEB_PATH_FILE) + 1) == 0)
347
- filename = &filename[strlen(WEB_PATH_FILE) + 1];
348
-
346
// if the filename contains "strange" characters, refuse to serve it
347
char *s;
348
for(s = filename; *s ;s++) {
@@ -416,7 +413,7 @@ int mysendfile(struct web_client *w, char *filename) {
413
if(errno == EBUSY || errno == EAGAIN) {
414
error("%llu: File '%s' is busy, sending 307 Moved Temporarily to force retry.", w->id, webfilename);
415
w->response.data->contenttype = CT_TEXT_HTML;
419
- buffer_sprintf(w->response.header, "Location: /" WEB_PATH_FILE "/%s\r\n", filename);
416
+ buffer_sprintf(w->response.header, "Location: /%s\r\n", filename);
417
buffer_strcat(w->response.data, "File is currently busy, please try again later: ");
418
buffer_strcat_htmlescape(w->response.data, webfilename);
419
return 307;
@@ -1127,11 +1124,6 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
1124
static uint32_t
1125
hash_api = 0,
1126
hash_netdata_conf = 0,
1130
- hash_data = 0,
1131
- hash_datasource = 0,
1132
- hash_graph = 0,
1133
- hash_list = 0,
1134
- hash_all_json = 0,
1127
hash_host = 0;
1128
1129
#ifdef NETDATA_INTERNAL_CHECKS
@@ -1141,11 +1133,6 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
1133
if(unlikely(!hash_api)) {
1134
hash_api = simple_hash("api");
1135
hash_netdata_conf = simple_hash("netdata.conf");
1144
- hash_data = simple_hash(WEB_PATH_DATA);
1145
- hash_datasource = simple_hash(WEB_PATH_DATASOURCE);
1146
- hash_graph = simple_hash(WEB_PATH_GRAPH);
1147
- hash_list = simple_hash("list");
1148
- hash_all_json = simple_hash("all.json");
1136
hash_host = simple_hash("host");
1137
#ifdef NETDATA_INTERNAL_CHECKS
1138
hash_exit = simple_hash("exit");
@@ -1167,26 +1154,6 @@ static inline int web_client_process_url(RRDHOST *host, struct web_client *w, ch
1154
debug(D_WEB_CLIENT_ACCESS, "%llu: host switch request ...", w->id);
1155
return web_client_switch_host(host, w, url);
1156
}
1170
- else if(unlikely(hash == hash_data && strcmp(tok, WEB_PATH_DATA) == 0)) { // old API "data"
1171
- debug(D_WEB_CLIENT_ACCESS, "%llu: old API data request...", w->id);
1172
- return check_host_and_dashboard_acl_and_call(host, w, url, web_client_api_old_data_request_json);
1173
- }
1174
- else if(unlikely(hash == hash_datasource && strcmp(tok, WEB_PATH_DATASOURCE) == 0)) { // old API "datasource"
1175
- debug(D_WEB_CLIENT_ACCESS, "%llu: old API datasource request...", w->id);
1176
- return check_host_and_dashboard_acl_and_call(host, w, url, web_client_api_old_data_request_jsonp);
1177
- }
1178
- else if(unlikely(hash == hash_graph && strcmp(tok, WEB_PATH_GRAPH) == 0)) { // old API "graph"
1179
- debug(D_WEB_CLIENT_ACCESS, "%llu: old API graph request...", w->id);
1180
- return check_host_and_dashboard_acl_and_call(host, w, url, web_client_api_old_graph_request);
1181
- }
1182
- else if(unlikely(hash == hash_list && strcmp(tok, "list") == 0)) { // old API "list"
1183
- debug(D_WEB_CLIENT_ACCESS, "%llu: old API list request...", w->id);
1184
- return check_host_and_dashboard_acl_and_call(host, w, url, web_client_api_old_list_request);
1185
- }
1186
- else if(unlikely(hash == hash_all_json && strcmp(tok, "all.json") == 0)) { // old API "all.json"
1187
- debug(D_WEB_CLIENT_ACCESS, "%llu: old API all.json request...", w->id);
1188
- return check_host_and_dashboard_acl_and_call(host, w, url, web_client_api_old_all_json);
1189
- }
1157
else if(unlikely(hash == hash_netdata_conf && strcmp(tok, "netdata.conf") == 0)) { // netdata.conf
1158
if(unlikely(!web_client_can_access_netdataconf(w)))
1159
return web_client_permission_denied(w);
src/web_client.h
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_WEB_CLIENT_H
4
#define NETDATA_WEB_CLIENT_H 1
5
src/web_server.c
+5
-2
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
5
// this file includes 3 web servers:
@@ -579,7 +580,8 @@ static void web_client_multi_threaded_web_server_release_clients(void) {
580
static void web_client_multi_threaded_web_server_stop_all_threads(void) {
581
struct web_client *w;
582
582
- int found = 1, max = 2 * USEC_PER_SEC, step = 50000;
583
+ int found = 1;
584
+ usec_t max = 2 * USEC_PER_SEC, step = 50000;
585
for(w = web_clients_cache.used; w ; w = w->next) {
586
if(w->running) {
587
found++;
@@ -1217,7 +1219,8 @@ static void socket_listen_main_static_threaded_cleanup(void *ptr) {
1219
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
1220
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
1221
1220
- int i, found = 0, max = 2 * USEC_PER_SEC, step = 50000;
1222
+ int i, found = 0;
1223
+ usec_t max = 2 * USEC_PER_SEC, step = 50000;
1224
1225
// we start from 1, - 0 is self
1226
for(i = 1; i < static_threaded_workers_count; i++) {
src/web_server.h
+1
-5
@@ -1,12 +1,8 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_WEB_SERVER_H
4
#define NETDATA_WEB_SERVER_H 1
5
5
-#define WEB_PATH_FILE "file"
6
-#define WEB_PATH_DATA "data"
7
-#define WEB_PATH_DATASOURCE "datasource"
8
-#define WEB_PATH_GRAPH "graph"
9
-
6
#ifndef API_LISTEN_PORT
7
#define API_LISTEN_PORT 19999
8
#endif
src/zfs_common.c
+1
@@ -1,4 +1,5 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#include "common.h"
4
#include "zfs_common.h"
5
src/zfs_common.h
+2
-1
@@ -1,6 +1,7 @@
1
// SPDX-License-Identifier: GPL-3.0+
2
+
3
#ifndef NETDATA_ZFS_COMMON_H
3
-#define NETDATA_ZFS_COMMON_H
4
+#define NETDATA_ZFS_COMMON_H 1
5
6
#define ZFS_FAMILY_SIZE "size"
7
#define ZFS_FAMILY_EFFICIENCY "efficiency"