All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] What returns rt_task_self in relation to rt_task_create
@ 2006-11-22 11:38 M. Koehrer
  2006-11-22 12:04 ` Jan Kiszka
  2006-11-22 13:09 ` [Xenomai-help] What returns rt_task_self in relation to rt_task_create Philippe Gerum
  0 siblings, 2 replies; 19+ messages in thread
From: M. Koehrer @ 2006-11-22 11:38 UTC (permalink / raw)
  To: xenomai

Hi all,

I have a simple question concerning the Xenomai native API:
According to the API documentation, rt_task_self returns the 
address of the caller's task descriptor.
I have now written the following (simple application):
---------- START ----------
#include <stdio.h>
#include <sys/mman.h>
#include <native/task.h>

RT_TASK task_desc;

void mytask(void *cookie)
{
    RT_TASK *tsk = rt_task_self();
    printf("rt_task_self  %p\n"
           "task_desc     %p\n", tsk, &task_desc);
}

int main(void)
{
    mlockall(MCL_CURRENT|MCL_FUTURE);

    rt_task_create(&task_desc, "mytaskname", 0, 80, T_JOINABLE);
    rt_task_start(&task_desc, &mytask, NULL);

    rt_task_join(&task_desc);

    return 0;
}
------------ END -----------

I expect now that rt_task_self() returns exactly the address of the task_desc.
However, a different address is returned. 
The output of the application from above is:
rt_task_self  0x804a050
task_desc     0x8049878

How are those addresses related - how can I find out the descriptor address 
used for rt_task_create() at runtime?

Background of the question:
I want to write an application that uses a couple of similar tasks.
I have to store some task-specific information (internal states...).
Now I am looking for a simple way to get this information at runtime from my task
by calling rt_task_self() (or something similar) to use this address to reach my
additional information.

Thanks for any idea on this.

Regards

Mathias



-- 
Mathias Koehrer
mathias_koehrer@domain.hid


Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren
ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT JETZT bei Arcor: günstig
und schnell mit DSL - das All-Inclusive-Paket für clevere Doppel-Sparer,
nur  44,85 €  inkl. DSL- und ISDN-Grundgebühr!
http://www.arcor.de/rd/emf-dsl-2


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2006-11-22 18:33 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-22 11:38 [Xenomai-help] What returns rt_task_self in relation to rt_task_create M. Koehrer
2006-11-22 12:04 ` Jan Kiszka
2006-11-22 12:52   ` Philippe Gerum
2006-11-22 13:14     ` Jan Kiszka
2006-11-22 14:00       ` Philippe Gerum
2006-11-22 14:03         ` Gilles Chanteperdrix
2006-11-22 14:22           ` Philippe Gerum
2006-11-22 16:34             ` Gilles Chanteperdrix
2006-11-22 17:03               ` Philippe Gerum
2006-11-22 17:38                 ` Gilles Chanteperdrix
2006-11-22 18:33                   ` Philippe Gerum
2006-11-22 14:16         ` Re: [Xenomai-help] What returns rt_task_self in M. Koehrer
2006-11-22 14:33           ` Jan Kiszka
2006-11-22 14:49           ` Philippe Gerum
2006-11-22 13:09 ` [Xenomai-help] What returns rt_task_self in relation to rt_task_create Philippe Gerum
2006-11-22 13:48   ` [Xenomai-help] What returns rt_task_self in relation tort_task_create Daniel Schnell
2006-11-22 14:06     ` Jan Kiszka
2006-11-22 14:16     ` Philippe Gerum
2006-11-22 14:23       ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.