Subject: Linux pseudo pty
To: None <tech-kern@netbsd.org>
From: Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr>
List: tech-kern
Date: 02/14/2001 21:08:32
> 4. Look at the cloning device on compat_svr4 to see how the pty
> multiplexor code can be made to work. I am not sure what linux needs
> [svr4_net.c].

There is some stuff about ptmx in this file: svr4_ptm_alloc. And it
seems Linux binaries try to use that device

   673 xterm    NAMI  "/emul/linux/dev/ptmx"
   673 xterm    NAMI  "/dev/ptmx"
   673 xterm    RET   open -1 errno 2 No such file or directory
   673 xterm    CALL  open(0x7fffd0b8,0x2,0x76)
   673 xterm    NAMI  "/emul/linux/dev/ptyp0"
   673 xterm    NAMI  "/dev/ptyp0"
   673 xterm    RET   open -1 errno 5 Input/output error
   673 xterm    CALL  open(0x7fffd0b8,0x2,0x76)
   673 xterm    NAMI  "/emul/linux/dev/ptyp1"
   673 xterm    NAMI  "/dev/ptyp1"
   673 xterm    RET   open -1 errno 5 Input/output error
   673 xterm    CALL  open(0x7fffd0b8,0x2,0x76)
   673 xterm    NAMI  "/emul/linux/dev/ptyp2"
   673 xterm    NAMI  "/dev/ptyp2"
   673 xterm    RET   open -1 errno 5 Input/output error
   673 xterm    CALL  open(0x7fffd0b8,0x2,0x76)
   673 xterm    NAMI  "/emul/linux/dev/ptyp3"
   673 xterm    NAMI  "/dev/ptyp3"
   673 xterm    RET   open 4

I've got really little knoledge about terminal handling. I assume that
ptmx would give some important information about which ptyp to open, and
if it cannot use it, it tries all of them sequentially.

What is the /dev/ptmx exactly for, and how svr4_net.c could help? Do I
need to make a device driver for /dev/ptmx? And if I do, where will it
go in the kernel sources?

There is another strange error later. xterm run utempter (I don't know
what this binary is for, there is no man page about it), and it fails
with this:

   676 utempter GIO   fd 2 wrote 45 bytes
       "fd 3 is not a master pty device (it is 4, 3)
       "

I assume this 4,3 is major and minor? Do we lack a device translation
there that should be handled in linux_sys_fakedev?

-- 
Emmanuel Dreyfus.
NetBSD, parceque je le vaux bien.
p99dreyf@criens.u-psud.fr