From kde-solaris Tue Oct 19 22:16:14 2004 From: Christopher Layne Date: Tue, 19 Oct 2004 22:16:14 +0000 To: kde-solaris Subject: [kde-solaris] kdebase/ksysguard/ksysguardd/* various patches Message-Id: <20041019221614.GM28915 () ns1 ! anodized ! com> X-MARC-Message: https://marc.info/?l=kde-solaris&m=109822418708132 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Fba/0zbH8Xs+Fj9o" --Fba/0zbH8Xs+Fj9o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here are patches to fix: 1. Change swap memory statistics reporting entirely from using SC_LIST with swapctl() to SC_AINFO. This actually gives us accurate aggregate swap information that matches with "swap -s". The older method did not. 2. _FILE_OFFSET_BITS=64 continually breaking builds on Solaris machines w/ 32-bit arch's due to and not allowing it under largefile compilation environment (i.e. 32bit arch w/ 64-bit file support). --Fba/0zbH8Xs+Fj9o Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="Memory.c.patch" Index: kdebase/ksysguard/ksysguardd/Solaris/Memory.c =================================================================== RCS file: /home/kde/kdebase/ksysguard/ksysguardd/Solaris/Memory.c,v retrieving revision 1.5 diff -u -3 -p -r1.5 Memory.c --- kdebase/ksysguard/ksysguardd/Solaris/Memory.c 24 Feb 2004 11:30:18 -0000 1.5 +++ kdebase/ksysguard/ksysguardd/Solaris/Memory.c 19 Oct 2004 21:56:52 -0000 @@ -23,11 +23,20 @@ #include #include #include -#include -#include #include "config.h" +/* Stop from crapping out on 32-bit architectures. */ + +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +# undef _FILE_OFFSET_BITS +# define _FILE_OFFSET_BITS 32 +#endif + +#include +#include +#include + #ifdef HAVE_KSTAT #include #endif @@ -103,56 +112,38 @@ void exitMemory( void ) { int updateMemory( void ) { - struct swaptable *swt; - struct swapent *ste; - int i; - int ndevs; + struct anoninfo *am_swap; long swaptotal; long swapfree; - char dummy[128]; + long swapused; #ifdef HAVE_KSTAT kstat_ctl_t *kctl; kstat_t *ksp; kstat_named_t *kdata; #endif /* HAVE_KSTAT */ + swaptotal = swapused = swapfree = 0L; - if( (ndevs = swapctl( SC_GETNSWP, NULL )) < 1 ) - return( 0 ); - if( (swt = (struct swaptable *) malloc( - sizeof( int ) - + ndevs * sizeof( struct swapent ))) == NULL ) - return( 0 ); + if ((am_swap = (struct anoninfo *)malloc(sizeof(struct anoninfo))) == NULL) + return(0); /* - * fill in the required fields and retrieve the info thru swapctl() + * Retrieve overall swap information from anonymous memory structure - + * which is the same way "swap -s" retrieves it's statistics. + * + * swapctl(SC_LIST, void *arg) does not return what we are looking for. */ - swt->swt_n = ndevs; - ste = &(swt->swt_ent[0]); - for( i = 0; i < ndevs; i++ ) { - /* - * since we'renot interested in the path(s), - * we'll re-use the same buffer - */ - ste->ste_path = dummy; - ste++; - } - swapctl( SC_LIST, swt ); - swaptotal = swapfree = 0L; + if (swapctl(SC_AINFO, am_swap) == -1) + return(0); - ste = &(swt->swt_ent[0]); - for( i = 0; i < ndevs; i++ ) { - if( (! (ste->ste_flags & ST_INDEL)) - && (! (ste->ste_flags & ST_DOINGDEL)) ) { - swaptotal += ste->ste_pages; - swapfree += ste->ste_free; - } - ste++; - } - free( swt ); + swaptotal = am_swap->ani_max; + swapused = am_swap->ani_resv; + swapfree = swaptotal - swapused; + + free(am_swap); - totalswap = pagetok( swaptotal ); - freeswap = pagetok( swapfree ); + totalswap = pagetok(swaptotal); + freeswap = pagetok(swapfree); #ifdef HAVE_KSTAT /* --Fba/0zbH8Xs+Fj9o Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="LoadAvg.c.patch" Index: kdebase/ksysguard/ksysguardd/Solaris/LoadAvg.c =================================================================== RCS file: /home/kde/kdebase/ksysguard/ksysguardd/Solaris/LoadAvg.c,v retrieving revision 1.5 diff -u -3 -p -r1.5 LoadAvg.c --- kdebase/ksysguard/ksysguardd/Solaris/LoadAvg.c 24 Feb 2004 11:30:18 -0000 1.5 +++ kdebase/ksysguard/ksysguardd/Solaris/LoadAvg.c 19 Oct 2004 21:56:52 -0000 @@ -24,7 +24,6 @@ #include #include #include -#include #include "config.h" --Fba/0zbH8Xs+Fj9o Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ProcessList.c.patch" Index: kdebase/ksysguard/ksysguardd/Solaris/ProcessList.c =================================================================== RCS file: /home/kde/kdebase/ksysguard/ksysguardd/Solaris/ProcessList.c,v retrieving revision 1.11 diff -u -3 -p -r1.11 ProcessList.c --- kdebase/ksysguard/ksysguardd/Solaris/ProcessList.c 24 Feb 2004 11:30:18 -0000 1.11 +++ kdebase/ksysguard/ksysguardd/Solaris/ProcessList.c 19 Oct 2004 21:56:52 -0000 @@ -20,6 +20,13 @@ */ +/* Stop from crapping out on 32-bit architectures. */ + +#if !defined(_LP64) && _FILE_OFFSET_BITS == 64 +# undef _FILE_OFFSET_BITS +# define _FILE_OFFSET_BITS 32 +#endif + #include #include #include --Fba/0zbH8Xs+Fj9o Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________ This message is from the kde-solaris mailing list. Account management: https://mail.kde.org/mailman/listinfo/kde-solaris. Archives: http://lists.kde.org/. More info: http://www.kde.org/faq.html. --Fba/0zbH8Xs+Fj9o--