Changeset 7904

Show
Ignore:
Timestamp:
06/19/08 12:56:31 (5 years ago)
Author:
shereef
Message:

ExecutableDevice? crashes calling 'execv'; I'm in big trouble

Location:
ossiedev/branches/ssayed/devs/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/ssayed/devs/src/components/ChannelDemo/ChannelDemo.spd.xml

    r7898 r7904  
    2020        <description>Linux implementation</description>  
    2121        <code type="Executable"> 
    22             <localfile name="bin/ChannelDemo"/> 
     22            <localfile name="/../../bin/ChannelDemo"/> 
    2323        </code> 
    2424        <processor name="x86"/> 
  • ossiedev/branches/ssayed/devs/src/components/RxDemo/RxDemo.spd.xml

    r7898 r7904  
    2020        <description>Linux implementation</description>  
    2121        <code type="Executable"> 
    22             <localfile name="bin/RxDemo"/> 
     22            <localfile name="/../../bin/RxDemo"/> 
    2323        </code> 
    2424        <processor name="x86"/> 
  • ossiedev/branches/ssayed/devs/src/components/TxDemo/TxDemo.spd.xml

    r7898 r7904  
    2020        <description>Linux implementation</description>  
    2121        <code type="Executable"> 
    22             <localfile name="bin/TxDemo"/> 
     22            <localfile name="/../../bin/TxDemo"/> 
    2323        </code> 
    2424        <processor name="x86"/> 
  • ossiedev/branches/ssayed/devs/src/system/ossie/framework/ApplicationFactory_impl.cpp

    r7903 r7904  
    182182            /// \TODO Validate that the intended device supports the LoadableDevice interface 
    183183      
    184             DEBUG(1, AppFact, "loading " << component->getLocalFileName()) 
    185              
    186                         CF::FileSystem_ptr fs = CF::FileSystem::_narrow(dmnMgr->fileMgr()); 
    187             device->load (fs, component->getLocalFileName(), component->getCodeType()); 
    188              
     184        DEBUG(1, AppFact, "loading " << component->getLocalFileName()) 
     185 
     186        int idx = 0; 
     187 
     188        CF::FileManager_var fileMgr = dmnMgr->fileMgr(); 
     189 
     190        CF::FileManager::MountSequence_var mts = fileMgr->getMounts(); 
     191 
     192        for( int i = 0; i < mts->length(); i++ ) 
     193        { 
     194         try 
     195         { 
     196          if( mts[i].fs->exists( component->getLocalFileName() ) ) idx = i; 
     197         } catch( CF::InvalidFileName &_ex ) { 
     198          std::cout << "[ApplicationFactory::create] Searching for FileSys containing " << component->getLocalFileName() << "\n"; 
     199         } catch( CF::FileException &_ex ) { 
     200          std::cout << "[ApplicationFactory::create] Searching for FileSys containing " << component->getLocalFileName() << "\n"; 
     201         } catch( ... ) { 
     202         } 
     203        } 
     204     
     205        try 
     206        { 
     207         device->load (mts[idx].fs, component->getLocalFileName(), component->getCodeType()); 
     208        } catch( CF::InvalidFileName &_ex ) { 
     209         std::cout << "[ApplicationFactory::create] While loading ExecDev: " << _ex.msg << "\n"; 
     210         exit(EXIT_FAILURE); 
     211        } catch( CF::Device::InvalidState &_ex ) { 
     212         std::cout << "[ApplicationFactory::create] While loading ExecDev: " << _ex.msg << "\n"; 
     213         exit(EXIT_FAILURE); 
     214        } catch( ... ) { 
     215         std::cout << "[ApplicationFactory::create] While loading ExecDev: Unknown Exception\n"; 
     216         exit(EXIT_FAILURE); 
     217        }             
    189218            // Execute when necesary 
    190             if (component->getCodeType() == CF::LoadableDevice::EXECUTABLE 
     219       if (component->getCodeType() == CF::LoadableDevice::EXECUTABLE 
    191220                    || component->getCodeType() == CF::LoadableDevice::SHARED_LIBRARY 
    192221                    && strcmp (component->getEntryPoint(), "") != 0) { 
    193222                /// \TODO: Validate that the intended device supports the LoadableDevice interface 
    194223                 
    195                 DEBUG(1, AppFact, "executing-> " << component->getLocalFileName()) 
    196  
    197                                 CF::DataType dt; 
    198                                 dt.id = component->getIdentifier(); 
    199  
    200                                 string initial_name(""); 
     224         DEBUG(1, AppFact, "executing-> " << component->getLocalFileName()) 
     225 
     226         CF::DataType dt; 
     227         dt.id = component->getIdentifier(); 
     228 
     229         string initial_name(""); 
    201230                                 
    202                                 if (!strncmp("DomainName1", component->getNamingServiceName(), 11)) { 
    203                                         initial_name.append((component->getNamingServiceName()+12)); 
    204                                 } else { 
    205                                         initial_name.append(component->getNamingServiceName()); 
    206                                 } 
     231         if (!strncmp("DomainName1", component->getNamingServiceName(), 11))  
     232         { 
     233          initial_name.append((component->getNamingServiceName()+12)); 
     234         } else { 
     235          initial_name.append(component->getNamingServiceName()); 
     236         } 
    207237                                 
    208                                 dt.value <<= component->getNamingServiceName(); 
     238         dt.value <<= component->getNamingServiceName(); 
    209239                                         
    210                                 component->addExecParameter(&dt); 
    211                                                  
    212                                 CF::ExecutableDevice::ProcessID_Type tempPid = device-> 
    213                                                 execute (component->getLocalFileName(), 
    214                                                                  component->getOptions(), 
    215                                                                  component->getExecParameters()); 
    216  
    217                                 if (tempPid < 0) { 
    218                                         /// \TODO throw exception here 
    219                                 } else { 
    220                                         _pidSeq->length (_pidSeq->length() + 1); 
    221                                         (* _pidSeq)[_pidSeq->length() - 1].processId = tempPid; 
    222                                         (* _pidSeq)[_pidSeq->length() - 1].componentId = 
    223                                                 CORBA::string_dup(component->getIdentifier()); 
    224                                 } 
    225                                 // NOTE: The PID returned by execute is not handled 
    226                                 // An exception shall be thrown when PID = -1 
    227             } 
    228         } 
     240         component->addExecParameter(&dt); 
     241        CF::ExecutableDevice::ProcessID_Type tempPid; 
     242        try 
     243        {        
     244         tempPid = device->execute (component->getLocalFileName(), component->getOptions(), component->getExecParameters()); 
     245        } catch( CF::InvalidFileName &_ex ) { 
     246         std::cout << "[ApplicationFactory::create] When calling 'execute' on a device: " << _ex.msg << "\n"; 
     247         exit(EXIT_FAILURE); 
     248        } catch( CF::Device::InvalidState &_ex ) { 
     249         std::cout << "[ApplicationFactory::create] When calling 'execute' on a device: " << _ex.msg << "\n"; 
     250         exit(EXIT_FAILURE); 
     251        } catch( ... ) { 
     252         std::cout << "[ApplicationFactory::create] When calling 'execute' on a device: Unknown Exception\n"; 
     253         exit(EXIT_FAILURE); 
     254        } 
     255 
     256        if (tempPid < 0) { 
     257        /// \TODO throw exception here 
     258        } else { 
     259         _pidSeq->length (_pidSeq->length() + 1); 
     260         (* _pidSeq)[_pidSeq->length() - 1].processId = tempPid; 
     261         (* _pidSeq)[_pidSeq->length() - 1].componentId = 
     262         CORBA::string_dup(component->getIdentifier()); 
     263        } 
     264        // NOTE: The PID returned by execute is not handled 
     265        // An exception shall be thrown when PID = -1 
     266      } 
     267     } 
    229268    } 
    230269