openbsd-ports/x11/xfce4/xfce4-systemload/patches/patch-panel-plugin_memswap_c
2008-02-26 17:33:10 +00:00

30 lines
928 B
Plaintext

$OpenBSD: patch-panel-plugin_memswap_c,v 1.3 2008/02/26 17:33:10 landry Exp $
--- panel-plugin/memswap.c.orig Wed Jan 17 19:01:09 2007
+++ panel-plugin/memswap.c Tue Feb 26 09:52:49 2008
@@ -405,20 +405,11 @@ gint read_memswap(gulong *mem, gulong *swap, gulong *M
#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;
}
{