Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!rutgers!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.unix.questions Subject: Re: PTY's Message-ID: <5756:Jul2520:37:5490@kramden.acf.nyu.edu> Date: 25 Jul 90 20:37:54 GMT References: <*%2$X6-@rpi.edu> <7170@star.cs.vu.nl> Organization: IR Lines: 31 In article <7170@star.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: > It is not that trivial. I'd say it's almost impossible to get it > _completely_ right when using the BSD pty driver... > You could use the `mtty' package I've just posted to alt.sources. Or the more powerful ``pty'' package I just posted to alt.sources. An official version should appear sometime in comp.sources.unix. > Check the accompanying documentation and you'll understand the > difficulties... No offense, Maarten, but I think some of your ``difficulties'' are blown a bit out of proportion. Convention dictates that the pty is used only until the child exits; so the master need not close the slave side. (In fact, it should not close the slave side, as it has to reset the slave's modes before exiting. This is more of a problem for pty, which is meant to act as the sole interface between pseudo-terminals and the rest of the system, than it is for mtty.) The master *can* handle the I/O while waiting for a SIGCHLD; it just mustn't die within the SIGCHLD handler. Look at the pty code for an example of how to do this correctly. You complain that ``anyone can open the tty slave,'' but in fact that's only a reflection of a poor security model. pty is much more careful about security matters, though it can be compiled and run without privileges. ---Dan