diff --git a/sched/sched/sched_waitid.c b/sched/sched/sched_waitid.c index 003f8b597f9..7f7aa717472 100644 --- a/sched/sched/sched_waitid.c +++ b/sched/sched/sched_waitid.c @@ -239,6 +239,8 @@ int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options) } } #else + /* Child status is not retained. */ + if (rtcb->nchildren == 0) { /* There are no children */ diff --git a/sched/sched/sched_waitpid.c b/sched/sched/sched_waitpid.c index 0e3902342b1..a8f164c0397 100644 --- a/sched/sched/sched_waitpid.c +++ b/sched/sched/sched_waitpid.c @@ -383,6 +383,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options) /* Get the TCB corresponding to this PID and make sure it is our child. */ ctcb = sched_gettcb(pid); + #ifdef HAVE_GROUP_MEMBERS if (!ctcb || ctcb->group->tg_pgid != rtcb->group->tg_gid) #else diff --git a/sched/task/task_reparent.c b/sched/task/task_reparent.c index 690294ec024..13cbbc39a29 100644 --- a/sched/task/task_reparent.c +++ b/sched/task/task_reparent.c @@ -190,6 +190,7 @@ int task_reparent(pid_t ppid, pid_t chpid) } #else /* CONFIG_SCHED_CHILD_STATUS */ + /* Child task exit status is not retained */ DEBUGASSERT(otcb->nchildren > 0); @@ -302,6 +303,7 @@ int task_reparent(pid_t ppid, pid_t chpid) } #else /* CONFIG_SCHED_CHILD_STATUS */ + /* Child task exit status is not retained */ DEBUGASSERT(otcb->nchildren > 0); diff --git a/sched/task/task_setup.c b/sched/task/task_setup.c index 6d0ea9c2b21..7a2297a1056 100644 --- a/sched/task/task_setup.c +++ b/sched/task/task_setup.c @@ -275,8 +275,17 @@ static inline void task_saveparent(FAR struct tcb_s *tcb, uint8_t ttype) } } #else - DEBUGASSERT(rtcb->nchildren < UINT16_MAX); - rtcb->nchildren++; + /* Child status is not retained. Simply keep track of the number + * child tasks (not pthreads) created. + */ + +#ifndef CONFIG_DISABLE_PTHREAD + if ((tcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_PTHREAD) +#endif + { + DEBUGASSERT(rtcb->nchildren < UINT16_MAX); + rtcb->nchildren++; + } #endif } #else