[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenonbeta/icecream/icecream/daemon
From: David Faure <faure () kde ! org>
Date: 2005-03-02 0:51:46
Message-ID: 20050302005146.25C2317A01 () office ! kde ! org
[Download RAW message or body]
CVS commit by faure:
Actually this FreeBSD code seems to work on Mac OS :)
A configure check for the sysctlfoobar function might not be enough though,
since by default the code should probably use /proc...
M +10 -5 load.cpp 1.18
--- kdenonbeta/icecream/icecream/daemon/load.cpp #1.17:1.18
@@ -24,5 +24,10 @@
#include <sys/stat.h>
#include <fcntl.h>
-#ifdef __FreeBSD__
+
+#if defined( __FreeBSD__ ) || defined( MACOS )
+#define USE_SYSCTL
+#endif
+
+#ifdef USE_SYSCTL
#include <sys/resource.h>
#include <sys/sysctl.h>
@@ -62,5 +67,5 @@ static void updateCPULoad( const char* l
unsigned long currUserTicks, currSysTicks, currNiceTicks, currIdleTicks;
-#ifdef __FreeBSD__
+#ifdef USE_SYSCTL
static int mibs[4] = { 0,0,0,0 };
static size_t mibsize = 4;
@@ -131,5 +136,5 @@ static unsigned int calculateMemLoad( co
unsigned long int MemFree;
-#ifdef __FreeBSD__
+#ifdef USE_SYSCTL
size_t len = sizeof (MemFree);
if ((sysctlbyname("vm.stats.vm.v_free_count", &MemFree, &len, NULL, 0) == -1) || !len)
@@ -173,5 +178,5 @@ bool fill_stats( unsigned long &mynicelo
static CPULoadInfo load;
-#ifdef __FreeBSD__
+#ifdef USE_SYSCTL
updateCPULoad( 0, &load );
#else
@@ -203,5 +208,5 @@ bool fill_stats( unsigned long &mynicelo
unsigned long int MemFree = 0;
-#ifdef __FreeBSD__
+#ifdef USE_SYSCTL
memory_fillgrade = calculateMemLoad( 0, MemFree );
#else
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic