vmstat: use libc error printing facilities
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
4bfc4a00fb
commit
f70cdd0666
17
vmstat.c
17
vmstat.c
@ -291,10 +291,8 @@ static int diskpartition_format(const char* partition_name){
|
|||||||
const char format[] = "%20u %10llu %10u %10llu\n";
|
const char format[] = "%20u %10llu %10u %10llu\n";
|
||||||
|
|
||||||
fDiskstat=fopen("/proc/diskstats","rb");
|
fDiskstat=fopen("/proc/diskstats","rb");
|
||||||
if(!fDiskstat){
|
if(!fDiskstat)
|
||||||
fprintf(stderr, _("Your kernel doesn't support diskstat. (2.5.70 or above required)\n"));
|
errx(EXIT_FAILURE, _("Your kernel doesn't support diskstat. (2.5.70 or above required)"));
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(fDiskstat);
|
fclose(fDiskstat);
|
||||||
ndisks=getdiskstat(&disks,&partitions);
|
ndisks=getdiskstat(&disks,&partitions);
|
||||||
@ -406,10 +404,8 @@ static void diskformat(void){
|
|||||||
free(disks);
|
free(disks);
|
||||||
free(partitions);
|
free(partitions);
|
||||||
}
|
}
|
||||||
}else{
|
}else
|
||||||
fprintf(stderr, _("Your kernel doesn't support diskstat (2.5.70 or above required)\n"));
|
errx(EXIT_FAILURE, _("Your kernel doesn't support diskstat (2.5.70 or above required)"));
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@ -428,7 +424,7 @@ static void slabformat (void){
|
|||||||
|
|
||||||
fSlab=fopen("/proc/slabinfo", "rb");
|
fSlab=fopen("/proc/slabinfo", "rb");
|
||||||
if(!fSlab){
|
if(!fSlab){
|
||||||
fprintf(stderr, _("Your kernel doesn't support slabinfo or your permissions are insufficient.\n"));
|
warnx(_("Your kernel doesn't support slabinfo or your permissions are insufficient."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,8 +646,7 @@ int main(int argc, char *argv[]) {
|
|||||||
case 'm': dataUnit = UNIT_m; break;
|
case 'm': dataUnit = UNIT_m; break;
|
||||||
case 'M': dataUnit = UNIT_M; break;
|
case 'M': dataUnit = UNIT_M; break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, _("-S requires k, K, m or M (default is kb)\n"));
|
errx(EXIT_FAILURE, _("-S requires k, K, m or M (default is kb)"));
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
}
|
||||||
szDataUnit[0] = optarg[0];
|
szDataUnit[0] = optarg[0];
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user