summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorriastradh <riastradh>2016-04-11 01:49:27 +0000
committerriastradh <riastradh>2016-04-11 01:49:27 +0000
commit8e7b9eb8a33f926b7137000d175a69b6dc66249c (patch)
treec6479ab77e8debdfa7b7ef2eafe6961b8e35616b /sysutils
parent674dfc78ae38093ed5ac652b7a8367f96aebac11 (diff)
downloadpkgsrc-8e7b9eb8a33f926b7137000d175a69b6dc66249c.tar.gz
Report memory statistics in NetBSD a little more sensibly.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/conky/distinfo4
-rw-r--r--sysutils/conky/patches/patch-src_netbsd.c44
2 files changed, 29 insertions, 19 deletions
diff --git a/sysutils/conky/distinfo b/sysutils/conky/distinfo
index 7146869836d..377d1b9f07d 100644
--- a/sysutils/conky/distinfo
+++ b/sysutils/conky/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.5 2015/11/04 01:32:08 agc Exp $
+$NetBSD: distinfo,v 1.6 2016/04/11 01:49:27 riastradh Exp $
SHA1 (conky-1.9.0.tar.bz2) = 2069cbdb8e7224fcbf3c6b1ddebf64a51634b4cc
RMD160 (conky-1.9.0.tar.bz2) = 2df0e60d4236ed667bdae876e11ba28d05914e25
@@ -11,7 +11,7 @@ SHA1 (patch-src_config.h.in) = 31aa9cd4bd4ab775e6da633f86415ee8f5383538
SHA1 (patch-src_conky.c) = e4c9173661cca437af0febbcae94eec72dc0ea4a
SHA1 (patch-src_core.c) = a64ff7cb05d7b6b62aea41e486c0a719e2c93faf
SHA1 (patch-src_fs.c) = 104fd3788f319689026702d6a149410184072e24
-SHA1 (patch-src_netbsd.c) = b6af055adea3922a1a8aed8c6ab8795bd1fa2607
+SHA1 (patch-src_netbsd.c) = 6dd3544c02fffe8ab03ecb9560c84f4016345ee6
SHA1 (patch-src_netbsd.h) = 25f9c66eede8e4aaef475d6afcbf79440ec8d7bb
SHA1 (patch-src_read__tcp.c) = 32fca1b7fdfdb2568b056705c7129807e281b0cc
SHA1 (patch-src_text__object.h) = 7f7e3684e21f9618a8ede37525f4a48f47a92050
diff --git a/sysutils/conky/patches/patch-src_netbsd.c b/sysutils/conky/patches/patch-src_netbsd.c
index 219e87bb085..6a9a7d21e11 100644
--- a/sysutils/conky/patches/patch-src_netbsd.c
+++ b/sysutils/conky/patches/patch-src_netbsd.c
@@ -1,10 +1,10 @@
-$NetBSD: patch-src_netbsd.c,v 1.2 2012/11/23 12:30:38 joerg Exp $
+$NetBSD: patch-src_netbsd.c,v 1.3 2016/04/11 01:49:28 riastradh Exp $
Many fixes and addons for conky to work on NetBSD.
--- src/netbsd.c.orig 2012-05-03 21:08:27.000000000 +0000
+++ src/netbsd.c
-@@ -30,337 +30,795 @@
+@@ -30,337 +30,805 @@
#include "netbsd.h"
#include "net_stat.h"
@@ -123,10 +123,9 @@ Many fixes and addons for conky to work on NetBSD.
- sep = (struct swapent *) malloc(n * (sizeof(*sep)));
+ info.memmax = uvmexp.npages * uvmexp.pagesize / 1024;
-+ info.memfree = uvmexp.inactive * uvmexp.pagesize / 1024;
-
-- if (sep == NULL) {
-- warn("memory allocation failed");
++ info.memfree = uvmexp.free * uvmexp.pagesize / 1024;
++ info.memeasyfree = uvmexp.inactive * uvmexp.pagesize / 1024;
++
+ info.swapmax = uvmexp.swpages * uvmexp.pagesize / 1024;
+ info.swapfree = (uvmexp.swpages - uvmexp.swpginuse) * \
+ uvmexp.pagesize / 1024;
@@ -135,10 +134,21 @@ Many fixes and addons for conky to work on NetBSD.
+ info.cached = uvmexp.execpages * uvmexp.pagesize / 1024;
+
+ info.mem = info.memmax - info.memfree;
-+ info.memeasyfree = info.memfree;
+ info.bufmem = info.cached + info.buffers;
+ info.swap = info.swapmax - info.swapfree;
+
++ /*
++ * Counter-adjust for the adjustment in update_stuff in common.c so
++ * that memeasyfree is the inactive memory. Since inactive memory
++ * partially overlaps with buffer memory, but the size of the
++ * overlap is not measured, attempting to split it into non-bufmem
++ * and bufmem parts, as common.c does, can't work. So instead we
++ * report inactive memory as memeasyfree.
++ */
++ info.memeasyfree -= info.bufmem;
+
+- if (sep == NULL) {
+- warn("memory allocation failed");
+ return 0;
+}
+
@@ -480,11 +490,17 @@ Many fixes and addons for conky to work on NetBSD.
+ double v[3];
+
+ getloadavg(v, 3);
-+
+
+- ns->recv += (ifnet.if_ibytes - ns->last_read_recv);
+- ns->last_read_recv = ifnet.if_ibytes;
+- ns->trans += (ifnet.if_obytes - ns->last_read_trans);
+- ns->last_read_trans = ifnet.if_obytes;
+ info.loadavg[0] = (float) v[0];
+ info.loadavg[1] = (float) v[1];
+ info.loadavg[2] = (float) v[2];
-+
+
+- ns->recv_speed = (ns->recv - last_recv) / delta;
+- ns->trans_speed = (ns->trans - last_trans) / delta;
+ return 0;
+}
+
@@ -503,20 +519,14 @@ Many fixes and addons for conky to work on NetBSD.
+{
+ return 1;
+}
-
-- ns->recv += (ifnet.if_ibytes - ns->last_read_recv);
-- ns->last_read_recv = ifnet.if_ibytes;
-- ns->trans += (ifnet.if_obytes - ns->last_read_trans);
-- ns->last_read_trans = ifnet.if_obytes;
++
+/* void */
+char
+get_freq(char *p_client_buffer, size_t client_buffer_size,
+ const char *p_format, int divisor, unsigned int cpu)
+{
+ int freq = cpu;
-
-- ns->recv_speed = (ns->recv - last_recv) / delta;
-- ns->trans_speed = (ns->trans - last_trans) / delta;
++
+ if (!p_client_buffer || client_buffer_size <= 0 || !p_format
+ || divisor <= 0) {
+ return 0;