iproute2: add 64bit support to ifstat
Le lundi 23 août 2010 à 10:33 -0700, Stephen Hemminger a écrit : > I think this breaks the wraparound detection code in this command. > > OK lets fix the bug only, before adding 64bit counters capabilities. Thanks [PATCH] iproute2: add 64bit arches support to ifstat ifstat assumes IFLA_STATS fields are "unsigned long", but they are __u32. This fix is needed to let ifstat run on 64bit arches. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
This commit is contained in:
parent
daf7bd5c73
commit
a571587d0b
|
|
@ -49,7 +49,7 @@ int npatterns;
|
||||||
char info_source[128];
|
char info_source[128];
|
||||||
int source_mismatch;
|
int source_mismatch;
|
||||||
|
|
||||||
#define MAXS (sizeof(struct rtnl_link_stats)/sizeof(unsigned long))
|
#define MAXS (sizeof(struct rtnl_link_stats)/sizeof(__u32))
|
||||||
|
|
||||||
struct ifstat_ent
|
struct ifstat_ent
|
||||||
{
|
{
|
||||||
|
|
@ -58,7 +58,7 @@ struct ifstat_ent
|
||||||
int ifindex;
|
int ifindex;
|
||||||
unsigned long long val[MAXS];
|
unsigned long long val[MAXS];
|
||||||
double rate[MAXS];
|
double rate[MAXS];
|
||||||
unsigned long ival[MAXS];
|
__u32 ival[MAXS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ifstat_ent *kern_db;
|
struct ifstat_ent *kern_db;
|
||||||
|
|
@ -187,7 +187,7 @@ void load_raw_table(FILE *fp)
|
||||||
*next++ = 0;
|
*next++ = 0;
|
||||||
if (sscanf(p, "%llu", n->val+i) != 1)
|
if (sscanf(p, "%llu", n->val+i) != 1)
|
||||||
abort();
|
abort();
|
||||||
n->ival[i] = (unsigned long)n->val[i];
|
n->ival[i] = (__u32)n->val[i];
|
||||||
p = next;
|
p = next;
|
||||||
if (!(next = strchr(p, ' ')))
|
if (!(next = strchr(p, ' ')))
|
||||||
abort();
|
abort();
|
||||||
|
|
@ -563,8 +563,6 @@ static void usage(void)
|
||||||
" -s, --noupdate don;t update history\n"
|
" -s, --noupdate don;t update history\n"
|
||||||
" -t, --interval=SECS report average over the last SECS\n"
|
" -t, --interval=SECS report average over the last SECS\n"
|
||||||
" -V, --version output version information\n"
|
" -V, --version output version information\n"
|
||||||
" -z, --zeros show entries with zero activity\n"
|
|
||||||
" -e, --errors show errors\n"
|
|
||||||
" -z, --zeros show entries with zero activity\n");
|
" -z, --zeros show entries with zero activity\n");
|
||||||
|
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
|
@ -581,8 +579,6 @@ static const struct option longopts[] = {
|
||||||
{ "interval", 1, 0, 't' },
|
{ "interval", 1, 0, 't' },
|
||||||
{ "version", 0, 0, 'V' },
|
{ "version", 0, 0, 'V' },
|
||||||
{ "zeros", 0, 0, 'z' },
|
{ "zeros", 0, 0, 'z' },
|
||||||
{ "errors", 0, 0, 'e' },
|
|
||||||
{ "zeros", 0, 0, 'z' },
|
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue