Plugins

From CRIU
Revision as of 15:10, 15 December 2013 by Avagin (talk | contribs) (Created page with "=Introduction= Linux processes are not things-in-themselves. They tend to cooperate with other parts of the system very actively. When CRIU tries to dump a process, that has s...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Linux processes are not things-in-themselves. They tend to cooperate with other parts of the system very actively. When CRIU tries to dump a process, that has such an external connection -- it refuses to make the dump. The reason is simple -- without knowing the details of such connections it's impossible to correctly detach the process from its peer on dump and attach back on restore.

Though sometimes we can handle this (this is what --shell-job, --ext-unix-sk and --tcp-established options are about), in many cases we cannot provide generic solution.

So, in order to address this problem we make CRIU pluggable. //by xemul@

Libraries

A CRIU plugin is shared library, which is loaded before dumping or restoring. The CRIU tool looks up callback by their names. A library may provide any set of callbacks.

Each library can have cr_plugin_init() and cr_plugin_fini() functions for initializing and finalizing. cr_plugin_init() can return a negative value in an error case.

Callbacks

Each callback gets an unique identificator of a serialized object.

External unix sockets

int cr_plugin_dump_unix_sk(int sk, int id)
int cr_plugin_restore_unix_sk(int id)

Unknown files

int cr_plugin_dump_file(int fd, int id)
int cr_plugin_restore_file(int fd, int id)