[RFC,3/4] action-scripts: add defines for inherit fd over RPC

Submitted by Adrian Reber on Aug. 3, 2018, 3:28 p.m.

Details

Message ID 20180803152808.25928-4-adrian@lisas.de
State Rejected
Series "Series without cover letter"
Headers show

Commit Message

Adrian Reber Aug. 3, 2018, 3:28 p.m.
From: Adrian Reber <areber@redhat.com>

To be able to use inherit-fd over RPC, the RPC client will only submit
the key to CRIU via RPC. The actual FD which relates to this key has to
be transmitted directly and not via a protobuf message.

The idea is to let CRIU send a 'notify' message to the RPC client and
ask for the FD to be transmitted over the unix domain socket between
CRIU and the RPC client.

 * RPC client requests restore with inherit-fd using 'key'
 * CRIU asks RPC client for the actual FD via a notify protobuf message
 * RPC client transmits the FD to CRIU

As the protobuf notify mechanism naming is based on the action scripts
the naming of the protobuf fields is not perfect. The field with the
notify functionality is called 'script', but we have to live with it
now.

Signed-off-by: Adrian Reber <areber@redhat.com>
---
 criu/action-scripts.c         | 1 +
 criu/include/action-scripts.h | 1 +
 images/rpc.proto              | 6 ++++++
 3 files changed, 8 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/action-scripts.c b/criu/action-scripts.c
index d382547cd..4e9eb65cf 100644
--- a/criu/action-scripts.c
+++ b/criu/action-scripts.c
@@ -29,6 +29,7 @@  static const char *action_names[ACT_MAX] = {
 	[ ACT_PRE_RESUME ]	= "pre-resume",
 	[ ACT_POST_RESUME ]	= "post-resume",
 	[ ACT_ORPHAN_PTS_MASTER ] = "orphan-pts-master",
+	[ ACT_REQ_INHERIT_FD ]  = "request-inherit-fd",
 };
 
 struct script {
diff --git a/criu/include/action-scripts.h b/criu/include/action-scripts.h
index 40b09b160..4b90feb92 100644
--- a/criu/include/action-scripts.h
+++ b/criu/include/action-scripts.h
@@ -15,6 +15,7 @@  enum script_actions {
 	ACT_POST_RESUME,
 	ACT_PRE_RESUME,
 	ACT_ORPHAN_PTS_MASTER,
+	ACT_REQ_INHERIT_FD,
 
 	ACT_MAX
 };
diff --git a/images/rpc.proto b/images/rpc.proto
index abf2f5d79..f3fc9d741 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -123,8 +123,14 @@  message criu_restore_resp {
 }
 
 message criu_notify {
+	/* This is not always the actual script. Better name
+	 * would be command, as it can be the script or
+	 * 'orphan-pts-master' or 'request-inherit-fd'. */
 	optional string script		= 1;
 	optional int32	pid		= 2;
+	/* For the command 'request-inherit-fd' this includes the
+	 * the inherit fd option key for which the fd is requested. */
+	optional string inherit_fd_key  = 3;
 }
 
 enum criu_req_type {