From b5230d45188e81ae58c889fa69e7e87b79359482 Mon Sep 17 00:00:00 2001 From: "ale@biancalanas.net" Date: Fri, 1 May 2015 16:48:30 +0000 Subject: [PATCH] fixes swap plugin on FreeBSD Jail --- src/swap.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 */ -- 2.30.2