X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fpf.c;h=88a4c2d0ecfe27a6d466d40d60d480a1d197f80b;hp=82adc53b275d2b10f0a194e586d220121f9fe4a5;hb=06a86a60a7dabc685bdbd81ce3d36ea5f7e2c2d4;hpb=5ff74d56067ac64db801df5184eb8b97f4b2b645 diff --git a/src/pf.c b/src/pf.c index 82adc53b..88a4c2d0 100644 --- a/src/pf.c +++ b/src/pf.c @@ -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 */