No description
Find a file
Cyrill Gorcunov 89a7a45d37 tty: Add checkpoint/restore for unix terminals v6
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:

- At moment of restore the master peer 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,
  this can't be done without kernel patching

[ avagin@:
   - ideas on contol terminals restore
   - overall code redesign and simplification
]

v4:
 - drop redundant pid from dump_chrdev
 - make sure optional fown is passed on regular ptys
 - add a comments about zeroifying termios
 - get rid of redundant empty line in files.c

v5 (by avagin@):
 - complete rework of tty image format, now we have
   two files -- tty.img and tty-info.img. The idea
   behind to reduce data being stored.

v6 (by xemul@):
 - packet mode should be set to true in image,
   until properly fetched from the kernel
 - verify image data on retrieval

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-12 20:00:54 +04:00
Documentation doc: Update -n option 2012-08-06 18:30:02 +04:00
include tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
protobuf tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
test zdtm: make several connections to a file dgram socket 2012-09-12 15:16:41 +04:00
.gitignore Update .gitignore 2012-07-09 15:03:38 +04:00
.mailmap repo: Add mailmap file 2012-03-25 23:31:20 +04:00
COPYING Add COPYING file 2011-12-05 14:11:05 +04:00
cr-check.c check: Don't forget to init mountns 2012-09-02 01:04:14 +04:00
cr-dump.c tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
cr-restore.c tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
cr-show.c show: Add pretty output for fdinfo 2012-08-21 16:30:37 +04:00
CREDITS Add the CREDITS file 2012-07-30 13:52:37 +04:00
crtools.c net: add ability to set names for outside links of veth devices 2012-09-02 01:07:32 +04:00
eventfd.c eventfd: Add LOG_PREFIX 2012-08-20 15:14:43 +04:00
eventpoll.c eventpoll: popullate eventfd in post_open() 2012-09-12 17:50:49 +04:00
fifo.c fd: Remove per-filetype make_gen_id abstraction 2012-08-11 22:41:29 +04:00
file-ids.c protobuf: Start switching our image entries to Google's protobuf 2012-07-17 07:10:41 +04:00
files-reg.c restore: auto-unlink for ghost files (v2) 2012-09-11 17:59:59 +04:00
files.c tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
gen-offsets.sh make: Generate offsets from linked files only 2012-04-18 18:22:15 +04:00
image.c tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
inotify.c inotify: Add LOG_PREFIX 2012-08-20 15:14:57 +04:00
ipc_ns.c code: Fix while ( formatting 2012-08-11 21:39:36 +04:00
kcmp-ids.c parasite: remove excessive header deps from parasite.h and friends 2012-05-30 12:50:18 +04:00
libnetlink.c code: A little but more checkpatch fixes over code 2012-08-11 22:19:34 +04:00
log.c log: Add log_get_loglevel() helper 2012-09-03 14:44:01 +04:00
Makefile tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
Makefile.inc make: Move common definitions to Makefile.inc 2012-09-02 00:58:37 +04:00
Makefile.pie make: Add -fno-strict-aliasing 2012-08-14 14:22:42 +04:00
Makefile.syscall make: Disable stack executable bit 2012-07-20 19:39:25 +04:00
mount.c tmpfs: replace all short tar options on long analogs 2012-09-12 18:34:19 +04:00
namespaces.c namespace: return -1 if one of ns can't be initilized 2012-08-06 18:36:35 +04:00
net.c net: add ability to set names for outside links of veth devices 2012-09-02 01:07:32 +04:00
netfilter.c sockets, inet: Use inet_sk_entry as a reference in inet_sk_info 2012-07-16 07:03:59 +04:00
parasite-head-x86-64.S parasite: Move bootstrap code into parasite-head-x86-64.S 2012-04-18 18:22:52 +04:00
parasite-syscall.c crtools: use pit_t for PIDs 2012-09-07 19:16:35 +04:00
parasite.c parasite: Initialize fd in parasite_get_proc_fd 2012-09-11 18:56:24 +04:00
pie.lds.S make: Generate offsets from linked files only 2012-04-18 18:22:15 +04:00
pipes.c fd: Remove per-filetype make_gen_id abstraction 2012-08-11 22:41:29 +04:00
proc_parse.c proc: Don't report error in case fdinfo for epoll fd is empty 2012-09-12 17:55:15 +04:00
protobuf.c tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
pstree.c pb: Rewrite object reading to use pb-descs 2012-08-07 19:22:00 +04:00
ptrace.c Helper for si_code event extraction. 2012-04-25 21:35:40 +04:00
rbtree.c code: Fix spaced indentation where found 2012-08-11 21:36:03 +04:00
README Drop kernel patching from README 2012-01-29 16:26:36 +04:00
restorer-log.c log, restorer: Make write_ log helpers to honor logging level 2012-09-05 17:16:38 +04:00
restorer.c mm: taking into account a gurad page to find a space for a restorer vma 2012-09-10 14:35:38 +04:00
shmem.c shmem: Get rid of static array of dumped shmem areas 2012-08-17 00:20:58 +04:00
signalfd.c fd: Remove per-filetype make_gen_id abstraction 2012-08-11 22:41:29 +04:00
sk-inet.c restore: disable repair mode in post_open() 2012-08-27 23:16:50 +04:00
sk-packet.c show: Show netdevice indices with %d 2012-08-21 16:47:32 +04:00
sk-queue.c pb: Rewrite object showing to use pb-descs 2012-08-07 19:22:02 +04:00
sk-tcp.c restore: disable repair mode in post_open() 2012-08-27 23:16:50 +04:00
sk-unix.c sk-unix: add a peer only if it's not in a list yet 2012-09-12 17:49:36 +04:00
sockets.c sk-inet: restore option REUSEADDR (v2) 2012-08-20 17:50:08 +04:00
syscall-common-x86-64.S syscalls: Complete redesign v9 2012-04-18 18:23:19 +04:00
syscalls-x86-64.sh syscalls: Complete redesign v9 2012-04-18 18:23:19 +04:00
sysctl.c parasite: remove excessive header deps from parasite.h and friends 2012-05-30 12:50:18 +04:00
tty.c tty: Add checkpoint/restore for unix terminals v6 2012-09-12 20:00:54 +04:00
util-net.c fown: get pid and uid-s from parasite 2012-09-05 16:41:14 +04:00
util.c mm: taking into account a gurad page to find a space for a restorer vma 2012-09-10 14:35:38 +04:00
uts_ns.c code: Remove trailing whitespaces over .c and .h files 2012-08-11 21:34:35 +04:00

crtools
=======

An utility to checkpoint/restore tasks.

Some code snippets are borrowed from

 - Linux kernel (http://kernel.org/)
 - git (http://git-scm.com/)
 - kvm-tools (https://github.com/penberg/linux-kvm)
 - ptrace-parasite (https://code.google.com/p/ptrace-parasite/)

Many thanks to these projects.

Licensed under GPLv2 (http://www.gnu.org/licenses/gpl-2.0.txt)