From bb0333e45d42f667a3643f96447e746abe1e1ff0 Mon Sep 17 00:00:00 2001 From: Greg V Date: Thu, 11 Feb 2016 15:52:39 +0300 Subject: [PATCH 1/2] fix process memory on FreeBSD --- freebsd/FreeBSDProcessList.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c index 7c4a6db5..b9359e54 100644 --- a/freebsd/FreeBSDProcessList.c +++ b/freebsd/FreeBSDProcessList.c @@ -477,8 +477,8 @@ void ProcessList_goThroughEntries(ProcessList* this) { } // from FreeBSD source /src/usr.bin/top/machine.c - proc->m_size = kproc->ki_size / 1024; - proc->m_resident = kproc->ki_rssize * pageSizeKb; + proc->m_size = kproc->ki_size / 1024 / pageSizeKb; + proc->m_resident = kproc->ki_rssize; proc->nlwp = kproc->ki_numthreads; proc->time = (kproc->ki_runtime + 5000) / 10000; From cc4267cc5c74468530e3a88374869c85fd44835c Mon Sep 17 00:00:00 2001 From: Hung-Yi Chen Date: Sat, 13 Feb 2016 02:09:50 +0800 Subject: [PATCH 2/2] Suppress compiler warnings. --- freebsd/FreeBSDProcess.c | 4 ++-- freebsd/Platform.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/freebsd/FreeBSDProcess.c b/freebsd/FreeBSDProcess.c index 70cfb954..b0d2c37c 100644 --- a/freebsd/FreeBSDProcess.c +++ b/freebsd/FreeBSDProcess.c @@ -115,7 +115,7 @@ void FreeBSDProcess_writeField(Process* this, RichString* str, ProcessField fiel char buffer[256]; buffer[255] = '\0'; int attr = CRT_colors[DEFAULT_COLOR]; int n = sizeof(buffer) - 1; - switch (field) { + switch ((int) field) { // add FreeBSD-specific fields here case JID: snprintf(buffer, n, Process_pidFormat, fp->jid); break; case JAIL:{ @@ -143,7 +143,7 @@ long FreeBSDProcess_compare(const void* v1, const void* v2) { p2 = (FreeBSDProcess*)v1; p1 = (FreeBSDProcess*)v2; } - switch (settings->sortKey) { + switch ((int) settings->sortKey) { // add FreeBSD-specific fields here case JID: return (p1->jid - p2->jid); diff --git a/freebsd/Platform.c b/freebsd/Platform.c index 9e0c25b0..f02daa5a 100644 --- a/freebsd/Platform.c +++ b/freebsd/Platform.c @@ -24,6 +24,7 @@ in the source distribution for its full text. #include #include #include +#include /*{ #include "Action.h"