X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fusers.c;h=768d48818fb1c7e17835860270fe02a282e15a56;hb=21c84cec32921e6de8feaa5496f337496379ea23;hp=1ae128e14ca6119b30e3cb881642c28a0e226a43;hpb=2079ee1517e34de372f58e7e2267ad5c71a8a41f;p=collectd.git diff --git a/src/users.c b/src/users.c index 1ae128e1..768d4881 100644 --- a/src/users.c +++ b/src/users.c @@ -27,8 +27,8 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #if HAVE_STATGRAB_H #include @@ -44,14 +44,10 @@ #endif static void users_submit(gauge_t value) { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - values[0].gauge = value; - - vl.values = values; + vl.values = &(value_t){.gauge = value}; vl.values_len = 1; - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, "users", sizeof(vl.plugin)); sstrncpy(vl.type, "users", sizeof(vl.plugin)); @@ -75,7 +71,7 @@ static int users_read(void) { endutxent(); users_submit(users); -/* #endif HAVE_GETUTXENT */ + /* #endif HAVE_GETUTXENT */ #elif HAVE_GETUTENT unsigned int users = 0; @@ -93,7 +89,7 @@ static int users_read(void) { endutent(); users_submit(users); -/* #endif HAVE_GETUTENT */ + /* #endif HAVE_GETUTENT */ #elif HAVE_LIBSTATGRAB sg_user_stats *us; @@ -105,7 +101,7 @@ static int users_read(void) { us = sg_get_user_stats(); #endif if (us == NULL) - return (-1); + return -1; users_submit((gauge_t) #if HAVE_LIBSTATGRAB_0_90 @@ -113,13 +109,13 @@ static int users_read(void) { #else us->num_entries); #endif -/* #endif HAVE_LIBSTATGRAB */ + /* #endif HAVE_LIBSTATGRAB */ #else #error "No applicable input method." #endif - return (0); + return 0; } /* int users_read */ void module_register(void) {