diff --git a/src/memory.c b/src/memory.c
index 3291bc870c4cfd6bb977f58a8f0f86921296a272..3ab19e651c8dc577cfd85bd8b1f87151bff79f56 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "memory.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_MEMORY
-#define MODULE_NAME "memory"
+#if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT)
+# define MEMORY_HAVE_READ 1
+#else
+# define MEMORY_HAVE_READ 0
+#endif
-#include "plugin.h"
-#include "common.h"
+#define MODULE_NAME "memory"
static char *memory_file = "memory.rrd";
static kstat_t *ksp;
#endif /* HAVE_LIBKSTAT */
-extern time_t curtime;
-
-void memory_init (void)
+static void memory_init (void)
{
#ifdef HAVE_LIBKSTAT
/* getpagesize(3C) tells me this does not fail.. */
return;
}
-void memory_write (char *host, char *inst, char *val)
+static void memory_write (char *host, char *inst, char *val)
{
rrd_update_file (host, memory_file, val, ds_def, ds_num);
}
+#if MEMORY_HAVE_READ
#define BUFSIZE 512
-void memory_submit (long long mem_used, long long mem_buffered,
+static void memory_submit (long long mem_used, long long mem_buffered,
long long mem_cached, long long mem_free)
{
char buf[BUFSIZE];
}
#undef BUFSIZE
-void memory_read (void)
+static void memory_read (void)
{
#ifdef KERNEL_LINUX
FILE *fh;
memory_submit (ios->used, 0LL, ios->cache, ios->free);
#endif /* HAVE_LIBSTATGRAB */
}
+#else
+# define memory_read NULL
+#endif /* MEMORY_HAVE_READ */
void module_register (void)
{
}
#undef MODULE_NAME
-#endif /* COLLECT_MEMORY */