00001 // ************************************************************** 00002 // Com ++ Framework by the C++ World 00003 // Please report defects: mailto:compp@cplusplusworld.com 00004 // Please visit: http://www.cplusplusworld.com/socketlibrary.html 00005 // ************************************************************** 00006 00007 #include <iostream> 00008 00009 //#include "config.h" 00010 #include "SysPlusPlus/syscall.h" 00011 #include "ComPlusPlus/Clone.h" 00012 #include "SysPlusPlus/ComException.h" 00013 00014 00015 00019 compp::Clone::Clone() { 00020 00021 } 00022 00029 compp::Clone::Clone ( const std::string & cmd ) : Process (cmd) { 00030 00031 00032 00033 } 00034 00038 int compp::Clone::Start() { 00039 int i; 00040 switch ( i=syspp::Call::Fork() ) { 00041 case -1: { 00042 throw syspp::ComException ( "PANIC: Cannot create new Process." ); 00043 break; 00044 } 00045 case 0: { 00046 exit(Run()); 00047 break; 00048 } 00049 default: { 00050 Pid = i; 00051 Name = "Clone"; 00052 return Pid; 00053 } 00054 } 00055 } 00056 00060 compp::Clone::~Clone() { 00061 00062 if ( TerminateInDestructor ) { 00063 GracefulTerminate(); 00064 Terminate(); 00065 } 00066 00067 } 00068 00069 00073 int compp::Clone::Run ( ) { 00074 00075 return 0; // HI LINT 00076 } 00077
1.6.3