Re: 2.5.70 latest: breaks gnome

From: Andrew Morton (akpm@digeo.com)
Date: Thu Jun 05 2003 - 18:11:32 EST


Edward Tandi <ed@efix.biz> wrote:
>
> 2) xosview still freezes (reading /proc/*)

OK, here's a quick hack to get xosview-1.8.0 working on 2.5.x kernels.

 xosview-1.8.0-akpm/linux/cpumeter.cc | 5 ++++-
 xosview-1.8.0-akpm/linux/diskmeter.cc | 2 ++
 xosview-1.8.0-akpm/linux/pagemeter.cc | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff -puN linux/diskmeter.cc~proc-stats-hang-fix linux/diskmeter.cc
--- xosview-1.8.0/linux/diskmeter.cc~proc-stats-hang-fix Thu Jun 5 16:02:34 2003
+++ xosview-1.8.0-akpm/linux/diskmeter.cc Thu Jun 5 16:02:53 2003
@@ -64,6 +64,8 @@ void DiskMeter::getdiskinfo( void )
         {
         stats.ignore(1024, '\n');
         stats >> buf;
+ if (stats.eof())
+ break;
         }
 
         // read values
diff -puN linux/cpumeter.cc~proc-stats-hang-fix linux/cpumeter.cc
--- xosview-1.8.0/linux/cpumeter.cc~proc-stats-hang-fix Thu Jun 5 16:07:14 2003
+++ xosview-1.8.0-akpm/linux/cpumeter.cc Thu Jun 5 16:07:42 2003
@@ -58,8 +58,11 @@ void CPUMeter::getcputime( void ){
   }
 
   // read until we are at the right line.
- for (int i = 0 ; i < _lineNum ; i++)
+ for (int i = 0 ; i < _lineNum ; i++) {
+ if (stats.eof())
+ break;
     stats.getline(tmp, 1024);
+ }
 
   stats >>tmp >>cputime_[cpuindex_][0]
>>cputime_[cpuindex_][1]
diff -puN linux/pagemeter.cc~proc-stats-hang-fix linux/pagemeter.cc
--- xosview-1.8.0/linux/pagemeter.cc~proc-stats-hang-fix Thu Jun 5 16:07:55 2003
+++ xosview-1.8.0-akpm/linux/pagemeter.cc Thu Jun 5 16:08:36 2003
@@ -58,7 +58,7 @@ void PageMeter::getpageinfo( void ){
 
   do {
     stats >>buf;
- } while (strncasecmp(buf, "swap", 5));
+ } while (!stats.eof() && strncasecmp(buf, "swap", 5));
           
   stats >>pageinfo_[pageindex_][0] >>pageinfo_[pageindex_][1];
 

_

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 07 2003 - 22:00:29 EST