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

Submitted by Kirill Tkhai on March 28, 2017, 3:35 p.m.

Details

Message ID 149071535786.12770.7721557511010925060.stgit@localhost.localdomain
State New
Series "Nested pid namespaces support"
Headers show

Commit Message

Kirill Tkhai March 28, 2017, 3:35 p.m.
It returns pid in task's active pid namespace
(i.e., returned by getpid()).

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

Patch hide | download patch | download mbox

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