2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 18:07:57 +00:00

24 Commits

Author SHA1 Message Date
Abhishek Dubey
20d4920a8b Adding --pre-dump-mode option
Two modes of pre-dump algorithm:
    1) splicing memory by parasite
        --pre-dump-mode=splice (default)
    2) using process_vm_readv syscall
        --pre-dump-mode=read

Signed-off-by: Abhishek Dubey <dubeyabhishek777@gmail.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2020-02-04 12:39:02 -08:00
Michał Cłapiński
2f337652ad Add new command line option: --cgroup-yard
Instead of creating cgroup yard in CRIU, now we can create it externally
and pass it to CRIU. Useful if somebody doesn't want to grant
CAP_SYS_ADMIN to CRIU.

Signed-off-by: Michał Cłapiński <mclapinski@google.com>
2020-02-04 12:37:37 -08:00
Radostin Stoyanov
ba454407bf make: Insert version macros in criu.h
Including the version information of CRIU in criu.h is required by
projects that use libcriu to preserve backward compatibility.

Closes #738

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2019-09-07 15:59:55 +03:00
Radostin Stoyanov
38769e94d6 rpc/libcriu: Add lsm-profile option
The --lsm-profile option allows a container engine to specify LSM
profile name.

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2019-04-20 20:25:26 -07:00
Martin Wührer
9ede9253f5 c-lib: simplify service set by removing set_service_comm().
This commit removes the functions criu_(local_)set_service_comm().
These functions are not neccessary, because if
set_service_address(), set_service_fd() or
set_service_binary() has been called it is already clear, which
service comm type should be used.

Furhtermore, this commit reduces the number of misuses.
E.g. if set_service_comm() was set to socket, but a binary was given
via set_service_binary().

Signed-off-by: Martin Wührer <martin.wuehrer@artech.at>
2019-04-20 20:25:26 -07:00
Martin Wührer
29af538da7 c-lib: added missing strdup-null checks.
This commit checks after each strdup() call if the call was successful.
If not, the function that calls strdup() returns an error.

This requires, that the return value of several functions has to be
changed from void to int.

Signed-off-by: Martin Wührer <martin.wuehrer@artech.at>
2019-04-20 20:25:26 -07:00
Martin Wührer
7d7f663be5 c-lib: converted char *-args to const char *
As most of the `criu_(local_)*` functions already call `strdup()`,
it is possible, to change the function signature to `const char *`.

As the struct `criu_opts` already contains a `const char *
service_binary`, also the member `service_address` is changed to
`const char`.

Additonally, also the function `criu_local_set_freeze_cgroup()` now
calls `strdup()`.

Signed-off-by: Martin Wührer <martin.wuehrer@artech.at>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2019-04-20 20:25:26 -07:00
Martin Wührer
f4ce0a7c08 c-lib: added set_page_server_address_port
According to https://criu.org/API_compliance, the C-library
doesn't support the pageserver option.
This patch contains the functions
`criu_(local_)set_page_server_address_port()`
that allow to specify on which ip and tcp-port the pageserver
is listening.

This patch affects only the c-lib, as criu-rpc already supports the
pageserver settings.

Signed-off-by: Martin Wührer <martin.wuehrer@artech.at>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2019-04-20 20:25:26 -07:00
Martin Wührer
6b84657ca4 c-lib: fixed memleaks, add criu_local_free_opts()
If `criu_local_init_opts()` is applied on the same opts-object
several times, not all of the allocated memory gets freed.
Therefore, the functions `criu_(local_)free_opts()` were introduced.
These functions ensure, that opts get freed accordingly.
Furthermore, `criu_(local_)free_opts()` gets part of the c-api,
and can therefore be called by external projects too.

Additionally, with this commit `criu_local_init_opts()` now uses
`criu_local_free_opts()`, to free the opts-parameter if it was already
initalized before.

This commit also contains a fix in `send_req_and_recv_resp_sk()` which
lead to a memory leak, if criu-notifications were received.

