shared memory under Neutrino

Hi all…

I am having a strange thing happen under Neutrino v2.0 (on an RPX-lite
board).

I want to share some data accross several forked processes. This is
pretty standard.

I do something like:

struct my_struct *ptr = NULL;

fd = shm_open( “/some_name”, O_RDWR | O_CREAT, 0777 );

ftruncate( fd, sizeof( struct my_struct ) );

ptr = mmap( 0, sizeof( struct my_struct ), PROT_READ | PROT_WRITE,
MAP_SHARED,
fd, 0 );

Now this works ok sometimes, but other times, a subsequent shared memory
area (with a different name), get the same value assigned to ptr.
I seems to always be 0x80100000 if that is any clue.

Has anyone seen this before?

Thanks.

Gord



Gordon McFadden
Westsoft Systems Inc
gmcfadden@westsoft-systems.com
http://www.westsoft-systems.com

I haven’t had any experience with this aspect of
Neutrino yet, but it seems that your mmap() call is
asking the OS to map the shared memory into your
DS memory space wherever it wants to. If that is so, why would
you be concerned as to where it ends up?


Gordon McFadden <gmcfadden@westsoft-systems.com> wrote:


Hi all…

I am having a strange thing happen under Neutrino v2.0 (on an RPX-lite
board).

I want to share some data accross several forked processes. This is
pretty standard.

I do something like:

struct my_struct *ptr = NULL;

fd = shm_open( “/some_name”, O_RDWR | O_CREAT, 0777 );

ftruncate( fd, sizeof( struct my_struct ) );

ptr = mmap( 0, sizeof( struct my_struct ), PROT_READ | PROT_WRITE,
MAP_SHARED,
fd, 0 );

Now this works ok sometimes, but other times, a subsequent shared memory
area (with a different name), get the same value assigned to ptr.
I seems to always be 0x80100000 if that is any clue.

Has anyone seen this before?

Thanks.

Gord



Gordon McFadden
Westsoft Systems Inc
gmcfadden@westsoft-systems.com
http://www.westsoft-systems.com


Mitchell Schoenbrun --------- maschoen@pobox.com

I would expect that different shared memory regions get
mapped to different, non-overlapping areas, no?

Gord

Mitchell Schoenbrun wrote:

I haven’t had any experience with this aspect of
Neutrino yet, but it seems that your mmap() call is
asking the OS to map the shared memory into your
DS memory space wherever it wants to. If that is so, why would
you be concerned as to where it ends up?

Gordon McFadden <> gmcfadden@westsoft-systems.com> > wrote:

Hi all…

I am having a strange thing happen under Neutrino v2.0 (on an RPX-lite
board).

I want to share some data accross several forked processes. This is
pretty standard.

I do something like:

struct my_struct *ptr = NULL;

fd = shm_open( “/some_name”, O_RDWR | O_CREAT, 0777 );

ftruncate( fd, sizeof( struct my_struct ) );

ptr = mmap( 0, sizeof( struct my_struct ), PROT_READ | PROT_WRITE,
MAP_SHARED,
fd, 0 );

Now this works ok sometimes, but other times, a subsequent shared memory
area (with a different name), get the same value assigned to ptr.
I seems to always be 0x80100000 if that is any clue.

Has anyone seen this before?

Thanks.

Gord

Gordon McFadden
Westsoft Systems Inc
gmcfadden@westsoft-systems.com
http://www.westsoft-systems.com


Mitchell Schoenbrun --------- > maschoen@pobox.com


Gordon McFadden
Westsoft Systems Inc
gmcfadden@westsoft-systems.com
http://www.westsoft-systems.com

Gordon McFadden <gmcfadden@westsoft-systems.com> wrote:

I would expect that different shared memory regions get
mapped to different, non-overlapping areas, no?

So you are talking about in the same process? I thought
your comment was that different processes mapping in
shared memory would not map to the same area.

Well if you are using the latest OS update, I would
document the problem and post it on QUICS. You might
want to show it here first to see if anyone sees an
error.