From: seb Date: Mon, 10 Dec 2012 20:49:12 +0000 (+0100) Subject: Changed IPv4 counters (used by sar -n {IP | EIP }) to X-Git-Tag: v10.1.3~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e2973dac564396924119458b5c846734d9cab7c;p=sysstat Changed IPv4 counters (used by sar -n {IP | EIP }) to unsigned long long to keep in sync with current kernels. Keep in sync with recent kernels (3.7rc8 used here): Now use unsigned long long for SNMP IPv4 statistics. WARNING: This breaks compatibility with older sar data files format for IPv4 statistics. --- diff --git a/CHANGES b/CHANGES index 77f9167..5880762 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,10 @@ xxxx/xx/xx: Version 10.1.3 - Sebastien Godard (sysstat orange.fr) unsigned long long to keep in sync with current kernels. WARNING: This breaks compatibility with older sar data files format for network statistics. + * Changed IPv4 counters (used by sar -n { IP | EIP}) to + unsigned long long to keep in sync with current kernels. + WARNING: This breaks compatibility with older sar data + files format for IPv4 statistics. * [Peter Schiffer]: Added option -y to iostat. This option prevents iostat from displaying its first report with statistics since system boot. diff --git a/activity.c b/activity.c index 58e258b..ed9c21c 100644 --- a/activity.c +++ b/activity.c @@ -572,7 +572,7 @@ struct activity net_sock_act = { struct activity net_ip_act = { .id = A_NET_IP, .options = AO_NULL, - .magic = ACTIVITY_MAGIC_BASE, + .magic = ACTIVITY_MAGIC_BASE + 1, .group = G_SNMP, #ifdef SOURCE_SADC .f_count = NULL, @@ -603,7 +603,7 @@ struct activity net_ip_act = { struct activity net_eip_act = { .id = A_NET_EIP, .options = AO_NULL, - .magic = ACTIVITY_MAGIC_BASE, + .magic = ACTIVITY_MAGIC_BASE + 1, .group = G_SNMP, #ifdef SOURCE_SADC .f_count = NULL, diff --git a/rd_stats.c b/rd_stats.c index 3e47824..008f158 100644 --- a/rd_stats.c +++ b/rd_stats.c @@ -967,8 +967,8 @@ void read_net_ip(struct stats_net_ip *st_net_ip) if (!strncmp(line, "Ip:", 3)) { if (sw) { - sscanf(line + 3, "%*u %*u %lu %*u %*u %lu %*u %*u " - "%lu %lu %*u %*u %*u %lu %lu %*u %lu %*u %lu", + sscanf(line + 3, "%*u %*u %llu %*u %*u %llu %*u %*u " + "%llu %llu %*u %*u %*u %llu %llu %*u %llu %*u %llu", &st_net_ip->InReceives, &st_net_ip->ForwDatagrams, &st_net_ip->InDelivers, @@ -1013,8 +1013,8 @@ void read_net_eip(struct stats_net_eip *st_net_eip) if (!strncmp(line, "Ip:", 3)) { if (sw) { - sscanf(line + 3, "%*u %*u %*u %lu %lu %*u %lu %lu " - "%*u %*u %lu %lu %*u %*u %*u %lu %*u %lu", + sscanf(line + 3, "%*u %*u %*u %llu %llu %*u %llu %llu " + "%*u %*u %llu %llu %*u %*u %*u %llu %*u %llu", &st_net_eip->InHdrErrors, &st_net_eip->InAddrErrors, &st_net_eip->InUnknownProtos, diff --git a/rd_stats.h b/rd_stats.h index 57a76a5..8d4b8b5 100644 --- a/rd_stats.h +++ b/rd_stats.h @@ -291,28 +291,28 @@ struct stats_net_sock { /* Structure for IP statistics */ struct stats_net_ip { - unsigned long InReceives __attribute__ ((aligned (8))); - unsigned long ForwDatagrams __attribute__ ((aligned (8))); - unsigned long InDelivers __attribute__ ((aligned (8))); - unsigned long OutRequests __attribute__ ((aligned (8))); - unsigned long ReasmReqds __attribute__ ((aligned (8))); - unsigned long ReasmOKs __attribute__ ((aligned (8))); - unsigned long FragOKs __attribute__ ((aligned (8))); - unsigned long FragCreates __attribute__ ((aligned (8))); + unsigned long long InReceives __attribute__ ((aligned (16))); + unsigned long long ForwDatagrams __attribute__ ((aligned (16))); + unsigned long long InDelivers __attribute__ ((aligned (16))); + unsigned long long OutRequests __attribute__ ((aligned (16))); + unsigned long long ReasmReqds __attribute__ ((aligned (16))); + unsigned long long ReasmOKs __attribute__ ((aligned (16))); + unsigned long long FragOKs __attribute__ ((aligned (16))); + unsigned long long FragCreates __attribute__ ((aligned (16))); }; #define STATS_NET_IP_SIZE (sizeof(struct stats_net_ip)) /* Structure for IP errors statistics */ struct stats_net_eip { - unsigned long InHdrErrors __attribute__ ((aligned (8))); - unsigned long InAddrErrors __attribute__ ((aligned (8))); - unsigned long InUnknownProtos __attribute__ ((aligned (8))); - unsigned long InDiscards __attribute__ ((aligned (8))); - unsigned long OutDiscards __attribute__ ((aligned (8))); - unsigned long OutNoRoutes __attribute__ ((aligned (8))); - unsigned long ReasmFails __attribute__ ((aligned (8))); - unsigned long FragFails __attribute__ ((aligned (8))); + unsigned long long InHdrErrors __attribute__ ((aligned (16))); + unsigned long long InAddrErrors __attribute__ ((aligned (16))); + unsigned long long InUnknownProtos __attribute__ ((aligned (16))); + unsigned long long InDiscards __attribute__ ((aligned (16))); + unsigned long long OutDiscards __attribute__ ((aligned (16))); + unsigned long long OutNoRoutes __attribute__ ((aligned (16))); + unsigned long long ReasmFails __attribute__ ((aligned (16))); + unsigned long long FragFails __attribute__ ((aligned (16))); }; #define STATS_NET_EIP_SIZE (sizeof(struct stats_net_eip))