Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Dec 2008 14:38:02 +0100 (CET)
From:      Udo Schweigert <udo.schweigert@siemens.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/129655: Update of sysutils/xosview
Message-ID:  <200812151338.mBFDc2jL065450@alaska.cert.siemens.com>
Resent-Message-ID: <200812151420.mBFEK27X057377@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         129655
>Category:       ports
>Synopsis:       Update of sysutils/xosview
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 15 14:20:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Udo Schweigert
>Release:        FreeBSD 7.1-RC1 i386
>Organization:
>Environment:

>Description:

Update of sysutils/xosview:

	- Fix CPU-meter for FreeBSD versions >= 7.0

>How-To-Repeat:
>Fix:

diff -ruN /usr/ports/sysutils/xosview/Makefile xosview/Makefile
--- /usr/ports/sysutils/xosview/Makefile	2008-04-19 19:53:54.000000000 +0200
+++ xosview/Makefile	2008-12-15 13:57:39.000000000 +0100
@@ -8,7 +8,7 @@
 
 PORTNAME=	xosview
 PORTVERSION=	1.8.3
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	sysutils
 MASTER_SITES=	SF
 
diff -ruN /usr/ports/sysutils/xosview/Makefile xosview/Makefile
--- /usr/ports/sysutils/xosview/Makefile	2008-04-19 19:53:54.000000000 +0200
+++ xosview/Makefile	2008-12-15 13:57:39.000000000 +0100
@@ -8,7 +8,7 @@
 
 PORTNAME=	xosview
 PORTVERSION=	1.8.3
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	sysutils
 MASTER_SITES=	SF
 
diff -ruN /usr/ports/sysutils/xosview/files/patch-kernel.cc.2 xosview/files/patch-kernel.cc.2
--- /usr/ports/sysutils/xosview/files/patch-kernel.cc.2	1970-01-01 01:00:00.000000000 +0100
+++ xosview/files/patch-kernel.cc.2	2008-12-15 14:35:51.000000000 +0100
@@ -0,0 +1,54 @@
+--- bsd/kernel.cc.orig2	2008-12-15 13:01:55.000000000 +0100
++++ bsd/kernel.cc	2008-12-15 13:54:58.000000000 +0100
+@@ -84,6 +84,10 @@
+ #else
+ #include <sys/dkstat.h>
+ #endif
++#if defined(XOSVIEW_FREEBSD) && (__FreeBSD_version >= 700000)
++#include <sys/resource.h>
++#include <sys/sysctl.h>
++#endif
+ 
+ #ifdef HAVE_SWAPCTL
+ #include <unistd.h>		/*  For swapctl proto.  */
+@@ -136,7 +140,7 @@
+ // this later on.  This keeps the indices within the nlist constant.
+ #define DUMMY_SYM "dummy_sym"
+ 
+-#if defined(XOSVIEW_BSDI) || (defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000))
++#if defined(XOSVIEW_BSDI) || (defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000)) || (defined(XOSVIEW_FREEBSD) && (__FreeBSD_version >= 700000))
+ // BSDI and __NetBSD_Version__ >= 104260000 reads cp_time through sysctl
+ { DUMMY_SYM },
+ #define DUMMY_0
+@@ -417,6 +421,12 @@
+ #if defined(XOSVIEW_NETBSD) && (__NetBSD_Version__ >= 104260000)
+   static int mib[] = { CTL_KERN, KERN_CP_TIME };
+ #endif
++#if defined(XOSVIEW_FREEBSD) && (__FreeBSD_version >= 700000)
++
++  long cpu[CPUSTATES];
++  size_t size = sizeof(cpu);
++
++#endif
+ 
+   if (!timeArray) errx (-1, "BSDGetCPUTimes():  passed pointer was null!\n");
+   if (CPUSTATES != 5)
+@@ -438,9 +448,18 @@
+   }
+   bcopy (cpu.cp_time,timeArray,sizeof (long) * CPUSTATES);
+ #else
++#if defined(XOSVIEW_FREEBSD) && (__FreeBSD_version >= 700000)
++
++  if (sysctlbyname("kern.cp_time", &cpu, &size, NULL, 0) < 0) {
++    fprintf(stderr, "xosview: sysctl failed: %s\n", strerror(errno));
++    bzero(&cpu, sizeof(cpu));
++  }
++  bcopy (cpu,timeArray,sizeof (long) * CPUSTATES);
++#else
+   safe_kvm_read_symbol (CP_TIME_SYM_INDEX, timeArray, sizeof (long) * CPUSTATES);
+ #endif
+ #endif
++#endif
+ }
+ 
+ 
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812151338.mBFDc2jL065450>