Xref: utzoo comp.sys.att:7342 unix-pc.general:3596 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!usc!rutgers!cbmvax!ford From: ford@cbmvax.UUCP (Michael "Ford" Ditto) Newsgroups: comp.sys.att,unix-pc.general Subject: Re: sockets & ptys Summary: a line discipline provides line editing, or packet protocol, or ... Keywords: socket tty driver line discipline Message-ID: <7710@cbmvax.UUCP> Date: 19 Aug 89 12:34:03 GMT References: <637@holin.ATT.COM> <2982@cuuxb.ATT.COM> <590@uncle.UUCP> Reply-To: ford@cbmvax.UUCP (Michael "Ford" Ditto) Organization: Commodore Technology, West Chester, PA Lines: 66 In article <2982@cuuxb.ATT.COM> mmengel@cuuxb.UUCP (Marc W. Mengel) writes: > you can change the line discipline routines when you init > your socket code, and all the tty drivers will call your > code. You should be able to put all the hooks you need > in the line discipline, I think. I don't know about "in the line discipline" since we don't have the ability to modify the line discipline code ... but perhaps with wrapper functions that go into linesw[0].l_* and call the old functions. If select had been designed into the kernel from the start there would be an l_select field in (struct linesw), since each line discipline has its own definition of whether a port is "ready" for I/O. In article <590@uncle.UUCP> jbm@uncle.UUCP (John B. Milton) writes: >I once heard A LONG TIME AGO that the line discipline code on the UNIXpc >is BUSTED and don't work. I have bumped into this stuff a lot, what can >one do with a line discipline? Is this a sort of driver-filter? What you heard about line disciplines not working on the Unix PC was probably me mentioning that /etc/lddrv/lddrv didn't seem to handle the "${module}in()" entry point under some conditions I didn't really determine. The "xt" driver that comes with the system goes in fine, but when I tried to install a line discipline called "sxt" lddrv got confused between sxtin() and sxtinit(). Actually, I now suspect that is is dependent on the order of the symbols in the driver -- fooin() must be before fooinit(). lddrv does a strncmp instead of strcmp for no apparrent reason, and the last symbol in the .o which is an initial substring of "fooinit" becomes the init function, even if it's "fooin". A line discipline is a set of routines that determine how the bytes sent through a tty device are interpreted/processed. For example, line discipline zero (the default) processes the erase/kill/eof/newline line editing characters, provides input echo, output delays, and CR/LF processing. In short, the line discipline is responsible for doing almost everything specified in termio(7). The c_line field in the termio structure determines which line discipline is in effect. On the Unix PC, there are two line disciplines available, 0 (the "normal Unix tty driver") and 1, the "xt" protocol discipline (if the "AT&T windowing utilities" package is installed). The xt line discipline is selected by the xt device driver when it is accessed by the "layers" program. It does none of the normal tty-driver types of things, it just speaks the xt packet protcol used by the Blit terminals, and multiplexes the data to/from the /dev/xt/* devices. On systems with the "shl" program, there is an "sxt" driver and line discipline to do the multiplexing used by that program. A typical use of the line discipline facility is to have an alternative tty driver with different (i.e. better) editing capability (on BSD unix, for example, you can use the "old" or "new" tty drivers, this is essentially the same idea). Another is to replace the "normal tty driver" processing with a protocol of some sort. On the SVR3 port to the Amiga, we have a TOPS-20 style tty driver and a SLIP (serial line IP) driver, both implemented as tty line disciplines. Type "stty line 4" and you get TOPS line editing, "stty line 0" switches back. On the Unix PC, it is probably reasonable for the select code only to work with line discipline zero, since it is unlikely that anyone will ever use anything else for a login session. -- -=] Ford [=- "The number of Unix installations (In Real Life: Mike Ditto) has grown to 10, with more expected." ditto@amix.commodore.com - The Unix Programmer's Manual, ...!uunet!cbmvax!ditto 2nd Edition, June, 1972. ford@kenobi.commodore.com