aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pid.h
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2006-10-02 02:17:09 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 07:57:13 -0700
commit558cb325485aaf655130f140e8ddd25392f6c972 (patch)
treeadfea6c0b901cf6591209d29091ff5ac298843c3 /include/linux/pid.h
parent[PATCH] pid: implement access helpers for a tacks various process groups (diff)
downloadlinux-dev-558cb325485aaf655130f140e8ddd25392f6c972.tar.xz
linux-dev-558cb325485aaf655130f140e8ddd25392f6c972.zip
[PATCH] pid: add do_each_pid_task
To avoid pid rollover confusion the kernel needs to work with struct pid * instead of pid_t. Currently there is not an iterator that walks through all of the tasks of a given pid type starting with a struct pid. This prevents us replacing some pid_t instances with struct pid. So this patch adds do_each_pid_task which walks through the set of task for a given pid type starting with a struct pid. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/pid.h')
-rw-r--r--include/linux/pid.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 359121086de1..8cf9b11ed264 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -119,4 +119,17 @@ extern void FASTCALL(free_pid(struct pid *pid));
1; }) ); \
}
+#define do_each_pid_task(pid, type, task) \
+ if ((task = pid_task(pid, type))) { \
+ prefetch(pid_next(task, type)); \
+ do {
+
+#define while_each_pid_task(pid, type, task) \
+ } while (pid_next(task, type) && ({ \
+ task = pid_next_task(task, type); \
+ rcu_dereference(task); \
+ prefetch(pid_next(task, type)); \
+ 1; }) ); \
+ }
+
#endif /* _LINUX_PID_H */