Kenneth Westerback wrote:
> On 26 February 2015 at 04:56, Marcus MERIGHI <mcmer-open...@tor.at> wrote:
> > hello,
> >
> > just wanted to let you know that a running iostat automagically adds cd0
> > to it's output when such a device is plugged in:
> >
> > $ iostat sd0 4
> >       tty              sd0             cpu
> >  tin tout  KB/t  t/s  MB/s  us ni sy in id
> >    2  189  8.90   14  0.12   0  3  3  0 93
> >    0   33  7.60    1  0.01   0  0  1  0 99
> > umass1 at uhub3 port 1 configuration 1 interface 0 "MediaTek Inc MT1887"
> >   rev 2.00/0.00 addr 3
> > umass1: using ATAPI over Bulk-Only
> > scsibus5 at umass1: 2 targets, initiator 0
> > cd0 at scsibus5 targ 1 lun 0: <TSSTcorp, CDDVDW SE-208DB, MF00> ATAPI
> >   5/cdrom removable serial.0e8d180676YAF400KW4_
> >       tty              sd0               cd0             cpu
> >  tin tout  KB/t  t/s  MB/s   KB/t  t/s  MB/s  us ni sy in id
> >    0   11 15.09    5  0.08   0.00    0  0.00   0  0  2  0 97
> >    0   46 16.00    0  0.01   0.00    0  0.00   1  0  6  0 93
> > ^C
> > $
> >
> > This behaviour contradicts iostat(8): "To force iostat to display
> > specific drives, their names may be supplied on the command line."
> >
> > Bye, Marcus
> >
> 
> I read the man page as saying that the drives specified on the command
> line are always displayed, but if there are other drives they are also
> displayed. Up to the limit of 4 drives. i.e. the phrase
> 
> "iostat displays only the first four drives. To force iostat to
> display specific drives, ..."
> 
> does not imply that ONLY the drives specified will be displayed.
> 
> Now, whether that is the intended behaviour or just a quirk of the
> delightfully flexible english language I can't say.

The way it works, is that *only* the selected drives are displayed at first.
But when the set of disks changes, then it changes the selected set.

I don't have a test system handy, but I imagine if you were to pick drives
sd[6789] on a system with the requisite number, then attach or detach another
drive, iostat would wind up displaying sd[1234] instead. Or something. The
code, which actually lives in vmstat/dkstat.c, does some rather convoluted
tricks.

The addition of cd0 to the display is a bug, in my opinion, but it's just the
most visible symptom of a rather bigger bug.

I don't think now is the time to be fiddling too deeply with this code, but I
have some ideas wrt expunging some magic.

Reply via email to