Lines Matching refs:wo
935 static int eligible_pid(struct wait_opts *wo, struct task_struct *p) in eligible_pid() argument
937 return wo->wo_type == PIDTYPE_MAX || in eligible_pid()
938 task_pid_type(p, wo->wo_type) == wo->wo_pid; in eligible_pid()
942 eligible_child(struct wait_opts *wo, bool ptrace, struct task_struct *p) in eligible_child() argument
944 if (!eligible_pid(wo, p)) in eligible_child()
951 if (ptrace || (wo->wo_flags & __WALL)) in eligible_child()
962 if ((p->exit_signal != SIGCHLD) ^ !!(wo->wo_flags & __WCLONE)) in eligible_child()
974 static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) in wait_task_zombie() argument
981 if (!likely(wo->wo_flags & WEXITED)) in wait_task_zombie()
984 if (unlikely(wo->wo_flags & WNOWAIT)) { in wait_task_zombie()
989 if (wo->wo_rusage) in wait_task_zombie()
990 getrusage(p, RUSAGE_BOTH, wo->wo_rusage); in wait_task_zombie()
1065 if (wo->wo_rusage) in wait_task_zombie()
1066 getrusage(p, RUSAGE_BOTH, wo->wo_rusage); in wait_task_zombie()
1069 wo->wo_stat = status; in wait_task_zombie()
1087 infop = wo->wo_info; in wait_task_zombie()
1133 static int wait_task_stopped(struct wait_opts *wo, in wait_task_stopped() argument
1144 if (!ptrace && !(wo->wo_flags & WUNTRACED)) in wait_task_stopped()
1161 if (!unlikely(wo->wo_flags & WNOWAIT)) in wait_task_stopped()
1182 if (wo->wo_rusage) in wait_task_stopped()
1183 getrusage(p, RUSAGE_BOTH, wo->wo_rusage); in wait_task_stopped()
1186 if (likely(!(wo->wo_flags & WNOWAIT))) in wait_task_stopped()
1187 wo->wo_stat = (exit_code << 8) | 0x7f; in wait_task_stopped()
1189 infop = wo->wo_info; in wait_task_stopped()
1205 static int wait_task_continued(struct wait_opts *wo, struct task_struct *p) in wait_task_continued() argument
1211 if (!unlikely(wo->wo_flags & WCONTINUED)) in wait_task_continued()
1223 if (!unlikely(wo->wo_flags & WNOWAIT)) in wait_task_continued()
1232 if (wo->wo_rusage) in wait_task_continued()
1233 getrusage(p, RUSAGE_BOTH, wo->wo_rusage); in wait_task_continued()
1236 infop = wo->wo_info; in wait_task_continued()
1238 wo->wo_stat = 0xffff; in wait_task_continued()
1257 static int wait_consider_task(struct wait_opts *wo, int ptrace, in wait_consider_task() argument
1271 ret = eligible_child(wo, ptrace, p); in wait_consider_task()
1281 wo->notask_error = 0; in wait_consider_task()
1311 return wait_task_zombie(wo, p); in wait_consider_task()
1334 if (likely(!ptrace) || (wo->wo_flags & (WCONTINUED | WEXITED))) in wait_consider_task()
1335 wo->notask_error = 0; in wait_consider_task()
1341 wo->notask_error = 0; in wait_consider_task()
1348 ret = wait_task_stopped(wo, ptrace, p); in wait_consider_task()
1357 return wait_task_continued(wo, p); in wait_consider_task()
1369 static int do_wait_thread(struct wait_opts *wo, struct task_struct *tsk) in do_wait_thread() argument
1374 int ret = wait_consider_task(wo, 0, p); in do_wait_thread()
1383 static int ptrace_do_wait(struct wait_opts *wo, struct task_struct *tsk) in ptrace_do_wait() argument
1388 int ret = wait_consider_task(wo, 1, p); in ptrace_do_wait()
1400 struct wait_opts *wo = container_of(wait, struct wait_opts, in child_wait_callback() local
1404 if (!eligible_pid(wo, p)) in child_wait_callback()
1407 if ((wo->wo_flags & __WNOTHREAD) && wait->private != p->parent) in child_wait_callback()
1419 static long do_wait(struct wait_opts *wo) in do_wait() argument
1424 trace_sched_process_wait(wo->wo_pid); in do_wait()
1426 init_waitqueue_func_entry(&wo->child_wait, child_wait_callback); in do_wait()
1427 wo->child_wait.private = current; in do_wait()
1428 add_wait_queue(¤t->signal->wait_chldexit, &wo->child_wait); in do_wait()
1436 wo->notask_error = -ECHILD; in do_wait()
1437 if ((wo->wo_type < PIDTYPE_MAX) && in do_wait()
1438 (!wo->wo_pid || hlist_empty(&wo->wo_pid->tasks[wo->wo_type]))) in do_wait()
1445 retval = do_wait_thread(wo, tsk); in do_wait()
1449 retval = ptrace_do_wait(wo, tsk); in do_wait()
1453 if (wo->wo_flags & __WNOTHREAD) in do_wait()
1459 retval = wo->notask_error; in do_wait()
1460 if (!retval && !(wo->wo_flags & WNOHANG)) { in do_wait()
1469 remove_wait_queue(¤t->signal->wait_chldexit, &wo->child_wait); in do_wait()
1493 struct wait_opts wo; in kernel_waitid() local
1538 wo.wo_type = type; in kernel_waitid()
1539 wo.wo_pid = pid; in kernel_waitid()
1540 wo.wo_flags = options; in kernel_waitid()
1541 wo.wo_info = infop; in kernel_waitid()
1542 wo.wo_rusage = ru; in kernel_waitid()
1543 ret = do_wait(&wo); in kernel_waitid()
1585 struct wait_opts wo; in kernel_wait4() local
1611 wo.wo_type = type; in kernel_wait4()
1612 wo.wo_pid = pid; in kernel_wait4()
1613 wo.wo_flags = options | WEXITED; in kernel_wait4()
1614 wo.wo_info = NULL; in kernel_wait4()
1615 wo.wo_stat = 0; in kernel_wait4()
1616 wo.wo_rusage = ru; in kernel_wait4()
1617 ret = do_wait(&wo); in kernel_wait4()
1619 if (ret > 0 && stat_addr && put_user(wo.wo_stat, stat_addr)) in kernel_wait4()