Help about Alchemy API
Hello, I have install xenomail-3.0-rc4 in vmware virtual machine(os:ubuntu14, kernel:linux3.16.7). Now I have met some problems when I use Alchemy API. I would appreciated it if you could help me.
I used Buffer Services of Alchemy API, the code like this:
"""
RT_BUFFER * bf = NULL;
RT_BUFFER_INFO * info;
int ret;
int n = 0;
ret = rt_buffer_create(bf , "buffer-demo" , 2048 , B_FIFO);
if( 0 < ret)
{
printf("%d\n",ret);
fail("creat_buffer");
}"""
The return of rt_buffer_create is always -17, no matter what name I used in rt_buffer_create. I have search the means of errno, and 17 means "File exists ". I have try rt_buffer_bind,rt_buffer_read and rt_buffer_write api, they didn't work either. And the use of Message Queue Services have the similar probem.
Thanks for you help.
Quoted 1 line · ニャン星人
Hello, I have install xenomail-3.0-rc4 in vmware virtual
machine(os:ubuntu14, kernel:linux3.16.7). Now I have met some problems when I use Alchemy API. I would appreciated it if you could help me.
Please use -rc7. This makes no sense to investigate bugs fixed months ago by using outdated candidate releases.
Signature · 1 line
Philippe.
Hi, according your advice, I reinstalled rc-7 in vmware virtual machine.(kernel:linux3.16.7) The same problem I met when I use "rt_buffer_write()"of alchemy api.
The whole code is:
"""
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <pthread.h>
#include <errno.h>
#include <rtdm/ipc.h>
#include <alchemy/buffer.h>
static const char *msg[] = {
"Surfing With The Alien",
"Lords of Karma",
"Banana Mango",
"Psycho Monkey",
"Luminous Flesh Giants",
"Moroccan Sunset",
"Satch Boogie",
"Flying In A Blue Dream",
"Ride",
"Summer Song",
"Speed Of Light",
"Crystal Planet",
"Raspberry Jam Delta-V",
"Champagne?",
"Clouds Race Across The Sky",
"Engines Of Creation"
};
static void fail(const char *reason)
{
perror(reason);
exit(EXIT_FAILURE);
}
static void *thread1(void *arg)
{
RT_BUFFER *bf;
int ret;
ret = rt_buffer_create(bf , "buffer_demo" , 1024 , B_FIFO);
printf("%d\n",ret);
if( 0 > ret)
{
rt_buffer_delete(bf);
fail("create");
}
ret = rt_buffer_write(bf , msg[0] , strlen(msg[0]) , 50000);
printf("%d\n",ret);
ret = rt_buffer_delete(bf);
printf("%d\n",ret);
return NULL;
}int main(int argc, char **argv)
{
pthread_t svtid;
struct sched_param svparam = {.sched_priority = 71 };
pthread_attr_t svattr;
sigset_t set;
int sig;
sigemptyset(&set);
sigaddset(&set, SIGINT);
sigaddset(&set, SIGTERM);
sigaddset(&set, SIGHUP);
pthread_sigmask(SIG_BLOCK, &set, NULL);
pthread_attr_init(&svattr);
pthread_attr_setdetachstate(&svattr, PTHREAD_CREATE_JOINABLE);
pthread_attr_setinheritsched(&svattr, PTHREAD_EXPLICIT_SCHED);
pthread_attr_setschedpolicy(&svattr, SCHED_FIFO);
pthread_attr_setschedparam(&svattr, &svparam);
errno = pthread_create(&svtid, &svattr, &thread1, NULL);
if (errno)
fail("pthread_create");
sigwait(&set, &sig);
pthread_cancel(svtid);
pthread_join(svtid, NULL);
return 0;
}"""
In the thead1 function par of above code, the return of rt_buffer_write is alway -1. I know it is relate to xenomai thread. I just don't know how to use the alchemy api properly and don't know the relationship of alchemy ipc and xenomai rt thread. Can you give me some example of alchemy api and xenomai thread. Thanks a lot.
------------------ 原始邮件 ------------------
发件人: "Philippe Gerum"<[email protected]>;
发送时间: 2015年8月20日(星期四) 晚上10:04
收件人: "ニャン星人"<[email protected]>; "xenomai"<[email protected]>; 主题: Re: [Xenomai] Help about Alchemy API
Quoted 1 line · ニャン星人
Hello, I have install xenomail-3.0-rc4 in vmware virtual
machine(os:ubuntu14, kernel:linux3.16.7). Now I have met some problems when I use Alchemy API. I would appreciated it if you could help me.
Please use -rc7. This makes no sense to investigate bugs fixed months ago by using outdated candidate releases.
Signature · 1 line
Philippe.