Lines Matching full:task

40 	struct task_struct *task;  in task_group_seq_get_next()  local
47 task = get_pid_task(pid, PIDTYPE_TGID); in task_group_seq_get_next()
48 if (!task) in task_group_seq_get_next()
54 return task; in task_group_seq_get_next()
59 * same for task_seq_start() to pick up the correct task. in task_group_seq_get_next()
63 task = get_pid_task(pid, PIDTYPE_PID); in task_group_seq_get_next()
65 return task; in task_group_seq_get_next()
68 task = find_task_by_pid_ns(common->pid_visiting, common->ns); in task_group_seq_get_next()
69 if (!task) in task_group_seq_get_next()
73 task = __next_thread(task); in task_group_seq_get_next()
74 if (!task) in task_group_seq_get_next()
77 next_tid = __task_pid_nr_ns(task, PIDTYPE_PID, common->ns); in task_group_seq_get_next()
81 if (skip_if_dup_files && task->files == task->group_leader->files) in task_group_seq_get_next()
85 get_task_struct(task); in task_group_seq_get_next()
86 return task; in task_group_seq_get_next()
93 struct task_struct *task = NULL; in task_seq_get_next() local
102 task = get_pid_task(pid, PIDTYPE_TGID); in task_seq_get_next()
107 return task; in task_seq_get_next()
112 task = task_group_seq_get_next(common, tid, skip_if_dup_files); in task_seq_get_next()
115 return task; in task_seq_get_next()
123 task = get_pid_task(pid, PIDTYPE_PID); in task_seq_get_next()
124 if (!task) { in task_seq_get_next()
127 } else if (skip_if_dup_files && !thread_group_leader(task) && in task_seq_get_next()
128 task->files == task->group_leader->files) { in task_seq_get_next()
129 put_task_struct(task); in task_seq_get_next()
130 task = NULL; in task_seq_get_next()
137 return task; in task_seq_get_next()
143 struct task_struct *task; in task_seq_start() local
145 task = task_seq_get_next(&info->common, &info->tid, false); in task_seq_start()
146 if (!task) in task_seq_start()
151 return task; in task_seq_start()
157 struct task_struct *task; in task_seq_next() local
162 task = task_seq_get_next(&info->common, &info->tid, false); in task_seq_next()
163 if (!task) in task_seq_next()
166 return task; in task_seq_next()
171 __bpf_md_ptr(struct task_struct *, task);
174 DEFINE_BPF_ITER_FUNC(task, struct bpf_iter_meta *meta, struct task_struct *task) in DEFINE_BPF_ITER_FUNC() argument
176 static int __task_seq_show(struct seq_file *seq, struct task_struct *task, in DEFINE_BPF_ITER_FUNC()
189 ctx.task = task; in DEFINE_BPF_ITER_FUNC()
214 if ((!!linfo->task.tid + !!linfo->task.pid + !!linfo->task.pid_fd) > 1) in bpf_iter_attach_task()
217 aux->task.type = BPF_TASK_ITER_ALL; in bpf_iter_attach_task()
218 if (linfo->task.tid != 0) { in bpf_iter_attach_task()
219 aux->task.type = BPF_TASK_ITER_TID; in bpf_iter_attach_task()
220 aux->task.pid = linfo->task.tid; in bpf_iter_attach_task()
222 if (linfo->task.pid != 0) { in bpf_iter_attach_task()
223 aux->task.type = BPF_TASK_ITER_TGID; in bpf_iter_attach_task()
224 aux->task.pid = linfo->task.pid; in bpf_iter_attach_task()
226 if (linfo->task.pid_fd != 0) { in bpf_iter_attach_task()
227 aux->task.type = BPF_TASK_ITER_TGID; in bpf_iter_attach_task()
229 pid = pidfd_get_pid(linfo->task.pid_fd, &flags); in bpf_iter_attach_task()
234 aux->task.pid = tgid; in bpf_iter_attach_task()
253 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()
301 /* the current task is done, go to the next task */ in task_file_seq_get_next()
306 info->task = NULL; in task_file_seq_get_next()
310 info->task = NULL; in task_file_seq_get_next()
321 info->task = NULL; in task_file_seq_start()
341 __bpf_md_ptr(struct task_struct *, task);
347 struct task_struct *task, u32 fd, in DEFINE_BPF_ITER_FUNC() argument
364 ctx.task = info->task; in DEFINE_BPF_ITER_FUNC()
383 put_task_struct(info->task); in task_file_seq_stop()
384 info->task = NULL; in task_file_seq_stop()
393 common->type = aux->task.type; in init_seq_pidns()
394 common->pid = aux->task.pid; in init_seq_pidns()
418 struct task_struct *task; member
447 if (info->task) { in task_vma_seq_get_next()
448 curr_task = info->task; in task_vma_seq_get_next()
480 * Process the next task. in task_vma_seq_get_next()
510 /* new task, process the first vma */ in task_vma_seq_get_next()
560 info->task = curr_task; in task_vma_seq_get_next()
570 info->task = NULL; in task_vma_seq_get_next()
578 info->task = NULL; in task_vma_seq_get_next()
606 __bpf_md_ptr(struct task_struct *, task);
611 struct task_struct *task, struct vm_area_struct *vma) in DEFINE_BPF_ITER_FUNC() argument
626 ctx.task = info->task; in DEFINE_BPF_ITER_FUNC()
655 put_task_struct(info->task); in task_vma_seq_stop()
656 info->task = NULL; in task_vma_seq_stop()
676 switch (aux->task.type) { in bpf_iter_fill_link_info()
678 info->iter.task.tid = aux->task.pid; in bpf_iter_fill_link_info()
681 info->iter.task.pid = aux->task.pid; in bpf_iter_fill_link_info()
691 seq_printf(seq, "task_type:\t%s\n", iter_task_type_names[aux->task.type]); in bpf_iter_task_show_fdinfo()
692 if (aux->task.type == BPF_TASK_ITER_TID) in bpf_iter_task_show_fdinfo()
693 seq_printf(seq, "tid:\t%u\n", aux->task.pid); in bpf_iter_task_show_fdinfo()
694 else if (aux->task.type == BPF_TASK_ITER_TGID) in bpf_iter_task_show_fdinfo()
695 seq_printf(seq, "pid:\t%u\n", aux->task.pid); in bpf_iter_task_show_fdinfo()
699 .target = "task",
704 { offsetof(struct bpf_iter__task, task),
725 { offsetof(struct bpf_iter__task_file, task),
748 { offsetof(struct bpf_iter__task_vma, task),
758 BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start, in BPF_CALL_5() argument
770 if (!task) in BPF_CALL_5()
773 mm = task->mm; in BPF_CALL_5()
785 callback_fn((u64)(long)task, (u64)(long)vma, in BPF_CALL_5()
805 struct task_struct *task; member
826 struct task_struct *task, u64 addr) in bpf_iter_task_vma_new() argument
843 kit->data->task = get_task_struct(task); in bpf_iter_task_vma_new()
844 kit->data->mm = task->mm; in bpf_iter_task_vma_new()
861 if (kit->data->task) in bpf_iter_task_vma_new()
862 put_task_struct(kit->data->task); in bpf_iter_task_vma_new()
884 put_task_struct(kit->data->task); in bpf_iter_task_vma_destroy()
956 struct task_struct *task; member
996 kit->task = task__nullable; in bpf_iter_task_new()
998 kit->task = &init_task; in bpf_iter_task_new()
999 kit->pos = kit->task; in bpf_iter_task_new()
1024 kit->task = next_task(kit->task); in bpf_iter_task_next()
1025 if (kit->task == &init_task) in bpf_iter_task_next()
1028 kit->pos = kit->task; in bpf_iter_task_next()