[net.bugs.4bsd] problem in iostat program -- Bug and fix.

joe@ccnysci.UUCP (12/03/85)

The iostat program in the 4.2 BSD release apparently works fine until
you use it on a system which has been up for several days. After that
the first line of information (the summary of performance since last
reboot) shows one or more states (USER, NICE, SYSTEM, IDLE) active
for a negative percent of the time.
	The bug is in the subroutine stat1, where the times are
multiplied by an integer 100, causing overflow into the sign bit for
long times. Forcing a multiplication of double quantities fixes the
problem.
	The single line correction (within stat1 in file iostat.c) is
-------------------------------------------------- CUT ------------
210c210
> 	printf("%3.0f", 100*s.cp_time[o]/time);
---
< 	printf("%3.0f", 100.0*s.cp_time[o]/time);
--------------------------------------------------- CUT -----------

	Joe Eccles -- City College of New York
	philabs!cucard!ccnysci!joe
	ihnp4!physics!ccnysci!joe