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

Diff for /pegasus/src/Pegasus/Common/Executor.cpp between version 1.15 and 1.16

version 1.15, 2008/01/29 18:45:05 version 1.16, 2008/02/04 12:21:58
Line 40 
Line 40 
 #if defined(PEGASUS_OS_TYPE_WINDOWS) #if defined(PEGASUS_OS_TYPE_WINDOWS)
 # include <windows.h> # include <windows.h>
 #else #else
   # include <spawn.h>
 # include <unistd.h> # include <unistd.h>
   # include <errno.h>
 # include <sys/types.h> # include <sys/types.h>
 # include <sys/time.h> # include <sys/time.h>
 # include <sys/resource.h> # include <sys/resource.h>
Line 208 
Line 210 
         AnonymousPipe*& readPipe,         AnonymousPipe*& readPipe,
         AnonymousPipe*& writePipe)         AnonymousPipe*& writePipe)
     {     {
           PEG_METHOD_ENTER(TRC_SERVER,"ExecutorLoopbackImpl::startProviderAgent");
 #if !defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) #if !defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION)
  
 # if defined(PEGASUS_OS_TYPE_WINDOWS) # if defined(PEGASUS_OS_TYPE_WINDOWS)
Line 270 
Line 273 
             &siStartInfo,  //  STARTUPINFO             &siStartInfo,  //  STARTUPINFO
             &piProcInfo))  //  PROCESS_INFORMATION             &piProcInfo))  //  PROCESS_INFORMATION
         {         {
               PEG_METHOD_EXIT();
             return -1;             return -1;
         }         }
  
Line 284 
Line 288 
         readPipe = pipeFromAgent.release();         readPipe = pipeFromAgent.release();
         writePipe = pipeToAgent.release();         writePipe = pipeToAgent.release();
  
           PEG_METHOD_EXIT();
         return 0;         return 0;
  
 # else /* POSIX CASE FOLLOWS */ # else /* POSIX CASE FOLLOWS */
Line 301 
Line 306 
         int to[2];         int to[2];
         int from[2];         int from[2];
  
   #  if defined(PEGASUS_OS_ZOS)
           // zOS is using __spawn2() instead of frok()
           struct __inheritance inherit;
           const char *c_argv[5];
           char arg1[32];
           char arg2[32];
   
   #  endif
   
         do         do
         {         {
             // Resolve full path of "cimprovagt".             // Resolve full path of "cimprovagt".
Line 318 
Line 332 
                 if (!System::lookupUserId(                 if (!System::lookupUserId(
                          userName.getCString(), newUid, newGid))                          userName.getCString(), newUid, newGid))
                 {                 {
                     PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL2,                      PEG_TRACE((TRC_SERVER, Tracer::LEVEL2,
                         "System::lookupUserId(%s) failed.",                          "System::lookupUserId(%s) for provider user "
                               "context failed.",
                         (const char*)userName.getCString()));                         (const char*)userName.getCString()));
                       PEG_METHOD_EXIT();
                     return -1;                     return -1;
                 }                 }
             }             }
