[Xfce4-commits] <xfce4-systemload-plugin:master> Use only HW_PHYSMEM64 on OpenBSD, HW_SYSMEM is deprecated

Landry Breuil noreply at xfce.org
Wed Apr 18 21:26:01 CEST 2012


Updating branch refs/heads/master
         to 93f14cb8953263958dec926886c5db8e18e8201d (commit)
       from 24923a178bdab38514b46ec1332c006288f2b912 (commit)

commit 93f14cb8953263958dec926886c5db8e18e8201d
Author: Landry Breuil <landry at xfce.org>
Date:   Wed Apr 18 21:11:53 2012 +0200

    Use only HW_PHYSMEM64 on OpenBSD, HW_SYSMEM is deprecated

 panel-plugin/memswap.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/panel-plugin/memswap.c b/panel-plugin/memswap.c
index f45d328..8e8a264 100644
--- a/panel-plugin/memswap.c
+++ b/panel-plugin/memswap.c
@@ -410,20 +410,11 @@ gint read_memswap(gulong *mem, gulong *swap, gulong *MT, gulong *MU, gulong *ST,
 
 #define ARRLEN(X) (sizeof(X)/sizeof(X[0]))
     {
-        static int mib[2];
-        /* 64-bit datatype */
-        if(sizeof(size_t) == 8) {
-            mib[0] = CTL_HW;
-            mib[1] = HW_PHYSMEM64;
-        }
-        /* assume 32-bit datatype */
-        else {
-            mib[0] = CTL_HW;
-            mib[1] = HW_PHYSMEM;
-        }
-        len = sizeof(MTotal);
-        sysctl(mib, ARRLEN(mib), &MTotal, &len, NULL, 0);
-        MTotal >>= 10;
+        static int mib[] = { CTL_HW, HW_PHYSMEM64 };
+        int64_t x;
+        len = sizeof(x);
+        sysctl(mib, ARRLEN(mib), &x, &len, NULL, 0);
+        MTotal = x >> 10;
     }
 
     {


More information about the Xfce4-commits mailing list