Make packet/byte counters 64 bits wide
authorPhil Blundell <philb@gnu.org>
Sat, 10 Feb 2001 19:31:14 +0000 (19:31 +0000)
committerPhil Blundell <philb@gnu.org>
Sat, 10 Feb 2001 19:31:14 +0000 (19:31 +0000)
README
include/interface.h
lib/interface.c

diff --git a/README b/README
index 4ec4a25..be63692 100644 (file)
--- a/README
+++ b/README
@@ -32,11 +32,7 @@ Contents:
                           Notes
                           -----
 
-This is net-tools 1.57.  Notable changes since 1.55 include:
-
- - A bug relating to IPv4 alias interfaces has been fixed.
- - Support for X.25 and STRIP has been added.
- - A tool for configuring MII transceivers has been added.
+This is net-tools 1.58.
 
 You need kernel 2.0 or later to use these programs.  These programs
 should compile cleanly with both glibc (version 2.0 or 2.1) and libc5,
index 45d4ac2..f95555c 100644 (file)
@@ -1,8 +1,8 @@
 struct user_net_device_stats {
-    unsigned long rx_packets;  /* total packets received       */
-    unsigned long tx_packets;  /* total packets transmitted    */
-    unsigned long rx_bytes;    /* total bytes received         */
-    unsigned long tx_bytes;    /* total bytes transmitted      */
+    unsigned long long rx_packets;     /* total packets received       */
+    unsigned long long tx_packets;     /* total packets transmitted    */
+    unsigned long long rx_bytes;       /* total bytes received         */
+    unsigned long long tx_bytes;       /* total bytes transmitted      */
     unsigned long rx_errors;   /* bad packets received         */
     unsigned long tx_errors;   /* packet transmit problems     */
     unsigned long rx_dropped;  /* no space in linux buffers    */
index 728ddc1..f4d2a9a 100644 (file)
@@ -7,7 +7,7 @@
    8/2000  Andi Kleen make the list operations a bit more efficient.
    People are crazy enough to use thousands of aliases now.
 
-   $Id: interface.c,v 1.13 2000/12/19 01:36:27 ecki Exp $
+   $Id: interface.c,v 1.14 2001/02/10 19:31:15 pb Exp $
  */
 
 #include "config.h"
@@ -239,7 +239,7 @@ static int get_dev_fields(char *bp, struct interface *ife)
     switch (procnetdev_vsn) {
     case 3:
        sscanf(bp,
-       "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",
+       "%llu %llu %lu %lu %lu %lu %lu %lu %llu %llu %lu %lu %lu %lu %lu %lu",
               &ife->stats.rx_bytes,
               &ife->stats.rx_packets,
               &ife->stats.rx_errors,
@@ -259,7 +259,7 @@ static int get_dev_fields(char *bp, struct interface *ife)
               &ife->stats.tx_compressed);
        break;
     case 2:
-       sscanf(bp, "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",
+       sscanf(bp, "%llu %llu %lu %lu %lu %lu %llu %llu %lu %lu %lu %lu %lu",
               &ife->stats.rx_bytes,
               &ife->stats.rx_packets,
               &ife->stats.rx_errors,
@@ -277,7 +277,7 @@ static int get_dev_fields(char *bp, struct interface *ife)
        ife->stats.rx_multicast = 0;
        break;
     case 1:
-       sscanf(bp, "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu",
+       sscanf(bp, "%llu %lu %lu %lu %lu %llu %lu %lu %lu %lu %lu",
               &ife->stats.rx_packets,
               &ife->stats.rx_errors,
               &ife->stats.rx_dropped,
@@ -583,10 +583,10 @@ void ife_print_short(struct interface *ptr)
     printf("%5d %3d", ptr->mtu, ptr->metric);
     /* If needed, display the interface statistics. */
     if (ptr->statistics_valid) {
-       printf("%8lu %6lu %6lu %6lu",
+       printf("%8llu %6lu %6lu %6lu",
               ptr->stats.rx_packets, ptr->stats.rx_errors,
               ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors);
-       printf("%8lu %6lu %6lu %6lu ",
+       printf("%8llu %6lu %6lu %6lu ",
               ptr->stats.tx_packets, ptr->stats.tx_errors,
               ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors);
     } else {
@@ -635,7 +635,7 @@ void ife_print_long(struct interface *ptr)
     struct hwtype *hw;
     int hf;
     int can_compress = 0;
-    unsigned long rx, tx, short_rx, short_tx;
+    unsigned long long rx, tx, short_rx, short_tx;
     char Rext[5]="b";
     char Text[5]="b";
 
@@ -832,7 +832,7 @@ void ife_print_long(struct interface *ptr)
         */
        printf("          ");
 
-       printf(_("RX packets:%lu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"),
+       printf(_("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"),
               ptr->stats.rx_packets, ptr->stats.rx_errors,
               ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors,
               ptr->stats.rx_frame_errors);
@@ -849,7 +849,7 @@ void ife_print_long(struct interface *ptr)
        else if (tx > 1024) { short_tx /= 1024;  strcpy(Text, "Kb"); }
 
        printf("          ");
-       printf(_("TX packets:%lu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"),
+       printf(_("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"),
               ptr->stats.tx_packets, ptr->stats.tx_errors,
               ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors,
               ptr->stats.tx_carrier_errors);
@@ -859,9 +859,11 @@ void ife_print_long(struct interface *ptr)
        if (ptr->tx_queue_len != -1)
            printf(_("txqueuelen:%d "), ptr->tx_queue_len);
        printf("\n          ");
-       printf(_("RX bytes:%lu (%lu.%lu %s)  TX bytes:%lu (%lu.%lu %s)\n"),
-               rx, short_rx / 10, short_rx % 10, Rext, 
-               tx, short_tx / 10, short_tx % 10, Text);
+       printf(_("RX bytes:%llu (%lu.%lu %s)  TX bytes:%llu (%lu.%lu %s)\n"),
+              rx, (unsigned long)(short_rx / 10), 
+              (unsigned long)(short_rx % 10), Rext, 
+              tx, (unsigned long)(short_tx / 10), 
+              (unsigned long)(short_tx % 10), Text);
     }
 
     if ((ptr->map.irq || ptr->map.mem_start || ptr->map.dma ||