tty select feature

art at ACC.arpa art at ACC.arpa
Tue Oct 14 05:41:15 AEST 1986


I thought that I would mention something we discovered while debugging
a driver for a terminal device of ours.  The problem exists in (at least)
BSD 4.2, BSD 4.3 and ULTRIX 1.2.  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.  Our
driver defines minor numbers which have more structure than that and caused
select to break.  The solution was to point cdevsw to a select entry in the
driver which massaged the dev parameter and then called ttselect().  But I
still object to code outside of the driver making assuptions about the format
of the driver's tty structure array and minor number.

						<Art at ACC.ARPA>

------



More information about the Comp.unix.wizards mailing list