Bug 135681 - xosview shows wrong swapspace size
Summary: xosview shows wrong swapspace size
Status: RESOLVED FIXED
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: X11 Applications (show other bugs)
Version: unspecified
Hardware: All SuSE Linux 10.0
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Dr. Werner Fink
QA Contact: Stefan Dirsch
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-28 15:27 UTC by Olaf Dabrunz
Modified: 2005-11-28 15:38 UTC (History)
0 users

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Dabrunz 2005-11-28 15:27:36 UTC
I have 7 GB swapspace, but the graph in xosview show only about 3GB.

The swapspace calculation in linux/swapmeter.cc overflows, because it is done
in integer. I tested the following fix:

--- linux/swapmeter.cc.orig     2005-11-11 12:45:56.000000000 +0100
+++ linux/swapmeter.cc  2005-11-27 02:10:35.000000000 +0100
@@ -64,9 +64,9 @@ void SwapMeter::getswapinfo( void ){
 
   unit = (sinfo.mem_unit ? sinfo.mem_unit : 1); 
 
-  total_ = sinfo.totalswap * unit;
-  fields_[0] = (sinfo.totalswap - sinfo.freeswap) * unit;
-  fields_[1] = sinfo.freeswap * unit;
+  total_ = 1.0 * sinfo.totalswap * unit;
+  fields_[0] = 1.0 * (sinfo.totalswap - sinfo.freeswap) * unit;
+  fields_[1] = 1.0 * sinfo.freeswap * unit;
 
   if ( total_ == 0 ){
     total_ = 1;
Comment 1 Olaf Dabrunz 2005-11-28 15:38:35 UTC
Submitted the above patch to STABLE.