Lines Matching refs: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()
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_PID); 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
271 if (info->task) { in task_file_seq_get_next()
272 curr_task = info->task; in task_file_seq_get_next()
277 info->task = NULL; in task_file_seq_get_next()
282 info->task = curr_task; in task_file_seq_get_next()
303 info->task = NULL; in task_file_seq_get_next()
307 info->task = NULL; in task_file_seq_get_next()
318 info->task = NULL; in task_file_seq_start()
338 __bpf_md_ptr(struct task_struct *, task);
344 struct task_struct *task, u32 fd, in DEFINE_BPF_ITER_FUNC() argument
361 ctx.task = info->task; in DEFINE_BPF_ITER_FUNC()
380 put_task_struct(info->task); in task_file_seq_stop()
381 info->task = NULL; in task_file_seq_stop()
390 common->type = aux->task.type; in init_seq_pidns()
391 common->pid = aux->task.pid; in init_seq_pidns()
415 struct task_struct *task; member
444 if (info->task) { in task_vma_seq_get_next()
445 curr_task = info->task; in task_vma_seq_get_next()
557 info->task = curr_task; in task_vma_seq_get_next()
567 info->task = NULL; in task_vma_seq_get_next()
575 info->task = NULL; in task_vma_seq_get_next()
603 __bpf_md_ptr(struct task_struct *, task);
608 struct task_struct *task, struct vm_area_struct *vma) in DEFINE_BPF_ITER_FUNC() argument
623 ctx.task = info->task; in DEFINE_BPF_ITER_FUNC()
652 put_task_struct(info->task); in task_vma_seq_stop()
653 info->task = NULL; in task_vma_seq_stop()
673 switch (aux->task.type) { in bpf_iter_fill_link_info()
675 info->iter.task.tid = aux->task.pid; in bpf_iter_fill_link_info()
678 info->iter.task.pid = aux->task.pid; in bpf_iter_fill_link_info()
688 seq_printf(seq, "task_type:\t%s\n", iter_task_type_names[aux->task.type]); in bpf_iter_task_show_fdinfo()
689 if (aux->task.type == BPF_TASK_ITER_TID) in bpf_iter_task_show_fdinfo()
690 seq_printf(seq, "tid:\t%u\n", aux->task.pid); in bpf_iter_task_show_fdinfo()
691 else if (aux->task.type == BPF_TASK_ITER_TGID) in bpf_iter_task_show_fdinfo()
692 seq_printf(seq, "pid:\t%u\n", aux->task.pid); in bpf_iter_task_show_fdinfo()
701 { offsetof(struct bpf_iter__task, task),
722 { offsetof(struct bpf_iter__task_file, task),
745 { offsetof(struct bpf_iter__task_vma, task),
755 BPF_CALL_5(bpf_find_vma, struct task_struct *, task, u64, start, in BPF_CALL_5() argument
767 if (!task) in BPF_CALL_5()
770 mm = task->mm; in BPF_CALL_5()
782 callback_fn((u64)(long)task, (u64)(long)vma, in BPF_CALL_5()
802 struct task_struct *task; member
823 struct task_struct *task, u64 addr) in bpf_iter_task_vma_new() argument
840 kit->data->task = get_task_struct(task); in bpf_iter_task_vma_new()
841 kit->data->mm = task->mm; in bpf_iter_task_vma_new()
858 if (kit->data->task) in bpf_iter_task_vma_new()
859 put_task_struct(kit->data->task); in bpf_iter_task_vma_new()
881 put_task_struct(kit->data->task); in bpf_iter_task_vma_destroy()
953 struct task_struct *task; member
993 kit->task = task__nullable; in bpf_iter_task_new()
995 kit->task = &init_task; in bpf_iter_task_new()
996 kit->pos = kit->task; in bpf_iter_task_new()
1021 kit->task = next_task(kit->task); in bpf_iter_task_next()
1022 if (kit->task == &init_task) in bpf_iter_task_next()
1025 kit->pos = kit->task; in bpf_iter_task_next()