X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fswap.c;h=f9debc1b595a4e405bc3b11fad25716b2db2245c;hb=10075e6fe3c384b73c2dd398a1435f8d10e56654;hp=4a414b70d21805890fa3abdc38f9cfa059224311;hpb=97deb523823b1f04880d584a19bc2b0e7e10d96a;p=collectd.git diff --git a/src/swap.c b/src/swap.c index 4a414b70..f9debc1b 100644 --- a/src/swap.c +++ b/src/swap.c @@ -36,6 +36,10 @@ # include #endif +#if HAVE_STATGRAB_H +# include +#endif + #undef MAX #define MAX(x,y) ((x) > (y) ? (x) : (y)) @@ -120,11 +124,12 @@ static void swap_submit (const char *type_instance, double value) vl.values = values; vl.values_len = 1; vl.time = time (NULL); - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "swap"); - strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "swap", sizeof (vl.plugin)); + sstrncpy (vl.type, "swap", sizeof (vl.type)); + sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); - plugin_dispatch_values ("swap", &vl); + plugin_dispatch_values (&vl); } /* void swap_submit */ static int swap_read (void) @@ -232,7 +237,7 @@ static int swap_read (void) swap_submit ("used", swap_alloc); swap_submit ("free", swap_avail); - swap_submit ("reserved", swap_resv - swap_alloc); + swap_submit ("reserved", swap_resv); /* #endif HAVE_LIBKSTAT */ #elif defined(VM_SWAPUSAGE)