[CRIU] [PATCH 5/5] tty: Add restoration of controlling terminal v4

Cyrill Gorcunov gorcunov at openvz.org
Wed Sep 12 11:44:23 EDT 2012


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: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-restore.c      |    6 ++++
 files.c           |   23 ++++++++++++++++-
 include/crtools.h |    1 +
 include/files.h   |    1 +
 include/pstree.h  |    1 +
 tty.c             |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 104 insertions(+), 1 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-tty-Add-restoration-of-controlling-terminal-v4.patch
Type: text/x-patch
Size: 5083 bytes
Desc: not available
Url : http://openvz.org/pipermail/criu/attachments/20120912/8115ae66/0005-tty-Add-restoration-of-controlling-terminal-v4-0001.bin


More information about the CRIU mailing list