tty select feature
Chris Torek
chris at umcp-cs.UUCP
Sat Oct 18 17:20:06 AEST 1986
In article <4569 at brl-smoke.ARPA> art at ACC.arpa writes:
>... Most of the terminal device drivers point the cdevsw entries for
>the select system call to ttselect(), which contains the following line:
> register struct tty *tp = &cdevsw[major(dev)].d_ttys[minor(dev)];
>This code assumes that the minor device number can be used as an index into
>the driver's tty structure array. My understanding is that ONLY THE DRIVER
>should interpret the meaning and format of the minor device number.
The interpretation inside ttselect() is a code-saving device. The
driver can override this easily. (There should be an equivalent
routine that can be called with a `struct tty *'; as it is a driver
has to play games with `dev', then call ttselect(). But as distributed
all of the drivers could use ttselect() directly, which makes this
other routine unnecessary. Writing, e.g.,
ttselect(dev)
dev_t dev;
{
return (tty_select(&cdevsw[major(dev)].d_ttys[minor(dev)]));
}
tty_select(tp)
register struct tty *tp;
{
...
would be cleaner, but slower; ergo, it was not done.)
>Our driver defines minor numbers which have more structure than
>that and caused select to break.
It was your option to put `ttselect' into conf.c. . . .
(It *would* be nice if ttselect's assumption were mentioned in conf.c.)
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516)
UUCP: seismo!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at mimsy.umd.edu
More information about the Comp.unix.wizards
mailing list