summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabs <abs@pkgsrc.org>1999-01-11 01:11:21 +0000
committerabs <abs@pkgsrc.org>1999-01-11 01:11:21 +0000
commit3b5f0faf360a1d66e13fce71d94e3d62600fc27b (patch)
tree4d87a60ebceadd78fa0c13a74309120c2843e33a
parent589c4d364331f90461ac3624f5d0f6b535d4f1e3 (diff)
downloadpkgsrc-3b5f0faf360a1d66e13fce71d94e3d62600fc27b.tar.gz
Modify kcminfo to report memory and processor usage.
Only partial memory information for pre-UVM systems.
-rw-r--r--x11/kdebase/patches/patch-am13
-rw-r--r--x11/kdebase/patches/patch-an13
-rw-r--r--x11/kdebase/patches/patch-ao46
-rw-r--r--x11/kdebase/patches/patch-ap18
-rw-r--r--x11/kdebase/patches/patch-aq98
-rw-r--r--x11/kdebase/patches/patch-ar14
-rw-r--r--x11/kdebase/patches/patch-as64
7 files changed, 266 insertions, 0 deletions
diff --git a/x11/kdebase/patches/patch-am b/x11/kdebase/patches/patch-am
new file mode 100644
index 00000000000..c05fddf1aee
--- /dev/null
+++ b/x11/kdebase/patches/patch-am
@@ -0,0 +1,13 @@
+$NetBSD: patch-am,v 1.1 1999/01/11 01:11:21 abs Exp $
+
+--- kcontrol/info.orig/Makefile.am Sat Jun 27 02:19:37 1998
++++ kcontrol/info/Makefile.am Sun Jan 10 16:31:43 1999
+@@ -5,7 +5,7 @@
+
+ kcminfo_SOURCES = main.cpp memory.cpp processor.cpp
+ BUILT_SOURCES = memory.moc processor.moc
+-noinst_HEADERS = processor.h memory.h memory_linux.cpp memory_fbsd.cpp memory_hpux.cpp memory_sgi.cpp processor_linux.cpp processor_fbsd.cpp processor_hpux.cpp processor_sgi.cpp
++noinst_HEADERS = processor.h memory.h memory_linux.cpp memory_netbsd.cpp memory_fbsd.cpp memory_hpux.cpp memory_sgi.cpp processor_linux.cpp processor_netbsd.cpp processor_fbsd.cpp processor_hpux.cpp processor_sgi.cpp
+
+ EXTRA_DIST = mini-memory.xpm mini-processor.xpm
+
diff --git a/x11/kdebase/patches/patch-an b/x11/kdebase/patches/patch-an
new file mode 100644
index 00000000000..b792ebf7dc9
--- /dev/null
+++ b/x11/kdebase/patches/patch-an
@@ -0,0 +1,13 @@
+$NetBSD: patch-an,v 1.1 1999/01/11 01:11:22 abs Exp $
+
+--- kcontrol/info.orig/Makefile.in Sun Jan 10 13:56:51 1999
++++ kcontrol/info/Makefile.in Sun Jan 10 16:32:00 1999
+@@ -154,7 +154,7 @@
+
+ kcminfo_SOURCES = main.cpp memory.cpp processor.cpp
+ BUILT_SOURCES = memory.moc processor.moc
+-noinst_HEADERS = processor.h memory.h memory_linux.cpp memory_fbsd.cpp memory_hpux.cpp memory_sgi.cpp processor_linux.cpp processor_fbsd.cpp processor_hpux.cpp processor_sgi.cpp
++noinst_HEADERS = processor.h memory.h memory_linux.cpp memory_netbsd.cpp memory_fbsd.cpp memory_hpux.cpp memory_sgi.cpp processor_linux.cpp processor_netbsd.cpp processor_fbsd.cpp processor_hpux.cpp processor_sgi.cpp
+
+ EXTRA_DIST = mini-memory.xpm mini-processor.xpm
+
diff --git a/x11/kdebase/patches/patch-ao b/x11/kdebase/patches/patch-ao
new file mode 100644
index 00000000000..a50c6359ad6
--- /dev/null
+++ b/x11/kdebase/patches/patch-ao
@@ -0,0 +1,46 @@
+$NetBSD: patch-ao,v 1.1 1999/01/11 01:11:22 abs Exp $
+
+--- kcontrol/info.orig/memory.cpp Tue Jun 16 19:52:48 1998
++++ kcontrol/info/memory.cpp Sun Jan 10 16:27:22 1999
+@@ -26,6 +26,23 @@
+ freeMem->setAutoResize(TRUE);
+ freeMem->setFont(courierFont);
+
++#ifdef __NetBSD__
++ activeMem = new QLabel(klocale->translate("Active memory"), this);
++ activeMem->move(8,56);
++ activeMem->setAutoResize(TRUE);
++ activeMem = new QLabel("0k", this);
++ activeMem->move(200,56);
++ activeMem->setAutoResize(TRUE);
++ activeMem->setFont(courierFont);
++
++ inactiveMem = new QLabel(klocale->translate("Inactive memory"), this);
++ inactiveMem->move(8,80);
++ inactiveMem->setAutoResize(TRUE);
++ inactiveMem = new QLabel("0k", this);
++ inactiveMem->move(200,80);
++ inactiveMem->setAutoResize(TRUE);
++ inactiveMem->setFont(courierFont);
++#else
+ sharedMem = new QLabel(klocale->translate("Shared memory"), this);
+ sharedMem->move(8,56);
+ sharedMem->setAutoResize(TRUE);
+@@ -41,6 +58,7 @@
+ bufferMem->move(200,80);
+ bufferMem->setAutoResize(TRUE);
+ bufferMem->setFont(courierFont);
++#endif
+
+ swapMem = new QLabel(klocale->translate("Swap memory"), this);
+ swapMem->move(8,112);
+@@ -84,6 +102,8 @@
+ #include "memory_sgi.cpp"
+ #elif __FreeBSD__
+ #include "memory_fbsd.cpp"
++#elif __NetBSD__
++#include "memory_netbsd.cpp"
+ #elif hpux
+ #include "memory_hpux.cpp"
+ #else
+
diff --git a/x11/kdebase/patches/patch-ap b/x11/kdebase/patches/patch-ap
new file mode 100644
index 00000000000..1e6a79f3ffd
--- /dev/null
+++ b/x11/kdebase/patches/patch-ap
@@ -0,0 +1,18 @@
+$NetBSD: patch-ap,v 1.1 1999/01/11 01:11:22 abs Exp $
+
+--- kcontrol/info.orig/memory.h Mon Nov 17 11:05:18 1997
++++ kcontrol/info/memory.h Sun Jan 10 16:28:19 1999
+@@ -26,7 +26,11 @@
+
+ private:
+
++#ifdef __NetBSD__
++ QLabel *freeMem, *totalMem, *activeMem, *inactiveMem, *swapMem, *freeSwapMem;
++#else
+ QLabel *freeMem, *totalMem, *sharedMem, *bufferMem, *swapMem, *freeSwapMem;
++#endif
+ QTimer *timer;
+
+ public slots:
+diff -N -u kdebase-1.0/kcontrol/info.orig/memory_netbsd.cpp kdebase-1.0/kcontrol/info/memory_netbsd.cpp
+
diff --git a/x11/kdebase/patches/patch-aq b/x11/kdebase/patches/patch-aq
new file mode 100644
index 00000000000..e4b8edb8bbb
--- /dev/null
+++ b/x11/kdebase/patches/patch-aq
@@ -0,0 +1,98 @@
+$NetBSD: patch-aq,v 1.1 1999/01/11 01:11:22 abs Exp $
+
+--- kcontrol/info.orig/memory_netbsd.cpp Wed Dec 31 16:00:00 1969
++++ kcontrol/info/memory_netbsd.cpp Sun Jan 10 16:27:26 1999
+@@ -0,0 +1,93 @@
++#include <sys/param.h>
++#if __NetBSD_Version__ > 103080000
++#define UVM
++#endif
++
++#include <stdlib.h>
++#include <unistd.h>
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#include <vm/vm_swap.h>
++#ifdef UVM
++#include <uvm/uvm_extern.h>
++#endif
++
++void KMemoryWidget::update()
++{
++ struct swapent *swaplist;
++ int mib[2], memory, nswap, rnswap, totalswap, freeswap, usedswap;
++ size_t len;
++#ifdef UVM
++ struct uvmexp uvmexp;
++#endif
++
++ /* memory */
++ mib[0] = CTL_HW;
++ mib[1] = HW_PHYSMEM;
++ len = sizeof(memory);
++ if( sysctl(mib,2,&memory,&len,NULL,0)< 0 )
++ totalMem->setText(klocale->translate("Problem in determining"));
++ else
++ totalMem->setText(format(memory));
++
++#ifdef UVM
++ mib[0] = CTL_VM;
++ mib[1] = VM_UVMEXP;
++ len = sizeof(uvmexp);
++ if ( sysctl(mib, 2, &uvmexp, &len, NULL, 0) < 0 )
++ {
++ freeMem->setText(klocale->translate("Problem in determining"));
++ activeMem->setText(klocale->translate("Problem in determining"));
++ inactiveMem->setText(klocale->translate("Problem in determining"));
++ swapMem->setText(klocale->translate("Problem in determining"));
++ freeSwapMem->setText(klocale->translate("Problem in determining"));
++ }
++ else
++ {
++ freeMem->setText(format((long)uvmexp.free * uvmexp.pagesize));
++ activeMem->setText(format((long)uvmexp.active * uvmexp.pagesize));
++ inactiveMem->setText(format((long)uvmexp.inactive * uvmexp.pagesize));
++ swapMem->setText(format((long)uvmexp.swpages * uvmexp.pagesize));
++ freeSwapMem->setText(format((long)(uvmexp.swpages - uvmexp.swpginuse) *
++ uvmexp.pagesize));
++ }
++#else
++ freeMem->setText(klocale->translate("Not calculated"));
++ activeMem->setText(klocale->translate("Not calculated"));
++ inactiveMem->setText(klocale->translate("Not calculated"));
++
++ /* swap */
++ totalswap = freeswap = usedswap = 0;
++ nswap = swapctl(SWAP_NSWAP,0,0);
++ if ( nswap > 0 )
++ {
++ if ( (swaplist = (struct swapent *)malloc(nswap * sizeof(*swaplist))) )
++ {
++ rnswap = swapctl(SWAP_STATS,swaplist,nswap);
++ if ( rnswap < 0 || rnswap > nswap )
++ totalswap = freeswap = -1; /* Error */
++ else
++ {
++ while ( rnswap-- > 0 )
++ {
++ totalswap += swaplist[rnswap].se_nblks;
++ usedswap += swaplist[rnswap].se_inuse;
++ }
++ freeswap = totalswap - usedswap;
++ }
++ }
++ else
++ totalswap = freeswap = -1; /* Error */
++ if ( totalswap == -1 )
++ {
++ swapMem->setText(klocale->translate("Problem in determining"));
++ freeSwapMem->setText(klocale->translate("Problem in determining"));
++ }
++ else
++ { /* Cast to long for LP64 hosts */
++ swapMem->setText(format(dbtob((long)totalswap)));
++ freeSwapMem->setText(format(dbtob((long)freeswap)));
++ }
++ }
++#endif
++}
diff --git a/x11/kdebase/patches/patch-ar b/x11/kdebase/patches/patch-ar
new file mode 100644
index 00000000000..55fb3f8cc6f
--- /dev/null
+++ b/x11/kdebase/patches/patch-ar
@@ -0,0 +1,14 @@
+$NetBSD: patch-ar,v 1.1 1999/01/11 01:11:22 abs Exp $
+
+--- kcontrol/info.orig/processor.cpp Mon Nov 24 11:23:49 1997
++++ kcontrol/info/processor.cpp Sun Jan 10 16:27:28 1999
+@@ -13,6 +13,8 @@
+ #include "processor_sgi.cpp"
+ #elif __FreeBSD__
+ #include "processor_fbsd.cpp"
++#elif __NetBSD__
++#include "processor_netbsd.cpp"
+ #elif hpux
+ #include "processor_hpux.cpp"
+ #else
+
diff --git a/x11/kdebase/patches/patch-as b/x11/kdebase/patches/patch-as
new file mode 100644
index 00000000000..bce7f5615f6
--- /dev/null
+++ b/x11/kdebase/patches/patch-as
@@ -0,0 +1,64 @@
+$NetBSD: patch-as,v 1.1 1999/01/11 01:11:22 abs Exp $
+
+--- kcontrol/info.orig/processor_netbsd.cpp Wed Dec 31 16:00:00 1969
++++ kcontrol/info/processor_netbsd.cpp Sun Jan 10 16:27:32 1999
+@@ -0,0 +1,59 @@
++#include <stdlib.h>
++#include <sys/param.h>
++#include <sys/types.h>
++#include <sys/sysctl.h>
++
++typedef struct
++ {
++ int string;
++ int name;
++ char *title;
++ } hw_info_mib_list_t;
++
++KProcessorWidget::KProcessorWidget(QWidget *parent, const char *name)
++ : KConfigWidget(parent, name)
++{
++ static hw_info_mib_list_t hw_info_mib_list[]= {
++ { 1, HW_MODEL, "Model : " },
++ { 1, HW_MACHINE, "Machine : " },
++ { 1, HW_MACHINE_ARCH, "Architecture : " },
++ { 0, HW_NCPU, "Number of CPUs : " },
++ { 0, HW_PAGESIZE, "Pagesize : " },
++ { 0,0,0 }
++ };
++ hw_info_mib_list_t *hw_info_mib;
++
++ int mib[2], num;
++ char *buf, numbuf[sizeof(num)*3+1];
++ size_t len;
++
++ lBox = new QListBox(this);
++ lBox->setGeometry(20,20,400,280);
++ lBox->setFont(QFont("Courier"));
++
++ for ( hw_info_mib = hw_info_mib_list ; hw_info_mib->title ; ++hw_info_mib )
++ {
++ mib[0] = CTL_HW;
++ mib[1] = hw_info_mib->name;
++ if ( hw_info_mib->string )
++ {
++ sysctl(mib,2,NULL,&len,NULL,0);
++ if ( (buf = (char*)malloc(len)) )
++ {
++ sysctl(mib,2,buf,&len,NULL,0);
++ lBox->insertItem(QString(hw_info_mib->title) + QString(buf));
++ free(buf);
++ }
++ else
++ lBox->insertItem(QString(hw_info_mib->title) + QString("Unknown"));
++ }
++ else
++ {
++ len = sizeof(num);
++ sysctl(mib,2,&num,&len,NULL,0);
++ sprintf(numbuf,"%d",num);
++ lBox->insertItem(QString(hw_info_mib->title) + QString(numbuf));
++ }
++ }
++}
++