unbreak swap fact; sorry, you don't have exabytes of swap.
This commit is contained in:
parent
a62f7fc6c6
commit
bdc6911a16
@ -1,9 +1,10 @@
|
||||
# $OpenBSD: Makefile,v 1.27 2016/05/30 15:07:58 jasper Exp $
|
||||
# $OpenBSD: Makefile,v 1.28 2016/05/31 14:09:55 jasper Exp $
|
||||
|
||||
# XXXTODO: Subpackage facter.jar for use with puppetserver
|
||||
COMMENT = collect and display system facts
|
||||
|
||||
DISTNAME = facter-3.1.7
|
||||
REVISION = 0
|
||||
SHARED_LIBS += facter 3.0 # 3.2
|
||||
PKGSPEC = facter->=3.0,<4.0
|
||||
CATEGORIES = sysutils
|
||||
|
@ -1,9 +1,10 @@
|
||||
$OpenBSD: patch-lib_src_facts_openbsd_memory_resolver_cc,v 1.2 2016/05/30 17:01:44 jasper Exp $
|
||||
$OpenBSD: patch-lib_src_facts_openbsd_memory_resolver_cc,v 1.3 2016/05/31 14:09:55 jasper Exp $
|
||||
|
||||
https://github.com/puppetlabs/facter/pull/1343
|
||||
- https://github.com/puppetlabs/facter/pull/1343
|
||||
- https://github.com/puppetlabs/facter/pull/1345
|
||||
|
||||
--- lib/src/facts/openbsd/memory_resolver.cc.orig Fri May 20 18:36:55 2016
|
||||
+++ lib/src/facts/openbsd/memory_resolver.cc Mon May 30 17:00:25 2016
|
||||
+++ lib/src/facts/openbsd/memory_resolver.cc Tue May 31 15:53:39 2016
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <internal/facts/openbsd/memory_resolver.hpp>
|
||||
-#include <facter/execution/execution.hpp>
|
||||
@ -21,3 +22,22 @@ https://github.com/puppetlabs/facter/pull/1343
|
||||
|
||||
namespace facter { namespace facts { namespace openbsd {
|
||||
|
||||
@@ -49,12 +48,16 @@ namespace facter { namespace facts { namespace openbsd
|
||||
uint64_t swap_used = 0;
|
||||
for (auto &&swap : swapdev) {
|
||||
if (swap.se_flags & SWF_ENABLE) {
|
||||
- result.swap_total += swap.se_nblks * DEV_BSIZE;
|
||||
- swap_used += swap.se_inuse * DEV_BSIZE;
|
||||
+ result.swap_total += swap.se_nblks / (1024 / DEV_BSIZE);
|
||||
+ swap_used += swap.se_inuse / (1024 / DEV_BSIZE);
|
||||
}
|
||||
}
|
||||
|
||||
result.swap_free = result.swap_total - swap_used;
|
||||
+
|
||||
+ // Adjust for expected scale
|
||||
+ result.swap_total *= 1024;
|
||||
+ result.swap_free *= 1024;
|
||||
|
||||
// 0 is for CTL_SWPENC_NAMES' "enable", see uvm_swap_encrypt.h
|
||||
int swap_encrypted_mib[] = { CTL_VM, VM_SWAPENCRYPT, 0 };
|
||||
|
Loading…
x
Reference in New Issue
Block a user