[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenonbeta/icecream/icecream
From: Adriaan de Groot <groot () kde ! org>
Date: 2004-11-27 21:34:54
Message-ID: 20041127213454.4D4201B55C () office ! kde ! org
[Download RAW message or body]
CVS commit by adridg:
Make it compile (again) on FreeBSD 5.3-STABLE. I don't know if it _works_ yet (has it \
ever?), but at least it builds.
M +4 -0 client/local.cpp 1.22
M +4 -0 daemon/environment.cpp 1.26
M +32 -8 daemon/load.cpp 1.15
M +4 -0 daemon/workit.cpp 1.34
M +2 -0 services/logging.cpp 1.4
--- kdenonbeta/icecream/icecream/client/local.cpp #1.21:1.22
@@ -29,4 +29,8 @@
#include <errno.h>
+#ifdef __FreeBSD__
+#include <signal.h>
+#endif
+
#include <comm.h>
#include "client.h"
--- kdenonbeta/icecream/icecream/daemon/environment.cpp #1.25:1.26
@@ -29,4 +29,8 @@
#include <sys/types.h>
#include <sys/wait.h>
+#ifdef __FreeBSD__
+#include <signal.h>
+#endif
+
#include "comm.h"
--- kdenonbeta/icecream/icecream/daemon/load.cpp #1.14:1.15
@@ -25,5 +25,7 @@
#include <fcntl.h>
#ifdef __FreeBSD__
-# include <dkstat.h>
+#include <sys/resource.h>
+#include <sys/sysctl.h>
+#include <devstat.h>
#endif
@@ -58,12 +60,33 @@ static void updateCPULoad( const char* l
{
unsigned long totalTicks;
-#ifdef __FreeBSD__
- unsigned long currUserTicks = cp_time[ CP_USER ];
- unsigned long currSysTicks = cp_time[ CP_SYS ];
- unsigned long currNiceTicks = cp_time[ CP_NICE ];
- unsigned long currIdleTicks = cp_time[ CP_IDLE ];
-#else
unsigned long currUserTicks, currSysTicks, currNiceTicks, currIdleTicks;
+#ifdef __FreeBSD__
+ static int mibs[4] = { 0,0,0,0 };
+ static size_t mibsize = 4;
+ unsigned long ticks[CPUSTATES];
+ size_t mibdatasize = sizeof(ticks);
+
+ if (mibs[0]==0) {
+ if (sysctlnametomib("kern.cp_time",mibs,&mibsize) < 0) {
+ load->userTicks = load->sysTicks = load->niceTicks = load->idleTicks = 0;
+ load->userLoad = load->sysLoad = load->niceLoad = load->idleLoad = 0;
+ mibs[0]=0;
+ return;
+ }
+ }
+ if (sysctl(mibs,mibsize,&ticks,&mibdatasize,NULL,0) < 0) {
+ load->userTicks = load->sysTicks = load->niceTicks = load->idleTicks = 0;
+ load->userLoad = load->sysLoad = load->niceLoad = load->idleLoad = 0;
+ return;
+ } else {
+ currUserTicks = ticks[CP_USER];
+ currNiceTicks = ticks[CP_NICE];
+ currSysTicks = ticks[CP_SYS];
+ currIdleTicks = ticks[CP_IDLE];
+ }
+ (void)(line);
+
+#else
sscanf( line, "%*s %lu %lu %lu %lu", &currUserTicks, &currNiceTicks,
&currSysTicks, &currIdleTicks );
@@ -120,4 +143,5 @@ static unsigned int calculateMemLoad( co
if ((sysctlbyname("vm.stats.vm.v_cache_count", &Cached, &len, NULL, 0) == -1) || \
!len) Cached = 0; /* Doesn't work under FreeBSD v2.2.x */
+ (void)(MemInfoBuf);
#else
MemFree = scan_one( MemInfoBuf, "MemFree" );
@@ -178,5 +202,5 @@ bool fill_stats( unsigned long &mynicelo
#ifdef __FreeBSD__
- memory_fillgrade = calucateMemLoad( 0, MemFree );
+ memory_fillgrade = calculateMemLoad( 0, MemFree );
#else
if ( ( fd = open( "/proc/meminfo", O_RDONLY ) ) < 0 ) {
--- kdenonbeta/icecream/icecream/daemon/workit.cpp #1.33:1.34
@@ -29,4 +29,8 @@
#include <algorithm>
+#ifdef __FreeBSD__
+#include <sys/param.h>
+#endif
+
/* According to earlier standards */
#include <sys/time.h>
--- kdenonbeta/icecream/icecream/services/logging.cpp #1.3:1.4
@@ -65,5 +65,7 @@ void setup_debug(int level, const string
}
+#ifndef __FreeBSD__
#define HAVE_BACKTRACE
+#endif
#ifdef HAVE_BACKTRACE
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic