cmake missing defines (#16680)
* added HAVE_ACCEPT4 * added HAVE_FINITE, HAVE_ISFINITE * added SIZEOF_VOID_P * added HAVE_NICE, HAVE_RECVMMSG, HAVE_GETPRIORITY * added HAVE_C__GENERIC * added HAVE_C_MALLOPT * added HAVE_BACKTRACE, HAVE_CLOSE_RANGE, HAVE_SCHED_GETSCHEDULER, HAVE_SCHED_SETSCHEDULER, HAVE_SCHED_GET_PRIORITY_MIN, HAVE_SCHED_GET_PRIORITY_MAX * added HAVE_DLSYM * added function attributes checks * fix SIZEOF_VOID_P * added HAVE_PTHREAD_GETNAME_NP * fixed compiler warnings
Costa Tsaousis committed
Dec 28, 2023 at 23:20 UTC
40c6c14dab8f85201cddf27b1ac6a02b88e1fafa
18 files changed
+256
-102
CMakeLists.txt
+126
-6
@@ -65,6 +65,8 @@ set(CMAKE_CXX_STANDARD 11)
65
set(CMAKE_C_STANDARD_REQUIRED On)
66
set(CMAKE_CXX_STANDARD_REQUIRED On)
67
68
+set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
69
+
70
if(NOT CMAKE_BUILD_TYPE)
71
set(CMAKE_BUILD_TYPE "Release")
72
endif()
@@ -184,11 +186,25 @@ check_library_exists(snappy snappy_compress "" HAVE_SNAPPY_LIB)
186
#
187
188
include(CheckSymbolExists)
187
-check_symbol_exists(major sys/sysmacros.h MAJOR_IN_SYSMACROS)
188
-check_symbol_exists(major sys/mkdev.h MAJOR_IN_MKDEV)
189
-check_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME)
190
-check_symbol_exists(clock_gettime time.h HAVE_CLOCK_GETTIME)
191
-check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
189
+check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS)
190
+check_symbol_exists(major "sys/mkdev.h" MAJOR_IN_MKDEV)
191
+check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
192
+check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R)
193
+check_symbol_exists(finite "math.h" HAVE_FINITE)
194
+check_symbol_exists(isfinite "math.h" HAVE_ISFINITE)
195
+check_symbol_exists(dlsym "dlfcn.h" HAVE_DLSYM)
196
+
197
+check_function_exists(nice HAVE_NICE)
198
+check_function_exists(recvmmsg HAVE_RECVMMSG)
199
+check_function_exists(getpriority HAVE_GETPRIORITY)
200
+
201
+check_function_exists(sched_getscheduler HAVE_SCHED_GETSCHEDULER)
202
+check_function_exists(sched_setscheduler HAVE_SCHED_SETSCHEDULER)
203
+check_function_exists(sched_get_priority_min HAVE_SCHED_GET_PRIORITY_MIN)
204
+check_function_exists(sched_get_priority_max HAVE_SCHED_GET_PRIORITY_MAX)
205
+
206
+check_function_exists(close_range HAVE_CLOSE_RANGE)
207
+check_function_exists(backtrace HAVE_BACKTRACE)
208
209
#
210
# check source compilation
@@ -197,6 +213,45 @@ check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
213
include(CheckCSourceCompiles)
214
include(CheckCXXSourceCompiles)
215
216
+set(CMAKE_REQUIRED_LIBRARIES pthread)
217
+check_c_source_compiles("
218
+#define _GNU_SOURCE
219
+#include <pthread.h>
220
+int main() {
221
+ char name[16];
222
+ pthread_t thread = pthread_self();
223
+ return pthread_getname_np(thread, name, sizeof(name));
224
+}
225
+" HAVE_PTHREAD_GETNAME_NP)
226
+
227
+check_c_source_compiles("
228
+#include <stdio.h>
229
+#define mytype(X) _Generic((X), int: 'i', float: 'f', default: 'u')
230
+int main() {
231
+ char type = mytype(0);
232
+ return 0;
233
+}
234
+" HAVE_C__GENERIC)
235
+
236
+check_c_source_compiles("
237
+#include <malloc.h>
238
+int main() {
239
+ mallopt(M_ARENA_MAX, 1);
240
+ mallopt(M_PERTURB, 0x5A);
241
+ return 0;
242
+}
243
+" HAVE_C_MALLOPT)
244
+
245
+check_c_source_compiles("
246
+#define _GNU_SOURCE
247
+#include <stdio.h>
248
+#include <sys/socket.h>
249
+int main() {
250
+ accept4(0, NULL, NULL, 0);
251
+ return 0;
252
+}
253
+" HAVE_ACCEPT4)
254
+
255
check_c_source_compiles("
256
#define _GNU_SOURCE
257
#include <string.h>
@@ -222,11 +277,76 @@ int main() {
277
}
278
" HAVE_BUILTIN_ATOMICS)
279
280
+check_c_source_compiles("
281
+void my_printf(char const *s, ...) __attribute__((format(printf, 1, 2)));
282
+int main() { return 0; }
283
+" HAVE_FUNC_ATTRIBUTE_FORMAT)
284
+
285
+check_c_source_compiles("
286
+#include <stdio.h>
287
+#include <stdlib.h>
288
+#include <unistd.h>
289
+void* my_alloc(size_t size) __attribute__((malloc));
290
+int main() {
291
+ void *x = my_alloc(1);
292
+ free(x);
293
+ return 0;
294
+}
295
+void* my_alloc(size_t size) {
296
+ void *ret = malloc(size);
297
+ if(!ret) exit(1);
298
+ return ret;
299
+}
300
+" HAVE_FUNC_ATTRIBUTE_MALLOC)
301
+
302
+check_c_source_compiles("
303
+void my_function() __attribute__((noinline));
304
+int main() { my_function(); return 0; }
305
+void my_function() { ; }
306
+" HAVE_FUNC_ATTRIBUTE_NOINLINE)
307
+
308
+check_c_source_compiles("
309
+void my_exit_function() __attribute__((noreturn));
310
+int main() {
311
+ my_exit_function(); // Call the noreturn function
312
+ return 0;
313
+}
314
+void my_exit_function() {
315
+ exit(1);
316
+}
317
+" HAVE_FUNC_ATTRIBUTE_NORETURN)
318
+
319
+check_c_source_compiles("
320
+#include <stdio.h>
321
+#include <stdlib.h>
322
+#include <unistd.h>
323
+void* my_alloc(size_t size) __attribute__((returns_nonnull));
324
+int main() {
325
+ void* ptr = my_alloc(10);
326
+ free(ptr);
327
+ return 0;
328
+}
329
+void* my_alloc(size_t size) {
330
+ void *ret = malloc(size);
331
+ if(!ret) exit(1);
332
+ return ret;
333
+}
334
+" HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL)
335
+
336
+check_c_source_compiles("
337
+int my_function() __attribute__((warn_unused_result));
338
+int main() {
339
+ return my_function();
340
+}
341
+int my_function() {
342
+ return 1;
343
+}
344
+" HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT)
345
+
346
if(FREEBSD OR MACOS)
347
set(HAVE_BUILTIN_ATOMICS True)
348
endif()
349
229
-
350
# openssl/crypto
351
set(ENABLE_OPENSSL True)
352
if(NOT MACOS)
aclk/aclk_stats.c
+2
@@ -1,6 +1,8 @@
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
3
+#ifndef MQTT_WSS_CPUSTATS
4
#define MQTT_WSS_CPUSTATS
5
+#endif
6
7
#include "aclk_stats.h"
8
collectors/cgroups.plugin/cgroup-top.c
+1
-1
@@ -101,7 +101,7 @@ int cgroup_function_cgroup_top(uuid_t *transaction __maybe_unused, BUFFER *wb,
101
usec_t *stop_monotonic_ut __maybe_unused, const char *function __maybe_unused,
102
void *collector_data __maybe_unused,
103
rrd_function_result_callback_t result_cb, void *result_cb_data,
104
- rrd_function_progress_cb_t progress_cb, void *progress_cb_data,
104
+ rrd_function_progress_cb_t progress_cb __maybe_unused, void *progress_cb_data __maybe_unused,
105
rrd_function_is_cancelled_cb_t is_cancelled_cb, void *is_cancelled_cb_data,
106
rrd_function_register_canceller_cb_t register_canceller_cb __maybe_unused,
107
void *register_canceller_cb_data __maybe_unused,
collectors/proc.plugin/proc_spl_kstat_zfs.c
+1
-1
@@ -6,7 +6,7 @@
6
#define ZFS_PROC_ARCSTATS "/proc/spl/kstat/zfs/arcstats"
7
#define ZFS_PROC_POOLS "/proc/spl/kstat/zfs"
8
9
-#define STATE_SIZE 9
9
+#define STATE_SIZE 20
10
#define MAX_CHART_ID 256
11
12
extern struct arcstats arcstats;
collectors/systemd-journal.plugin/systemd-journal-annotations.c
+5
-5
@@ -712,8 +712,8 @@ void netdata_systemd_journal_transform_message_id(FACETS *facets __maybe_unused,
712
713
// ----------------------------------------------------------------------------
714
715
-static void netdata_systemd_journal_rich_message(FACETS *facets __maybe_unused, BUFFER *json_array, FACET_ROW_KEY_VALUE *rkv, FACET_ROW *row __maybe_unused, void *data __maybe_unused) {
716
- buffer_json_add_array_item_object(json_array);
717
- buffer_json_member_add_string(json_array, "value", buffer_tostring(rkv->wb));
718
- buffer_json_object_close(json_array);
719
-}
715
+//static void netdata_systemd_journal_rich_message(FACETS *facets __maybe_unused, BUFFER *json_array, FACET_ROW_KEY_VALUE *rkv, FACET_ROW *row __maybe_unused, void *data __maybe_unused) {
716
+// buffer_json_add_array_item_object(json_array);
717
+// buffer_json_member_add_string(json_array, "value", buffer_tostring(rkv->wb));
718
+// buffer_json_object_close(json_array);
719
+//}
collectors/systemd-journal.plugin/systemd-journal-files.c
+70
-70
@@ -39,74 +39,74 @@ static bool journal_sd_id128_parse(const char *in, sd_id128_t *ret) {
39
return false;
40
}
41
42
-static void journal_file_get_header_from_journalctl(const char *filename, struct journal_file *jf) {
43
- // unfortunately, our capabilities are not inheritted by journalctl
44
- // so, it fails to give us the information we need.
45
-
46
- bool read_writer = false, read_head = false, read_tail = false;
47
-
48
- char cmd[FILENAME_MAX * 2];
49
- snprintfz(cmd, sizeof(cmd), "journalctl --header --file '%s'", filename);
50
- CLEAN_BUFFER *wb = run_command_and_get_output_to_buffer(cmd, 1024);
51
- if(wb) {
52
- const char *s = buffer_tostring(wb);
53
-
54
- const char *sequential_id_header = "Sequential Number ID:";
55
- const char *sequential_id_data = strcasestr(s, sequential_id_header);
56
- if(sequential_id_data) {
57
- sequential_id_data += strlen(sequential_id_header);
58
- if(journal_sd_id128_parse(sequential_id_data, &jf->first_writer_id))
59
- read_writer = true;
60
- }
61
-
62
- const char *head_sequential_number_header = "Head sequential number:";
63
- const char *head_sequential_number_data = strcasestr(s, head_sequential_number_header);
64
- if(head_sequential_number_data) {
65
- head_sequential_number_data += strlen(head_sequential_number_header);
66
-
67
- while(isspace(*head_sequential_number_data))
68
- head_sequential_number_data++;
69
-
70
- if(isdigit(*head_sequential_number_data)) {
71
- jf->first_seqnum = strtoul(head_sequential_number_data, NULL, 10);
72
- if(jf->first_seqnum)
73
- read_head = true;
74
- }
75
- }
76
-
77
- const char *tail_sequential_number_header = "Tail sequential number:";
78
- const char *tail_sequential_number_data = strcasestr(s, tail_sequential_number_header);
79
- if(tail_sequential_number_data) {
80
- tail_sequential_number_data += strlen(tail_sequential_number_header);
81
-
82
- while(isspace(*tail_sequential_number_data))
83
- tail_sequential_number_data++;
84
-
85
- if(isdigit(*tail_sequential_number_data)) {
86
- jf->last_seqnum = strtoul(tail_sequential_number_data, NULL, 10);
87
- if(jf->last_seqnum)
88
- read_tail = true;
89
- }
90
- }
91
-
92
- if(read_head && read_tail && jf->last_seqnum > jf->first_seqnum)
93
- jf->messages_in_file = jf->last_seqnum - jf->first_seqnum;
94
- }
95
-
96
- if(!jf->logged_journalctl_failure && (!read_head || !read_tail)) {
97
-
98
- nd_log(NDLS_COLLECTORS, NDLP_NOTICE,
99
- "Failed to read %s%s%s from journalctl's output on filename '%s', using the command: %s",
100
- read_writer?"":"writer id,",
101
- read_head?"":"head id,",
102
- read_tail?"":"tail id,",
103
- filename, cmd);
104
-
105
- jf->logged_journalctl_failure = true;
106
- }
107
-}
108
-
109
-usec_t journal_file_update_annotation_boot_id(sd_journal *j, struct journal_file *jf, const char *boot_id) {
42
+//static void journal_file_get_header_from_journalctl(const char *filename, struct journal_file *jf) {
43
+// // unfortunately, our capabilities are not inheritted by journalctl
44
+// // so, it fails to give us the information we need.
45
+//
46
+// bool read_writer = false, read_head = false, read_tail = false;
47
+//
48
+// char cmd[FILENAME_MAX * 2];
49
+// snprintfz(cmd, sizeof(cmd), "journalctl --header --file '%s'", filename);
50
+// CLEAN_BUFFER *wb = run_command_and_get_output_to_buffer(cmd, 1024);
51
+// if(wb) {
52
+// const char *s = buffer_tostring(wb);
53
+//
54
+// const char *sequential_id_header = "Sequential Number ID:";
55
+// const char *sequential_id_data = strcasestr(s, sequential_id_header);
56
+// if(sequential_id_data) {
57
+// sequential_id_data += strlen(sequential_id_header);
58
+// if(journal_sd_id128_parse(sequential_id_data, &jf->first_writer_id))
59
+// read_writer = true;
60
+// }
61
+//
62
+// const char *head_sequential_number_header = "Head sequential number:";
63
+// const char *head_sequential_number_data = strcasestr(s, head_sequential_number_header);
64
+// if(head_sequential_number_data) {
65
+// head_sequential_number_data += strlen(head_sequential_number_header);
66
+//
67
+// while(isspace(*head_sequential_number_data))
68
+// head_sequential_number_data++;
69
+//
70
+// if(isdigit(*head_sequential_number_data)) {
71
+// jf->first_seqnum = strtoul(head_sequential_number_data, NULL, 10);
72
+// if(jf->first_seqnum)
73
+// read_head = true;
74
+// }
75
+// }
76
+//
77
+// const char *tail_sequential_number_header = "Tail sequential number:";
78
+// const char *tail_sequential_number_data = strcasestr(s, tail_sequential_number_header);
79
+// if(tail_sequential_number_data) {
80
+// tail_sequential_number_data += strlen(tail_sequential_number_header);
81
+//
82
+// while(isspace(*tail_sequential_number_data))
83
+// tail_sequential_number_data++;
84
+//
85
+// if(isdigit(*tail_sequential_number_data)) {
86
+// jf->last_seqnum = strtoul(tail_sequential_number_data, NULL, 10);
87
+// if(jf->last_seqnum)
88
+// read_tail = true;
89
+// }
90
+// }
91
+//
92
+// if(read_head && read_tail && jf->last_seqnum > jf->first_seqnum)
93
+// jf->messages_in_file = jf->last_seqnum - jf->first_seqnum;
94
+// }
95
+//
96
+// if(!jf->logged_journalctl_failure && (!read_head || !read_tail)) {
97
+//
98
+// nd_log(NDLS_COLLECTORS, NDLP_NOTICE,
99
+// "Failed to read %s%s%s from journalctl's output on filename '%s', using the command: %s",
100
+// read_writer?"":"writer id,",
101
+// read_head?"":"head id,",
102
+// read_tail?"":"tail id,",
103
+// filename, cmd);
104
+//
105
+// jf->logged_journalctl_failure = true;
106
+// }
107
+//}
108
+
109
+usec_t journal_file_update_annotation_boot_id(sd_journal *j, struct journal_file *jf __maybe_unused, const char *boot_id) {
110
usec_t ut = UINT64_MAX;
111
int r;
112
@@ -447,7 +447,7 @@ static void files_registry_insert_cb(const DICTIONARY_ITEM *item, void *value, v
447
jf->filename);
448
}
449
450
-static bool files_registry_conflict_cb(const DICTIONARY_ITEM *item, void *old_value, void *new_value, void *data __maybe_unused) {
450
+static bool files_registry_conflict_cb(const DICTIONARY_ITEM *item __maybe_unused, void *old_value, void *new_value, void *data __maybe_unused) {
451
struct journal_file *jf = old_value;
452
struct journal_file *njf = new_value;
453
@@ -801,7 +801,7 @@ int journal_file_dict_items_forward_compar(const void *a, const void *b) {
801
return -journal_file_dict_items_backward_compar(a, b);
802
}
803
804
-static bool boot_id_conflict_cb(const DICTIONARY_ITEM *item, void *old_value, void *new_value, void *data __maybe_unused) {
804
+static bool boot_id_conflict_cb(const DICTIONARY_ITEM *item __maybe_unused, void *old_value, void *new_value, void *data __maybe_unused) {
805
usec_t *old_usec = old_value;
806
usec_t *new_usec = new_value;
807
collectors/systemd-journal.plugin/systemd-journal.c
+3
-5
@@ -518,12 +518,12 @@ static size_t sampling_running_file_query_estimate_remaining_lines_by_time(FUNCT
518
return remaining_logs_by_time;
519
}
520
521
-static size_t sampling_running_file_query_estimate_remaining_lines(sd_journal *j, FUNCTION_QUERY_STATUS *fqs, struct journal_file *jf, FACETS_ANCHOR_DIRECTION direction, usec_t msg_ut) {
522
- size_t expected_matching_logs_by_seqnum = 0;
523
- double proportion_by_seqnum = 0.0;
521
+static size_t sampling_running_file_query_estimate_remaining_lines(sd_journal *j __maybe_unused, FUNCTION_QUERY_STATUS *fqs, struct journal_file *jf, FACETS_ANCHOR_DIRECTION direction, usec_t msg_ut) {
522
size_t remaining_logs_by_seqnum = 0;
523
524
#ifdef HAVE_SD_JOURNAL_GET_SEQNUM
525
+ size_t expected_matching_logs_by_seqnum = 0;
526
+ double proportion_by_seqnum = 0.0;
527
uint64_t current_msg_seqnum;
528
sd_id128_t current_msg_writer;
529
if(!fqs->query_file.first_msg_seqnum || sd_journal_get_seqnum(j, ¤t_msg_seqnum, ¤t_msg_writer) < 0) {
@@ -1533,7 +1533,6 @@ void function_systemd_journal(const char *transaction, char *function, usec_t *s
1533
.stop_monotonic_ut = stop_monotonic_ut,
1534
};
1535
FUNCTION_QUERY_STATUS *fqs = NULL;
1536
- const DICTIONARY_ITEM *fqs_item = NULL;
1536
1537
FACETS *facets = facets_create(50, FACETS_OPTION_ALL_KEYS_FTS,
1538
SYSTEMD_ALWAYS_VISIBLE_KEYS,
@@ -1855,7 +1854,6 @@ void function_systemd_journal(const char *transaction, char *function, usec_t *s
1854
// put this request into the progress db
1855
1856
fqs = &tmp_fqs;
1858
- fqs_item = NULL;
1857
1858
// ------------------------------------------------------------------------
1859
// validate parameters
config.cmake.h.in
+28
-1
@@ -6,6 +6,8 @@
6
#define __always_unused __attribute__((unused))
7
#define __maybe_unused __attribute__((unused))
8
9
+#cmakedefine SIZEOF_VOID_P ${SIZEOF_VOID_P}
10
+
11
// platform
12
#cmakedefine COMPILED_FOR_FREEBSD
13
#cmakedefine COMPILED_FOR_LINUX
@@ -38,7 +40,19 @@
40
#cmakedefine MAJOR_IN_MKDEV
41
#cmakedefine HAVE_CLOCK_GETTIME
42
#cmakedefine HAVE_STRERROR_R
41
-#cmakedefine HAVE_SETNS
43
+#cmakedefine HAVE_FINITE
44
+#cmakedefine HAVE_ISFINITE
45
+#cmakedefine HAVE_RECVMMSG
46
+#cmakedefine HAVE_NICE
47
+#cmakedefine HAVE_GETPRIORITY
48
+#cmakedefine HAVE_DLSYM
49
+
50
+#cmakedefine HAVE_BACKTRACE
51
+#cmakedefine HAVE_CLOSE_RANGE
52
+#cmakedefine HAVE_SCHED_GETSCHEDULER
53
+#cmakedefine HAVE_SCHED_SETSCHEDULER
54
+#cmakedefine HAVE_SCHED_GET_PRIORITY_MIN
55
+#cmakedefine HAVE_SCHED_GET_PRIORITY_MAX
56
57
#cmakedefine HAVE_SYSTEMD
58
#cmakedefine HAVE_SD_JOURNAL_OS_ROOT
@@ -48,7 +62,20 @@
62
#cmakedefine ENABLE_SYSTEMD_DBUS
63
64
// checked source compilation
65
+
66
+#cmakedefine HAVE_PTHREAD_GETNAME_NP
67
+#cmakedefine HAVE_ACCEPT4
68
#cmakedefine STRERROR_R_CHAR_P
69
+#cmakedefine HAVE_C__GENERIC
70
+#cmakedefine HAVE_C_MALLOPT
71
+#cmakedefine HAVE_SETNS
72
+
73
+#cmakedefine HAVE_FUNC_ATTRIBUTE_FORMAT
74
+#cmakedefine HAVE_FUNC_ATTRIBUTE_MALLOC
75
+#cmakedefine HAVE_FUNC_ATTRIBUTE_NOINLINE
76
+#cmakedefine HAVE_FUNC_ATTRIBUTE_NORETURN
77
+#cmakedefine HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
78
+#cmakedefine HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT
79
80
// enabled features
81
database/engine/page.c
+3
-2
@@ -612,7 +612,7 @@ void pgdc_reset(PGDC *pgdc, PGD *pgd, uint32_t position)
612
pgdc_seek(pgdc, position);
613
}
614
615
-bool pgdc_get_next_point(PGDC *pgdc, uint32_t expected_position, STORAGE_POINT *sp)
615
+bool pgdc_get_next_point(PGDC *pgdc, uint32_t expected_position __maybe_unused, STORAGE_POINT *sp)
616
{
617
if (!pgdc->pgd || pgdc->pgd == PGD_EMPTY || pgdc->position >= pgdc->slots)
618
{
@@ -668,7 +668,8 @@ bool pgdc_get_next_point(PGDC *pgdc, uint32_t expected_position, STORAGE_POINT *
668
static bool logged = false;
669
if (!logged)
670
{
671
- netdata_log_error("DBENGINE: unknown page type %d found. Cannot decode it. Ignoring its metrics.", pgd_type(pgdc->pgd));
671
+ netdata_log_error("DBENGINE: unknown page type %"PRIu32" found. Cannot decode it. Ignoring its metrics.",
672
+ pgd_type(pgdc->pgd));
673
logged = true;
674
}
675
database/rrddim.c
+1
-1
@@ -362,7 +362,7 @@ RRDDIM *rrddim_find_active(RRDSET *st, const char *id) {
362
// ----------------------------------------------------------------------------
363
// RRDDIM rename a dimension
364
365
-inline int rrddim_reset_name(RRDSET *st, RRDDIM *rd, const char *name) {
365
+inline int rrddim_reset_name(RRDSET *st __maybe_unused, RRDDIM *rd, const char *name) {
366
if(unlikely(!name || !*name || !strcmp(rrddim_name(rd), name)))
367
return 0;
368
database/rrdfunctions.c
+1
-1
@@ -1098,7 +1098,7 @@ int rrdhost_function_streaming(uuid_t *transaction __maybe_unused, BUFFER *wb,
1098
buffer_json_member_add_string(wb, "help", RRDFUNCTIONS_STREAMING_HELP);
1099
buffer_json_member_add_array(wb, "data");
1100
1101
- size_t max_sent_bytes_on_this_connection_per_type[STREAM_TRAFFIC_TYPE_MAX];
1101
+ size_t max_sent_bytes_on_this_connection_per_type[STREAM_TRAFFIC_TYPE_MAX] = { 0 };
1102
size_t max_db_metrics = 0, max_db_instances = 0, max_db_contexts = 0;
1103
size_t max_collection_replication_instances = 0, max_streaming_replication_instances = 0;
1104
size_t max_ml_anomalous = 0, max_ml_normal = 0, max_ml_trained = 0, max_ml_pending = 0, max_ml_silenced = 0;
libnetdata/datetime/rfc3339.c
+1
-1
@@ -27,7 +27,7 @@ size_t rfc3339_datetime_ut(char *buffer, size_t len, usec_t now_ut, size_t fract
27
return 0;
28
}
29
30
- if (fractional_digits >= 0 && fractional_digits <= 9) {
30
+ if (fractional_digits >= 1 && fractional_digits <= 9) {
31
int fractional_part = (int)(now_ut % USEC_PER_SEC);
32
if (fractional_part && len - used_length > fractional_digits + 1) {
33
char format[] = ".%01d";
libnetdata/libnetdata.h
+4
@@ -28,6 +28,10 @@ extern "C" {
28
#define NETDATA_INTERNAL_CHECKS 1
29
#endif
30
31
+#ifndef SIZEOF_VOID_P
32
+#error SIZEOF_VOID_P is not defined
33
+#endif
34
+
35
#if SIZEOF_VOID_P == 4
36
#define ENV32BIT 1
37
#else
libnetdata/log/log.c
+3
-2
@@ -2112,7 +2112,7 @@ static void nd_logger(const char *file, const char *function, const unsigned lon
2112
else if(thread_log_fields[NDF_LOG_SOURCE].entry.type == NDFT_U64)
2113
src = thread_log_fields[NDF_LOG_SOURCE].entry.u64;
2114
2115
- if(src != source && src >= 0 && src < _NDLS_MAX) {
2115
+ if(src != source && src < _NDLS_MAX) {
2116
source = src;
2117
output = nd_logger_select_output(source, &fp, &spinlock);
2118
if(output != NDLM_FILE && output != NDLM_JOURNAL && output != NDLM_SYSLOG)
@@ -2396,7 +2396,8 @@ static bool nd_log_limit_reached(struct nd_log_source *source) {
2396
source->limits.logs_per_period,
2397
source->limits.throttle_period,
2398
program_name,
2399
- (int64_t)((source->limits.started_monotonic_ut + (source->limits.throttle_period * USEC_PER_SEC) - now_ut)) / USEC_PER_SEC);
2399
+ (int64_t)(((source->limits.started_monotonic_ut + (source->limits.throttle_period * USEC_PER_SEC) - now_ut)) / USEC_PER_SEC)
2400
+ );
2401
2402
if(source->pending_msg)
2403
freez((void *)source->pending_msg);
libnetdata/log/systemd-cat-native.c
+4
-4
@@ -11,7 +11,7 @@
11
#include <machine/endian.h>
12
#endif
13
14
-static void log_message_to_stderr(BUFFER *msg) {
14
+static inline void log_message_to_stderr(BUFFER *msg) {
15
CLEAN_BUFFER *tmp = buffer_create(0, NULL);
16
17
for(size_t i = 0; i < msg->len ;i++) {
@@ -594,7 +594,7 @@ static int log_input_as_netdata(const char *newline, int timeout_ms) {
594
// an empty line - we are done for this message
595
596
nd_log(NDLS_HEALTH, priority,
597
- "added %d fields", // if the user supplied a MESSAGE, this will be ignored
597
+ "added %zu fields", // if the user supplied a MESSAGE, this will be ignored
598
fields_added);
599
600
lgs_reset(lgs);
@@ -627,7 +627,7 @@ static int log_input_as_netdata(const char *newline, int timeout_ms) {
627
628
nd_log(NDLS_COLLECTORS, NDLP_ERR,
629
"Field '%.*s' is not a Netdata field. Ignoring it.",
630
- field_len, field);
630
+ (int)field_len, field);
631
632
lgs[NDF_MESSAGE] = backup;
633
}
@@ -648,7 +648,7 @@ static int log_input_as_netdata(const char *newline, int timeout_ms) {
648
}
649
650
if(fields_added) {
651
- nd_log(NDLS_HEALTH, priority, "added %d fields", fields_added);
651
+ nd_log(NDLS_HEALTH, priority, "added %zu fields", fields_added);
652
messages_logged++;
653
}
654
libnetdata/query_progress/progress.c
+1
@@ -636,6 +636,7 @@ int progress_unittest(void) {
636
for(size_t i = 0; i < permanent ;i++) {
637
qp = query_progress_find_in_hashtable_unsafe(&valid[i]);
638
assert(qp);
639
+ (void)qp;
640
}
641
}
642
libnetdata/simple_hashtable.h
+1
-1
@@ -251,7 +251,7 @@ static void simple_hashtable_init_named(SIMPLE_HASHTABLE_NAMED *ht, size_t size)
251
ht->hashtable = callocz(ht->size, sizeof(*ht->hashtable));
252
}
253
254
-static void simple_hashtable_destroy_named(SIMPLE_HASHTABLE_NAMED *ht) {
254
+static inline void simple_hashtable_destroy_named(SIMPLE_HASHTABLE_NAMED *ht) {
255
#ifdef SIMPLE_HASHTABLE_SORT_FUNCTION
256
freez(ht->sorted.array);
257
#endif
web/api/formatters/rrdset2json.c
+1
-1
@@ -2,7 +2,7 @@
2
3
#include "rrdset2json.h"
4
5
-static int process_label_callback(const char *name, const char *value, RRDLABEL_SRC ls, void *data) {
5
+static int process_label_callback(const char *name, const char *value, RRDLABEL_SRC ls __maybe_unused, void *data) {
6
BUFFER *wb = data;
7
buffer_json_member_add_string_or_empty(wb, name, value);
8
return 1;