summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-07-04 16:32:24 +0400
committerIgor Pashev <pashev.igor@gmail.com>2013-07-04 16:32:24 +0400
commit6508e283f03fd661fc23817ffa3f926ae4a9d593 (patch)
treeb41896c7b0da66d02fdc94bb2439695bcf1e3749 /sysdeps
parentf69825b4dbfcb9fa1c04be86d81efbcba09cf81b (diff)
downloadhtop-6508e283f03fd661fc23817ffa3f926ae4a9d593.tar.gz
Solaris sysdep_get_meminfo
/*TODO*/ this->sharedMem = 0; this->cachedMem = 0; this->buffersMem = 0;
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/solaris.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sysdeps/solaris.c b/sysdeps/solaris.c
index 89cc9f2..ef3fef9 100644
--- a/sysdeps/solaris.c
+++ b/sysdeps/solaris.c
@@ -1,3 +1,8 @@
+#include <unistd.h>
+#include <string.h>
+#include <sys/swap.h>
+#include <vm/anon.h>
+
#include "htop-sysdeps.h"
/* dummy */
@@ -11,3 +16,25 @@ void sysdep_set_ioprio(pid_t p, IOPriority ioprio)
{
}
+void sysdep_get_meminfo(ProcessList *this)
+{
+ long pageSize;
+
+ pageSize = sysconf(_SC_PAGESIZE) / 1024; // KiB
+
+ this->totalMem = sysconf(_SC_PHYS_PAGES) * pageSize;
+ this->freeMem = sysconf(_SC_AVPHYS_PAGES) * pageSize;
+ this->usedMem = this->totalMem - this->freeMem;
+
+ struct anoninfo ai;
+ memset(&ai, 0, sizeof(ai));
+ (void) swapctl(SC_AINFO, &ai);
+ this->totalSwap = ai.ani_max * pageSize;
+ this->usedSwap = (ai.ani_max - ai.ani_free) * pageSize;
+
+ /*TODO*/
+ this->sharedMem = 0;
+ this->cachedMem = 0;
+ this->buffersMem = 0;
+}
+