diff options
| author | David Vrabel <david.vrabel@csr.com> | 2009-01-22 19:12:32 +0000 |
|---|---|---|
| committer | David Vrabel <david.vrabel@csr.com> | 2009-01-22 19:12:32 +0000 |
| commit | dff243f7cb3a2ebbb09093066c1bc4a90ff5b3a4 (patch) | |
| tree | 1c63e7c2f879cd322ca785671b74b4ff796dd24c /include/linux/pid.h | |
| parent | a5e6ced58d423cb09c4fc0087dcfdb0b5deb5e1c (diff) | |
| parent | f3b8436ad9a8ad36b3c9fa1fe030c7f38e5d3d0b (diff) | |
| download | cachepc-linux-dff243f7cb3a2ebbb09093066c1bc4a90ff5b3a4.tar.gz cachepc-linux-dff243f7cb3a2ebbb09093066c1bc4a90ff5b3a4.zip | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-upstream
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; |
