änderungen wegen problemen bei mac default werte für max shared memory < 4mb
This commit is contained in:
parent
2c6635f689
commit
3c8c08faef
@ -17,7 +17,7 @@ int main(int argc, char** argv) {
|
|||||||
vkvm::setDefaultValues();
|
vkvm::setDefaultValues();
|
||||||
std::atexit(deleteSharedMemory);
|
std::atexit(deleteSharedMemory);
|
||||||
std::string eingabe;
|
std::string eingabe;
|
||||||
|
getConfig();
|
||||||
while(eingabe != "exit") {
|
while(eingabe != "exit") {
|
||||||
std::cout << "cmd# ";
|
std::cout << "cmd# ";
|
||||||
std::cin >> eingabe;
|
std::cin >> eingabe;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#defaultKey = 12345
|
#defaultKey = 12345
|
||||||
newKey = 0
|
#newKey = 0
|
||||||
layoutVersion = 0
|
layoutVersion = 0
|
||||||
width = 0
|
width = 0
|
||||||
height = 0
|
height = 0
|
||||||
|
@ -8,10 +8,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
key_t changedKey()
|
key_t changedKey()
|
||||||
{
|
{
|
||||||
std::ofstream keyFile;
|
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();
|
keyFile.clear();
|
||||||
int newKey;
|
int newKey;
|
||||||
std::cout << "Type in a new Key for the Shared Memory Segment" << std::endl;
|
std::cout << "Type in a new Key for the Shared Memory Segment" << std::endl;
|
||||||
@ -21,9 +22,6 @@ key_t changedKey()
|
|||||||
keyFile << newKey;
|
keyFile << newKey;
|
||||||
keyFile.close();
|
keyFile.close();
|
||||||
|
|
||||||
auto config = cpptoml::parse_file(configFile);
|
|
||||||
newKey = config->get_as<int>("newKey").value_or(0); //toml
|
|
||||||
|
|
||||||
return key_t(newKey);
|
return key_t(newKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +50,7 @@ void initSharedMemory(void) {
|
|||||||
if(answer.compare("y") == 0)
|
if(answer.compare("y") == 0)
|
||||||
{
|
{
|
||||||
vkvm::impl.sharedMemoryKey = changedKey();
|
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();
|
initSharedMemory();
|
||||||
} else if(answer.compare("n") == 0) {
|
} else if(answer.compare("n") == 0) {
|
||||||
std::cout << "This will end shared memory" <<std::endl;
|
std::cout << "This will end shared memory" <<std::endl;
|
||||||
|
@ -7,12 +7,13 @@
|
|||||||
//ID-Speicherbereich
|
//ID-Speicherbereich
|
||||||
//Größe des Speicherbereichs hier 8MB (8000)
|
//Größe des Speicherbereichs hier 8MB (8000)
|
||||||
//Shared-Memory-Segment erstellen oder öffnen – shmget()
|
//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(int s);
|
||||||
void deleteSharedMemory(void);
|
void deleteSharedMemory(void);
|
||||||
void initSharedMemory(void);
|
void initSharedMemory(void);
|
||||||
|
void getConfig();
|
||||||
key_t changedKey();
|
key_t changedKey();
|
||||||
std::string getAnswerFromUser();
|
std::string getAnswerFromUser();
|
||||||
//Config File
|
//Config File
|
||||||
#define configFile "res/config.toml"
|
#define configFile "../res/config.toml"
|
||||||
#endif //SHARED_MEMORY_H
|
#endif //SHARED_MEMORY_H
|
||||||
|
Loading…
Reference in New Issue
Block a user