Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_exit.c
Show First 20 Lines • Show All 1,119 Lines • ▼ Show 20 Lines | if (p_canwait(td, p)) { | ||||
return (0); | return (0); | ||||
} | } | ||||
if (((options & WEXITED) == 0) && (p->p_state == PRS_ZOMBIE)) { | if (((options & WEXITED) == 0) && (p->p_state == PRS_ZOMBIE)) { | ||||
PROC_UNLOCK(p); | PROC_UNLOCK(p); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | |||||
* This special case handles a kthread spawned by linux_clone | |||||
* (see linux_misc.c). The linux_wait4 and linux_waitpid | |||||
* functions need to be able to distinguish between waiting | |||||
* on a process and waiting on a thread. It is a thread if | |||||
* p_sigparent is not SIGCHLD, and the WLINUXCLONE option | |||||
* signifies we want to wait for threads and not processes. | |||||
*/ | |||||
if ((p->p_sigparent != SIGCHLD) ^ | |||||
((options & WLINUXCLONE) != 0)) { | |||||
PROC_UNLOCK(p); | |||||
return (0); | |||||
} | |||||
if (siginfo != NULL) { | if (siginfo != NULL) { | ||||
bzero(siginfo, sizeof(*siginfo)); | bzero(siginfo, sizeof(*siginfo)); | ||||
siginfo->si_errno = 0; | siginfo->si_errno = 0; | ||||
/* | /* | ||||
* SUSv4 requires that the si_signo value is always | * SUSv4 requires that the si_signo value is always | ||||
* SIGCHLD. Obey it despite the rfork(2) interface | * SIGCHLD. Obey it despite the rfork(2) interface | ||||
* allows to request other signal for child exit | * allows to request other signal for child exit | ||||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | if ((pid_t)id == WAIT_MYPGRP && (idtype == P_PID || idtype == P_PGID)) { | ||||
PROC_LOCK(q); | PROC_LOCK(q); | ||||
id = (id_t)q->p_pgid; | id = (id_t)q->p_pgid; | ||||
PROC_UNLOCK(q); | PROC_UNLOCK(q); | ||||
idtype = P_PGID; | idtype = P_PGID; | ||||
} | } | ||||
/* If we don't know the option, just return. */ | /* If we don't know the option, just return. */ | ||||
if ((options & ~(WUNTRACED | WNOHANG | WCONTINUED | WNOWAIT | | if ((options & ~(WUNTRACED | WNOHANG | WCONTINUED | WNOWAIT | | ||||
WEXITED | WTRAPPED | WLINUXCLONE)) != 0) | WEXITED | WTRAPPED)) != 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
if ((options & (WEXITED | WUNTRACED | WCONTINUED | WTRAPPED)) == 0) { | if ((options & (WEXITED | WUNTRACED | WCONTINUED | WTRAPPED)) == 0) { | ||||
/* | /* | ||||
* We will be unable to find any matching processes, | * We will be unable to find any matching processes, | ||||
* because there are no known events to look for. | * because there are no known events to look for. | ||||
* Prefer to return error instead of blocking | * Prefer to return error instead of blocking | ||||
* indefinitely. | * indefinitely. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 160 Lines • Show Last 20 Lines |