[CRIU] [PATCH 6/9] service: add cr_errno to criu_resp and send cr_errno in it, v2

Ruslan Kuprieiev kupruser at gmail.com
Fri Dec 19 10:18:12 PST 2014


v2, set cr_errno only if we have one that is != 0

Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 cr-service.c       | 17 ++++++++++++++++-
 protobuf/rpc.proto |  2 ++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/cr-service.c b/cr-service.c
index 99cba06..eb33048 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -88,7 +88,10 @@ static void send_criu_err(int sk, char *msg)
 
 	resp.type = CRIU_REQ_TYPE__EMPTY;
 	resp.success = false;
-	/* XXX -- add optional error code to CriuResp */
+	if (get_cr_errno()) {
+		resp.has_cr_errno = true;
+		resp.cr_errno = get_cr_errno();
+	}
 
 	send_criu_msg(sk, &resp);
 }
@@ -100,6 +103,10 @@ int send_criu_dump_resp(int socket_fd, bool success, bool restored)
 
 	msg.type = CRIU_REQ_TYPE__DUMP;
 	msg.success = success;
+	if (get_cr_errno()) {
+		msg.has_cr_errno = true;
+		msg.cr_errno = get_cr_errno();
+	}
 	msg.dump = &resp;
 
 	resp.has_restored = true;
@@ -114,6 +121,10 @@ static int send_criu_pre_dump_resp(int socket_fd, bool success)
 
 	msg.type = CRIU_REQ_TYPE__PRE_DUMP;
 	msg.success = success;
+	if (get_cr_errno()) {
+		msg.has_cr_errno = true;
+		msg.cr_errno = get_cr_errno();
+	}
 
 	return send_criu_msg(socket_fd, &msg);
 }
@@ -125,6 +136,10 @@ int send_criu_restore_resp(int socket_fd, bool success, int pid)
 
 	msg.type = CRIU_REQ_TYPE__RESTORE;
 	msg.success = success;
+	if (get_cr_errno()) {
+		msg.has_cr_errno = true;
+		msg.cr_errno = get_cr_errno();
+	}
 	msg.restore = &resp;
 
 	resp.pid = pid;
diff --git a/protobuf/rpc.proto b/protobuf/rpc.proto
index d511512..ed76d4f 100644
--- a/protobuf/rpc.proto
+++ b/protobuf/rpc.proto
@@ -116,4 +116,6 @@ message criu_resp {
 	optional criu_restore_resp	restore		= 4;
 	optional criu_notify		notify		= 5;
 	optional criu_page_server_info	ps		= 6;
+
+	optional int32			cr_errno	= 7;
 }
-- 
2.1.0



More information about the CRIU mailing list