Merge branch 'collectd-4.3' into collectd-4.4
authorFlorian Forster <octo@huhu.verplant.org>
Tue, 19 Aug 2008 07:26:13 +0000 (09:26 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Tue, 19 Aug 2008 07:26:13 +0000 (09:26 +0200)
configure.in
src/Makefile.am
src/snmp.c
src/swap.c
src/tcpconns.c

index ceb2553..53f2cc4 100644 (file)
@@ -1232,12 +1232,13 @@ then
   AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
 fi
 
-AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
-if test "x$with_libkvm" = "xyes"
+AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
+if test "x$with_kvm_getswapinfo" = "xyes"
 then
-       AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
+       AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
+                 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
 fi
-AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
+AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
 
 with_sensors_cflags=""
 with_sensors_ldflags=""
index a4f9a79..67a79b8 100644 (file)
@@ -590,7 +590,7 @@ endif
 if BUILD_WITH_LIBDEVINFO
 swap_la_LIBADD += -ldevinfo
 endif
-if BUILD_WITH_LIBKVM
+if BUILD_WITH_LIBKVM_GETSWAPINFO
 swap_la_LIBADD += -lkvm
 endif
 if BUILD_WITH_LIBSTATGRAB
index 460624b..408defa 100644 (file)
@@ -1120,10 +1120,6 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
     vb = res->variables;
     if (vb == NULL)
     {
-      if (res != NULL)
-       snmp_free_pdu (res);
-      res = NULL;
-
       status = -1;
       break;
     }
@@ -1132,10 +1128,7 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
      * subtree */
     if (csnmp_check_res_left_subtree (host, data, res) != 0)
     {
-      if (res != NULL)
-       snmp_free_pdu (res);
-      res = NULL;
-
+      status = 0;
       break;
     }
 
@@ -1157,11 +1150,7 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
          (vb != NULL) && (vb->next_variable != NULL);
          vb = vb->next_variable)
        /* do nothing */;
-      if (vb == NULL)
-      {
-       status = -1;
-       break;
-      }
+      assert (vb != NULL);
 
       /* Copy OID to oid_list[data->values_len] */
       memcpy (oid_list[data->values_len].oid, vb->name,
@@ -1224,6 +1213,10 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
     res = NULL;
   } /* while (status == 0) */
 
+  if (res != NULL)
+    snmp_free_pdu (res);
+  res = NULL;
+
   if (status == 0)
     csnmp_dispatch_table (host, data, instance_list, value_table);
 
index 4d1f24d..7fa72dc 100644 (file)
@@ -56,10 +56,10 @@ static kstat_t *ksp;
 /* No global variables */
 /* #endif defined(VM_SWAPUSAGE) */
 
-#elif HAVE_LIBKVM
+#elif HAVE_LIBKVM_GETSWAPINFO
 static kvm_t *kvm_obj = NULL;
 int kvm_pagesize;
-/* #endif HAVE_LIBKVM */
+/* #endif HAVE_LIBKVM_GETSWAPINFO */
 
 #elif HAVE_LIBSTATGRAB
 /* No global variables */
@@ -86,7 +86,7 @@ static int swap_init (void)
        /* No init stuff */
 /* #endif defined(VM_SWAPUSAGE) */
 
-#elif HAVE_LIBKVM
+#elif HAVE_LIBKVM_GETSWAPINFO
        if (kvm_obj != NULL)
        {
                kvm_close (kvm_obj);
@@ -105,7 +105,7 @@ static int swap_init (void)
                ERROR ("swap plugin: kvm_open failed.");
                return (-1);
        }
-/* #endif HAVE_LIBKVM */
+/* #endif HAVE_LIBKVM_GETSWAPINFO */
 
 #elif HAVE_LIBSTATGRAB
        /* No init stuff */
@@ -259,7 +259,7 @@ static int swap_read (void)
        swap_submit ("free", sw_usage.xsu_avail);
 /* #endif VM_SWAPUSAGE */
 
-#elif HAVE_LIBKVM
+#elif HAVE_LIBKVM_GETSWAPINFO
        struct kvm_swap data_s;
        int             status;
 
@@ -285,7 +285,7 @@ static int swap_read (void)
 
        swap_submit ("used", used);
        swap_submit ("free", free);
-/* #endif HAVE_LIBKVM */
+/* #endif HAVE_LIBKVM_GETSWAPINFO */
 
 #elif HAVE_LIBSTATGRAB
        sg_swap_stats *swap;
index 5a8f461..2e11592 100644 (file)
@@ -142,7 +142,7 @@ static void conn_submit_port_entry (port_entry_t *pe)
       || (pe->flags & PORT_COLLECT_LOCAL))
   {
     snprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
-       "%hu-local", pe->port);
+       "%"PRIu16"-local", pe->port);
     vl.plugin_instance[sizeof (vl.plugin_instance) - 1] = '\0';
 
     for (i = 1; i <= TCP_STATE_MAX; i++)
@@ -159,7 +159,7 @@ static void conn_submit_port_entry (port_entry_t *pe)
   if (pe->flags & PORT_COLLECT_REMOTE)
   {
     snprintf (vl.plugin_instance, sizeof (vl.plugin_instance),
-       "%hu-remote", pe->port);
+       "%"PRIu16"-remote", pe->port);
     vl.plugin_instance[sizeof (vl.plugin_instance) - 1] = '\0';
 
     for (i = 1; i <= TCP_STATE_MAX; i++)
@@ -227,7 +227,7 @@ static void conn_reset_port_entry (void)
       port_entry_t *next = pe->next;
 
       DEBUG ("tcpconns plugin: Removing temporary entry "
-         "for listening port %hu", pe->port);
+         "for listening port %"PRIu16, pe->port);
 
       if (prev == NULL)
        port_list_head = next;
@@ -258,8 +258,8 @@ static int conn_handle_ports (uint16_t port_local, uint16_t port_remote, uint8_t
 #endif
      )
   {
-    NOTICE ("tcpconns plugin: Ignoring connection with unknown state 0x%02x.",
-       state);
+    NOTICE ("tcpconns plugin: Ignoring connection with "
+       "unknown state 0x%02"PRIx8".", state);
     return (-1);
   }
 
@@ -271,7 +271,7 @@ static int conn_handle_ports (uint16_t port_local, uint16_t port_remote, uint8_t
       pe->flags |= PORT_IS_LISTENING;
   }
 
-  DEBUG ("tcpconns plugin: Connection %hu <-> %hu (%s)",
+  DEBUG ("tcpconns plugin: Connection %"PRIu16" <-> %"PRIu16" (%s)",
       port_local, port_remote, tcp_state[state]);
 
   pe = conn_get_port_entry (port_local, 0 /* no create */);