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

Diff for /pegasus/src/Server/cimserver.cpp between version 1.185 and 1.200

version 1.185, 2006/06/30 13:24:33 version 1.200, 2007/06/05 10:22:40
Line 29 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Mike Brasher (mbrasher@bmc.com)  
 //  
 // Modified By: Mike Day (mdday@us.ibm.com)  
 //              Karl Schopmeyer (k.schopmeyer@opengroup.org)  
 //              Nag Boranna (nagaraja_boranna@hp.com)  
 //              Jenny Yu (jenny_yu@hp.com)  
 //              Sushma Fernandes (sushma_fernandes@hp.com)  
 //              Carol Ann Krug Graves, Hewlett-Packard Company  
 //                  (carolann_graves@hp.com)  
 //              Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)  
 //              Dave Rosckes (rosckes@us.ibm.com)  
 //              Humberto Rivero (hurivero@us.ibm.com)  
 //              Steve Hills (steve.hills@ncr.com)  
 //              Sean Keenan, Hewlett-Packard Company (sean.keenan@hp.com)  
 //              Amit K Arora, IBM (amitarora@in.ibm.com) - pep 167  
 //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2555  
 //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#2032  
 //              Heather Sterling, IBM (hsterl@us.ibm.com) - PEP#222  
 //              Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#3452  
 //              David Dillard, VERITAS Software Corp.  
 //                  (david.dillard@veritas.com)  
 //              Aruran, IBM (aruran.shanmug@in.ibm.com) for Bug# 4183, 4937  
 //              Thilo Boehm, IBM (tboehm@de.ibm.com)  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
  
Line 100 
Line 76 
 // Alternatively, you can use the windows service manager. Pegasus shows up // Alternatively, you can use the windows service manager. Pegasus shows up
 // in the service database as "Pegasus CIM Object Manager" // in the service database as "Pegasus CIM Object Manager"
 // //
 // Mike Day, mdday@us.ibm.com  
 //  
 ////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
  
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/Constants.h> #include <Pegasus/Common/Constants.h>
 #include <Pegasus/Common/PegasusAssert.h> #include <Pegasus/Common/PegasusAssert.h>
 #include <cstdlib>  
 #include <Pegasus/Common/FileSystem.h> #include <Pegasus/Common/FileSystem.h>
 #include <Pegasus/Common/Monitor.h> #include <Pegasus/Common/Monitor.h>
 #include <Pegasus/Common/PegasusVersion.h> #include <Pegasus/Common/PegasusVersion.h>
Line 118 
Line 91 
 #include <Pegasus/Common/LanguageParser.h> #include <Pegasus/Common/LanguageParser.h>
 #include <Pegasus/Config/ConfigManager.h> #include <Pegasus/Config/ConfigManager.h>
 #include <Pegasus/Client/CIMClient.h> #include <Pegasus/Client/CIMClient.h>
 #include <Pegasus/Server/ShutdownService.h>  
 #include <Pegasus/Server/CIMServer.h> #include <Pegasus/Server/CIMServer.h>
 #include <Service/ServerProcess.h> #include <Service/ServerProcess.h>
   #include <Service/ServerShutdownClient.h>
 #if defined(PEGASUS_OS_OS400)  #include <Service/ServerRunStatus.h>
 #  include "vfyptrs.cinc"  
 #  include "OS400ConvertChar.h"  
 #endif  
  
 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
 #include <Service/ARM_zOS.h> #include <Service/ARM_zOS.h>
   # ifdef PEGASUS_ZOS_SECURITY
   // This include file will not be provided in the OpenGroup CVS for now.
   // Do NOT try to include it in your compile
   #  include <Pegasus/Common/safCheckzOS_inline.h>
   # endif
 #endif #endif
  
 #if defined(PEGASUS_OS_TYPE_UNIX) #if defined(PEGASUS_OS_TYPE_UNIX)
 # if defined(PEGASUS_OS_OS400)  
 #  include <unistd.cleinc>  
 # else  
 #  include <unistd.h> #  include <unistd.h>
 # endif  
 # include <sys/types.h> # include <sys/types.h>
 # include <sys/stat.h> # include <sys/stat.h>
 # include <fcntl.h> # include <fcntl.h>
 #endif #endif
  
   #ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION
   # define PEGASUS_PROCESS_NAME "cimservermain"
   #else
   # define PEGASUS_PROCESS_NAME "cimserver"
   #endif
   
   #include <Pegasus/Common/Executor.h>
   
 PEGASUS_USING_PEGASUS; PEGASUS_USING_PEGASUS;
 PEGASUS_USING_STD; PEGASUS_USING_STD;
  
 #define PEGASUS_PROCESS_NAME "cimserver";  
   
 //Windows service variables are not defined elsewhere in the product //Windows service variables are not defined elsewhere in the product
 //enable ability to override these //enable ability to override these
 #ifndef PEGASUS_SERVICE_NAME #ifndef PEGASUS_SERVICE_NAME
Line 220 
Line 196 
     void cimserver_stop(void);     void cimserver_stop(void);
 }; };
  
   ServerRunStatus _serverRunStatus(
       PEGASUS_PROCESS_NAME, PEGASUS_CIMSERVER_START_FILE);
 AutoPtr<CIMServerProcess> _cimServerProcess(new CIMServerProcess()); AutoPtr<CIMServerProcess> _cimServerProcess(new CIMServerProcess());
 static CIMServer* _cimServer = 0; static CIMServer* _cimServer = 0;
 static Monitor* _monitor = 0; static Monitor* _monitor = 0;
