⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sys_check_gtk.h

📁 linux下的人机对话编程
💻 H
字号:
int testnum=0;gint sys_check(){   /* attach parent's shared memory */      	ap=(struct area *)shmat(shmid, 0, 0);      /* note: shmid is still set correctly */        /* set semaphore */        buf_sem.sem_op=-1;        semop(semid, (struct sembuf *) &buf_sem, 1);//M machine check        if(Mstate_check()==0)                {                ap->Mstate_gl=0;                ap->Mhost_name_gl="127.0.0.1";                //change the lpudated_log reboot M                //update state_file                exit(EXIT_FAILURE);                }        else                {                ap->Mstate_gl=1;                ap->Mhost_name_gl="192.168.1.1";                }//check A machine              Astate_check();//check B machine              Bstate_check();//further check for Main_cpu Main_hub        if((ap->Astate_gl==1)&&(ap->Bstate_gl==1))                {		ap->flag_sys_check=1;                ap->Sys_main_cpu_gl=1;                ap->Sys_main_hub_gl=1;                }        else if((ap->Astate_gl==1)&&(ap->Bstate_gl==0))                {                ap->Sys_main_cpu_gl=1; 		ap->Sys_main_hub_gl=1;		ap->flag_sys_check=2;                }        else if((ap->Astate_gl==0)&&(ap->Bstate_gl==1))                {                ap->Sys_main_cpu_gl=2;                ap->Sys_main_hub_gl=1;		ap->flag_sys_check=3;                }        else    {		ap->flag_sys_check=4;                //Sys_main_hub_gl=2;                }/*//further check for host_name        if(Sys_main_hub_gl==2)                {                Ahost_name_gl="192.168.1.4";                Bhost_name_gl="192.168.1.6";                }*///get the check detail infomation	/* clear semaphore */        buf_sem.sem_op=1;        semop(semid, (struct sembuf *) &buf_sem, 1);	testnum++;	printf("test_num= %d\n",testnum);return TRUE;}//sys_checkgint sys_check_gtk(gint argc,gchar *argv[]){	gtk_init(&argc,&argv);	gtk_timeout_add(2311,sys_check,NULL);	gtk_main();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -