Re: [Xenomai-core] why does not the share memory work well ?
The errno of mmap that is called in function __map_shm_heap_memory() is 22, namely, EINVAL. Is there someone successfully run the shared memory under rtai skins. 2011/5/12 Gilles Chanteperdrix : > On 05/12/2011 06:15 AM, arethe rtai wrote: >> Hi all: >> I wirte a share memory program, but I found the share momory does >> not work while I try to take a communication between user space and >> kernel space. >> The task in kernel is OK, we can get the shared space. But the >> task in user space can not get the share memory. >> The code of the task in user space as follows: > > What happens when the user-space tries to get the shared space? > >> >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> #include >> >> >> int main(void) >> { >> unsigned int *adr; >> >> adr=(unsigned int *)rt_shm_alloc(0xa, sizeof(*adr), USE_VMALLOC); >> >> if (adr==NULL) >> printf("NULL pointer find \n"); >> >> //rt_shm_free(0xa); >> >> printf("%d line \n",__LINE__); >> >> fflush(stdout); >> >> return 0; >> >> } >> >> BTW: I added some printf in file src/skins/rtai/shm.c, but they cannot >> be outputted to the console. > > I doubt that very much. If printf did not work, a lot of application > would not work on your system. > > -- > Gilles. > ___ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core
Re: [Xenomai-core] why does not the share memory work well ?
On 05/12/2011 06:15 AM, arethe rtai wrote: > Hi all: > I wirte a share memory program, but I found the share momory does > not work while I try to take a communication between user space and > kernel space. > The task in kernel is OK, we can get the shared space. But the > task in user space can not get the share memory. > The code of the task in user space as follows: What happens when the user-space tries to get the shared space? > > #include > #include > #include > #include > #include > #include > #include > #include > > > int main(void) > { > unsigned int *adr; > > adr=(unsigned int *)rt_shm_alloc(0xa, sizeof(*adr), USE_VMALLOC); > > if (adr==NULL) > printf("NULL pointer find \n"); > > //rt_shm_free(0xa); > > printf("%dline \n",__LINE__); > > fflush(stdout); > > return 0; > > } > > BTW: I added some printf in file src/skins/rtai/shm.c, but they cannot > be outputted to the console. I doubt that very much. If printf did not work, a lot of application would not work on your system. -- Gilles. ___ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core
[Xenomai-core] why does not the share memory work well ?
Hi all: I wirte a share memory program, but I found the share momory does not work while I try to take a communication between user space and kernel space. The task in kernel is OK, we can get the shared space. But the task in user space can not get the share memory. The code of the task in user space as follows: #include #include #include #include #include #include #include #include int main(void) { unsigned int *adr; adr=(unsigned int *)rt_shm_alloc(0xa, sizeof(*adr), USE_VMALLOC); if (adr==NULL) printf("NULL pointer find \n"); //rt_shm_free(0xa); printf("%dline \n",__LINE__); fflush(stdout); return 0; } BTW: I added some printf in file src/skins/rtai/shm.c, but they cannot be outputted to the console. Regards Arethe ___ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core