Skip to contentSkip to conversation

something funny about tty's on 2.6.4-rc1-mm1

DISCUSSION Albert Cahalan 3 participants 4 messages Mar 2, 2004 – Mar 3, 2004

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines

As RBJ said, ptys are now recycled in pid-like fashion, which means numbers won't be reused until wraparound happens. This is good for security/fault tolerance, at least to some minor degree.

Ouch. It's bad for display and bad for typing. What is easier to type?

ps -t pts/6
ps -t pts/1014962

(and yes, I really type these -- I don't have a third hand to operate the mouse simultaneously)

What looks better?

UID        PID  PPID  C    SZ  RSS PSR STIME TTY          TIME CMD
albert    3339  2114  0   771 1684   0 Feb26 pts/6    00:00:00 bash
albert    3149  2514  0   771 1684   0 Feb26 pts/1004922 00:00:00 bash
albert    3835  2164  0   771 1684   0 Feb26 pts/8    00:00:00 bash
albert    4136  3114  0   771 1684   0 Feb26 pts/1013866 00:00:00 bash
albert    4739  2119  0   771 1684   0 Feb26 pts/9    00:00:00 bash

Better way:

Have a soft limit, initially set at 99. When 2/3 of the ptys are in use, increase the soft limit to 999, then to 9999, 99999, and finally to 999999.

This way, a plain 1-person desktop user would never have a pty name longer than pts/99 and an insanely busy server could go as high as needed.

#1 lore raw
Followup to:  <1078254284.2232.385.camel@cube>
By author:    Albert Cahalan <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 6 lines
Quoted 5 lines

As RBJ said, ptys are now recycled in pid-like fashion, which means numbers won't be reused until wraparound happens. This is good for security/fault tolerance, at least to some minor degree.

Quoted 9 lines

Ouch. It's bad for display and bad for typing.
What is easier to type?

ps -t pts/6
ps -t pts/1014962

(and yes, I really type these -- I don't have a
third hand to operate the mouse simultaneously)

(Programmable) tab completion, anyone?

-hpa

#2 lore raw
In reply to Albert Cahalan
Quoted 11 lines · Albert Cahalan
Quoted 5 lines

As RBJ said, ptys are now recycled in pid-like fashion, which means numbers won't be reused until wraparound happens. This is good for security/fault tolerance, at least to some minor degree.

Ouch. It's bad for display and bad for typing.
What is easier to type?

ps -t pts/6
ps -t pts/1014962

IMHO more important: what about utmp? It would become terribly large. Beside that, such huge numbers won't fit into ut_id.

Ciao, ET.

--[man utmp extract]--
...
char ut_id[4]; /* init id or abbrev. ttyname */
...
xterm(1) and other terminal emulators directly create a USER_PROCESS record and generate the ut_id by using the last two letters of /dev/ttyp%c or by using p%d for /dev/pts/%d. If they find a DEAD_PROCESS for this id, they recycle it, otherwise they create a new entry.
...

#3 lore raw
Quoted 6 lines · Edgar Toernig

IMHO more important: what about utmp? It would become terribly large. Beside that, such huge numbers won't fit into ut_id.

Ciao, ET.

Quoted 10 lines

--[man utmp extract]--
...
char ut_id[4]; /* init id or abbrev. ttyname */
...
xterm(1) and other terminal emulators directly create a USER_PROCESS record and generate the ut_id by using the last two letters of /dev/ttyp%c or by using p%d for /dev/pts/%d. If they find a DEAD_PROCESS for this id, they recycle it, otherwise they create a new entry.
...

That's broken for anything more than 1000 ptys, OR if you're using BSD and Unix98 ptys at the same time.

In other words, it's totally broken.

-hpa