From 3c8c08faefd29168b4b514e2ce9420c0a4fe99a4 Mon Sep 17 00:00:00 2001 From: cigerxwinchaker Date: Wed, 4 Dec 2019 13:26:49 +0100 Subject: [PATCH] =?UTF-8?q?=C3=A4nderungen=20wegen=20problemen=20bei=20mac?= =?UTF-8?q?=20default=20werte=20f=C3=BCr=20max=20shared=20memory=20<=204mb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/main.cpp | 2 +- res/config.toml | 2 +- src/SharedMemory.cpp | 8 +++----- src/SharedMemory.h | 5 +++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index 9a8548f..ef3064a 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -17,7 +17,7 @@ int main(int argc, char** argv) { vkvm::setDefaultValues(); std::atexit(deleteSharedMemory); std::string eingabe; - + getConfig(); while(eingabe != "exit") { std::cout << "cmd# "; std::cin >> eingabe; diff --git a/res/config.toml b/res/config.toml index e91e65f..e90cdab 100644 --- a/res/config.toml +++ b/res/config.toml @@ -1,5 +1,5 @@ #defaultKey = 12345 -newKey = 0 +#newKey = 0 layoutVersion = 0 width = 0 height = 0 diff --git a/src/SharedMemory.cpp b/src/SharedMemory.cpp index 2619e92..374d980 100644 --- a/src/SharedMemory.cpp +++ b/src/SharedMemory.cpp @@ -8,10 +8,11 @@ + key_t changedKey() { std::ofstream keyFile; - keyFile.open("key.log", std::ofstream::out | std::ofstream::trunc); + keyFile.open("/tmp/vkvmKey.log", std::ofstream::out | std::ofstream::trunc); keyFile.clear(); int newKey; std::cout << "Type in a new Key for the Shared Memory Segment" << std::endl; @@ -21,9 +22,6 @@ key_t changedKey() keyFile << newKey; keyFile.close(); - auto config = cpptoml::parse_file(configFile); - newKey = config->get_as("newKey").value_or(0); //toml - return key_t(newKey); } @@ -52,7 +50,7 @@ void initSharedMemory(void) { if(answer.compare("y") == 0) { vkvm::impl.sharedMemoryKey = changedKey(); - std::cout << "new Try with Key:c " << vkvm::impl.sharedMemoryKey << std::endl; + std::cout << "new Try with Key: " << vkvm::impl.sharedMemoryKey << std::endl; initSharedMemory(); } else if(answer.compare("n") == 0) { std::cout << "This will end shared memory" <