small tweaks incorporated while trying to push this upstream

This commit is contained in:
jasper 2015-07-30 07:56:20 +00:00
parent 601667677a
commit 69b2bf2892
3 changed files with 9 additions and 9 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.17 2015/07/23 08:21:28 jasper Exp $
# $OpenBSD: Makefile,v 1.18 2015/07/30 07:56:20 jasper Exp $
COMMENT = collect and display system facts
DISTNAME = facter-3.0.2
REVISION = 0
SHARED_LIBS += facter 3.0 # 3.0
PKGSPEC = facter->=3.0,<4.0
CATEGORIES = sysutils

View File

@ -17,12 +17,11 @@ namespace facter { namespace facts { namespace openbsd {
memory_resolver::data memory_resolver::collect_data(collection& facts)
{
data result;
size_t len;
// Get the system page size
int pagesize_mib[] = { CTL_HW, HW_PAGESIZE};
int page_size = 0;
len = sizeof(page_size);
size_t len = sizeof(page_size);
if (sysctl(pagesize_mib, 2, &page_size, &len, nullptr, 0) == -1) {
LOG_DEBUG("sysctl failed: %1% (%2%): system page size is unknown.", strerror(errno), errno);
} else {
@ -34,8 +33,8 @@ namespace facter { namespace facts { namespace openbsd {
}
// Should we account for the buffer cache?
result.mem_total = (uint64_t) uvmexp.npages << uvmexp.pageshift;
result.mem_free = (uint64_t) uvmexp.free << uvmexp.pageshift;
result.mem_total = static_cast<u_int64_t>(uvmexp.npages) << uvmexp.pageshift;
result.mem_free = static_cast<u_int64_t>(uvmexp.free) << uvmexp.pageshift;
}
#if 0

View File

@ -15,18 +15,18 @@ namespace facter { namespace facts { namespace openbsd {
mib[0] = CTL_HW;
// Get the physical count of processors
len = sizeof(result.logical_count);
len = sizeof(result.physical_count);
mib[1] = HW_NCPUFOUND;
if (sysctl(mib, 2, &result.logical_count, &len, nullptr, 0) == -1) {
if (sysctl(mib, 2, &result.physical_count, &len, nullptr, 0) == -1) {
LOG_DEBUG("sysctl hw.ncpufound failed: %1% (%2%): physical processor count is unavailable.", strerror(errno), errno);
}
// Get the logical count of processors
len = sizeof(result.physical_count);
len = sizeof(result.logical_count);
mib[1] = HW_NCPU;
if (sysctl(mib, 2, &result.physical_count, &len, nullptr, 0) == -1) {
if (sysctl(mib, 2, &result.logical_count, &len, nullptr, 0) == -1) {
LOG_DEBUG("sysctl hw.ncpu failed: %1% (%2%): logical processor count is unavailable.", strerror(errno), errno);
}