Author: Michael Tokarev Description: For vmstat only change units where it makes sense and try to stop some overflows of some kernel variables Bug-Debian: http://bugs.debian.org/558134 Bug-Debian: http://bugs.debian.org/558361 --- a/proc/sysinfo.c +++ b/proc/sysinfo.c @@ -606,7 +606,7 @@ ); head = tail+1; if(!found) goto nextline; - *(found->slot) = strtoul(head,&tail,10); + *(found->slot) = (unsigned long)strtoull(head,&tail,10); nextline: tail = strchr(head, '\n'); if(!tail) break; --- a/vmstat.c +++ b/vmstat.c @@ -209,8 +209,8 @@ unitConvert(kb_swap_used), unitConvert(kb_main_free), unitConvert(a_option?kb_inactive:kb_main_buffers), unitConvert(a_option?kb_active:kb_main_cached), - (unsigned)( (*pswpin * unitConvert(kb_per_page) * hz + divo2) / Div ), - (unsigned)( (*pswpout * unitConvert(kb_per_page) * hz + 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)( (*intr * hz + divo2) / Div ), @@ -258,8 +258,8 @@ unitConvert(kb_swap_used),unitConvert(kb_main_free), unitConvert(a_option?kb_inactive:kb_main_buffers), unitConvert(a_option?kb_active:kb_main_cached), - (unsigned)( ( (pswpin [tog] - pswpin [!tog])*unitConvert(kb_per_page)+sleep_half )/sleep_time ), /*si*/ - (unsigned)( ( (pswpout[tog] - pswpout[!tog])*unitConvert(kb_per_page)+sleep_half )/sleep_time ), /*so*/ + (unsigned)( ( (pswpin [tog] - pswpin [!tog])*kb_per_page+sleep_half )/sleep_time ), /*si*/ + (unsigned)( ( (pswpout[tog] - pswpout[!tog])*kb_per_page+sleep_half )/sleep_time ), /*so*/ (unsigned)( ( pgpgin [tog] - pgpgin [!tog] +sleep_half )/sleep_time ), /*bi*/ (unsigned)( ( pgpgout[tog] - pgpgout[!tog] +sleep_half )/sleep_time ), /*bo*/ (unsigned)( ( intr [tog] - intr [!tog] +sleep_half )/sleep_time ), /*in*/ --- a/vmstat.8 +++ b/vmstat.8 @@ -67,7 +67,8 @@ .PP The \fB\-p\fP followed by some partition name for detailed statistics (2.5.70 or above required) .PP -The \fB\-S\fP followed by k or K or m or M switches outputs between 1000, 1024, 1000000, or 1048576 bytes +The \fB\-S\fP followed by k or K or m or M switches changes the units of +ouput from bytes to outputs between 1000, 1024, 1000000, or 1048576 bytes. Note this does not change the swap (si/so) or block (bi/bo) fields. .PP The \fB\-V\fP switch results in displaying version information. .PP