änderungen wegen problemen bei mac default werte für max shared memory < 4mb

This commit is contained in:
cigerxwinchaker 2019-12-04 13:26:49 +01:00
parent 2c6635f689
commit 3c8c08faef
4 changed files with 8 additions and 9 deletions

View File

@ -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;

View File

@ -1,5 +1,5 @@
#defaultKey = 12345
newKey = 0
#newKey = 0
layoutVersion = 0
width = 0
height = 0

View File

@ -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<int>("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" <<std::endl;

View File

@ -7,12 +7,13 @@
//ID-Speicherbereich
//Größe des Speicherbereichs hier 8MB (8000)
//Shared-Memory-Segment erstellen oder öffnen shmget()
#define Max_Memory_Size 8000 * 1024
#define Max_Memory_Size 8000 * 512
void deleteSharedMemory(int s);
void deleteSharedMemory(void);
void initSharedMemory(void);
void getConfig();
key_t changedKey();
std::string getAnswerFromUser();
//Config File
#define configFile "res/config.toml"
#define configFile "../res/config.toml"
#endif //SHARED_MEMORY_H