* [Xenomai-help] help with porting simple posix application
@ 2010-04-30 14:39 Leyrit Vincent
2010-04-30 14:43 ` Gilles Chanteperdrix
0 siblings, 1 reply; 6+ messages in thread
From: Leyrit Vincent @ 2010-04-30 14:39 UTC (permalink / raw)
To: xenomai
[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]
Hello,
i would like to port a POSIX application on XENOMAI ..
i have try a very simple test to verify the xenomai functionnalities ...
a thread call a recursive funtion which call clock_gettime() ...
this thread is set with a SCHED_FIFO and has a priority of 10 ...
the binary is well linked with the xenomail pthread_rt library (in makefile
i have used xeno-config with posix sking and cflags / ldflags)
when i execute the binary , i take a look on the /proc/xenomai/sched and i
see that my thread is set as X 'related shadow'
i think it is a problem? For my opinion the flag show that my thread swich
many time from the Xenomai domain to the Linux domain ...
Does someone can help me if my simple code is false?
Thanks for help...
Alexandre... (xenomai )
xeno-info : xenomai 2.5.2 (kernel 2.6.32.11 | ipipe 2.6-03)
CODE -----------------------------------------------------------------------
int recursive_method(int cp)
{
struct timeval ta;
struct timespec ts_start, ts_end;
if(cp < n_recurs)
{
for(int i=0; i < 10;i++)
{
clock_gettime(CLOCK_REALTIME,&ts_start);
xnprintf("%d\n", ts_start.tv_nsec);
}
recursive_method(cp++);
}
}
void *producer(void *)
{
recursive_method(1);
return 0;
}
int xeno_user_init()
{
struct sched_param parm;
pthread_attr_t attr;
int rc = 0, fd = -1;
struct sigevent evt;
pthread_attr_init(&attr);
pthread_attr_setinheritsched(&attr, 1);
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
parm.sched_priority = 10;
pthread_attr_setschedparam(&attr, &parm);
rc = pthread_create(&producer_task, &attr, &producer, NULL);
if (rc)
{
xnprintf("pthread_create(producer_task): %d\n", rc);
}
return rc;
}
int main (int ac, char *av[])
{
int rc, sig;
mlockall(MCL_CURRENT|MCL_FUTURE);
rc = xeno_user_init();
return 0;
}
CODE -----------------------------------------------------------------------
[-- Attachment #2: Type: text/html, Size: 2265 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] help with porting simple posix application
2010-04-30 14:39 [Xenomai-help] help with porting simple posix application Leyrit Vincent
@ 2010-04-30 14:43 ` Gilles Chanteperdrix
2010-04-30 14:48 ` Leyrit Vincent
0 siblings, 1 reply; 6+ messages in thread
From: Gilles Chanteperdrix @ 2010-04-30 14:43 UTC (permalink / raw)
To: Leyrit Vincent; +Cc: xenomai
Leyrit Vincent wrote:
> Hello,
>
> i would like to port a POSIX application on XENOMAI ..
See:
http://www.xenomai.org/index.php/Porting_POSIX_applications_to_Xenomai
> CODE -----------------------------------------------------------------------
>
> int recursive_method(int cp)
> {
> struct timeval ta;
> struct timespec ts_start, ts_end;
>
> if(cp < n_recurs)
> {
> for(int i=0; i < 10;i++)
> {
> clock_gettime(CLOCK_REALTIME,&ts_start);
> xnprintf("%d\n", ts_start.tv_nsec);
printf here causes a switch to secondary mode.
--
Gilles.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] help with porting simple posix application
2010-04-30 14:43 ` Gilles Chanteperdrix
@ 2010-04-30 14:48 ` Leyrit Vincent
2010-04-30 14:50 ` Gilles Chanteperdrix
0 siblings, 1 reply; 6+ messages in thread
From: Leyrit Vincent @ 2010-04-30 14:48 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]
Thanks you for the link, i have already have a look on it ...
The only thing that i do not understand in the code i have posted, is that i
never do any call to a linux domain syscall ...
but i don't see my thread in "runnable" (R) in the xenomai scheduler
/proc/xenomai/sched...
On Fri, Apr 30, 2010 at 4:43 PM, Gilles Chanteperdrix <
gilles.chanteperdrix@xenomai.org> wrote:
> Leyrit Vincent wrote:
> > Hello,
> >
> > i would like to port a POSIX application on XENOMAI ..
>
> See:
> http://www.xenomai.org/index.php/Porting_POSIX_applications_to_Xenomai
>
>
> > CODE
> -----------------------------------------------------------------------
> >
> > int recursive_method(int cp)
> > {
> > struct timeval ta;
> > struct timespec ts_start, ts_end;
> >
> > if(cp < n_recurs)
> > {
> > for(int i=0; i < 10;i++)
> > {
> > clock_gettime(CLOCK_REALTIME,&ts_start);
> > xnprintf("%d\n", ts_start.tv_nsec);
>
> printf here causes a switch to secondary mode.
>
> --
> Gilles.
>
[-- Attachment #2: Type: text/html, Size: 1684 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] help with porting simple posix application
2010-04-30 14:48 ` Leyrit Vincent
@ 2010-04-30 14:50 ` Gilles Chanteperdrix
2010-04-30 14:53 ` Leyrit Vincent
0 siblings, 1 reply; 6+ messages in thread
From: Gilles Chanteperdrix @ 2010-04-30 14:50 UTC (permalink / raw)
To: Leyrit Vincent; +Cc: xenomai
Leyrit Vincent wrote:
> Thanks you for the link, i have already have a look on it ...
> The only thing that i do not understand in the code i have posted, is
> that i never do any call to a linux domain syscall ...
printf sometimes results in a linux domain syscall, it is mentioned in
the howto.
--
Gilles.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] help with porting simple posix application
2010-04-30 14:50 ` Gilles Chanteperdrix
@ 2010-04-30 14:53 ` Leyrit Vincent
2010-04-30 14:56 ` Gilles Chanteperdrix
0 siblings, 1 reply; 6+ messages in thread
From: Leyrit Vincent @ 2010-04-30 14:53 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
sorry i have forgot to post all the code :
here printf is a define to the one provided by xenomai library :
#define xnarch_printf printf
On Fri, Apr 30, 2010 at 4:50 PM, Gilles Chanteperdrix <
gilles.chanteperdrix@xenomai.org> wrote:
> Leyrit Vincent wrote:
> > Thanks you for the link, i have already have a look on it ...
> > The only thing that i do not understand in the code i have posted, is
> > that i never do any call to a linux domain syscall ...
>
> printf sometimes results in a linux domain syscall, it is mentioned in
> the howto.
>
> --
> Gilles.
>
[-- Attachment #2: Type: text/html, Size: 986 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] help with porting simple posix application
2010-04-30 14:53 ` Leyrit Vincent
@ 2010-04-30 14:56 ` Gilles Chanteperdrix
0 siblings, 0 replies; 6+ messages in thread
From: Gilles Chanteperdrix @ 2010-04-30 14:56 UTC (permalink / raw)
To: Leyrit Vincent; +Cc: xenomai
Leyrit Vincent wrote:
> sorry i have forgot to post all the code :
> here printf is a define to the one provided by xenomai library :
>
> #define xnarch_printf printf
If you do not believe me, use pthread_set_mode_np as explained in the howto.
--
Gilles.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-04-30 14:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-30 14:39 [Xenomai-help] help with porting simple posix application Leyrit Vincent
2010-04-30 14:43 ` Gilles Chanteperdrix
2010-04-30 14:48 ` Leyrit Vincent
2010-04-30 14:50 ` Gilles Chanteperdrix
2010-04-30 14:53 ` Leyrit Vincent
2010-04-30 14:56 ` Gilles Chanteperdrix
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.