Lines Matching full:task
39 struct task_struct *task; in task_group_seq_get_next() local
46 task = get_pid_task(pid, PIDTYPE_TGID); in task_group_seq_get_next()
47 if (!task) in task_group_seq_get_next()
53 return task; in task_group_seq_get_next()
58 * same for task_seq_start() to pick up the correct task. in task_group_seq_get_next()
62 task = get_pid_task(pid, PIDTYPE_PID); in task_group_seq_get_next()
64 return task; in task_group_seq_get_next()
67 task = find_task_by_pid_ns(common->pid_visiting, common->ns); in task_group_seq_get_next()
68 if (!task) in task_group_seq_get_next()
72 task = __next_thread(task); in task_group_seq_get_next()
73 if (!task) in task_group_seq_get_next()
76 next_tid = __task_pid_nr_ns(task, PIDTYPE_PID, common->ns); in task_group_seq_get_next()
80 if (skip_if_dup_files && task->files == task->group_leader->files) in task_group_seq_get_next()
84 get_task_struct(task); in task_group_seq_get_next()
85 return task; in task_group_seq_get_next()
92 struct task_struct *task = NULL; in task_seq_get_next() local
101 task = get_pid_task(pid, PIDTYPE_PID); in task_seq_get_next()
106 return task; in task_seq_get_next()
111 task = task_group_seq_get_next(common, tid, skip_if_dup_files); in task_seq_get_next()
114 return task; in task_seq_get_next()
122 task = get_pid_task(pid, PIDTYPE_PID); in task_seq_get_next()
123 if (!task) { in task_seq_get_next()
126 } else if (skip_if_dup_files && !thread_group_leader(task) && in task_seq_get_next()
127 task->files == task->group_leader->files) { in task_seq_get_next()
128 put_task_struct(task); in task_seq_get_next()
129 task = NULL; in task_seq_get_next()
136 return task; in task_seq_get_next()
142 struct task_struct *task; in task_seq_start() local
144 task = task_seq_get_next(&info->common, &info->tid, false); in task_seq_start()
145 if (!task) in task_seq_start()
150 return task; in task_seq_start()
156 struct task_struct *task; in task_seq_next() local
161 task = task_seq_get_next(&info->common, &info->tid, false); in task_seq_next()
162 if (!task) in task_seq_next()
165 return task; in task_seq_next()
170 __bpf_md_ptr(struct task_struct *, task);
173 DEFINE_BPF_ITER_FUNC(task, struct bpf_iter_meta *meta, struct task_struct *task) in DEFINE_BPF_ITER_FUNC() argument
175 static int __task_seq_show(struct seq_file *seq, struct task_struct *task, in DEFINE_BPF_ITER_FUNC()
188 ctx.task = task; in DEFINE_BPF_ITER_FUNC()
213 if ((!!linfo->task.tid + !!linfo->task.pid + !!linfo->task.pid_fd) > 1) in bpf_iter_attach_task()
216 aux->task.type = BPF_TASK_ITER_ALL; in bpf_iter_attach_task()
217 if (linfo->task.tid != 0) { in bpf_iter_attach_task()
218 aux->task.type = BPF_TASK_ITER_TID; in bpf_iter_attach_task()
219 aux->task.pid = linfo->task.tid; in bpf_iter_attach_task()
221 if (linfo->task.pid != 0) { in bpf_iter_attach_task()
222 aux->task.type = BPF_TASK_ITER_TGID; in bpf_iter_attach_task()
223 aux->task.pid = linfo->task.pid; in bpf_iter_attach_task()
225 if (linfo->task.pid_fd != 0) { in bpf_iter_attach_task()
226 aux->task.type = BPF_TASK_ITER_TGID; in bpf_iter_attach_task()
228 pid = pidfd_get_pid(linfo->task.pid_fd, &flags); in bpf_iter_attach_task()
233 aux->task.pid = tgid; in bpf_iter_attach_task()
252 struct task_struct *task; member
266 * it held a reference to the task/file. in task_file_seq_get_next()
270 if (info->task) { in task_file_seq_get_next()
271 curr_task = info->task; in task_file_seq_get_next()
276 info->task = NULL; in task_file_seq_get_next()
280 /* set info->task */ in task_file_seq_get_next()
281 info->task = curr_task; in task_file_seq_get_next()
295 /* the current task is done, go to the next task */ in task_file_seq_get_next()
299 info->task = NULL; in task_file_seq_get_next()
303 info->task = NULL; in task_file_seq_get_next()
314 info->task = NULL; in task_file_seq_start()
334 __bpf_md_ptr(struct task_struct *, task);
340 struct task_struct *task, u32 fd, in DEFINE_BPF_ITER_FUNC() argument
357 ctx.task = info->task; in DEFINE_BPF_ITER_FUNC()
376 put_task_struct(info->task); in task_file_seq_stop()
377 info->task = NULL; in task_file_seq_stop()
386 common->type = aux->task.type; in init_seq_pidns()
387 common->pid = aux->task.pid; in init_seq_pidns()
411 struct task_struct *task; member
440 if (info->task) { in task_vma_seq_get_next()
441 curr_task = info->task; in task_vma_seq_get_next()
473 * Process the next task. in task_vma_seq_get_next()
503 /* new task, process the first vma */ in task_vma_seq_get_next()
553 info->task = curr_task; in task_vma_seq_get_next()
563 info->task = NULL; in task_vma_seq_get_next()
571 info->task = NULL; in task_vma_seq_get_next()
599 __bpf_md_ptr(struct task_struct *, task);
604 struct task_struct *task, struct vm_area_struct *vma) in DEFINE_BPF_ITER_FUNC() argument
619 ctx.task = info->task; in DEFINE_BPF_ITER_FUNC()
648 put_task_struct(info->task); in task_vma_seq_stop()
649 info->task = NULL; in task_vma_seq_stop()
669 switch (aux->task.type) { in bpf_iter_fill_link_info()
671 info->iter.task.tid = aux->task.pid; in bpf_iter_fill_link_info()
674 info->iter.task.pid = aux->task.pid; in bpf_iter_fill_link_info()
684 seq_printf(seq, "task_type:\t%s\n", iter_task_type_names[aux->task.type]); in bpf_iter_task_show_fdinfo()
685 if (aux->task.type == BPF_TASK_ITER_TID) in bpf_iter_task_show_fdinfo()
686 seq_printf(seq, "tid:\t%u\n", aux->task.pid); in bpf_iter_task_show_fdinfo()
687 else if (aux->task.type == BPF_TASK_ITER_TGID) in bpf_iter_task_show_fdinfo()
688 seq_printf(seq, "pid:\t%u\n", aux->task.pid); in bpf_iter_task_show_fdinfo()
692 .target = "task",
697 { offsetof(struct bpf_iter__task, task),
718 { offsetof(struct bpf_iter__task_file, task),
741 { offsetof(struct bpf_iter__task_vma, task),
751 BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start, in BPF_CALL_5() argument
763 if (!task) in BPF_CALL_5()
766 mm = task->mm; in BPF_CALL_5()
778 callback_fn((u64)(long)task, (u64)(long)vma, in BPF_CALL_5()
798 struct task_struct *task; member
819 struct task_struct *task, u64 addr) in bpf_iter_task_vma_new() argument
836 kit->data->task = get_task_struct(task); in bpf_iter_task_vma_new()
837 kit->data->mm = task->mm; in bpf_iter_task_vma_new()
854 if (kit->data->task) in bpf_iter_task_vma_new()
855 put_task_struct(kit->data->task); in bpf_iter_task_vma_new()
877 put_task_struct(kit->data->task); in bpf_iter_task_vma_destroy()
949 struct task_struct *task; member
989 kit->task = task__nullable; in bpf_iter_task_new()
991 kit->task = &init_task; in bpf_iter_task_new()
992 kit->pos = kit->task; in bpf_iter_task_new()
1017 kit->task = next_task(kit->task); in bpf_iter_task_next()
1018 if (kit->task == &init_task) in bpf_iter_task_next()
1021 kit->pos = kit->task; in bpf_iter_task_next()