FairMQ: Fix session name modification shm transport.

This commit is contained in:
Alexey Rybalchenko 2017-11-29 10:37:57 +01:00 committed by Mohammad Al-Turany
parent 0dc4000187
commit b967de4a57
2 changed files with 4 additions and 2 deletions

View File

@ -62,7 +62,7 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai
{ {
numIoThreads = config->GetValue<int>("io-threads"); numIoThreads = config->GetValue<int>("io-threads");
fSessionName = config->GetValue<string>("session"); fSessionName = config->GetValue<string>("session");
fSessionName.resize(8); // shorten the session name, to acomodate for name size limit on some systems (MacOS) fSessionName.resize(8, '_'); // shorten the session name, to accommodate for name size limit on some systems (MacOS)
// fSegmentName = "fmq_shm_" + fSessionName + "_main"; // fSegmentName = "fmq_shm_" + fSessionName + "_main";
segmentSize = config->GetValue<size_t>("shm-segment-size"); segmentSize = config->GetValue<size_t>("shm-segment-size");
} }
@ -87,7 +87,7 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai
} }
fManager = fair::mq::tools::make_unique<Manager>(fSessionName, segmentSize); fManager = fair::mq::tools::make_unique<Manager>(fSessionName, segmentSize);
LOG(DEBUG) << "shmem: created/opened shared memory segment of " << segmentSize << " bytes. Available are " << fManager->Segment().get_free_memory() << " bytes."; LOG(DEBUG) << "shmem: created/opened shared memory segment '" << "fmq_shm_" << fSessionName << "_main" << "' of " << segmentSize << " bytes. Available are " << fManager->Segment().get_free_memory() << " bytes.";
{ {
bipc::scoped_lock<bipc::named_mutex> lock(*fShMutex); bipc::scoped_lock<bipc::named_mutex> lock(*fShMutex);

View File

@ -45,6 +45,8 @@ int main(int argc, char** argv)
notify(vm); notify(vm);
sessionName.resize(8, '_'); // shorten the session name, to accommodate for name size limit on some systems (MacOS)
if (cleanup) if (cleanup)
{ {
cout << "Cleaning up \"" << sessionName << "\"..." << endl; cout << "Cleaning up \"" << sessionName << "\"..." << endl;