12345678910111213141516171819202122232425262728293031323334 |
- #include <QCoreApplication>
- #include "smartlightshm.h"
- #include "core.h"
- SL_Shm *slShm;
- WebDataShm *webData;
- bool load_shm()
- {
- int shmid;
- key_t key;
- if((key = ftok(SHM_PATH,static_cast<int>(SHM_PORT)))==-1)
- return false;
- if((shmid = shmget(key,sizeof(SL_Shm),IPC_CREAT|0666))==-1)
- return false;
- slShm = static_cast<SL_Shm *>(shmat(shmid,nullptr,0));
- if((key = ftok(WEB_SHM_PATH,static_cast<int>(WEB_SHM_PORT)))==-1)
- return false;
- if((shmid = shmget(key,sizeof(WebDataShm),IPC_CREAT|0666))==-1)
- return false;
- webData = static_cast<WebDataShm *>(shmat(shmid,nullptr,0));
- return true;
- }
- int main(int argc, char *argv[])
- {
- QCoreApplication a(argc, argv);
- if(load_shm()){
- Core *core = new Core(nullptr);
- core->start();
- }
- return a.exec();
- }
|