Subject: [boost] Boost managed_shared_memory not working with C's mmap call on freeBSD
From: vijay sharma (sharmavijay1991_at_[hidden])
Date: 2018-02-27 05:39:11
I am having two processes and they are sharing shared-memory.
- Process-1 (implemented in c++ and using
- 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.
obj = new boost::interprocess::managed_shared_memory(
boost::interprocess::open_or_create,<shm_name>, <shm_size>); // to
obj->allocate(<data_size>) ; // to write in shm
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.
I have raised same on stackoverflow.com and below is the link:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk