bin/72588: iostat tty stats field concatenation

Xander Jansen x+freebsd-gnats at surfnet.nl
Tue Oct 12 10:01:09 PDT 2004


>Number:         72588
>Category:       bin
>Synopsis:       iostat tty stats field concatenation
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 12 17:00:47 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Xander
>Release:        FreeBSD 4.x and 5.x (6.x also I guess)
>Organization:
Not really
>Environment:
		Noticed on 4.9_REL, 4.10_REL, 5.2.1_REL, problem exists in
rev 1.28 and older of iostat.c

>Description:
		With a lot of tty-activity the tty in/out fields in iostat
output are printed without separating space. Besides making the output
unreadable it also breaks parsing of the output based on whitespace
separated fields. The problem is similar to the one in bin/41674 (which
contains a fix for the CPU stats).

For example:

iostat -C -n 0 -c 4 -w 10
      tty            cpu
 tin tout us ni sy in id
   1  551  1  0  0  0 99
   1206250 47  0  3  0 50   <----
   6256600 59  0  4  0 37   <----
   0  227  0  0  0  0 100

>How-To-Repeat:
	Start a proces sending lots of output to a terminal and have a look
at the output of:

	iostat -C -n 0 -c 10 -w 10
>Fix:

Similar to the one in bin/41674. I'm aware that this fix only fixes this
particular case and that there might be other printf's to be changed. 

--- iostat.c.1.28	Sun Mar 16 17:39:52 2003
+++ iostat.c	Tue Oct 12 17:48:07 2004
@@ -548,7 +548,7 @@ main(int argc, char **argv)
 		}
 
 		if (Tflag > 0)
-			printf("%4.0Lf%5.0Lf", cur.tk_nin / etime, 
+			printf(" %3.0Lf %4.0Lf", cur.tk_nin / etime, 
 				cur.tk_nout/etime);
 
 		devstats(hflag, etime, havelast);

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list