diff --git a/src/serial.c b/src/serial.c
index 78210300fd0a234ded51d35d53bef21aaf5772a4..0c6050d72c9a9e7533782ba2dd458627268532e0 100644 (file)
--- a/src/serial.c
+++ b/src/serial.c
/**
* collectd - src/serial.c
/**
* collectd - src/serial.c
- * Copyright (C) 2005 David Bacher
+ * Copyright (C) 2005,2006 David Bacher
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Florian octo Forster <octo at verplant.org>
**/
* 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"
#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 char *ds_def[] =
{
static char *serial_filename_template = "serial-%s.rrd";
static char *ds_def[] =
{
- "DS:incoming:COUNTER:25:0:U",
- "DS:outgoing:COUNTER:25:0:U",
+ "DS:incoming:COUNTER:"COLLECTD_HEARTBEAT":0:U",
+ "DS:outgoing:COUNTER:"COLLECTD_HEARTBEAT":0:U",
NULL
};
static int ds_num = 2;
NULL
};
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;
{
char file[512];
int status;
rrd_update_file (host, file, val, ds_def, ds_num);
}
rrd_update_file (host, file, val, ds_def, ds_num);
}
+#if SERIAL_HAVE_READ
#define BUFSIZE 512
#define BUFSIZE 512
-void serial_submit (char *device,
+static void serial_submit (char *device,
unsigned long long incoming,
unsigned long long outgoing)
{
unsigned long long incoming,
unsigned long long outgoing)
{
}
#undef BUFSIZE
}
#undef BUFSIZE
-void serial_read (void)
+static void serial_read (void)
{
#ifdef KERNEL_LINUX
{
#ifdef KERNEL_LINUX
{
int have_rx = 0, have_tx = 0;
{
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)
numfields = strsplit (buffer, fields, 16);
if (numfields < 6)
fclose (fh);
#endif /* KERNEL_LINUX */
}
fclose (fh);
#endif /* KERNEL_LINUX */
}
+#else
+# define serial_read NULL
+#endif /* SERIAL_HAVE_READ */
void module_register (void)
{
void module_register (void)
{
}
#undef MODULE_NAME
}
#undef MODULE_NAME
-#endif /* COLLECT_SERIAL */