PTY's
Dan Bernstein
brnstnd at kramden.acf.nyu.edu
Thu Jul 26 06:37:54 AEST 1990
In article <7170 at star.cs.vu.nl> maart at 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
More information about the Comp.unix.questions
mailing list