[CRIU] Re: [PATCH 6/6] tty: Add checkpoint/restore for unix terminals

Pavel Emelyanov xemul at parallels.com
Mon Aug 27 15:35:30 EDT 2012


On 08/26/2012 08:35 PM, Cyrill Gorcunov wrote:
> 
> The main idea of TTY restore (the dumping is straight forward
> and has nothing special) is the following
> 
>  - because master peers must be opened before slave peers
>    we add new tty list into rst_info structure. This list
>    will carry tty information related to file descriptors
>    and a task will try to open master peers before slave
>    peers
> 
>  - because SID should be restored in a task context which
>    SID mathes peer's we introduce CTL_TTY special.
> 
> Anything else is straighforward -- master get opened via
> /dev/ptmx interface, while slaves are via /dev/pts/N.
> 
> Known problems
> 
>  - need to figure out how to deal with ttys which have some
>    data in buffers not yet flushed
> 
>  - when open ptmx with specified index we better need a patch
>    for kernel which would allow us to open pty with index in
>    one pass
> 
> [ avagin@:
>    - contol terminals restoration code complete rework
>    - overall code redesign and simplification
> ]
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  Makefile              |    1 +
>  cr-dump.c             |   23 ++-
>  cr-restore.c          |   16 +-
>  cr-show.c             |    6 +
>  files.c               |   93 ++++++-
>  image.c               |    1 +
>  include/crtools.h     |    4 +
>  include/files.h       |    3 +-
>  include/image.h       |    1 +
>  include/parasite.h    |    1 +
>  include/proc_parse.h  |    1 +
>  include/protobuf.h    |    1 +
>  include/pstree.h      |    1 +
>  include/ptrace.h      |    2 +-
>  include/tty.h         |   23 ++
>  proc_parse.c          |    2 +-
>  protobuf.c            |    2 +
>  protobuf/Makefile     |    1 +
>  protobuf/fdinfo.proto |    3 +-
>  protobuf/tty.proto    |   37 +++
>  ptrace.c              |    4 +-
>  tty.c                 |  710 +++++++++++++++++++++++++++++++++++++++++++++++++
>  22 files changed, 913 insertions(+), 23 deletions(-)
>  create mode 100644 include/tty.h
>  create mode 100644 protobuf/tty.proto
>  create mode 100644 tty.c
> 

After 5 minutes of looking through the patch I see that it _SHOULD_ be splitted in parts.

Plus one comment about the code:

> +       ... TTY_FILE_ENTRY__TTY_TYPE__PTY;

O_O Great Scott!

Thanks,
Pavel


More information about the CRIU mailing list