* [Xenomai-core] why does not the share memory work well ?
@ 2011-05-12 4:15 arethe rtai
2011-05-12 6:48 ` Gilles Chanteperdrix
0 siblings, 1 reply; 3+ messages in thread
From: arethe rtai @ 2011-05-12 4:15 UTC (permalink / raw)
To: Xenomai-core
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 <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <rtai/rtai.h>
#include <rtai/rtai_shm.h>
int main(void)
{
unsigned int *adr;
adr=(unsigned int *)rt_shm_alloc(0xaaaaa, sizeof(*adr), USE_VMALLOC);
if (adr==NULL)
printf("NULL pointer find \n");
//rt_shm_free(0xaaaaa);
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.
Regards Arethe
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Xenomai-core] why does not the share memory work well ?
2011-05-12 4:15 [Xenomai-core] why does not the share memory work well ? arethe rtai
@ 2011-05-12 6:48 ` Gilles Chanteperdrix
2011-05-12 8:41 ` arethe rtai
0 siblings, 1 reply; 3+ messages in thread
From: Gilles Chanteperdrix @ 2011-05-12 6:48 UTC (permalink / raw)
To: arethe rtai; +Cc: Xenomai-core
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 <stdio.h>
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/mman.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <rtai/rtai.h>
> #include <rtai/rtai_shm.h>
>
>
> int main(void)
> {
> unsigned int *adr;
>
> adr=(unsigned int *)rt_shm_alloc(0xaaaaa, sizeof(*adr), USE_VMALLOC);
>
> if (adr==NULL)
> printf("NULL pointer find \n");
>
> //rt_shm_free(0xaaaaa);
>
> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Xenomai-core] why does not the share memory work well ?
2011-05-12 6:48 ` Gilles Chanteperdrix
@ 2011-05-12 8:41 ` arethe rtai
0 siblings, 0 replies; 3+ messages in thread
From: arethe rtai @ 2011-05-12 8:41 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: xenomai
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 <gilles.chanteperdrix@xenomai.org>:
> 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 <stdio.h>
>> #include <unistd.h>
>> #include <sys/types.h>
>> #include <sys/mman.h>
>> #include <sys/stat.h>
>> #include <fcntl.h>
>> #include <rtai/rtai.h>
>> #include <rtai/rtai_shm.h>
>>
>>
>> int main(void)
>> {
>> unsigned int *adr;
>>
>> adr=(unsigned int *)rt_shm_alloc(0xaaaaa, sizeof(*adr), USE_VMALLOC);
>>
>> if (adr==NULL)
>> printf("NULL pointer find \n");
>>
>> //rt_shm_free(0xaaaaa);
>>
>> 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.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-12 8:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-12 4:15 [Xenomai-core] why does not the share memory work well ? arethe rtai
2011-05-12 6:48 ` Gilles Chanteperdrix
2011-05-12 8:41 ` arethe rtai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.