Skip to contentSkip to conversation

rt_heap_alloc fails in shared session mode.

Xenomai Stéphane ANCELOT 1 participant 1 message May 29, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

The next code snippet fails in session mode.
I can create and allocate heaps from a program.
In another one, I can bind , but rt_heap_inquire fails with Invalid argument. Or I can use rt_alloc_heap with it. But when accessing memory, a bus error is trapped.

    //err = rt_heap_bind(heap_desc[module],module,TM_INFINITE);
    err = rt_heap_bind(heap_desc[module],module,TM_INFINITE);
    if (err != 0)
         {
         printf("can not bind %s [%s]\n",module,strerror(-err));
         return (void *) -1;
         }

// err = rt_heap_inquire(heap_desc[module],&info);
// if (err != 0) {

//        printf("can not inquire info about %s [%s]\n",module,strerror(-err));
//        return (void *) -1;
//        }

// printf("size %d\n,",info.heapsize);

    err = rt_heap_alloc((RT_HEAP *)heap_desc[module],4288,TM_INFINITE, 
&shmem);
    if (err == 0)
        {
        return shmem;
        }
    else {
         printf("can not alloc %s [%s]\n",module,strerror(-err));
         return (void *) -1;
         }

Regards,
S.Ancelot