Added function to kill a processor with signal 9, signature: "ccs_killpe"
authorFilippo Gioachin <gioachin@illinois.edu>
Thu, 20 Aug 2009 01:43:43 +0000 (01:43 +0000)
committerFilippo Gioachin <gioachin@illinois.edu>
Thu, 20 Aug 2009 01:43:43 +0000 (01:43 +0000)
src/conv-ccs/ccs-builtins.C

index 726fe723635e45775b0c44354c0018f837047c95..f4f7d0d8803c1bbdc49b279649f49cb07d56672b 100644 (file)
@@ -83,6 +83,16 @@ extern "C" void CcsImpl_kill(void)
   }
 }
 
+/**********************************************
+  "ccs_killpe"-- kills the executing processor
+    Used for fault-tolerance testing: terminate the processor.
+*/
+
+#include <signal.h>
+
+static void ccs_killpe(char *msg) {
+  kill(getpid(), 9);
+}
 
 /*************************************************
 List interface:
@@ -260,6 +270,7 @@ void CpdMachineArchitecture(char *msg) {
   // get the size of an "bool"
   reply[5] = sizeof(bool);
   CcsSendReply(6, (void*)reply);
+  CmiFree(msg);
 }
 
 static void CpdList_ccs_list_items_fmt(char *msg)
@@ -672,6 +683,7 @@ extern "C" void CcsBuiltinsInit(char **argv)
 {
   CcsRegisterHandler("ccs_getinfo",(CmiHandler)ccs_getinfo);
   CcsRegisterHandler("ccs_killport",(CmiHandler)ccs_killport);
+  CcsRegisterHandler("ccs_killpe",(CmiHandler)ccs_killpe);
   CWebInit();
   CpdListInit();
 }