summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 30220fc)
raw | patch | inline | side by side (parent: 30220fc)
author | Florian Forster <octo@blarzwurst.de> | |
Mon, 4 May 2009 16:51:51 +0000 (18:51 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 4 May 2009 17:01:58 +0000 (19:01 +0200) |
Unfortunately OpenBSD support is non-trivial to add, so we'll keep that for
later.
later.
configure.in | patch | blob | history | |
src/processes.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 954d967cb536a15481eebaad986049a0ea23962e..df1b187f03c2c15de2408ed6be9090a2163318c8 100644 (file)
--- a/configure.in
+++ b/configure.in
@@ -855,6 +855,37 @@ AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_p
#include <linux/netdevice.h>
])
+AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
+ [
+ AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
+ [Define if struct kinfo_proc exists in the FreeBSD variant.])
+ have_struct_kinfo_proc_freebsd="yes"
+ ],
+ [
+ have_struct_kinfo_proc_freebsd="no"
+ ],
+ [
+#include <kvm.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/user.h>
+ ])
+
+AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
+ [
+ AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
+ [Define if struct kinfo_proc exists in the OpenBSD variant.])
+ have_struct_kinfo_proc_openbsd="yes"
+ ],
+ [
+ have_struct_kinfo_proc_openbsd="no"
+ ],
+ [
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <kvm.h>
+ ])
+
AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
[#if HAVE_STDINT_H
# include <stdint.h>
plugin_processes="yes"
fi
-if test "x$with_kvm_getprocs" = "xyes"
+if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
then
plugin_processes="yes"
fi
diff --git a/src/processes.c b/src/processes.c
index 95c62bba0c47f2b33131da59f33f3264b0eb11a5..a76b57bce80c360aa88eafe808fd5d2246fda440 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
# endif
/* #endif KERNEL_LINUX */
-#elif HAVE_LIBKVM_GETPROCS
+#elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD
# include <kvm.h>
+# include <sys/param.h>
+# include <sys/sysctl.h>
# include <sys/user.h>
# include <sys/proc.h>
-# if HAVE_SYS_SYSCTL_H
-# include <sys/sysctl.h>
-# endif
-/* #endif HAVE_LIBKVM_GETPROCS */
+/* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */
#else
# error "No applicable input method."
static long pagesize_g;
/* #endif KERNEL_LINUX */
-#elif HAVE_LIBKVM_GETPROCS
+#elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD
/* no global variables */
-#endif /* HAVE_LIBKVM_GETPROCS */
+#endif /* HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */
/* put name of process from config to list_head_g tree
list_head_g is a list of 'procstat_t' structs with
pagesize_g, CONFIG_HZ);
/* #endif KERNEL_LINUX */
-#elif HAVE_LIBKVM_GETPROCS
+#elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD
/* no initialization */
-#endif /* HAVE_LIBKVM_GETPROCS */
+#endif /* HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */
return (0);
} /* int ps_init */
ps_submit_proc_list (ps_ptr);
/* #endif KERNEL_LINUX */
-#elif HAVE_LIBKVM_GETPROCS
+#elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD
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_GETPROCS */
+#endif /* HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */
return (0);
} /* int ps_read */