Line 257 
Line 235 
  
 /** GetOptions function - This function defines the Options Table /** GetOptions function - This function defines the Options Table
     and sets up the options from that table using the config manager.     and sets up the options from that table using the config manager.
   
       Some possible exceptions:  NoSuchFile, FileNotReadable, CannotRenameFile,
       ConfigFileSyntaxError, UnrecognizedConfigProperty, InvalidPropertyValue,
       CannotOpenFile.
 */ */
 void GetOptions( void GetOptions(
     ConfigManager* cm,     ConfigManager* cm,
     int& argc,     int& argc,
     char** argv)      char** argv,
 {      Boolean shutdownOption)
     try  
     {  
         cm->mergeConfigFiles();  
   
         cm->mergeCommandLine(argc, argv);  
     }  
     catch (NoSuchFile&)  
     {  
         throw;  
     }  
     catch (FileNotReadable&)  
     {  
         throw;  
     }  
     catch (CannotRenameFile&)  
     {  
         throw;  
     }  
     catch (ConfigFileSyntaxError&)  
     {  
         throw;  
     }  
     catch(UnrecognizedConfigProperty&)  
     {     {
         throw;      if (shutdownOption)
     }  
     catch(InvalidPropertyValue&)  
     {     {
         throw;          cm->loadConfigFiles();
     }     }
     catch (CannotOpenFile&)      else
     {     {
         throw;          cm->mergeConfigFiles();
     }     }
   
       // Temporarily disable updates to the current configuration
       // file if shutdownOption is true
       cm->useConfigFiles = (shutdownOption==false);
   
       cm->mergeCommandLine(argc, argv);
   
       // Enable updates again
       cm->useConfigFiles = true;
 } }
  
 /* PrintHelp - This is temporary until we expand the options manager to allow /* PrintHelp - This is temporary until we expand the options manager to allow
Line 383 
Line 349 
 // needed to localize the exceptions thrown during CIM request processing. // needed to localize the exceptions thrown during CIM request processing.
 // Note: This function should never be called! // Note: This function should never be called!
 // //
 PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL dummyThreadFunc(void *parm)  ThreadReturnType PEGASUS_THREAD_CDECL dummyThreadFunc(void *parm)
 { {
    return((PEGASUS_THREAD_RETURN)0);     return((ThreadReturnType)0);
 } }
  
 //  #ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION
 //  Waits until either the CIM Server has terminated, or the shutdown timeout  
 //  has expired.  If the shutdown timeout has expired, and the CIM Server is  
 //  still running, kills the cimserver process.  
 //  
 void _waitForTerminationOrTimeout (Uint32 maxWaitTime)  
 {  
     //  
     //  If the CIM Server is still running, and the shutdown timeout has not  
     //  expired, loop and wait one second until either the CIM Server has  
     //  terminated, or the shutdown timeout has expired  
     //  
     Boolean running = _cimServerProcess->isCIMServerRunning ();  
     while (running && (maxWaitTime > 0))  
     {  
         System::sleep (1);  
         running = _cimServerProcess->isCIMServerRunning ();  
         maxWaitTime--;  
     }  
  
     //  static int _extractExecutorSockOpt(int& argc, char**& argv)
     //  If the shutdown timeout has expired, and the CIM Server is still  
     //  running, kill the cimserver process  
     //  
     if (running)  
     {     {
         int kill_rc = _cimServerProcess->cimserver_kill (0);      // Extract the "--executor-socket <sock>" option if any. This indicates
       // that the e[x]ecutor is running. The option argument is the socket used
       // to communicate with the executor. Remove the option from the
       // argv list and decrease argc by two.
  
 #ifdef PEGASUS_OS_OS400      int sock = -1;
         if (kill_rc == -1)      const char OPT[] = "--executor-socket";
   
       for (int i = 1; i < argc; i++)
         {         {
             _cimServerProcess->cimserver_exitRC (2);          if (strcmp(argv[i], OPT) == 0)
         }          {
         _cimServerProcess->cimserver_exitRC (1);              // Check for missing option argument.
 #endif  
  
 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU) \              if (i + 1 == argc)
 || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_SOLARIS) \  
 || defined (PEGASUS_OS_VMS)  
         if (kill_rc != -1)  
         {         {
             //l10n - TODO                  MessageLoaderParms parms(
             Logger::put_l (Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,                      "src.Server.cimserver.MISSING_OPTION_ARGUMENT",
                 "src.Server.cimserver.TIMEOUT_EXPIRED_SERVER_KILLED",                      "Missing argument for $0 option.",
                 "Shutdown timeout expired.  Forced shutdown initiated.");                      OPT);
             MessageLoaderParms parms                  cerr << argv[0] << ": " << MessageLoader::getMessage(parms) <<
                 ("src.Server.cimserver.TIMEOUT_EXPIRED_SERVER_KILLED",                      endl;
                 "Shutdown timeout expired.  Forced shutdown initiated.");                  exit(1);
             cout << MessageLoader::getMessage(parms) << endl;  
             exit (0);  
         }  
 #endif  
     }  
 } }
  
 void shutdownCIMOM(Uint32 timeoutValue)              // Convert argument to positive integer.
 {  
     //  
     // Create CIMClient object  
     //  
     CIMClient client;  
  
     //              char* end;
     // Get local host name              unsigned long x = strtoul(argv[i+1], &end, 10);
     //  
     String hostStr = System::getHostName();  
  
     //              // Check whether option argument will fit in a signed integer.
     // open connection to CIMOM  
     //  
     try  
     {  
         client.connectLocal();  
  
         //              if (*end != '\0' || x > 2147483647)
         // set client timeout to 2 seconds  
         //  
         client.setTimeout(2000);  
     }  
     catch(Exception&)  
     {     {
 #ifdef PEGASUS_OS_OS400                  MessageLoaderParms parms(
     //l10n                      "src.Server.cimserver.BAD_OPTION_ARGUMENT",
     //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,                      "Bad $0 option argument: $1.",
             //"Unable to connect to CIM Server.  CIM Server may not be running." );                      OPT,
     Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,                      argv[i+1]);
             "src.Server.cimserver.UNABLE_CONNECT_SERVER_MAY_NOT_BE_RUNNING",                  cerr << argv[0] << ": " << MessageLoader::getMessage(parms) <<
             "Unable to connect to CIM Server.  CIM Server may not be running." );                      endl;
     // The server job may still be active but not responding.  
     // Kill the job if it exists.  
     if(_cimServerProcess->cimserver_kill(0) == -1)  
        _cimServerProcess->cimserver_exitRC(2);  
     _cimServerProcess->cimserver_exitRC(1);  
 #else  
         //l10n  
         //PEGASUS_STD(cerr) << "Unable to connect to CIM Server." << PEGASUS_STD(endl);  
         //PEGASUS_STD(cerr) << "CIM Server may not be running." << PEGASUS_STD(endl);  
         MessageLoaderParms parms("src.Server.cimserver.UNABLE_CONNECT_SERVER_MAY_NOT_BE_RUNNING",  
                                                          "Unable to connect to CIM Server.\nCIM Server may not be running.\n");  
         PEGASUS_STD(cerr) << MessageLoader::getMessage(parms);  
         exit(1);         exit(1);
 #endif  
     }     }
  
     try              sock = int(x);
     {  
         //  
         // construct CIMObjectPath  
         //  
         String referenceStr = "//";  
         referenceStr.append(hostStr);  
         referenceStr.append("/");  
         referenceStr.append(PEGASUS_NAMESPACENAME_SHUTDOWN.getString());  
         referenceStr.append(":");  
         referenceStr.append(PEGASUS_CLASSNAME_SHUTDOWN.getString());  
         CIMObjectPath reference(referenceStr);  
   
         //  
         // issue the invokeMethod request on the shutdown method  
         //  
         Array<CIMParamValue> inParams;  
         Array<CIMParamValue> outParams;  
   
         // set force option to true for now  
         inParams.append(CIMParamValue("force",  
             CIMValue(Boolean(true))));  
  
         inParams.append(CIMParamValue("timeout",              // Remove "-x <sock>" from argv-argc.
             CIMValue(Uint32(timeoutValue))));  
  
         CIMValue retValue = client.invokeMethod(              memmove(argv + i, argv + i + 2, sizeof(char*) * (argc - i - 1));
             PEGASUS_NAMESPACENAME_SHUTDOWN,              argc -= 2;
             reference,              break;
             "shutdown",  
             inParams,  
             outParams);  
     }  
     catch(CIMException& e)  
     {  
 #ifdef PEGASUS_OS_OS400  
   
     if (e.getCode() == CIM_ERR_INVALID_NAMESPACE)  
     {  
         //l10n  
         //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
             //"Failed to shutdown server: $0", "The repository may be empty.");  
         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
             "src.Server.cimserver.SHUTDOWN_FAILED_REPOSITORY_EMPTY",  
             "Error in server shutdown: The repository may be empty.");  
     }  
     else  
     {  
         //l10n  
         //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
             //"Failed to shutdown server: $0", e.getMessage());  
         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
             "src.Server.cimserver.SHUTDOWN_FAILED",  
             "Error in server shutdown: $0", e.getMessage());  
     }     }
     // Kill the server job.  
     if(_cimServerProcess->cimserver_kill(0) == -1)  
        _cimServerProcess->cimserver_exitRC(2);  
 #else  
         //l10n - TODO  
         MessageLoaderParms parms("src.Server.cimserver.SHUTDOWN_FAILED",  
                                  "Error in server shutdown: ");  
         PEGASUS_STD(cerr) << MessageLoader::getMessage(parms);  
         if (e.getCode() == CIM_ERR_INVALID_NAMESPACE)  
         {  
             //  
             // Repository may be empty.  
             //  
             //l10n - TODO  
             Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
                 "src.Server.cimserver.SHUTDOWN_FAILED_REPOSITORY_EMPTY",  
                 "Error in server shutdown: The repository may be empty.");  
             MessageLoaderParms parms("src.Server.cimserver.REPOSITORY_EMPTY",  
                                      "The repository may be empty.");  
             PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);  
         }  
         else  
         {  
             //l10n - TODO  
             Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
                 "src.Server.cimserver.SHUTDOWN_FAILED",  
                 "Error in server shutdown: $0", e.getMessage());  
             PEGASUS_STD(cerr) << e.getMessage() << PEGASUS_STD(endl);  
         }         }
  
     // Kill the cimserver process      if (sock == -1)
     if (_cimServerProcess->cimserver_kill(0) == 0)  
         {         {
             //l10n - TODO          MessageLoaderParms parms(
             Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,              "src.Server.cimserver.MISSING_OPTION",
                 "src.Server.cimserver.SERVER_FORCED_SHUTDOWN",              "Missing $0 option.",
             "Forced shutdown initiated.");              OPT);
             MessageLoaderParms parms("src.Server.cimserver.SERVER_FORCED_SHUTDOWN",          cerr << argv[0] << ": " << MessageLoader::getMessage(parms) << endl;
                                      "Forced shutdown initiated.");  
             PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);  
         }  
         exit(1);         exit(1);
 #endif  
     }  
     catch(Exception&)  
     {  
         //  
         // This may mean that the CIM Server has terminated, causing this  
         // client to get a "Empty HTTP response message" exception.  It may  
         // also mean that the CIM Server is taking longer than 2 seconds  
         // (client timeout value) to terminate, causing this client to  
         // timeout with a "connection timeout" exception.  
         //  
         //  Wait until either the CIM Server has terminated, or the shutdown  
         //  timeout has expired.  If the timeout has expired and the CIM Server  
         //  is still running, kill the cimserver process.  
         //  
         _waitForTerminationOrTimeout (timeoutValue - 2);  
     }     }
  
     //      return sock;
     //  InvokeMethod succeeded.  
     //  Wait until either the CIM Server has terminated, or the shutdown  
     //  timeout has expired.  If the timeout has expired and the CIM Server  
     //  is still running, kill the cimserver process.  
     //  
     _waitForTerminationOrTimeout (timeoutValue);  
     return;  
 } }
  
   #endif /* PEGASUS_ENABLE_PRIVILEGE_SEPARATION */
  
 ///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
 //  MAIN //  MAIN
 ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
   
 int main(int argc, char** argv) int main(int argc, char** argv)
 { {
     String pegasusHome  = String::EMPTY;      String pegasusHome;
     Boolean shutdownOption = false;     Boolean shutdownOption = false;
     Boolean debugOutputOption = false;     Boolean debugOutputOption = false;
  
Line 637 
Line 447 
 setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
 #endif #endif
  
 #ifdef PEGASUS_OS_OS400  
   
   VFYPTRS_INCDCL;               // VFYPTRS local variables  
   
   // verify pointers  
   #pragma exception_handler (qsyvp_excp_hndlr,qsyvp_excp_comm_area,\  
     0,_C2_MH_ESCAPE)  
     for( int arg_index = 1; arg_index < argc; arg_index++ ){  
     VFYPTRS(VERIFY_SPP_NULL(argv[arg_index]));  
     }  
   #pragma disable_handler  
   
     // Convert the args to ASCII  
     for(Uint32 i = 0;i< argc;++i)  
     {  
     EtoA(argv[i]);  
     }  
   
     // Initialize Pegasus home to the shipped OS/400 directory.  
     pegasusHome = OS400_DEFAULT_PEGASUS_HOME;  
 #endif  
   
   
 #ifndef PEGASUS_OS_TYPE_WINDOWS #ifndef PEGASUS_OS_TYPE_WINDOWS
     //     //
     // Get environment variables:     // Get environment variables:
     //     //
 #ifdef PEGASUS_OS_OS400  
 #pragma convert(37)  
     const char* tmp = getenv("PEGASUS_HOME");  
 #pragma convert(0)  
     char home[256] = {0};  
     if (tmp && strlen(tmp) < 256)  
     {  
     strcpy(home, tmp);  
     EtoA(home);  
     pegasusHome = home;  
     }  
 #else  
   #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_USE_RELEASE_DIRS)   #if defined(PEGASUS_OS_AIX) && defined(PEGASUS_USE_RELEASE_DIRS)
     pegasusHome = AIX_RELEASE_PEGASUS_HOME;     pegasusHome = AIX_RELEASE_PEGASUS_HOME;
   #elif !defined(PEGASUS_USE_RELEASE_DIRS) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)   #elif !defined(PEGASUS_USE_RELEASE_DIRS) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
Line 686 
Line 461 
         pegasusHome = tmp;         pegasusHome = tmp;
     }     }
   #endif   #endif
 #endif  
  
     FileSystem::translateSlashes(pegasusHome);     FileSystem::translateSlashes(pegasusHome);
 #else #else
