summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7368105)
raw | patch | inline | side by side (parent: 7368105)
author | octo <octo> | |
Sat, 17 Dec 2005 11:26:00 +0000 (11:26 +0000) | ||
committer | octo <octo> | |
Sat, 17 Dec 2005 11:26:00 +0000 (11:26 +0000) |
src/Makefile.am | patch | blob | history | |
src/serial.c | patch | blob | history | |
src/swap.c | patch | blob | history | |
src/tape.c | patch | blob | history | |
src/traffic.c | patch | blob | history | |
src/users.c | patch | blob | history |
diff --git a/src/Makefile.am b/src/Makefile.am
index 3252aec3147148e5d08bf25a2213e7d9242ba17e..9240239570acb3bb19b73559fe3c0c1b875dc1b2 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
pkglib_LTLIBRARIES += serial.la
serial_la_SOURCES = serial.c serial.h
serial_la_LDFLAGS = -module -avoid-version
+serial_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" serial.la
collectd_DEPENDENCIES += serial.la
endif
pkglib_LTLIBRARIES += swap.la
swap_la_SOURCES = swap.c swap.h
swap_la_LDFLAGS = -module -avoid-version
+swap_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" swap.la
collectd_DEPENDENCIES += swap.la
endif
pkglib_LTLIBRARIES += tape.la
tape_la_SOURCES = tape.c tape.h
tape_la_LDFLAGS = -module -avoid-version
+tape_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" tape.la
collectd_DEPENDENCIES += tape.la
endif
pkglib_LTLIBRARIES += traffic.la
traffic_la_SOURCES = traffic.c traffic.h
traffic_la_LDFLAGS = -module -avoid-version
+traffic_la_CFLAGS = -Wall -Werror
collectd_LDADD += "-dlopen" traffic.la
collectd_DEPENDENCIES += traffic.la
endif
diff --git a/src/serial.c b/src/serial.c
index 78210300fd0a234ded51d35d53bef21aaf5772a4..20a51e70d91b549e3bb6898af689d43c0910dca9 100644 (file)
--- a/src/serial.c
+++ b/src/serial.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "serial.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_SERIAL
#define MODULE_NAME "serial"
-#include "plugin.h"
-#include "common.h"
+#if defined(KERNEL_LINUX)
+# define SERIAL_HAVE_READ 1
+#else
+# define SERIAL_HAVE_READ 0
+#endif
static char *serial_filename_template = "serial-%s.rrd";
};
static int ds_num = 2;
-void serial_init (void)
+static void serial_init (void)
{
+ return;
}
-void serial_write (char *host, char *inst, char *val)
+static void serial_write (char *host, char *inst, char *val)
{
char file[512];
int status;
}
#define BUFSIZE 512
-void serial_submit (char *device,
+static void serial_submit (char *device,
unsigned long long incoming,
unsigned long long outgoing)
{
}
#undef BUFSIZE
-void serial_read (void)
+#if SERIAL_HAVE_READ
+static void serial_read (void)
{
#ifdef KERNEL_LINUX
{
int have_rx = 0, have_tx = 0;
+ /* stupid compiler:
+ * serial.c:87: warning: 'incoming' may be used uninitialized in this function
+ * serial.c:87: warning: 'outgoing' may be used uninitialized in this function
+ */
+ incoming = 0ULL;
+ outgoing = 0ULL;
+
numfields = strsplit (buffer, fields, 16);
if (numfields < 6)
fclose (fh);
#endif /* KERNEL_LINUX */
}
+#endif /* SERIAL_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, serial_init, serial_read, serial_write);
+ plugin_register (MODULE_NAME, serial_init,
+#if SERIAL_HAVE_READ
+ serial_read,
+#else
+ NULL,
+#endif
+ serial_write);
}
#undef MODULE_NAME
-#endif /* COLLECT_SERIAL */
diff --git a/src/swap.c b/src/swap.c
index c3e399d83fd5e3d13d0fb3f072cc974eb48f3e24..eb476a42e4b0206c035cb96a69cdf0769431fab6 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "swap.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_SWAP
#define MODULE_NAME "swap"
+#if defined(KERNEL_LINUX) || defined(KERNEL_SOLARIS) || defined(HAVE_LIBSTATGRAB)
+# define SWAP_HAVE_READ 1
+#else
+# define SWAP_HAVE_READ 0
+#endif
+
#ifdef KERNEL_SOLARIS
#include <sys/swap.h>
#endif /* KERNEL_SOLARIS */
-#include "plugin.h"
-#include "common.h"
-
#undef MAX
#define MAX(x,y) ((x) > (y) ? (x) : (y))
static kstat_t *ksp;
#endif /* KERNEL_SOLARIS */
-void module_init (void)
+static void module_init (void)
{
#ifdef KERNEL_SOLARIS
/* getpagesize(3C) tells me this does not fail.. */
return;
}
-void module_write (char *host, char *inst, char *val)
+static void module_write (char *host, char *inst, char *val)
{
rrd_update_file (host, swap_file, val, ds_def, ds_num);
}
-void module_submit (unsigned long long swap_used,
+static void module_submit (unsigned long long swap_used,
unsigned long long swap_free,
unsigned long long swap_cached,
unsigned long long swap_resv)
plugin_submit (MODULE_NAME, "-", buffer);
}
-void module_read (void)
+#if SWAP_HAVE_READ
+static void module_read (void)
{
#ifdef KERNEL_LINUX
FILE *fh;
module_submit (swap->used, swap->free, -1LL, -1LL);
#endif /* HAVE_LIBSTATGRAB */
}
+#else
+# define module_read NULL
+#endif /* SWAP_HAVE_READ */
void module_register (void)
{
}
#undef MODULE_NAME
-#endif /* COLLECT_SWAP */
diff --git a/src/tape.c b/src/tape.c
index 3697c6333aa8f4d6cfab06b1ec5a3e86fa27bb74..c6271de7d99c304cec9cf9ed9233954643e5ff8f 100644 (file)
--- a/src/tape.c
+++ b/src/tape.c
* Scott Garrett <sgarrett at technomancer.com>
**/
-#include "tape.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_TAPE
#define MODULE_NAME "tape"
-#include "plugin.h"
-#include "common.h"
-
#if defined(HAVE_LIBKSTAT)
-#define MAX_NUMTAPE 256
-extern kstat_ctl_t *kc;
-static kstat_t *ksp[MAX_NUMTAPE];
-static int numtape = 0;
-#endif /* HAVE_LIBKSTAT */
+# define TAPE_HAVE_READ 1
+#else
+# define TAPE_HAVE_READ 0
+#endif
static char *tape_filename_template = "tape-%s.rrd";
};
static int tape_ds_num = 8;
-void tape_init (void)
+#if defined(HAVE_LIBKSTAT)
+#define MAX_NUMTAPE 256
+extern kstat_ctl_t *kc;
+static kstat_t *ksp[MAX_NUMTAPE];
+static int numtape = 0;
+#endif /* HAVE_LIBKSTAT */
+
+static void tape_init (void)
{
#ifdef HAVE_LIBKSTAT
kstat_t *ksp_chain;
return;
}
-void tape_write (char *host, char *inst, char *val)
+static void tape_write (char *host, char *inst, char *val)
{
char file[512];
int status;
#define BUFSIZE 512
-void tape_submit (char *tape_name,
+static void tape_submit (char *tape_name,
unsigned long long read_count,
unsigned long long read_merged,
unsigned long long read_bytes,
#undef BUFSIZE
+#if TAPE_HAVE_READ
void tape_read (void)
{
}
#endif /* defined(HAVE_LIBKSTAT) */
}
+#else
+# define tape_read NULL
+#endif /* TAPE_HAVE_READ */
void module_register (void)
{
}
#undef MODULE_NAME
-#endif /* COLLECT_TAPE */
diff --git a/src/traffic.c b/src/traffic.c
index 5a276a825dec02a7faa3d2a56cc823add5cb73f5..ab2c8cc2316c37d44c319754c6dc090536764b4b 100644 (file)
--- a/src/traffic.c
+++ b/src/traffic.c
* Florian octo Forster <octo at verplant.org>
**/
-#include "traffic.h"
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
-#if COLLECT_TRAFFIC
#define MODULE_NAME "traffic"
-#include "plugin.h"
-#include "common.h"
-
-#ifdef HAVE_LIBKSTAT
-#define MAX_NUMIF 256
-extern kstat_ctl_t *kc;
-static kstat_t *ksp[MAX_NUMIF];
-static int numif = 0;
-#endif /* HAVE_LIBKSTAT */
+#if defined(KERNEL_LINUX) || defined(HAVE_LIBKSTAT) || defined(HAVE_LIBSTATGRAB)
+# define TRAFFIC_HAVE_READ 1
+#else
+# define TRAFFIC_HAVE_READ 0
+#endif
static char *traffic_filename_template = "traffic-%s.rrd";
};
static int ds_num = 2;
+#ifdef HAVE_LIBKSTAT
+#define MAX_NUMIF 256
+extern kstat_ctl_t *kc;
+static kstat_t *ksp[MAX_NUMIF];
+static int numif = 0;
+#endif /* HAVE_LIBKSTAT */
+
void traffic_init (void)
{
#ifdef HAVE_LIBKSTAT
}
#undef BUFSIZE
+#if TRAFFIC_HAVE_READ
void traffic_read (void)
{
#ifdef KERNEL_LINUX
traffic_submit (ios[i].interface_name, ios[i].rx, ios[i].tx);
#endif /* HAVE_LIBSTATGRAB */
}
+#else
+#define traffic_read NULL
+#endif /* TRAFFIC_HAVE_READ */
void module_register (void)
{
}
#undef MODULE_NAME
-#endif /* COLLECT_TRAFFIC */
diff --git a/src/users.c b/src/users.c
index 2739c2beec307bb17f9e55460f0f5ada5ae58b74..e2b741c9393f96b44ec8aa17b5132b249e22b8b8 100644 (file)
--- a/src/users.c
+++ b/src/users.c
* Sebastian Harl <sh at tokkee.org>
**/
+#include "collectd.h"
#include "common.h"
#include "plugin.h"
-#include "users.h"
#if HAVE_UTMPX_H
# include <utmpx.h>
#define MODULE_NAME "users"
+#if HAVE_GETUTXENT || HAVE_GETUTENT
+# define USERS_HAVE_READ 1
+#else
+# define USERS_HAVE_READ 0
+#endif
+
static char *rrd_file = "users.rrd";
static char *ds_def[] =
{
} /* static void users_submit(unsigned int users) */
#undef BUFSIZE
+#if USERS_HAVE_READ
static void users_read (void)
{
#if HAVE_GETUTXENT
return;
} /* static void users_read(void) */
+#else
+# define users_read NULL
+#endif /* USERS_HAVE_READ */
void module_register (void)
{