2015-10-03 21:25:53 +08:00
|
|
|
/****************************************************************************
|
2014-08-09 06:44:08 +08:00
|
|
|
* sched/task/task_getgroup.c
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2021-02-08 23:33:58 +08:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2021-02-08 23:33:58 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2021-02-08 23:33:58 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2015-10-03 21:25:53 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2015-10-03 21:25:53 +08:00
|
|
|
/****************************************************************************
|
2007-02-18 07:21:28 +08:00
|
|
|
* Included Files
|
2015-10-03 21:25:53 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2013-02-04 00:43:58 +08:00
|
|
|
#include <nuttx/config.h>
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2013-02-04 00:43:58 +08:00
|
|
|
#include <sched.h>
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2014-08-09 07:53:55 +08:00
|
|
|
#include "sched/sched.h"
|
2014-08-09 04:06:42 +08:00
|
|
|
#include "group/group.h"
|
2014-08-09 06:44:08 +08:00
|
|
|
#include "task/task.h"
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2015-10-03 21:25:53 +08:00
|
|
|
/****************************************************************************
|
2007-02-18 07:21:28 +08:00
|
|
|
* Public Functions
|
2015-10-03 21:25:53 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2015-10-03 21:25:53 +08:00
|
|
|
/****************************************************************************
|
2013-02-04 00:43:58 +08:00
|
|
|
* Name: task_getgroup
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
|
|
|
* Description:
|
2013-02-04 00:43:58 +08:00
|
|
|
* Given a task ID, return the group structure of this task.
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2018-03-13 23:52:27 +08:00
|
|
|
* Input Parameters:
|
2013-02-04 00:43:58 +08:00
|
|
|
* pid - The task ID to use in the lookup.
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2018-02-02 00:00:02 +08:00
|
|
|
* Returned Value:
|
2013-02-04 00:43:58 +08:00
|
|
|
* 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
|
2020-02-23 16:50:23 +08:00
|
|
|
* grouped ID.
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
|
|
|
* Assumptions:
|
2013-02-04 00:43:58 +08:00
|
|
|
* 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.
|
2007-02-18 07:21:28 +08:00
|
|
|
*
|
2015-10-03 21:25:53 +08:00
|
|
|
****************************************************************************/
|
2007-02-18 07:21:28 +08:00
|
|
|
|
2013-02-04 00:43:58 +08:00
|
|
|
FAR struct task_group_s *task_getgroup(pid_t pid)
|
2007-02-18 07:21:28 +08:00
|
|
|
{
|
2020-05-09 22:04:45 +08:00
|
|
|
FAR struct tcb_s *tcb = nxsched_get_tcb(pid);
|
2013-02-04 00:43:58 +08:00
|
|
|
if (tcb)
|
2007-02-18 07:21:28 +08:00
|
|
|
{
|
2013-02-04 00:43:58 +08:00
|
|
|
return tcb->group;
|
2007-02-18 07:21:28 +08:00
|
|
|
}
|
|
|
|
|
2013-02-04 00:43:58 +08:00
|
|
|
return NULL;
|
2007-02-18 07:21:28 +08:00
|
|
|
}
|