View | Details | Raw Unified | Return to bug 157195
Collapse All | Expand All

(-)ProcessList.c (-2 / +13 lines)
Lines 31-36 Link Here
31
#include "debug.h"
31
#include "debug.h"
32
#include <assert.h>
32
#include <assert.h>
33
33
34
#ifdef __FreeBSD__
35
#include <sys/types.h>
36
#include <sys/sysctl.h>
37
#endif
38
34
/*{
39
/*{
35
#ifndef PROCDIR
40
#ifndef PROCDIR
36
#define PROCDIR "/proc"
41
#define PROCDIR "/proc"
Lines 313-319 Link Here
313
   unsigned int pid = p->pid;
318
   unsigned int pid = p->pid;
314
   int index = Vector_indexOf(this->processes, p, Process_pidCompare);
319
   int index = Vector_indexOf(this->processes, p, Process_pidCompare);
315
   assert(index != -1);
320
   assert(index != -1);
316
   Vector_remove(this->processes, index);
321
   if (index >= 0) Vector_remove(this->processes, index);
317
   assert(Hashtable_get(this->processTable, pid) == NULL); (void)pid;
322
   assert(Hashtable_get(this->processTable, pid) == NULL); (void)pid;
318
   assert(Hashtable_count(this->processTable) == Vector_count(this->processes));
323
   assert(Hashtable_count(this->processTable) == Vector_count(this->processes));
319
}
324
}
Lines 730-736 Link Here
730
735
731
void ProcessList_scan(ProcessList* this) {
736
void ProcessList_scan(ProcessList* this) {
732
   unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime;
737
   unsigned long long int usertime, nicetime, systemtime, systemalltime, idlealltime, idletime, totaltime;
733
   unsigned long long int swapFree;
738
   unsigned long long int swapFree = 0;
734
739
735
   FILE* status;
740
   FILE* status;
736
   char buffer[128];
741
   char buffer[128];
Lines 766-771 Link Here
766
      }
771
      }
767
   }
772
   }
768
773
774
   #ifdef __FreeBSD__
775
   size_t len = sizeof(this->freeMem);
776
   if (!sysctlbyname("vm.stats.vm.v_free_count", &this->freeMem, &len, NULL, 0))
777
      this->freeMem *= getpagesize() / 1024;
778
   #endif
779
769
   this->usedMem = this->totalMem - this->freeMem;
780
   this->usedMem = this->totalMem - this->freeMem;
770
   this->usedSwap = this->totalSwap - swapFree;
781
   this->usedSwap = this->totalSwap - swapFree;
771
   fclose(status);
782
   fclose(status);

Return to bug 157195