projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor collectd binary to separate Unix-specific code.
[collectd.git]
/
src
/
interface.c
diff --git
a/src/interface.c
b/src/interface.c
index
deba186
..
86110b0
100644
(file)
--- a/
src/interface.c
+++ b/
src/interface.c
@@
-86,16
+86,19
@@
static const char *config_keys[] = {
};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static ignorelist_t *ignorelist
= NULL
;
+static ignorelist_t *ignorelist;
-static
_Bool report_inactive = 1
;
+static
bool report_inactive = true
;
#ifdef HAVE_LIBKSTAT
#ifdef HAVE_LIBKSTAT
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
#define MAX_NUMIF 256
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMIF];
#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 int numif;
+static
bool unique_name
;
#endif /* HAVE_LIBKSTAT */
static int interface_config(const char *key, const char *value) {
#endif /* HAVE_LIBKSTAT */
static int interface_config(const char *key, const char *value) {
@@
-114,7
+117,7
@@
static int interface_config(const char *key, const char *value) {
else if (strcasecmp(key, "UniqueName") == 0) {
#ifdef HAVE_LIBKSTAT
if (IS_TRUE(value))
else if (strcasecmp(key, "UniqueName") == 0) {
#ifdef HAVE_LIBKSTAT
if (IS_TRUE(value))
- unique_name =
1
;
+ unique_name =
true
;
#else
WARNING("interface plugin: the \"UniqueName\" option is only valid on "
"Solaris.");
#else
WARNING("interface plugin: the \"UniqueName\" option is only valid on "
"Solaris.");
@@
-236,9
+239,7
@@
static int interface_read(void) {
int numfields;
if ((fh = fopen("/proc/net/dev", "r")) == NULL) {
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;
}
return -1;
}
@@
-352,9
+353,7
@@
static int interface_read(void) {
if ((nif = perfstat_netinterface(NULL, NULL, sizeof(perfstat_netinterface_t),
0)) < 0) {
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;
}
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) {
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,
WARNING("interface plugin: perfstat_netinterface (interfaces=%d): %s", nif,
-
sstrerror(errno, errbuf, sizeof(errbuf))
);
+
STRERRNO
);
return -1;
}
return -1;
}