Line 330 
Line 346 
             // Create "to-agent" pipe:             // Create "to-agent" pipe:
  
             if (pipe(to) != 0)             if (pipe(to) != 0)
               {
                   PEG_METHOD_EXIT();
                 return -1;                 return -1;
               }
   
  
             // Create "from-agent" pipe:             // Create "from-agent" pipe:
  
             if (pipe(from) != 0)             if (pipe(from) != 0)
               {
                   PEG_METHOD_EXIT();
                 return -1;                 return -1;
               }
   
               // Start provider agent:
   
   #  if defined(PEGASUS_OS_ZOS)
               // zOS is using __spawn2() to start provider agent
               sprintf(arg1, "%d", to[0]);
               sprintf(arg2, "%d", from[1]);
   
               CString program_name = path.getCString();
  
             // Fork process:              c_argv[0] = program_name;
               c_argv[1] = arg1;
               c_argv[2] = arg2;
               c_argv[3] = module;
               c_argv[4] = NULL;
   
               // reset the inherit structure
               memset(&inherit,0,sizeof(inherit));
   
               // The provider agent should get a defined JobName.
               inherit.flags=SPAWN_SETJOBNAME;
               memcpy( inherit.jobname,"CFZOOPA ",
                       sizeof(inherit.jobname));
   
               CString program = path.getCString();
   
               PEG_TRACE((TRC_SERVER, Tracer::LEVEL4,
                          "Starting provider agent: %s %s %s %s %s",
                          program,program_name,arg1,arg2,module));
  
 #  if defined(PEGASUS_OS_VMS)              pid = __spawn2(program,0,NULL,&inherit,
                              c_argv,(const char **)environ);
   
               if (pid < 0)
               {
                   PEG_TRACE((TRC_SERVER, Tracer::LEVEL4,
                       "Spawn of provider agent fails:%s "
                           "( errno %d , reason code %08X )",
                       strerror(errno) ,errno,__errno2()));
                   PEG_METHOD_EXIT();
                   return -1;
               }
   
   #  elif defined(PEGASUS_OS_VMS)
             pid = (int)vfork();             pid = (int)vfork();
 # elif defined(PEGASUS_OS_PASE) # elif defined(PEGASUS_OS_PASE)
             pid = (int)fork400("QUMEPRVAGT",0);             pid = (int)fork400("QUMEPRVAGT",0);
Line 347 
Line 410 
             pid = (int)fork();             pid = (int)fork();
 #  endif #  endif
  
   #  if !defined(PEGASUS_OS_ZOS)
   
             if (pid < 0)             if (pid < 0)
               {
                   PEG_TRACE((TRC_SERVER, Tracer::LEVEL4,
                        "Fork for provider agent fails: errno = %d",errno));
                   PEG_METHOD_EXIT();
                 return -1;                 return -1;
               }
  
             // If child proceses.             // If child proceses.
   
             if (pid == 0)             if (pid == 0)
             {             {
 #  if !defined(PEGASUS_OS_VMS) #  if !defined(PEGASUS_OS_VMS)
Line 377 
Line 446 
  
 #  endif /* !defined(PEGASUS_OS_VMS) */ #  endif /* !defined(PEGASUS_OS_VMS) */
  
 #  if !defined(PEGASUS_DISABLE_PROV_USERCTXT) && !defined(PEGASUS_OS_ZOS)  #   if !defined(PEGASUS_DISABLE_PROV_USERCTXT)
  
                 // Set uid and gid for the new provider agent process.                 // Set uid and gid for the new provider agent process.
  
Line 403 
Line 472 
                     CString cstr = path.getCString();                     CString cstr = path.getCString();
                     if (execl(cstr, cstr, arg1, arg2, module, (char*)0) == -1)                     if (execl(cstr, cstr, arg1, arg2, module, (char*)0) == -1)
                     {                     {
                         PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL2,                          PEG_TRACE((TRC_SERVER, Tracer::LEVEL2,
                             "execl() failed.  errno = %d.", errno));                             "execl() failed.  errno = %d.", errno));
                         _exit(1);                         _exit(1);
                     }                     }
                 }                 }
             }             }
   #  else  /* PEGASUS_OS_ZOS */
               if (pid > 0)
               {
                   PEG_TRACE((TRC_SERVER, Tracer::LEVEL4,
                        "Provider agent started suggessfully: Pid(%d).",pid));
                   break;
               }
   #endif /* PEGASUS_OS_ZOS */
   
         }         }
         while (0);         while (0);
  
Line 433 
Line 511 
         readPipe = new AnonymousPipe(readFdStr, 0);         readPipe = new AnonymousPipe(readFdStr, 0);
         writePipe = new AnonymousPipe(0, writeFdStr);         writePipe = new AnonymousPipe(0, writeFdStr);
  
           PEG_METHOD_EXIT();
         return 0;         return 0;
  
 # endif /* POSIX CASE */ # endif /* POSIX CASE */


Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2