[CRIU] [PATCH v3 31/55] images: Add NSpids pstree descriptions

Kirill Tkhai ktkhai at virtuozzo.com
Mon Apr 10 01:20:10 PDT 2017


Add new fields to store NSpid, NSsid, NSpgid for task and NStid for threads.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/pstree.c       |    3 +++
 images/pstree.proto |   17 +++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/criu/pstree.c b/criu/pstree.c
index f4984ec40..653f39920 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -329,6 +329,9 @@ int dump_pstree(struct pstree_item *root_item)
 		e.pgid		= item->pgid->ns[0].virt;
 		e.sid		= item->sid->ns[0].virt;
 		e.n_threads	= item->nr_threads;
+		e.has_pid	= true;
+		e.has_pgid	= true;
+		e.has_sid	= true;
 
 		e.threads = xmalloc(sizeof(e.threads[0]) * e.n_threads);
 		if (!e.threads)
diff --git a/images/pstree.proto b/images/pstree.proto
index 23e88aa74..6bb560849 100644
--- a/images/pstree.proto
+++ b/images/pstree.proto
@@ -1,9 +1,18 @@
 syntax = "proto2";
 
+message ns_tid {
+	repeated uint32 tid				= 1;
+}
+
 message pstree_entry {
-	required uint32			pid		= 1;
-	required uint32			ppid		= 2;
-	required uint32			pgid		= 3;
-	required uint32			sid		= 4;
+	optional uint32			pid		= 1;
+	required uint32			ppid		= 2;	/* Pid of parent in pid_ns NS_ROOT */
+	optional uint32			pgid		= 3;
+	optional uint32			sid		= 4;
 	repeated uint32			threads		= 5;
+
+	repeated uint32			ns_pid		= 6;
+	repeated uint32			ns_pgid		= 7;
+	repeated uint32			ns_sid		= 8;
+	repeated ns_tid			tids		= 9;
 }



More information about the CRIU mailing list