Subject: Re: TTY virtualization driver
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 01/23/2002 14:01:56
>>>> [...tty abstraction at the device attachment level...]
>>> I personally think there's more benefit to doing this [...]
>> Hm.  I can't see that benefit, unless you just happen to like it
>> aesthetically.  Could you explain in a bit more detail?

> Right now it's easy to figure out what disks or ethernet interfaces
> are on your machine.

> [...sd[0-n], wd[0-n], handwave other disk devices...]

Well, aside from handwaving other disk devices, this works only if
you've not wired down devices; if you have, there can be holes in the
numbering, with no easy way to tell how high you should go.
(Consulting dmesg, of course, vitiates the whole argument, as that you
can do for any of these device types - see also below.)

> [...ifconfig -a...]

This is an argument not for a uniform tty layer but rather for a tool
that lists all devices presenting the tty interface.

> But, let's say you want to hook up a modem to a serial port and run
> getty on it.  How do you determine which device that corresponds to?

If I have physical access, which I must if I'm plugging stuff into it,
I say "it's port 3 on the 8-port card, so it's mtty3" or "it's
motherboard port 1, that's tty01" or some such.  I don't have to say
"okay, it's port 1 on the 4-port card, that's...two for the
motherboard, 8 for the 8-port card, one for the modem, plus one is 12"
and then discover the hard way that the 8-port card comes _after_ the
4-port card in the "uniform" numbering, so I actually started getty on
port 5 on the 8-port card instead.

Of course, if I have a half-dozen identical cards or something, I have
that problem, but why inflict it on people who don't have to have it?

> You can determine which serial drivers have attached by looking
> through the boot messages.  But there's no real correlation between a
> device instance and a node in /dev.

Then let's fix that, rather than introducing new problems.

> You can look at the man pages but they tell you about the device
> instance, not the /dev node.

That depends.  Try "man zstty" on a sparc.  Again, fix the problem,
don't introduce more problems.  ISTM this is an argument for naming
/dev entries for ttys more rationally; even if too much stuff demands
that ttys be /dev/tty*, you can still do /dev/ttycom0 or /dev/ttymtty4
or /dev/ttyzstty1.  (Indeed, nothing's stopping you from doing that
now, though you'd likely want some symlinks for backwards
compatability.)

> So what exactly does correspond to /dev/ttyC00?  Or /dev/tty00?  Does
> the machine even have a working /dev/tty00?

And how does this differ from "so what exactly corresponds to
/dev/tty08?"?

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B