X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fcollectd-tg.c;h=2d83bbfe1b9c5e8412007bd12ec50f8e8ee1cefa;hp=d8b2ea19d29bbe2b7e945e4c6f83c036e1b6c34e;hb=7f07c55bac640c7a50d516248a3152235a14af59;hpb=47c86ace348a1d7a5352a83d10935209f89aa4f5 diff --git a/src/collectd-tg.c b/src/collectd-tg.c index d8b2ea19..2d83bbfe 100644 --- a/src/collectd-tg.c +++ b/src/collectd-tg.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -44,8 +45,8 @@ #include "utils_heap.h" -#include "libcollectdclient/collectd/client.h" -#include "libcollectdclient/collectd/network.h" +#include "collectd/client.h" +#include "collectd/network.h" #define DEF_NUM_HOSTS 1000 #define DEF_NUM_PLUGINS 20 @@ -61,12 +62,12 @@ static const char *conf_service = NET_DEFAULT_PORT; static lcc_network_t *net; -static c_heap_t *values_heap = NULL; +static c_heap_t *values_heap; static struct sigaction sigint_action; static struct sigaction sigterm_action; -static _Bool loop = 1; +static bool loop = true; __attribute__((noreturn)) static void exit_usage(int exit_status) /* {{{ */ { @@ -94,9 +95,9 @@ __attribute__((noreturn)) static void exit_usage(int exit_status) /* {{{ */ exit(exit_status); } /* }}} void exit_usage */ -static void signal_handler(int signal) /* {{{ */ +static void signal_handler(int __attribute__((unused)) signal) /* {{{ */ { - loop = 0; + loop = false; } /* }}} void signal_handler */ #if HAVE_CLOCK_GETTIME @@ -104,7 +105,7 @@ static double dtime(void) /* {{{ */ { struct timespec ts = {0}; - if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) + if (clock_gettime(CLOCK_REALTIME, &ts) != 0) perror("clock_gettime"); return (double)ts.tv_sec + (double)ts.tv_nsec / 1e9; @@ -146,7 +147,8 @@ static int get_boundet_random(int min, int max) /* {{{ */ range = max - min; - return min + ((int)(((double)range) * ((double)random()) / (((double)RAND_MAX) + 1.0))); + return min + ((int)(((double)range) * ((double)random()) / + (((double)RAND_MAX) + 1.0))); } /* }}} int get_boundet_random */ static lcc_value_list_t *create_value_list(void) /* {{{ */