Line 696 
Line 470 
   pegasusHome = _cimServerProcess->getHome();   pegasusHome = _cimServerProcess->getHome();
 #endif #endif
  
   #ifdef PEGASUS_ENABLE_PRIVILEGE_SEPARATION
   
       // If invoked with "--executor-socket <socket>" option, then use executor.
   
       Executor::setSock(_extractExecutorSockOpt(argc, argv));
   
       // Ping executor to verify the specified socket is valid.
   
       if (Executor::ping() != 0)
       {
           MessageLoaderParms parms("src.Server.cimserver.EXECUTOR_PING_FAILED",
               "Failed to ping the executor on the specified socket.");
           cerr << argv[0] << ": " << MessageLoader::getMessage(parms) << endl;
           exit(1);
       }
   
   #endif /* !defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) */
   
         // Get help, version, and shutdown options         // Get help, version, and shutdown options
  
         for (int i = 1; i < argc; )         for (int i = 1; i < argc; )
Line 850 
Line 642 
     Boolean shutdownOption,     Boolean shutdownOption,
     Boolean debugOutputOption)     Boolean debugOutputOption)
 { {
     String logsDirectory = String::EMPTY;      String logsDirectory;
     Boolean daemonOption = false;     Boolean daemonOption = false;
  
     //     //
Line 859 
Line 651 
     configManager = ConfigManager::getInstance();     configManager = ConfigManager::getInstance();
     configManager->useConfigFiles = true;     configManager->useConfigFiles = true;
  
 #ifdef PEGASUS_OS_OS400  
     // In a special startup case for IBM OS400, when the server is  
     // automatically started when the machine starts up the config  
     // file cannot be read because of access restrictions for the  
     // user starting the server.  In this case, we need to skip  
     // reading the config options and therefore any use of the config  
     // manager also.  To make this determinations we will check to see  
     // if the daemon flag is set to true.  If so, then there will be a  
     // series of checks to bracket all the calls to the configManager  
     // which would otherwise fail.  All this will only be done for  
     // IBM OS400.  
   
     Boolean os400StartupOption = false;  
     // loop through args to check for daemon=true  
     for (int i=1; i < argc; i++)  
       if (strcmp(argv[i], "daemon=true") == 0)  
       {  
         os400StartupOption = true;  
         daemonOption = true;  
       }  
   
     if (!os400StartupOption)  
     {  
         // If this is the server job, then set the job  
         // to save the job log.  
         system ("QSYS/CHGJOB JOB(*) LOG(4 00 *SECLVL)");  
     }  
 #endif  
   
     //     //
     // Get options (from command line and from configuration file); this     // Get options (from command line and from configuration file); this
     // removes corresponding options and their arguments from the command     // removes corresponding options and their arguments from the command
Line 895 
Line 658 
     //     //
     try     try
     {     {
 #ifdef PEGASUS_OS_OS400          // If current process is "cimserver -s" (shutdown option = true) the contents
     if (os400StartupOption == false)          // of current config should not be overwriten by planned config
 #endif          GetOptions(configManager, argc, argv, shutdownOption);
         GetOptions(configManager, argc, argv);  
     }     }
     catch (Exception& e)     catch (Exception& e)
     {     {
Line 906 
Line 668 
             "src.Server.cimserver.SERVER_NOT_STARTED",             "src.Server.cimserver.SERVER_NOT_STARTED",
             "cimserver not started:  $0", e.getMessage());             "cimserver not started:  $0", e.getMessage());
  
 #if !defined(PEGASUS_OS_OS400)  
         MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",         MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",
             "cimserver not started: $0", e.getMessage());             "cimserver not started: $0", e.getMessage());
  
         PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)         PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)
             << PEGASUS_STD(endl);             << PEGASUS_STD(endl);
 #endif  
  
         return(1);         return(1);
     }     }
