devpts

Donnie Roos dr at kaneda.demon.nl
Thu Nov 16 14:33:52 PST 2000


A followup to my own post. Hopefully this information will be usefull
for someone else.

I think I have finally figured out how devpts and pseudo-terminals work.
telnet, xterm and other software that gives you an terminal that is not
dirctly attached to hardware use pseudo-terminals. To make this work
devices need to be created and these are /dev/ttyp[0..f] and /dev/ptyp[0..f]

This gives only 16 terminals. As this needed to be extended more
devices had to be created. The names for these devices continue from
the letter 'p'. This follows the (weird) ordering of pqr..za..e .

So the namerange of pseudo-terminals is as follows:
/dev/tty[p-z,a-e][0-f]
/dev/pty[p-z,a-e][0-f]

I haven't found documentation about why this system was applied and
not something like extending the last (hexadecimal) value (/dev/pty10,
/dev/ptyff). But whatever were going to do away with it anyway.

devpts/Unix98 replaces this system. To use this do the following.
kernel config: enable UNIX98_PTY (char devices) and DEVPTS (filesystem)

mknod /dev/ptmx c 5 2
chmod 666 /dev/ptmx
mkdir /dev/pts

add the following to fstab. GID should be the id of the tty group
devpts /dev/pts devpts gid=4,mode=620 0 0

After doing this reboot (or mount devpts) and everything should
be working. To check this telnet to your system and type "who"
'who' gives the devices that are used by all logged in persons
you should see /dev/pts/0 or similar.

If you want to you can now delete the old device-files
(yeah, clean them up. Too many there as it is, go devfs)

backup & remove: do a "ls tty[p-za-e][0-9a-f]" first to check if the
correct files are selected. Do the same for 'pty' (pty* should also
work AFAIK there are no other devices that start with pty).
DO NOT USE tty*. tty, tty0-8 & ttyS0-4 are needed for correct working
of you system
tar -cf /dev_pty.tar pty[p-za-e][0-9a-f]
tar -cf /dev_tty.tar tty[p-za-e][0-9a-f]
rm tty[p-za-e][0-9a-f]
rm pty[p-za-e][0-9a-f]

/dev is much more readable now :)

note:
Software that uses pseudo-terminals must support Unix98 pty's.
This means that it might be necesary to recompile, patch or rewrite
the software to make use of Unix98 pty's. Also glibc 2.1 or higher
must be installed on your system.

I am using OpenSSH and had no problems switching. After a reboot the
SSH-daemon used the Unix98 pty's. If you have software that does not
support Unix98 pty's do not delete the pty & tty devices.


Donnie Roos


-- 
Unsubscribe: send email to lfs-apps-request at linuxfromscratch.org
and put unsubscribe in the subject header of the message




More information about the blfs-support mailing list