• Cyrill Gorcunov's avatar
    tty: Add restoration of controlling terminal v4 · 20d6762d
    Cyrill Gorcunov authored
    The idea behind is pretty simple -- once we find
    that there is a controlling terminal present we
    do call ioctl on appropriate /dev/pts/N.
    
    This is done in a bit unusuall manner. When we
    find that there is a controling terminal present
    we do create an additional FdinfoEntry for it
    with object id taken from existing master peer.
    
    The file engine stack this new FdinfoEntry on
    fd_info_head head list. Thus we will have at
    least two entries on this list. One for real
    Fdinfo associated with master peer and one for
    our new generated Fdfinfo entry, it depends on
    pid which one become a file master.
    
    Finally we do use post_open_fd hook in our
    tty code which allows us to open controlling
    terminal and yield proper ioctl on it.
    
    v2:
     - restore control terminals via service fd,
       still need to speedup service fd retrieval.
    
    v3:
     - use prepare_ctl_tty() helper to generate
       control terminal fdinfo entry
    
    v4:
     - use post_open_fd
    Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
    20d6762d
tty.c 18.3 KB