Line 924 
Line 684 
     MessageLoader::setPegasusMsgHome(ConfigManager::getHomedPath(     MessageLoader::setPegasusMsgHome(ConfigManager::getHomedPath(
         ConfigManager::getInstance()->getCurrentValue("messageDir")));         ConfigManager::getInstance()->getCurrentValue("messageDir")));
  
 #ifdef PEGASUS_OS_OS400      Boolean enableHttpConnection = ConfigManager::parseBooleanValue(
     // Still need to declare and set the connection variables.          configManager->getCurrentValue("enableHttpConnection"));
     // Will initialize to false since they are fixed at false for OS400.      Boolean enableHttpsConnection = ConfigManager::parseBooleanValue(
           configManager->getCurrentValue("enableHttpsConnection"));
     // NOTE:  OS400 is a LOCAL_DOMAIN_SOCKET, so a few lines down  
     // the test will not be compiled in.  If OS400 ever turns off that  
     // define, then we will need to change this code path to insure that  
     // one of the variables is true.  
     Boolean enableHttpConnection = false;  
     Boolean enableHttpsConnection = false;  
     Boolean enableSSLExportClientVerification = false;  
   
     if (os400StartupOption == false)  
     {  
       enableHttpConnection = String::equal(  
           configManager->getCurrentValue("enableHttpConnection"), "true");  
       enableHttpsConnection = String::equal(  
           configManager->getCurrentValue("enableHttpsConnection"), "true");  
       enableSSLExportClientVerification = String::equal(  
           configManager->getCurrentValue("enableSSLExportClientVerification"), "true");  
     }  
 #else  
     Boolean enableHttpConnection = String::equal(  
         configManager->getCurrentValue("enableHttpConnection"), "true");  
     Boolean enableHttpsConnection = String::equal(  
         configManager->getCurrentValue("enableHttpsConnection"), "true");  
     Boolean enableSSLExportClientVerification = String::equal(  
         configManager->getCurrentValue("enableSSLExportClientVerification"), "true");  
 #endif  
  
     // Make sure at least one connection is enabled     // Make sure at least one connection is enabled
 #ifdef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET #ifdef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
