363 |
|
"net", name, "tx", NULL); |
364 |
|
add_stat(LONG_LONG, &net[i].rx, |
365 |
|
"net", name, "rx", NULL); |
366 |
+ |
add_stat(LONG_LONG, &net[i].ipackets, |
367 |
+ |
"net", name, "ipackets", NULL); |
368 |
+ |
add_stat(LONG_LONG, &net[i].opackets, |
369 |
+ |
"net", name, "opackets", NULL); |
370 |
+ |
add_stat(LONG_LONG, &net[i].ierrors, |
371 |
+ |
"net", name, "ierrors", NULL); |
372 |
+ |
add_stat(LONG_LONG, &net[i].oerrors, |
373 |
+ |
"net", name, "oerrors", NULL); |
374 |
+ |
add_stat(LONG_LONG, &net[i].collisions, |
375 |
+ |
"net", name, "collisions", NULL); |
376 |
|
add_stat(TIME_T, &net[i].systime, |
377 |
|
"net", name, "systime", NULL); |
378 |
|
} |
459 |
|
t->populate(); |
460 |
|
} |
461 |
|
|
462 |
< |
qsort(stats, num_stats, sizeof *stats, stats_compare); |
462 |
> |
if (stats != NULL) |
463 |
> |
qsort(stats, num_stats, sizeof *stats, stats_compare); |
464 |
|
} |
465 |
|
|
466 |
|
/* Print the value of a stat. */ |
467 |
|
void print_stat_value(const stat *s) { |
468 |
|
void *v = s->stat; |
469 |
+ |
long l; |
470 |
|
|
471 |
|
switch (s->type) { |
472 |
|
case LONG_LONG: |
474 |
|
break; |
475 |
|
case TIME_T: |
476 |
|
/* FIXME option for formatted time? */ |
477 |
< |
printf("%ld", *(time_t *)v); |
477 |
> |
l = *(time_t *)v; |
478 |
> |
printf("%ld", l); |
479 |
|
break; |
480 |
|
case FLOAT: |
481 |
|
printf("%f", *(float *)v); |
548 |
|
else |
549 |
|
compare = stats_compare; |
550 |
|
|
551 |
< |
s = (const stat *)bsearch(&key, stats, num_stats, |
552 |
< |
sizeof *stats, compare); |
551 |
> |
if (stats == NULL) { |
552 |
> |
s = NULL; |
553 |
> |
} else { |
554 |
> |
s = (const stat *)bsearch(&key, stats, |
555 |
> |
num_stats, |
556 |
> |
sizeof *stats, |
557 |
> |
compare); |
558 |
> |
} |
559 |
> |
|
560 |
|
if (s == NULL) { |
561 |
|
printf("Unknown stat %s\n", name); |
562 |
|
continue; |