예제 #1
0
int main(int argc, char **argv)  {
infolog_SetFacility((char *)"CTP");
infolog_SetStream("",0);
setlinebuf(stdout);
signal(SIGUSR1, gotsignal); siginterrupt(SIGUSR1, 0);
signal(SIGQUIT, gotsignal); siginterrupt(SIGQUIT, 0);
signal(SIGBUS, gotsignal); siginterrupt(SIGBUS, 0);
micrate(-1);
if(micratepresent()) {
    SLOT_S= 30;   // was 60 before 10.11.2011
  } else {
    SLOT_S= 5;   // in lab just 5secs
  };
/*
if(envcmp("VMESITE", "ALICE")==0) {
  udpsock= udpopens("alidcscom835", send2PORT);
} else {
  udpsock= udpopens("avmes", send2PORT);
}; */
ds_register();

while(1)  {  
  int rc=0;
  rc= update_qpll();
  if(rc!=0) break;
  //printf("sleteping 10secs...\n"); fflush(stdout);
  //sleep(1) ; 
  //msleep(1000);
  dtq_sleep(2);
  //printf("slept 10secs...\n"); fflush(stdout);
};  
ds_stop();
exit(0);
}   
예제 #2
0
파일: ttcmidims.c 프로젝트: juskoa/trigger
/*-----------------*/ void MICLOCK_SETcmd(void *tag, void *msgv, int *size)  {
char errmsg[200];
char msg[80]; int rc,rc2=0; int nwclocktag, msglen;
sprintf(errmsg, "MICLOCK_SETcmd: tag:%d size:%d msg:%5.5s", 
  *(int *)tag, *size, (char *)msgv); prtLog(errmsg); 
/* pydim client: msg not finished by 0x0 ! -that's why strncmp() used below...

if(*size >=2) {
msg[*size]='\0';   // with python client ok
//if(msg[*size-2]=='\n') { msg[*size-2]='\0'; } else { msg[*size-1]='\0'; };
};
*/
msglen= *size;
strncpy(msg, (char *)msgv, msglen); msg[msglen]='\0';
rc= authenticate(""); rc2=1; //rc2= authenticate("oerjan/");
//rc=0;
if((rc!=0) and (rc2!=0) ) {
  //sprintf(errmsg, "Only trigger/oerjan user can change the clock"); prtLog(errmsg); 
  sprintf(errmsg, "Only alidcscom779 can request the change of the clock"); prtLog(errmsg); 
  return;  
};
if(strncmp(msg,"qq", 2)==0) ds_stop();
if(strncmp(msg,"BEAM1", 5)==0) { nwclocktag=1;
} else if(strncmp(msg,"BEAM2", 5)==0) { nwclocktag=2;
} else if(strncmp(msg,"REF", 3)==0) { nwclocktag=3;
} else if(strncmp(msg,"LOCAL", 5)==0) { nwclocktag=4;
} else { 
  sprintf(errmsg, "bad clock request:%s ignored.\n", msg); infolog_trgboth(LOG_ERROR, errmsg); 
  return; 
};
strcpy(lastmsg,msg);
getclocknow();
if(clocktag==nwclocktag) {
  sprintf(errmsg, "clock request:%s ignored (already set).\n", msg); infolog_trgboth(LOG_ERROR, errmsg); 
  return; 
};
sprintf(errmsg, "ALICE clock change to %s starting...\n", msg); infolog_trgboth(LOG_WARNING, errmsg); 
checkstartthread(nwclocktag);
}