Merged 2.4 branch

r2828 | ffr | 2009-11-25 09:56:49 +1100 (Wed, 25 Nov 2009) | 2 lines
This commit is contained in:
Ferdi Franceschini
2009-11-25 09:56:49 +11:00
committed by Douglas Clowes
parent c58ee9fbcb
commit 2ec6505ef8
71 changed files with 2237 additions and 1528 deletions

View File

@@ -19,6 +19,7 @@
#include "sicsvar.h"
#define SICS_SUID "sics_suid"
pICallBack statemon_cbinterface = NULL;
/*==========================================================================*/
typedef struct __STATEMON {
pObjectDescriptor pDes;
@@ -132,6 +133,14 @@ static int StateInterest(int iEvent, void *pEvent, void *pUser,
snprintf(buffer,255,"FINISH = %s", device);
SCWriteInContext(pCon,buffer,eWarning,cc);
}
if(iEvent == STPAUSE){
snprintf(buffer,255,"PAUSE = %s", device);
SCWriteInContext(pCon,buffer,eWarning,cc);
}
if(iEvent == STCONTINUE){
snprintf(buffer,255,"CONTINUE = %s", device);
SCWriteInContext(pCon,buffer,eWarning,cc);
}
}
return 1;
}
@@ -272,6 +281,7 @@ int StateMonFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
memset(pNew,0,sizeof(StateMon));
pNew->pDes = CreateDescriptor("statemon");
pNew->pCall = CreateCallBackInterface();
statemon_cbinterface = pNew->pCall;
if(pNew->pDes == NULL || pNew->pCall == NULL){
SCWrite(pCon,"ERROR: out of memory creating StateMon",eError);
return 0;
@@ -334,6 +344,12 @@ int StateMonAction(SConnection *pCon, SicsInterp *pSics, void *pData,
lID = RegisterCallback(self->pCall, SCGetContext(pCon),STEND, StateInterest,
pCon, NULL);
SCRegister(pCon,pSics, self->pCall,lID);
lID = RegisterCallback(self->pCall, SCGetContext(pCon),STPAUSE, StateInterest,
pCon, NULL);
SCRegister(pCon,pSics, self->pCall,lID);
lID = RegisterCallback(self->pCall, SCGetContext(pCon),STCONTINUE, StateInterest,
pCon, NULL);
SCRegister(pCon,pSics, self->pCall,lID);
SCSendOK(pCon);
return 1;
} else if(strcmp(argv[1],"uninterest") == 0) {
@@ -369,7 +385,22 @@ int StateMonAction(SConnection *pCon, SicsInterp *pSics, void *pData,
return 1;
}
return 0;
}
} else if(strcmp(argv[1],"pause") == 0) {
if(argc > 2){
InvokeCallBack(self->pCall,STPAUSE,argv[2]);
SCSendOK(pCon);
return 1;
}
return 0;
} else if(strcmp(argv[1],"continue") == 0) {
if(argc > 2){
InvokeCallBack(self->pCall,STCONTINUE,argv[2]);
SCSendOK(pCon);
return 1;
}
return 0;
}
SCWrite(pCon,"ERROR: keyword not recognized",eError);
return 0;