Hi,
I'm trying to make a Xenomai target for Mathwork's Real Time Workshop
Embedded Coder and I need to embed the generated code in an user-space
application. My problem is that I cannot create semaphores correctly.
rt_sem_create() returns me the -17 value instead of 0 or one of the
error codes described in the documentation. I cannot figure what is
the cause of the problem.
This problem appears in the small code I've put in attachment.
Have you any idea of what I'm doing wrong ?
Thanks in advance for your reply.
Best regards,
Jean-Philippe
#include <stdio.h>
#include <signal.h>
#include <sys/mman.h>
#include <native/sem.h>
#include <native/task.h>
#define STACK_SIZE 8192
RT_TASK test_task_ptr;
RT_SEM semaDesc;
void clean_exit(int dummy) {
printf("cleanup\n");
rt_sem_delete(&semaDesc);
}
int main(int argc, char *argv[]) {
int err, ret;
printf("start\n");
signal(SIGTERM, clean_exit);
signal(SIGINT, clean_exit);
mlockall(MCL_CURRENT | MCL_FUTURE);
err = rt_sem_create(&semaDesc, "sema", 0, S_FIFO);
if (err) {
printf("error sema : %d\n",err);
}
pause();
fflush(NULL);
return 0;
}
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help