[CRIU] [PATCH v3 09/55] pid: Add last_level_pid() helper

Kirill Tkhai ktkhai at virtuozzo.com
Mon Apr 10 01:16:35 PDT 2017


It returns pid in task's active pid namespace
(i.e., returned by getpid()).

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/include/pid.h |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/criu/include/pid.h b/criu/include/pid.h
index 1a43a3067..72f36360f 100644
--- a/criu/include/pid.h
+++ b/criu/include/pid.h
@@ -62,6 +62,11 @@ struct pid {
 	___ret;								\
 })
 
+static inline pid_t last_level_pid(struct pid *pid)
+{
+	return pid->ns[pid->level-1].virt;
+}
+
 /*
  * When we have to restore a shared resource, we mush select which
  * task should do it, and make other(s) wait for it. In order to



More information about the CRIU mailing list