report a warning if shared memory segment cannot be locked into RAM
This commit is contained in:
parent
733d1384a4
commit
5fe24cb689
@ -43,6 +43,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
@ -121,9 +123,13 @@ public:
|
|||||||
key,
|
key,
|
||||||
size
|
size
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
shmctl(shm.get_shmid(), SHM_LOCK, 0);
|
if( -1 == shmctl(shm.get_shmid(), SHM_LOCK, 0) ) {
|
||||||
|
if( ENOMEM == errno ) {
|
||||||
|
SimpleLogger().Write(logWARNING) <<
|
||||||
|
"could not lock shared memory to RAM";
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
region = boost::interprocess::mapped_region (
|
region = boost::interprocess::mapped_region (
|
||||||
shm,
|
shm,
|
||||||
|
Loading…
Reference in New Issue
Block a user