8 #ifndef FAIR_MQ_SHMEM_COMMON_H_ 9 #define FAIR_MQ_SHMEM_COMMON_H_ 13 #include <unordered_map> 15 #include <boost/interprocess/managed_shared_memory.hpp> 16 #include <boost/interprocess/allocators/allocator.hpp> 17 #include <boost/interprocess/containers/map.hpp> 18 #include <boost/interprocess/containers/string.hpp> 19 #include <boost/interprocess/containers/vector.hpp> 20 #include <boost/functional/hash.hpp> 23 #include <sys/types.h> 32 using SegmentManager = boost::interprocess::managed_shared_memory::segment_manager;
33 using VoidAlloc = boost::interprocess::allocator<void, SegmentManager>;
34 using CharAlloc = boost::interprocess::allocator<char, SegmentManager>;
35 using Str = boost::interprocess::basic_string<char, std::char_traits<char>, CharAlloc>;
36 using StrAlloc = boost::interprocess::allocator<Str, SegmentManager>;
37 using StrVector = boost::interprocess::vector<Str, StrAlloc>;
48 RegionInfo(
const char* path,
const int flags,
const uint64_t userFlags,
const VoidAlloc& alloc)
51 , fUserFlags(userFlags)
61 using Uint64RegionInfoPairAlloc = boost::interprocess::allocator<std::pair<const uint64_t, RegionInfo>, SegmentManager>;
62 using Uint64RegionInfoMap = boost::interprocess::map<uint64_t, RegionInfo, std::less<uint64_t>, Uint64RegionInfoPairAlloc>;
70 std::atomic<unsigned int> fCount;
79 std::atomic<uint64_t> fCount;
87 boost::interprocess::managed_shared_memory::handle_t fHandle;
98 RegionBlock(boost::interprocess::managed_shared_memory::handle_t handle,
size_t size,
size_t hint)
104 boost::interprocess::managed_shared_memory::handle_t fHandle;
111 inline std::string buildShmIdFromSessionIdAndUserId(
const std::string& sessionId)
113 boost::hash<std::string> stringHash;
114 std::string shmId(std::to_string(stringHash(std::string((std::to_string(geteuid()) + sessionId)))));
115 shmId.resize(8,
'_');
Tools for interfacing containers to the transport via polymorphic allocators.
Definition: DeviceRunner.h:23