diff --git a/src/internal.cpp b/src/internal.cpp index d4ef7e9..287d561 100644 --- a/src/internal.cpp +++ b/src/internal.cpp @@ -2,32 +2,10 @@ #include #include +#include "SharedMemoryAccess.h" + Impl impl; -void *getSharedMemory(){ - impl.sharedMemorySize = 8000; - - auto id = shmget(impl.sharedMemoryKey, impl.sharedMemorySize, 0644u | IPC_CREAT); - if(id == -1){ - //error - impl.sharedMemorySize = 0; - return nullptr; - } - - void *data = shmat(id, nullptr, 0); - if(data == (char*)(-1)){ - //error - impl.sharedMemorySize = 0; - return nullptr; - } - - return data; -} - -int getSharedMemorySize(){ - return impl.sharedMemorySize; -} - void sendSignal(pid_t pid, int signalNumber) { kill(pid, signalNumber); } diff --git a/src/vkvm.cpp b/src/vkvm.cpp index 27350f4..be44a83 100644 --- a/src/vkvm.cpp +++ b/src/vkvm.cpp @@ -16,6 +16,8 @@ bool registerEvent(EventType type, std::function handler) { ivt[type].pid = getpid(); ivt[type].signum = signum; + impl.eventTable.push_back(handler); + onSignal(signum, [](int sig){ if(sig >= SIGUSR1){ if((sig - SIGUSR1) < impl.eventTable.size()){