// -----------------------------------------------------------------------
//
// ComRtGetProgramInfo()
//
// Outputs:
// 1) the pathname of the directory where the application program
//    is being run from.
//    For OSS processes, this will be the fully qualified oss directory
//      pathname.
//    For Guardian processes, pathname is not set
// 2) the process type (oss or guardian).
// 3) Other output values are: cpu, pin, nodename, nodename Len, processCreateTime
//       and processNameString in the format <\node_name>.<cpu>,<pin>
//
// // Return status:      0, if all ok. <errnum>, in case of an error.
//
// -----------------------------------------------------------------------
Lng32 ComRtGetProgramInfo(char * pathName,    /* out */
			 Lng32 pathNameMaxLen,
			 short  &processType,/* out */
			 Int32  &cpu, /* cpu */
			 pid_t  &pin, /* pin */
			 Lng32   &nodeNumber,
			 char * nodeName, // GuaNodeNameMaxLen+1
			 short  &nodeNameLen,
			 Int64  &processCreateTime,
			 char *processNameString,
			 char *parentProcessNameString
#ifdef SQ_PHANDLE_VERIFIER
                         , SB_Verif_Type *verifier
#endif
)
{
  Lng32 retcode = 0;

  processType = 2;
  strcpy(nodeName, "NSK");
  nodeNameLen = strlen("NSK");
  NAProcessHandle myPhandle;
  myPhandle.getmine();
  myPhandle.decompose();
  cpu = myPhandle.getCpu();
  pin = myPhandle.getPin();
#ifdef SQ_PHANDLE_VERIFIER
  if (verifier)
    *verifier = myPhandle.getSeqNum();
#endif

  // Map the node number to cpu
  nodeNumber = cpu;
  strcpy(processNameString, myPhandle.getPhandleString());
  MS_Mon_Process_Info_Type processInfo;
  if ((retcode = msg_mon_get_process_info_detail(
     processNameString, &processInfo))
                        != XZFIL_ERR_OK)
     return retcode;
  processCreateTime = ComRtGetJulianFromUTC(processInfo.creation_time);
  if (processInfo.parent_nid != -1 && 
      processInfo.parent_pid != -1 && parentProcessNameString)
    strcpy(parentProcessNameString, processInfo.parent_name);
  else
    parentProcessNameString = NULL;
  return retcode;
}