@cryptotaxi247 / netdata-1 / commits / 24282e490

fix compilation warnings (#16001)

Costa Tsaousis committed Sep 18, 2023 at 20:10 UTC 24282e490a7af2012ff0a995cb1e7b0244826aed
12 files changed +31 -28
collectors/apps.plugin/apps_plugin.c
+8 -8
@@ -2460,7 +2460,7 @@ static inline int debug_print_process_and_parents(struct pid_stat *p, usec_t tim
2460 for(i = 0; i < indent ;i++) buffer[i] = ' ';
2461 buffer[i] = '\0';
2462
2463 - fprintf(stderr, " %s %s%s (%d %s %llu"
2463 + fprintf(stderr, " %s %s%s (%d %s %"PRIu64""
2464 , buffer
2465 , prefix
2466 , p->comm
@@ -3432,7 +3432,7 @@ static void calculate_netdata_statistics(void) {
3432 // update chart dimensions
3433
3434 static inline void send_BEGIN(const char *type, const char *id, usec_t usec) {
3435 - fprintf(stdout, "BEGIN %s.%s %llu\n", type, id, usec);
3435 + fprintf(stdout, "BEGIN %s.%s %"PRIu64"\n", type, id, usec);
3436 }
3437
3438 static inline void send_SET(const char *name, kernel_uint_t value) {
@@ -3518,11 +3518,11 @@ void send_resource_usage_to_netdata(usec_t dt) {
3518 }
3519
3520 fprintf(stdout,
3521 - "BEGIN netdata.apps_cpu %llu\n"
3522 - "SET user = %llu\n"
3523 - "SET system = %llu\n"
3521 + "BEGIN netdata.apps_cpu %"PRIu64"\n"
3522 + "SET user = %"PRIu64"\n"
3523 + "SET system = %"PRIu64"\n"
3524 "END\n"
3525 - "BEGIN netdata.apps_sizes %llu\n"
3525 + "BEGIN netdata.apps_sizes %"PRIu64"\n"
3526 "SET calls = %zu\n"
3527 "SET files = %zu\n"
3528 "SET filenames = %zu\n"
@@ -3549,7 +3549,7 @@ void send_resource_usage_to_netdata(usec_t dt) {
3549 );
3550
3551 fprintf(stdout,
3552 - "BEGIN netdata.apps_fix %llu\n"
3552 + "BEGIN netdata.apps_fix %"PRIu64"\n"
3553 "SET utime = %u\n"
3554 "SET stime = %u\n"
3555 "SET gtime = %u\n"
@@ -3566,7 +3566,7 @@ void send_resource_usage_to_netdata(usec_t dt) {
3566
3567 if(include_exited_childs)
3568 fprintf(stdout,
3569 - "BEGIN netdata.apps_children_fix %llu\n"
3569 + "BEGIN netdata.apps_children_fix %"PRIu64"\n"
3570 "SET cutime = %u\n"
3571 "SET cstime = %u\n"
3572 "SET cgtime = %u\n"
collectors/perf.plugin/perf_plugin.c
+1 -1
@@ -1328,7 +1328,7 @@ int main(int argc, char **argv) {
1328 if(unlikely(netdata_exit)) break;
1329
1330 if(unlikely(debug && iteration))
1331 - fprintf(stderr, "perf.plugin: iteration %zu, dt %llu usec\n"
1331 + fprintf(stderr, "perf.plugin: iteration %zu, dt %"PRIu64" usec\n"
1332 , iteration
1333 , dt
1334 );
database/engine/metric.c
+1 -1
@@ -923,7 +923,7 @@ int mrg_unittest(void) {
923 netdata_log_info("DBENGINE METRIC: did %zu additions, %zu duplicate additions, "
924 "%zu deletions, %zu wrong deletions, "
925 "%zu successful searches, %zu wrong searches, "
926 - "in %llu usecs",
926 + "in %"PRIu64" usecs",
927 stats.additions, stats.additions_duplicate,
928 stats.deletions, stats.delete_misses,
929 stats.search_hits, stats.search_misses,
database/rrdfunctions.c
+5 -2
@@ -757,7 +757,9 @@ struct rrd_function_call_wait {
757 int code;
758 };
759
760 -static void rrd_inflight_function_cleanup(RRDHOST *host, const DICTIONARY_ITEM *host_function_acquired, const char *transaction) {
760 +static void rrd_inflight_function_cleanup(RRDHOST *host __maybe_unused,
761 + const DICTIONARY_ITEM *host_function_acquired __maybe_unused,
762 + const char *transaction) {
763 dictionary_del(rrd_functions_inflight_requests, transaction);
764 dictionary_garbage_collect(rrd_functions_inflight_requests);
765 }
@@ -1176,7 +1178,8 @@ int rrdhost_function_streaming(BUFFER *wb, int timeout __maybe_unused, const cha
1178 void *collector_data __maybe_unused,
1179 rrd_function_result_callback_t result_cb, void *result_cb_data,
1180 rrd_function_is_cancelled_cb_t is_cancelled_cb, void *is_cancelled_cb_data,
1179 - rrd_function_register_canceller_cb_t register_cancel_cb, void *register_cancel_db_data) {
1181 + rrd_function_register_canceller_cb_t register_canceller_cb __maybe_unused,
1182 + void *register_canceller_cb_data __maybe_unused) {
1183
1184 time_t now = now_realtime_sec();
1185
database/rrdfunctions.h
+1 -1
@@ -50,7 +50,7 @@ int rrd_call_function_error(BUFFER *wb, const char *msg, int code);
50 int rrdhost_function_streaming(BUFFER *wb, int timeout, const char *function, void *collector_data,
51 rrd_function_result_callback_t result_cb, void *result_cb_data,
52 rrd_function_is_cancelled_cb_t is_cancelled_cb, void *is_cancelled_cb_data,
53 - rrd_function_register_canceller_cb_t register_cancel_cb, void *register_cancel_db_data);
53 + rrd_function_register_canceller_cb_t register_canceller_cb, void *register_canceller_cb_data);
54
55 #define RRDFUNCTIONS_STREAMING_HELP "Streaming status for parents and children."
56
exporting/prometheus/prometheus.c
+1 -1
@@ -522,7 +522,7 @@ static void generate_as_collected_prom_metric(BUFFER *wb,
522 buffer_sprintf(wb, COLLECTED_NUMBER_FORMAT, p->rd->collector.last_collected_value);
523
524 if (p->output_options & PROMETHEUS_OUTPUT_TIMESTAMPS)
525 - buffer_sprintf(wb, " %llu\n", timeval_msec(&p->rd->collector.last_collected_time));
525 + buffer_sprintf(wb, " %"PRIu64"\n", timeval_msec(&p->rd->collector.last_collected_time));
526 else
527 buffer_sprintf(wb, "\n");
528 }
libnetdata/aral/aral.c
+1 -1
@@ -1057,7 +1057,7 @@ int aral_stress_test(size_t threads, size_t elements, size_t seconds) {
1057 }
1058
1059 netdata_log_info("ARAL: did %zu malloc, %zu free, "
1060 - "using %zu threads, in %llu usecs",
1060 + "using %zu threads, in %"PRIu64" usecs",
1061 auc.ar->aral_lock.user_malloc_operations,
1062 auc.ar->aral_lock.user_free_operations,
1063 threads,
libnetdata/clocks/clocks.c
+4 -4
@@ -299,7 +299,7 @@ usec_t heartbeat_next(heartbeat_t *hb, usec_t tick) {
299 usec_t tmp = (now_realtime_usec() * clock_realtime_resolution) % (tick / 2);
300
301 error_limit_static_global_var(erl, 10, 0);
302 - error_limit(&erl, "heartbeat randomness of %llu is too big for a tick of %llu - setting it to %llu", hb->randomness, tick, tmp);
302 + error_limit(&erl, "heartbeat randomness of %"PRIu64" is too big for a tick of %"PRIu64" - setting it to %"PRIu64"", hb->randomness, tick, tmp);
303 hb->randomness = tmp;
304 }
305
@@ -326,12 +326,12 @@ usec_t heartbeat_next(heartbeat_t *hb, usec_t tick) {
326 if(unlikely(now < next)) {
327 errno = 0;
328 error_limit_static_global_var(erl, 10, 0);
329 - error_limit(&erl, "heartbeat clock: woke up %llu microseconds earlier than expected (can be due to the CLOCK_REALTIME set to the past).", next - now);
329 + error_limit(&erl, "heartbeat clock: woke up %"PRIu64" microseconds earlier than expected (can be due to the CLOCK_REALTIME set to the past).", next - now);
330 }
331 else if(unlikely(now - next > tick / 2)) {
332 errno = 0;
333 error_limit_static_global_var(erl, 10, 0);
334 - error_limit(&erl, "heartbeat clock: woke up %llu microseconds later than expected (can be due to system load or the CLOCK_REALTIME set to the future).", now - next);
334 + error_limit(&erl, "heartbeat clock: woke up %"PRIu64" microseconds later than expected (can be due to system load or the CLOCK_REALTIME set to the future).", now - next);
335 }
336
337 if(unlikely(!hb->realtime)) {
@@ -381,7 +381,7 @@ void sleep_usec_with_now(usec_t usec, usec_t started_ut) {
381 }
382 }
383 else {
384 - netdata_log_error("Cannot nanosleep() for %llu microseconds.", usec);
384 + netdata_log_error("Cannot nanosleep() for %"PRIu64" microseconds.", usec);
385 break;
386 }
387 }
libnetdata/dictionary/dictionary.c
+1 -1
@@ -2877,7 +2877,7 @@ static usec_t dictionary_unittest_run_and_measure_time(DICTIONARY *dict, char *m
2877 }
2878 }
2879
2880 - fprintf(stderr, " %zu errors, %d (found %ld) items in dictionary, %d (found %ld) referenced, %d (found %ld) deleted, %llu usec \n",
2880 + fprintf(stderr, " %zu errors, %d (found %ld) items in dictionary, %d (found %ld) referenced, %d (found %ld) deleted, %"PRIu64" usec \n",
2881 errs, dict?dict->entries:0, found_ok, dict?dict->referenced_items:0, found_referenced, dict?dict->pending_deletion_items:0, found_deleted, dt);
2882 *errors += errs;
2883 return dt;
libnetdata/facets/facets.c
+1 -1
@@ -1762,7 +1762,7 @@ void facets_report(FACETS *facets, BUFFER *wb) {
1762
1763 buffer_json_member_add_array(wb, "data");
1764 {
1765 - usec_t last_usec = 0;
1765 + usec_t last_usec = 0; (void)last_usec;
1766
1767 for(FACET_ROW *row = facets->base ; row ;row = row->next) {
1768
libnetdata/log/log.c
+1 -1
@@ -890,7 +890,7 @@ void error_limit_int(ERROR_LIMIT *erl, const char *prefix, const char *file __ma
890 erl->count, (unsigned long long)(erl->last_logged ? now - erl->last_logged : 0));
891
892 if(erl->sleep_ut)
893 - fprintf(fp, " (sleeping for %llu microseconds every time this happens)", erl->sleep_ut);
893 + fprintf(fp, " (sleeping for %"PRIu64" microseconds every time this happens)", erl->sleep_ut);
894
895 if(__errno) {
896 char buf[1024];
libnetdata/string/string.c
+6 -6
@@ -533,42 +533,42 @@ int string_unittest(size_t entries) {
533 strings[i] = string_strdupz(names[i]);
534 }
535 end_ut = now_realtime_usec();
536 - fprintf(stderr, "Created %zu strings in %llu usecs\n", entries, end_ut - start_ut);
536 + fprintf(stderr, "Created %zu strings in %"PRIu64" usecs\n", entries, end_ut - start_ut);
537
538 start_ut = now_realtime_usec();
539 for(size_t i = 0; i < entries ;i++) {
540 strings[i] = string_dup(strings[i]);
541 }
542 end_ut = now_realtime_usec();
543 - fprintf(stderr, "Cloned %zu strings in %llu usecs\n", entries, end_ut - start_ut);
543 + fprintf(stderr, "Cloned %zu strings in %"PRIu64" usecs\n", entries, end_ut - start_ut);
544
545 start_ut = now_realtime_usec();
546 for(size_t i = 0; i < entries ;i++) {
547 strings[i] = string_strdupz(string2str(strings[i]));
548 }
549 end_ut = now_realtime_usec();
550 - fprintf(stderr, "Found %zu existing strings in %llu usecs\n", entries, end_ut - start_ut);
550 + fprintf(stderr, "Found %zu existing strings in %"PRIu64" usecs\n", entries, end_ut - start_ut);
551
552 start_ut = now_realtime_usec();
553 for(size_t i = 0; i < entries ;i++) {
554 string_freez(strings[i]);
555 }
556 end_ut = now_realtime_usec();
557 - fprintf(stderr, "Released %zu referenced strings in %llu usecs\n", entries, end_ut - start_ut);
557 + fprintf(stderr, "Released %zu referenced strings in %"PRIu64" usecs\n", entries, end_ut - start_ut);
558
559 start_ut = now_realtime_usec();
560 for(size_t i = 0; i < entries ;i++) {
561 string_freez(strings[i]);
562 }
563 end_ut = now_realtime_usec();
564 - fprintf(stderr, "Released (again) %zu referenced strings in %llu usecs\n", entries, end_ut - start_ut);
564 + fprintf(stderr, "Released (again) %zu referenced strings in %"PRIu64" usecs\n", entries, end_ut - start_ut);
565
566 start_ut = now_realtime_usec();
567 for(size_t i = 0; i < entries ;i++) {
568 string_freez(strings[i]);
569 }
570 end_ut = now_realtime_usec();
571 - fprintf(stderr, "Freed %zu strings in %llu usecs\n", entries, end_ut - start_ut);
571 + fprintf(stderr, "Freed %zu strings in %"PRIu64" usecs\n", entries, end_ut - start_ut);
572
573 freez(strings);
574