Skip to content

Commit

Permalink
RPC: Evaluate configuration file before switching to RPC mode
Browse files Browse the repository at this point in the history
When CRIU is started in RPC mode ('criu swrk') it used to ignore all
command-line options and configuration files. This moves the jump to RPC
mode after the configuration file parsing to enable configuration.

With this configuration files are now also evaluated in RPC mode and it
is possible to change the behavior of CRIU via the configuration file if
used via RPC.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
  • Loading branch information
adrianreber authored and avagin committed Oct 30, 2018
1 parent 9d225fa commit a5fc468
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions criu/crtools.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,6 @@ int main(int argc, char *argv[], char *envp[])

init_opts();

if (!strcmp(argv[1], "swrk")) {
if (argc < 3)
goto usage;

if (early_init())
return -1;

/*
* This is to start criu service worker from libcriu calls.
* The usage is "criu swrk <fd>" and is not for CLI/scripts.
* The arguments semantics can change at any time with the
* corresponding lib call change.
*/
opts.swrk_restore = true;
return cr_service_work(atoi(argv[2]));
}

ret = parse_options(argc, argv, &usage_error, &has_exec_cmd);

Expand All @@ -148,6 +132,19 @@ int main(int argc, char *argv[], char *envp[])
if (early_init())
return -1;

if (!strcmp(argv[1], "swrk")) {
if (argc < 3)
goto usage;
/*
* This is to start criu service worker from libcriu calls.
* The usage is "criu swrk <fd>" and is not for CLI/scripts.
* The arguments semantics can change at any time with the
* corresponding lib call change.
*/
opts.swrk_restore = true;
return cr_service_work(atoi(argv[2]));
}

if (opts.deprecated_ok)
pr_msg("Turn deprecated stuff ON\n");
if (opts.tcp_skip_in_flight)
Expand Down

0 comments on commit a5fc468

Please sign in to comment.