[CRIU] [PATCH] pstree: Move struct pid to pstree.h
Cyrill Gorcunov
gorcunov at openvz.org
Wed Oct 3 13:46:45 EDT 2012
I believe this make sense to keep this structure
in pstree.h where pstree related data lives.
Also I've added some comments on struct pid members.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
Andrew, Pavel, does such action look sane for you?
include/crtools.h | 6 ------
include/namespaces.h | 1 +
include/pstree.h | 16 ++++++++++++++++
parasite-syscall.c | 1 +
4 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/include/crtools.h b/include/crtools.h
index 3c31b88..e2de846 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -221,12 +221,6 @@ struct rst_info {
struct list_head tty_slaves;
};
-struct pid
-{
- pid_t real; /* used to peek/poke tasks during dump stage */
- pid_t virt; /* used all over in the images and saved after restore */
-};
-
static inline int in_vma_area(struct vma_area *vma, unsigned long addr)
{
return addr >= (unsigned long)vma->vma.start &&
diff --git a/include/namespaces.h b/include/namespaces.h
index 244107c..43efc6e 100644
--- a/include/namespaces.h
+++ b/include/namespaces.h
@@ -2,6 +2,7 @@
#define __CR_NS_H__
#include "crtools.h"
+#include "pstree.h"
int dump_namespaces(struct pid *pid, unsigned int ns_flags);
int prepare_namespace(int pid, unsigned long clone_flags);
diff --git a/include/pstree.h b/include/pstree.h
index fb5806e..0e967d0 100644
--- a/include/pstree.h
+++ b/include/pstree.h
@@ -3,6 +3,22 @@
#include "list.h"
#include "crtools.h"
+struct pid {
+ /*
+ * The @real pid is used to fetch tasks during dumping stage,
+ * This is a global pid seen from the context where the dumping
+ * is running.
+ */
+ pid_t real;
+
+ /*
+ * The @virt pid is one which used in the image itself and keeps
+ * the pid value to be restored. This pid fetched from the
+ * dumpee context, because the dumpee might have own pid namespace.
+ */
+ pid_t virt;
+};
+
struct pstree_item {
struct pstree_item *parent;
struct list_head children; /* list of my children */
diff --git a/parasite-syscall.c b/parasite-syscall.c
index dbd963c..4bde79a 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -12,6 +12,7 @@
#include "parasite.h"
#include "crtools.h"
#include "namespaces.h"
+#include "pstree.h"
#include "protobuf.h"
#include "protobuf/sa.pb-c.h"
--
1.7.7.6
More information about the CRIU
mailing list