-#endif /* HAVE_LIBKSTAT */
+/* #endif HAVE_LIBKSTAT */
+
+#elif HAVE_LIBSTATGRAB
+/* no global variables */
+/* endif HAVE_LIBSTATGRAB */
+
+#else
+# error "No applicable input method."
+#endif
port_host = mach_host_self ();
host_page_size (port_host, &pagesize);
port_host = mach_host_self ();
host_page_size (port_host, &pagesize);
- strcpy (vl.host, hostname_g);
- strcpy (vl.plugin, "memory");
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
+ sstrncpy (vl.plugin, "memory", sizeof (vl.plugin));
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
vl.type_instance[sizeof (vl.type_instance) - 1] = '\0';
memory_submit ("active", active);
memory_submit ("inactive", inactive);
memory_submit ("free", free);
memory_submit ("active", active);
memory_submit ("inactive", inactive);
memory_submit ("free", free);
memory_submit ("cache", sysctl_vals[6]);
/* #endif HAVE_SYSCTLBYNAME */
memory_submit ("cache", sysctl_vals[6]);
/* #endif HAVE_SYSCTLBYNAME */
memory_submit ("cached", mem_cached);
memory_submit ("free", mem_free);
}
memory_submit ("cached", mem_cached);
memory_submit ("free", mem_free);
}
memory_submit ("used", mem_used);
memory_submit ("free", mem_free);
memory_submit ("used", mem_used);
memory_submit ("free", mem_free);
- memory_submit ("locked", mem_locked);
-/* #endif defined(HAVE_LIBKSTAT) */
+ memory_submit ("locked", mem_lock);
+/* #endif HAVE_LIBKSTAT */
sg_mem_stats *ios;
if ((ios = sg_get_mem_stats ()) != NULL)
{
memory_submit ("used", ios->used);
sg_mem_stats *ios;
if ((ios = sg_get_mem_stats ()) != NULL)
{
memory_submit ("used", ios->used);
memory_submit ("free", ios->free);
}
#endif /* HAVE_LIBSTATGRAB */
return (0);
}
memory_submit ("free", ios->free);
}
#endif /* HAVE_LIBSTATGRAB */
return (0);
}
plugin_register_init ("memory", memory_init);
plugin_register_read ("memory", memory_read);
plugin_register_init ("memory", memory_init);
plugin_register_read ("memory", memory_read);