Line 977 
Line 712 
     try     try
     {     {
         //         //
         // Check to see if we should Pegasus as a daemon          // Check to see if we should start Pegasus as a daemon
         //         //
  
         if (String::equal(configManager->getCurrentValue("daemon"), "true"))          daemonOption = ConfigManager::parseBooleanValue(
         {              configManager->getCurrentValue("daemon"));
             daemonOption = true;  
         }  
  
 #ifdef PEGASUS_OS_OS400  
     if (os400StartupOption == false)  
     {  
 #endif  
         // Get the log file directory definition.  
         // We put String into Cstring because  
         // Directory functions only handle Cstring.  
         // ATTN-KS: create String based directory functions.  
 #if !defined(PEGASUS_USE_SYSLOGS) #if !defined(PEGASUS_USE_SYSLOGS)
                 // When using syslog facility. No files anymore.  
         logsDirectory = configManager->getCurrentValue("logdir");  
         logsDirectory =         logsDirectory =
         ConfigManager::getHomedPath(configManager->getCurrentValue("logdir"));         ConfigManager::getHomedPath(configManager->getCurrentValue("logdir"));
 #endif #endif
 #ifdef PEGASUS_OS_OS400  
     }  // end if (os400StartupOption == false)  
 #endif  
  
         // Set up the Logger. This does not open the logs         // Set up the Logger. This does not open the logs
         // Might be more logical to clean before set.         // Might be more logical to clean before set.
         // ATTN: Need tool to completely disable logging.         // ATTN: Need tool to completely disable logging.
  
 #if !defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) && \ #if !defined(PEGASUS_OS_HPUX) && !defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) && \
 !defined(PEGASUS_OS_OS400) && !defined(PEGASUS_USE_SYSLOGS)  !defined(PEGASUS_USE_SYSLOGS)
         Logger::setHomeDirectory(logsDirectory);         Logger::setHomeDirectory(logsDirectory);
 #endif #endif
  
Line 1020 
Line 740 
             String configTimeout =             String configTimeout =
                 configManager->getCurrentValue("shutdownTimeout");                 configManager->getCurrentValue("shutdownTimeout");
             Uint32 timeoutValue = strtol(configTimeout.getCString(), (char **)0, 10);             Uint32 timeoutValue = strtol(configTimeout.getCString(), (char **)0, 10);
   // To deregister Pegasus with SLP
   #ifdef PEGASUS_SLP_REG_TIMEOUT
               unregisterPegasusFromSLP();
   #endif
  
             shutdownCIMOM(timeoutValue);              ServerShutdownClient serverShutdownClient(&_serverRunStatus);
               serverShutdownClient.shutdown(timeoutValue);
  
 #ifdef PEGASUS_OS_OS400              MessageLoaderParms parms(
         //l10n  
         //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,  
             //"CIM Server stopped.");  
         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION,  
             "src.Server.cimserver.SERVER_STOPPED",             "src.Server.cimserver.SERVER_STOPPED",
             "CIM Server stopped.");             "CIM Server stopped.");
             cimserver_exitRC(0);  
 #else  
             //l10n  
             //cout << "CIM Server stopped." << endl;  
             MessageLoaderParms parms("src.Server.cimserver.SERVER_STOPPED",  
                                      "CIM Server stopped.");  
  
             cout << MessageLoader::getMessage(parms) << endl;             cout << MessageLoader::getMessage(parms) << endl;
             return(0);             return(0);
 #endif  
         }         }
  
 #if defined(PEGASUS_DEBUG)  #if defined(PEGASUS_DEBUG) && !defined(PEGASUS_USE_SYSLOGS)
         // Leave this in until people get familiar with the logs.         // Leave this in until people get familiar with the logs.
         //l10n  
         //cout << "Logs Directory = " << logsDirectory << endl;  
 #if !defined(PEGASUS_USE_SYSLOGS)  
         MessageLoaderParms parms("src.Server.cimserver.LOGS_DIRECTORY",         MessageLoaderParms parms("src.Server.cimserver.LOGS_DIRECTORY",
                                  "Logs Directory = ");                                  "Logs Directory = ");
         cout << MessageLoader::getMessage(parms) << logsDirectory << endl;         cout << MessageLoader::getMessage(parms) << logsDirectory << endl;
 #endif #endif
 #endif  
     }     }
     catch (UnrecognizedConfigProperty& e)     catch (UnrecognizedConfigProperty& e)
     {     {
           // UnrecognizedConfigProperty is already translated
 #ifdef PEGASUS_OS_OS400          // thus, just output the message
     //l10n          Logger::put(Logger::ERROR_LOG,
     //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,                      System::CIMSERVER,
             //"Error: $0",e.getMessage());                      Logger::SEVERE,
     Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
             "src.Server.cimserver.ERROR",  
             "Error: $0",e.getMessage());  
 #else  
     //l10n  
     //cout << "Error: " << e.getMessage() << endl;  
     MessageLoaderParms parms("src.Server.cimserver.ERROR",  
                              "Error: $0",  
                              e.getMessage());                              e.getMessage());
     cout << MessageLoader::getMessage(parms) << endl;          cout << e.getMessage() << endl;
 #endif      }
       catch (Exception& ex)
       {
           Logger::put(Logger::ERROR_LOG,
                         System::CIMSERVER,
                         Logger::SEVERE,
                         ex.getMessage());
           cout << ex.getMessage() << endl;
           exit(1);
     }     }
  
   #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) && defined(PEGASUS_ZOS_SECURITY)
       startupCheckBPXServer(true);
       startupCheckProfileCIMSERVclassWBEM();
       startupEnableMSC();
   #endif
   
     // Bug 2148 - Here is the order of operations for determining the server HTTP and HTTPS ports.     // Bug 2148 - Here is the order of operations for determining the server HTTP and HTTPS ports.
     // 1) If the user explicitly specified a port, use it.     // 1) If the user explicitly specified a port, use it.
     // 2) If the user did not specify a port, get the port from the services file.     // 2) If the user did not specify a port, get the port from the services file.
