[CRIU] [PATCH v2 12/57] pid: Add last_level_pid() helper

Kirill Tkhai ktkhai at virtuozzo.com
Tue Mar 28 08:35:57 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 478e5d0b..a2e6e08f 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