From f05e9721b9ea58d6ea4a8295a80cede2d6b327d1 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 30 Apr 2008 10:25:15 +0200 Subject: [PATCH] Moved out of "collectd.h" and into the plugins that actually use the library. The libstatgrab specific CFLAGS are only passed to these plugins, so that other plugins may fail if libstatgrab is in a non-standard path. --- src/collectd.c | 4 ++++ src/collectd.h | 3 --- src/interface.c | 4 ++++ src/load.c | 4 ++++ src/memory.c | 18 +++++++++++++----- src/swap.c | 4 ++++ 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/collectd.c b/src/collectd.c index 4e18fd6e..ab9c89d2 100644 --- a/src/collectd.c +++ b/src/collectd.c @@ -27,6 +27,10 @@ #include "configfile.h" #include "types_list.h" +#if HAVE_STATGRAB_H +# include +#endif + /* * Global variables */ diff --git a/src/collectd.h b/src/collectd.h index 59dc5d20..80d86ba8 100644 --- a/src/collectd.h +++ b/src/collectd.h @@ -174,9 +174,6 @@ #if HAVE_PTH_H # include #endif -#if HAVE_STATGRAB_H -# include -#endif #if HAVE_SENSORS_SENSORS_H # include #endif diff --git a/src/interface.c b/src/interface.c index 741ff764..33736b67 100644 --- a/src/interface.c +++ b/src/interface.c @@ -46,6 +46,10 @@ # include #endif +#if HAVE_STATGRAB_H +# include +#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 diff --git a/src/load.c b/src/load.c index c9f130b7..db3bf4b8 100644 --- a/src/load.c +++ b/src/load.c @@ -27,6 +27,10 @@ #include #endif +#if HAVE_STATGRAB_H +# include +#endif + #ifdef HAVE_GETLOADAVG #if !defined(LOADAVG_1MIN) || !defined(LOADAVG_5MIN) || !defined(LOADAVG_15MIN) #define LOADAVG_1MIN 0 diff --git a/src/memory.c b/src/memory.c index 3fbd33fb..fe3a16eb 100644 --- a/src/memory.c +++ b/src/memory.c @@ -43,6 +43,10 @@ # include #endif +#if HAVE_STATGRAB_H +# include +#endif + /* vm_statistics_data_t */ #if HAVE_HOST_STATISTICS static mach_port_t port_host; @@ -62,6 +66,10 @@ static int pagesize; static kstat_t *ksp; /* #endif HAVE_LIBKSTAT */ +#elif HAVE_LIBSTATGRAB +/* no global variables */ +/* endif HAVE_LIBSTATGRAB */ + #else # error "No applicable input method." #endif @@ -218,7 +226,7 @@ static int memory_read (void) memory_submit ("cache", sysctl_vals[6]); /* #endif HAVE_SYSCTLBYNAME */ -#elif defined(KERNEL_LINUX) +#elif KERNEL_LINUX FILE *fh; char buffer[1024]; @@ -276,9 +284,9 @@ static int memory_read (void) memory_submit ("cached", mem_cached); memory_submit ("free", mem_free); } -/* #endif defined(KERNEL_LINUX) */ +/* #endif KERNEL_LINUX */ -#elif defined(HAVE_LIBKSTAT) +#elif HAVE_LIBKSTAT long long mem_used; long long mem_free; long long mem_lock; @@ -303,9 +311,9 @@ static int memory_read (void) memory_submit ("used", mem_used); memory_submit ("free", mem_free); memory_submit ("locked", mem_lock); -/* #endif defined(HAVE_LIBKSTAT) */ +/* #endif HAVE_LIBKSTAT */ -#elif defined(HAVE_LIBSTATGRAB) +#elif HAVE_LIBSTATGRAB sg_mem_stats *ios; if ((ios = sg_get_mem_stats ()) != NULL) diff --git a/src/swap.c b/src/swap.c index 1cf70779..e91ebefd 100644 --- a/src/swap.c +++ b/src/swap.c @@ -36,6 +36,10 @@ # include #endif +#if HAVE_STATGRAB_H +# include +#endif + #undef MAX #define MAX(x,y) ((x) > (y) ? (x) : (y)) -- 2.11.0