diff --git a/src/cpu.c b/src/cpu.c
index 6832b5239a1b9bad95d931b5061636e1fa01118c..62e814578cb688d50bb5a857a34899f65bc520c2 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
#define MODULE_NAME "cpu"
-#if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT) || defined(HAVE_SYSCTLBYNAME)
-# define CPU_HAVE_READ 1
-#else
-# define CPU_HAVE_READ 0
-#endif
-
#ifdef HAVE_LIBKSTAT
# include <sys/sysinfo.h>
#endif /* HAVE_LIBKSTAT */
# endif
#endif /* HAVE_SYSCTLBYNAME */
+#if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT) || defined(HAVE_SYSCTLBYNAME)
+# define CPU_HAVE_READ 1
+#else
+# define CPU_HAVE_READ 0
+#endif
+
#ifdef HAVE_LIBKSTAT
/* colleague tells me that Sun doesn't sell systems with more than 100 or so CPUs.. */
# define MAX_NUMCPU 256
};
static int ds_num = 5;
-void cpu_init (void)
+static void cpu_init (void)
{
#ifdef HAVE_LIBKSTAT
kstat_t *ksp_chain;
return;
}
-void cpu_write (char *host, char *inst, char *val)
+static void cpu_write (char *host, char *inst, char *val)
{
char file[512];
int status;
rrd_update_file (host, file, val, ds_def, ds_num);
}
+#if CPU_HAVE_READ
#define BUFSIZE 512
static void cpu_submit (int cpu_num, unsigned long long user,
unsigned long long nice, unsigned long long syst,
}
#undef BUFSIZE
-#if CPU_HAVE_READ
static void cpu_read (void)
{
#ifdef KERNEL_LINUX
return;
}
+#else
+# define cpu_read NULL
#endif /* CPU_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, cpu_init,
-#if CPU_HAVE_READ
- cpu_read,
-#else
- NULL,
-#endif
- cpu_write);
+ plugin_register (MODULE_NAME, cpu_init, cpu_read, cpu_write);
}
#undef MODULE_NAME