netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=4397b3eafc225217e8425ac43b863ece96dc7e0a

commit 4397b3eafc225217e8425ac43b863ece96dc7e0a
Author: Alastair Poole <nets...@gmail.com>
Date:   Sat Aug 24 16:35:41 2019 +0100

    OpenBSD: Stack issues.
---
 src/system.c        | 5 +++--
 src/tingle/tingle.c | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/system.c b/src/system.c
index 9a0caf4..c8f40db 100644
--- a/src/system.c
+++ b/src/system.c
@@ -249,7 +249,9 @@ _cpu_state_get(cpu_core_t **cores, int ncpu)
         core->idle = idle;
      }
 #elif defined(__OpenBSD__)
-   struct cpustats cpu_times[CPU_STATES];
+   static struct cpustats cpu_times[CPU_STATES];
+   static int cpu_time_mib[] = { CTL_KERN, KERN_CPUSTATS, 0 };
+
    memset(&cpu_times, 0, CPU_STATES * sizeof(struct cpustats));
    if (!ncpu)
      return;
@@ -257,7 +259,6 @@ _cpu_state_get(cpu_core_t **cores, int ncpu)
    for (i = 0; i < ncpu; i++)
      {
         core = cores[i];
-        int cpu_time_mib[] = { CTL_KERN, KERN_CPUSTATS, 0 };
         size = sizeof(struct cpustats);
         cpu_time_mib[2] = i;
         if (sysctl(cpu_time_mib, 3, &cpu_times[i], &size, NULL, 0) < 0)
diff --git a/src/tingle/tingle.c b/src/tingle/tingle.c
index c1a8358..ced4b90 100644
--- a/src/tingle/tingle.c
+++ b/src/tingle/tingle.c
@@ -314,7 +314,9 @@ _cpu_state_get(cpu_core_t **cores, int ncpu)
         core->idle = idle;
      }
 #elif defined(__OpenBSD__)
-   struct cpustats cpu_times[CPU_STATES];
+   static struct cpustats cpu_times[CPU_STATES];
+   static int cpu_time_mib[] = { CTL_KERN, KERN_CPUSTATS, 0 };
+
    memset(&cpu_times, 0, CPU_STATES * sizeof(struct cpustats));
    if (!ncpu)
      return;
@@ -322,7 +324,6 @@ _cpu_state_get(cpu_core_t **cores, int ncpu)
    for (i = 0; i < ncpu; i++)
      {
         core = cores[i];
-        int cpu_time_mib[] = { CTL_KERN, KERN_CPUSTATS, 0 };
         size = sizeof(struct cpustats);
         cpu_time_mib[2] = i;
         if (sysctl(cpu_time_mib, 3, &cpu_times[i], &size, NULL, 0) < 0)

-- 


Reply via email to