From 728b04bbb5667291f1e56058240fcd7e03cbfe74 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 26 Aug 2020 10:15:00 +1000 Subject: Merge branch 'ci-hwloc-job' of https://github.com/bertwesarg/htop into bertwesarg-ci-hwloc-job --- ProcessList.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'ProcessList.c') diff --git a/ProcessList.c b/ProcessList.c index edbc114c..36b494e2 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -93,12 +93,19 @@ ProcessList* ProcessList_init(ProcessList* this, ObjectClass* klass, UsersTable* #ifdef HAVE_LIBHWLOC this->topologyOk = false; - int topoErr = hwloc_topology_init(&this->topology); - if (topoErr == 0) { - topoErr = hwloc_topology_load(this->topology); - } - if (topoErr == 0) { - this->topologyOk = true; + if (hwloc_topology_init(&this->topology) == 0) { + this->topologyOk = + #if HWLOC_API_VERSION < 0x00020000 + /* try to ignore the top-level machine object type */ + 0 == hwloc_topology_ignore_type_keep_structure(this->topology, HWLOC_OBJ_MACHINE) && + /* ignore caches, which don't add structure */ + 0 == hwloc_topology_ignore_type_keep_structure(this->topology, HWLOC_OBJ_CORE) && + 0 == hwloc_topology_ignore_type_keep_structure(this->topology, HWLOC_OBJ_CACHE) && + 0 == hwloc_topology_set_flags(this->topology, HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM) && + #else + 0 == hwloc_topology_set_all_types_filter(this->topology, HWLOC_TYPE_FILTER_KEEP_STRUCTURE) && + #endif + 0 == hwloc_topology_load(this->topology); } #endif -- cgit v1.2.3