Shm: Use MakeShmName to construct shm object names

This commit is contained in:
Alexey Rybalchenko
2023-09-28 14:53:36 +02:00
parent 4310d07ed1
commit 8d28824489
5 changed files with 51 additions and 55 deletions

View File

@@ -273,10 +273,6 @@ struct UnmanagedRegion
RegionCallback fCallback;
RegionBulkCallback fBulkCallback;
static std::string MakeSegmentName(const std::string& shmId, std::string_view segment, int regionIndex) {
return tools::ToString("fmq_", shmId, "_", segment, "_", regionIndex);
}
static RegionConfig makeRegionConfig(uint16_t id)
{
RegionConfig regionCfg;
@@ -288,7 +284,7 @@ struct UnmanagedRegion
{
using namespace boost::interprocess;
LOG(debug) << "Registering unmanaged shared memory region with id " << cfg.id.value();
managed_shared_memory mngSegment(open_or_create, std::string("fmq_" + shmId + "_mng").c_str(), kManagementSegmentSize);
managed_shared_memory mngSegment(open_or_create, MakeShmName(shmId, "mng").c_str(), kManagementSegmentSize);
VoidAlloc alloc(mngSegment.get_segment_manager());
Uint16RegionInfoHashMap* shmRegions = mngSegment.find_or_construct<Uint16RegionInfoHashMap>(unique_instance)(alloc);