Signed-off-by: Martin Wührer <martin.wuehrer@artech.at>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2019-04-20 20:25:26 -07:00
Radostin Stoyanov
844a72371a rpc: Add interface for --tcp-close option
Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
2019-04-20 20:25:26 -07:00
Ronny Chevalier
d71fc8dc08 lib/c: add missing criu_local_set_service_binary signature
Signed-off-by: Ronny Chevalier <ronny.chevalier@hp.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-07-09 18:26:50 +03:00
Ronny Chevalier
3ec82d4b6a lib/c: add const qualifier to criu_set_service_binary
service_binary is either set to a const char * (CR_DEFAULT_SERVICE_BIN)
or to a user provided char *, but there is no reason to give a char *.
Users of such function will most likely provide a const char *,
that will generate a warning.
Thus, we add the const qualifier to better represent the usage of
service_binary, and avoid such warnings.

Signed-off-by: Ronny Chevalier <ronny.chevalier@hp.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-07-09 18:26:50 +03:00
Pavel Tikhomirov
d1be199765 Add --weak_sysctl CLI option to RPC and lib
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-12-05 23:34:54 +03:00
Ruslan Kuprieiev
c4f4e6c926 lib: add external support
It is already present in rpc, so lets add it to libcriu too.

Signed-off-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-11-12 11:06:21 +03:00
Ruslan Kuprieiev
4f329dd4b2 lib: add inherit_fd
It is already present in CLI and RPC, so libcriu should reflect it too.

travis-ci: success for lib: add inherit_fd
Signed-off-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-10-24 16:00:15 +03:00
Kir Kolyshkin
40edd7eff5 lib/c/criu.h: rm explicit numbering of enum elements
C standard specifies that the first enum element is 0 and the next ones
are +1 to a previous element (C90, "3.5.2.2 Enumeration
specifiers").
Therefore, there is no need to explicitly specify element values.

The explicit initializers were added in the first commit introducing
this enum (commit 46e8aee).

While at it, let's also add a comma after the last element, for any
future patch adding more elements to look better.

No functional change.

Cc: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Ruslan Kuprieiev <rkuprieiev@cloudlinux.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-09-26 15:42:43 +03:00
Adrian Reber
ed8fecd12d criu: add RPC interface for skip in-flight connections
For the previously added option to skip in-flight connections this adds
that option to the RPC interface. The skip in-flight connections is also
described in criu.txt.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:12:59 +03:00
Nikita Spiridonov
788a74cecc rpc: Add interface for @timeout option
Needed for container migration, where arguments are
set via p.haul as rpc request.

Signed-off-by: Nikita Spiridonov <nspiridonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:12:27 +03:00
Cyrill Gorcunov
85578bd5e8 rpc: Add interface --freeze-cgroup option
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:09:40 +03:00
Cyrill Gorcunov
900e71cbec cg: rpc -- Add bindings for custom cgroup props engine
For handling  --cgroup-props, --cgroup-props-file and
--cgroup-dump-controller from RPC interface.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:05:52 +03:00
Pavel Emelyanov
3cffd523e4 Revert "seccomp: add a --no-seccomp option to disable dumping seccomp"
This reverts commit a98014f306be4b4fefdf01af31e1efa5d83e5e4f.

As per Saied Kazemi, actually dump works without seccomp support
from the kernel on non-seccomped tasks. The only problem was with
criu check, but this would be addressed separately.

Reverting the commit not to burden the API with (yet) unneeded stuff.

Conflicts:
	lib/c/criu.h
2016-02-20 13:35:47 +03:00
Pavel Emelyanov
c271e13f9a lib: fix comilation after previous commit
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-17 14:29:47 +03:00
Tycho Andersen
a98014f306 seccomp: add a --no-seccomp option to disable dumping seccomp
Sometimes we may want to use CRIU on older kernels which don't support
dumping seccomp state where we don't actually care about the seccomp state.
Of course this is unsafe, but it does allow for c/r of things using
seccomp on these older kernels in some cases. When the task is in
SECCOMP_MODE_STRICT or SECCOMP_MODE_FILTER with filters that block the
syscalls criu's parasite code needs, the dump will still fail.

Note that we disable seccomp by simply feigning that we are in mode 0. This
is a little hacky, but avoids distributing ifs throughout the code and
keeps them in this one place.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
CC: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-17 13:46:55 +03:00
Cyrill Gorcunov
da0eb1483b build: Move C and Python libraries into lib
Both CRIU library and CRIT python data are moved into
lib/c and lib/py.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-02-15 15:32:39 +03:00