Re: Does anyone still care about BSD ptys?

From: Albert Cahalan
Date: Mon Feb 09 2004 - 11:08:46 EST


H. Peter Anvin writes:

> Does anyone still care about old-style BSD ptys,
> i.e. /dev/pty*? I'm thinking of restructuring
> the pty system slightly to make it more dynamic
> and to make use of the new larger dev_t, and
> I'd like to get rid of the BSD ptys as part of
> the same patch.

The BSD-style ptys are used all the time for
serial port emulation. The SysV-style ones are
useless for this, since they don't have a fixed
mapping from master to slave. You might make a
symlink from /dev/testbox to /dev/ptyp0, then
configure gdb to use /dev/testbox for remote
debugging. Then you start a remserial process
to connect /dev/ttyp0 with port 7455 on some
terminal server, and on the terminal server you
have remserial connect port 7455 to /dev/C7.
Now, whenever you run gdb, you're debugging
a test box over a serial line connected to the
terminal server. With SysV-style ttys, you
can't set up your config as nicely. The above
would likely have a few extra symlinks BTW.

In your use of the larger dev_t, please keep
the first 2047 or 2048 ptys as they are today.
Let the last major use the full 20-bit minor,
while restricting the first 7 minors to 8 bits.
This avoids breaking userspace software.

For example, due to the lack of /proc/*/tty links,
procps uses min+(maj-136)*256 to guess the number
of a SysV-style pty. A 32-bit dev_t will be handled
correctly by procps 3.2 if you extend the pty usage
as explained above.

Adding /proc/*/tty links solves the problem as
well, subject to a linux-2.7.0 version check.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/