Hi,
I am using 6.2.0 and having problem with shared memory. I have successfully
allocated 4618240 bytes of shared memory, but I can access up to 2260991
bytes only. Is there any limit on the shared memory size? Or have I done
anything wrong in my code? Here is what I do in my code:
char *pBlock;
if ((fd = shm_open (sMyTable, O_RDWR | O_CREAT, 0777)) == -1)
{
exit (-1);
}
if (ftruncate (fd, 4618240) == -1)
{
exit (-1);
}
if (pBlock = mmap (0, 4618240, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0))
== MAP_FAILED)
{
exit (-1);
}
Overhere I can access up to pBlock[2260991], but accessing pBlock[2260992]
and above produces the following error:
"Error accessing memory address 0x… : error 312.
Johannes <Jsukamtoh@infolink.co.id> wrote:
anything wrong in my code? Here is what I do in my code:
Similar code works for me, I can access the entire region (just using
ptr[] dereferences).
Overhere I can access up to pBlock[2260991], but accessing pBlock[2260992]
and above produces the following error:
"Error accessing memory address 0x… : error 312.
How are you accessing the memory? The mapping usual failure would be
for a SEGV to terminate your program. Errno 312 is ESRVRFAULT, which
indicates some sort of message-pass issue - are you using this memory
as a message-passing buffer? Can you provide code that shows this error.
I got the error message from IDE debugger that I run under XP. As I step
through the code, after calling mmap, I evaluate the pointer location like
&pBlock[1000]. It works for index below 2260992 and that error message for
above that.
Without the debugger, my process crashed, and when I try to debug the core
dump using IDE, the IDE itself crashed. That’s why I try to trace it line by
line using the debugger.
“John Garvey” <jgarvey@qnx.com> wrote in message
news:bgcb83$j29$1@nntp.qnx.com…
Johannes <> Jsukamtoh@infolink.co.id> > wrote:
anything wrong in my code? Here is what I do in my code:Similar code works for me, I can access the entire region (just using
ptr[] dereferences).Overhere I can access up to pBlock[2260991], but accessing
pBlock[2260992]
and above produces the following error:
"Error accessing memory address 0x… : error 312.How are you accessing the memory? The mapping usual failure would be
for a SEGV to terminate your program. Errno 312 is ESRVRFAULT, which
indicates some sort of message-pass issue - are you using this memory
as a message-passing buffer? Can you provide code that shows this error.
Johannes <Jsukamtoh@infolink.co.id> wrote:
I got the error message from IDE debugger that I run under XP.
Without the debugger, my process crashed, and when I try to debug the core
dump using IDE, the IDE itself crashed. That’s why I try to trace it line
by line using the debugger.
I would think that ESRVFAULT is likely a manifestation of your IDE
issues as opposed to the real fault (the crash/SEGV). Have you tried
with gdb directly (either the core or line-by-line)? Or you may find
the “qdn.public.qnxrtp.devtools” newsgroup more suited to IDE usage …
Thanks. I have found the problem. It is due to the shm_unlink with name
without ‘/’. In my code, I called shm_unlink to all shared memory when the
program is started. The problem has disappeared after I fixed the name
correctly. But I am not sure why the shm_unlink could affect the others.
Anyway, I assume the problem is fixed for the time being.
“John Garvey” <jgarvey@qnx.com> wrote in message
news:bgcldq$4n$1@nntp.qnx.com…
Johannes <> Jsukamtoh@infolink.co.id> > wrote:
I got the error message from IDE debugger that I run under XP.
Without the debugger, my process crashed, and when I try to debug the
core
dump using IDE, the IDE itself crashed. That’s why I try to trace it
line
by line using the debugger.I would think that ESRVFAULT is likely a manifestation of your IDE
issues as opposed to the real fault (the crash/SEGV). Have you tried
with gdb directly (either the core or line-by-line)? Or you may find
the “qdn.public.qnxrtp.devtools” newsgroup more suited to IDE usage …