[5/4] unshare: Add RPC bits

Submitted by Pavel Emelianov on May 4, 2016, 4:04 p.m.

Details

Message ID 572A1D97.7060605@virtuozzo.com
State Superseded
Commit 2a245ed82d2b2eb8e03952c77d395736386c1c28
Headers show

Commit Message

Pavel Emelianov May 4, 2016, 4:04 p.m.
This completes the --unshare feature (except for userns).

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 criu/cr-service.c | 5 ++++-
 images/rpc.proto  | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/cr-service.c b/criu/cr-service.c
index 219a986..93d146f 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -471,6 +471,9 @@  static int setup_opts_from_req(int sk, CriuOpts *req)
 			goto err;
 	}
 
+	if (req->has_unshare)
+		opts.unshare_flags = req->unshare;
+
 	if (req->n_irmap_scan_paths) {
 		for (i = 0; i < req->n_irmap_scan_paths; i++) {
 			if (irmap_scan_path_add(req->irmap_scan_paths[i]))
@@ -542,7 +545,7 @@  static int restore_using_req(int sk, CriuOpts *req)
 	success = true;
 exit:
 	if (send_criu_restore_resp(sk, success,
-				   root_item ? root_item->pid.real : -1) == -1) {
+				   root_item ? restored_root_pid(): -1) == -1) {
 		pr_perror("Can't send response");
 		success = false;
 	}
diff --git a/images/rpc.proto b/images/rpc.proto
index 9ece4da..0bd4ef7 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -97,6 +97,7 @@  message criu_opts {
 	repeated string			external	= 37;
 	optional uint32			empty_ns	= 38;
 	repeated join_namespace		join_ns		= 39;
+	optional uint32			unshare		= 40;
 }
 
 message criu_dump_resp {