Logo Search packages:      
Sourcecode: condor version File versions  Download package

PidEnvID * DaemonCore::InfoEnvironmentID ( PidEnvID *  penvid,
int  pid = -1 
)

Returns a pointer to the penvid passed in if successful in determining the environment id for the pid, or NULL if unable to determine.

Parameters:
pid The pid to ask about. -1 (Default) means the calling process
penvid Address of a structure to be filled in with the environment id of the pid. Left in undefined state after function call.

Definition at line 1028 of file daemon_core.cpp.

{
      extern char **environ;

      if (penvid == NULL) {
            return NULL;
      }

      /* just in case... */
      pidenvid_init(penvid);

      /* handle the base case of my own pid */
      if ( pid == -1 ) {

            if (pidenvid_filter_and_insert(penvid, environ) == 
                  PIDENVID_OVERSIZED)
            {
                  EXCEPT( "DaemonCore::InfoEnvironmentID: Programmer error. "
                        "Tried to overstuff a PidEntryID array." );
            }

      } else {

            // If someone else was asked for, give them the info for that pid.
            PidEntry *pidinfo = NULL;
            if ((pidTable->lookup(pid, pidinfo) < 0)) {
                  // we have no information on this pid
                  return NULL;
            }

            // copy over the information to the passed in array
            pidenvid_copy(penvid, &pidinfo->penvid);
      }

      return penvid;
}


Generated by  Doxygen 1.6.0   Back to index