/** Return the list at this (null-terminated ASCII) path. */ static CpdListAccessor *CpdListLookup(const char *path) { CpdListAccessor *acc=CpvAccess(cpdListTable)->get(path); if (acc==NULL) { CmiError("CpdListAccessor> Unrecognized list path '%s'\n",path); return NULL; } return acc; }
void FIFO_Destroy(FIFO_QUEUE *queue) { if (!FIFO_Empty(queue)) { CmiError("Tried to FIFO_Destroy a non-empty queue.\n"); exit(1); } free(queue->block); free(queue); }
/** Return a CpdListAccessor, given a network string containing the list path. A network string is a big-endian 32-bit "length" field, followed by a null-terminated ASCII string of that length. */ static CpdListAccessor *CpdListLookup(const ChMessageInt_t *lenAndPath) { static const int CpdListMaxLen=80; int len=ChMessageInt(lenAndPath[0]); const char *path=(const char *)(lenAndPath+1); char pathBuf[CpdListMaxLen+1]; //Temporary null-termination buffer if ((len<0) || (len>CpdListMaxLen)) { CmiError("CpdListAccessor> Invalid list path length %d!\n",len); return NULL; //Character count is invalid } strncpy(pathBuf,path,len); pathBuf[len]=0; //Ensure string is null-terminated return CpdListLookup(pathBuf); }
int CmiSetCPUAffinity(int mycore) { int core = mycore; if (core < 0) { core = CmiNumCores() + core; } if (core < 0) { CmiError("Error: Invalid cpu affinity core number: %d\n", mycore); CmiAbort("CmiSetCPUAffinity failed"); } CpvAccess(myCPUAffToCore) = core; /* set cpu affinity */ #if CMK_SMP return set_thread_affinity(core); #else return set_cpu_affinity(core); /* print_cpu_affinity(); */ #endif }
/* CCS handler "lvImage", taking a liveVizRequest, returning binary image data. A client requests an image from us. */ extern "C" void getImageHandler(char * msg) { int msgLen=CmiSize(msg); char *buf=(char *)(msg+CmiMsgHeaderSizeBytes); msgLen-=CmiMsgHeaderSizeBytes; liveVizRequest o; PUP_toNetwork_unpack up(buf); o.pupNetwork(up); buf+=up.size(); msgLen-=up.size(); int wid=o.wid,ht=o.ht; if (config.getVerbose(2)) CmiPrintf("CCS getImage> Request for (%d x %d) or (0x%x x 0x%x) pixel image.\n", wid,ht,wid,ht); if (msgLen<0) { CmiError("liveViz0 getImageHandler Rejecting too-short image request\n"); return; } o.replyToken = CcsDelayReply(); liveViz0Get(o,buf,msgLen); CmiFree(msg); //Throw away the client's request }
static void CpdList_ccs_list_items_txt(char *msg) { CpdListItemsRequest req; CpdListAccessor *acc=CpdListHeader_ccs_list_items(msg,req); if(acc == NULL) CmiPrintf("ccs-builtins> Null Accessor--bad list name (txt)\n"); if (acc!=NULL) { int bufLen; { PUP::sizerText p; pupCpd(p,acc,req); bufLen=p.size(); } char *buf=new char[bufLen]; { PUP::toText p(buf); pupCpd(p,acc,req); if (p.size()!=bufLen) CmiError("ERROR! Sizing/packing length mismatch for %s list pup function!\n", acc->getPath()); } CcsSendReply(bufLen,(void *)buf); delete[] buf; } CmiFree(msg); }
static void posixth_fail() { CmiError("error detected in posix threads.\n"); exit(1); }
void LrtsAbort(const char *message) { CmiError(message); LAPI_Term(lapiContext); exit(1); }
void CmiAbort(const char *message) { CmiError(message); exit(1); }