123456789101112131415161718192021222324252627282930313233 |
- #include <QCoreApplication>
- #include "dogshm.h"
- #include "dogcore.h"
- ServerDogShm *dogshm;
- bool shm_load()
- {
- int shmid;
- key_t key;
- if((key=ftok(SHM_PATH,static_cast<int>(SHM_PORT)))==-1){
- return false;
- }
- if((shmid=shmget(key,sizeof(ServerDogShm),IPC_CREAT|0666))==-1){
- return false;
- }
- printf("dmp dog shmid = %d\n",shmid);
- dogshm=static_cast<ServerDogShm*>(shmat(shmid,nullptr,0));
- return true;
- }
- int main(int argc, char *argv[])
- {
- QCoreApplication a(argc, argv);
- if(shm_load()){
- DogCore *dogcore = new DogCore(nullptr);
- dogcore->start();
- }
- return a.exec();
- }
|