Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!brl-adm!brl-smoke!smoke!art@ACC.arpa From: art@ACC.arpa Newsgroups: net.unix-wizards Subject: tty select feature Message-ID: <4569@brl-smoke.ARPA> Date: Mon, 13-Oct-86 15:41:15 EDT Article-I.D.: brl-smok.4569 Posted: Mon Oct 13 15:41:15 1986 Date-Received: Tue, 14-Oct-86 06:52:01 EDT Sender: news@brl-smoke.ARPA Lines: 21 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. ------