Skip to contentSkip to conversation

Does anyone still care about BSD ptys?

DISCUSSION H. Peter Anvin 13 participants 23 messages Feb 9, 2004 – Feb 10, 2004

lore
Share & tools
lore
#0 lore raw

Hi all,

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.

-hpa

Signature · 4 lines
PGP public key available - finger [email protected]
Key fingerprint: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
"The earth is but one country, and mankind its citizens."  --  Bahá'u'lláh
Just Say No to Morden * The Shadows were defeated -- Babylon 5 is renewed!!
#1 lore raw
Quoted 6 lines · H. Peter Anvin

Hi all,

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.

As long as you make it a 2.7-thing, I don't thing anyone would mind much...

Regards: David Weinehall

Signature · 3 lines
 /) David Weinehall <[email protected]> /) Northern lights wander      (\
//  Maintainer of the v2.0 kernel   //  Dance across the winter sky //
\)  http://www.acc.umu.se/~tao/    (/   Full colour fire           (/
#2 lore raw
Quoted 4 lines · David Weinehall
Quoted 2 lines · H. Peter Anvin

Hi all,

Quoted 8 lines
Quoted 4 lines

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.

As long as you make it a 2.7-thing, I don't thing anyone would mind much...

Right, this is basically for 2.6/2.7 depending on if there are any stragglers who still use these things...

-hpa

#3 lore raw
Quoted 2 lines · H. Peter Anvin

Right, this is basically for 2.6/2.7 depending on if there are any stragglers who still use these things...

nettty (whatever you may find it named) uses the BSD pty interface. I don't know how much work it would be to get it to use /dev/pts. I've not used it for many years, so I cannot say anyone would care if it stopped working.

The code is at least 7 years old (originally written by Livingston.)

--Ricky

#4 lore raw
Quoted 11 lines · Ricky Beam
Quoted 2 lines · H. Peter Anvin

Right, this is basically for 2.6/2.7 depending on if there are any stragglers who still use these things...

nettty (whatever you may find it named) uses the BSD pty interface. I don't know how much work it would be to get it to use /dev/pts. I've not used it for many years, so I cannot say anyone would care if it stopped working.

The code is at least 7 years old (originally written by Livingston.)

The porting effort is usually trivial assuming one has access to the source.

-hpa

#5 lore raw
In reply to H. Peter Anvin

In article <[email protected]>,

Quoted 4 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 larger dev_t, and I'd like to get rid of the BSD ptys as part of the same patch.

bootlogd(8) which is used by Debian and Suse is started as the first thing at boottime. It needs a pty, and tries to use /dev/pts if it's there but falls back to BSD style pty's if /dev/pts isn't mounted - which will be the case 99% of the time.

Mike.

#6 lore raw
Quoted 11 lines · Miquel van Smoorenburg

In article <[email protected]>,

Quoted 4 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 larger dev_t, and I'd like to get rid of the BSD ptys as part of the same patch.

bootlogd(8) which is used by Debian and Suse is started as the first thing at boottime. It needs a pty, and tries to use /dev/pts if it's there but falls back to BSD style pty's if /dev/pts isn't mounted - which will be the case 99% of the time.

So what's the problem with calling mount(2)?

#7 lore raw
Quoted 8 lines · On 2004.02.09 11:09, [email protected] wrote:
Quoted 7 lines · Miquel van Smoorenburg

In article <[email protected]>,

Quoted 4 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 larger dev_t, and I'd like to get rid of the BSD ptys as part of the same patch.

Quoted 6 lines
Quoted 4 lines

bootlogd(8) which is used by Debian and Suse is started as the first thing at boottime. It needs a pty, and tries to use /dev/pts if it's there but falls back to BSD style pty's if /dev/pts isn't mounted - which will be the case 99% of the time.

So what's the problem with calling mount(2)?

Well, nothing really, but removing BSD style support in the 2.6 series now will break existing installations. Doing it in 2.7 would be fine.

Mike.

#8 lore raw
In reply to [email protected]

In article <[email protected]>,
<[email protected]> wrote:

