[CRIU] [PATCH RESEND v1 32/55] pid_ns: Implement pid_ns_root_off()
Kirill Tkhai
ktkhai at virtuozzo.com
Fri Mar 24 08:14:02 PDT 2017
Implement a helper receiving number of levels between
pid namespace level NS_CRIU and NS_ROOT.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/include/namespaces.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h
index 81a1cd73..5cb51d93 100644
--- a/criu/include/namespaces.h
+++ b/criu/include/namespaces.h
@@ -227,5 +227,12 @@ extern int add_ns_shared_cb(int (*actor)(void *data), void *data);
extern struct ns_id *get_socket_ns(int lfd);
extern struct ns_id *lookup_ns_by_kid(unsigned int kid, struct ns_desc *nd);
+/* Number of levels of pid_ns between NS_CRIU and NS_ROOT */
+static inline int pid_ns_root_off(void)
+{
+ if (root_ns_mask & CLONE_NEWPID)
+ return 1;
+ return 0;
+}
#endif /* __CR_NS_H__ */
More information about the CRIU
mailing list