pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/x11/kdebase3 Teach ksysguard more about NetBSD. Fixes...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/07b7bee5c384
branches:  trunk
changeset: 519704:07b7bee5c384
user:      markd <markd%pkgsrc.org@localhost>
date:      Sun Oct 08 07:49:27 2006 +0000

description:
Teach ksysguard more about NetBSD.  Fixes PR pkg/28338.
Bump PKGREVISION.

diffstat:

 x11/kdebase3/Makefile         |    3 +-
 x11/kdebase3/distinfo         |    6 +-
 x11/kdebase3/patches/patch-fh |  133 +++++++++++++++++++++++++++++++
 x11/kdebase3/patches/patch-fi |  175 ++++++++++++++++++++++++++++++++++++++++++
 x11/kdebase3/patches/patch-fj |   25 ++++++
 x11/kdebase3/patches/patch-fk |   16 +++
 6 files changed, 356 insertions(+), 2 deletions(-)

diffs (truncated from 397 to 300 lines):

diff -r e32806a0c7c2 -r 07b7bee5c384 x11/kdebase3/Makefile
--- a/x11/kdebase3/Makefile     Sun Oct 08 07:33:13 2006 +0000
+++ b/x11/kdebase3/Makefile     Sun Oct 08 07:49:27 2006 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.117 2006/08/02 13:45:51 markd Exp $
+# $NetBSD: Makefile,v 1.118 2006/10/08 07:49:27 markd Exp $
 
 DISTNAME=      kdebase-${_KDE_VERSION}
+PKGREVISION=   1
 CATEGORIES=    x11
 COMMENT=       Base modules for the KDE 3 integrated X11 desktop
 
diff -r e32806a0c7c2 -r 07b7bee5c384 x11/kdebase3/distinfo
--- a/x11/kdebase3/distinfo     Sun Oct 08 07:33:13 2006 +0000
+++ b/x11/kdebase3/distinfo     Sun Oct 08 07:49:27 2006 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.88 2006/09/19 17:50:46 wiz Exp $
+$NetBSD: distinfo,v 1.89 2006/10/08 07:49:27 markd Exp $
 
 SHA1 (Daemon.README) = eb1e6af52adc02ded77af17e8953134b7e60d23b
 RMD160 (Daemon.README) = 39edd92ed4314397080f32a8caff0ac3f716ecf4
@@ -48,6 +48,10 @@
 SHA1 (patch-fe) = 3da89e7228d5246e98a244d7f52d9052c3dbcfa2
 SHA1 (patch-ff) = a027ccd5f578d41560e970aa54fca9b5760da0ac
 SHA1 (patch-fg) = bdd6fbbf1f82e174d5ceb70e67763813c13b14dd
+SHA1 (patch-fh) = 28e63604888b7b1a84cfadbc0b658347b1f42fbc
+SHA1 (patch-fi) = 80965bb595f91b96c5e417e08ed37af355542ae9
+SHA1 (patch-fj) = 25de89b959a365f57f68557a878cc7dff5f62df5
+SHA1 (patch-fk) = 05b3a6a6451185b3f0eee3a8b9d2001ead62211a
 SHA1 (patch-ga) = 40ab73f3e32e8d8e8c58662df7c5dc54bd4acd29
 SHA1 (patch-gb) = b36e23cf6c64e42269b396f389c5a0e24a40e67e
 SHA1 (patch-gc) = e02ddb93ae7aa249b3b3e68690f587b2c98255b8
