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

Cyrill Gorcunov gorcunov at openvz.org
Wed Aug 29 06:32:21 EDT 2012


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 lists into rst_info structure. The lists
   will carry tty information related to file descriptors
   and a task will try to open master peers before slave
   ones

 - because SID should be restored in a task context which
   SID mathes peer's we introduce CTL_TTY_OFF special file
   descriptor which allow us to transfer restored control
   terminal to the task which needs it.

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, at moment this data will
   be simply lost during c/r

 - we might need an additional option which would try to open
   tty with specified index until success instead of exiting
   with error if more than 32 attempts were done, patching
   kernel is not the option here since we can't break ABI
   the kernel provides at moment

[ 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          |   19 +-
 cr-restore.c       |   14 +
 cr-show.c          |    6 +
 files.c            |   21 +-
 image.c            |    1 +
 include/crtools.h  |    2 +
 include/image.h    |    1 +
 include/protobuf.h |    1 +
 include/tty.h      |   23 ++
 protobuf.c         |    2 +
 protobuf/Makefile  |    1 +
 protobuf/tty.proto |   37 +++
 tty.c              |  711 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 14 files changed, 828 insertions(+), 12 deletions(-)
 create mode 100644 include/tty.h
 create mode 100644 protobuf/tty.proto
 create mode 100644 tty.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0010-tty-Add-checkpoint-restore-for-unix-terminals.patch
Type: text/x-patch
Size: 25593 bytes
Desc: not available
Url : http://openvz.org/pipermail/criu/attachments/20120829/b7a25557/0010-tty-Add-checkpoint-restore-for-unix-terminals-0001.bin


More information about the CRIU mailing list