[CRIU] [PATCH 13/21] ns: Use alternative name in set_ns_hookups() if need
Kirill Tkhai
ktkhai at virtuozzo.com
Tue May 23 05:40:19 PDT 2017
Account the fact, that ns may be found by alternative
name, and use it if so.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/include/namespaces.h | 1 +
criu/namespaces.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h
index 1c406b39e..1f5783317 100644
--- a/criu/include/namespaces.h
+++ b/criu/include/namespaces.h
@@ -101,6 +101,7 @@ struct ns_id {
unsigned int kid;
unsigned int id;
pid_t ns_pid;
+ bool alternative;
struct ns_desc *nd;
struct ns_id *parent;
struct list_head children;
diff --git a/criu/namespaces.c b/criu/namespaces.c
index 1a03caa89..94f9140cc 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -443,6 +443,7 @@ static unsigned int generate_ns_id(int pid, unsigned int kid, struct ns_desc *nd
nsid->ns_populated = true;
INIT_LIST_HEAD(&nsid->children);
INIT_LIST_HEAD(&nsid->siblings);
+ nsid->alternative = alternative;
nsid_add(nsid, nd, ns_next_id++, pid);
BUG_ON(nsid->id == UINT_MAX);
@@ -804,7 +805,7 @@ static int set_ns_hookups(struct ns_id *ns)
struct ns_id *u_ns;
int fd, ret = -1;
- fd = open_proc(ns->ns_pid, "ns/%s", nd->str);
+ fd = open_proc(ns->ns_pid, "ns/%s", !ns->alternative ? nd->str : nd->alt_str);
if (fd < 0) {
pr_perror("Can't open %s, pid %d", nd->str, ns->ns_pid);
return -1;
More information about the CRIU
mailing list