diff --git a/sysutils/turbostat/Makefile b/sysutils/turbostat/Makefile index b2784d3b2542..3815b4d3b8bd 100644 --- a/sysutils/turbostat/Makefile +++ b/sysutils/turbostat/Makefile @@ -1,6 +1,6 @@ PORTNAME= turbostat PORTVERSION= 4.17 # Turbostat itself has a version, but we don't bother -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= sysutils MASTER_SITES= https://raw.githubusercontent.com/torvalds/linux/v${PORTVERSION}/tools/power/x86/turbostat/ \ https://raw.githubusercontent.com/torvalds/linux/v${PORTVERSION}/arch/x86/include/asm/ diff --git a/sysutils/turbostat/files/patch-turbostat.c b/sysutils/turbostat/files/patch-turbostat.c index cbfdcb22ddda..ae33628083e8 100644 --- a/sysutils/turbostat/files/patch-turbostat.c +++ b/sysutils/turbostat/files/patch-turbostat.c @@ -23,7 +23,7 @@ +#define CPU_ALLOC(_ign) ({(cpuset_t*)malloc(sizeof(cpuset_t));}) +#define CPU_ALLOC_SIZE(_ign) sizeof(cpuset_t) +#define CPU_FREE free -+#define CPU_ISSET_S(cpu, _ign, set) (set && CPU_ISSET(cpu, set)) ++#define CPU_ISSET_S(cpu, _ign, set) CPU_ISSET(cpu, set) +#define CPU_SET_S(cpu, _ign, set) CPU_SET(cpu, set) +#define CPU_ZERO_S(_ign, set) CPU_ZERO(set) +#define sched_setaffinity(_x, _y, set) cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset_t), set) @@ -445,6 +445,15 @@ /* * NHM adds support for additional MSRs: +@@ -4343,7 +4682,7 @@ void topology_probe() + * Validate that all cpus in cpu_subset are also in cpu_present_set + */ + for (i = 0; i < CPU_SUBSET_MAXCPUS; ++i) { +- if (CPU_ISSET_S(i, cpu_subset_size, cpu_subset)) ++ if (cpu_subset && CPU_ISSET_S(i, cpu_subset_size, cpu_subset)) + if (!CPU_ISSET_S(i, cpu_present_setsize, cpu_present_set)) + err(1, "cpu%d not present", i); + } @@ -4520,8 +4852,21 @@ void setup_all_buffers(void) for_all_proc_cpus(initialize_counters); }