[CRIU] [PATCH 1/2] rpc: Add interface for --tcp-close option

Radostin Stoyanov rstoyanov1 at gmail.com
Sun Jan 6 18:44:26 MSK 2019


Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 criu/cr-service.c |  3 +++
 images/rpc.proto  |  1 +
 lib/c/criu.c      | 11 +++++++++++
 lib/c/criu.h      |  2 ++
 4 files changed, 17 insertions(+)

diff --git a/criu/cr-service.c b/criu/cr-service.c
index 532a87c81..37cc6f7df 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -437,6 +437,9 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
 	if (req->has_tcp_skip_in_flight)
 		opts.tcp_skip_in_flight = req->tcp_skip_in_flight;
 
+	if (req->has_tcp_close)
+		opts.tcp_close = req->tcp_close;
+
 	if (req->has_weak_sysctls)
 		opts.weak_sysctls = req->weak_sysctls;
 
diff --git a/images/rpc.proto b/images/rpc.proto
index abf2f5d79..5c8226d25 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -112,6 +112,7 @@ message criu_opts {
 	optional int32			status_fd		= 49;
 	optional bool			orphan_pts_master	= 50;
 	optional string			config_file		= 51;
+	optional bool			tcp_close		= 52;
 }
 
 message criu_dump_resp {
diff --git a/lib/c/criu.c b/lib/c/criu.c
index ff9c9b87e..b70da4d81 100644
--- a/lib/c/criu.c
+++ b/lib/c/criu.c
@@ -321,6 +321,17 @@ void criu_set_tcp_skip_in_flight(bool tcp_skip_in_flight)
 	criu_local_set_tcp_skip_in_flight(global_opts, tcp_skip_in_flight);
 }
 
+void criu_local_set_tcp_close(criu_opts *opts, bool tcp_close)
+{
+	opts->rpc->has_tcp_close	= true;
+	opts->rpc->tcp_close		= tcp_close;
+}
+
+void criu_set_tcp_close(bool tcp_close)
+{
+	criu_local_set_tcp_close(global_opts, tcp_close);
+}
+
 void criu_local_set_weak_sysctls(criu_opts *opts, bool val)
 {
 	opts->rpc->has_weak_sysctls = true;
diff --git a/lib/c/criu.h b/lib/c/criu.h
index ae8683bc9..672246526 100644
--- a/lib/c/criu.h
+++ b/lib/c/criu.h
@@ -66,6 +66,7 @@ void criu_set_ext_unix_sk(bool ext_unix_sk);
 int criu_add_unix_sk(unsigned int inode);
 void criu_set_tcp_established(bool tcp_established);
 void criu_set_tcp_skip_in_flight(bool tcp_skip_in_flight);
+void criu_set_tcp_close(bool tcp_close);
 void criu_set_weak_sysctls(bool val);
 void criu_set_evasive_devices(bool evasive_devices);
 void criu_set_shell_job(bool shell_job);
@@ -175,6 +176,7 @@ void criu_local_set_ext_unix_sk(criu_opts *opts, bool ext_unix_sk);
 int criu_local_add_unix_sk(criu_opts *opts, unsigned int inode);
 void criu_local_set_tcp_established(criu_opts *opts, bool tcp_established);
 void criu_local_set_tcp_skip_in_flight(criu_opts *opts, bool tcp_skip_in_flight);
+void criu_local_set_tcp_close(criu_opts *opts, bool tcp_close);
 void criu_local_set_weak_sysctls(criu_opts *opts, bool val);
 void criu_local_set_evasive_devices(criu_opts *opts, bool evasive_devices);
 void criu_local_set_shell_job(criu_opts *opts, bool shell_job);
-- 
2.20.1



More information about the CRIU mailing list