[CRIU] [PATCH 4/4] RPC: Evaluate configuration file before switching to RPC mode

Adrian Reber adrian at lisas.de
Tue Mar 20 19:55:10 MSK 2018


From: Adrian Reber <areber at redhat.com>

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 at redhat.com>
---
 criu/crtools.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/criu/crtools.c b/criu/crtools.c
index e4f866dd7..d345d129b 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -565,19 +565,6 @@ int main(int argc, char *argv[], char *envp[])
 	if (kerndat_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]));
-	}
-
 	help_or_configs = passed_help_or_defaults_forbidden(argc, argv);
 	if (help_or_configs == 1) {
 		usage_error = false;
@@ -906,6 +893,19 @@ int main(int argc, char *argv[], char *envp[])
 		}
 	}
 
+	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)
-- 
2.14.3



More information about the CRIU mailing list