Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bloom-beacon!gatech!rutgers!mtune!jhc From: jhc@mtune.ATT.COM (Jonathan Clark) Newsgroups: comp.unix.xenix,comp.sources.wanted,comp.unix.questions Subject: Re: tty watcher Message-ID: <1180@mtune.ATT.COM> Date: Mon, 14-Sep-87 15:30:07 EDT Article-I.D.: mtune.1180 Posted: Mon Sep 14 15:30:07 1987 Date-Received: Tue, 15-Sep-87 06:52:46 EDT References: <4263@ozdaltx.UUCP> <15136@hi.UUCP> <1178@mtune.ATT.COM> <27816@sun.uucp> Reply-To: jhc@mtune.UUCP (Jonathan Clark) Organization: AT&T ISL Middletown NJ USA Lines: 48 Xref: mnetor comp.unix.xenix:734 comp.sources.wanted:2246 comp.unix.questions:4067 In article <27816@sun.uucp> guy@sun.uucp (Guy Harris) writes: >I wrote: >> This sounds like a 3-line stream module to me. What's the problem? > >1) Few, if any, kernels currently have streams-based tty drivers; S5R3 and >S5R3.1's standard tty drivers aren't streams-based. Well, I *was* being more than slightly facetious when I wrote that comment, although I think you could actually do the guts of it in close to three lines: /* output */ /* input */ mblk_t *dup; mblk_t *dup; dup = copymsg(mp); dup = copymsg(mp); putnext(up_to_monitor,dup); putnext(up_to_monitor,dup); putnext(down_to_device,mp); putnext(up_from_device,mp); [ I'm doing this from memory so the declarations &c may be wrong. ] A small amount of footling around to set this up would be needed, and the surrounding stream module code should be added, but it should be that simple. Unfortunately Guy is absolutely correct about the SVR3 and 3.1 tty drivers not being streams-based and hence this approach not being terribly useful. Perhaps some day this will come to pass (or we'll convert to v8). You could even stick this either above or below the line discipline module, depending on whether you wanted raw characters as typed or what gets passed up the the user process. >2) Streams modules live in the kernel, and not everybody can stuff an >arbitrary streams module into their kernel. True, alas, although one can in all the SVR3-based systems. Errr, can't you? >3) There is no such thing as a non-trivial 3-line streams module. :-) Right again! This one *is* trivial! >2) is the major point here; there are no tty watchers that consist solely of a >user-mode program that drops on top of a non-hacked UNIX system. Yup. This is the type of problem which *ought* to be simple but which isn't in a non-streams environment. Streams was created to be able to handle this sort of thing - following the example above, it succeeds. -- Jonathan Clark [NAC,attmail]!mtune!jhc An Englishman never enjoys himself except for some noble purpose.