34 lines
1.0 KiB
C++
34 lines
1.0 KiB
C++
#include <cstdlib>
|
|
#include <signal.h>
|
|
#include "../src/SharedMemory.h"
|
|
#include <sys/shm.h>
|
|
#include <iostream>
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
initSharedMemory();
|
|
struct sigaction sigIntHandler;
|
|
sigIntHandler.sa_handler = deleteSharedMemory;
|
|
sigemptyset(&sigIntHandler.sa_mask);
|
|
sigIntHandler.sa_flags = 0;
|
|
sigaction(SIGINT, &sigIntHandler, NULL);
|
|
|
|
std::atexit(deleteSharedMemory);
|
|
std::string eingabe = "";
|
|
while(eingabe != "exit") {
|
|
std::cout << "cmd# ";
|
|
std::cin >> eingabe;
|
|
//if verschieden information ausgaben
|
|
if(eingabe == "info")
|
|
{
|
|
std::cout << "OUTPUT ------------------------ OUTPUT" << std::endl;
|
|
std::cout << "memory ID: " << shmget(impl.sharedMemoryKey, 0, 0) << std::endl;
|
|
std::cout << "Max memory Size: " << Max_Memory_Size << std::endl;
|
|
std::cout << "OUTPUT ------------------------ OUTPUT" << std::endl;
|
|
//Memory that is used now
|
|
//outprint of all memory
|
|
}
|
|
}
|
|
return 0;
|
|
} |