Skip to contentSkip to conversation

Best way to identify a Xenomai task

Xenomai-help Jean-Olivier Villemure 2 participants 4 messages May 27, 2006 – May 28, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

I'm looking for the best to identify a Xenomai Task.

We are running multiple task inside kernel space and I need to identify each of these task. Is there a sort of TaskID ? Otherwise I could look at the address of the thread associated to one task, but is there a better way?

Thank You!

#1 lore raw
Quoted 8 lines · Jean-Olivier Villemure

Hi,

I'm looking for the best to identify a Xenomai Task.

We are running multiple task inside kernel space and I need to identify each of these task. Is there a sort of TaskID ? Otherwise I could look at the address of the thread associated to one task, but is there a better way?

It depends on the skin you are using,
- for posix skin, it is pthread_self()
- for native skin, it is rt_task_self()
- for vxworks skin, it is taskIdSelf()

The task Id of a new task is also returned by the task creation services:
- pthread_create for the posix skin,
- rt_task_create for the native skin,
- taskSpawn for the vxworks skin.
When using taskInit with the vxworks skin, the task ID is the address of the tcb passed as first argument.

Signature · 1 line
					    Gilles Chanteperdrix.
#2 lore raw
Quoted 4 lines · Gilles Chanteperdrix

The task Id of a new task is also returned by the task creation services:
- rt_task_create for the native skin

Thank you for your answer!

Looking at the API, i see that rt_task_create returns:
- 0 is returned upon success. Otherwise:
- ENOMEM is returned if the system fails to get enough dynamic memory from the global real-time heap in order to create or register the task.
- EEXIST is returned if the /name/ is already in use by some registered object.
- EPERM is returned if this service was called from an asynchronous context.

So according to this, no TaskId is returned by this function since 0 is returned upon success. But according to the EEXIST error, can we considerate that the name of the task is unique? So I could simply use this information to identify my tasks ?

Thank you again :-)

Jean-Olivier

#3 lore raw
Quoted 15 lines · Jean-Olivier Villemure
Quoted 4 lines · Gilles Chanteperdrix

The task Id of a new task is also returned by the task creation services:
- rt_task_create for the native skin

Thank you for your answer!

Looking at the API, i see that rt_task_create returns:
- 0 is returned upon success. Otherwise:
- ENOMEM is returned if the system fails to get enough dynamic memory from the global real-time heap in order to create or register the task.
- EEXIST is returned if the /name/ is already in use by some registered object.
- EPERM is returned if this service was called from an asynchronous context.

Quoted 4 lines

So according to this, no TaskId is returned by this function since 0 is returned upon success. But according to the EEXIST error, can we considerate that the name of the task is unique? So I could simply use this information to identify my tasks ?

Sorry, the task Id is not really returned by rt_task_create, the task Id is the RT_TASK pointer passed as first argument.

Signature · 1 line
					    Gilles Chanteperdrix.