[CRIU] [PATCH 11/21] ns: Add alternative name for pid namespace

Kirill Tkhai ktkhai at virtuozzo.com
Tue May 23 05:39:55 PDT 2017


It may be read from "/proc/[pid]/ns/pid_for_children_ns",
so add this alias to pid_ns_desc.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/cgroup.c             |    2 +-
 criu/include/namespaces.h |    3 ++-
 criu/ipc_ns.c             |    2 +-
 criu/mount.c              |    2 +-
 criu/namespaces.c         |    4 ++--
 criu/net.c                |    2 +-
 criu/uts_ns.c             |    2 +-
 7 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/criu/cgroup.c b/criu/cgroup.c
index b1c7b3df3..3d44e30bb 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -1837,4 +1837,4 @@ int new_cg_root_add(char *controller, char *newroot)
 	return 0;
 }
 
-struct ns_desc cgroup_ns_desc = NS_DESC_ENTRY(CLONE_NEWCGROUP, "cgroup");
+struct ns_desc cgroup_ns_desc = NS_DESC_ENTRY(CLONE_NEWCGROUP, "cgroup", NULL);
diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h
index e9f09d1e3..1c406b39e 100644
--- a/criu/include/namespaces.h
+++ b/criu/include/namespaces.h
@@ -162,10 +162,11 @@ extern struct ns_id *ns_ids;
 extern struct ns_id *top_pid_ns;
 extern struct ns_id *root_user_ns;
 
-#define NS_DESC_ENTRY(_cflag, _str)			\
+#define NS_DESC_ENTRY(_cflag, _str, _alt_str)		\
 	{						\
 		.cflag		= _cflag,		\
 		.str		= _str,			\
+		.alt_str	= _alt_str,		\
 		.len		= sizeof(_str) - 1,	\
 	}
 
diff --git a/criu/ipc_ns.c b/criu/ipc_ns.c
index d8590fa39..bdac31ddb 100644
--- a/criu/ipc_ns.c
+++ b/criu/ipc_ns.c
@@ -943,4 +943,4 @@ int prepare_ipc_ns(int pid)
 	return 0;
 }
 
-struct ns_desc ipc_ns_desc = NS_DESC_ENTRY(CLONE_NEWIPC, "ipc");
+struct ns_desc ipc_ns_desc = NS_DESC_ENTRY(CLONE_NEWIPC, "ipc", NULL);
diff --git a/criu/mount.c b/criu/mount.c
index 634491310..ee44ce4d0 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -3328,4 +3328,4 @@ void clean_cr_time_mounts(void)
 	}
 }
 
-struct ns_desc mnt_ns_desc = NS_DESC_ENTRY(CLONE_NEWNS, "mnt");
+struct ns_desc mnt_ns_desc = NS_DESC_ENTRY(CLONE_NEWNS, "mnt", NULL);
diff --git a/criu/namespaces.c b/criu/namespaces.c
index c6e47bb8c..580b55197 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -2772,5 +2772,5 @@ int destroy_pid_ns_helpers(void)
 	return 0;
 }
 
-struct ns_desc pid_ns_desc = NS_DESC_ENTRY(CLONE_NEWPID, "pid");
-struct ns_desc user_ns_desc = NS_DESC_ENTRY(CLONE_NEWUSER, "user");
+struct ns_desc pid_ns_desc = NS_DESC_ENTRY(CLONE_NEWPID, "pid", "pid_for_children");
+struct ns_desc user_ns_desc = NS_DESC_ENTRY(CLONE_NEWUSER, "user", NULL);
diff --git a/criu/net.c b/criu/net.c
index 821a83750..17976afb8 100644
--- a/criu/net.c
+++ b/criu/net.c
@@ -2447,7 +2447,7 @@ int collect_net_namespaces(bool for_dump)
 			(void *)(for_dump ? 1UL : 0));
 }
 
-struct ns_desc net_ns_desc = NS_DESC_ENTRY(CLONE_NEWNET, "net");
+struct ns_desc net_ns_desc = NS_DESC_ENTRY(CLONE_NEWNET, "net", NULL);
 
 static struct ns_id *get_root_netns()
 {
diff --git a/criu/uts_ns.c b/criu/uts_ns.c
index 1ea075cbd..fdf683bdc 100644
--- a/criu/uts_ns.c
+++ b/criu/uts_ns.c
@@ -68,4 +68,4 @@ int prepare_utsns(int pid)
 	return ret;
 }
 
-struct ns_desc uts_ns_desc = NS_DESC_ENTRY(CLONE_NEWUTS, "uts");
+struct ns_desc uts_ns_desc = NS_DESC_ENTRY(CLONE_NEWUTS, "uts", NULL);



More information about the CRIU mailing list