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

Submitted by Kirill Tkhai on April 10, 2017, 8:16 a.m.

Details

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

Commit Message

Kirill Tkhai April 10, 2017, 8:16 a.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 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