pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

waybar: fix memory info



Module Name:	pkgsrc-wip
Committed By:	kikadf <kikadf.01%gmail.com@localhost>
Pushed By:	kikadf
Date:		Wed Sep 9 20:03:06 2026 +0200
Changeset:	2fad6fa6e7e69e93d8ee1b8e94ccf30ad38af509

Modified Files:
	waybar/distinfo
Added Files:
	waybar/patches/patch-src_modules_memory_bsd.cpp

Log Message:
waybar: fix memory info

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=2fad6fa6e7e69e93d8ee1b8e94ccf30ad38af509

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 waybar/distinfo                                 |  1 +
 waybar/patches/patch-src_modules_memory_bsd.cpp | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diffs:
diff --git a/waybar/distinfo b/waybar/distinfo
index f57f41f258..b492818b07 100644
--- a/waybar/distinfo
+++ b/waybar/distinfo
@@ -10,6 +10,7 @@ SHA1 (patch-src_factory.cpp) = de849a029ac8b51381bbe4b94ea59ab9c94c44ef
 SHA1 (patch-src_modules_battery.cpp) = 4ee104fb0ed46112c09d8559687d910e08ee93b0
 SHA1 (patch-src_modules_cpu__frequency_bsd.cpp) = 9ad194942940b2b38b0f01d6a96408cd23969269
 SHA1 (patch-src_modules_custom.cpp) = 644740e4862444b7ed33523affe5d97e5fcbdd32
+SHA1 (patch-src_modules_memory_bsd.cpp) = 4880f83108e304eb1e5c0301911fbda01f80639d
 SHA1 (patch-src_modules_simpleclock.cpp) = 7ffa485e5cc9033e090d46133654243cbd1b3f8d
 SHA1 (patch-src_modules_user.cpp) = 7b9d5578a64d2b1fefbecd650549c5e9f8ea19ad
 SHA1 (patch-src_util_icon__loader.cpp) = 29b8f755333ab617263b6f80e20c993025300e9a
diff --git a/waybar/patches/patch-src_modules_memory_bsd.cpp b/waybar/patches/patch-src_modules_memory_bsd.cpp
new file mode 100644
index 0000000000..fe17b0f987
--- /dev/null
+++ b/waybar/patches/patch-src_modules_memory_bsd.cpp
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Fix get_free_memory on NetBSD, avoid underflow
+
+--- src/modules/memory/bsd.cpp.orig	2026-09-09 17:46:47.416277348 +0000
++++ src/modules/memory/bsd.cpp
+@@ -73,10 +73,16 @@ static uint64_t get_free_memory() {
+   if (sysctl(mib, miblen, &uvmexp, &sz, NULL, 0)) {
+     throw std::runtime_error("sysctl vm.uvmexp failed");
+   }
++#ifdef VM_UVMEXP2
++  uint64_t total = get_total_memory();
++  uint64_t used = static_cast<uint64_t>(uvmexp.active + uvmexp.wired) * uvmexp.pagesize;
++  return used < total ? total - used : 0;
++#else
+   return static_cast<uint64_t>(uvmexp.free + uvmexp.inactive + uvmexp.filepages +
+                                uvmexp.execpages) *
+          uvmexp.pagesize;
+ #endif
++#endif
+ }
+ 
+ void waybar::modules::Memory::parseMeminfo() {


Home | Main Index | Thread Index | Old Index