From: ale@biancalanas.net Date: Fri, 1 May 2015 16:48:30 +0000 (+0000) Subject: fixes swap plugin on FreeBSD Jail X-Git-Tag: collectd-5.5.0~12^2~5^2~5 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b5230d45188e81ae58c889fa69e7e87b79359482;p=collectd.git fixes swap plugin on FreeBSD Jail --- diff --git a/src/swap.c b/src/swap.c index 1621f7af..b3aa4f7d 100644 --- a/src/swap.c +++ b/src/swap.c @@ -160,6 +160,8 @@ static int swap_init (void) /* {{{ */ /* #endif defined(VM_SWAPUSAGE) */ #elif HAVE_LIBKVM_GETSWAPINFO + char errbuf[1024]; + if (kvm_obj != NULL) { kvm_close (kvm_obj); @@ -168,14 +170,11 @@ static int swap_init (void) /* {{{ */ kvm_pagesize = getpagesize (); - if ((kvm_obj = kvm_open (NULL, /* execfile */ - NULL, /* corefile */ - NULL, /* swapfile */ - O_RDONLY, /* flags */ - NULL)) /* errstr */ - == NULL) + kvm_obj = kvm_openfiles (NULL, "/dev/null", NULL, O_RDONLY, errbuf); + + if (kvm_obj == NULL) { - ERROR ("swap plugin: kvm_open failed."); + ERROR ("swap plugin: kvm_open failed, %s", errbuf); return (-1); } /* #endif HAVE_LIBKVM_GETSWAPINFO */