Line 1108 
Line 824 
                 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,                 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
                               "src.Server.cimserver.SERVER_NOT_STARTED",                               "src.Server.cimserver.SERVER_NOT_STARTED",
                               "cimserver not started:  $0", e.getMessage());                               "cimserver not started:  $0", e.getMessage());
 #if !defined(PEGASUS_OS_OS400)  
                 MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",                 MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",
                                          "cimserver not started: $0", e.getMessage());                                          "cimserver not started: $0", e.getMessage());
                 PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)                 PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)
                                   << PEGASUS_STD(endl);                                   << PEGASUS_STD(endl);
 #endif  
                 exit(1);                 exit(1);
             }             }
         }         }
Line 1143 
Line 857 
                 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,                 Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
                               "src.Server.cimserver.SERVER_NOT_STARTED",                               "src.Server.cimserver.SERVER_NOT_STARTED",
                               "cimserver not started:  $0", e.getMessage());                               "cimserver not started:  $0", e.getMessage());
 #if !defined(PEGASUS_OS_OS400)  
                 MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",                 MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",
                                              "cimserver not started: $0", e.getMessage());                                              "cimserver not started: $0", e.getMessage());
                 PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)                 PEGASUS_STD(cerr) << argv[0] << ": " << MessageLoader::getMessage(parms)
                                   << PEGASUS_STD(endl);                                   << PEGASUS_STD(endl);
 #endif  
                 exit(1);                 exit(1);
             }             }
         }         }
     }     }
   
   
     if (enableSSLExportClientVerification)  
     {  
         //  
         // No config property is looked up to get the default port number.  
         // Lookup the port defined in /etc/services for the service name  
         // wbem-exp-https and bind to that port. If the service is  not defined  
         // then log a warning message and do not start the cimserver.  
         //  
         Uint32 port = 0;  
   
         portNumberExportHttps = System::lookupPort(WBEM_EXPORT_HTTPS_SERVICE_NAME, port);  
   
         if (portNumberExportHttps == 0)  
         {  
             Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,  
                 "src.Server.cimserver.EXPORT_HTTPS_PORT_NOT_DEFINED",  
                 "Port not defined for the service wbem-exp-https. CIMServer will not be started.");  
   
             MessageLoaderParms parms("src.Server.cimserver.EXPORT_HTTPS_PORT_NOT_DEFINED",  
                 "Port not defined for the service wbem-exp-https. CIMServer will not be started.");  
   
             cerr << MessageLoader::getMessage(parms) << endl;  
   
             return(1);  
         }  
     }  
 #if defined(PEGASUS_DEBUG) #if defined(PEGASUS_DEBUG)
     // Put out startup up message.     // Put out startup up message.
     cout << _cimServerProcess->getProductName() << " " << _cimServerProcess->getCompleteVersion() << endl;     cout << _cimServerProcess->getProductName() << " " << _cimServerProcess->getCompleteVersion() << endl;
Line 1199 
Line 883 
 //l10n //l10n
  
     // Get the parent's PID before forking     // Get the parent's PID before forking
     _cimServerProcess->set_parent_pid(System::getPID());      _serverRunStatus.setParentPid(System::getPID());
  
     // do we need to run as a daemon ?  // Do not fork when using privilege separation (executor will daemonize itself
   // later).
     if (daemonOption)     if (daemonOption)
     {     {
         if(-1 == _cimServerProcess->cimserver_fork())         if(-1 == _cimServerProcess->cimserver_fork())
 #ifndef PEGASUS_OS_OS400  
     {  
         return(-1);  
     }  
 #else  
     {  
             return(-1);             return(-1);
     }  
     else     else
     {  
         return(0);         return(0);
     }     }
 #endif  
   
     }  
  
 // l10n // l10n
     // Now we are after the fork...     // Now we are after the fork...
