[PATCH 2/5] pid: Add macros for interating through tasks by type.

From: Eric W. Biederman
Date: Sun Jan 29 2006 - 02:23:25 EST



Currently do_each_task_pid/while_each_task_pid make it
possible to iterate through each task of a group of
processes given the pid of the group.

do_each_task/while_each_task do the same thing but assume
you are atarting with the first task of a process group.
This is needed so we can start with a task_ref instead
of a pid.

Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>


---

include/linux/pid.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

34e71e62a13a78350239c18e3e3c31e79593380f
diff --git a/include/linux/pid.h b/include/linux/pid.h
index e206149..7fa9b2e 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -54,4 +54,16 @@ extern void switch_exec_pids(struct task
hlist_unhashed(&(task)->pids[type].pid_chain)); \
} \

+#define do_each_task(task, type) \
+ if (task) { \
+ prefetch((task)->pids[type].pid_list.next); \
+ do {
+
+#define while_each_task(task, type) \
+ } while (task = pid_task((task)->pids[type].pid_list.next, \
+ (type)), \
+ prefetch((task)->pids[type].pid_list.next), \
+ hlist_unhashed(&(task)->pids[type].pid_chain)); \
+ }
+
#endif /* _LINUX_PID_H */
--
1.1.5.g3480

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/