diff options
| author | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2009-01-14 16:29:51 +1100 |
|---|---|---|
| committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2009-01-14 16:29:51 +1100 |
| commit | cb7a97d01521797cad9f63e8478403c3e51fea49 (patch) | |
| tree | 84cddf20369f82f10c1c3712e6cce20dd1b9d863 /include/linux/pid.h | |
| parent | 0335cb76aa3fa913a2164bc9b669e5aef9d56fa3 (diff) | |
| parent | a6525042bfdfcab128bd91fad264de10fd24a55e (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
Diffstat (limited to 'include/linux/pid.h')
| -rw-r--r-- | include/linux/pid.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/pid.h b/include/linux/pid.h index bb206c56d1f0..49f1c2f66e95 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; |
