From a8bdb9116583d6d2505349d4d8c77c9f3bb49e11 Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Thu, 10 Jun 2021 11:16:56 +0200 Subject: [PATCH] shm: throw TransportError if could not lock region --- fairmq/shmem/Manager.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fairmq/shmem/Manager.h b/fairmq/shmem/Manager.h index 10d9394c..ac03eb8f 100644 --- a/fairmq/shmem/Manager.h +++ b/fairmq/shmem/Manager.h @@ -16,8 +16,8 @@ #define FAIR_MQ_SHMEM_MANAGER_H_ #include "Common.h" -#include "Region.h" #include "Monitor.h" +#include "Region.h" #include #include @@ -34,8 +34,8 @@ #include #include -#include // getenv #include +#include // getenv #include // make_unique #include #include @@ -43,9 +43,9 @@ #include #include #include +#include #include #include // pair -#include #include #include // getuid @@ -194,6 +194,7 @@ class Manager LOG(debug) << "Locking the managed segment memory pages..."; if (mlock(boost::apply_visitor(SegmentAddress(), fSegments.at(fSegmentId)), boost::apply_visitor(SegmentSize(), fSegments.at(fSegmentId))) == -1) { LOG(error) << "Could not lock the managed segment memory. Code: " << errno << ", reason: " << strerror(errno); + throw TransportError(tools::ToString("Could not lock the managed segment memory: ", strerror(errno))); } LOG(debug) << "Successfully locked the managed segment memory pages."; } @@ -323,6 +324,7 @@ class Manager LOG(debug) << "Locking region " << id << "..."; if (mlock(r.first->second->fRegion.get_address(), r.first->second->fRegion.get_size()) == -1) { LOG(error) << "Could not lock region " << id << ". Code: " << errno << ", reason: " << strerror(errno); + throw TransportError(tools::ToString("Could not lock region ", id, ": ", strerror(errno))); } LOG(debug) << "Successfully locked region " << id << "."; }