PSI update
r1464 | ffr | 2007-02-12 12:20:21 +1100 (Mon, 12 Feb 2007) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
634f2023b1
commit
3168325921
36
devexec.c
36
devexec.c
@@ -70,18 +70,23 @@ static FILE *devLog = NULL;
|
||||
int openDevexecLog(){
|
||||
char *fileName = NULL;
|
||||
char fileBuffer[1024];
|
||||
time_t iDate;
|
||||
struct tm *psTime;
|
||||
|
||||
|
||||
if(devLog == NULL){
|
||||
fileName = IFindOption(pSICSOptions,"devexeclog");
|
||||
if(fileName != NULL){
|
||||
strcpy(fileBuffer,fileName);
|
||||
} else {
|
||||
iDate = time(NULL);
|
||||
psTime = localtime(&iDate);
|
||||
fileBuffer[0] = '\0';
|
||||
fileName = getenv("HOME");
|
||||
if(fileName != NULL){
|
||||
strcpy(fileBuffer,fileName);
|
||||
snprintf(fileBuffer,1023,"%s/log/devexec%4.4d.log",
|
||||
fileName, psTime->tm_year + 1900);
|
||||
}
|
||||
strcat(fileBuffer,"/log/devexec.log");
|
||||
}
|
||||
devLog = fopen(fileBuffer,"a+");
|
||||
}
|
||||
@@ -168,6 +173,20 @@ typedef struct {
|
||||
} ExeList;
|
||||
|
||||
static pExeList pExecutor = NULL;
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static void *DevexecInterface(void *pData, int iInter)
|
||||
{
|
||||
pExeList self = NULL;
|
||||
|
||||
self = (pExeList)pData;
|
||||
assert(self);
|
||||
|
||||
if(iInter == CALLBACKINTERFACE)
|
||||
{
|
||||
return self->pCall;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
pExeList CreateExeList(pTaskMan pTask)
|
||||
{
|
||||
@@ -200,8 +219,10 @@ typedef struct {
|
||||
pRes->lTask = -1;
|
||||
pRes->iLock = 0;
|
||||
pRes->drivePrint = 0;
|
||||
pRes->paused = 0;
|
||||
pRes->pCall = CreateCallBackInterface();
|
||||
pRes->lastRun = time(NULL);
|
||||
pRes->pDes->GetInterface = DevexecInterface;
|
||||
return pRes;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -508,7 +529,7 @@ typedef struct {
|
||||
ExeInterest(self, pDev, "finished");
|
||||
DeleteDevEntry(pDev);
|
||||
LLDnodeDelete(self->iList);
|
||||
SCWrite(pCon, "Finished", eFinish);
|
||||
SCWrite(pCon, "", eFinish);
|
||||
iRet = LLDnodePtr2Prev(self->iList);
|
||||
if(SCGetInterrupt(self->pOwner) != eContinue)
|
||||
{
|
||||
@@ -667,7 +688,6 @@ static int errorDevice(pCheckContext pCheck){
|
||||
|
||||
ExeInterest(pCheck->self, pCheck->pDev, "finished with problem");
|
||||
DevexecLog("STOP",pCheck->pDev->name);
|
||||
DeleteDevEntry(pCheck->pDev);
|
||||
LLDnodeDelete(pCheck->self->iList);
|
||||
status = LLDnodePtr2Prev(pCheck->self->iList);
|
||||
SCWrite(pCheck->self->pOwner, "", eFinish);
|
||||
@@ -675,7 +695,9 @@ static int errorDevice(pCheckContext pCheck){
|
||||
if(pCheck->pDrivInt != NULL) {
|
||||
pCheck->pDrivInt->iErrorCount++;
|
||||
}
|
||||
return checkInterrupt(pCheck,status);
|
||||
status = checkInterrupt(pCheck,status);
|
||||
DeleteDevEntry(pCheck->pDev);
|
||||
return status;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static int testFinish(pExeList self){
|
||||
@@ -1121,7 +1143,7 @@ static int testFinish(pExeList self){
|
||||
{
|
||||
ListPending(self,pCon);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
iRet = StopExe(self,argv[1]);
|
||||
if(!iRet)
|
||||
@@ -1143,7 +1165,7 @@ static int testFinish(pExeList self){
|
||||
SCPopContext(pCon);
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int ListExe(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user