Skip to content

Commit d490c24

Browse files
Copilotrdementi
andcommitted
Fix FreeBSD compilation error: use cpuset_getaffinity instead of cpuset_getdomain
Co-authored-by: rdementi <25432609+rdementi@users.noreply.github.com>
1 parent 2b1a925 commit d490c24

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/cpucounters.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include <sys/ioccom.h>
3838
#include <sys/cpuctl.h>
3939
#include <machine/cpufunc.h>
40-
#include <sys/domainset.h>
4140
#endif
4241

4342
#ifdef _MSC_VER
@@ -7493,9 +7492,9 @@ int32 PCM::mapNUMANodeToSocket(uint32 numa_node_id) const
74937492
cpuset_t cpuset;
74947493
CPU_ZERO(&cpuset);
74957494

7496-
// cpuset_getdomain returns the cpuset for a specific domain
7497-
if (cpuset_getdomain(CPU_LEVEL_WHICH, CPU_WHICH_DOMAIN, numa_node_id,
7498-
sizeof(cpuset), &cpuset, DOMAINSET_POLICY_PREFER) == 0)
7495+
// cpuset_getaffinity with CPU_WHICH_DOMAIN returns the cpuset for a specific NUMA domain
7496+
if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_DOMAIN, numa_node_id,
7497+
sizeof(cpuset), &cpuset) == 0)
74997498
{
75007499
// Find the first CPU in this domain's cpuset
75017500
for (size_t cpu = 0; cpu < topology.size(); ++cpu)
@@ -7510,7 +7509,7 @@ int32 PCM::mapNUMANodeToSocket(uint32 numa_node_id) const
75107509
}
75117510
else
75127511
{
7513-
DBG(2, "cpuset_getdomain failed for domain ", numa_node_id);
7512+
DBG(2, "cpuset_getaffinity failed for domain ", numa_node_id);
75147513
}
75157514
#endif
75167515

0 commit comments

Comments
 (0)