| On Mon, Feb 09, 2004 at 08:59:39AM +0000, Miquel van Smoorenburg wrote:
| > In article <[email protected]>,
| > H. Peter Anvin <[email protected]> wrote:
| > >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.
| > 
| > bootlogd(8) which is used by Debian and Suse is started as the
| > first thing at boottime. It needs a pty, and tries to use /dev/pts
| > if it's there but falls back to BSD style pty's if /dev/pts isn't
| > mounted - which will be the case 99% of the time.
| 
| So what's the problem with calling mount(2)?

Other than making an optional part of the kernel required... Not impossible but something to consider.

Signature · 3 lines
bill davidsen <[email protected]>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.
#9 lore raw
Followup to:  <[email protected]>
By author:    [email protected] (bill davidsen)
In newsgroup: linux.dev.kernel
Quoted 9 lines

In article <[email protected]>,
<[email protected]> wrote:

| So what's the problem with calling mount(2)?

Other than making an optional part of the kernel required... Not impossible but something to consider.

With my changes the devpts filesystem will be pretty much an integral part of the pty system (since the whole idea is to use the devpts filesystem to keep track of the tty structures) so that's not an issue.

-hpa

Signature · 4 lines
PGP public key available - finger [email protected]
Key fingerprint: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
"The earth is but one country, and mankind its citizens."  --  Bahá'u'lláh
Just Say No to Morden * The Shadows were defeated -- Babylon 5 is renewed!!
#10 lore raw
In reply to Miquel van Smoorenburg
Quoted 11 lines · Miquel van Smoorenburg

In article <[email protected]>,

Quoted 4 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 larger dev_t, and I'd like to get rid of the BSD ptys as part of the same patch.

bootlogd(8) which is used by Debian and Suse is started as the first thing at boottime. It needs a pty, and tries to use /dev/pts if it's there but falls back to BSD style pty's if /dev/pts isn't mounted - which will be the case 99% of the time.

mounting proc and dev/pts is the first thing our boot script does, since a very long time. So it will not break anything.

Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
#11 lore raw
In reply to H. Peter Anvin
Quoted 1 line · H. Peter Anvin

Does anyone still care about old-style BSD ptys, i.e. /dev/pty*?

I use them quite a lot for testing serial port stuff in shell scripts, eg connect one process which expects a serial port to /dev/ttys0 and another to /dev/ptys0. I expect there is a sane way of doing this new style pty's - I just don't know it!

Signature · 2 lines
Nick Craig-Wood
[email protected]
#12 lore raw
Quoted 7 lines · Nick Craig-Wood
Quoted 1 line · H. Peter Anvin

Does anyone still care about old-style BSD ptys, i.e. /dev/pty*?

I use them quite a lot for testing serial port stuff in shell scripts, eg connect one process which expects a serial port to /dev/ttys0 and another to /dev/ptys0. I expect there is a sane way of doing this new style pty's - I just don't know it!

Look up "Pseudo-Terminals" in the libc info pages.
http://www.delorie.com/gnu/docs/glibc/libc_376.html

-- Jamie

#13 lore raw
Quoted 11 lines · Jamie Lokier
Quoted 7 lines · Nick Craig-Wood
Quoted 1 line · H. Peter Anvin

Does anyone still care about old-style BSD ptys, i.e. /dev/pty*?

I use them quite a lot for testing serial port stuff in shell scripts, eg connect one process which expects a serial port to /dev/ttys0 and another to /dev/ptys0. I expect there is a sane way of doing this new style pty's - I just don't know it!

Look up "Pseudo-Terminals" in the libc info pages.
http://www.delorie.com/gnu/docs/glibc/libc_376.html

Interesting but doesn't help my shell script!

Signature · 2 lines
Nick Craig-Wood
[email protected]
#14 lore raw
Quoted 2 lines · H. Peter Anvin
Quoted 1 line

Does anyone still care about old-style BSD ptys, i.e. /dev/pty*?

Only people who want to log-in from the network..... Of course you could force a re-write of all the stuff like telnet, adding another layer of bugs that'll take another N years to find and remove.

I think you really need to leave the "legacy" stuff alone. Somebody installs a new kernel and then can't log in from the Network. Not good at all.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.

