From 8f466aa21dda3cd8055fac54ba7291c9af737103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20G=C3=B6rig?= Date: Thu, 16 Dec 2010 10:19:14 +0100 Subject: [PATCH] Headers for disk and slab info and getopt replacement Author: Liu Xing Author: Michael Tokarev Bug-Debian: http://bugs.debian.org/436805 Bug-Debian: http://bugs.debian.org/408088 --- vmstat.c | 82 ++++++++++++++++++++++++-------------------------------- 1 file changed, 35 insertions(+), 47 deletions(-) diff --git a/vmstat.c b/vmstat.c index f022928b..e0d3c23f 100644 --- a/vmstat.c +++ b/vmstat.c @@ -29,14 +29,15 @@ #include "proc/sysinfo.h" #include "proc/version.h" -static unsigned long dataUnit=1024; -static char szDataUnit [16]; #define UNIT_B 1 #define UNIT_k 1000 #define UNIT_K 1024 #define UNIT_m 1000000 #define UNIT_M 1048576 +static unsigned long dataUnit=UNIT_K; +static char szDataUnit[3] = "K"; + #define VMSTAT 0 #define DISKSTAT 0x00000001 #define VMSUMSTAT 0x00000002 @@ -354,6 +355,7 @@ static void diskformat(void){ if ((fDiskstat=fopen("/proc/diskstats", "rb"))){ fclose(fDiskstat); ndisks=getdiskstat(&disks,&partitions); + if (!moreheaders) diskheader(); for(k=0; k0)?tmp:22);