crtools: preload libraries (v2)

Libraries (plugins) is going to be used for dumping and restoring
external dependencies (e.g. dbus, systemd journal sockets, charecter
devices, etc)

A plugin can have the cr_plugin_init() and cr_plugin_fini functions for
initialization and deinialization.

criu-plugin.h contains all things, which can be used in plugins.

v2: rename lib to plugin
v3: add a default value for a plugin path.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
unix: link a socket to its peer

We are going to add callback-s for dumping external sockets.
All external sockets are added into unix_list, but for dumping we need
to know all peers.

And one more thing is that a socket is not closed before its peer is
not be dumped. We are going to transfer the socket decriptor in the
callback.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
unix: add ability to set callbacks for external sockets (v2)

We don't know a state behind an external socket. It depends on logic
of the program, which handles this socket.

This patch adds ability to load a library with callbacks for dumping
and restoring external sockets.

This patch introduces two callbacks cr_plugin_dump_unix_sk and
cr_plugin_restore_unix_sk. If a callback can not handle a socket, it
must return CRIU_CB_SKIP.

The main questions, what kind of information should be tranfered in
these callbacks. Pls, think a few minutes about that and send me
your opinion.

v2: Use uflags instread of adding a new field

Signed-off-by: Andrey Vagin <avagin@openvz.org>
plugin: allow to use logging function in plugins

Signed-off-by: Andrey Vagin <avagin@openvz.org>
plugin: add a function to get a descriptor to the image dir
tests: check callback-s for dumping and restoring sockets (v2)

Here are client, server programs and two libraries for dumping client
sockets and syslog socket.

The client can ask server to save a value and then request it later.
We suppose that after dumping and restoring the client will get
the same value.

So the dump callback requests the value and save it in a file.
The restore callback creates a new socket and ask server to save the
value from the file.

v2: open a syslog socket

Signed-off-by: Andrey Vagin <avagin@openvz.org>
files: add ability to set callbacks for character devices

The difference in compare with unix sockets is that dump callbacks
for character devices can be executed to test, which callback can be
used for a given fd.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
zdtm: test dumping character devices with help of custom callbacks

Signed-off-by: Andrey Vagin <avagin@openvz.org>