[CRIU] [PATCH 0/10] add ability to set callbacks for external sockets (v6)
Andrey Vagin
avagin at openvz.org
Wed Dec 18 03:36:29 PST 2013
We don't know a state behind an external socket. It depends on logic
of the program, which handles this socket.
The patch adds ability to load a library with callbacks for dumping
and restoring external sockets, character devices. In a future we can
add callbacks for other external objects.
Now a library can have:
* two functions cr_plugin_init and cr_plugin_fini, which are called
on loading and unloading.
* two callbacks cr_plugin_{dump,restore}_unix_sk for dumping and restoring
unix sockets.
* two callbacks cr_plugin_{dump,restore}_file for character devices.
If a callback can not handle an object, it must return CRIU_CB_SKIP.
v2: * Scan libraries in a predefined directory. The path cab be set by
the -L option or the CRIU_LIBS_DIR environment
* Look up all callbacks on loading of libraries
* The test uses two libraries
v3: add callbacks for character devices.
v4: rework callbacks for dumping files.
v5: use -ENOTSUP instead of CRIU_CB_SKIP
open files in the criu_plugin_restore_files() callbacks
v6: set USK_CALLBACK, if a socket was dumped by callback
Andrey Vagin (7):
crtools: preload libraries (v2)
unix: link a socket to its peer
unix: add ability to set callbacks for external sockets (v2)
plugin: allow to use logging function in plugins
tests: check callback-s for dumping and restoring sockets (v2)
files: add ability to set callbacks for character devices
zdtm: test dumping character devices with help of custom callbacks
Makefile | 4 +-
Makefile.crtools | 1 +
cr-dump.c | 6 +
cr-restore.c | 27 ++--
crtools.c | 14 ++-
files-reg.c | 16 +++
files.c | 14 +++
include/cr_options.h | 1 +
include/criu-plugin.h | 91 ++++++++++++++
include/files.h | 2 +
include/image.h | 1 +
include/log-levels.h | 12 --
include/log.h | 43 +------
include/plugin.h | 18 +++
pie/log-simple.c | 1 -
plugin.c | 223 ++++++++++++++++++++++++++++++++++
protobuf/regfile.proto | 1 +
sk-unix.c | 109 ++++++++++++-----
test/unix-callback/Makefile | 16 +++
test/unix-callback/lib/syslog-lib.so | 1 +
test/unix-callback/lib/unix-lib.so | 1 +
test/unix-callback/run.sh | 48 ++++++++
test/unix-callback/syslog-lib.c | 50 ++++++++
test/unix-callback/unix-client.c | 88 ++++++++++++++
test/unix-callback/unix-lib.c | 170 ++++++++++++++++++++++++++
test/unix-callback/unix-server.c | 102 ++++++++++++++++
test/zdtm.sh | 6 +
test/zdtm/live/static/Makefile | 9 +-
test/zdtm/live/static/criu-rtc.c | 87 +++++++++++++
test/zdtm/live/static/lib/criu-rtc.so | 1 +
test/zdtm/live/static/rtc.c | 57 +++++++++
31 files changed, 1123 insertions(+), 97 deletions(-)
create mode 100644 include/criu-plugin.h
delete mode 100644 include/log-levels.h
create mode 100644 include/plugin.h
create mode 100644 plugin.c
create mode 100644 test/unix-callback/Makefile
create mode 120000 test/unix-callback/lib/syslog-lib.so
create mode 120000 test/unix-callback/lib/unix-lib.so
create mode 100755 test/unix-callback/run.sh
create mode 100644 test/unix-callback/syslog-lib.c
create mode 100644 test/unix-callback/unix-client.c
create mode 100644 test/unix-callback/unix-lib.c
create mode 100644 test/unix-callback/unix-server.c
create mode 100644 test/zdtm/live/static/criu-rtc.c
create mode 120000 test/zdtm/live/static/lib/criu-rtc.so
create mode 100644 test/zdtm/live/static/rtc.c
--
1.8.3.1:qa
More information about the CRIU
mailing list