Line 1243 
Line 917 
                              e.getMessage());                              e.getMessage());
     }     }
  
   
   
 #ifdef PEGASUS_OS_OS400  
     // Special server initialization code for OS/400.  
     if (cimserver_initialize() != 0)  
     {  
     // do some logging here!  
     //l10n  
     //Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
             //"CIM Server failed to initialize");  
     Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
                   "src.Server.cimserver.SERVER_FAILED_TO_INITIALIZE",  
                   "CIM Server failed to initialize");  
     return(-1);  
     }  
 #endif  
   
 #ifndef PEGASUS_OS_TYPE_WINDOWS #ifndef PEGASUS_OS_TYPE_WINDOWS
     umask(S_IRWXG|S_IRWXO);     umask(S_IRWXG|S_IRWXO);
 #endif #endif
Line 1293 
Line 950 
     // if CIMServer is already running, print message and     // if CIMServer is already running, print message and
     // notify parent process (if there is a parent process) to terminate     // notify parent process (if there is a parent process) to terminate
     //     //
     if(_cimServerProcess->isCIMServerRunning())      if (_serverRunStatus.isServerRunning())
     {     {
     //l10n          MessageLoaderParms parms(
         //cout << "Unable to start CIMServer." << endl;              "src.Server.cimserver.UNABLE_TO_START_SERVER_ALREADY_RUNNING",
         //cout << "CIMServer is already running." << endl;              "Unable to start CIMServer. CIMServer is already running.");
         MessageLoaderParms parms("src.Server.cimserver.UNABLE_TO_START_SERVER_ALREADY_RUNNING",          PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) <<
                      "Unable to start CIMServer.\nCIMServer is already running.");              PEGASUS_STD(endl);
     PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);          Logger::put(Logger::ERROR_LOG,System::CIMSERVER,Logger::INFORMATION,
               MessageLoader::getMessage(parms));
  
     //     //
         // notify parent process (if there is a parent process) to terminate         // notify parent process (if there is a parent process) to terminate
         //         //
         if (daemonOption)         if (daemonOption)
           {
                 _cimServerProcess->notify_parent(1);                 _cimServerProcess->notify_parent(1);
           }
  
         return(1);          return 1;
     }     }
  
 #endif #endif
Line 1316 
Line 976 
     // try loop to bind the address, and run the server     // try loop to bind the address, and run the server
     try     try
     {     {
   
     _monitor  = new Monitor();     _monitor  = new Monitor();
     //PEP#222  
     //CIMServer server(&monitor);  
     //CimserverHolder cimserverHolder( &server );  
     _cimServer = new CIMServer(_monitor);     _cimServer = new CIMServer(_monitor);
  
   
         if (enableHttpConnection)         if (enableHttpConnection)
         {         {
             _cimServer->addAcceptor(false, portNumberHttp, false, false);              _cimServer->addAcceptor(false, portNumberHttp, false);
             //l10n  
             //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,  
                         //"Listening on HTTP port $0.", portNumberHttp);  
  
             Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,              Logger::put_l(
                   Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
                             "src.Server.cimserver.LISTENING_ON_HTTP_PORT",                             "src.Server.cimserver.LISTENING_ON_HTTP_PORT",
                             "Listening on HTTP port $0.", portNumberHttp);                             "Listening on HTTP port $0.", portNumberHttp);
         }         }
   
         if (enableHttpsConnection)         if (enableHttpsConnection)
         {         {
             _cimServer->addAcceptor(false, portNumberHttps, true, false);              _cimServer->addAcceptor(false, portNumberHttps, true);
             //l10n  
             //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,              Logger::put_l(
                         //"Listening on HTTPS port $0.", portNumberHttps);                  Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
             Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,  
                             "src.Server.cimserver.LISTENING_ON_HTTPS_PORT",                             "src.Server.cimserver.LISTENING_ON_HTTPS_PORT",
                             "Listening on HTTPS port $0.", portNumberHttps);                             "Listening on HTTPS port $0.", portNumberHttps);
         }         }
         if (enableSSLExportClientVerification)  
         {  
             _cimServer->addAcceptor(false, portNumberExportHttps, true, true);  
   
             Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,  
                 "src.Server.cimserver.LISTENING_ON_EXPORT_HTTPS_PORT",  
                 "Listening on Export HTTPS port $0.", portNumberExportHttps);  
         }  
  
 #ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET #ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
         _cimServer->addAcceptor(true, 0, false, false);          _cimServer->addAcceptor(true, 0, false);
         //l10n  
         //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,          Logger::put_l(
                     //"Listening on local connection socket.");              Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
         Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,  
               "src.Server.cimserver.LISTENING_ON_LOCAL",               "src.Server.cimserver.LISTENING_ON_LOCAL",
               "Listening on local connection socket.");               "Listening on local connection socket.");
 #endif #endif
