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]>

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:


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:


I have raised same on and below is the link:



Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at