Bug 129655 - Update of sysutils/xosview
Summary: Update of sysutils/xosview
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Cheng-Lung Sung
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-15 14:20 UTC by Udo.Schweigert
Modified: 2009-01-08 17:10 UTC (History)
0 users

See Also:


Attachments
file.diff (2.65 KB, patch)
2008-12-15 14:20 UTC, Udo.Schweigert
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Udo.Schweigert 2008-12-15 14:20:02 UTC
Update of sysutils/xosview:

	- Fix CPU-meter for FreeBSD versions >= 7.0
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2008-12-15 14:20:12 UTC
Responsible Changed
From-To: freebsd-ports-bugs->clsung

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Udo.Schweigert 2008-12-15 15:01:24 UTC
On Mon, Dec 15, 2008 at 14:20:02 +0000, FreeBSD-gnats-submit@FreeBSD.org wrote:
> Thank you very much for your problem report.
> It has the internal identification `ports/129655'.
> The individual assigned to look at your
> report is: freebsd-ports-bugs. 
> 
> You can access the state of your problem report at any time
> via this link:
> 
> http://www.freebsd.org/cgi/query-pr.cgi?pr=129655
> 
> >Category:       ports
> >Responsible:    freebsd-ports-bugs
> >Synopsis:       Update of sysutils/xosview
> >Arrival-Date:   Mon Dec 15 14:20:02 UTC 2008
> 

I was too fast with submitting. Please use this patch, as it also fixes the
diskmeter for FreeBSD >= 6.0 (as well as the CPU meter which is also fixed
for >= 6.0 (not only 7.x))

Udo

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 15:56:07.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 xosview/files/patch-kernel.cc
--- /usr/ports/sysutils/xosview/files/patch-kernel.cc	2006-01-27 09:17:32.000000000 +0100
+++ xosview/files/patch-kernel.cc	2008-12-15 15:53:11.000000000 +0100
@@ -1,5 +1,5 @@
---- bsd/kernel.cc.orig	Tue Oct 14 09:53:17 2003
-+++ bsd/kernel.cc	Fri Jan 27 16:02:27 2006
+--- bsd/kernel.cc.orig	2006-02-18 08:36:06.000000000 +0100
++++ bsd/kernel.cc	2008-12-15 15:46:05.000000000 +0100
 @@ -54,6 +54,7 @@
  #endif
  
@@ -8,7 +8,27 @@
  #include <devstat.h>
  #include <stdlib.h>	/*  For malloc().  */
  void DevStat_Init();
-@@ -211,19 +212,28 @@
+@@ -83,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.  */
+@@ -135,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
+@@ -211,19 +216,28 @@
  
  { "_bufspace" },
  #define BUFSPACE_SYM_INDEX      3
@@ -41,7 +61,7 @@
  
  #endif /*HAVE_DEVSTAT */
  
-@@ -329,7 +339,12 @@
+@@ -329,7 +343,12 @@
    while (nlp && nlp->n_name && strncmp(nlp->n_name, DUMMY_SYM, strlen(DUMMY_SYM))) {
      if ((nlp->n_type == 0) || (nlp->n_value == 0))
        /*errx (-1, "kvm_nlist() lookup failed for symbol '%s'.", nlp->n_name);*/
@@ -54,7 +74,45 @@
      nlp++;
    }
  #ifdef HAVE_DEVSTAT
-@@ -597,13 +612,21 @@
+@@ -402,11 +421,17 @@
+ #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)
+     errx (-1, "Error:  xosview for *BSD expects 5 cpu states!\n");
+-#if defined(__NetBSD_Version__) && __NetBSD_Version__ > 104260000 /* > 1.4Z */
++#if (defined(__NetBSD_Version__) && __NetBSD_Version__ > 104260000) /* > 1.4Z */
+   struct schedstate_percpu ssp;
+   size_t size = sizeof(ssp.spc_cp_time);
+   if (sysctl(mib, 2, ssp.spc_cp_time, &size, NULL, 0) < 0) {
+@@ -423,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
+ }
+ 
+ 
+@@ -597,13 +631,21 @@
  	 * Make sure that the userland devstat version matches the kernel
  	 * devstat version.
  	 */
@@ -76,7 +134,7 @@
  		nodisk++;
  		return;
  	}
-@@ -618,7 +641,11 @@
+@@ -618,7 +660,11 @@
  	 * changed here, since it almost certainly has.  We only look for
  	 * errors.
  	 */
@@ -88,7 +146,7 @@
  		nodisk++;
  		return;
  	}
-@@ -630,7 +657,11 @@
+@@ -630,7 +676,11 @@
  
  	/* only interested in disks */
  	matches = NULL;
@@ -100,7 +158,7 @@
  		nodisk++;
  		return;
  	}
-@@ -645,7 +676,11 @@
+@@ -645,13 +695,18 @@
  	 * device list has changed, so we don't look for return values of 0
  	 * or 1.  If we get back -1, though, there is an error.
  	 */
@@ -112,7 +170,14 @@
  		       &num_selections, &select_generation,
  		       generation, cur.dinfo->devices, num_devices,
  		       matches, num_matches,
-@@ -672,7 +707,11 @@
+ 		       NULL, 0,
+ 		       select_mode, 10, 0) == -1)
+ 		nodisk++;
++
+ }
+ 
+ int
+@@ -672,7 +727,11 @@
  		 * the selection process again, in case a device that we
  		 * were previously displaying has gone away.
  		 */
@@ -124,7 +189,7 @@
  		case -1:
  			return (0);
  		case 1: {
-@@ -680,7 +719,11 @@
+@@ -680,7 +739,11 @@
  
  			num_devices = cur.dinfo->numdevs;
  			generation = cur.dinfo->generation;
@@ -136,7 +201,7 @@
  					    &num_selections, &select_generation,
  					    generation, cur.dinfo->devices,
  					    num_devices, matches, num_matches,
-@@ -704,14 +747,22 @@
+@@ -704,14 +767,22 @@
  		 * Calculate elapsed time up front, since it's the same for all
  		 * devices.
  		 */
@@ -159,7 +224,7 @@
  			return (0);
  		}
  
-@@ -725,7 +776,11 @@
+@@ -725,12 +796,15 @@
  
  			di = dev_select[dn].position;
  
@@ -169,9 +234,17 @@
  			if (compute_stats(&cur.dinfo->devices[di],
 +#endif
  				  &last.dinfo->devices[di], busy_seconds,
- 				  &total_bytes, &total_transfers,
- 				  NULL, NULL,
-@@ -740,7 +795,11 @@
+-				  &total_bytes, &total_transfers,
+-				  NULL, NULL,
+-				  NULL, NULL, 
+-				  NULL, NULL)!= 0)
++				  DSM_TOTAL_BYTES, &total_bytes,
++				  DSM_TOTAL_TRANSFERS, &total_transfers,
++				  DSM_NONE)!= 0)
+ 				  break;
+ 			total_xfers += (int)total_transfers;
+ 			total_xbytes += (int)total_bytes;
+@@ -740,7 +814,11 @@
  		last.dinfo = cur.dinfo;
  		cur.dinfo = tmp_dinfo;
  
@@ -183,7 +256,7 @@
  
  	} else {
  		/* no disks found ? */
-@@ -912,25 +971,26 @@
+@@ -912,25 +990,26 @@
    OpenKDIfNeeded(); 
    nintr = (nlst[EINTRCNT_SYM_INDEX].n_value -
  	   nlst[INTRCNT_SYM_INDEX].n_value)   / sizeof(int);
@@ -217,7 +290,7 @@
      /* FreeBSD has an array of interrupt counts, indexed by device number.
         These are also indirected by IRQ num with intr_countp: */
      safe_kvm_read (nlst[INTRCOUNTP_SYM_INDEX].n_value,
-@@ -944,6 +1004,46 @@
+@@ -944,6 +1023,46 @@
  	    sizeof(unsigned long);
  	intrCount[i] = kvm_intrcnt[idx];
      }
Comment 3 Stefan Walter freebsd_committer freebsd_triage 2009-01-08 17:06:37 UTC
State Changed
From-To: open->closed

Committed, thanks!
Comment 4 dfilter service freebsd_committer freebsd_triage 2009-01-08 17:06:46 UTC
stefan      2009-01-08 17:06:27 UTC

  FreeBSD ports repository

  Modified files:
    sysutils/xosview     Makefile 
    sysutils/xosview/files patch-kernel.cc 
  Log:
  Fix CPU-meter for FreeBSD versions >= 7.0.
  
  PR:             129655
  Submitted by:   Udo Schweigert <udo.schweigert@siemens.com>
  Approved by:    maintainer timeout (3 weeks)
  
  Revision  Changes    Path
  1.44      +1 -1      ports/sysutils/xosview/Makefile
  1.8       +90 -17    ports/sysutils/xosview/files/patch-kernel.cc
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"