sched: Remove all group id related stuff

it is wrong to define a new grpid_t, but not reuse pid_t,
because it make getpid(parent) == getppid(child) impossible.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2021-03-04 01:11:40 +08:00
committed by liuguo09
parent 0a797f1e8b
commit 90be95bb89
13 changed files with 43 additions and 294 deletions
+6 -14
View File
@@ -249,7 +249,7 @@ static inline void nxtask_groupexit(FAR struct task_group_s *group)
#ifdef CONFIG_SCHED_HAVE_PARENT
#ifdef HAVE_GROUP_MEMBERS
static inline void nxtask_sigchild(grpid_t pgrpid, FAR struct tcb_s *ctcb,
static inline void nxtask_sigchild(pid_t ppid, FAR struct tcb_s *ctcb,
int status)
{
FAR struct task_group_s *chgrp = ctcb->group;
@@ -263,14 +263,14 @@ static inline void nxtask_sigchild(grpid_t pgrpid, FAR struct tcb_s *ctcb,
* this case, the child task group has been orphaned.
*/
pgrp = group_findby_grpid(pgrpid);
pgrp = group_findbypid(ppid);
if (!pgrp)
{
/* Set the task group ID to an invalid group ID. The dead parent
* task group ID could get reused some time in the future.
*/
chgrp->tg_pgrpid = INVALID_GROUP_ID;
chgrp->tg_ppid = INVALID_PROCESS_ID;
return;
}
@@ -305,11 +305,7 @@ static inline void nxtask_sigchild(grpid_t pgrpid, FAR struct tcb_s *ctcb,
info.si_code = CLD_EXITED;
info.si_errno = OK;
info.si_value.sival_ptr = NULL;
#ifndef CONFIG_DISABLE_PTHREAD
info.si_pid = chgrp->tg_task;
#else
info.si_pid = ctcb->pid;
#endif
info.si_pid = chgrp->tg_pid;
info.si_status = status;
/* Send the signal to one thread in the group */
@@ -358,11 +354,7 @@ static inline void nxtask_sigchild(FAR struct tcb_s *ptcb,
info.si_code = CLD_EXITED;
info.si_errno = OK;
info.si_value.sival_ptr = NULL;
#ifndef CONFIG_DISABLE_PTHREAD
info.si_pid = ctcb->group->tg_task;
#else
info.si_pid = ctcb->pid;
#endif
info.si_pid = ctcb->group->tg_pid;
info.si_status = status;
/* Send the signal. We need to use this internal interface so that we
@@ -400,7 +392,7 @@ static inline void nxtask_signalparent(FAR struct tcb_s *ctcb, int status)
/* Send SIGCHLD to all members of the parent's task group */
nxtask_sigchild(ctcb->group->tg_pgrpid, ctcb, status);
nxtask_sigchild(ctcb->group->tg_ppid, ctcb, status);
sched_unlock();
#else
FAR struct tcb_s *ptcb;