diff --git a/sysutils/turbostat/Makefile b/sysutils/turbostat/Makefile index 66bfe421d962..ccc8b1933bf0 100644 --- a/sysutils/turbostat/Makefile +++ b/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/ diff --git a/sysutils/turbostat/files/patch-turbostat.c b/sysutils/turbostat/files/patch-turbostat.c index 67407110c227..bfe11b2212b4 100644 --- a/sysutils/turbostat/files/patch-turbostat.c +++ b/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,177 @@ int parse_int_file(const char *fmt, ...) return value; } @@ -150,13 +150,15 @@ + +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) != 0 && errno != ENOMEM) ++ err(1, "sysctl: kern.sched.topology_spec: failed"); ++ spec = malloc(sz); ++ 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); }