[Xenomai] Xenomai 3.0.5 - sigwaitinfo si_overrun wrong value

Fazio Maurizio maurizio.fazio at leonardocompany.com
Thu Oct 26 15:56:04 CEST 2017


Hello,
I'm running an application using the xenomai 3.0.5...
I have a problem with the si_overrun field of the siginfo_t structure returned by the sigwaitinfo function.
I armed a timer with and interval of 1ms… every 3 timer ticks I execute a sleep of 1.5 ms… I expect an overrun in that cycle but no overrun occurs…
Why??

The following is the interested part of the source code:

timer_t timer1;
pthread_t thread;

void* print_time (void* args)
{
     struct timespec tp;
     char buffer [80];
     struct itimerspec new_value, old_value;
     struct sigevent sevent;
     sigset_t set;
     siginfo_t siginfo;
     int signum = SIGRTMIN;
     sevent.sigev_notify = SIGEV_THREAD_ID;
     sevent._sigev_un._tid = syscall(__NR_gettid);
     sevent.sigev_signo = signum;

     sigemptyset(&set);
     sigaddset(&set, signum);
     sigprocmask(SIG_BLOCK, &set, NULL);

     if (timer_create (CLOCK_REALTIME, &sevent, &timer1) == -1)
             perror ("timer_create");

     new_value.it_interval.tv_sec = 0;
     new_value.it_interval.tv_nsec = 1000000;
     new_value.it_value.tv_sec = 0;
     new_value.it_value.tv_nsec = 1000000;

     if (timer_settime (timer1, 0, &new_value, &old_value) == -1)
         perror ("timer_settime");

     unsigned int counter = 0;
     struct timespec lastTime;
     while(1){

         /* wait for signal */
         if (sigwaitinfo(&set, &siginfo) == -1) perror ("sigwait");

         if (clock_gettime (CLOCK_REALTIME, &tp) == -1)
             perror ("clock_gettime");

         struct timespec diffTime = timespec_sub(tp, lastTime);
         lastTime = tp;

         sprintf (buffer, "%ld s %ld ns - %ld s %ld ns overrun = %d\n",tp.tv_sec,
                 tp.tv_nsec, diffTime.tv_sec,diffTime.tv_nsec, siginfo.si_overrun);

         write (STDOUT_FILENO, buffer, strlen (buffer));
         if (counter % 3 == 0)
         {
               usleep(1500);
         }
         counter++;
     }
}

int main(int argc, char* argv[])
{
     pthread_create(&thread, NULL, print_time, NULL);

     pthread_join(thread, NULL);
     exit (EXIT_SUCCESS);
}

----------------------------
The following is the output:

1286 s 77432620 ns - 1285 s 77432491 ns overrun = 0
1286 s 78975557 ns - 0 s 1542937 ns overrun = 0
1286 s 79431008 ns - 0 s 455451 ns overrun = 0
1286 s 80430867 ns - 0 s 999859 ns overrun = 0
1286 s 81990548 ns - 0 s 1559681 ns overrun = 0
1286 s 82431705 ns - 0 s 441157 ns overrun = 0
1286 s 83434563 ns - 0 s 1002858 ns overrun = 0
1286 s 84999441 ns - 0 s 1564878 ns overrun = 0
And so on...

I expected one overrun every 3 ticks but no one occurs...
Someone can help me with this trouble??


Thanks in advance


Maurizio Fazio

Chief Technical Office / Aircraft Systems
Software Engineer



Leonardo S.p.A.
C.so Francia, 426 - Torino - 10146 - Italy
Tel. +39 011 756 3308 / 3761
cell. +39 328 3488070
maurizio.fazio at leonardocompany.com
www.leonardocompany.com

————————————————————————————————–——————
HELICOPTERS/AERONAUTICS/ELECTRONICS, DEFENCE & SECURITY SYSTEMS/SPACE
————————————————————————————————–——————



Il presente messaggio e-mail e ogni suo allegato devono intendersi indirizzati esclusivamente al destinatario indicato e considerarsi dal contenuto strettamente riservato e confidenziale. Se non siete l'effettivo destinatario o avete ricevuto il messaggio e-mail per errore, siete pregati di avvertire immediatamente il mittente e di cancellare il suddetto messaggio e ogni suo allegato dal vostro sistema informatico. Qualsiasi utilizzo, diffusione, copia o archiviazione del presente messaggio da parte di chi non ne è il destinatario è strettamente proibito e può dar luogo a responsabilità di carattere civile e penale punibili ai sensi di legge.
Questa e-mail ha valore legale solo se firmata digitalmente ai sensi della normativa vigente.

The contents of this email message and any attachments are intended solely for the addressee(s) and contain confidential and/or privileged information.
If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately notify the sender and then delete this message and any attachments from your system. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited. Unauthorized disclosure and/or use of information contained in this email message may result in civil and criminal liability. “
This e-mail has legal value according to the applicable laws only if it is digitally signed by the sender


More information about the Xenomai mailing list