sched/: Correct some naming. The NuttX task groups have been using the acroynum 'gid' and also the type 'gid_t' for the the task group ID. That is incorrect. Than naming is reserved for use with group permissions. So these were all named to grpid and grpid_t so that it is clearer that these refer to NuttX task group IDs, and not to group permissions.
This commit is contained in:
parent
4c800ca372
commit
8e321aba84
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* fs/procfs/fs_procfsproc.c
|
* fs/procfs/fs_procfsproc.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013-2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -513,7 +513,7 @@ static ssize_t proc_status(FAR struct proc_file_s *procfile,
|
|||||||
|
|
||||||
#ifdef HAVE_GROUPID
|
#ifdef HAVE_GROUPID
|
||||||
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n", "Group:",
|
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n", "Group:",
|
||||||
group->tg_pgid);
|
group->tg_pgrpid);
|
||||||
#else
|
#else
|
||||||
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n", "PPID:",
|
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n", "PPID:",
|
||||||
group->tg_ppid);
|
group->tg_ppid);
|
||||||
@ -930,7 +930,7 @@ static ssize_t proc_groupstatus(FAR struct proc_file_s *procfile,
|
|||||||
|
|
||||||
#ifdef HAVE_GROUP_MEMBERS
|
#ifdef HAVE_GROUP_MEMBERS
|
||||||
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n",
|
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n",
|
||||||
"Group ID:", group->tg_gid);
|
"Group ID:", group->tg_grpid);
|
||||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);
|
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);
|
||||||
|
|
||||||
totalsize += copysize;
|
totalsize += copysize;
|
||||||
@ -943,7 +943,7 @@ static ssize_t proc_groupstatus(FAR struct proc_file_s *procfile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n",
|
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n",
|
||||||
"Parent ID:", group->tg_pgid);
|
"Parent ID:", group->tg_pgrpid);
|
||||||
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);
|
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);
|
||||||
|
|
||||||
totalsize += copysize;
|
totalsize += copysize;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* include/nuttx/sched.h
|
* include/nuttx/sched.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2016, 2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2016, 2018-2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -361,6 +361,12 @@ struct pthread_cleanup_s
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* type grpid_t ******************************************************************/
|
||||||
|
|
||||||
|
/* The task group ID */
|
||||||
|
|
||||||
|
typedef int16_t grpid_t;
|
||||||
|
|
||||||
/* struct dspace_s ***************************************************************/
|
/* struct dspace_s ***************************************************************/
|
||||||
|
|
||||||
/* This structure describes a reference counted D-Space region. This must be a
|
/* This structure describes a reference counted D-Space region. This must be a
|
||||||
@ -425,10 +431,10 @@ struct task_group_s
|
|||||||
{
|
{
|
||||||
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
||||||
struct task_group_s *flink; /* Supports a singly linked list */
|
struct task_group_s *flink; /* Supports a singly linked list */
|
||||||
gid_t tg_gid; /* The ID of this task group */
|
grpid_t tg_grpid; /* The ID of this task group */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_GROUP_MEMBERS
|
#ifdef HAVE_GROUP_MEMBERS
|
||||||
gid_t tg_pgid; /* The ID of the parent task group */
|
grpid_t tg_pgrpid; /* The ID of the parent task group */
|
||||||
#endif
|
#endif
|
||||||
#if !defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SCHED_HAVE_PARENT)
|
#if !defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SCHED_HAVE_PARENT)
|
||||||
pid_t tg_task; /* The ID of the task within the group */
|
pid_t tg_task; /* The ID of the task within the group */
|
||||||
@ -479,7 +485,7 @@ struct task_group_s
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_GROUP_MEMBERS
|
#ifndef HAVE_GROUP_MEMBERS
|
||||||
/* REVISIT: What if parent thread exits? Should use tg_pgid. */
|
/* REVISIT: What if parent thread exits? Should use tg_pgrpid. */
|
||||||
|
|
||||||
pid_t tg_ppid; /* This is the ID of the parent thread */
|
pid_t tg_ppid; /* This is the ID of the parent thread */
|
||||||
#ifndef CONFIG_SCHED_CHILD_STATUS
|
#ifndef CONFIG_SCHED_CHILD_STATUS
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/group/group.h
|
* sched/group/group.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2013, 2015, 2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2013, 2015, 2018-2019 Gregory Nutt. All rights
|
||||||
|
* reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -48,14 +49,16 @@
|
|||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* Any negative GID is invalid. */
|
|
||||||
|
/* Any negative GRPID is invalid. */
|
||||||
|
|
||||||
#define INVALID_GROUP_ID (pid_t)-1
|
#define INVALID_GROUP_ID (pid_t)-1
|
||||||
#define IS_INVALID_GID(gid) ((int)(gid) < 0)
|
#define IS_INVALID_GRPID(grpid) ((int)(grpid) < 0)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Type Definitions
|
* Public Type Definitions
|
||||||
@ -81,7 +84,7 @@ extern FAR struct task_group_s *g_grouphead;
|
|||||||
* This must only be accessed with interrupts disabled.
|
* This must only be accessed with interrupts disabled.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern gid_t g_gid_current;
|
extern grpid_t g_grpid_current;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -107,7 +110,7 @@ void group_delwaiter(FAR struct task_group_s *group);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
||||||
FAR struct task_group_s *group_findbygid(gid_t gid);
|
FAR struct task_group_s *group_findby_grpid(grpid_t grpid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GROUP_MEMBERS
|
#ifdef HAVE_GROUP_MEMBERS
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/group/group_addrenv.c
|
* sched/group/group_addrenv.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014, 2016, 2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -59,7 +59,7 @@
|
|||||||
* This must only be accessed with interrupts disabled.
|
* This must only be accessed with interrupts disabled.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gid_t g_gid_current;
|
grpid_t g_grpid_current;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@ -98,7 +98,7 @@ int group_addrenv(FAR struct tcb_s *tcb)
|
|||||||
FAR struct task_group_s *group;
|
FAR struct task_group_s *group;
|
||||||
FAR struct task_group_s *oldgroup;
|
FAR struct task_group_s *oldgroup;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
gid_t gid;
|
grpid_t grpid;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* NULL for the tcb means to use the TCB of the task at the head of the
|
/* NULL for the tcb means to use the TCB of the task at the head of the
|
||||||
@ -126,21 +126,21 @@ int group_addrenv(FAR struct tcb_s *tcb)
|
|||||||
|
|
||||||
/* Get the ID of the group that needs the address environment */
|
/* Get the ID of the group that needs the address environment */
|
||||||
|
|
||||||
gid = group->tg_gid;
|
grpid = group->tg_grpid;
|
||||||
DEBUGASSERT(gid != 0);
|
DEBUGASSERT(grpid != 0);
|
||||||
|
|
||||||
/* Are we going to change address environments? */
|
/* Are we going to change address environments? */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
if (gid != g_gid_current)
|
if (grpid != g_grpid_current)
|
||||||
{
|
{
|
||||||
/* Yes.. Is there a current address environment in place? */
|
/* Yes.. Is there a current address environment in place? */
|
||||||
|
|
||||||
if (g_gid_current != 0)
|
if (g_grpid_current != 0)
|
||||||
{
|
{
|
||||||
/* Find the old group with this ID. */
|
/* Find the old group with this ID. */
|
||||||
|
|
||||||
oldgroup = group_findbygid(g_gid_current);
|
oldgroup = group_findby_grpid(g_grpid_current);
|
||||||
DEBUGASSERT(oldgroup &&
|
DEBUGASSERT(oldgroup &&
|
||||||
(oldgroup->tg_flags & GROUP_FLAG_ADDRENV) != 0);
|
(oldgroup->tg_flags & GROUP_FLAG_ADDRENV) != 0);
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ int group_addrenv(FAR struct tcb_s *tcb)
|
|||||||
|
|
||||||
/* Save the new, current group */
|
/* Save the new, current group */
|
||||||
|
|
||||||
g_gid_current = gid;
|
g_grpid_current = grpid;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/group/group_create.c
|
* sched/group/group_create.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013, 2016, 2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -47,6 +47,7 @@
|
|||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
#include <nuttx/semaphore.h>
|
#include <nuttx/semaphore.h>
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
|
||||||
#include "environ/environ.h"
|
#include "environ/environ.h"
|
||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
@ -64,7 +65,7 @@
|
|||||||
/* This is counter that is used to generate unique task group IDs */
|
/* This is counter that is used to generate unique task group IDs */
|
||||||
|
|
||||||
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
||||||
static gid_t g_gidcounter;
|
static grpid_t g_grpid_counter;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -82,7 +83,7 @@ FAR struct task_group_s *g_grouphead;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: group_assigngid
|
* Name: group_assign_grpid
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Create a unique group ID.
|
* Create a unique group ID.
|
||||||
@ -100,10 +101,10 @@ FAR struct task_group_s *g_grouphead;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
||||||
static void group_assigngid(FAR struct task_group_s *group)
|
static void group_assign_grpid(FAR struct task_group_s *group)
|
||||||
{
|
{
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
gid_t gid;
|
grpid_t grpid;
|
||||||
|
|
||||||
/* Pre-emption should already be enabled, but lets be paranoid careful */
|
/* Pre-emption should already be enabled, but lets be paranoid careful */
|
||||||
|
|
||||||
@ -116,13 +117,13 @@ static void group_assigngid(FAR struct task_group_s *group)
|
|||||||
/* Increment the ID counter. This is global data so be extra paranoid. */
|
/* Increment the ID counter. This is global data so be extra paranoid. */
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
gid = ++g_gidcounter;
|
grpid = ++g_grpid_counter;
|
||||||
|
|
||||||
/* Check for overflow */
|
/* Check for overflow */
|
||||||
|
|
||||||
if (gid <= 0)
|
if (grpid <= 0)
|
||||||
{
|
{
|
||||||
g_gidcounter = 1;
|
g_grpid_counter = 1;
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -130,11 +131,11 @@ static void group_assigngid(FAR struct task_group_s *group)
|
|||||||
/* Does a task group with this ID already exist? */
|
/* Does a task group with this ID already exist? */
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
if (group_findbygid(gid) == NULL)
|
if (group_findby_grpid(grpid) == NULL)
|
||||||
{
|
{
|
||||||
/* Now assign this ID to the group and return */
|
/* Now assign this ID to the group and return */
|
||||||
|
|
||||||
group->tg_gid = gid;
|
group->tg_grpid = grpid;
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -222,11 +223,11 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype)
|
|||||||
tcb->cmn.group = group;
|
tcb->cmn.group = group;
|
||||||
|
|
||||||
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
||||||
/* Assign the group a unique ID. If g_gidcounter were to wrap before we
|
/* Assign the group a unique ID. If g_grpid_counter were to wrap before we
|
||||||
* finish with task creation, that would be a problem.
|
* finish with task creation, that would be a problem.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
group_assigngid(group);
|
group_assign_grpid(group);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Duplicate the parent tasks environment */
|
/* Duplicate the parent tasks environment */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/group/group_find.c
|
* sched/group/group_find.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013, 2016, 2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
|
||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
#include "environ/environ.h"
|
#include "environ/environ.h"
|
||||||
@ -55,7 +56,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: group_findbygid
|
* Name: group_findby_grpid
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Given a group ID, find the group task structure with that ID. IDs are
|
* Given a group ID, find the group task structure with that ID. IDs are
|
||||||
@ -64,7 +65,7 @@
|
|||||||
* because if the group disappears, this function will fail gracefully.
|
* because if the group disappears, this function will fail gracefully.
|
||||||
*
|
*
|
||||||
* Input Parameters:
|
* Input Parameters:
|
||||||
* gid - The group ID to find.
|
* grpid - The group ID to find.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* On success, a pointer to the group task structure is returned. This
|
* On success, a pointer to the group task structure is returned. This
|
||||||
@ -79,7 +80,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
||||||
FAR struct task_group_s *group_findbygid(gid_t gid)
|
FAR struct task_group_s *group_findby_grpid(grpid_t grpid)
|
||||||
{
|
{
|
||||||
FAR struct task_group_s *group;
|
FAR struct task_group_s *group;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
@ -89,7 +90,7 @@ FAR struct task_group_s *group_findbygid(gid_t gid)
|
|||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
for (group = g_grouphead; group; group = group->flink)
|
for (group = g_grouphead; group; group = group->flink)
|
||||||
{
|
{
|
||||||
if (group->tg_gid == gid)
|
if (group->tg_grpid == grpid)
|
||||||
{
|
{
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
return group;
|
return group;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/group/group_leave.c
|
* sched/group/group_leave.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2018 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013-2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -203,7 +203,7 @@ static inline void group_release(FAR struct task_group_s *group)
|
|||||||
|
|
||||||
/* Mark no address environment */
|
/* Mark no address environment */
|
||||||
|
|
||||||
g_gid_current = 0;
|
g_grpid_current = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
#if defined(HAVE_GROUP_MEMBERS) || defined(CONFIG_ARCH_ADDRENV)
|
||||||
|
@ -231,7 +231,7 @@ int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
|
|||||||
ctcb = sched_gettcb((pid_t)id);
|
ctcb = sched_gettcb((pid_t)id);
|
||||||
|
|
||||||
#ifdef HAVE_GROUP_MEMBERS
|
#ifdef HAVE_GROUP_MEMBERS
|
||||||
if (ctcb == NULL || ctcb->group->tg_pgid != rtcb->group->tg_gid)
|
if (ctcb == NULL || ctcb->group->tg_pgrpid != rtcb->group->tg_grpid)
|
||||||
#else
|
#else
|
||||||
if (ctcb == NULL || ctcb->group->tg_ppid != rtcb->pid)
|
if (ctcb == NULL || ctcb->group->tg_ppid != rtcb->pid)
|
||||||
#endif
|
#endif
|
||||||
@ -274,7 +274,7 @@ int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
|
|||||||
ctcb = sched_gettcb((pid_t)id);
|
ctcb = sched_gettcb((pid_t)id);
|
||||||
|
|
||||||
#ifdef HAVE_GROUP_MEMBERS
|
#ifdef HAVE_GROUP_MEMBERS
|
||||||
if (ctcb == NULL || ctcb->group->tg_pgid != rtcb->group->tg_gid)
|
if (ctcb == NULL || ctcb->group->tg_pgrpid != rtcb->group->tg_grpid)
|
||||||
#else
|
#else
|
||||||
if (ctcb == NULL || ctcb->group->tg_ppid != rtcb->pid)
|
if (ctcb == NULL || ctcb->group->tg_ppid != rtcb->pid)
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:make
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
@ -359,7 +359,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
|||||||
/* Make sure that the thread it is our child. */
|
/* Make sure that the thread it is our child. */
|
||||||
|
|
||||||
#ifdef HAVE_GROUP_MEMBERS
|
#ifdef HAVE_GROUP_MEMBERS
|
||||||
if (ctcb->group->tg_pgid != rtcb->group->tg_gid)
|
if (ctcb->group->tg_pgrpid != rtcb->group->tg_grpid)
|
||||||
#else
|
#else
|
||||||
if (ctcb->group->tg_ppid != rtcb->pid)
|
if (ctcb->group->tg_ppid != rtcb->pid)
|
||||||
#endif
|
#endif
|
||||||
@ -403,7 +403,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
|||||||
ctcb = sched_gettcb(pid);
|
ctcb = sched_gettcb(pid);
|
||||||
|
|
||||||
#ifdef HAVE_GROUP_MEMBERS
|
#ifdef HAVE_GROUP_MEMBERS
|
||||||
if (ctcb == NULL || ctcb->group->tg_pgid != rtcb->group->tg_gid)
|
if (ctcb == NULL || ctcb->group->tg_pgrpid != rtcb->group->tg_grpid)
|
||||||
#else
|
#else
|
||||||
if (ctcb == NULL || ctcb->group->tg_ppid != rtcb->pid)
|
if (ctcb == NULL || ctcb->group->tg_ppid != rtcb->pid)
|
||||||
#endif
|
#endif
|
||||||
|
@ -298,7 +298,7 @@ static inline void nxtask_groupexit(FAR struct task_group_s *group)
|
|||||||
|
|
||||||
#ifdef CONFIG_SCHED_HAVE_PARENT
|
#ifdef CONFIG_SCHED_HAVE_PARENT
|
||||||
#ifdef HAVE_GROUP_MEMBERS
|
#ifdef HAVE_GROUP_MEMBERS
|
||||||
static inline void nxtask_sigchild(gid_t pgid, FAR struct tcb_s *ctcb,
|
static inline void nxtask_sigchild(grpid_t pgrpid, FAR struct tcb_s *ctcb,
|
||||||
int status)
|
int status)
|
||||||
{
|
{
|
||||||
FAR struct task_group_s *chgrp = ctcb->group;
|
FAR struct task_group_s *chgrp = ctcb->group;
|
||||||
@ -312,14 +312,14 @@ static inline void nxtask_sigchild(gid_t pgid, FAR struct tcb_s *ctcb,
|
|||||||
* this case, the child task group has been orphaned.
|
* this case, the child task group has been orphaned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pgrp = group_findbygid(pgid);
|
pgrp = group_findby_grpid(pgrpid);
|
||||||
if (!pgrp)
|
if (!pgrp)
|
||||||
{
|
{
|
||||||
/* Set the task group ID to an invalid group ID. The dead parent
|
/* Set the task group ID to an invalid group ID. The dead parent
|
||||||
* task group ID could get reused some time in the future.
|
* task group ID could get reused some time in the future.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
chgrp->tg_pgid = INVALID_GROUP_ID;
|
chgrp->tg_pgrpid = INVALID_GROUP_ID;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ static inline void nxtask_signalparent(FAR struct tcb_s *ctcb, int status)
|
|||||||
|
|
||||||
/* Send SIGCHLD to all members of the parent's task group */
|
/* Send SIGCHLD to all members of the parent's task group */
|
||||||
|
|
||||||
nxtask_sigchild(ctcb->group->tg_pgid, ctcb, status);
|
nxtask_sigchild(ctcb->group->tg_pgrpid, ctcb, status);
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
#else
|
#else
|
||||||
FAR struct tcb_s *ptcb;
|
FAR struct tcb_s *ptcb;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* sched/task/task_reparent.c
|
* sched/task/task_reparent.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013, 2016, 2019 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -42,6 +42,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
|
#include <nuttx/sched.h>
|
||||||
|
|
||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
#include "group/group.h"
|
#include "group/group.h"
|
||||||
@ -79,8 +80,8 @@ int task_reparent(pid_t ppid, pid_t chpid)
|
|||||||
FAR struct task_group_s *ogrp;
|
FAR struct task_group_s *ogrp;
|
||||||
FAR struct task_group_s *pgrp;
|
FAR struct task_group_s *pgrp;
|
||||||
FAR struct tcb_s *tcb;
|
FAR struct tcb_s *tcb;
|
||||||
gid_t ogid;
|
grpid_t ogrpid;
|
||||||
gid_t pgid;
|
grpid_t pgrpid;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -102,13 +103,13 @@ int task_reparent(pid_t ppid, pid_t chpid)
|
|||||||
DEBUGASSERT(tcb->group);
|
DEBUGASSERT(tcb->group);
|
||||||
chgrp = tcb->group;
|
chgrp = tcb->group;
|
||||||
|
|
||||||
/* Get the GID of the old parent task's task group (ogid) */
|
/* Get the GID of the old parent task's task group (ogrpid) */
|
||||||
|
|
||||||
ogid = chgrp->tg_pgid;
|
ogrpid = chgrp->tg_pgrpid;
|
||||||
|
|
||||||
/* Get the old parent task's task group (ogrp) */
|
/* Get the old parent task's task group (ogrp) */
|
||||||
|
|
||||||
ogrp = group_findbygid(ogid);
|
ogrp = group_findby_grpid(ogrpid);
|
||||||
if (!ogrp)
|
if (!ogrp)
|
||||||
{
|
{
|
||||||
ret = -ESRCH;
|
ret = -ESRCH;
|
||||||
@ -124,8 +125,8 @@ int task_reparent(pid_t ppid, pid_t chpid)
|
|||||||
{
|
{
|
||||||
/* Get the grandparent task's task group (pgrp) */
|
/* Get the grandparent task's task group (pgrp) */
|
||||||
|
|
||||||
pgid = ogrp->tg_pgid;
|
pgrpid = ogrp->tg_pgrpid;
|
||||||
pgrp = group_findbygid(pgid);
|
pgrp = group_findby_grpid(pgrpid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -139,7 +140,7 @@ int task_reparent(pid_t ppid, pid_t chpid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pgrp = tcb->group;
|
pgrp = tcb->group;
|
||||||
pgid = pgrp->tg_gid;
|
pgrpid = pgrp->tg_grpid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pgrp)
|
if (!pgrp)
|
||||||
@ -153,7 +154,7 @@ int task_reparent(pid_t ppid, pid_t chpid)
|
|||||||
* all members of the child's task group.
|
* all members of the child's task group.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
chgrp->tg_pgid = pgid;
|
chgrp->tg_pgrpid = pgrpid;
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_CHILD_STATUS
|
#ifdef CONFIG_SCHED_CHILD_STATUS
|
||||||
/* Remove the child status entry from old parent task group */
|
/* Remove the child status entry from old parent task group */
|
||||||
|
@ -228,7 +228,7 @@ static inline void nxtask_saveparent(FAR struct tcb_s *tcb, uint8_t ttype)
|
|||||||
* child's task group.
|
* child's task group.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tcb->group->tg_pgid = rtcb->group->tg_gid;
|
tcb->group->tg_pgrpid = rtcb->group->tg_grpid;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* Save the parent task's ID in the child task's group. */
|
/* Save the parent task's ID in the child task's group. */
|
||||||
|
Loading…
Reference in New Issue
Block a user