summaryrefslogtreecommitdiff
path: root/x11
diff options
context:
space:
mode:
authortron <tron@pkgsrc.org>1999-07-15 08:46:22 +0000
committertron <tron@pkgsrc.org>1999-07-15 08:46:22 +0000
commit754310ab9665153135dcd007e32013c72adfd6e3 (patch)
treefc92142ab122931731427b4d68512cc5366ff219 /x11
parent6b895cd125777cf83f57e9fca9dc6e22a800624e (diff)
downloadpkgsrc-754310ab9665153135dcd007e32013c72adfd6e3.tar.gz
Adapt "kcminfo" to NetBSD. Patches supplied by Jaromir Dolecek in
PR pkg/7990.
Diffstat (limited to 'x11')
-rw-r--r--x11/kdebase/files/patch-sum9
-rw-r--r--x11/kdebase/patches/patch-am16
-rw-r--r--x11/kdebase/patches/patch-an45
-rw-r--r--x11/kdebase/patches/patch-ao98
-rw-r--r--x11/kdebase/patches/patch-ap18
-rw-r--r--x11/kdebase/patches/patch-aq18
-rw-r--r--x11/kdebase/patches/patch-ar13
-rw-r--r--x11/kdebase/patches/patch-as320
8 files changed, 536 insertions, 1 deletions
diff --git a/x11/kdebase/files/patch-sum b/x11/kdebase/files/patch-sum
index a4a8c50296d..bd85655f665 100644
--- a/x11/kdebase/files/patch-sum
+++ b/x11/kdebase/files/patch-sum
@@ -1,4 +1,4 @@
-$NetBSD: patch-sum,v 1.1 1999/07/09 14:23:27 agc Exp $
+$NetBSD: patch-sum,v 1.2 1999/07/15 08:46:22 tron Exp $
MD5 (patch-aa) = b02c21a3d700b6a6f1f350b0df7c1a57
MD5 (patch-ab) = aa17d01d1afe68ecc9556555779f8c0d
@@ -10,3 +10,10 @@ MD5 (patch-ag) = c9e121403e4f2de2a25e7f1ea8a8ecf4
MD5 (patch-ah) = 109a2d63b2f3ff0d05e2b50251bc1ec5
MD5 (patch-ak) = 073c4980228c29843856cbb3b3883334
MD5 (patch-al) = 148498220dac0b3d280ac213b5925352
+MD5 (patch-am) = 1b7b201d060759a5ae1878fad7252dce
+MD5 (patch-an) = 4cb12dc4a80c1e8f66f619139511e924
+MD5 (patch-ao) = 2a0a9344a99303aae0d5b7816b52f16a
+MD5 (patch-ap) = 747c8fc023114a90e8826feb5a73ad16
+MD5 (patch-aq) = fcaaee7a19064589042d52cd8b1b3844
+MD5 (patch-ar) = 66012da1191f029d9d1296044a6e3a14
+MD5 (patch-as) = 509e621b2e1234df1cd6dbd6b1834daf
diff --git a/x11/kdebase/patches/patch-am b/x11/kdebase/patches/patch-am
new file mode 100644
index 00000000000..4f408e51645
--- /dev/null
+++ b/x11/kdebase/patches/patch-am
@@ -0,0 +1,16 @@
+$NetBSD: patch-am,v 1.3 1999/07/15 08:46:23 tron Exp $
+
+--- kcontrol/info/memory.h.orig Fri Jan 29 19:43:25 1999
++++ kcontrol/info/memory.h Fri Jan 29 19:45:18 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 --git a/x11/kdebase/patches/patch-an b/x11/kdebase/patches/patch-an
new file mode 100644
index 00000000000..5f4d48032bd
--- /dev/null
+++ b/x11/kdebase/patches/patch-an
@@ -0,0 +1,45 @@
+$NetBSD: patch-an,v 1.3 1999/07/15 08:46:23 tron Exp $
+
+--- kcontrol/info/memory.cpp.orig Mon Oct 5 12:17:29 1998
++++ kcontrol/info/memory.cpp Sat Jan 30 00:26:18 1999
+@@ -30,6 +30,23 @@
+ freeMem->setAutoResize(TRUE);
+ freeMem->setFont(courierFont);
+
++#ifdef __NetBSD__
++ activeMem = new QLabel(klocale->translate("Active memory"), this);
++ activeMem->move(STARTX,STARTY+2*DY);
++ activeMem->setAutoResize(TRUE);
++ activeMem = new QLabel("0k", this);
++ activeMem->move(STARTX2,STARTY+2*DY);
++ activeMem->setAutoResize(TRUE);
++ activeMem->setFont(courierFont);
++
++ inactiveMem = new QLabel(klocale->translate("Inactive memory"), this);
++ inactiveMem->move(STARTX,STARTY+3*DY);
++ inactiveMem->setAutoResize(TRUE);
++ inactiveMem = new QLabel("0k", this);
++ inactiveMem->move(STARTX2,STARTY+3*DY);
++ inactiveMem->setAutoResize(TRUE);
++ inactiveMem->setFont(courierFont);
++#else
+ sharedMem = new QLabel(i18n("Shared memory"), this);
+ sharedMem->move(STARTX,STARTY+2*DY);
+ sharedMem->setAutoResize(TRUE);
+@@ -45,6 +62,7 @@
+ bufferMem->move(STARTX2,STARTY+3*DY);
+ bufferMem->setAutoResize(TRUE);
+ bufferMem->setFont(courierFont);
++#endif
+
+ swapMem = new QLabel(i18n("Swap memory"), this);
+ swapMem->move(STARTX,STARTY+5*DY);
+@@ -88,6 +106,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-ao b/x11/kdebase/patches/patch-ao
new file mode 100644
index 00000000000..e0a0afd25a2
--- /dev/null
+++ b/x11/kdebase/patches/patch-ao
@@ -0,0 +1,98 @@
+$NetBSD: patch-ao,v 1.3 1999/07/15 08:46:23 tron Exp $
+
+--- /dev/null Fri Jan 29 20:07:16 1999
++++ kcontrol/info/memory_netbsd.cpp Fri Jan 29 20:04:24 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-ap b/x11/kdebase/patches/patch-ap
new file mode 100644
index 00000000000..315e4ed6f37
--- /dev/null
+++ b/x11/kdebase/patches/patch-ap
@@ -0,0 +1,18 @@
+$NetBSD: patch-ap,v 1.3 1999/07/15 08:46:23 tron Exp $
+
+--- po/cs/kcminfo.po.orig Sat Jan 30 01:04:03 1999
++++ po/cs/kcminfo.po Sat Jan 30 00:53:33 1999
+@@ -205,6 +205,13 @@
+ msgid "Buffer memory"
+ msgstr "Vyrovnávací pamě»"
+
++#: memory.cpp: NetBSD-specific memory types
++msgid "Active memory"
++msgstr "Aktivní pamě»"
++
++msgid "Inactive memory"
++msgstr "Neaktivní pamě»"
++
+ #: memory.cpp:49
+ msgid "Swap memory"
+ msgstr "Swapovací pamě»"
diff --git a/x11/kdebase/patches/patch-aq b/x11/kdebase/patches/patch-aq
new file mode 100644
index 00000000000..07a63239c08
--- /dev/null
+++ b/x11/kdebase/patches/patch-aq
@@ -0,0 +1,18 @@
+$NetBSD: patch-aq,v 1.3 1999/07/15 08:46:25 tron Exp $
+
+--- po/kcminfo.pot.orig Sat Jan 30 00:45:46 1999
++++ po/kcminfo.pot Sat Jan 30 00:53:47 1999
+@@ -200,6 +200,13 @@
+ msgid "Buffer memory"
+ msgstr ""
+
++#: memory.cpp: NetBSD-specific memory types
++msgid "Active memory"
++msgstr ""
++
++msgid "Inactive memory"
++msgstr ""
++
+ #: memory.cpp:49
+ msgid "Swap memory"
+ msgstr ""
diff --git a/x11/kdebase/patches/patch-ar b/x11/kdebase/patches/patch-ar
new file mode 100644
index 00000000000..846a56bf09e
--- /dev/null
+++ b/x11/kdebase/patches/patch-ar
@@ -0,0 +1,13 @@
+$NetBSD: patch-ar,v 1.3 1999/07/15 08:46:26 tron Exp $
+
+--- kcontrol/info/info.cpp.orig Mon Apr 12 11:02:27 1999
++++ kcontrol/info/info.cpp Wed Jul 14 21:25:26 1999
+@@ -116,6 +116,8 @@ bool GetInfo_XServer_Generic( KTabListBo
+ #include "info_fbsd.cpp"
+ #elif hpux
+ #include "info_hpux.cpp"
++#elif __NetBSD__
++#include "info_netbsd.cpp"
+ #elif __svr4__
+ #include "info_svr4.cpp"
+ #else
diff --git a/x11/kdebase/patches/patch-as b/x11/kdebase/patches/patch-as
new file mode 100644
index 00000000000..cc8d7dfc43e
--- /dev/null
+++ b/x11/kdebase/patches/patch-as
@@ -0,0 +1,320 @@
+$NetBSD: patch-as,v 1.3 1999/07/15 08:46:26 tron Exp $
+
+--- kcontrol/info/info_netbsd.cpp.orig Wed Jul 14 21:26:21 1999
++++ kcontrol/info/info_netbsd.cpp Wed Jul 14 21:51:31 1999
+@@ -0,0 +1,315 @@
++/*
++ * $Id: patch-as,v 1.3 1999/07/15 08:46:26 tron Exp $
++ *
++ * info_netbsd.cpp is part of the KDE program kcminfo. This displays
++ * various information about the NetBSD system it's running on.
++ *
++ * CPU info code has been imported from abs's processor.cpp implementation
++ * for KDE 1.0 with only minor formatting changes
++ * SCSI, IRQ, Devices, Audio and Partition Info was implemented by
++ * Jaromir Dolecek <dolecek@ics.muni.cz>
++ */
++
++#define INFO_CPU_AVAILABLE
++#define INFO_IRQ_AVAILABLE
++#define INFO_DMA_AVAILABLE
++#define INFO_PCI_AVAILABLE
++#define INFO_IOPORTS_AVAILABLE
++#define INFO_SOUND_AVAILABLE
++#define INFO_DEVICES_AVAILABLE
++#define INFO_SCSI_AVAILABLE
++#define INFO_PARTITIONS_AVAILABLE
++#define INFO_XSERVER_AVAILABLE
++
++
++/*
++ * all following functions should return TRUE, when the Information
++ * was filled into the lBox-Widget. Returning FALSE indicates that
++ * information was not available.
++ */
++
++#include <sys/types.h>
++#include <sys/param.h>
++#include <sys/sysctl.h>
++
++#include <qfile.h>
++#include <qfontmetrics.h>
++
++/* stdio.h has NULL, but also a lot of extra cruft */
++#ifndef NULL
++#define NULL 0L
++#endif
++
++/* Again avoid the cruft in stdlib.h since malloc() isn't gonna change
++ too often, unless someone decides to de-KNR FreeBSD */
++void *malloc __P((size_t));
++
++typedef struct
++ {
++ int string;
++ int name;
++ char *title;
++ } hw_info_mib_list_t;
++
++bool GetInfo_CPU(KTabListBox *lBox)
++{
++ 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;
++ QString value;
++
++ lBox->setNumCols(2);
++ lBox->setSeparator('');
++ lBox->setColumn(0, i18n("Information"), 150);
++ lBox->setColumn(1, i18n("Value"));
++
++ 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);
++ value = QString(buf);
++ free(buf);
++ }
++ else {
++ value = QString("Unknown");
++ }
++ }
++ else {
++ len = sizeof(num);
++ sysctl(mib,2,&num,&len,NULL,0);
++ value.sprintf("%d", num);
++ }
++ lBox->insertItem(QString(hw_info_mib->title) + QString("") +
++ value);
++ }
++
++ return true;
++}
++
++// this is used to find out which devices are currently
++// on system
++static bool GetDmesgInfo(KTabListBox *lBox, const char *filter,
++ void func(KTabListBox *, QString s, void **, bool))
++{
++ QFile *dmesg = new QFile("/var/run/dmesg.boot");
++ bool usepipe=false;
++ FILE *pipe=NULL;
++ QTextStream *t;
++ bool seencpu=false;
++ void *opaque=NULL;
++ QString s;
++ bool found=false;
++
++ if (dmesg->exists() && dmesg->open(IO_ReadOnly)) {
++ t = new QTextStream(dmesg);
++ }
++ else {
++ delete dmesg;
++ pipe = popen("/sbin/dmesg", "r");
++ if (!pipe) return false;
++ usepipe = true;
++ t = new QTextStream(pipe, IO_ReadOnly);
++ }
++
++ lBox->setAutoUpdate(false);
++ while((s = t->readLine()) != "") {
++ if (!seencpu) {
++ if (s.contains("cpu"))
++ seencpu = true;
++ else
++ continue;
++ }
++ if (s.contains("boot device") ||
++ s.contains("WARNING: old BSD partition ID!"))
++ break;
++
++ if (!filter || s.contains(filter)) {
++ if (func) {
++ func(lBox, s, &opaque, false);
++ }
++ else {
++ lBox->insertItem(s);
++ }
++ found = true;
++ }
++ }
++ if (func) {
++ func(lBox, s, &opaque, true);
++ }
++ lBox->setAutoUpdate(true);
++ lBox->repaint();
++
++ delete t;
++ if (pipe) {
++ pclose(pipe);
++ }
++ else {
++ dmesg->close();
++ delete dmesg;
++ }
++
++ return found;
++}
++
++void AddIRQLine(KTabListBox *lBox, QString s, void **opaque, bool ending)
++{
++ QStrList *strlist = (QStrList *) *opaque;
++ const char *str;
++ int pos, irqnum=0;
++
++ if (!strlist) {
++ strlist = new QStrList();
++ *opaque = (void *) strlist;
++ }
++ if (ending) {
++ str = strlist->first();
++ for(;str; str = strlist->next()) {
++ lBox->insertItem(str);
++ }
++ delete strlist;
++ return;
++ }
++
++ pos = s.find(" irq ");
++ irqnum = (pos < 0) ? 0 : atoi(&(((const char *)s)[pos+5]));
++ if (irqnum) {
++ s.sprintf("%02d%s", irqnum, (const char *)s);
++ }
++ else {
++ s.sprintf("??%s", (const char *)s);
++ }
++ strlist->inSort(s);
++}
++
++bool GetInfo_IRQ (KTabListBox *lBox)
++{
++ lBox->setNumCols(2);
++ lBox->setSeparator('');
++ lBox->setColumn(0, i18n("IRQ"), 150);
++ lBox->setColumn(1, i18n("Device"));
++ (void) GetDmesgInfo(lBox, " irq ", AddIRQLine);
++ return true;
++}
++
++bool GetInfo_DMA (KTabListBox *)
++{
++ return FALSE;
++}
++
++bool GetInfo_PCI (KTabListBox *)
++{
++ return FALSE;
++}
++
++bool GetInfo_IO_Ports (KTabListBox *)
++{
++ return FALSE;
++}
++
++bool GetInfo_Sound (KTabListBox *lbox)
++{
++ if (!GetDmesgInfo(lbox, "audio", NULL))
++ lbox->insertItem(i18n("No audio devices found."));
++ return true;
++}
++
++bool GetInfo_Devices (KTabListBox *lBox)
++{
++ (void) GetDmesgInfo(lBox, NULL, NULL);
++ return true;
++}
++
++bool GetInfo_SCSI (KTabListBox *lbox)
++{
++ if (!GetDmesgInfo(lbox, "scsibus", NULL))
++ lbox->insertItem(i18n("No SCSI devices found."));
++ return true;
++}
++
++bool GetInfo_Partitions (KTabListBox *lbox)
++{
++ int maxwidth[4]={0,0,0};
++
++ QFontMetrics fm(lbox->tableFont());
++ QString s;
++ char *line, *orig_line;
++ const char *device, *mountpoint, *type, *flags;
++ FILE *pipe = popen("/sbin/mount", "r");
++ QTextStream *t;
++
++ if (!pipe) {
++ kdebug(KDEBUG_ERROR, 0, i18n("Ahh couldn't run /sbin/mount!"));
++ return false;
++ }
++ t = new QTextStream(pipe, IO_ReadOnly);
++
++ lbox->setNumCols(4);
++ lbox->setSeparator(';');
++
++ maxwidth[0]=fm.width(i18n("Device"));
++ lbox->setColumn(0, i18n("Device"), maxwidth[0]+2);
++
++ maxwidth[1]=fm.width(i18n("Mount Point"));
++ lbox->setColumn(1, i18n("Mount Point"), maxwidth[1]+2);
++
++ lbox->setColumn(2, i18n("FS Type"));
++ lbox->setColumn(2, i18n("FS Type"), maxwidth[2]+2);
++
++ maxwidth[3]=fm.width(i18n("Mount Options"));
++ lbox->setColumn(3, i18n("Mount Options"));
++
++
++ while ((s = t->readLine()) != "") {
++ orig_line = line = strdup(s);
++
++ device = strsep(&line, " ");
++ if (fm.width(device) > maxwidth[0]) {
++ maxwidth[0]=fm.width(device);
++ lbox->setColumnWidth(0, maxwidth[0]+10);
++ }
++
++ (void) strsep(&line, " "); // cosume word "on"
++ mountpoint = strsep(&line, " ");
++ if (fm.width(mountpoint) > maxwidth[1]) {
++ maxwidth[1]=fm.width(mountpoint);
++ lbox->setColumnWidth(1, maxwidth[1]+10);
++ }
++
++ (void) strsep(&line, " "); // cosume word "type"
++ type = strsep(&line, " ");
++ if (fm.width(type) > maxwidth[2]) {
++ maxwidth[2]=fm.width(type);
++ lbox->setColumnWidth(2, maxwidth[2]+10);
++ }
++
++ flags = line;
++
++ s.sprintf("%s;%s;%s;%s", device, mountpoint, type, flags);
++ lbox->insertItem(s);
++ free(orig_line);
++ }
++
++ delete t;
++ pclose(pipe);
++ return true;
++}
++
++bool GetInfo_XServer_and_Video (KTabListBox *lBox)
++{
++ return GetInfo_XServer_Generic( lBox );
++}
++