mirror of
https://github.com/apache/nuttx.git
synced 2026-10-06 11:03:16 +08:00
sched/waitpid: Preserve child status with WNOWAIT.
When waitpid(-1) finds an exited child in the retained status list, honor WNOWAIT instead of unconditionally removing and freeing the child entry. This makes the any-child path consistent with the specific-PID and SIGCHLD paths. Assisted-by: OpenAI Codex Signed-off-by: yushuailong <yyyusl@qq.com>
This commit is contained in:
committed by
Alan C. Assis
parent
556f0bc0a6
commit
d5c4433a01
@@ -93,10 +93,14 @@ int waittcb(FAR struct tcb_s *rtcb, pid_t pid, int options,
|
||||
|
||||
ret = child->ch_pid;
|
||||
|
||||
/* Discard the child entry and break out of the loop */
|
||||
/* Discard the child entry unless WNOWAIT is set */
|
||||
|
||||
if ((options & WNOWAIT) == 0)
|
||||
{
|
||||
group_remove_child(rtcb->group, child->ch_pid);
|
||||
group_free_child(child);
|
||||
}
|
||||
|
||||
group_remove_child(rtcb->group, child->ch_pid);
|
||||
group_free_child(child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user