Package: xosview
Version: 1.8.3+debian-6
Severity: normal
Tags: patch

xosview has a fixed-size array mapping numbers from /proc/interrupts
to interrupt indicator positions. The size of this map is 1024. On some
x86-64 system (and probably modern i386 systems too) with PCI express,
the interrupt numbers the kernel uses for the Message Signalled Interrupt
might well exceed 1024.

The appended patch makes xosview use a dynamic map instead of an static
array.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'stable'), (490, 'unstable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.25 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages xosview depends on:
ii  libc6                         2.7-10     GNU C Library: Shared libraries
ii  libgcc1                       1:4.3.0-3  GCC support library
ii  libstdc++6                    4.3.0-3    The GNU Standard C++ Library v3
ii  libx11-6                      2:1.0.3-7  X11 client-side library

xosview recommends no packages.

-- no debconf information

#! /bin/sh /usr/share/dpatch/dpatch-run
## handle_high_irq_numbers.dpatch by  <[EMAIL PROTECTED]>
##
## Uses a dynamic map instead of a fixed-size array for interrupt mapping,
## as some x86-64 systems have the MSI interrupts way beyond 1024.

@DPATCH@
diff -urNad xosview-1.8.3+debian~/linux/intmeter.cc 
xosview-1.8.3+debian/linux/intmeter.cc
--- xosview-1.8.3+debian~/linux/intmeter.cc     2008-05-31 12:25:04.656454148 
+0200
+++ xosview-1.8.3+debian/linux/intmeter.cc      2008-05-31 12:27:10.861106922 
+0200
@@ -11,13 +11,14 @@
 #include "cpumeter.h"
 #include <fstream>
 #include <sstream>
+#include <map>
 #include <stdlib.h>
 
 
 static const char *INTFILE     = "/proc/interrupts";
 static const char *VERSIONFILE = "/proc/version";
 
-static         int realintnum[1024];
+std::map<int,int> realintnum;
 
 IntMeter::IntMeter( XOSView *parent, int cpu)
   : BitMeter( parent, "INTS", "", 1,
@@ -114,10 +115,11 @@
    setNumBits(n+1);
    std::ostringstream os;
 
-   os << "INTs (0-16" ;
-   for (int i=16; i<1024; i++) {
-       if (realintnum[i])
-          os << ", " << (i) ;
+   os << "INTs (0-15" ;
+   for (std::map<int,int>::const_iterator it = realintnum.upper_bound(15),
+                                          end = realintnum.end(); 
+                                          it != end; ++it) {
+         os << ", " << it->first ;
    }
    os << ")" << std::ends;
 
@@ -161,11 +163,8 @@
   }
 
   if (!_old) {
-      for (i=0; i<1024; i++)   // init index into int array
-       if (i < 16)             // first 16 map directly
-           realintnum[i] = i;
-       else
-           realintnum[i] = 0;
+      for (i=0; i<16; i++)     // Map first 16 interrupts directly
+        realintnum[i] = i;
       intfile.ignore(1024, '\n');
   }
 



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to