1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-06-13 16:01:32 +03:00

MCOL-520 - initial changes for /dev/shm

This commit is contained in:
David Hill
2018-10-01 14:39:17 -05:00
parent 05bcd58e76
commit 8d3ce9757f
6 changed files with 68 additions and 12 deletions

View File

@ -41,6 +41,8 @@ using namespace rwlock;
#include "mastersegmenttable.h"
#undef MASTERSEGMENTTABLE_DLLEXPORT
#include "installdir.h"
namespace
{
using namespace BRM;
@ -73,13 +75,26 @@ MasterSegmentTableImpl::MasterSegmentTableImpl(int key, int size)
{
string keyName = ShmKeys::keyToName(key);
bool rootUser = true;
//check if root-user
int user;
user = getuid();
if (user != 0)
rootUser = false;
string shmLocation = "/dev/shm/";
if ( !rootUser)
shmLocation = startup::StartUp::installDir() + "/dev/shm/";
try
{
#if BOOST_VERSION < 104500
bi::shared_memory_object shm(bi::create_only, keyName.c_str(), bi::read_write);
#ifdef __linux__
{
string pname = "/dev/shm/" + keyName;
string pname = shmLocation + keyName;
chmod(pname.c_str(), 0666);
}
#endif
@ -96,7 +111,7 @@ MasterSegmentTableImpl::MasterSegmentTableImpl(int key, int size)
bi::shared_memory_object shm(bi::open_only, keyName.c_str(), bi::read_write);
#ifdef __linux__
{
string pname = "/dev/shm/" + keyName;
string pname = shmLocation + keyName;
chmod(pname.c_str(), 0666);
}
#endif