Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.unix-wizards Subject: Re: tty select feature Message-ID: <3926@umcp-cs.UUCP> Date: Sat, 18-Oct-86 03:20:06 EDT Article-I.D.: umcp-cs.3926 Posted: Sat Oct 18 03:20:06 1986 Date-Received: Sat, 18-Oct-86 23:26:04 EDT References: <4569@brl-smoke.ARPA> Reply-To: chris@umcp-cs.UUCP (Chris Torek) Organization: University of Maryland, Dept. of Computer Sci. Lines: 41 In article <4569@brl-smoke.ARPA> art@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@umcp-cs ARPA: chris@mimsy.umd.edu