{email,multimeter,users} plugin: Don't pass NULL-pointers to `plugin_submit'.
[collectd.git] / src / memory.c
index 6c89dbc..b8b7229 100644 (file)
@@ -23,6 +23,7 @@
 #include "collectd.h"
 #include "common.h"
 #include "plugin.h"
+#include "utils_debug.h"
 
 #ifdef HAVE_SYS_SYSCTL_H
 # include <sys/sysctl.h>
@@ -40,7 +41,7 @@
 #ifdef HAVE_MACH_HOST_PRIV_H
 # include <mach/host_priv.h>
 #endif
-#ifdef MACH_VM_STATISTICS_H
+#ifdef HAVE_MACH_VM_STATISTICS_H
 # include <mach/vm_statistics.h>
 #endif
 
@@ -213,11 +214,11 @@ static void memory_read (void)
        {
                len = sizeof (int);
                if ((status = sysctlbyname (sysctl_keys[i],
-                                               (void *) &sysctl_vals[i], len,
+                                               (void *) &sysctl_vals[i], &len,
                                                NULL, 0)) < 0)
                {
                        syslog (LOG_ERR, "memory plugin: sysctlbyname (%s): %s",
-                                       sysctl_keys[i], strerror (status));
+                                       sysctl_keys[i], strerror (errno));
                        return;
                }
                DBG ("%26s: %6i", sysctl_keys[i], sysctl_vals[i]);