Does anyone still care about BSD ptys?
Quoted 6 lines · H. Peter Anvin
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 largerdev_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.
Quoted 17 lines · Albert Cahalan
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/testboxto/dev/ptyp0, then configure gdb to use/dev/testboxfor remote debugging. Then you start a remserial process to connect/dev/ttyp0with 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.
Eh?! Have your server process create the appropriate symlinks... problem solved.
Quoted 5 lines
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.
No bloody way in hell. However, unless I have a strong reason to the contrary I'll keep them on major 136, so your little formula should still woprk.
Quoted 9 lines
For example, due to the lack of
/proc/*/ttylinks, procps uses min+(maj-136)*256 to guess the number of a SysV-style pty. A 32-bitdev_twill be handled correctly by procps 3.2 if you extend the pty usage as explained above.Adding
/proc/*/ttylinks solves the problem as well, subject to a linux-2.7.0 version check.
Presumably it should be: subject to an existence check.
-hpa
Quoted 18 lines · H. Peter Anvin
Quoted 16 lines · Albert Cahalan
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/testboxto/dev/ptyp0, then configure gdb to use/dev/testboxfor remote debugging. Then you start a remserial process to connect/dev/ttyp0with 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.
Quoted 2 lines
Eh?! Have your server process create the appropriate symlinks... problem solved.
1. That isn't what existing software does.
2. The symlinks couldn't be in /dev without running as root. Using /tmp isn't going to work if you're emulating serial ports for something that will tack a /dev on the front, unless users will put up with "../tmp/foo".
I should mention here that the SysV pty stuff is nearly 100% undocumented in the man pages. I get nothing for pts, pty, grantpt...
Quoted 9 lines
Quoted 5 lines
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.No bloody way in hell. However, unless I have a strong reason to the contrary I'll keep them on major 136, so your little formula should still woprk.
I'm glad that my formula will work. I doubt I'm the only one to be mapping from number to name though. Other software, and older procps releases, won't handle pty 256 through 2047 after you make your proposed change.
If you insist though, increase the procps release requirement to 3.2.0 with your patch please.
Quoted 10 lines
Quoted 8 lines
For example, due to the lack of
/proc/*/ttylinks, procps uses min+(maj-136)*256 to guess the number of a SysV-style pty. A 32-bitdev_twill be handled correctly by procps 3.2 if you extend the pty usage as explained above.Adding
/proc/*/ttylinks solves the problem as well, subject to a linux-2.7.0 version check.Presumably it should be: subject to an existence check.
That too of course, since there might not be a tty at all. Also, depending on implementation, some processes started in early boot might not have a tty name in spite of having a tty.
The version check avoids trying a link that is known to not exist on current kernels. For a long time now I've been moving the version. :-(
Quoted 3 lines · Albert Cahalan
I should mention here that the SysV pty stuff
is nearly 100% undocumented in the man pages.
I get nothing for pts, pty, grantpt...
% man pts
NAME
ptmx and pts - pseudo-terminal master and slave
% man grantpt
NAME
grantpt - grant access to the slave pseudotty
% man posix_openpt
NAME
posix_openpt - open a pseudo-terminal device
I have to conclude that your version of "the man pages" is older than man-pages-1.55. Current is man-pages-1.66.
Andries
Quoted 4 lines
I should mention here that the SysV pty stuff
is nearly 100% undocumented in the man pages.
I get nothing for pts, pty, grantpt...
Update your system! manpages-1.62 includes:
getpt(3)
grantpt(3)
ptsname(3)
unlockpt(3)
pts(4)
ptmx(4)
Now that should be sufficient, shouldn't it?
Regards,
Dominik Kubla
Signature · 2 lines
In buying horses and taking a wife shut your eyes tight and commend yourself to God.