From: Florian Forster Date: Mon, 4 May 2009 17:12:00 +0000 (+0200) Subject: Merge branch 'collectd-4.5' into collectd-4.6 X-Git-Tag: collectd-4.7.0~13^2~5 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=c01301e8a69b8d53b06b522b107c97dcb65093ad;hp=218635ab44a8533ef5b23fd1ae78be761ff0600c Merge branch 'collectd-4.5' into collectd-4.6 --- diff --git a/configure.in b/configure.in index 2344cdb5..b4d1d943 100644 --- a/configure.in +++ b/configure.in @@ -876,6 +876,37 @@ AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_p #include ]) +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 +#include +#include +#include + ]) + +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 +#include +#include + ]) + AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [], [#if HAVE_STDINT_H # include @@ -3007,7 +3038,7 @@ then 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 559ba972..4a564214 100644 --- a/src/processes.c +++ b/src/processes.c @@ -86,14 +86,13 @@ # endif /* #endif KERNEL_LINUX */ -#elif HAVE_LIBKVM_GETPROCS +#elif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD # include +# include +# include # include # include -# if HAVE_SYS_SYSCTL_H -# include -# endif -/* #endif HAVE_LIBKVM_GETPROCS */ +/* #endif HAVE_LIBKVM_GETPROCS && HAVE_STRUCT_KINFO_PROC_FREEBSD */ #else # error "No applicable input method." @@ -178,9 +177,9 @@ static mach_msg_type_number_t pset_list_len; 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 @@ -537,9 +536,9 @@ static int ps_init (void) 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 */ @@ -1279,7 +1278,7 @@ static int ps_read (void) 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; @@ -1401,7 +1400,7 @@ static int ps_read (void) 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 */