diff -r e32806a0c7c2 -r 07b7bee5c384 x11/kdebase3/patches/patch-fh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/kdebase3/patches/patch-fh     Sun Oct 08 07:49:27 2006 +0000
@@ -0,0 +1,133 @@
+$NetBSD: patch-fh,v 1.5 2006/10/08 07:49:27 markd Exp $
+
+--- ksysguard/ksysguardd/NetBSD/CPU.c.orig     2005-10-11 04:04:31.000000000 +1300
++++ ksysguard/ksysguardd/NetBSD/CPU.c
+@@ -19,6 +19,8 @@
+ 
+ */
+ 
++#include <sys/param.h>
++#include <sys/sysctl.h>
+ #include <sys/dkstat.h>
+ #include <sys/sched.h>         /* CPUSTATES */
+ #include <fcntl.h>
+@@ -33,20 +35,13 @@
+ #include "Command.h"
+ #include "ksysguardd.h"
+ 
+-long percentages(int cnt, int *out, long *new, long *old, long *diffs);
+-
+-struct nlist my_nlist[] = {
+-      {"_cp_time"},
+-      { 0 }
+-};
++void percentages(int, int *, u_int64_t *, u_int64_t *, u_int64_t *);
+ 
+ kvm_t *kd;
+ 
+-unsigned long cp_time_offset;
+-
+-long cp_time[CPUSTATES];
+-long cp_old[CPUSTATES];
+-long cp_diff[CPUSTATES];
++u_int64_t cp_time[CPUSTATES];
++u_int64_t cp_old[CPUSTATES];
++u_int64_t cp_diff[CPUSTATES];
+ int cpu_states[CPUSTATES];
+ 
+ void
+@@ -61,9 +56,7 @@ initCpuInfo(struct SensorModul* sm)
+                       printCPUSysInfo, sm);
+       registerMonitor("cpu/idle", "integer", printCPUIdle,
+                       printCPUIdleInfo, sm);
+-      kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open");
+-      kvm_nlist(kd, my_nlist);
+-      cp_time_offset = my_nlist[0].n_value;
++      kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, "kvm_open");
+ 
+       updateCpuInfo();
+ }
+@@ -77,7 +70,13 @@ exitCpuInfo(void)
+ int
+ updateCpuInfo(void)
+ {
+-        kvm_read(kd, cp_time_offset, (char *)cp_time, sizeof(cp_time));
++      int mib[2];
++      size_t size;
++
++      mib[0] = CTL_KERN;
++        mib[1] = KERN_CP_TIME;
++      size = sizeof(cp_time[0]) * CPUSTATES;
++      sysctl(mib, 2, cp_time, &size, NULL, 0);
+         percentages(CPUSTATES, cpu_states, cp_time, cp_old, cp_diff);
+       return (0);
+ }
+@@ -152,20 +151,20 @@ printCPUIdleInfo(const char* cmd)
+  *    useful on BSD mchines for calculating cpu state percentages.
+  */
+ 
+-long percentages(cnt, out, new, old, diffs)
++void percentages(cnt, out, new, old, diffs)
+ 
+ int cnt;
+ int *out;
+-register long *new;
+-register long *old;
+-long *diffs;
++u_int64_t *new;
++u_int64_t *old;
++u_int64_t *diffs;
+ 
+ {
+-    register int i;
+-    register long change;
+-    register long total_change;
+-    register long *dp;
+-    long half_total;
++    int i;
++    u_int64_t change;
++    u_int64_t total_change;
++    u_int64_t *dp;
++    u_int64_t half_total;
+ 
+     /* initialization */
+     total_change = 0;
+@@ -174,12 +173,11 @@ long *diffs;
+     /* calculate changes for each state and the overall change */
+     for (i = 0; i < cnt; i++)
+     {
+-      if ((change = *new - *old) < 0)
+-      {
+-          /* this only happens when the counter wraps */
+-          change = (int)
+-              ((unsigned long)*new-(unsigned long)*old);
+-      }
++        /*
++       * Don't worry about wrapping - even at hz=1GHz, a
++       * u_int64_t will last at least 544 years.
++       */
++        change = *new - *old;
+       total_change += (*dp++ = change);
+       *old++ = *new++;
+     }
+@@ -191,16 +189,9 @@ long *diffs;
+     }
+ 
+     /* calculate percentages based on overall change, rounding up */
+-    half_total = total_change / 2l;
+-
+-    /* Do not divide by 0. Causes Floating point exception */
+-    if(total_change) {
+-        for (i = 0; i < cnt; i++)
+-        {
+-          *out++ = (int)((*diffs++ * 1000 + half_total) / total_change);
+-        }
++    half_total = total_change / 2;
++    for (i = 0; i < cnt; i++)
++    {
++        *out++ = (int)((*diffs++ * 1000 + half_total) / total_change);
+     }
+-
+-    /* return the total in case the caller wants to use it */
+-    return(total_change);
+ }
diff -r e32806a0c7c2 -r 07b7bee5c384 x11/kdebase3/patches/patch-fi
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/kdebase3/patches/patch-fi     Sun Oct 08 07:49:27 2006 +0000
@@ -0,0 +1,175 @@
+$NetBSD: patch-fi,v 1.3 2006/10/08 07:49:27 markd Exp $
+
+--- ksysguard/ksysguardd/NetBSD/Memory.c.orig  2006-10-08 15:49:27.000000000 +1300
++++ ksysguard/ksysguardd/NetBSD/Memory.c
+@@ -45,8 +45,11 @@
+ static size_t Total = 0;
+ static size_t MFree = 0;
+ static size_t Used = 0;
+-static size_t Buffers = 0;
+-static size_t Cached = 0;
++static size_t Active = 0;
++static size_t Inactive = 0;
++static size_t Wired = 0;
++static size_t Execpages = 0;
++static size_t Filepages = 0;
+ static size_t STotal = 0;
+ static size_t SFree = 0;
+ static size_t SUsed = 0;
+@@ -55,19 +58,18 @@ static kvm_t *kd;
+ void
+ initMemory(struct SensorModul* sm)
+ {
+-      char *nlistf = NULL;
+-      char *memf = NULL;
+-      char buf[_POSIX2_LINE_MAX];
+-      
+-      if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, buf)) == NULL) {
+-              log_error("kvm_openfiles()");
++      if ((kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, "kvm_open")) == NULL) {
++              log_error("kvm_open()");
+               return;
+       }
+ 
+         registerMonitor("mem/physical/free", "integer", printMFree, printMFreeInfo, sm);
+       registerMonitor("mem/physical/used", "integer", printUsed, printUsedInfo, sm);
+-      registerMonitor("mem/physical/buf", "integer", printBuffers, printBuffersInfo, sm);
+-      registerMonitor("mem/physical/cached", "integer", printCached, printCachedInfo, sm);
++      registerMonitor("mem/physical/active", "integer", printActive, printActiveInfo, sm);
++      registerMonitor("mem/physical/inactive", "integer", printInactive, printInactiveInfo, sm);
++      registerMonitor("mem/physical/wired", "integer", printWired, printWiredInfo, sm);
++      registerMonitor("mem/physical/execpages", "integer", printExecpages, printExecpagesInfo, sm);
++      registerMonitor("mem/physical/filepages", "integer", printFilepages, printFilepagesInfo, sm);
+       registerMonitor("mem/swap/free", "integer", printSwapFree, printSwapFreeInfo, sm);
+       registerMonitor("mem/swap/used", "integer", printSwapUsed, printSwapUsedInfo, sm);
+ }
+@@ -83,7 +85,6 @@ updateMemory(void)
+ {
+ 
+ #define ARRLEN(X) (sizeof(X)/sizeof(X[0]))
+-  long pagesize; /* using a long promotes the arithmetic */
+   size_t len;
+   
+   {
+@@ -95,37 +96,26 @@ updateMemory(void)
+   }
+  
+   {
+-    struct uvmexp x;
+-    static int mib[] = { CTL_VM, VM_UVMEXP };
++    struct uvmexp_sysctl x;
++    static int mib[] = { CTL_VM, VM_UVMEXP2 };
+     
+     len = sizeof(x);
+     STotal = SUsed = SFree = -1;
+-    pagesize = 1;
++    Active = Inactive = Wired = Execpages = Filepages = MFree = Used = -1;
+     if (-1 < sysctl(mib, ARRLEN(mib), &x, &len, NULL, 0)) {
+-      pagesize = x.pagesize;
+-      STotal = (pagesize*x.swpages) >> 10;
+-      SUsed = (pagesize*x.swpginuse) >> 10;
++      STotal = (x.pagesize*x.swpages) >> 10;
++      SUsed = (x.pagesize*x.swpginuse) >> 10;
+       SFree = STotal - SUsed;
++      MFree = (x.free * x.pagesize) >> 10;
++      Active = (x.active * x.pagesize) >> 10;
++      Inactive = (x.inactive * x.pagesize) >> 10;
++      Wired = (x.wired * x.pagesize) >> 10;
++      Execpages = (x.execpages * x.pagesize) >> 10;
++      Filepages = (x.filepages * x.pagesize) >> 10;
++      Used = Total - MFree;
+     }
+   }
+  
+-  /* can't find NetBSD filesystem buffer info */
+-  Buffers = -1;
+- 
+-  /* NetBSD doesn't know about vm.stats */
+-  Cached = -1;
+-  
+-  {
+-    static int mib[]={ CTL_VM, VM_METER };
+-    struct vmtotal x;
+-    
+-    len = sizeof(x);
+-    MFree = Used = -1;
+-    if (sysctl(mib, ARRLEN(mib), &x, &len, NULL, 0) > -1) {
+-      MFree = (x.t_free * pagesize) >> 10;
+-      Used = (x.t_rm * pagesize) >> 10;
+-    }
+-  }
+   return 0;
+ }
+ 
+@@ -154,27 +144,63 @@ printUsedInfo(const char* cmd)
+ }
+ 
+ void
+-printBuffers(const char* cmd)
++printActive(const char* cmd)
++{
++      fprintf(CurrentClient, "%d\n", Active);
++}
++
++void
++printActiveInfo(const char* cmd)
++{
++      fprintf(CurrentClient, "Active Memory\t0\t%d\tKB\n", Total);
++}
++
++void
++printInactive(const char* cmd)
++{
++      fprintf(CurrentClient, "%d\n", Inactive);
++}
++
++void
++printInactiveInfo(const char* cmd)



Home | Main Index | Thread Index | Old Index