|
@@ -2053,6 +2053,38 @@ SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
+void walk_process_tree(struct task_struct *top, proc_visitor visitor, void *data)
|
|
|
+{
|
|
|
+ struct task_struct *leader, *parent, *child;
|
|
|
+ int res;
|
|
|
+
|
|
|
+ read_lock(&tasklist_lock);
|
|
|
+ leader = top = top->group_leader;
|
|
|
+down:
|
|
|
+ for_each_thread(leader, parent) {
|
|
|
+ list_for_each_entry(child, &parent->children, sibling) {
|
|
|
+ res = visitor(child, data);
|
|
|
+ if (res) {
|
|
|
+ if (res < 0)
|
|
|
+ goto out;
|
|
|
+ leader = child;
|
|
|
+ goto down;
|
|
|
+ }
|
|
|
+up:
|
|
|
+ ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (leader != top) {
|
|
|
+ child = leader;
|
|
|
+ parent = child->real_parent;
|
|
|
+ leader = parent->group_leader;
|
|
|
+ goto up;
|
|
|
+ }
|
|
|
+out:
|
|
|
+ read_unlock(&tasklist_lock);
|
|
|
+}
|
|
|
+
|
|
|
#ifndef ARCH_MIN_MMSTRUCT_ALIGN
|
|
|
#define ARCH_MIN_MMSTRUCT_ALIGN 0
|
|
|
#endif
|