Available for testing: /dev/pts filesystem

H. Peter Anvin (hpa@transmeta.com)
24 Mar 1998 08:28:06 GMT


Since C. Scott Ananian added support for the SysV/Unix98 /dev/ptmx
multiplex pty master device, I thought I might as well fix the other
side of the equation. At:

ftp://ftp.kernel.org/pub/linux/kernel/hpa/devpts-2.1.91-pre1.diff

... there is a patch for a /dev/pts virtual filesystem which creates
pty device nodes as /dev/ptmx is open. A program (or rather, the C
library) would then use the TIOCGPTN ioctl() to get the pty number,
which would correspond to /dev/pts/<number>.

The normal operation is that this filesystem is mounted on /dev/pts;
with no arguments it creates device nodes owned by the user/group that
opened /dev/ptmx and mode 600; a typical use would be:

mount -t devpts -o gid=5,mode=620 none /dev/pts

... which would create the new device nodes with gid 5 (= tty on
RedHat systems) and mode 620. The uid would still be taken from the
process that opened /dev/ptmx.

[Known bug: currently it takes the ruid/rgid from the running
process. I haven't made up my mind yet if the right thing would be to
use the ruid, the euid, or the fsuid.]

This patch contains a modification to the VFS interface (no unlock on
put_super) which is required to support virtual filesystems without
any form of backing store. autofs v4 will require this change as
well.

As most of you are quite aware of, I usually don't like putting things
in the kernel. In particular, I believe devfs to be a bad idea.
However, in this particular case I have been persuaded to agree that
pty's are sufficiently special -- they really act more like pipes or
sockets than device nodes -- that a virtual filesystem is probably the
right thing to do. I have tried to keep the memory requirements of
this filesystem as small as possible.

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
        I am Bahá'í -- ask me about it or see http://www.bahai.org/
   "To love another person is to see the face of God." -- Les Misérables

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu