diff options
author | Oleg Nesterov <[email protected]> | 2017-01-30 18:06:11 +0300 |
---|---|---|
committer | Eric W. Biederman <[email protected]> | 2017-02-03 16:34:41 +1300 |
commit | 0f1b92cbdd0309afae0af1963e8cccddb3d2eaff (patch) | |
tree | f30ecfd58043e4a2b32de2b053efac37a4f03b21 /include/linux/sched.h | |
parent | 015bb305b8ebe8d601a238ab70ebdc394c7a19ba (diff) |
introduce the walk_process_tree() helper
Add the new helper to walk the process tree, the next patch adds a user.
Note that it visits the group leaders only, proc_visitor can do
for_each_thread itself or we can trivially extend walk_process_tree() to
do this.
Signed-off-by: Oleg Nesterov <[email protected]>
Signed-off-by: Pavel Tikhomirov <[email protected]>
Signed-off-by: Eric W. Biederman <[email protected]>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index d2334229167f..6261bfc12853 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -3053,6 +3053,9 @@ extern bool current_is_single_threaded(void); #define for_each_process_thread(p, t) \ for_each_process(p) for_each_thread(p, t) +typedef int (*proc_visitor)(struct task_struct *p, void *data); +void walk_process_tree(struct task_struct *top, proc_visitor, void *); + static inline int get_nr_threads(struct task_struct *tsk) { return tsk->signal->nr_threads; |