mirror of
https://github.com/apache/nuttx.git
synced 2026-10-02 11:48:02 +00: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:
parent
556f0bc0a6
commit
d5c4433a01
1 changed files with 7 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue