projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ChangeLog: Updated after the merge.
[collectd.git]
/
src
/
interface.c
diff --git
a/src/interface.c
b/src/interface.c
index
c439ebd
..
2add89d
100644
(file)
--- a/
src/interface.c
+++ b/
src/interface.c
@@
-46,6
+46,10
@@
# include <ifaddrs.h>
#endif
# include <ifaddrs.h>
#endif
+#if HAVE_STATGRAB_H
+# include <statgrab.h>
+#endif
+
/*
* Various people have reported problems with `getifaddrs' and varying versions
* of `glibc'. That's why it's disabled by default. Since more statistics are
/*
* Various people have reported problems with `getifaddrs' and varying versions
* of `glibc'. That's why it's disabled by default. Since more statistics are
@@
-58,10
+62,8
@@
# endif /* !COLLECT_GETIFADDRS */
#endif /* KERNEL_LINUX */
# endif /* !COLLECT_GETIFADDRS */
#endif /* KERNEL_LINUX */
-#if HAVE_GETIFADDRS || KERNEL_LINUX || HAVE_LIBKSTAT || HAVE_LIBSTATGRAB
-# define INTERFACE_HAVE_READ 1
-#else
-# define INTERFACE_HAVE_READ 0
+#if !HAVE_GETIFADDRS && !KERNEL_LINUX && !HAVE_LIBKSTAT && !HAVE_LIBSTATGRAB
+# error "No applicable input method."
#endif
/*
#endif
/*
@@
-132,7
+134,6
@@
static int interface_config (const char *key, const char *value)
#if HAVE_LIBKSTAT
static int interface_init (void)
{
#if HAVE_LIBKSTAT
static int interface_init (void)
{
-#if HAVE_LIBKSTAT
kstat_t *ksp_chain;
unsigned long long val;
kstat_t *ksp_chain;
unsigned long long val;
@@
-155,7
+156,6
@@
static int interface_init (void)
continue;
ksp[numif++] = ksp_chain;
}
continue;
ksp[numif++] = ksp_chain;
}
-#endif /* HAVE_LIBKSTAT */
return (0);
} /* int interface_init */
return (0);
} /* int interface_init */
@@
-181,7
+181,6
@@
static int check_ignore_if (const char *interface)
return (1 - if_list_action);
} /* int check_ignore_if */
return (1 - if_list_action);
} /* int check_ignore_if */
-#if INTERFACE_HAVE_READ
static void if_submit (const char *dev, const char *type,
unsigned long long rx,
unsigned long long tx)
static void if_submit (const char *dev, const char *type,
unsigned long long rx,
unsigned long long tx)
@@
-198,8
+197,8
@@
static void if_submit (const char *dev, const char *type,
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
vl.values = values;
vl.values_len = 2;
vl.time = time (NULL);
- s
trcpy (vl.host, hostname_g
);
- s
trcpy (vl.plugin, "interface"
);
+ s
strncpy (vl.host, hostname_g, sizeof (vl.host)
);
+ s
strncpy (vl.plugin, "interface", sizeof (vl.plugin)
);
strncpy (vl.type_instance, dev, sizeof (vl.type_instance));
plugin_dispatch_values (type, &vl);
strncpy (vl.type_instance, dev, sizeof (vl.type_instance));
plugin_dispatch_values (type, &vl);
@@
-317,7
+316,7
@@
static int interface_read (void)
unsigned long long tx;
if (kc == NULL)
unsigned long long tx;
if (kc == NULL)
- return;
+ return
(-1)
;
for (i = 0; i < numif; i++)
{
for (i = 0; i < numif; i++)
{
@@
-353,7
+352,6
@@
static int interface_read (void)
return (0);
} /* int interface_read */
return (0);
} /* int interface_read */
-#endif /* INTERFACE_HAVE_READ */
void module_register (void)
{
void module_register (void)
{
@@
-362,7
+360,5
@@
void module_register (void)
#if HAVE_LIBKSTAT
plugin_register_init ("interface", interface_init);
#endif
#if HAVE_LIBKSTAT
plugin_register_init ("interface", interface_init);
#endif
-#if INTERFACE_HAVE_READ
plugin_register_read ("interface", interface_read);
plugin_register_read ("interface", interface_read);
-#endif
} /* void module_register */
} /* void module_register */