Line 1367 
Line 1011 
 #if defined(PEGASUS_DEBUG) #if defined(PEGASUS_DEBUG)
         if (enableHttpConnection)         if (enableHttpConnection)
         {         {
             //l10n              MessageLoaderParms parms(
             //cout << "Listening on HTTP port " << portNumberHttp << endl;                  "src.Server.cimserver.LISTENING_ON_HTTP_PORT",
       MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_HTTP_PORT",  
                    "Listening on HTTP port $0.", portNumberHttp);                    "Listening on HTTP port $0.", portNumberHttp);
             cout << MessageLoader::getMessage(parms) << endl;             cout << MessageLoader::getMessage(parms) << endl;
         }         }
         if (enableHttpsConnection)         if (enableHttpsConnection)
         {         {
             //l10n              MessageLoaderParms parms(
             //cout << "Listening on HTTPS port " << portNumberHttps << endl;                  "src.Server.cimserver.LISTENING_ON_HTTPS_PORT",
             MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_HTTPS_PORT",  
                      "Listening on HTTPS port $0.", portNumberHttps);                      "Listening on HTTPS port $0.", portNumberHttps);
             cout << MessageLoader::getMessage(parms) << endl;             cout << MessageLoader::getMessage(parms) << endl;
         }         }
         if (enableSSLExportClientVerification)  
         {  
             MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_EXPORT_HTTPS_PORT",  
                 "Listening on Export HTTPS port $0.", portNumberExportHttps);  
   
             cout << MessageLoader::getMessage(parms) << endl;  
         }  
  
 # ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET # ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
         //l10n          MessageLoaderParms parms(
         //cout << "Listening on local connection socket" << endl;              "src.Server.cimserver.LISTENING_ON_LOCAL",
         MessageLoaderParms parms("src.Server.cimserver.LISTENING_ON_LOCAL",  
                  "Listening on local connection socket.");                  "Listening on local connection socket.");
         cout << MessageLoader::getMessage(parms) << endl;         cout << MessageLoader::getMessage(parms) << endl;
 # endif # endif
 #endif #endif
  
         // bind throws an exception if the bind fails  
         try {  
            _cimServer->bind();            _cimServer->bind();
         } catch (const BindFailedException &e)  
         {  
 #ifdef PEGASUS_DEBUG  
         MessageLoaderParms parms("src.Server.cimserver.BIND_FAILED",  
                  "Could not bind: $0.", e.getMessage());  
         cout << MessageLoader::getMessage(parms) << endl;  
 #endif  
         Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,  
             "src.Server.cimserver.BIND.FAILED",  
             "Could not bind:  $0", e.getMessage());  
  
            deleteCIMServer();  
            return 1;  
         }  
     // notify parent process (if there is a parent process) to terminate     // notify parent process (if there is a parent process) to terminate
         // so user knows that there is cimserver ready to serve CIM requests.         // so user knows that there is cimserver ready to serve CIM requests.
     if (daemonOption)     if (daemonOption)
           {
   #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
               Executor::daemonizeExecutor();
   #else
         _cimServerProcess->notify_parent(0);         _cimServerProcess->notify_parent(0);
   #endif
           }
  
     time_t last = 0;  #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) || \
       defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_AIX) || \
 #if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_OS_LINUX) || defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) \      defined(PEGASUS_OS_SOLARIS) || defined(PEGASUS_OS_VMS)
     || defined(PEGASUS_OS_AIX) || defined(PEGASUS_OS_SOLARIS) \  
     || defined(PEGASUS_OS_VMS)  
         //         //
         // create a file to indicate that the cimserver has started and         // create a file to indicate that the cimserver has started and
         // save the process id of the cimserver process in the file         // save the process id of the cimserver process in the file
         //         //
         // remove the old file if it exists          _serverRunStatus.setServerRunning();
         System::removeFile(_cimServerProcess->getPIDFileName());  
   
         // open the file  
         FILE *pid_file = fopen(_cimServerProcess->getPIDFileName(), "w");  
   
         if (pid_file)  
         {  
             // save the pid in the file  
             fprintf(pid_file, "%ld\n", _cimServerProcess->get_server_pid());  
             fclose(pid_file);  
         }  
 #endif #endif
  
 #if defined(PEGASUS_DEBUG) #if defined(PEGASUS_DEBUG)
Line 1469 
Line 1081 
             Logger::INFORMATION,             Logger::INFORMATION,
             "src.Server.cimserver.STARTED_VERSION",             "src.Server.cimserver.STARTED_VERSION",
             "Started $0 version $1.",             "Started $0 version $1.",
                       _cimServerProcess->getProductName(), _cimServerProcess->getCompleteVersion());              _cimServerProcess->getProductName(),
               _cimServerProcess->getCompleteVersion());
  
 #if defined(PEGASUS_OS_TYPE_UNIX)  #if defined(PEGASUS_OS_TYPE_UNIX) && !defined(PEGASUS_OS_ZOS)
         if (daemonOption && !debugOutputOption)         if (daemonOption && !debugOutputOption)
         {         {
             // Direct standard input, output, and error to /dev/null,             // Direct standard input, output, and error to /dev/null,
Line 1498 
Line 1111 
  
 #endif #endif
  
   
   
         //         //
         // Loop to call CIMServer's runForever() method until CIMServer         // Loop to call CIMServer's runForever() method until CIMServer
         // has been shutdown         // has been shutdown
Line 1538 
Line 1149 
         //         //
 #endif #endif
     }     }
     catch(Exception& e)      catch(BindFailedException& e)
     {     {
           Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
               "src.Server.cimserver.SERVER_NOT_STARTED",
               "cimserver not started:  $0", e.getMessage());
           MessageLoaderParms parms("src.Server.cimserver.SERVER_NOT_STARTED",
               "cimserver not started: $0", e.getMessage());
  
     //l10n          cerr << MessageLoader::getMessage(parms) << endl;
     //Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,  
             //"Error: $0", e.getMessage());      //
           // notify parent process (if there is a parent process) to terminate
           //
           if (daemonOption)
                   _cimServerProcess->notify_parent(1);
   
           deleteCIMServer();
           return 1;
       }
       catch(Exception& e)
       {
     Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,     Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING,
             "src.Server.cimserver.ERROR",             "src.Server.cimserver.ERROR",
             "Error: $0", e.getMessage());             "Error: $0", e.getMessage());
   
 #ifndef PEGASUS_OS_OS400  
     //l10n  
     //PEGASUS_STD(cerr) << "Error: " << e.getMessage() << PEGASUS_STD(endl);  
     MessageLoaderParms parms("src.Server.cimserver.ERROR",     MessageLoaderParms parms("src.Server.cimserver.ERROR",
                              "Error: $0", e.getMessage());                              "Error: $0", e.getMessage());
     PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);     PEGASUS_STD(cerr) << MessageLoader::getMessage(parms) << PEGASUS_STD(endl);
   
 #endif  
   
     //     //
         // notify parent process (if there is a parent process) to terminate         // notify parent process (if there is a parent process) to terminate
         //         //
Line 1570 
Line 1189 
     deleteCIMServer();     deleteCIMServer();
     return 0;     return 0;
 } }
   
   
   
   


Legend:
Removed from v.1.185  
changed lines
  Added in v.1.200

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2