FreeBSD Bugzilla – Attachment 115430 Details for
Bug 157195
[PATCH] sysutils/htop miscalculates available memory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.33 KB, created by
freebsd
on 2011-05-20 01:10:09 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
freebsd
Created:
2011-05-20 01:10:09 UTC
Size:
1.33 KB
patch
obsolete
>--- ProcessList.c.orig 2009-03-11 14:03:42.000000000 +0100 >+++ ProcessList.c 2011-05-20 01:48:22.000000000 +0200 >@@ -31,6 +31,11 @@ > #include "debug.h" > #include <assert.h> > >+#ifdef __FreeBSD__ >+#include <sys/types.h> >+#include <sys/sysctl.h> >+#endif >+ > /*{ > #ifndef PROCDIR > #define PROCDIR "/proc" >@@ -313,7 +318,7 @@ > unsigned int pid = p->pid; > int index = Vector_indexOf(this->processes, p, Process_pidCompare); > assert(index != -1); >- Vector_remove(this->processes, index); >+ if (index >= 0) Vector_remove(this->processes, index); > assert(Hashtable_get(this->processTable, pid) == NULL); (void)pid; > assert(Hashtable_count(this->processTable) == Vector_count(this->processes)); > } >@@ -730,7 +735,7 @@ > > void ProcessList_scan(ProcessList* this) { > unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime; >- unsigned long long int swapFree; >+ unsigned long long int swapFree = 0; > > FILE* status; > char buffer[128]; >@@ -766,6 +771,12 @@ > } > } > >+ #ifdef __FreeBSD__ >+ size_t len = sizeof(this->freeMem); >+ if (!sysctlbyname("vm.stats.vm.v_free_count", &this->freeMem, &len, NULL, 0)) >+ this->freeMem *= getpagesize() / 1024; >+ #endif >+ > this->usedMem = this->totalMem - this->freeMem; > this->usedSwap = this->totalSwap - swapFree; > fclose(status);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 157195
: 115430 |
115431
|
115432
|
115433
|
115434
|
115435