[CRIU] [PATCH 2/4] tty: Add checkpoint/restore for unix terminals v3
Cyrill Gorcunov
gorcunov at openvz.org
Fri Sep 7 09:41:00 EDT 2012
Usually the PTYs represent a pair of links -- master peer and slave
peer. Master peer must be opened before slave. Internally, when kernel
creates master peer it also generates a slave interface in a form of
/dev/pts/N, where N is that named pty "index". Master/slave connection
unambiguously identified by this index.
Still, one master can carry multiple slaves -- for example a user opens
one master via /dev/ptmx and appropriate /dev/pts/N in sequence.
The result will be the following
master
`- slave 1
`- slave 2
both slave will have same master index but different file descriptors.
Still inside the kernel pty parameters are same for both slaves. Thus
only one slave parameters should be restored, there is no need to carry
all parameters for every slave peer we've found.
Not yet addressed problems:
- Also there is a second hardness with slave peers -- at moment of
restore the master end might be already closed for any reason so
to resolve such problem we need to open a fake master peer with
proper index and hook a slave on it, then we close master peer.
- 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
- Need to restore control terminals
- Need to fetch tty flags such as exclusive/packet-mode
[ avagin@:
- contol terminals restoration code complete rework
(not addressed in this patch)
- overall code redesign and simplification
]
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
CC: Andrey Vagin <avagin at openvz.org>
---
Makefile | 1 +
cr-dump.c | 15 +-
cr-restore.c | 10 +
files.c | 8 +
image.c | 1 +
include/crtools.h | 1 +
include/image.h | 1 +
include/protobuf.h | 1 +
include/tty.h | 24 ++
protobuf.c | 2 +
protobuf/Makefile | 1 +
protobuf/fdinfo.proto | 1 +
protobuf/tty.proto | 52 ++++
tty.c | 752 +++++++++++++++++++++++++++++++++++++++++++++++++
14 files changed, 867 insertions(+), 3 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: 0002-tty-Add-checkpoint-restore-for-unix-terminals-v3.patch
Type: text/x-patch
Size: 24816 bytes
Desc: not available
Url : http://openvz.org/pipermail/criu/attachments/20120907/e1382508/0002-tty-Add-checkpoint-restore-for-unix-terminals-v3-0001.bin
More information about the CRIU
mailing list