diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index 2e4961be90..e2f69308c7 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -454,6 +454,9 @@ struct task_group_s #else uint16_t tg_nchildren; /* This is the number active children */ #endif + /* Group exit status ******************************************************/ + + int tg_exitcode; /* Exit code (status) for group */ #endif /* CONFIG_SCHED_HAVE_PARENT */ #if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT) diff --git a/sched/task/task_exithook.c b/sched/task/task_exithook.c index 375487f76e..e0915abcbf 100644 --- a/sched/task/task_exithook.c +++ b/sched/task/task_exithook.c @@ -80,7 +80,7 @@ static inline void nxtask_exitstatus(FAR struct task_group_s *group, } #else -# define nxtask_exitstatus(group,status) +# define nxtask_exitstatus(group,status) (group)->tg_exitcode = (status); #endif /* CONFIG_SCHED_CHILD_STATUS */ @@ -188,7 +188,7 @@ static inline void nxtask_sigchild(pid_t ppid, FAR struct tcb_s *ctcb, info.si_errno = OK; info.si_value.sival_ptr = NULL; info.si_pid = chgrp->tg_pid; - info.si_status = status; + info.si_status = pgrp->tg_exitcode; /* Send the signal to one thread in the group */