From: albert <> Date: Fri, 11 Oct 2002 20:01:16 +0000 (+0000) Subject: bad C, warnings, 64-bit time X-Git-Tag: v3.3.0~439 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=887f247760e1ba3e50680ea447d83ad75088ed6c;p=procps-ng bad C, warnings, 64-bit time --- diff --git a/vmstat.c b/vmstat.c index 924a8a80..23c93c78 100644 --- a/vmstat.c +++ b/vmstat.c @@ -40,7 +40,7 @@ static char buff[BUFFSIZE]; /* used in the procedures */ -typedef unsigned long jiff; +typedef unsigned long long jiff; static int a_option; /* "-a" means "show active/inactive" */ @@ -83,7 +83,7 @@ static void showheader(void){ "in","cs","us","sy","id"); } -static void getstat(jiff *cuse, jiff *cice, jiff *csys, jiff long *cide, jiff long *ciow, +static void getstat(jiff *cuse, jiff *cice, jiff *csys, jiff *cide, jiff *ciow, unsigned *pin, unsigned *pout, unsigned *s_in, unsigned *sout, unsigned *itot, unsigned *i1, unsigned *ct) { static int Stat; @@ -103,7 +103,7 @@ static void getstat(jiff *cuse, jiff *cice, jiff *csys, jiff long *cide, jiff lo *ciow = 0; /* not separated out until the 2.5.41 kernel */ b = strstr(buff, "cpu "); - if(b) sscanf(b, "cpu %lu %lu %lu %lu %lu", cuse, cice, csys, cide, ciow); + if(b) sscanf(b, "cpu %Lu %Lu %Lu %Lu %Lu", cuse, cice, csys, cide, ciow); b = strstr(buff, "page "); if(b) sscanf(b, "page %u %u", pin, pout); @@ -247,6 +247,7 @@ int main(int argc, char *argv[]) { pero2=(per/2); showheader(); + getrunners(&running,&blocked,&swapped); meminfo(); getstat(cpu_use,cpu_nic,cpu_sys,cpu_idl,cpu_iow, @@ -263,21 +264,22 @@ int main(int argc, char *argv[]) { kb_swap_used,kb_main_free, a_option?kb_inactive:kb_main_buffers, a_option?kb_active:kb_main_cached, - (*pswpin *kb_per_page*hz+divo2)/Div, - (*pswpout*kb_per_page*hz+divo2)/Div, - (*pgpgin *hz+divo2)/Div, - (*pgpgout *hz+divo2)/Div, - (*inter *hz+divo2)/Div, - (*ctxt *hz+divo2)/Div, - (100*duse+divo2)/Div, - (100*dsys+divo2)/Div, - (100*didl+divo2)/Div + (unsigned)( (*pswpin * kb_per_page * hz + divo2) / Div ), + (unsigned)( (*pswpout * kb_per_page * hz + divo2) / Div ), + (unsigned)( (*pgpgin * hz + divo2) / Div ), + (unsigned)( (*pgpgout * hz + divo2) / Div ), + (unsigned)( (*inter * hz + divo2) / Div ), + (unsigned)( (*ctxt * hz + divo2) / Div ), + (unsigned)( (100*duse + divo2) / Div ), + (unsigned)( (100*dsys + divo2) / Div ), + (unsigned)( (100*didl + divo2) / Div ) ); for(i=1;i