Lines Matching full:wo

1104 static int eligible_pid(struct wait_opts *wo, struct task_struct *p)  in eligible_pid()  argument
1106 return wo->wo_type == PIDTYPE_MAX || in eligible_pid()
1107 task_pid_type(p, wo->wo_type) == wo->wo_pid; in eligible_pid()
1111 eligible_child(struct wait_opts *wo, bool ptrace, struct task_struct *p) in eligible_child() argument
1113 if (!eligible_pid(wo, p)) in eligible_child()
1120 if (ptrace || (wo->wo_flags & __WALL)) in eligible_child()
1131 if ((p->exit_signal != SIGCHLD) ^ !!(wo->wo_flags & __WCLONE)) in eligible_child()
1143 static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) in wait_task_zombie() argument
1150 if (!likely(wo->wo_flags & WEXITED)) in wait_task_zombie()
1153 if (unlikely(wo->wo_flags & WNOWAIT)) { in wait_task_zombie()
1159 if (wo->wo_rusage) in wait_task_zombie()
1160 getrusage(p, RUSAGE_BOTH, wo->wo_rusage); in wait_task_zombie()
1231 if (wo->wo_rusage) in wait_task_zombie()
1232 getrusage(p, RUSAGE_BOTH, wo->wo_rusage); in wait_task_zombie()
1235 wo->wo_stat = status; in wait_task_zombie()
1253 infop = wo->wo_info; in wait_task_zombie()
1283 * @wo: wait options
1299 static int wait_task_stopped(struct wait_opts *wo, in wait_task_stopped() argument
1310 if (!ptrace && !(wo->wo_flags & WUNTRACED)) in wait_task_stopped()
1327 if (!unlikely(wo->wo_flags & WNOWAIT)) in wait_task_stopped()
1348 if (wo->wo_rusage) in wait_task_stopped()
1349 getrusage(p, RUSAGE_BOTH, wo->wo_rusage); in wait_task_stopped()
1352 if (likely(!(wo->wo_flags & WNOWAIT))) in wait_task_stopped()
1353 wo->wo_stat = (exit_code << 8) | 0x7f; in wait_task_stopped()
1355 infop = wo->wo_info; in wait_task_stopped()
1371 static int wait_task_continued(struct wait_opts *wo, struct task_struct *p) in wait_task_continued() argument
1377 if (!unlikely(wo->wo_flags & WCONTINUED)) in wait_task_continued()
1389 if (!unlikely(wo->wo_flags & WNOWAIT)) in wait_task_continued()
1398 if (wo->wo_rusage) in wait_task_continued()
1399 getrusage(p, RUSAGE_BOTH, wo->wo_rusage); in wait_task_continued()
1402 infop = wo->wo_info; in wait_task_continued()
1404 wo->wo_stat = 0xffff; in wait_task_continued()
1423 static int wait_consider_task(struct wait_opts *wo, int ptrace, in wait_consider_task() argument
1437 ret = eligible_child(wo, ptrace, p); in wait_consider_task()
1447 wo->notask_error = 0; in wait_consider_task()
1477 return wait_task_zombie(wo, p); in wait_consider_task()
1500 if (likely(!ptrace) || (wo->wo_flags & (WCONTINUED | WEXITED))) in wait_consider_task()
1501 wo->notask_error = 0; in wait_consider_task()
1507 wo->notask_error = 0; in wait_consider_task()
1514 ret = wait_task_stopped(wo, ptrace, p); in wait_consider_task()
1523 return wait_task_continued(wo, p); in wait_consider_task()
1535 static int do_wait_thread(struct wait_opts *wo, struct task_struct *tsk) in do_wait_thread() argument
1540 int ret = wait_consider_task(wo, 0, p); in do_wait_thread()
1549 static int ptrace_do_wait(struct wait_opts *wo, struct task_struct *tsk) in ptrace_do_wait() argument
1554 int ret = wait_consider_task(wo, 1, p); in ptrace_do_wait()
1563 bool pid_child_should_wake(struct wait_opts *wo, struct task_struct *p) in pid_child_should_wake() argument
1565 if (!eligible_pid(wo, p)) in pid_child_should_wake()
1568 if ((wo->wo_flags & __WNOTHREAD) && wo->child_wait.private != p->parent) in pid_child_should_wake()
1577 struct wait_opts *wo = container_of(wait, struct wait_opts, in child_wait_callback() local
1581 if (pid_child_should_wake(wo, p)) in child_wait_callback()
1593 static bool is_effectively_child(struct wait_opts *wo, bool ptrace, in is_effectively_child() argument
1599 return current == parent || (!(wo->wo_flags & __WNOTHREAD) && in is_effectively_child()
1607 static int do_wait_pid(struct wait_opts *wo) in do_wait_pid() argument
1614 target = pid_task(wo->wo_pid, PIDTYPE_TGID); in do_wait_pid()
1615 if (target && is_effectively_child(wo, ptrace, target)) { in do_wait_pid()
1616 retval = wait_consider_task(wo, ptrace, target); in do_wait_pid()
1622 target = pid_task(wo->wo_pid, PIDTYPE_PID); in do_wait_pid()
1624 is_effectively_child(wo, ptrace, target)) { in do_wait_pid()
1625 retval = wait_consider_task(wo, ptrace, target); in do_wait_pid()
1633 long __do_wait(struct wait_opts *wo) in __do_wait() argument
1643 wo->notask_error = -ECHILD; in __do_wait()
1644 if ((wo->wo_type < PIDTYPE_MAX) && in __do_wait()
1645 (!wo->wo_pid || !pid_has_task(wo->wo_pid, wo->wo_type))) in __do_wait()
1650 if (wo->wo_type == PIDTYPE_PID) { in __do_wait()
1651 retval = do_wait_pid(wo); in __do_wait()
1658 retval = do_wait_thread(wo, tsk); in __do_wait()
1662 retval = ptrace_do_wait(wo, tsk); in __do_wait()
1666 if (wo->wo_flags & __WNOTHREAD) in __do_wait()
1673 retval = wo->notask_error; in __do_wait()
1674 if (!retval && !(wo->wo_flags & WNOHANG)) in __do_wait()
1680 static long do_wait(struct wait_opts *wo) in do_wait() argument
1684 trace_sched_process_wait(wo->wo_pid); in do_wait()
1686 init_waitqueue_func_entry(&wo->child_wait, child_wait_callback); in do_wait()
1687 wo->child_wait.private = current; in do_wait()
1688 add_wait_queue(&current->signal->wait_chldexit, &wo->child_wait); in do_wait()
1692 retval = __do_wait(wo); in do_wait()
1701 remove_wait_queue(&current->signal->wait_chldexit, &wo->child_wait); in do_wait()
1705 int kernel_waitid_prepare(struct wait_opts *wo, int which, pid_t upid, in kernel_waitid_prepare() argument
1754 wo->wo_type = type; in kernel_waitid_prepare()
1755 wo->wo_pid = pid; in kernel_waitid_prepare()
1756 wo->wo_flags = options; in kernel_waitid_prepare()
1757 wo->wo_info = infop; in kernel_waitid_prepare()
1758 wo->wo_rusage = ru; in kernel_waitid_prepare()
1760 wo->wo_flags |= WNOHANG; in kernel_waitid_prepare()
1768 struct wait_opts wo; in kernel_waitid() local
1771 ret = kernel_waitid_prepare(&wo, which, upid, infop, options, ru); in kernel_waitid()
1775 ret = do_wait(&wo); in kernel_waitid()
1776 if (!ret && !(options & WNOHANG) && (wo.wo_flags & WNOHANG)) in kernel_waitid()
1779 put_pid(wo.wo_pid); in kernel_waitid()
1819 struct wait_opts wo; in kernel_wait4() local
1845 wo.wo_type = type; in kernel_wait4()
1846 wo.wo_pid = pid; in kernel_wait4()
1847 wo.wo_flags = options | WEXITED; in kernel_wait4()
1848 wo.wo_info = NULL; in kernel_wait4()
1849 wo.wo_stat = 0; in kernel_wait4()
1850 wo.wo_rusage = ru; in kernel_wait4()
1851 ret = do_wait(&wo); in kernel_wait4()
1853 if (ret > 0 && stat_addr && put_user(wo.wo_stat, stat_addr)) in kernel_wait4()
1861 struct wait_opts wo = { in kernel_wait() local
1868 ret = do_wait(&wo); in kernel_wait()
1869 if (ret > 0 && wo.wo_stat) in kernel_wait()
1870 *stat = wo.wo_stat; in kernel_wait()
1871 put_pid(wo.wo_pid); in kernel_wait()