X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fpf.c;h=9681d366a1631b7b29d8074ee4a774f75218ace8;hp=82adc53b275d2b10f0a194e586d220121f9fe4a5;hb=48efd3deb4c9139fd060ff3d289896e9031bcc7c;hpb=217ec252adf547f2dd048489e2498bc31e8f70db diff --git a/src/pf.c b/src/pf.c index 82adc53b..9681d366 100644 --- a/src/pf.c +++ b/src/pf.c @@ -21,8 +21,8 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #if HAVE_SYS_IOCTL_H #include @@ -58,7 +58,7 @@ static char const *pf_scounters[SCNT_MAX + 1] = SCNT_NAMES; static char const *pf_device = "/dev/pf"; static void pf_submit(char const *type, char const *type_instance, uint64_t val, - _Bool is_gauge) { + bool is_gauge) { value_t values[1]; value_list_t vl = VALUE_LIST_INIT; @@ -83,17 +83,13 @@ static int pf_read(void) { fd = open(pf_device, O_RDONLY); if (fd < 0) { - char errbuf[1024]; - ERROR("pf plugin: Unable to open %s: %s", pf_device, - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("pf plugin: Unable to open %s: %s", pf_device, STRERRNO); return -1; } status = ioctl(fd, DIOCGETSTATUS, &state); if (status != 0) { - char errbuf[1024]; - ERROR("pf plugin: ioctl(DIOCGETSTATUS) failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("pf plugin: ioctl(DIOCGETSTATUS) failed: %s", STRERRNO); close(fd); return -1; } @@ -107,19 +103,19 @@ static int pf_read(void) { for (int i = 0; i < PFRES_MAX; i++) pf_submit("pf_counters", pf_reasons[i], state.counters[i], - /* is gauge = */ 0); + /* is gauge = */ false); for (int i = 0; i < LCNT_MAX; i++) pf_submit("pf_limits", pf_lcounters[i], state.lcounters[i], - /* is gauge = */ 0); + /* is gauge = */ false); for (int i = 0; i < FCNT_MAX; i++) pf_submit("pf_state", pf_fcounters[i], state.fcounters[i], - /* is gauge = */ 0); + /* is gauge = */ false); for (int i = 0; i < SCNT_MAX; i++) pf_submit("pf_source", pf_scounters[i], state.scounters[i], - /* is gauge = */ 0); + /* is gauge = */ false); pf_submit("pf_states", "current", (uint32_t)state.states, - /* is gauge = */ 1); + /* is gauge = */ true); return 0; } /* int pf_read */