[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-solaris
Subject: [kde-solaris] kdebase/ksysguard/ksysguardd/* various patches
From: Christopher Layne <clayne () anodized ! com>
Date: 2004-10-19 22:16:14
Message-ID: 20041019221614.GM28915 () ns1 ! anodized ! com
[Download RAW message or body]
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 <sys/swap.h> and <sys/procfs.h> not allowing it under
largefile compilation environment (i.e. 32bit arch w/ 64-bit file support).
["Memory.c.patch" (text/plain)]
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 <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/swap.h>
#include "config.h"
+/* Stop <sys/swap.h> 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 <sys/stat.h>
+#include <sys/swap.h>
+#include <vm/anon.h>
+
#ifdef HAVE_KSTAT
#include <kstat.h>
#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
/*
["LoadAvg.c.patch" (text/plain)]
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 <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
-#include <sys/swap.h>
#include "config.h"
["ProcessList.c.patch" (text/plain)]
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 <sys/procfs.h> 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 <stdio.h>
#include <stdlib.h>
#include <unistd.h>
___________________________________________________
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.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic