(file) Return to SystemUnix.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/SystemUnix.cpp between version 1.56 and 1.57

version 1.56, 2003/03/19 01:37:28 version 1.57, 2003/04/10 11:45:40
Line 37 
Line 37 
 # include <dll.h> # include <dll.h>
 #elif defined(PEGASUS_PLATFORM_OS400_ISERIES_IBM) #elif defined(PEGASUS_PLATFORM_OS400_ISERIES_IBM)
 #  include <fcntl.h> #  include <fcntl.h>
 #  include <mih/rslvsp.h>            /* rslvsp()                       */  
 #  include <mih/micommon.h>          /* _AUTH_EXECUTE                  */  
 #  include <mih/miobjtyp.h>          /* WLI_SRVPGM                     */  
 #  include <pointer.h>               /* _SYSPTR                        */  
 #  include <qusec.h>                 /* Qus_EC_t                       */  
 #  include <qleawi.h>                /* QleActBndPgm(),QleGetExp()     */  
 #  include <qycmutiltyUtility.H> #  include <qycmutiltyUtility.H>
 #  include <unistd.cleinc> #  include <unistd.cleinc>
 #  include "qycmmsgclsMessage.H" // ycmMessage class #  include "qycmmsgclsMessage.H" // ycmMessage class
   #  include <Pegasus/Common/OS400SystemState.h>  // OS400LoadDynamicLibrary, etc (not in CVS)
 #else #else
 # include <dlfcn.h> # include <dlfcn.h>
 #endif #endif
Line 79 
Line 74 
 Boolean System::bindVerbose = false; Boolean System::bindVerbose = false;
 #endif #endif
  
 #if defined(PEGASUS_OS_OS400)  
 char os400ExceptionID[8] = {0};  
 #endif  
   
 inline void sleep_wrapper(Uint32 seconds) inline void sleep_wrapper(Uint32 seconds)
 { {
     sleep(seconds);     sleep(seconds);
Line 212 
Line 203 
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return DynamicLibraryHandle(dllload(fileName));     return DynamicLibraryHandle(dllload(fileName));
 #elif defined(PEGASUS_OS_OS400) #elif defined(PEGASUS_OS_OS400)
     // Activate the service program.  
   
     // Parse out the library and srvpgm names.  
     // Note: the fileName passed in must be in OS/400 form - library/srvpgm  
     if (fileName == NULL || strlen(fileName) == 0 || strlen(fileName) >= 200)  
        return 0;  
   
     // More checking here!  
     char name[200];  
     strcpy(name, fileName);  
   
     char* lib = strtok(name, "/");  
     if (lib == NULL || strlen(lib) == 0)  
        return 0;  
   
     char* srvpgm = strtok(NULL,"/");  
     if (srvpgm == NULL || strlen(srvpgm) == 0)  
        return 0;  
   
     /*----------------------------------------------------------------*/  
     /* Resolve to the service program                                 */  
     /*----------------------------------------------------------------*/  
     _OBJ_TYPE_T objectType = WLI_SRVPGM;  
     _SYSPTR sysP = rslvsp(objectType, srvpgm, lib, _AUTH_NONE);  
   
     /*----------------------------------------------------------------*/  
     /* Activate the service program                                   */  
     /*----------------------------------------------------------------*/  
     Qle_ABP_Info_t activationInfo;  
     int actInfoLen = sizeof(activationInfo);  
     int hdl;  
   
     Qus_EC_t os400ErrorCode = {0};  
     os400ErrorCode.Bytes_Provided = sizeof(Qus_EC_t);  
     os400ErrorCode.Bytes_Available = 0;  
   
     QleActBndPgm(&sysP,  
                 &hdl,  
                 &activationInfo,  
                 &actInfoLen,  
                 &os400ErrorCode);  
   
     if (os400ErrorCode.Bytes_Available)  
     {  
        // Got an error.  
        memset(os400ExceptionID, '\0', 8);  
        strncpy(os400ExceptionID, os400ErrorCode.Exception_Id, 7);  
        Tracer::trace(TRC_OS_ABSTRACTION, Tracer::LEVEL2,  
                   "Error activating service program. Exception Id = %s", os400ExceptionID);  
        return 0;  
     }  
   
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return DynamicLibraryHandle(hdl);      return DynamicLibraryHandle(OS400_LoadDynamicLibrary(fileName));
   
 #else #else
     PEG_METHOD_EXIT();     PEG_METHOD_EXIT();
     return DynamicLibraryHandle(dlopen(fileName, RTLD_NOW | RTLD_GLOBAL));     return DynamicLibraryHandle(dlopen(fileName, RTLD_NOW | RTLD_GLOBAL));
Line 286 
Line 224 
     // multiple times.  No reference count is kept.     // multiple times.  No reference count is kept.
     int ignored = shl_unload(reinterpret_cast<shl_t>(libraryHandle));     int ignored = shl_unload(reinterpret_cast<shl_t>(libraryHandle));
 #endif #endif
   
   #ifdef PEGASUS_OS_OS400
      OS400_UnloadDynamicLibrary((int)libraryHandle);
   #endif
 } }
  
 String System::dynamicLoadError() { String System::dynamicLoadError() {
Line 297 
Line 239 
 #elif defined(PEGASUS_OS_ZOS) #elif defined(PEGASUS_OS_ZOS)
     return String();     return String();
 #elif defined(PEGASUS_OS_OS400) #elif defined(PEGASUS_OS_OS400)
     return String(os400ExceptionID);      return String(OS400_DynamicLoadError());
 #else #else
     String dlerr = dlerror();     String dlerr = dlerror();
     return dlerr;     return dlerr;
Line 334 
Line 276 
                                (char*)symbolName));                                (char*)symbolName));
  
 #elif defined(PEGASUS_OS_OS400) #elif defined(PEGASUS_OS_OS400)
    /*----------------------------------------------------------------*/      return DynamicSymbolHandle(OS400_LoadDynamicSymbol((int)libraryHandle,
    /* Get procedure pointer and return it to caller                  */                                 symbolName));
    /*----------------------------------------------------------------*/  
   
     Qus_EC_t os400ErrorCode = {0};  
     os400ErrorCode.Bytes_Provided = sizeof(Qus_EC_t);  
     os400ErrorCode.Bytes_Available = 0;  
   
     int exportType;  
     int hdl = (int)libraryHandle;  
     void * procAddress = NULL;  
   
     QleGetExp(&hdl,  
              0,  
              0,  
              (char *)symbolName,  
              &procAddress,  
              &exportType,  
              &os400ErrorCode);  
   
     if (os400ErrorCode.Bytes_Available)  
     {  
       // Got an error.  
        memset(os400ExceptionID, '\0', 8);  
        strncpy(os400ExceptionID, os400ErrorCode.Exception_Id, 7);  
        Tracer::trace(TRC_OS_ABSTRACTION, Tracer::LEVEL2,  
                   "Error getting export. Exception Id = %s", os400ExceptionID);  
        return 0;  
     }  
   
     return DynamicSymbolHandle(procAddress);  
   
 #else #else
  
     return DynamicSymbolHandle(dlsym(libraryHandle, (char*)symbolName));     return DynamicSymbolHandle(dlsym(libraryHandle, (char*)symbolName));


Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2