[Xenomai] rt task & stack overflow

Johann Obermayr johann.obermayr at sigmatek.at
Tue Apr 19 00:21:48 CEST 2016


Hello,

is there a way to handle a stack overflow with a xenomai  rt_task ?

this example work for a standard linux
#define _XOPEN_SOURCE 700
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
void handler(int sig)
{
     printf("stack overflow: %d\n", sig);
     _exit(1);
}
unsigned infinite_recursion(unsigned x) {
     return infinite_recursion(x)+1;
}
int main()
{
     static char stack[SIGSTKSZ];
     stack_t ss = {
         .ss_size = SIGSTKSZ,
         .ss_sp = stack,
     };
     struct sigaction sa = {
         .sa_handler = handler,
         .sa_flags = SA_ONSTACK
     };
     sigaltstack(&ss, 0);
     sigfillset(&sa.sa_mask);
     sigaction(SIGSEGV, &sa, 0);
     infinite_recursion(0);
}


thanks for help

regards
   Johann



More information about the Xenomai mailing list