[lkml]   [1998]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: pty pairs in POXIX with devpts
    On Tue, 28 Apr 1998 (H. Peter Anvin) wrote:

    > Followup to: <>
    > By author: (Peter Benie)
    > In newsgroup:
    > >
    > > What does it do if both /dev/ptmx and /dev/pty?? devices exist?
    > >
    > > Suppose a user runs a program that allocates a pty by scanning the
    > > /dev/pty?? devices and chowning the corresponding slave device when it
    > > manages to open a pty master. The program may terminate without
    > > cleaning up. (Let's say the user sent it a SIGQUIT.) The master and
    > > slave sides of the pty are closed, so the pty can be allocated again,
    > > but the owner of the slave device remains as the user who started the
    > > program.
    > >
    > > Now suppose another user runs a program that allocates a pty using
    > > /dev/ptmx and /dev/pts/??. There's a good chance that it will get the
    > > pty from the program that just died. Now the pty slave is available
    > > twice - once to the correct user in /dev/pts, and once to somebody
    > > else as /dev/tty??.
    > >
    > > To make the device safe, you still have to use vhangup(), but now you
    > > have to locate the corresponding /dev/tty?? entry and chown it, even
    > > though you are using SysV-style pty allocation.
    > >
    > > IMO, it would be sensible for slave devices in /dev/pts to have a
    > > different major number so that the two allocation schemes were better
    > > separated from each other.
    > >
    > This is a very good point. Obviously you can't allocate it twice, but
    > there is nastiness about having the two allocated from the same pool.
    > One possibility is to remove the restriction that you need to have
    > used /dev/ptmx in order for the device node to exist in /dev/pts, and
    > make all the /dev/tty?? entries symlinks to /dev/pts. Does anyone
    > know if that solution would work properly? I have a nasty feeling it
    > wouldn't.

    We dealt with this with devfs. IIRC, libc 5.X doesn't like symlinks to
    ttys. glibc might handle this better, I don't recall. Richard Gooch
    patched libc to work around this problem; I've cc'ed this message to him
    for his comments.
    @ @
    C. Scott Ananian: / Declare the Truth boldly and
    Laboratory for Computer Science/Crypto / without hindrance.
    Massachusetts Institute of Technology /META-PARRESIAS AKOLUTOS:Acts 28:31
    -.-. .-.. .. ..-. ..-. --- .-. -.. ... -.-. --- - - .- -. .- -. .. .- -.
    PGP key available via finger and from

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to

     \ /
      Last update: 2005-03-22 13:42    [W:0.025 / U:0.284 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site