Boost logo

Boost :

Subject: Re: [boost] Boost managed_shared_memory not working with C's mmap call on freeBSD
From: Frank Mori Hess (fmh6jj_at_[hidden])
Date: 2018-02-27 07:39:09


On Feb 27, 2018 5:39 AM, "vijay sharma via Boost" <boost_at_[hidden]>
wrote:

Hi All,

I am having two processes and they are sharing shared-memory.

   - Process-1 (implemented in c++ and using
   boost::interprocess::managed_shared_memory interface)
   - Process-2 (implemented in c and using "she_open" and "mmap" interfaces)

This code was working fine on Linux But When I deployed same code on
FreeBSD. Process-2 (C lang based) is keep on throwing error in mmap. Error
is "Bad file Descriptor".

Please let me know:

   1. Do I need to change the interface while moving from Linux to FreeBSD.
   2. Is there any known issue with this design.

Code Snippet:

Process-1(c++):

obj = new boost::interprocess::managed_shared_memory(
boost::interprocess::open_or_create,<shm_name>, <shm_size>); // to
create shm
obj->allocate(<data_size>) ; // to write in shm

Process-2 (c):

int fd = shm_open(<shm_name>,O_RDWR, 0666);void * startpoint =
mmap(NULL, <shm_size>, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); //
using the startpoint to read data written by process-1.

Maybe it is your filesystem. For example, jffs2 doesn't support shared
writable mmaps.

Boost version:

Boost.1.63.0

I have raised same on stackoverflow.com and below is the link:

https://stackoverflow.com/questions/48984703/boost-
managed-shared-memory-not-working-with-cs-mmap-call-on-freebsd

Thanks,

Vijay

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/
mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk