mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user