#15 lore raw
Quoted 7 lines · Richard B. Johnson
Quoted 2 lines · H. Peter Anvin
Quoted 1 line

Does anyone still care about old-style BSD ptys, i.e. /dev/pty*?

Only people who want to log-in from the network..... Of course you could force a re-write of all the stuff like telnet, adding another layer of bugs that'll take another N years to find and remove.

What are you talking about? On my system (Debian Sid) there are no BSD pty's (i removed the device nodes) and everything works without even a recompile.

Regards,
Dominik

Signature · 1 line
This fortune was brought to you by the people at Hewlett-Packard.
#16 lore raw
Quoted 9 lines · Dominik Kubla
Quoted 7 lines · Richard B. Johnson
Quoted 2 lines · H. Peter Anvin
Quoted 1 line

Does anyone still care about old-style BSD ptys, i.e. /dev/pty*?

Only people who want to log-in from the network..... Of course you could force a re-write of all the stuff like telnet, adding another layer of bugs that'll take another N years to find and remove.

Quoted 6 lines

What are you talking about? On my system (Debian Sid) there are no BSD pty's (i removed the device nodes) and everything works without even a recompile.

Regards,
Dominik

Really? Then you don't have anybody trying to log-in from the network using telnet, then do you?

The BSD virtual terminals go in pairs, /dev/ptyp* /dev/ttyp*

Script started on Mon Feb 9 13:19:16 2004

# ls -la /dev/ptyp*
crw-rw-rw-   1 root     root       2,   0 Feb  9 13:17 /dev/ptyp0
crw-rw-rw-   1 root     root       2,   1 Feb  9 13:19 /dev/ptyp1
crw-rw-rw-   1 root     root       2,   2 Feb  5 11:22 /dev/ptyp2
crw-rw-rw-   1 root     root       2,   3 Mar 19  2003 /dev/ptyp3
[SNIPPED...]
# ls -la /dev/ttyp0
# ls -la /dev/ttyp*
crw--w----   1 rjohnson tty        3,   0 Feb  9 13:17 /dev/ttyp0
crw-rw-rw-   1 root     root       3,   1 Feb  9 13:19 /dev/ttyp1
crw-rw-rw-   1 root     root       3,   2 Feb  5 11:22 /dev/ttyp2
crw-rw-rw-   1 root     root       3,   3 Mar 19  2003 /dev/ttyp3
Script done on Mon Feb  9 13:20:03 2004

Here, rjohnson is logged in using telnet. The code is so common that there is even some C runtime library support in later C libraries, it's called forkpty(). man forkpty. It does a lot of the dirty-work of using BSD virtual terminals.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
Note 96.31% of all statistics are fiction.

#17 lore raw
Quoted 7 lines · Richard B. Johnson

Really? Then you don't have anybody trying to log-in from the network using telnet, then do you?

The BSD virtual terminals go in pairs, /dev/ptyp* /dev/ttyp*

# ls -la /dev/ttyp*
crw--w----   1 rjohnson tty        3,   0 Feb  9 13:17 /dev/ttyp0

Then your telnetd needs 'fixing'. This works fine, with /dev/pts on
my Debian stable/Woody system:

20:56:57 0$ w athan

USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU  WHAT
athan    pts/26   XXXXXXXXXXXXXX   20:56    1:04   0.09s  0.09s  -bash

That's a telnet login just started.

This is specifically using the 'telnetd-ssl' package in Debian.

-Ath

Signature · 4 lines
- Athanasius = Athanasius(at)miggy.org / http://www.miggy.org/
                  Finger athan(at)fysh.org for PGP key
	   "And it's me who is my enemy. Me who beats me up.
Me who makes the monsters. Me who strips my confidence." Paula Cole - ME
#18 lore raw
In reply to Richard B. Johnson
Quoted 15 lines · Richard B. Johnson
Quoted 13 lines · Dominik Kubla
Quoted 7 lines · Richard B. Johnson
Quoted 2 lines · H. Peter Anvin
Quoted 1 line

Does anyone still care about old-style BSD ptys, i.e. /dev/pty*?

Only people who want to log-in from the network..... Of course you could force a re-write of all the stuff like telnet, adding another layer of bugs that'll take another N years to find and remove.

