X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fpf.c;h=ecaa869c0658c6a549899288ce18c2e05566b953;hb=e1fda36ff7e4b5f508b630b614b182e298d91fb7;hp=112e28f3554dee66efb5dd5dcd3fb15843ad4e85;hpb=3d7453f6c3a13dc49e9ed6dd6d7a19202a3b087e;p=collectd.git diff --git a/src/pf.c b/src/pf.c index 112e28f3..ecaa869c 100644 --- a/src/pf.c +++ b/src/pf.c @@ -20,15 +20,13 @@ */ #include "collectd.h" + #include "plugin.h" #include "common.h" #if HAVE_SYS_IOCTL_H # include #endif -#if HAVE_SYS_SOCKET_H -# include -#endif #if HAVE_NET_IF_H # include #endif @@ -72,7 +70,6 @@ static void pf_submit (char const *type, char const *type_instance, vl.values = values; vl.values_len = 1; - sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "pf", sizeof (vl.plugin)); sstrncpy (vl.type, type, sizeof(vl.type)); sstrncpy (vl.type_instance, type_instance, sizeof(vl.type_instance)); @@ -85,7 +82,6 @@ static int pf_read (void) struct pf_status state; int fd; int status; - int i; fd = open (pf_device, O_RDONLY); if (fd < 0) @@ -97,7 +93,6 @@ static int pf_read (void) return (-1); } - memset (&state, 0, sizeof (state)); status = ioctl (fd, DIOCGETSTATUS, &state); if (status != 0) { @@ -109,7 +104,6 @@ static int pf_read (void) } close (fd); - fd = -1; if (!state.running) { @@ -117,16 +111,16 @@ static int pf_read (void) return (-1); } - for (i = 0; i < PFRES_MAX; i++) + for (int i = 0; i < PFRES_MAX; i++) pf_submit ("pf_counters", pf_reasons[i], state.counters[i], /* is gauge = */ 0); - for (i = 0; i < LCNT_MAX; i++) + for (int i = 0; i < LCNT_MAX; i++) pf_submit ("pf_limits", pf_lcounters[i], state.lcounters[i], /* is gauge = */ 0); - for (i = 0; i < FCNT_MAX; i++) + for (int i = 0; i < FCNT_MAX; i++) pf_submit ("pf_state", pf_fcounters[i], state.fcounters[i], /* is gauge = */ 0); - for (i = 0; i < SCNT_MAX; i++) + for (int i = 0; i < SCNT_MAX; i++) pf_submit ("pf_source", pf_scounters[i], state.scounters[i], /* is gauge = */ 0);