From 90be95bb895d0619ca4a57a8a73da416dbb14401 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 4 Mar 2021 01:11:40 +0800 Subject: [PATCH] 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 --- fs/procfs/fs_procfsproc.c | 58 +------------------------ include/nuttx/sched.h | 26 ++---------- sched/group/group.h | 16 ++----- sched/group/group_addrenv.c | 20 ++++----- sched/group/group_create.c | 85 +------------------------------------ sched/group/group_find.c | 54 ++--------------------- sched/group/group_leave.c | 2 +- sched/sched/sched_waitid.c | 12 +----- sched/sched/sched_waitpid.c | 12 +----- sched/task/task_exithook.c | 20 +++------ sched/task/task_getppid.c | 4 -- sched/task/task_reparent.c | 17 ++++---- sched/task/task_setup.c | 11 +---- 13 files changed, 43 insertions(+), 294 deletions(-) diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c index da6e967aabc..266197e18e5 100644 --- a/fs/procfs/fs_procfsproc.c +++ b/fs/procfs/fs_procfsproc.c @@ -62,18 +62,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* See include/nuttx/sched.h: */ - -#undef HAVE_GROUPID - -#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS) -# define HAVE_GROUPID 1 -#endif - -#ifdef CONFIG_DISABLE_PTHREAD -# undef HAVE_GROUPID -#endif - /* Determines the size of an intermediate buffer that must be large enough * to handle the longest line generated by this logic. */ @@ -453,9 +441,7 @@ static ssize_t proc_status(FAR struct proc_file_s *procfile, FAR struct tcb_s *tcb, FAR char *buffer, size_t buflen, off_t offset) { -#ifdef CONFIG_SCHED_HAVE_PARENT FAR struct task_group_s *group; -#endif FAR const char *policy; FAR const char *name; size_t remaining; @@ -504,18 +490,11 @@ static ssize_t proc_status(FAR struct proc_file_s *procfile, return totalsize; } -#ifdef CONFIG_SCHED_HAVE_PARENT group = tcb->group; DEBUGASSERT(group != NULL); -#ifdef HAVE_GROUPID - linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n", - "Group:", group->tg_pgrpid); -#else linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n", "PPID:", group->tg_ppid); -#endif - copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset); @@ -527,7 +506,6 @@ static ssize_t proc_status(FAR struct proc_file_s *procfile, { return totalsize; } -#endif #ifdef CONFIG_SMP if (tcb->task_state >= FIRST_ASSIGNED_STATE && @@ -946,11 +924,8 @@ static ssize_t proc_groupstatus(FAR struct proc_file_s *procfile, remaining = buflen; totalsize = 0; - /* Show the group IDs */ - -#ifdef HAVE_GROUP_MEMBERS linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n", - "Group ID:", group->tg_grpid); + "Main task:", group->tg_pid); copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset); @@ -963,37 +938,6 @@ static ssize_t proc_groupstatus(FAR struct proc_file_s *procfile, return totalsize; } - linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n", - "Parent ID:", group->tg_pgrpid); - copysize = procfs_memcpy(procfile->line, linesize, buffer, - remaining, &offset); - - totalsize += copysize; - buffer += copysize; - remaining -= copysize; - - if (totalsize >= buflen) - { - return totalsize; - } -#endif - -#if !defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SCHED_HAVE_PARENT) - linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n", - "Main task:", group->tg_task); - copysize = procfs_memcpy(procfile->line, linesize, buffer, - remaining, &offset); - - totalsize += copysize; - buffer += copysize; - remaining -= copysize; - - if (totalsize >= buflen) - { - return totalsize; - } -#endif - linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s0x%02x\n", "Flags:", group->tg_flags); copysize = procfs_memcpy(procfile->line, linesize, buffer, diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index c4376d491fd..e6cb9bd5225 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -362,12 +362,6 @@ struct pthread_cleanup_s # endif #endif -/* type grpid_t *****************************************************************/ - -/* The task group ID */ - -typedef int16_t grpid_t; - /* struct dspace_s **************************************************************/ /* This structure describes a reference counted D-Space region. This must be a @@ -466,14 +460,9 @@ struct task_group_s { #if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV) struct task_group_s *flink; /* Supports a singly linked list */ - grpid_t tg_grpid; /* The ID of this task group */ -#endif -#ifdef HAVE_GROUP_MEMBERS - grpid_t tg_pgrpid; /* The ID of the parent task group */ -#endif -#if !defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SCHED_HAVE_PARENT) - pid_t tg_task; /* The ID of the task within the group */ #endif + pid_t tg_pid; /* The ID of the task within the group */ + pid_t tg_ppid; /* This is the ID of the parent thread */ uint8_t tg_flags; /* See GROUP_FLAG_* definitions */ /* User identity **************************************************************/ @@ -508,16 +497,9 @@ struct task_group_s #ifdef CONFIG_SCHED_CHILD_STATUS FAR struct child_status_s *tg_children; /* Head of a list of child status */ +#else + uint16_t tg_nchildren; /* This is the number active children */ #endif - -#ifndef HAVE_GROUP_MEMBERS - /* REVISIT: What if parent thread exits? Should use tg_pgrpid. */ - - pid_t tg_ppid; /* This is the ID of the parent thread */ -#ifndef CONFIG_SCHED_CHILD_STATUS - uint16_t tg_nchildren; /* This is the number active children */ -#endif -#endif /* HAVE_GROUP_MEMBERS */ #endif /* CONFIG_SCHED_HAVE_PARENT */ #if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT) diff --git a/sched/group/group.h b/sched/group/group.h index 23d2e081866..3449891803f 100644 --- a/sched/group/group.h +++ b/sched/group/group.h @@ -35,15 +35,6 @@ #include #include -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Any negative GRPID is invalid. */ - -#define INVALID_GROUP_ID (pid_t)-1 -#define IS_INVALID_GRPID(grpid) ((int)(grpid) < 0) - /**************************************************************************** * Public Type Definitions ****************************************************************************/ @@ -61,14 +52,14 @@ extern FAR struct task_group_s *g_grouphead; #endif #ifdef CONFIG_ARCH_ADDRENV -/* This variable holds the group ID of the current task group. This ID is +/* This variable holds the PID of the current task group. This ID is * zero if the current task is a kernel thread that has no address * environment (other than the kernel context). * * This must only be accessed with interrupts disabled. */ -extern grpid_t g_grpid_current; +extern pid_t g_pid_current; #endif /**************************************************************************** @@ -94,11 +85,10 @@ void group_del_waiter(FAR struct task_group_s *group); #endif #if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV) -FAR struct task_group_s *group_findby_grpid(grpid_t grpid); +FAR struct task_group_s *group_findbypid(pid_t pid); #endif #ifdef HAVE_GROUP_MEMBERS -FAR struct task_group_s *group_findbypid(pid_t pid); int group_foreachchild(FAR struct task_group_s *group, foreachchild_t handler, FAR void *arg); int group_kill_children(FAR struct tcb_s *tcb); diff --git a/sched/group/group_addrenv.c b/sched/group/group_addrenv.c index 14cace70daf..af211330485 100644 --- a/sched/group/group_addrenv.c +++ b/sched/group/group_addrenv.c @@ -38,14 +38,14 @@ * Public Data ****************************************************************************/ -/* This variable holds the group ID of the current task group. This ID is +/* This variable holds the PID of the current task group. This ID is * zero if the current task is a kernel thread that has no address * environment (other than the kernel context). * * This must only be accessed with interrupts disabled. */ -grpid_t g_grpid_current; +pid_t g_pid_current = INVALID_PROCESS_ID; /**************************************************************************** * Public Functions @@ -84,7 +84,7 @@ int group_addrenv(FAR struct tcb_s *tcb) FAR struct task_group_s *group; FAR struct task_group_s *oldgroup; irqstate_t flags; - grpid_t grpid; + pid_t pid; int ret; /* NULL for the tcb means to use the TCB of the task at the head of the @@ -110,23 +110,23 @@ int group_addrenv(FAR struct tcb_s *tcb) return OK; } - /* Get the ID of the group that needs the address environment */ + /* Get the PID of the group that needs the address environment */ - grpid = group->tg_grpid; - DEBUGASSERT(grpid != 0); + pid = group->tg_pid; + DEBUGASSERT(pid != INVALID_PROCESS_ID); /* Are we going to change address environments? */ flags = enter_critical_section(); - if (grpid != g_grpid_current) + if (pid != g_pid_current) { /* Yes.. Is there a current address environment in place? */ - if (g_grpid_current != 0) + if (g_pid_current != INVALID_PROCESS_ID) { /* Find the old group with this ID. */ - oldgroup = group_findby_grpid(g_grpid_current); + oldgroup = group_findbypid(g_pid_current); DEBUGASSERT(oldgroup && (oldgroup->tg_flags & GROUP_FLAG_ADDRENV) != 0); @@ -154,7 +154,7 @@ int group_addrenv(FAR struct tcb_s *tcb) /* Save the new, current group */ - g_grpid_current = grpid; + g_pid_current = pid; } leave_critical_section(flags); diff --git a/sched/group/group_create.c b/sched/group/group_create.c index a80c4bcc4e3..51256b1c97b 100644 --- a/sched/group/group_create.c +++ b/sched/group/group_create.c @@ -46,16 +46,6 @@ #define GROUP_INITIAL_MEMBERS 4 -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/* This is counter that is used to generate unique task group IDs */ - -#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV) -static grpid_t g_grpid_counter; -#endif - /**************************************************************************** * Public Data ****************************************************************************/ @@ -70,68 +60,6 @@ FAR struct task_group_s *g_grouphead; * Private Functions ****************************************************************************/ -/**************************************************************************** - * Name: group_assign_grpid - * - * Description: - * Create a unique group ID. - * - * Input Parameters: - * tcb - The tcb in need of the task group. - * - * Returned Value: - * None - * - * Assumptions: - * Called during task creation in a safe context. No special precautions - * are required here. - * - ****************************************************************************/ - -#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV) -static void group_assign_grpid(FAR struct task_group_s *group) -{ - irqstate_t flags; - grpid_t grpid; - - /* Pre-emption should already be disabled, but let's be paranoid careful */ - - sched_lock(); - - /* Loop until we create a unique ID */ - - for (; ; ) - { - /* Increment the ID counter. It is global data so be extra paranoid. */ - - flags = enter_critical_section(); - grpid = ++g_grpid_counter; - - /* Check for overflow */ - - if (grpid <= 0) - { - g_grpid_counter = 1; /* One is the IDLE group */ - leave_critical_section(flags); - } - else - { - /* Does a task group with this ID already exist? */ - - leave_critical_section(flags); - if (group_findby_grpid(grpid) == NULL) - { - /* No.. Assign this ID to the new group and return */ - - group->tg_grpid = grpid; - sched_unlock(); - return; - } - } - } -} -#endif /* HAVE_GROUP_MEMBERS */ - /**************************************************************************** * Name: group_inherit_identity * @@ -243,14 +171,6 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype) tcb->cmn.group = group; -#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV) - /* Assign the group a unique ID. If g_grpid_counter were to wrap before we - * finish with task creation, that would be a problem. - */ - - group_assign_grpid(group); -#endif - /* Inherit the user identity from the parent task group */ group_inherit_identity(group); @@ -349,7 +269,6 @@ int group_initialize(FAR struct task_tcb_s *tcb) group->flink = g_grouphead; g_grouphead = group; leave_critical_section(flags); - #endif /* Save the ID of the main task within the group of threads. This needed @@ -358,9 +277,7 @@ int group_initialize(FAR struct task_tcb_s *tcb) * task has exited. */ -#if !defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SCHED_HAVE_PARENT) - group->tg_task = tcb->cmn.pid; -#endif + group->tg_pid = tcb->cmn.pid; /* Mark that there is one member in the group, the main task */ diff --git a/sched/group/group_find.c b/sched/group/group_find.c index b41e29d1395..a7948c2535c 100644 --- a/sched/group/group_find.c +++ b/sched/group/group_find.c @@ -40,60 +40,12 @@ * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: group_findby_grpid - * - * Description: - * Given a group ID, find the group task structure with that ID. IDs are - * used instead of pointers to group structures. This is done because a - * group can disappear at any time leaving a stale pointer; an ID is - * cleaner because if the group disappears, this function will fail - * gracefully. - * - * Input Parameters: - * grpid - The group ID to find. - * - * Returned Value: - * On success, a pointer to the group task structure is returned. This - * function can fail only if there is no group that corresponds to the - * group ID. - * - * Assumptions: - * Called during when signally tasks in a safe context. No special - * precautions should be required here. However, extra care is taken when - * accessing the global g_grouphead list. - * - ****************************************************************************/ - -#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV) -FAR struct task_group_s *group_findby_grpid(grpid_t grpid) -{ - FAR struct task_group_s *group; - irqstate_t flags; - - /* Find the status structure with the matching GID */ - - flags = enter_critical_section(); - for (group = g_grouphead; group; group = group->flink) - { - if (group->tg_grpid == grpid) - { - leave_critical_section(flags); - return group; - } - } - - leave_critical_section(flags); - return NULL; -} -#endif - /**************************************************************************** * Name: group_findbypid * * Description: * Given a task ID, find the group task structure with was started by that - * task ID. That task's ID is retained in the group as tg_task and will + * task ID. That task's ID is retained in the group as tg_pid and will * be remember even if the main task thread leaves the group. * * Input Parameters: @@ -111,7 +63,7 @@ FAR struct task_group_s *group_findby_grpid(grpid_t grpid) * ****************************************************************************/ -#ifdef HAVE_GROUP_MEMBERS +#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV) FAR struct task_group_s *group_findbypid(pid_t pid) { FAR struct task_group_s *group; @@ -122,7 +74,7 @@ FAR struct task_group_s *group_findbypid(pid_t pid) flags = enter_critical_section(); for (group = g_grouphead; group; group = group->flink) { - if (group->tg_task == pid) + if (group->tg_pid == pid) { leave_critical_section(flags); return group; diff --git a/sched/group/group_leave.c b/sched/group/group_leave.c index a3396e001c0..6b9487b3e75 100644 --- a/sched/group/group_leave.c +++ b/sched/group/group_leave.c @@ -176,7 +176,7 @@ static inline void group_release(FAR struct task_group_s *group) /* Mark no address environment */ - g_grpid_current = 0; + g_pid_current = INVALID_PROCESS_ID; #endif #if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV) diff --git a/sched/sched/sched_waitid.c b/sched/sched/sched_waitid.c index 1ef4fe3b011..a627d8c2e42 100644 --- a/sched/sched/sched_waitid.c +++ b/sched/sched/sched_waitid.c @@ -168,11 +168,7 @@ int nx_waitid(int idtype, id_t id, FAR siginfo_t *info, int options) ctcb = nxsched_get_tcb((pid_t)id); if (ctcb != NULL) { -#ifdef HAVE_GROUP_MEMBERS - if (ctcb->group->tg_pgrpid != rtcb->group->tg_grpid) -#else - if (ctcb->group->tg_ppid != rtcb->pid) -#endif + if (ctcb->group->tg_ppid != rtcb->group->tg_pid) { ret = -ECHILD; goto errout; @@ -212,11 +208,7 @@ int nx_waitid(int idtype, id_t id, FAR siginfo_t *info, int options) ctcb = nxsched_get_tcb((pid_t)id); -#ifdef HAVE_GROUP_MEMBERS - if (ctcb == NULL || ctcb->group->tg_pgrpid != rtcb->group->tg_grpid) -#else - if (ctcb == NULL || ctcb->group->tg_ppid != rtcb->pid) -#endif + if (ctcb == NULL || ctcb->group->tg_ppid != rtcb->group->tg_pid) { ret = -ECHILD; goto errout; diff --git a/sched/sched/sched_waitpid.c b/sched/sched/sched_waitpid.c index 225bbb5f88e..20d40a9045e 100644 --- a/sched/sched/sched_waitpid.c +++ b/sched/sched/sched_waitpid.c @@ -233,11 +233,7 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options) { /* Make sure that the thread it is our child. */ -#ifdef HAVE_GROUP_MEMBERS - if (ctcb->group->tg_pgrpid != rtcb->group->tg_grpid) -#else - if (ctcb->group->tg_ppid != rtcb->pid) -#endif + if (ctcb->group->tg_ppid != rtcb->group->tg_pid) { ret = -ECHILD; goto errout; @@ -277,11 +273,7 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options) ctcb = nxsched_get_tcb(pid); -#ifdef HAVE_GROUP_MEMBERS - if (ctcb == NULL || ctcb->group->tg_pgrpid != rtcb->group->tg_grpid) -#else - if (ctcb == NULL || ctcb->group->tg_ppid != rtcb->pid) -#endif + if (ctcb == NULL || ctcb->group->tg_ppid != rtcb->group->tg_pid) { ret = -ECHILD; goto errout; diff --git a/sched/task/task_exithook.c b/sched/task/task_exithook.c index 0e34a99ab7c..f216e3f5be8 100644 --- a/sched/task/task_exithook.c +++ b/sched/task/task_exithook.c @@ -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; diff --git a/sched/task/task_getppid.c b/sched/task/task_getppid.c index ba1fc298ded..0f7978494c2 100644 --- a/sched/task/task_getppid.c +++ b/sched/task/task_getppid.c @@ -84,11 +84,7 @@ pid_t getppid(void) * ready-to-run task list */ -#ifdef HAVE_GROUP_MEMBERS - return rtcb->group->tg_pgrpid; -#else return rtcb->group->tg_ppid; -#endif } /* No.. return -ESRCH to indicate this condition */ diff --git a/sched/task/task_reparent.c b/sched/task/task_reparent.c index 9b0d55d1edf..e1254b324aa 100644 --- a/sched/task/task_reparent.c +++ b/sched/task/task_reparent.c @@ -65,9 +65,8 @@ int task_reparent(pid_t ppid, pid_t chpid) FAR struct task_group_s *ogrp; FAR struct task_group_s *pgrp; FAR struct tcb_s *tcb; - grpid_t ogrpid; - grpid_t pgrpid; irqstate_t flags; + pid_t opid; int ret; /* Disable interrupts so that nothing can change in the relationship of @@ -88,13 +87,13 @@ int task_reparent(pid_t ppid, pid_t chpid) DEBUGASSERT(tcb->group); chgrp = tcb->group; - /* Get the GID of the old parent task's task group (ogrpid) */ + /* Get the PID of the old parent task's task group (opid) */ - ogrpid = chgrp->tg_pgrpid; + opid = chgrp->tg_ppid; /* Get the old parent task's task group (ogrp) */ - ogrp = group_findby_grpid(ogrpid); + ogrp = group_findbypid(opid); if (!ogrp) { ret = -ESRCH; @@ -110,8 +109,8 @@ int task_reparent(pid_t ppid, pid_t chpid) { /* Get the grandparent task's task group (pgrp) */ - pgrpid = ogrp->tg_pgrpid; - pgrp = group_findby_grpid(pgrpid); + ppid = ogrp->tg_ppid; + pgrp = group_findbypid(ppid); } else { @@ -125,7 +124,7 @@ int task_reparent(pid_t ppid, pid_t chpid) } pgrp = tcb->group; - pgrpid = pgrp->tg_grpid; + ppid = pgrp->tg_pid; } if (!pgrp) @@ -139,7 +138,7 @@ int task_reparent(pid_t ppid, pid_t chpid) * all members of the child's task group. */ - chgrp->tg_pgrpid = pgrpid; + chgrp->tg_ppid = ppid; #ifdef CONFIG_SCHED_CHILD_STATUS /* Remove the child status entry from old parent task group */ diff --git a/sched/task/task_setup.c b/sched/task/task_setup.c index 82e93a02898..3930ed78668 100644 --- a/sched/task/task_setup.c +++ b/sched/task/task_setup.c @@ -211,19 +211,12 @@ static inline void nxtask_save_parent(FAR struct tcb_s *tcb, uint8_t ttype) DEBUGASSERT(rtcb != NULL && rtcb->group != NULL); -#ifdef HAVE_GROUP_MEMBERS - /* Save the ID of the parent tasks' task group in the child's task + /* Save the PID of the parent tasks' task group in the child's task * group. Copy the ID from the parent's task group structure to * child's task group. */ - tcb->group->tg_pgrpid = rtcb->group->tg_grpid; - -#else - /* Save the parent task's ID in the child task's group. */ - - tcb->group->tg_ppid = rtcb->pid; -#endif + tcb->group->tg_ppid = rtcb->group->tg_pid; #ifdef CONFIG_SCHED_CHILD_STATUS /* Tasks can also suppress retention of their child status by applying