Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1084, root task ID on RTEMS #1085

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/os/rtems/src/os-impl-tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,20 @@ osal_id_t OS_TaskGetId_Impl(void)

task_self = rtems_task_self();
/* When the task was created the OSAL ID was used as the "classic name",
* which gives us an easy way to map it back again */
* which gives us an easy way to map it back again. However, if this
* API is invoked from a non-OSAL task (i.e. the "root" task) then it is
* possible that rtems_object_get_classic_name() succeeds but the result
* is not actually an OSAL task ID. */
status = rtems_object_get_classic_name(task_self, &self_name);
if (status == RTEMS_SUCCESSFUL)
{
global_task_id = OS_ObjectIdFromInteger(self_name);

if (OS_ObjectIdToType_Impl(global_task_id) != OS_OBJECT_TYPE_OS_TASK)
{
/* not an OSAL task */
global_task_id = OS_OBJECT_ID_UNDEFINED;
}
}
else
{
Expand Down