summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: abfe65f)
raw | patch | inline | side by side (parent: abfe65f)
author | Florian Forster <octo@huhu.verplant.org> | |
Tue, 19 Aug 2008 07:34:08 +0000 (09:34 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 19 Aug 2008 07:34:08 +0000 (09:34 +0200) |
Link the processes plugin with the `kvm' library if it provides this symbol.
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/processes.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 4a7fdfb2fef66733c358b2d4ead784fa593281d3..02e06fe6df02dd1984a185e70faff31073167b97 100644 (file)
--- a/configure.in
+++ b/configure.in
AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
fi
+AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
+if test "x$with_kvm_getprocs" = "xyes"
+then
+ AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
+ [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
+fi
+AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
+
AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
if test "x$with_kvm_getswapinfo" = "xyes"
then
diff --git a/src/Makefile.am b/src/Makefile.am
index 8d8845ed9a8bb3056d319da3c23526794066752f..789f7f8adaa06448012ab3cb9d8af8ea0f78c8de 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
pkglib_LTLIBRARIES += processes.la
processes_la_SOURCES = processes.c
processes_la_LDFLAGS = -module -avoid-version
+processes_la_LIBADD =
collectd_LDADD += "-dlopen" processes.la
collectd_DEPENDENCIES += processes.la
+if BUILD_WITH_LIBKVM_GETPROCS
+processes_la_LIBADD += -lkvm
+endif
endif
if BUILD_PLUGIN_QMAIL
diff --git a/src/processes.c b/src/processes.c
index 7531a6ae9cc1ac8d06c01ad7d1b7bc8ea7c936d6..257f5bb75ab24b53af80b0410489df74d53b3f34 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
# endif
/* #endif KERNEL_LINUX */
-#elif HAVE_KVM_H
+#elif HAVE_LIBKVM_GETPROCS
# include <kvm.h>
# include <sys/user.h>
# include <sys/proc.h>
# if HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
# endif
-/* #endif HAVE_KVM_H */
+/* #endif HAVE_LIBKVM_GETPROCS */
#else
# error "No applicable input method."
#elif KERNEL_LINUX
static long pagesize_g;
-#endif /* KERNEL_LINUX */
+/* #endif KERNEL_LINUX */
+
+#elif HAVE_LIBKVM_GETPROCS
+/* no global variables */
+#endif /* HAVE_LIBKVM_GETPROCS */
/* put name of process from config to list_head_g tree
list_head_g is a list of 'procstat_t' structs with
pagesize_g = sysconf(_SC_PAGESIZE);
DEBUG ("pagesize_g = %li; CONFIG_HZ = %i;",
pagesize_g, CONFIG_HZ);
-#endif /* KERNEL_LINUX */
+/* #endif KERNEL_LINUX */
+
+#elif HAVE_LIBKVM_GETPROCS
+/* no initialization */
+#endif /* HAVE_LIBKVM_GETPROCS */
return (0);
} /* int ps_init */
ps_submit_proc_list (ps_ptr);
/* #endif KERNEL_LINUX */
-#elif HAVE_LIBKVM
+#elif HAVE_LIBKVM_GETPROCS
int running = 0;
int sleeping = 0;
int zombies = 0;
for (ps_ptr = list_head_g; ps_ptr != NULL; ps_ptr = ps_ptr->next)
ps_submit_proc_list (ps_ptr);
-#endif /* HAVE_LIBKVM */
+#endif /* HAVE_LIBKVM_GETPROCS */
return (0);
} /* int ps_read */