Index: sysutils/turbostat/Makefile =================================================================== --- sysutils/turbostat/Makefile +++ sysutils/turbostat/Makefile @@ -2,7 +2,7 @@ PORTNAME= turbostat PORTVERSION= 4.17 # Turbostat itself has a version, but we don't bother -PORTREVISION= 1 +PORTREVISION= 2 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/ Index: sysutils/turbostat/files/patch-turbostat.c =================================================================== --- sysutils/turbostat/files/patch-turbostat.c +++ sysutils/turbostat/files/patch-turbostat.c @@ -1,4 +1,4 @@ ---- turbostat.c.orig 2018-07-31 20:42:12 UTC +--- turbostat.c.orig 2020-11-13 21:55:04 UTC +++ turbostat.c @@ -41,7 +41,31 @@ #include @@ -99,7 +99,7 @@ /* * Each string in this array is compared in --show and --hide cmdline. -@@ -2239,6 +2288,173 @@ int parse_int_file(const char *fmt, ...) +@@ -2239,6 +2288,176 @@ int parse_int_file(const char *fmt, ...) return value; } @@ -150,13 +150,16 @@ + +static void read_topology_spec(void) +{ -+ char spec[16384]; -+ size_t sz = sizeof(spec) - 1; -+ char *i; ++ char *spec, *i; ++ size_t sz = 0; + ++ if (sysctlbyname("kern.sched.topology_spec", NULL, &sz, NULL, 0) != ENOMEM) ++ err(1, "sysctl: kern.sched.topology_spec: failed"); ++ spec = malloc(sz + 1); ++ if (spec == NULL) ++ err(1, "malloc: failed"); + if (sysctlbyname("kern.sched.topology_spec", spec, &sz, NULL, 0)) + err(1, "sysctl: kern.sched.topology_spec: failed"); -+ spec[sizeof(spec) - 1] = '\0'; + + /* Skip the entire system entry. */ + i = strstr(spec, " 1) fprintf(outf, "base_cpu = %d\n", base_cpu); }