update to 3.8.0 and unbreak CPU usage gauge; take maintainership

ok jasper@
This commit is contained in:
robert
2023-05-17 12:44:00 +00:00
parent 14263b9d3f
commit 6b37dfb262
4 changed files with 36 additions and 13 deletions
+2 -2
View File
@@ -2,11 +2,11 @@ COMMENT = CPU, RAM memory, and load monitor for use with tmux(1)
GH_ACCOUNT = thewtex
GH_PROJECT = tmux-mem-cpu-load
GH_TAGNAME = v3.5.1
GH_TAGNAME = v3.8.0
CATEGORIES = sysutils
MAINTAINER = Jasper Lievisse Adriaanse <jasper@openbsd.org>
MAINTAINER = Robert Nagy <robert@openbsd.org>
HOMEPAGE = https://github.com/thewtex/tmux-mem-cpu-load
+2 -2
View File
@@ -1,2 +1,2 @@
SHA256 (tmux-mem-cpu-load-3.5.1.tar.gz) = a2IZe6dV7sd1s/SU22F7I5tenXmUXhZaPIu6O5CS0NE=
SIZE (tmux-mem-cpu-load-3.5.1.tar.gz) = 23020
SHA256 (tmux-mem-cpu-load-3.8.0.tar.gz) = 3rm97e4qqK0OHpXaTC/9/dDSBSiKw8muQsdwzsTfZhU=
SIZE (tmux-mem-cpu-load-3.8.0.tar.gz) = 35245
@@ -3,15 +3,20 @@ Fix CP_STATES definition
Index: common/cpu.h
--- common/cpu.h.orig
+++ common/cpu.h
@@ -36,7 +36,11 @@
@@ -28,12 +28,15 @@
#define CP_IDLE 2
#define CP_NICE 3
#define CP_STATES 4
+#elif defined(__OpenBSD__)
+ #include <sys/sched.h>
+ #define CP_STATES CPUSTATES
#else
#define CP_USER 0
#define CP_NICE 1
#define CP_SYS 2
- #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+ #if defined(__FreeBSD__) || defined(__NetBSD__)
// *BSD or OSX
#define CP_INTR 3
#define CP_IDLE 4
+ #if defined(__OpenBSD__)
+ #define CP_STATES 6
+ #else
#define CP_STATES 5
+ #endif
#else
//linux
#define CP_IDLE 3
@@ -12,3 +12,21 @@ Index: openbsd/cpu.cc
{
int cpu_count = 1; // default to 1
int mib[2] = { CTL_HW, HW_NCPUONLINE };
@@ -35,7 +35,7 @@ uint8_t get_cpu_count()
error( "sysctl: error getting cpu count" );
}
- return cpu_count;
+ return static_cast<uint32_t>( cpu_count );
}
float cpu_percentage( unsigned int cpu_usage_delay )
@@ -54,6 +54,8 @@ float cpu_percentage( unsigned int cpu_usage_delay )
}
usleep( cpu_usage_delay );
+
+ size = sizeof( load2 );
// update cpu times
if( sysctl( cpu_ctl, 2, &load2, &size, NULL, 0 ) < 0 )