From: hadaq Date: Thu, 19 Aug 2010 17:22:01 +0000 (+0000) Subject: hostname number included. Sergey. X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=617a0875dcbf4530a36b859bcb82685392505de0;p=daqdata.git hostname number included. Sergey. --- diff --git a/ebctrl/ioc/ebctrlApp/src/evtbuild.c b/ebctrl/ioc/ebctrlApp/src/evtbuild.c index a55c39c..75d199e 100644 --- a/ebctrl/ioc/ebctrlApp/src/evtbuild.c +++ b/ebctrl/ioc/ebctrlApp/src/evtbuild.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -35,7 +36,7 @@ long evtbuild_init( struct genSubRecord *pgsub ) long evtbuild_proc( struct genSubRecord *pgsub ) { - uint32_t *out[13]; + uint32_t *out[14]; unsigned long tmp; static unsigned long temp[10] = {0}; int i; @@ -53,6 +54,7 @@ long evtbuild_proc( struct genSubRecord *pgsub ) out[10] = (uint32_t *)pgsub->valk; /* evtDRate = events discarded rate */ out[11] = (uint32_t *)pgsub->vall; /* dataMover = number of selected Data Mover */ out[12] = (uint32_t *)pgsub->valm; /* diskNr = disk number where data is being written */ + out[13] = (uint32_t *)pgsub->valn; /* number of EB machine (1 = lxhadeb01) */ /* pgsub->vall : bytesWrittenRate in stringin record (array of char's) */ for( i=0; i<12; i++ ) @@ -67,7 +69,8 @@ long evtbuild_proc( struct genSubRecord *pgsub ) printf(" evtbuild.c: Worker_getStatistic failed for nrOfMsgs!\n"); } else { - *out[7] = 1; /* status: Event Builder is on */ + *out[0] = (uint32_t)tmp; /* nrOfMsgs */ + *out[7] = 1; /* status: Event Builder is on */ if(evtbuildDebug) { printf(" evtbuild.c: Worker_getStatistic::nrOfMsgs = %lu\n", tmp); printf(" evtbuild.c: status = %lu\n", (unsigned long)1); @@ -159,7 +162,6 @@ long evtbuild_proc( struct genSubRecord *pgsub ) *out[12] = (uint32_t)tmp; } - char ebbuf[100]; for( i=0; i<(*out[0]); i++ ) { @@ -179,6 +181,24 @@ long evtbuild_proc( struct genSubRecord *pgsub ) } } + /* Get host name and extract the number from its name */ + char hostname[30]; + char *c_ptr; + char host_nr[2]; + + gethostname(hostname, 30); + c_ptr = strchr(hostname, '0'); + + if( c_ptr == (char*) NULL ){ + if(evtbuildDebug) + printf(" evtbuild.c: failed to extract a number from the hostname: %s!\n", hostname); + } + else{ + strcpy(host_nr,c_ptr); + printf("EB name number: %s\n", c_ptr); + *out[13] = (uint32_t) strtoul(c_ptr, NULL, 0); + } + /* * int bytedCoverted; * sprintf( buf, "%s", unit(*out[9]));