Lines Matching full:task

38 	struct task_struct *task, *next_task;  in task_group_seq_get_next()  local
48 task = get_pid_task(pid, PIDTYPE_TGID); in task_group_seq_get_next()
49 if (!task) in task_group_seq_get_next()
55 return task; in task_group_seq_get_next()
60 * same for task_seq_start() to pick up the correct task. in task_group_seq_get_next()
64 task = get_pid_task(pid, PIDTYPE_PID); in task_group_seq_get_next()
66 return task; in task_group_seq_get_next()
73 task = get_pid_task(pid, PIDTYPE_PID); in task_group_seq_get_next()
74 if (!task) in task_group_seq_get_next()
78 if (!pid_alive(task)) { in task_group_seq_get_next()
79 put_task_struct(task); in task_group_seq_get_next()
83 next_task = next_thread(task); in task_group_seq_get_next()
84 put_task_struct(task); in task_group_seq_get_next()
101 if (skip_if_dup_files && task->files == task->group_leader->files) { in task_group_seq_get_next()
102 task = next_task; in task_group_seq_get_next()
113 struct task_struct *task = NULL; in task_seq_get_next() local
122 task = get_pid_task(pid, PIDTYPE_TGID); in task_seq_get_next()
127 return task; in task_seq_get_next()
132 task = task_group_seq_get_next(common, tid, skip_if_dup_files); in task_seq_get_next()
135 return task; in task_seq_get_next()
143 task = get_pid_task(pid, PIDTYPE_PID); in task_seq_get_next()
144 if (!task) { in task_seq_get_next()
147 } else if (skip_if_dup_files && !thread_group_leader(task) && in task_seq_get_next()
148 task->files == task->group_leader->files) { in task_seq_get_next()
149 put_task_struct(task); in task_seq_get_next()
150 task = NULL; in task_seq_get_next()
157 return task; in task_seq_get_next()
163 struct task_struct *task; in task_seq_start() local
165 task = task_seq_get_next(&info->common, &info->tid, false); in task_seq_start()
166 if (!task) in task_seq_start()
171 return task; in task_seq_start()
177 struct task_struct *task; in task_seq_next() local
182 task = task_seq_get_next(&info->common, &info->tid, false); in task_seq_next()
183 if (!task) in task_seq_next()
186 return task; in task_seq_next()
191 __bpf_md_ptr(struct task_struct *, task);
194 DEFINE_BPF_ITER_FUNC(task, struct bpf_iter_meta *meta, struct task_struct *task) in DEFINE_BPF_ITER_FUNC() argument
196 static int __task_seq_show(struct seq_file *seq, struct task_struct *task, in DEFINE_BPF_ITER_FUNC()
209 ctx.task = task; in DEFINE_BPF_ITER_FUNC()
234 if ((!!linfo->task.tid + !!linfo->task.pid + !!linfo->task.pid_fd) > 1) in bpf_iter_attach_task()
237 aux->task.type = BPF_TASK_ITER_ALL; in bpf_iter_attach_task()
238 if (linfo->task.tid != 0) { in bpf_iter_attach_task()
239 aux->task.type = BPF_TASK_ITER_TID; in bpf_iter_attach_task()
240 aux->task.pid = linfo->task.tid; in bpf_iter_attach_task()
242 if (linfo->task.pid != 0) { in bpf_iter_attach_task()
243 aux->task.type = BPF_TASK_ITER_TGID; in bpf_iter_attach_task()
244 aux->task.pid = linfo->task.pid; in bpf_iter_attach_task()
246 if (linfo->task.pid_fd != 0) { in bpf_iter_attach_task()
247 aux->task.type = BPF_TASK_ITER_TGID; in bpf_iter_attach_task()
249 pid = pidfd_get_pid(linfo->task.pid_fd, &flags); in bpf_iter_attach_task()
254 aux->task.pid = tgid; in bpf_iter_attach_task()
273 struct task_struct *task; member
286 * it held a reference to the task/file. in task_file_seq_get_next()
290 if (info->task) { in task_file_seq_get_next()
291 curr_task = info->task; in task_file_seq_get_next()
296 info->task = NULL; in task_file_seq_get_next()
300 /* set info->task */ in task_file_seq_get_next()
301 info->task = curr_task; in task_file_seq_get_next()
323 /* the current task is done, go to the next task */ in task_file_seq_get_next()
328 info->task = NULL; in task_file_seq_get_next()
332 info->task = NULL; in task_file_seq_get_next()
343 info->task = NULL; in task_file_seq_start()
363 __bpf_md_ptr(struct task_struct *, task);
369 struct task_struct *task, u32 fd, in DEFINE_BPF_ITER_FUNC() argument
386 ctx.task = info->task; in DEFINE_BPF_ITER_FUNC()
405 put_task_struct(info->task); in task_file_seq_stop()
406 info->task = NULL; in task_file_seq_stop()
415 common->type = aux->task.type; in init_seq_pidns()
416 common->pid = aux->task.pid; in init_seq_pidns()
440 struct task_struct *task; member
466 if (info->task) { in task_vma_seq_get_next()
467 curr_task = info->task; in task_vma_seq_get_next()
498 * Process the next task. in task_vma_seq_get_next()
526 /* new task, process the first vma */ in task_vma_seq_get_next()
572 info->task = curr_task; in task_vma_seq_get_next()
581 info->task = NULL; in task_vma_seq_get_next()
588 info->task = NULL; in task_vma_seq_get_next()
615 __bpf_md_ptr(struct task_struct *, task);
620 struct task_struct *task, struct vm_area_struct *vma) in DEFINE_BPF_ITER_FUNC() argument
635 ctx.task = info->task; in DEFINE_BPF_ITER_FUNC()
661 mmap_read_unlock(info->task->mm); in task_vma_seq_stop()
662 put_task_struct(info->task); in task_vma_seq_stop()
663 info->task = NULL; in task_vma_seq_stop()
683 switch (aux->task.type) { in bpf_iter_fill_link_info()
685 info->iter.task.tid = aux->task.pid; in bpf_iter_fill_link_info()
688 info->iter.task.pid = aux->task.pid; in bpf_iter_fill_link_info()
698 seq_printf(seq, "task_type:\t%s\n", iter_task_type_names[aux->task.type]); in bpf_iter_task_show_fdinfo()
699 if (aux->task.type == BPF_TASK_ITER_TID) in bpf_iter_task_show_fdinfo()
700 seq_printf(seq, "tid:\t%u\n", aux->task.pid); in bpf_iter_task_show_fdinfo()
701 else if (aux->task.type == BPF_TASK_ITER_TGID) in bpf_iter_task_show_fdinfo()
702 seq_printf(seq, "pid:\t%u\n", aux->task.pid); in bpf_iter_task_show_fdinfo()
706 .target = "task",
711 { offsetof(struct bpf_iter__task, task),
732 { offsetof(struct bpf_iter__task_file, task),
755 { offsetof(struct bpf_iter__task_vma, task),
765 BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start, in BPF_CALL_5() argument
777 if (!task) in BPF_CALL_5()
780 mm = task->mm; in BPF_CALL_5()
792 callback_fn((u64)(long)task, (u64)(long)vma, in BPF_CALL_5()