What are you talking about? On my system (Debian Sid) there are no BSD pty's (i removed the device nodes) and everything works without even a recompile.

Quoted 6 lines
Quoted 2 lines

Regards,
Dominik

Really? Then you don't have anybody trying to log-in from the network using telnet, then do you?

Really? How do you diagnose my system without even logging in?

[kubla@duron] telnet server1
Trying 192.168.xxx.xxx...
Connected to server1.intern.kubla.de.
Escape character is '^]'.
[SSL - attempting to switch on SSL]
[SSL - handshake starting]
[SSL - OK]
Password:
Last login: Tue Feb 10 12:03:36 2004 from duron.intern.kubla.de on pts/0 Linux server1 2.6.0-1-k7 #2 Sun Jan 11 17:06:46 EST 2004 i686 GNU/Linux

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.
You have mail.
[kubla@server1] tty
/dev/pts/0
[kubla@server1] ls -l /dev/pts/0
crw------- 1 kubla tty 136, 0 Feb 10 12:08 /dev/pts/0

Quoted 1 line

The BSD virtual terminals go in pairs, /dev/ptyp* /dev/ttyp*

...

Quoted 4 lines

Here, rjohnson is logged in using telnet. The code is so common that there is even some C runtime library support in later C libraries, it's called forkpty(). man forkpty. It does a lot of the dirty-work of using BSD virtual terminals.

Try removing you BSD pty's and most likely you will see that telnetd happily uses System V pty's. If not then you should really update your telnetd. Both netkit-telnetd and telnetd-ssl, which is derived from it, can use System V-ptys since at least 5 years, probably even longer. If both BSD and System V pty's are present on the system, the code will use BSD. (That's why i removed the BSD pty's in the first place!)

Regards,
Dominik

Signature · 3 lines
"Conversion, fastidious Goddess, loves blood better than brick, and feasts
most subtly on the human will."
-- Virginia Woolf, "Mrs. Dalloway"
#19 lore raw
Followup to:  <[email protected]>
By author:    Dominik Kubla <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 8 lines

Try removing you BSD pty's and most likely you will see that telnetd happily uses System V pty's. If not then you should really update your telnetd. Both netkit-telnetd and telnetd-ssl, which is derived from it, can use System V-ptys since at least 5 years, probably even longer. If both BSD and System V pty's are present on the system, the code will use BSD. (That's why i removed the BSD pty's in the first place!)

Eep!

Using BSD ptys is a security hazard. They should *definitely* not be usef preferentially. On my system (RH9) they aren't used by telnet even though they exist.

-hpa

Signature · 4 lines
PGP public key available - finger [email protected]
Key fingerprint: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
"The earth is but one country, and mankind its citizens."  --  Bahá'u'lláh
Just Say No to Morden * The Shadows were defeated -- Babylon 5 is renewed!!
#20 lore raw
In reply to H. Peter Anvin
Quoted 10 lines · H. Peter Anvin

Hi all,

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.

-hpa

Hi,

Thanks for asking. I had a critical application that depended on
them until last week and am now happy to say that even they have moved on (I protested the small number of available ptys and explained the direction that Unix is going with Unix98 style ptys. Now I depend on those. I would be very interested in seeing what you do with your pty restructuring as I have a large amount of serial devices.

Karl Tatgenhorst

#21 lore raw
Quoted 12 lines · Karl Tatgenhorst

Hi,

Thanks for asking. I had a critical application that depended on
them until last week and am now happy to say that even they have moved on (I protested the small number of available ptys and explained the direction that Unix is going with Unix98 style ptys. Now I depend on those. I would be very interested in seeing what you do with your pty restructuring as I have a large amount of serial devices.

Karl Tatgenhorst

LOL :)

If the changes I'm working on work out you should be able to have hundreds of thousands of ptys if you have enough memory.

-hpa

#22 lore raw
Quoted 12 lines

LOL :)

If the changes I'm working on work out you should be able to have hundreds of thousands of ptys if you have enough memory.

-hpa

Sounds sweet, I am limited though by 4 GB of RAM on a dual PIV 2.8 Ghz IBM server. Legacy character apps need so much more :-)