• Kirill Tkhai's avatar
    files: Move CTL_TTY_OFF fixup to generic file engine · 7a6fe6f0
    Kirill Tkhai authored
    There are two problems. The first is CTL_TTY_OFF occupies
    one of the biggest available fds in the system. It's a number
    near service_fd_rlim_cur. Next patches want to allocate
    service fds lower, than service_fd_rlim_cur, and they want
    to know max used fd from file fles after the image reading.
    
    But since one of fds is already set very big (CTL_TTY_OFF)
    on a stage of collection fles, the only availabe service
    fds are near service_fd_rlim_cur. It's vicious circle,
    and the only way is to change ctl tty fd allocation way.
    
    The second problem is ctl tty is ugly out of generic file
    engine fixup (see open_fd()). This is made because ctl tty
    is the only slave fle, which needs additional actions
    (see tty_restore_ctl_terminal()). Another file types just
    receive their slave fle, and do not do anything else.
    
    This patch moves ctl tty to generic engine and solves all
    the above problems. To do that, we implement new CTL_TTY
    file type, which open method waits till slave tty is received
    and then calls tty_restore_ctl_terminal() for that. It fits
    to generic engine well, and allocates fd via find_unused_fd(),
    and do not polute file table by big fd numbers.
    
    Next patch will kill currently unneed CTL_TTY leftovers
    and will remove CTL_TTY_OFF service fd from criu.
    Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
    Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
    7a6fe6f0
fdinfo.proto 1.56 KB