| 121 |
|
break; |
| 122 |
|
partlen = strlen(part); |
| 123 |
|
memcpy(p, part, partlen); |
| 124 |
< |
p += partlen; |
| 124 |
> |
|
| 125 |
> |
/* Replace spaces and dots with underscores. */ |
| 126 |
> |
while (partlen-- > 0) { |
| 127 |
> |
if (*p == ' ' || *p == '.') |
| 128 |
> |
*p = '_'; |
| 129 |
> |
p++; |
| 130 |
> |
} |
| 131 |
> |
|
| 132 |
|
*p++ = '.'; |
| 133 |
|
} |
| 134 |
|
va_end(ap); |
| 135 |
|
*--p = '\0'; |
| 136 |
|
|
| 130 |
– |
/* Replace spaces with underscores. */ |
| 131 |
– |
for (p = name; *p != '\0'; p++) { |
| 132 |
– |
if (*p == ' ') |
| 133 |
– |
*p = '_'; |
| 134 |
– |
} |
| 135 |
– |
|
| 137 |
|
/* Stretch the stats array if necessary. */ |
| 138 |
|
if (num_stats >= alloc_stats) { |
| 139 |
|
alloc_stats += INCREMENT_STATS; |
| 314 |
|
"fs", name, "used_inodes", NULL); |
| 315 |
|
add_stat(LONG_LONG, &disk[i].free_inodes, |
| 316 |
|
"fs", name, "free_inodes", NULL); |
| 317 |
+ |
add_stat(LONG_LONG, &disk[i].avail_inodes, |
| 318 |
+ |
"fs", name, "avail_inodes", NULL); |
| 319 |
+ |
add_stat(LONG_LONG, &disk[i].io_size, |
| 320 |
+ |
"fs", name, "io_size", NULL); |
| 321 |
+ |
add_stat(LONG_LONG, &disk[i].block_size, |
| 322 |
+ |
"fs", name, "block_size", NULL); |
| 323 |
+ |
add_stat(LONG_LONG, &disk[i].total_blocks, |
| 324 |
+ |
"fs", name, "total_blocks", NULL); |
| 325 |
+ |
add_stat(LONG_LONG, &disk[i].free_blocks, |
| 326 |
+ |
"fs", name, "free_blocks", NULL); |
| 327 |
+ |
add_stat(LONG_LONG, &disk[i].avail_blocks, |
| 328 |
+ |
"fs", name, "avail_blocks", NULL); |
| 329 |
+ |
add_stat(LONG_LONG, &disk[i].used_blocks, |
| 330 |
+ |
"fs", name, "used_blocks", NULL); |
| 331 |
|
|
| 332 |
|
free(buf); |
| 333 |
|
} |
| 427 |
|
"net", name, "speed", NULL); |
| 428 |
|
add_stat(BOOL, &iface[i].up, |
| 429 |
|
"net", name, "up", NULL); |
| 430 |
< |
add_stat(DUPLEX, &iface[i].dup, |
| 430 |
> |
add_stat(DUPLEX, &iface[i].duplex, |
| 431 |
|
"net", name, "duplex", NULL); |
| 432 |
|
} |
| 433 |
|
} |
| 512 |
|
|
| 513 |
|
switch (s->type) { |
| 514 |
|
case LONG_LONG: |
| 515 |
+ |
#ifdef WIN32 /* Windows printf does not understand %lld, so use %I64d instead */ |
| 516 |
+ |
printf("%I64d", *(long long *)v); |
| 517 |
+ |
#else |
| 518 |
|
printf("%lld", *(long long *)v); |
| 519 |
+ |
#endif |
| 520 |
|
break; |
| 521 |
|
case BYTES: |
| 522 |
|
llv = *(long long *)v; |
| 523 |
|
if (bytes_scale_factor != 0) { |
| 524 |
|
llv /= bytes_scale_factor; |
| 525 |
|
} |
| 526 |
+ |
#ifdef WIN32 |
| 527 |
+ |
printf("%I64d", llv); |
| 528 |
+ |
#else |
| 529 |
|
printf("%lld", llv); |
| 530 |
+ |
#endif |
| 531 |
|
break; |
| 532 |
|
case TIME_T: |
| 533 |
|
/* FIXME option for formatted time? */ |
| 743 |
|
/* We don't care if sg_init fails, because we can just display |
| 744 |
|
the statistics that can be read as non-root. */ |
| 745 |
|
sg_init(); |
| 746 |
+ |
sg_snapshot(); |
| 747 |
|
if (sg_drop_privileges() != 0) |
| 748 |
|
die("Failed to drop setuid/setgid privileges"); |
| 749 |
|
|
| 755 |
|
case REPEAT_ONCE: |
| 756 |
|
get_stats(); |
| 757 |
|
sleep(repeat_time); |
| 758 |
+ |
sg_snapshot(); |
| 759 |
|
get_stats(); |
| 760 |
|
print_stats(argc, argv); |
| 761 |
|
break; |
| 765 |
|
print_stats(argc, argv); |
| 766 |
|
printf("\n"); |
| 767 |
|
sleep(repeat_time); |
| 768 |
+ |
sg_snapshot(); |
| 769 |
|
} |
| 770 |
|
} |
| 771 |
|
|
| 773 |
|
printf("\n"); |
| 774 |
|
printf("statgrab\n"); |
| 775 |
|
} |
| 776 |
+ |
|
| 777 |
+ |
sg_shutdown(); |
| 778 |
|
|
| 779 |
|
return 0; |
| 780 |
|
} |