diff options
author | tron <tron> | 1999-07-19 09:43:07 +0000 |
---|---|---|
committer | tron <tron> | 1999-07-19 09:43:07 +0000 |
commit | 806c14e3fa01ea62821aba4c0a40a8242ce34b55 (patch) | |
tree | 7614f7d21c4b7ee6a69ff53e8fb12a7a38da34e2 | |
parent | f4c8f8a6e38a9fb409818219d5385289885bd62b (diff) | |
download | pkgsrc-806c14e3fa01ea62821aba4c0a40a8242ce34b55.tar.gz |
Add "memory_netbsd.cpp" to package sources directly and link it into
the KDE base sources instead of creating it with patch file.
-rw-r--r-- | x11/kdebase/Makefile | 3 | ||||
-rw-r--r-- | x11/kdebase/files/memory_netbsd.cpp | 95 | ||||
-rw-r--r-- | x11/kdebase/files/patch-sum | 3 | ||||
-rw-r--r-- | x11/kdebase/patches/patch-ao | 98 |
4 files changed, 98 insertions, 101 deletions
diff --git a/x11/kdebase/Makefile b/x11/kdebase/Makefile index 8b18d0b26d5..c803a03cac5 100644 --- a/x11/kdebase/Makefile +++ b/x11/kdebase/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.40 1999/07/15 13:54:30 tron Exp $ +# $NetBSD: Makefile,v 1.41 1999/07/19 09:43:07 tron Exp $ # FreeBSD Id: Makefile,v 1.6 1997/11/27 00:35:27 se Exp DISTNAME= kdebase-1.1.1 @@ -39,6 +39,7 @@ KDE_DIRS= share/doc/kde/HTML/cs share/doc/kde/HTML/da \ post-extract: @${LN} -fs ${FILESDIR}/info_netbsd.cpp ${WRKSRC}/kcontrol/info + @${LN} -fs ${FILESDIR}/memory_netbsd.cpp ${WRKSRC}/kcontrol/info post-install: @${CHMOD} u+s ${PREFIX}/bin/klock diff --git a/x11/kdebase/files/memory_netbsd.cpp b/x11/kdebase/files/memory_netbsd.cpp new file mode 100644 index 00000000000..c70dfe7efc2 --- /dev/null +++ b/x11/kdebase/files/memory_netbsd.cpp @@ -0,0 +1,95 @@ +/* $NetBSD: memory_netbsd.cpp,v 1.1 1999/07/19 09:43:08 tron Exp $ */ + +#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/files/patch-sum b/x11/kdebase/files/patch-sum index 4fa19503631..d1e18aa4866 100644 --- a/x11/kdebase/files/patch-sum +++ b/x11/kdebase/files/patch-sum @@ -1,4 +1,4 @@ -$NetBSD: patch-sum,v 1.3 1999/07/15 13:54:30 tron Exp $ +$NetBSD: patch-sum,v 1.4 1999/07/19 09:43:08 tron Exp $ MD5 (patch-aa) = b02c21a3d700b6a6f1f350b0df7c1a57 MD5 (patch-ab) = aa17d01d1afe68ecc9556555779f8c0d @@ -12,7 +12,6 @@ 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 diff --git a/x11/kdebase/patches/patch-ao b/x11/kdebase/patches/patch-ao deleted file mode 100644 index e0a0afd25a2..00000000000 --- a/x11/kdebase/patches/patch-ao +++ /dev/null @@ -1,98 +0,0 @@ -$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 -+} |