Subject: Re: Linux pseudo pty
To: Greywolf <>
From: Thor Lancelot Simon <>
List: tech-kern
Date: 02/19/2001 15:22:41
On Wed, Feb 14, 2001 at 09:33:08PM -0800, Greywolf wrote:
> # Solaris, for instance, provides BSD-style (SunOS 4 compatibility) ptys named
> # /dev/[pt]typ[0-9] and so forth, but they aren't in the same device
> # numberspace, because the naming scheme is quite limited.  In the case of
> # /dev/pts having its own device space, you could have as many nodes as you
> # want (or even a kernel fs similar to fdesc), without worrying about running
> # out of letters.
> They're not in the same device numberspace because they're not the same
> devices.  The /dev/pts space is set up by ptmx which basically plumbs
> a stream between device and process and effectively removes, i.e., 
> the daemon from the loop, so it doesn't actually have to process anything
> under Solaris.  The telnetd establishes the ptmx connection and then
> hands all the back/forth communication to the kernel directly.  Since
> the ssh processing layer is not built into the kernel, sshd uses
> BSD-style ptys and has to remain alive and tend to the encryption.

That's not really an accurate description.  While it is *possible* to push
an arbitrary protocol-processing module onto a stream, the use of /dev/ptmx
to acquire a file descriptor for a pty does not imply that any such push
has occurred.

You should look at what sshd (if you like), the Borman/MIT telnetd, or
indeed any other portable program that uses ptys does on systems that
don't provide BSD-style ptys.  /dev/ptmx is used, no magical modules are
pushed, and everything works pretty much like it would with ptys done the
BSD way.  Or see the Stevens book; there are good examples in there.