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

Ruslan Kuprieiev kupruser at gmail.com
Thu Dec 11 12:55:15 PST 2014


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

diff --git a/cr-service.c b/cr-service.c
index 99cba06..9ad7769 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -88,7 +88,8 @@ 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 */
+	resp.has_cr_errno = true;
+	resp.cr_errno = get_cr_errno();
 
 	send_criu_msg(sk, &resp);
 }
@@ -100,6 +101,8 @@ int send_criu_dump_resp(int socket_fd, bool success, bool restored)
 
 	msg.type = CRIU_REQ_TYPE__DUMP;
 	msg.success = success;
+	msg.has_cr_errno = true;
+	msg.cr_errno = get_cr_errno();
 	msg.dump = &resp;
 
 	resp.has_restored = true;
@@ -114,6 +117,8 @@ static int send_criu_pre_dump_resp(int socket_fd, bool success)
 
 	msg.type = CRIU_REQ_TYPE__PRE_DUMP;
 	msg.success = success;
+	msg.has_cr_errno = true;
+	msg.cr_errno = get_cr_errno();
 
 	return send_criu_msg(socket_fd, &msg);
 }
@@ -125,6 +130,8 @@ int send_criu_restore_resp(int socket_fd, bool success, int pid)
 
 	msg.type = CRIU_REQ_TYPE__RESTORE;
 	msg.success = success;
+	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;
 }
-- 
1.9.3



More information about the CRIU mailing list