summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4fcf231)
raw | patch | inline | side by side (parent: 4fcf231)
author | Tomasz Pala <gotar@pld-linux.org> | |
Sat, 18 Apr 2009 15:45:01 +0000 (17:45 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 20 Apr 2009 19:35:50 +0000 (21:35 +0200) |
Hello,
attached patch fixes accounting of most frequent interrupts (like NICs
on routers). E.g. in my case:
213: 76266 76357 76250 76397 2408617852 2411844062 2411642538 2411814531 PCI-MSI-edge eth1
214: 2621368360 2621463385 2621343444 2621386931 2349184 28 35 32 PCI-MSI-edge eth0
Here LONG_MAX (2147483647L) overflows in 10 days uptime and strtol()
returns the same value.
As all the values (including counter_t) are unsigned long long int, the
fix is trivial (for now there's no need to check for irq_value overflow;>).
--
Tomasz Pala <gotar@pld-linux.org>
Signed-off-by: Florian Forster <octo@leeloo.lan.home.verplant.org>
attached patch fixes accounting of most frequent interrupts (like NICs
on routers). E.g. in my case:
213: 76266 76357 76250 76397 2408617852 2411844062 2411642538 2411814531 PCI-MSI-edge eth1
214: 2621368360 2621463385 2621343444 2621386931 2349184 28 35 32 PCI-MSI-edge eth0
Here LONG_MAX (2147483647L) overflows in 10 days uptime and strtol()
returns the same value.
As all the values (including counter_t) are unsigned long long int, the
fix is trivial (for now there's no need to check for irq_value overflow;>).
--
Tomasz Pala <gotar@pld-linux.org>
Signed-off-by: Florian Forster <octo@leeloo.lan.home.verplant.org>
src/irq.c | patch | blob | history |
diff --git a/src/irq.c b/src/irq.c
index 9b7e61877d8c62bafc009e91e1f792c43024e63e..38304fca58f84ef7cf98abe13675fa8abbb754c8 100644 (file)
--- a/src/irq.c
+++ b/src/irq.c
FILE *fh;
char buffer[BUFSIZE];
unsigned int irq;
- unsigned int irq_value;
- long value;
+ unsigned long long irq_value;
+ unsigned long long value;
char *endptr;
int i;
for (i = 1; i < fields_num; i++)
{
errno = 0;
- value = strtol (fields[i], &endptr, 10);
+ value = strtoull (fields[i], &endptr, 10);
if ((*endptr != '\0') || (errno != 0))
break;