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 <oleg@redhat.com> Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
This commit is contained in:

committed by
Eric W. Biederman

parent
015bb305b8
commit
0f1b92cbdd
@@ -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;
|
||||
|
Reference in New Issue
Block a user