X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Finterface.c;h=64764d518e302c5a53c741fbecf57533db77b5bb;hb=61a4ed99b1a5b6d371bb745933d0efc5dff9505c;hp=2ff7db2a1690dd3ffa1da8ac41a99cd474430c8e;hpb=be126043c2be20399d7670fe194645292018bde0;p=collectd.git diff --git a/src/interface.c b/src/interface.c index 2ff7db2a..64764d51 100644 --- a/src/interface.c +++ b/src/interface.c @@ -88,14 +88,17 @@ static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); static ignorelist_t *ignorelist = NULL; -static _Bool report_inactive = 1; +static bool report_inactive = 1; #ifdef HAVE_LIBKSTAT +#if HAVE_KSTAT_H +#include +#endif #define MAX_NUMIF 256 extern kstat_ctl_t *kc; static kstat_t *ksp[MAX_NUMIF]; static int numif = 0; -static _Bool unique_name = 0; +static bool unique_name = 0; #endif /* HAVE_LIBKSTAT */ static int interface_config(const char *key, const char *value) { @@ -236,9 +239,7 @@ static int interface_read(void) { int numfields; if ((fh = fopen("/proc/net/dev", "r")) == NULL) { - char errbuf[1024]; - WARNING("interface plugin: fopen: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + WARNING("interface plugin: fopen: %s", STRERRNO); return -1; } @@ -297,7 +298,7 @@ static int interface_read(void) { if (unique_name) snprintf(iname, sizeof(iname), "%s_%d_%s", ksp[i]->ks_module, - ksp[i]->ks_instance, ksp[i]->ks_name); + ksp[i]->ks_instance, ksp[i]->ks_name); else sstrncpy(iname, ksp[i]->ks_name, sizeof(iname)); @@ -352,9 +353,7 @@ static int interface_read(void) { if ((nif = perfstat_netinterface(NULL, NULL, sizeof(perfstat_netinterface_t), 0)) < 0) { - char errbuf[1024]; - WARNING("interface plugin: perfstat_netinterface: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + WARNING("interface plugin: perfstat_netinterface: %s", STRERRNO); return -1; } @@ -367,9 +366,8 @@ static int interface_read(void) { id.name[0] = '\0'; if ((ifs = perfstat_netinterface(&id, ifstat, sizeof(perfstat_netinterface_t), nif)) < 0) { - char errbuf[1024]; WARNING("interface plugin: perfstat_netinterface (interfaces=%d): %s", nif, - sstrerror(errno, errbuf, sizeof(errbuf))); + STRERRNO); return -1; }