[Xfce4-commits] [apps/xfce4-taskmanager] 03/08: Repair memory and swap size calculation on OpenBSD.
noreply at xfce.org
noreply at xfce.org
Thu Dec 4 21:02:48 CET 2014
This is an automated email from the git hooks/post-receive script.
landry pushed a commit to branch master
in repository apps/xfce4-taskmanager.
commit a554ff2e8bee2332f11c3774b7f4e9edbb6f59ec
Author: Landry Breuil <landry at xfce.org>
Date: Thu Dec 4 20:35:17 2014 +0100
Repair memory and swap size calculation on OpenBSD.
---
src/task-manager-bsd.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/task-manager-bsd.c b/src/task-manager-bsd.c
index f37e4c2..e8a06c7 100644
--- a/src/task-manager-bsd.c
+++ b/src/task-manager-bsd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008-2010 Landry Breuil <landry at xfce.org>
+ * Copyright (c) 2008-2014 Landry Breuil <landry at xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -241,10 +241,10 @@ gboolean get_memory_usage (guint64 *memory_total, guint64 *memory_free, guint64
if (sysctl(mib, 2, &uvmexp, &size, NULL, 0) < 0)
errx(1,"failed to get vm.uvmexp");
/* cheat : rm = tot used, add free to get total */
- *memory_total = pagetok(uvmexp.npages);
- *memory_free = pagetok(uvmexp.free);
+ *memory_free = pagetok((guint64)uvmexp.free);
+ *memory_total = pagetok((guint64)uvmexp.npages);
*memory_cache = 0;
- *memory_buffers = pagetok(uvmexp.npages - uvmexp.free -uvmexp.active);
+ *memory_buffers = 0; /*pagetok(uvmexp.npages - uvmexp.free - uvmexp.active);*/
#else
size = sizeof(vmtotal);
if (sysctl(mib, 2, &vmtotal, &size, NULL, 0) < 0)
@@ -272,10 +272,12 @@ gboolean get_memory_usage (guint64 *memory_total, guint64 *memory_free, guint64
*swap_total = *swap_free = 0;
for (i = 0; i < nswap; i++) {
if (swdev[i].se_flags & SWF_ENABLE) {
- *swap_free += ((swdev[i].se_nblks - swdev[i].se_inuse) / DEV_BSIZE);
- *swap_total += (swdev[i].se_nblks / DEV_BSIZE);
+ *swap_free += (swdev[i].se_nblks - swdev[i].se_inuse);
+ *swap_total += swdev[i].se_nblks;
}
}
+ *swap_total *= DEV_BSIZE;
+ *swap_free *= DEV_BSIZE;
free(swdev);
return TRUE;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list