aboutsummaryrefslogtreecommitdiff
path: root/include/linux/pid.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-01-11 15:34:05 +0100
committerIngo Molnar <mingo@elte.hu>2009-01-11 15:34:05 +0100
commitd19b85db9d5c44a4c21dcb10d6fbadaa4425ab2a (patch)
tree250be7a5a29069f7d1f4524fa45ab0e988833025 /include/linux/pid.h
parent490dea45d00f01847ebebd007685d564aaf2cd98 (diff)
parentc59765042f53a79a7a65585042ff463b69cb248c (diff)
Merge commit 'v2.6.29-rc1' into timers/urgent
Diffstat (limited to 'include/linux/pid.h')
-rw-r--r--include/linux/pid.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/pid.h b/include/linux/pid.h
index bb206c56d1f..49f1c2f66e9 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -123,6 +123,24 @@ extern struct pid *alloc_pid(struct pid_namespace *ns);
extern void free_pid(struct pid *pid);
/*
+ * ns_of_pid() returns the pid namespace in which the specified pid was
+ * allocated.
+ *
+ * NOTE:
+ * ns_of_pid() is expected to be called for a process (task) that has
+ * an attached 'struct pid' (see attach_pid(), detach_pid()) i.e @pid
+ * is expected to be non-NULL. If @pid is NULL, caller should handle
+ * the resulting NULL pid-ns.
+ */
+static inline struct pid_namespace *ns_of_pid(struct pid *pid)
+{
+ struct pid_namespace *ns = NULL;
+ if (pid)
+ ns = pid->numbers[pid->level].ns;
+ return ns;
+}
+
+/*
* the helpers to get the pid's id seen from different namespaces
*
* pid_nr() : global id, i.e. the id seen from the init namespace;