Merge branch 'collectd-4.0'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 19 Jun 2007 19:43:42 +0000 (21:43 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 19 Jun 2007 19:43:42 +0000 (21:43 +0200)
ChangeLog
README
configure.in
contrib/PerlLib/Collectd.pm
src/Makefile.am
src/cpu.c
src/csv.c
src/ping.c
src/rrdtool.c

index d264959..79c117e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-06-19, Version 4.0.3
+       * cpu plugin: Fix the Darwin / Mac OS X code.
+       * ping plugin: Use the return value of `getpid', not its address.
+       * csv, rrdtool plugin: Fixed a bug that prevented an buffer to be
+         initialized correctly.
+       * configure: Added `--with-nan-emulation' to aid cross compilation.
+
 2007-06-12, Version 4.0.2
        * hddtemp and ntpd plugin: Corrected the parsing of port numbers when
          they're given in numerically form.
diff --git a/README b/README
index c39885d..b639095 100644 (file)
--- a/README
+++ b/README
@@ -275,6 +275,26 @@ Prerequisites
     For compiling on Darwin in general and the `apple_sensors' plugin in
     particular.
 
+
+Crosscompiling
+--------------
+
+    To compile correctly collectd needs to be able to initialize static
+    variables to NAN (Not A Number). Some C libraries, especially the GNU
+    libc, have a problem with that.
+
+    Luckily, with GCC it's possible to work around that problem: One can define
+    NAN as being (0.0 / 0.0) and `isnan' as `f != f'. However, to test this
+    ``implementation'' the configure script needs to compile and run a short
+    test program. Obviously running a test program when doing a cross-
+    compilation is, well, challenging.
+
+    If you run into this problem, you can use the `--with-nan-emulation'
+    configure option to force the use of this implementation. We can't promise
+    that the compiled binary actually behaves as it should, but since NANs
+    are likely never passed to the libm you have a good chance to be lucky.
+
+
 Author
 ------
 
index ff5bcd5..2914b5a 100644 (file)
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(collectd, 4.0.2)
+AC_INIT(collectd, 4.0.3)
 AC_CONFIG_SRCDIR(src/collectd.c)
 AC_CONFIG_HEADERS(src/config.h)
 AM_INIT_AUTOMAKE(dist-bzip2)
@@ -413,7 +413,17 @@ AC_CHECK_FUNCS(getgrgid getpwuid)
 AC_CHECK_FUNCS(getifaddrs)
 
 # Check for NAN
-nan_type="none"
+AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
+[
+ if test "x$withval" = "xno"; then
+        nan_type="none"
+ else if test "x$withval" = "xyes"; then
+        nan_type="zero"
+ else
+        nan_type="$withval"
+ fi; fi
+],
+[nan_type="none"])
 if test "x$nan_type" = "xnone"; then
   AC_CACHE_CHECK([whether NAN is defined by default],
     [have_nan_default],
@@ -436,9 +446,7 @@ static float foo = NAN;
   )
   if test "x$have_nan_default" = "xyes"
   then
-   nan_type="default"
-   AC_DEFINE(NAN_STATIC_DEFAULT, 1,
-     [Define if NAN is defined by default and can initialize static variables.])
+    nan_type="default"
   fi
 fi
 if test "x$nan_type" = "xnone"; then
@@ -464,9 +472,7 @@ static float foo = NAN;
   )
   if test "x$have_nan_isoc" = "xyes"
   then
-   nan_type="isoc99"
-   AC_DEFINE(NAN_STATIC_ISOC, 1,
-     [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
+    nan_type="isoc99"
   fi
 fi
 if test "x$nan_type" = "xnone"; then
@@ -498,14 +504,22 @@ static float foo = NAN;
   )
   if test "x$have_nan_zero" = "xyes"
   then
-   nan_type="zero"
-   AC_DEFINE(NAN_ZERO_ZERO, 1,
-     [Define if NAN can be defined as (0.0 / 0.0)])
+    nan_type="zero"
   fi
 fi
-if test "x$nan_type" = "xnone"; then
+
+if test "x$nan_type" = "xdefault"; then
+  AC_DEFINE(NAN_STATIC_DEFAULT, 1,
+    [Define if NAN is defined by default and can initialize static variables.])
+else if test "x$nan_type" = "xisoc99"; then
+  AC_DEFINE(NAN_STATIC_ISOC, 1,
+    [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
+else if test "x$nan_type" = "xzero"; then
+  AC_DEFINE(NAN_ZERO_ZERO, 1,
+    [Define if NAN can be defined as (0.0 / 0.0)])
+else
   AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
-fi
+fi; fi; fi
 
 # For mount interface
 #AC_CHECK_FUNCS(getfsent getvfsent)
index 18cc062..6c40c07 100644 (file)
@@ -44,7 +44,7 @@ our %EXPORT_TAGS = (
 
 Exporter::export_ok_tags('all');
 
-bootstrap Collectd "4.0.2";
+bootstrap Collectd "4.0.3";
 
 1;
 
index 31b11ab..2459bcf 100644 (file)
@@ -597,4 +597,4 @@ install-exec-hook:
        else \
                $(INSTALL) -m 0640 collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf; \
        fi; \
-       cp -f types.db $(DESTDIR)$(pkglibdir)/;
+       cp -f $(srcdir)/types.db $(DESTDIR)$(pkglibdir)/;
index 99e7a66..4c852a5 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -219,9 +219,9 @@ static int cpu_read (void)
                }
 
                submit (cpu, "user", (counter_t) cpu_info.cpu_ticks[CPU_STATE_USER]);
-               submit (cpu, "nice", (counter_t) cpu_info.cpu_ticks[CPU_STATE_USER]);
-               submit (cpu, "system", (counter_t) cpu_info.cpu_ticks[CPU_STATE_USER]);
-               submit (cpu, "idle", (counter_t) cpu_info.cpu_ticks[CPU_STATE_USER]);
+               submit (cpu, "nice", (counter_t) cpu_info.cpu_ticks[CPU_STATE_NICE]);
+               submit (cpu, "system", (counter_t) cpu_info.cpu_ticks[CPU_STATE_SYSTEM]);
+               submit (cpu, "idle", (counter_t) cpu_info.cpu_ticks[CPU_STATE_IDLE]);
 #endif /* PROCESSOR_CPU_LOAD_INFO */
 #if PROCESSOR_TEMPERATURE
                /*
index fcd707e..192cf52 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
@@ -41,7 +41,7 @@ static int value_list_to_string (char *buffer, int buffer_len,
        int status;
        int i;
 
-       memset (buffer, '\0', sizeof (buffer_len));
+       memset (buffer, '\0', buffer_len);
 
        status = snprintf (buffer, buffer_len, "%u", (unsigned int) vl->time);
        if ((status < 1) || (status >= buffer_len))
index 3c70066..27a65fa 100644 (file)
@@ -241,7 +241,7 @@ static int ping_read (void)
                number_of_hosts++;
        }
 
-       if ((number_of_hosts == 0) && (getuid != 0))
+       if ((number_of_hosts == 0) && (getuid () != 0))
        {
                ERROR ("ping plugin: All hosts failed. Try starting collectd as root.");
        }
index 63dc56d..4d4b87c 100644 (file)
@@ -409,7 +409,7 @@ static int value_list_to_string (char *buffer, int buffer_len,
        int status;
        int i;
 
-       memset (buffer, '\0', sizeof (buffer_len));
+       memset (buffer, '\0', buffer_len);
 
        status = snprintf (buffer, buffer_len, "%u", (unsigned int) vl->time);
        if ((status < 1) || (status >= buffer_len))