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

Submitted by Kirill Tkhai on April 10, 2017, 8:20 a.m.

Details

Message ID 149181240999.17342.3355057813424434237.stgit@localhost.localdomain
State New
Series "Nested pid namespaces support"
Headers show

Commit Message

Kirill Tkhai April 10, 2017, 8:20 a.m.
Add new fields to store NSpid, NSsid, NSpgid for task and NStid for threads.

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

Patch hide | download patch | download mbox

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;
 }