author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Tue, 10 Jun 2008 15:09:46 +0000 (17:09 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Tue, 10 Jun 2008 15:09:46 +0000 (17:09 +0200) |
configure.in | patch | blob | history | |
src/collectd.h | patch | blob | history | |
src/disk.c | patch | blob | history | |
src/network.c | patch | blob | history | |
src/plugin.h | patch | blob | history | |
src/wireless.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 3876b4f13d2603baf279bdf4decd2afa9e22e736..12c91393bc360cb31bd77a780e752dbe396d3e7e 100644 (file)
--- a/configure.in
+++ b/configure.in
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
-AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h)
+AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h)
# For ping library
AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
diff --git a/src/collectd.h b/src/collectd.h
index 55aac160587a889e488554ac1009660047d3382b..0ccf5336e6887f1bce252d8955d98895e4c19ea4 100644 (file)
--- a/src/collectd.h
+++ b/src/collectd.h
# endif /* !defined(isnan) */
#endif /* NAN_ZERO_ZERO */
+/* Try really, really hard to determine endianess. Under NexentaStor 1.0.2 this
+ * information is in <sys/isa_defs.h>, possibly some other Solaris versions do
+ * this too.. */
#if HAVE_ENDIAN_H
# include <endian.h>
+#elif HAVE_SYS_ISA_DEFS_H
+# include <sys/isa_defs.h>
#endif
#ifndef BYTE_ORDER
# define BIG_ENDIAN __BIG_ENDIAN
# endif
#endif
+#ifndef LITTLE_ENDIAN
+# if defined(_LITTLE_ENDIAN)
+# define LITTLE_ENDIAN _LITTLE_ENDIAN
+# elif defined(__LITTLE_ENDIAN)
+# define LITTLE_ENDIAN __LITTLE_ENDIAN
+# endif
+#endif
+#ifndef BYTE_ORDER
+# if defined(BIG_ENDIAN) && !defined(LITTLE_ENDIAN)
+# undef BIG_ENDIAN
+# define BIG_ENDIAN 4321
+# define LITTLE_ENDIAN 1234
+# define BYTE_ORDER BIG_ENDIAN
+# elif !defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN)
+# undef LITTLE_ENDIAN
+# define BIG_ENDIAN 4321
+# define LITTLE_ENDIAN 1234
+# define BYTE_ORDER LITTLE_ENDIAN
+# endif
+#endif
#if !defined(BYTE_ORDER) || !defined(BIG_ENDIAN)
# error "Cannot determine byte order"
#endif
#define STATIC_ARRAY_LEN(array) (sizeof (array) / sizeof ((array)[0]))
+/* Remove GNU specific __attribute__ settings when using another compiler */
+#if !__GNUC__
+# define __attribute__(x) /**/
+#endif
+
extern char hostname_g[];
extern int interval_g;
diff --git a/src/disk.c b/src/disk.c
index 6ed71b2853396f22eb848f504cffa16586a1d407..2d13430b29ec61dae56a3a739942608ff785dc03 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
major = atoll (fields[0]);
minor = atoll (fields[1]);
- disk_name = fields[2];
+ disk_name = fields[2 + fieldshift];
for (ds = disklist, pre_ds = disklist; ds != NULL; pre_ds = ds, ds = ds->next)
if (strcmp (disk_name, ds->name) == 0)
diff --git a/src/network.c b/src/network.c
index e15036424d880316ec58bcdffd7d9d3cc76ff2ae..039354b5b44a9e123c3d0a41172161ca8edf96ba 100644 (file)
--- a/src/network.c
+++ b/src/network.c
static c_avl_tree_t *cache_tree = NULL;
static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER;
-static time_t cache_flush_last;
+static time_t cache_flush_last = 0;
static int cache_flush_interval = 1800;
/*
plugin_unregister_write ("network");
plugin_unregister_shutdown ("network");
+ /* Let the init function do it's move again ;) */
+ cache_flush_last = 0;
+
return (0);
} /* int network_shutdown */
static int network_init (void)
{
+ /* Check if we were already initialized. If so, just return - there's
+ * nothing more to do (for now, that is). */
+ if (cache_flush_last != 0)
+ return (0);
+
plugin_register_shutdown ("network", network_shutdown);
send_buffer_ptr = send_buffer;
diff --git a/src/plugin.h b/src/plugin.h
index 7b59930df3f7ae53eea9690f74d7b998846948ed..318b54734a0cbe1777855b624c9dd87adacab492 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
int plugin_dispatch_notification (const notification_t *notif);
-void plugin_log (int level, const char *format, ...);
+void plugin_log (int level, const char *format, ...)
+ __attribute__ ((format(printf,2,3)));
+
#define ERROR(...) plugin_log (LOG_ERR, __VA_ARGS__)
#define WARNING(...) plugin_log (LOG_WARNING, __VA_ARGS__)
#define NOTICE(...) plugin_log (LOG_NOTICE, __VA_ARGS__)
diff --git a/src/wireless.c b/src/wireless.c
index 285fb744748c64714aa7eed8948e2f5b73df73c3..fdea9d3bfdce76af90cc2733636cbe2ce6b2ea43 100644 (file)
--- a/src/wireless.c
+++ b/src/wireless.c
power = 1.0; /* invalid */
else if ((power >= 0.0) && (power <= 100.0))
power = wireless_percent_to_power (power);
- else if (power > 100.0)
+ else if ((power > 100.0) && (power <= 256.0))
+ power = power - 256.0;
+ else if (power > 0.0)
power = 1.0; /* invalid */
/* noise [dBm] < 0.0 */
noise = 1.0; /* invalid */
else if ((noise >= 0.0) && (noise <= 100.0))
noise = wireless_percent_to_power (noise);
- else if (noise > 100.0)
+ else if ((noise > 100.0) && (noise <= 256.0))
+ noise = noise - 256.0;
+ else if (noise > 0.0)
noise = 1.0; /* invalid */
wireless_submit (device, "signal_quality", quality);