All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.