예제 #1
0
파일: cmd.job.c 프로젝트: fudanyi/openlava
struct loadIndexLog *
initLoadIndex(void)
{
    int i;
    struct lsInfo *lsInfo;
    static struct loadIndexLog loadIndex;
    static char *defNames[] = {"r15s", "r1m", "r15m", "ut", "pg", "io", "ls",
			       "it", "swp", "mem", "tmp"};
    static char **names;

    TIMEIT(1, (lsInfo = ls_info()), "ls_info");
    if (lsInfo == NULL) {
	loadIndex.nIdx = 11;
	loadIndex.name = defNames;
    } else {
	loadIndex.nIdx = lsInfo->nRes;
        if (!names)
            if(!(names = malloc(lsInfo->nRes * sizeof(char *)))) {
                lserrno=LSE_MALLOC;
                ls_perror("initLoadIndex");
                return NULL;
	    }
	for (i = 0; i < loadIndex.nIdx; i++)
	    names[i] = lsInfo->resTable[i].name;
	loadIndex.name = names;
    }
    return (&loadIndex);
}
예제 #2
0
static void
prtResourcesShort(int num, struct lsbSharedResourceInfo  *info)
{
    struct lsInfo *lsInfo;
    int i, j, k;
    char *buf1, *buf2, *buf3, *buf4;

    if ((lsInfo = ls_info()) == NULL) {
        ls_perror("lsinfo");
        exit(-10);
    }

    buf1 = putstr_(_i18n_msg_get(ls_catd,NL_SETN,1645, "RESOURCE")); /* catgets 1645 */
    buf2 = putstr_(_i18n_msg_get(ls_catd,NL_SETN,1646, "TOTAL"));  /* catgets  1646 */
    buf3 = putstr_(_i18n_msg_get(ls_catd,NL_SETN,1647, "RESERVED")); /* catgets 1647 */
    buf4 = putstr_(_i18n_msg_get(ls_catd,NL_SETN,1648, "LOCATION")); /* catgets 1648 */

    printf("%-20s%10s%15s%15s\n", buf1, buf2, buf3, buf4);

    FREEUP(buf1);
    FREEUP(buf2);
    FREEUP(buf3);
    FREEUP(buf4);

    
    for (i = 0; i < num; i++) {
        for (j = 0; j < info[i].nInstances; j++)  {
           

            for (k = 0; k < lsInfo->nRes; k++) {
                if (strcmp(lsInfo->resTable[k].name, 
                           info[i].resourceName) == 0) {

                    if (lsInfo->resTable[k].valueType & LS_NUMERIC) {
                         prtOneInstance(info[i].resourceName,
                                          &(info[i].instances[j]));
                    }
                }
            }
        }
    }

} 
예제 #3
0
void
displayShareResource (int argc, char **argv, int index, int flag, int extflag)
{
  int i, j, k, numRes = 0;
  struct lsSharedResourceInfo *lsResourceInfo;
  struct lsInfo *lsInfo;
  char **resources = NULL, **resourceNames = NULL;
  int firstFlag = 1;

  if ((lsInfo = ls_info ()) == NULL)
    {
      ls_perror ("lsinfo");
      exit (-10);
    }

  if (argc > index)
    {
      if ((resourceNames =
	   (char **) malloc ((argc - index) * sizeof (char *))) == NULL)
	{
	  lserrno = LSE_MALLOC;
	  ls_perror ("lshosts");
	  exit (-1);
	}
      numRes = getResourceNames (argc, argv, index, resourceNames);
    }

  if (numRes > 0)
    resources = resourceNames;

  TIMEIT (0,
	  (lsResourceInfo =
	   ls_sharedresourceinfo (resources, &numRes, NULL, 0)),
	  "ls_sharedresourceinfo");

  if (lsResourceInfo == NULL)
    {
      ls_perror ("ls_sharedresourceinfo");
      exit (-1);
    }



  for (k = 0; k < numRes; k++)
    {

      for (i = 0; i < lsResourceInfo[k].nInstances; i++)
	{


	  for (j = 0; j < lsInfo->nRes; j++)
	    {

	      if (!extflag)
		if (lsInfo->resTable[j].flags & RESF_EXTERNAL)
		  continue;

	      if (strcmp (lsInfo->resTable[j].name,
			  lsResourceInfo[k].resourceName) == 0)
		{
		  if (flag == TRUE)
		    {
		      if (!(lsInfo->resTable[j].flags & RESF_DYNAMIC))
			{

			  if (firstFlag)
			    {
			      firstFlag = 0;
			      prtTableHeader ();
			    }
			  prtOneInstance (lsResourceInfo[k].resourceName,
					  &(lsResourceInfo[k].instances[i]));
			}
		    }
		  else
		    {
		      if (lsInfo->resTable[j].flags & RESF_DYNAMIC)
			{

			  if (firstFlag)
			    {
			      firstFlag = 0;
			      prtTableHeader ();
			    }
			  prtOneInstance (lsResourceInfo[k].resourceName,
					  &(lsResourceInfo[k].instances[i]));
			}
		    }
		}
	    }
	}
    }
  if (firstFlag)
    {
      if (flag)
	printf (_i18n_msg_get (ls_catd, NL_SETN, 753, "No static shared resources defined \n"));	/* catgets 753 */
      else
	printf (_i18n_msg_get (ls_catd, NL_SETN, 754, "No dynamic shared resources defined \n"));	/* catgets 754 */
    }
  FREEUP (resourceNames);
}
예제 #4
0
static int
makeShare (char *hostname, char ***nameTable, char ***valueTable,
	   char ***formatTable, int (*resourceSelect) (struct resItem *))
{
  static int first = TRUE;
  static struct lsSharedResourceInfo *resourceInfo;
  static struct lsInfo *lsInfo;
  static char **namTable;
  static char **valTable;
  static char **fmtTable;
  static int numRes, nRes;
  int k, i, j;
  char *hPtr;
  int ii, numHosts, found;

  if (first == TRUE)
    {
      if ((lsInfo = ls_info ()) == NULL)
	{
	  return (-1);
	}

      TIMEIT (0,
	      (resourceInfo =
	       ls_sharedresourceinfo (NULL, &numRes, NULL, 0)),
	      "ls_sharedresourceinfo");

      if (resourceInfo == NULL)
	{
	  return (-1);
	}
      if ((namTable = (char **) malloc (numRes * sizeof (char *))) == NULL)
	{
	  lserrno = LSE_MALLOC;
	  return (-1);
	}
      if ((valTable = (char **) malloc (numRes * sizeof (char *))) == NULL)
	{
	  lserrno = LSE_MALLOC;
	  return (-1);
	}
      if ((fmtTable = (char **) malloc (numRes * sizeof (char *))) == NULL)
	{
	  lserrno = LSE_MALLOC;
	  return (-1);
	}
      first = FALSE;
    }
  else
    {

      for (i = 0; i < nRes; i++)
	{
	  FREEUP (fmtTable[i]);
	}
    }

  nRes = 0;
  for (k = 0; k < numRes; k++)
    {
      found = FALSE;
      for (j = 0; j < lsInfo->nRes; j++)
	{
	  if (strcmp (lsInfo->resTable[j].name,
		      resourceInfo[k].resourceName) == 0)
	    {
	      if (resourceSelect (&lsInfo->resTable[j]))
		{
		  found = TRUE;
		  break;
		}
	      break;
	    }
	}
      if (!found)
	{
	  continue;
	}
      namTable[nRes] = resourceInfo[k].resourceName;
      found = FALSE;
      for (i = 0; i < resourceInfo[k].nInstances; i++)
	{
	  numHosts = resourceInfo[k].instances[i].nHosts;
	  for (ii = 0; ii < numHosts; ii++)
	    {
	      hPtr = resourceInfo[k].instances[i].hostList[ii];
	      if (strcmp (hPtr, hostname) == 0)
		{
		  valTable[nRes] = resourceInfo[k].instances[i].value;
		  found = TRUE;
		  break;
		}
	    }
	  if (found)
	    {
	      break;
	    }
	}
      if (!found)
	{
	  valTable[nRes] = "-";
	}
      nRes++;
    }
  if (nRes)
    {
      j = 0;
      for (i = 0; i < nRes; i++)
	{
	  char fmt[16];
	  int nameLen;

	  nameLen = strlen (namTable[i]);
	  sprintf (fmt, "%s%d.%d%s", "%", nameLen + 2, nameLen + 1, "s");
	  fmtTable[j++] = putstr_ (fmt);
	}
    }
  *nameTable = namTable;
  *valueTable = valTable;
  *formatTable = fmtTable;
  return (nRes);
}
예제 #5
0
static void
prtHostsLong (int numReply, struct hostInfoEnt  *hInfo)
{
    struct hostInfoEnt *hPtr;
    int i, j, retVal = 0;
    char *status, maxJobs[MAX_CHARLEN], userJobLimit[MAX_CHARLEN];
    char **nameTable, **totalValues, **rsvValues, **formats;
    struct lsInfo *lsInfo;
   
    if ((lsInfo = ls_info()) == NULL) {
	ls_perror("ls_info");
	exit(-1);
    }
    
    lsInfoPtr = lsInfo;

    for (i = 0; i < numReply; i++) {
	hPtr = &(hInfo[i]);
        if (repeatHost (i, hInfo))
            continue;
	printf("%s  %s\n",
		(_i18n_msg_get(ls_catd,NL_SETN,1604, "HOST")), /* catgets  1604  */
		hPtr->host); 

	
        prtWord(HOST_STATUS_LENGTH, I18N_STATUS, 0);

	if (lsbMode_ & LSB_MODE_BATCH) {
            prtWord(HOST_CPUF_LENGTH, I18N_CPUF, -1);
            prtWord(HOST_JL_U_LENGTH, I18N_JL_U, -1);
	};

            prtWord(HOST_MAX_LENGTH,   I18N_MAX, -1);
            prtWord(HOST_NJOBS_LENGTH, I18N_NJOBS, -1);
            prtWord(HOST_RUN_LENGTH,   I18N_RUN, -1);
            prtWord(HOST_SSUSP_LENGTH, I18N_SSUSP, -1);
            prtWord(HOST_USUSP_LENGTH, I18N_USUSP, -1);
            prtWord(HOST_RSV_LENGTH,   I18N_RSV, -1);

	if (lsbMode_ & LSB_MODE_BATCH)
	    printf(I18N(1608, "DISPATCH_WINDOW\n")); /* catgets  1608  */
	else
	    printf("\n");
	
	status = I18N_ok; 
	if (hPtr->hStatus & HOST_STAT_UNAVAIL)
	    status = I18N_unavail; 
	else if (hPtr->hStatus & HOST_STAT_UNREACH)
	    status = (_i18n_msg_get(ls_catd,NL_SETN,1611, "unreach")); /* catgets  1611  */
      
        else if (hPtr->hStatus & (HOST_STAT_BUSY
                                             | HOST_STAT_WIND
                                             | HOST_STAT_DISABLED
                                             | HOST_STAT_EXCLUSIVE
                                             | HOST_STAT_LOCKED
                                             | HOST_STAT_LOCKED_MASTER
                                             | HOST_STAT_FULL
                                             | HOST_STAT_NO_LIM)) 
            getCloseString (hPtr->hStatus, &status);

	if (hPtr->userJobLimit < INFINIT_INT)   
            strcpy(userJobLimit, 
                   prtValue(HOST_JL_U_LENGTH, hPtr->userJobLimit));
        else 
            strcpy(userJobLimit,  prtDash(HOST_JL_U_LENGTH));

        if ( hPtr->maxJobs < INFINIT_INT )
            strcpy(maxJobs,
                   prtValue(HOST_MAX_LENGTH, hPtr->maxJobs));
        else 
            strcpy(maxJobs,  prtDash(HOST_MAX_LENGTH));

        prtWordL(HOST_STATUS_LENGTH, status);

	if (lsbMode_ & LSB_MODE_BATCH) {
            sprintf(fomt, "%%%d.2f %%s", HOST_CPUF_LENGTH );
	    printf(fomt, hPtr->cpuFactor, userJobLimit);
	};


            sprintf(fomt, "%%s%%%dd %%%dd %%%dd %%%dd %%%dd ", 
                                  HOST_NJOBS_LENGTH,
                                  HOST_RUN_LENGTH,
                                  HOST_SSUSP_LENGTH,
                                  HOST_USUSP_LENGTH,
                                  HOST_RSV_LENGTH);
            
            printf(fomt,
                   maxJobs, hPtr->numJobs, hPtr->numRUN, 
		   hPtr->numSSUSP, hPtr->numUSUSP, hPtr->numRESERVE);

	if (lsbMode_ & LSB_MODE_BATCH)	    
	    printf("%s\n\n",	
		   hPtr->windows[0] != '\0' ? hPtr->windows : "     -");
	else
	    printf("\n\n");	    

	if (!(hPtr->hStatus & (HOST_STAT_UNAVAIL | HOST_STAT_UNREACH))){ 
	    printf(" %s:\n",
		_i18n_msg_get(ls_catd,NL_SETN,1612, "CURRENT LOAD USED FOR SCHEDULING")); /* catgets  1612  */
	    prtLoad(hPtr, lsInfo);

	    if (lsbSharedResConfigured_) {
		
		retVal = makeShareFields(hPtr->host, lsInfo, &nameTable, 
					 &totalValues, &rsvValues,
					 &formats); 
		if (retVal > 0) {
		    int start =0;
		    int end;
                    while ((end = getDispLastItem(nameTable, start, retVal)) > start 
	                   && start < retVal) { 
		        printf(" %11s", " ");
		        for (j = start; j < end; j++) 
                            printf(formats[j], nameTable[j]);
		    
		        printf("\n %-11.11s",
                               _i18n_msg_get(ls_catd,NL_SETN,1613, "Total"));   /* catgets  1613  */
	                for (j = start; j < end; j++) 
                            printf(formats[j], totalValues[j]);

		        printf("\n %-11.11s",
                               _i18n_msg_get(ls_catd,NL_SETN,1614, "Reserved"));  /* catgets 1614 */
		        for (j = start; j < end; j++) 
                            printf(formats[j], rsvValues[j]);
		        putchar('\n');
		        putchar('\n');
			start = end;
                    }
		    putchar('\n');
		}
	    }
	}
	printf(" %s:\n",
	    _i18n_msg_get(ls_catd,NL_SETN,1615, "LOAD THRESHOLD USED FOR SCHEDULING"));	 /* catgets  1615  */
	if (printThresholds(hPtr->loadSched, hPtr->loadStop, 
			    hPtr->busySched, hPtr->busyStop,
			    MIN(hInfo->nIdx, lsInfo->numIndx),
			    lsInfo) < 0)
	    continue;
	printf("\n");
	
        
	if (hPtr->mig < INFINIT_INT) 
	    printf(( _i18n_msg_get(ls_catd, NL_SETN, 1616, "Migration threshold is %d min \n")), hPtr->mig);  /* catgets  1616  */

        printf("\n");
    } 
} 
예제 #6
0
파일: cmd.job.c 프로젝트: fudanyi/openlava
void
displayLong(struct jobInfoEnt *job,
	    struct jobInfoHead *jInfoH,
	    float cpuFactor)
{
    char *hostPtr, *sp;
    char hostName[MAXHOSTNAMELEN];
    float hostFactor, *getFactor;
    static int first = TRUE;
    static struct lsInfo *lsInfo;
    char prline[MAXLINELEN];

    if (first) {
        first = FALSE;
	TIMEIT(0, (lsInfo = ls_info()), "ls_info");
	if (lsInfo == NULL) {
	    ls_perror("ls_info");
	    exit(-1);
	}
    }

    prtHeader(job, TRUE, FALSE);
    prtJobSubmit(job, FALSE, FALSE);
    TIMEIT(1, prtFileNames(job, TRUE), "prtFileNames");
    hostPtr = job->submit.hostSpec;
    hostFactor = 1.0;

    if (job->numExHosts > 0
	  && (strcmp (job->exHosts[0], LOST_AND_FOUND) != 0)
	  && !IS_PEND (job->status)) {
	strcpy (hostName, job->exHosts[0]);

        if ((sp = strstr (hostName, "@")) != NULL) {
            *sp = '\0';

            if (strcmp(hostName, hostPtr) == 0) {
	        if ((getFactor=getCpuFactor(hostName, TRUE)) == NULL) {
        	    prtLine("\n");
		    fprintf(stderr,
			(_i18n_msg_get(ls_catd,NL_SETN,1451, "Cannot obtain execution host information: %s\n")), ls_errmsg[lserrno]);
    	            exit(-1);
	        } else {
	            hostFactor = *getFactor;
	            hostPtr = job->exHosts[0];
                }
            }
        }
    }

    TIMEIT(1, prtSubDetails(job, hostPtr, hostFactor), "prtSubDetails");
    if (job->numExHosts > 0 && job->reserveTime > 0) {
       TIMEIT(1, prtJobReserv(job), "prtJobReserv");
       sprintf(prline, ";\n");
       prtLine(prline);
    }


    if (job->predictedStartTime && IS_PEND(job->status)) {
	char localTimeStr[60];
	strcpy ( localTimeStr, _i18n_ctime(ls_catd, CTIME_FORMAT_a_b_d_T, &job->predictedStartTime));
        sprintf(prline, (_i18n_msg_get(ls_catd,NL_SETN,1466, "%s: Will be started;\n")), /* catgets  1466  */
		localTimeStr );
        prtLine(prline);
    }

    if (job->startTime && !IS_PEND(job->status)) {
	TIMEIT(1, prtJobStart(job, BJOBS_PRINT, job->jobPid, FALSE), "prtJobStart");
    }

    if ((cpuFactor > 0.0) && (job->cpuTime > 0))
        job->cpuTime = job->cpuTime * hostFactor / cpuFactor;

    if (job->jType == JGRP_NODE_ARRAY) {

        printf("\n %s:\n",
	    _i18n_msg_get(ls_catd,NL_SETN,1467, "COUNTERS")); /* catgets  1467  */
        printf( (_i18n_msg_get(ls_catd,NL_SETN,1468, " NJOBS PEND DONE RUN EXIT SSUSP USUSP PSUSP\n"))); /* catgets  1468  */
        printf(" %5d %4d %3d %4d %4d %5d %5d %5d\n",
            job->counter[JGRP_COUNT_NJOBS],
            job->counter[JGRP_COUNT_PEND],
            job->counter[JGRP_COUNT_NDONE],
            job->counter[JGRP_COUNT_NRUN],
            job->counter[JGRP_COUNT_NEXIT],
            job->counter[JGRP_COUNT_NSSUSP],
            job->counter[JGRP_COUNT_NUSUSP],
            job->counter[JGRP_COUNT_NPSUSP]);
        return;
    }
    TIMEIT(1, prtJobFinish(job, jInfoH), "prtJobFinish");

    if (lsbMode_ & LSB_MODE_BATCH) {
	sprintf(prline, "\n %s:\n",
	    _i18n_msg_get(ls_catd,NL_SETN,1469, "SCHEDULING PARAMETERS")); /* catgets  1469  */
	prtLine(prline);
	if (printThresholds (job->loadSched, job->loadStop, NULL, NULL,
			     job->nIdx, lsInfo) < 0)
	    exit (-1);
    }

    return;
}
예제 #7
0
/* prtQueuesLong()
 */
static void
prtQueuesLong(int numQueues, struct queueInfoEnt *queueInfo)
{
    struct queueInfoEnt *qp;
    char *status;
    char userJobLimit[MAX_CHARLEN];
    char procJobLimit[MAX_CHARLEN];
    char hostJobLimit[MAX_CHARLEN];
    char maxJobs[MAX_CHARLEN];
    int i;
    int numDefaults = 0;
    struct lsInfo *lsInfo;
    int printFlag = 0;
    int printFlag1 = 0;
    int printFlag2 = 0;
    int printFlag3 = 0;
    int procLimits[3];

    if ((lsInfo = ls_info()) == NULL) {
        ls_perror("ls_info");
        exit(-1);
    }

    printf("\n");

    for (i = 0; i < numQueues; i++ )  {
        qp = &(queueInfo[i]);
        if (qp->qAttrib & Q_ATTRIB_DEFAULT)
            numDefaults++;
    }

    for (i = 0; i < numQueues; i++ ) {

        qp = &(queueInfo[i]);

        if (qp->qStatus & QUEUE_STAT_OPEN) {
            if ((qp->qStatus & QUEUE_STAT_ACTIVE)
                && (qp->qStatus & QUEUE_STAT_RUN))
                status = "   Open:Active  ";
            if ((qp->qStatus & QUEUE_STAT_ACTIVE)
                && !(qp->qStatus & QUEUE_STAT_RUN))
                status = " Open:Inact_Win "; /* windows are closed */
            if (!(qp->qStatus & QUEUE_STAT_ACTIVE))
                status = " Open:Inact_Adm "; /* By user (manager) */
        } else {  /* queue is disabled */
            if ((qp->qStatus & QUEUE_STAT_ACTIVE)
                && (qp->qStatus & QUEUE_STAT_RUN))
                status = "  Closed:Active ";
            if ((qp->qStatus & QUEUE_STAT_ACTIVE)
                && !(qp->qStatus & QUEUE_STAT_RUN))
                status = "Closed:Inact_Win"; /* by time window */
            if (!(qp->qStatus & QUEUE_STAT_ACTIVE))
                status = "Closed:Inact_Adm"; /* by user (manager) */
        }

        if (qp->maxJobs < INFINIT_INT)
            sprintf (maxJobs, "%5d", qp->maxJobs);
        else
            sprintf (maxJobs, "   - ");
        if (qp->userJobLimit < INFINIT_INT)
            sprintf (userJobLimit, "%4d", qp->userJobLimit);
        else
            sprintf (userJobLimit, "  - ");
        if (qp->procJobLimit < INFINIT_FLOAT)
            sprintf (procJobLimit, "%4.1f", qp->procJobLimit);
        else
            sprintf (procJobLimit, "  - ");
        if (qp->hostJobLimit < INFINIT_INT)
            sprintf (hostJobLimit, "%4d", qp->hostJobLimit);
        else
            sprintf (hostJobLimit, "  - ");

        if (i > 0)
            printf("-------------------------------------------------------------------------------\n\n");
        printf("QUEUE: %s\n", qp->queue);
        printf("  -- %s", qp->description);
        if (qp->qAttrib & Q_ATTRIB_DEFAULT) {
            if (numDefaults == 1)
                printf("  This is the default queue.\n\n");
            else
                printf("  This is one of the default queues.\n\n");
        } else
            printf("\n\n");

        printf("PARAMETERS/STATISTICS\n");
        printf("PRIO");
        printf(" NICE");
        printf("     STATUS       ");
        printf("MAX JL/U JL/P JL/H ");
        printf("NJOBS  PEND  RUN  SSUSP USUSP  RSV\n");
        printf("%4d", qp->priority);
        printf(" %3d", qp->nice);
        printf(" %-16.16s", status);

        printf("%s %s %s %s",
               maxJobs, userJobLimit, procJobLimit,hostJobLimit);

        printf("%5d %5d %5d %5d %5d %4d\n\n",
               qp->numJobs, qp->numPEND, qp->numRUN,
               qp->numSSUSP, qp->numUSUSP, qp->numRESERVE);

        if (qp->mig < INFINIT_INT)
            printf("Migration threshold is %d minutes\n", qp->mig);

        if (qp->schedDelay < INFINIT_INT)
            printf("Schedule delay for a new job is %d seconds\n",
                   qp->schedDelay);

        if (qp->acceptIntvl < INFINIT_INT)
            printf("Interval for a host to accept two jobs is %d seconds\n",
                   qp->acceptIntvl);


        if (((qp->defLimits[LSF_RLIMIT_CPU] != INFINIT_INT) &&
             (qp->defLimits[LSF_RLIMIT_CPU] > 0 )) ||
            ((qp->defLimits[LSF_RLIMIT_RUN] != INFINIT_INT) &&
             (qp->defLimits[LSF_RLIMIT_RUN] > 0 )) ||
            ((qp->defLimits[LSF_RLIMIT_DATA] != INFINIT_INT) &&
             (qp->defLimits[LSF_RLIMIT_DATA] > 0 )) ||
            ((qp->defLimits[LSF_RLIMIT_RSS] != INFINIT_INT) &&
             (qp->defLimits[LSF_RLIMIT_RSS] > 0 )) ||
            ((qp->defLimits[LSF_RLIMIT_PROCESS] != INFINIT_INT) &&
             (qp->defLimits[LSF_RLIMIT_PROCESS] > 0 ))) {


            printf("\n");
            printf("DEFAULT LIMITS:");
            prtResourceLimit (qp->defLimits, qp->hostSpec, 1.0, 0);
            printf("\n");
            printf("MAXIMUM LIMITS:");
        }

        procLimits[0] = qp->minProcLimit;
        procLimits[1] = qp->defProcLimit;
        procLimits[2] = qp->procLimit;
        prtResourceLimit (qp->rLimits, qp->hostSpec, 1.0, procLimits);

        printf("\nSCHEDULING PARAMETERS\n");
        if (printThresholds(qp->loadSched,  qp->loadStop, NULL, NULL,
                            MIN(lsInfo->numIndx, qp->nIdx), lsInfo) < 0)
            exit(-1);

        if ((qp->qAttrib & Q_ATTRIB_EXCLUSIVE)
            || (qp->qAttrib & Q_ATTRIB_BACKFILL)
            || (qp->qAttrib & Q_ATTRIB_IGNORE_DEADLINE)
            || (qp->qAttrib & Q_ATTRIB_ONLY_INTERACTIVE)
            || (qp->qAttrib & Q_ATTRIB_NO_INTERACTIVE)
            || (qp->qAttrib & Q_ATTRIB_FAIRSHARE)) {
            printf("\nSCHEDULING POLICIES:");
            if (qp->qAttrib & Q_ATTRIB_FAIRSHARE)
                printf("  FAIRSHARE");
            if (qp->qAttrib & Q_ATTRIB_BACKFILL)
                printf("  BACKFILL");
            if (qp->qAttrib & Q_ATTRIB_IGNORE_DEADLINE)
                printf("  IGNORE_DEADLINE");
            if (qp->qAttrib & Q_ATTRIB_EXCLUSIVE)
                printf("  EXCLUSIVE");
            if (qp->qAttrib & Q_ATTRIB_NO_INTERACTIVE)
                printf("  NO_INTERACTIVE");
            if (qp->qAttrib & Q_ATTRIB_ONLY_INTERACTIVE)
                printf("  ONLY_INTERACTIVE");
            if (qp->qAttrib & Q_ATTRIB_ROUND_ROBIN)
                printf("ROUND_ROBIN_SCHEDULING:  yes\n");
            printf("\n");
        }

        /* If the queue has the FAIRSHARE policy on, print out
         * shareAcctInforEnt data structure.
         */
        if (qp->qAttrib & Q_ATTRIB_FAIRSHARE) {
            print_slot_shares(qp);
        }

        if (qp->qAttrib & Q_ATTRIB_PREEMPTIVE)
            printf("\nPREEMPTION = %s", qp->preemption);

        if (strcmp (qp->defaultHostSpec, " ") !=  0)
            printf("\nDEFAULT HOST SPECIFICATION:  %s\n", qp->defaultHostSpec);

        if (qp->windows && strcmp (qp->windows, " " ) !=0)
            printf("\nRUN_WINDOWS:  %s\n", qp->windows);
        if (strcmp (qp->windowsD, " ")  !=  0)
            printf("\nDISPATCH_WINDOW:  %s\n", qp->windowsD);

        if ( strcmp(qp->userList, " ") == 0) {
            printf("\nUSERS:  all users\n");
        } else {
            if (strcmp(qp->userList, " ") != 0 && qp->userList[0] != 0)
                printf("\nUSERS:  %s\n", qp->userList);
        }

        if (strcmp(qp->hostList, " ") == 0) {
            printf("HOSTS:  all hosts used by the OpenLava system\n");
        } else {
            if (strcmp(qp->hostList, " ") != 0 && qp->hostList[0])
                printf("HOSTS:  %s\n", qp->hostList);
        }
        if (strcmp (qp->admins, " ") != 0)
            printf("ADMINISTRATORS:  %s\n", qp->admins);
        if (strcmp (qp->preCmd, " ") != 0)
            printf("PRE_EXEC:  %s\n", qp->preCmd);
        if (strcmp (qp->postCmd, " ") != 0)
            printf("POST_EXEC:  %s\n", qp->postCmd);
        if (strcmp (qp->requeueEValues, " ") != 0)
            printf("REQUEUE_EXIT_VALUES:  %s\n", qp->requeueEValues);
        if (strcmp (qp->resReq, " ") != 0)
            printf("RES_REQ:  %s\n", qp->resReq);
        if (qp->slotHoldTime > 0)
            printf("Maximum slot reservation time: %d seconds\n", qp->slotHoldTime);
        if (strcmp (qp->resumeCond, " ") != 0)
            printf("RESUME_COND:  %s\n", qp->resumeCond);
        if (strcmp (qp->stopCond, " ") != 0)
            printf("STOP_COND:  %s\n", qp->stopCond);
        if (strcmp (qp->jobStarter, " ") != 0)
            printf("JOB_STARTER:  %s\n", qp->jobStarter);

        /* CONF_SIG_ACT */

        printf("\n");
        printFlag = 0;
        if  ((qp->suspendActCmd != NULL)
             && (qp->suspendActCmd[0] != ' '))
            printFlag = 1;

        printFlag1 = 0;
        if  ((qp->resumeActCmd != NULL)
             && (qp->resumeActCmd[0] != ' '))
            printFlag1 = 1;

        printFlag2 = 0;
        if  ((qp->terminateActCmd != NULL)
             && (qp->terminateActCmd[0] != ' '))
            printFlag2 = 1;

        if (printFlag || printFlag1 || printFlag2)
            printf("JOB_CONTROLS:\n");


        if (printFlag) {
            printf("    SUSPEND:  ");
            if (strcmp (qp->suspendActCmd, " ") != 0)
                printf("    [%s]\n", qp->suspendActCmd);
        }

        if (printFlag1) {
            printf("    RESUME:   ");
            if (strcmp (qp->resumeActCmd, " ") != 0)
                printf("    [%s]\n", qp->resumeActCmd);
        }

        if (printFlag2) {
            printf("    TERMINATE:");
            if (strcmp (qp->terminateActCmd, " ") != 0)
                printf("    [%s]\n", qp->terminateActCmd);
        }

        if (printFlag || printFlag1 || printFlag2)
            printf("\n");

        printFlag = terminateWhen_(qp->sigMap, "USER");
        printFlag1 = terminateWhen_(qp->sigMap, "PREEMPT");
        printFlag2 = terminateWhen_(qp->sigMap, "WINDOW");
        printFlag3 = terminateWhen_(qp->sigMap, "LOAD");

        if (printFlag | printFlag1 | printFlag2 | printFlag3) {
            printf("TERMINATE_WHEN = ");
            if (printFlag) printf("USER ");
            if (printFlag1) printf("PREEMPT ");
            if (printFlag2) printf("WINDOW ");
            if (printFlag3) printf("LOAD");
            printf("\n");
        }
    }
}
예제 #8
0
파일: bqueues.c 프로젝트: ryukun11/openlava
static void
prtQueuesLong(int numQueues, struct queueInfoEnt *queueInfo)
{
    struct queueInfoEnt   *qp;
    char                  statusStr[64];
    char                  userJobLimit[MAX_CHARLEN];
    char                  procJobLimit[MAX_CHARLEN];
    char                  hostJobLimit[MAX_CHARLEN];
    char                  maxJobs[MAX_CHARLEN];
    int                   i;
    int                   numDefaults = 0;
    struct lsInfo         *lsInfo;
    int                   printFlag = 0;
    int                   printFlag1 = 0;
    int                   printFlag2 = 0;
    int                   procLimits[3];

    if ((lsInfo = ls_info()) == NULL) {
        ls_perror("ls_info");
        exit(-1);
    }

    printf("\n");

    for (i = 0; i < numQueues; i++ )  {
        qp = &(queueInfo[i]);
        if (qp->qAttrib & Q_ATTRIB_DEFAULT)
            numDefaults++;
    }

    for (i = 0; i < numQueues; i++) {

        qp = &(queueInfo[i]);

        if (qp->qStatus & QUEUE_STAT_OPEN) {
            sprintf(statusStr, "%s:", I18N_Open);
        }
        else {
            sprintf(statusStr, "%s:", I18N_Closed);
        }
        if (qp->qStatus & QUEUE_STAT_ACTIVE) {
            if (qp->qStatus & QUEUE_STAT_RUN) {
                strcat(statusStr, I18N_Active);
            } else {
                strcat(statusStr, I18N_Inact__Win);
            }
        } else {
            strcat(statusStr, I18N_Inact__Adm);
        }


        if (qp->maxJobs < INFINIT_INT)
            strcpy(maxJobs, prtValue(QUEUE_MAX_LENGTH, qp->maxJobs) );
        else
            strcpy(maxJobs, prtDash(QUEUE_MAX_LENGTH) );


        if (qp->userJobLimit < INFINIT_INT)
            strcpy(userJobLimit,
                   prtValue(QUEUE_JL_U_LENGTH, qp->userJobLimit) );
        else
            strcpy(userJobLimit, prtDash(QUEUE_JL_U_LENGTH) );


        if (qp->procJobLimit < INFINIT_FLOAT) {
            sprintf(fomt, "%%%d.1f ", QUEUE_JL_P_LENGTH);
            sprintf (procJobLimit, fomt, qp->procJobLimit);
        }
        else
            strcpy(procJobLimit, prtDash(QUEUE_JL_P_LENGTH) );


        if (qp->hostJobLimit < INFINIT_INT)
            strcpy(hostJobLimit,
                   prtValue(QUEUE_JL_H_LENGTH, qp->hostJobLimit) );
        else
            strcpy(hostJobLimit, prtDash(QUEUE_JL_H_LENGTH) );

        if (i > 0)
            printf("-------------------------------------------------------------------------------\n\n");
        printf("%s: %s\n", _i18n_msg_get(ls_catd,NL_SETN,1210,
                                         "QUEUE"), qp->queue); /* catgets  1210  */

        printf("  -- %s", qp->description);
        if (qp->qAttrib & Q_ATTRIB_DEFAULT) {
            if (numDefaults == 1)
                printf("  %s.\n\n", _i18n_msg_get(ls_catd,NL_SETN,1211,
                                                  "This is the default queue")); /* catgets  1211  */
            else
                printf("  %s.\n\n", _i18n_msg_get(ls_catd,NL_SETN,1212,
                                                  "This is one of the default queues")); /* catgets  1212  */
        } else
            printf("\n\n");

        printf((_i18n_msg_get(ls_catd,NL_SETN,1213, "PARAMETERS/STATISTICS\n"))); /* catgets  1213  */

        prtWord(QUEUE_PRIO_LENGTH, I18N_PRIO, 0);

        if ( lsbMode_ & LSB_MODE_BATCH )
            prtWord(QUEUE_NICE_LENGTH, I18N_NICE, 1);

        prtWord(QUEUE_STATUS_LENGTH, I18N_STATUS, 0);

        if ( lsbMode_ & LSB_MODE_BATCH ) {
            prtWord(QUEUE_MAX_LENGTH,  I18N_MAX, -1);
            prtWord(QUEUE_JL_U_LENGTH, I18N_JL_U, -1);
            prtWord(QUEUE_JL_P_LENGTH, I18N_JL_P, -1);
            prtWord(QUEUE_JL_H_LENGTH, I18N_JL_H, -1);
        };

        prtWord(QUEUE_NJOBS_LENGTH, I18N_NJOBS, -1);
        prtWord(QUEUE_PEND_LENGTH,  I18N_PEND,  -1);
        prtWord(QUEUE_RUN_LENGTH,   I18N_RUN,   -1);
        prtWord(QUEUE_SSUSP_LENGTH, I18N_SSUSP, -1);
        prtWord(QUEUE_USUSP_LENGTH, I18N_USUSP, -1);
        prtWord(QUEUE_RSV_LENGTH,   I18N_RSV,   -1);
        printf("\n");

        prtWordL(QUEUE_PRIO_LENGTH,
                 prtValue(QUEUE_PRIO_LENGTH-1, qp->priority));

        if ( lsbMode_ & LSB_MODE_BATCH )
            prtWordL(QUEUE_NICE_LENGTH,
                     prtValue(QUEUE_NICE_LENGTH-1, qp->nice));

        prtWord(QUEUE_STATUS_LENGTH, statusStr, 0);

        if ( lsbMode_ & LSB_MODE_BATCH ) {
            sprintf(fomt, "%%%ds%%%ds%%%ds%%%ds", QUEUE_MAX_LENGTH,
                    QUEUE_JL_U_LENGTH,
                    QUEUE_JL_P_LENGTH,
                    QUEUE_JL_H_LENGTH );
            printf(fomt,
                   maxJobs, userJobLimit, procJobLimit, hostJobLimit);
        };

        sprintf(fomt, "%%%dd %%%dd %%%dd %%%dd %%%dd %%%dd\n",
                QUEUE_NJOBS_LENGTH,
                QUEUE_PEND_LENGTH,
                QUEUE_RUN_LENGTH,
                QUEUE_SSUSP_LENGTH,
                QUEUE_USUSP_LENGTH,
                QUEUE_RSV_LENGTH );
        printf(fomt,
               qp->numJobs, qp->numPEND, qp->numRUN,
               qp->numSSUSP, qp->numUSUSP, qp->numRESERVE);

        if ( qp->mig < INFINIT_INT )
            printf((_i18n_msg_get(ls_catd,NL_SETN,1215,
                                  "Migration threshold is %d minutes\n")), qp->mig); /* catgets  1215  */

        if ( qp->schedDelay < INFINIT_INT )
            printf((_i18n_msg_get(ls_catd,NL_SETN,1216, "Schedule delay for a new job is %d seconds\n")),  /* catgets  1216  */
                   qp->schedDelay);

        if ( qp->acceptIntvl < INFINIT_INT )
            printf((_i18n_msg_get(ls_catd,NL_SETN,1217, "Interval for a host to accept two jobs is %d seconds\n")), /* catgets  1217  */
                   qp->acceptIntvl);

        if (((qp->defLimits[LSF_RLIMIT_CPU] != INFINIT_INT) &&
                (qp->defLimits[LSF_RLIMIT_CPU] > 0 )) ||
                ((qp->defLimits[LSF_RLIMIT_RUN] != INFINIT_INT) &&
                 (qp->defLimits[LSF_RLIMIT_RUN] > 0 )) ||
                ((qp->defLimits[LSF_RLIMIT_DATA] != INFINIT_INT) &&
                 (qp->defLimits[LSF_RLIMIT_DATA] > 0 )) ||
                ((qp->defLimits[LSF_RLIMIT_RSS] != INFINIT_INT) &&
                 (qp->defLimits[LSF_RLIMIT_RSS] > 0 )) ||
                ((qp->defLimits[LSF_RLIMIT_PROCESS] != INFINIT_INT) &&
                 (qp->defLimits[LSF_RLIMIT_PROCESS] > 0 ))) {


            printf("\n");
            printf(_i18n_msg_get(ls_catd,NL_SETN,1270,
                                 "DEFAULT LIMITS:") /* catgets 1270 */ );
            prtResourceLimit (qp->defLimits, qp->hostSpec, 1.0, 0);
            printf("\n");
            printf(_i18n_msg_get(ls_catd,NL_SETN,1271,
                                 "MAXIMUM LIMITS:") /* catgets 1271 */ );
        }

        procLimits[0] = qp->minProcLimit;
        procLimits[1] = qp->defProcLimit;
        procLimits[2] = qp->procLimit;
        prtResourceLimit (qp->rLimits, qp->hostSpec, 1.0, procLimits);

        if ( lsbMode_ & LSB_MODE_BATCH ) {
            printf((_i18n_msg_get(ls_catd,NL_SETN,1218, "\nSCHEDULING PARAMETERS\n")));  /* catgets 1218 */

            if (printThresholds (qp->loadSched,  qp->loadStop, NULL, NULL,
                                 MIN(lsInfo->numIndx, qp->nIdx), lsInfo) < 0)
                exit (-1);
        }

        if ((qp->qAttrib & Q_ATTRIB_EXCLUSIVE)
                || (qp->qAttrib & Q_ATTRIB_BACKFILL)
                || (qp->qAttrib & Q_ATTRIB_IGNORE_DEADLINE)
                || (qp->qAttrib & Q_ATTRIB_ONLY_INTERACTIVE)
                || (qp->qAttrib & Q_ATTRIB_NO_INTERACTIVE)) {

            printf("\n%s:", _i18n_msg_get(ls_catd,NL_SETN,1219,
                                          "SCHEDULING POLICIES")); /* catgets  1219  */
            if (qp->qAttrib & Q_ATTRIB_BACKFILL)
                printf("  %s", (_i18n_msg_get(ls_catd,NL_SETN,1223,
                                              "BACKFILL"))); /* catgets  1223  */
            if (qp->qAttrib & Q_ATTRIB_IGNORE_DEADLINE)
                printf("  %s", (_i18n_msg_get(ls_catd,NL_SETN,1224,
                                              "IGNORE_DEADLINE"))); /* catgets  1224  */
            if (qp->qAttrib & Q_ATTRIB_EXCLUSIVE)
                printf("  %s", (_i18n_msg_get(ls_catd,NL_SETN,1225,
                                              "EXCLUSIVE"))); /* catgets  1225  */
            if (qp->qAttrib & Q_ATTRIB_NO_INTERACTIVE)
                printf("  %s", (_i18n_msg_get(ls_catd,NL_SETN,1226,
                                              "NO_INTERACTIVE"))); /* catgets  1226  */
            if (qp->qAttrib & Q_ATTRIB_ONLY_INTERACTIVE)
                printf("  %s", (_i18n_msg_get(ls_catd,NL_SETN,1227,
                                              "ONLY_INTERACTIVE")));                   /* catgets  1227  */
            printf("\n");
        }

        if (strcmp (qp->defaultHostSpec, " ") !=  0)
            printf("\n%s: %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1230, "DEFAULT HOST SPECIFICATION")), qp->defaultHostSpec); /* catgets  1230  */

        if (qp->windows && strcmp (qp->windows, " " ) !=0)
            printf("\n%s: %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1231, "RUN_WINDOW")), qp->windows); /* catgets  1231  */
        if (strcmp (qp->windowsD, " ")  !=  0)
            printf("\n%s: %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1232, "DISPATCH_WINDOW")), qp->windowsD); /* catgets  1232  */

        if (lsbMode_ & LSB_MODE_BATCH) {
            if ( strcmp(qp->userList, " ") == 0) {
                printf("\n%s:  %s\n", I18N_USERS,
                       I18N(408, "all users")); /* catgets 408 */
            } else {
                if (strcmp(qp->userList, " ") != 0 && qp->userList[0] != 0)
                    printf("\n%s: %s\n", I18N_USERS, qp->userList);
            }
        }

        if (strcmp(qp->hostList, " ") == 0) {
            if (lsbMode_ & LSB_MODE_BATCH)
                printf("%s\n",
                       (_i18n_msg_get(ls_catd,NL_SETN,1235, "HOSTS:  all hosts used by the LSF Batch system"))); /* catgets  1235  */
            else
                printf("%s\n",
                       (_i18n_msg_get(ls_catd,NL_SETN,1236, "HOSTS: all hosts used by the LSF JobScheduler system"))); /* catgets  1236  */
        } else {
            if (strcmp(qp->hostList, " ") != 0 && qp->hostList[0])
                printf("%s:  %s\n", I18N_HOSTS, qp->hostList);
        }
        if (strcmp (qp->prepostUsername, " ") != 0)
            printf("%s:  %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1238, "PRE_POST_EXEC_USER")), qp->prepostUsername); /* catgets  1238  */
        if (strcmp (qp->admins, " ") != 0)
            printf("%s:  %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1239, "ADMINISTRATORS")), qp->admins); /* catgets  1239  */
        if (strcmp (qp->preCmd, " ") != 0)
            printf("%s:  %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1240, "PRE_EXEC")), qp->preCmd); /* catgets  1240  */
        if (strcmp (qp->postCmd, " ") != 0)
            printf("%s:  %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1241, "POST_EXEC")), qp->postCmd); /* catgets  1241  */
        if (strcmp (qp->requeueEValues, " ") != 0)
            printf("%s:  %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1242, "REQUEUE_EXIT_VALUES")), qp->requeueEValues); /* catgets  1242  */
        if (strcmp (qp->resReq, " ") != 0)
            printf("%s:  %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1243, "RES_REQ")), qp->resReq); /* catgets  1243  */
        if (qp->slotHoldTime > 0)
            printf((_i18n_msg_get(ls_catd,NL_SETN,1244, "Maximum slot reservation time: %d seconds\n")), qp->slotHoldTime); /* catgets  1244  */
        if (strcmp (qp->resumeCond, " ") != 0)
            printf("%s:  %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1245, "RESUME_COND")), qp->resumeCond); /* catgets  1245  */
        if (strcmp (qp->stopCond, " ") != 0)
            printf("%s:  %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1246, "STOP_COND")), qp->stopCond); /* catgets  1246  */
        if (strcmp (qp->jobStarter, " ") != 0)
            printf("%s:  %s\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1247, "JOB_STARTER")), qp->jobStarter);   /* catgets  1247  */
        if (qp->qAttrib & Q_ATTRIB_RERUNNABLE)
            printf("RERUNNABLE :  yes\n");

        if ( qp->qAttrib & Q_ATTRIB_CHKPNT ) {
            printf((_i18n_msg_get(ls_catd,NL_SETN,1261, "CHKPNTDIR : %s\n")), qp->chkpntDir); /* catgets  1261  */
            printf((_i18n_msg_get(ls_catd,NL_SETN,1262, "CHKPNTPERIOD : %d\n")), qp->chkpntPeriod); /* catgets  1262  */
        }

        if (qp->qAttrib & Q_ATTRIB_ROUND_ROBIN)
            printf("ROUN_ROBIN_SCHEDULING:  yes\n");

        printf("\n");
        printFlag = 0;
        if  ((qp->suspendActCmd != NULL)
                && (qp->suspendActCmd[0] != ' '))
            printFlag = 1;

        printFlag1 = 0;
        if  ((qp->resumeActCmd != NULL)
                && (qp->resumeActCmd[0] != ' '))
            printFlag1 = 1;

        printFlag2 = 0;
        if  ((qp->terminateActCmd != NULL)
                && (qp->terminateActCmd[0] != ' '))
            printFlag2 = 1;

        if (printFlag || printFlag1 || printFlag2)
            printf("%s:\n",
                   (_i18n_msg_get(ls_catd,NL_SETN,1251, "JOB_CONTROLS"))); /* catgets  1251  */

        if (printFlag) {
            printf("    %-9.9s", (_i18n_msg_get(ls_catd,NL_SETN,1252, "SUSPEND:"))); /* catgets  1252  */
            if (strcmp (qp->suspendActCmd, " ") != 0)
                printf("    [%s]\n", qp->suspendActCmd);
        }

        if (printFlag1) {
            printf("    %-9.9s", (_i18n_msg_get(ls_catd,NL_SETN,1253, "RESUME:"))); /* catgets  1253  */
            if (strcmp (qp->resumeActCmd, " ") != 0)
                printf("    [%s]\n", qp->resumeActCmd);
        }

        if (printFlag2) {
            printf("    %-9.9s", (_i18n_msg_get(ls_catd,NL_SETN,1254, "TERMINATE:"))); /* catgets  1254  */
            if (strcmp (qp->terminateActCmd, " ") != 0)
                printf("    [%s]\n", qp->terminateActCmd);
        }

        if (printFlag || printFlag1 || printFlag2)
            printf("\n");

        printFlag = terminateWhen_(qp->sigMap, "USER");
        printFlag1 = terminateWhen_(qp->sigMap, "WINDOW");
        printFlag2 = terminateWhen_(qp->sigMap, "LOAD");

        if (printFlag | printFlag1 | printFlag2) {
            printf((_i18n_msg_get(ls_catd,NL_SETN,1255, "TERMINATE_WHEN = "))); /* catgets  1255  */
            if (printFlag) printf((_i18n_msg_get(ls_catd,NL_SETN,1256, "USER "))); /* catgets  1256  */
            if (printFlag1) printf((_i18n_msg_get(ls_catd,NL_SETN,1258, "WINDOW "))); /* catgets  1258  */
            if (printFlag2) printf((_i18n_msg_get(ls_catd,NL_SETN,1259, "LOAD"))); /* catgets  1259  */
            printf("\n");
        }
    }

    printf("\n");

}
예제 #9
0
파일: lsinfo.c 프로젝트: shaoboyang/jhlava
int
main(int argc, char **argv)
{
    static char fname[] = "lsinfo/main";
    struct lsInfo *lsInfo;
    int i, cc, nnames;
    char *namebufs[256];
    char longFormat = FALSE;
    char rFlag = FALSE;
    char tFlag = FALSE;
    char mFlag = FALSE;
    char mmFlag = FALSE;
    int rc;

    rc = _i18n_init ( I18N_CAT_MIN );

    if (ls_initdebug(argv[0]) < 0) {
        ls_perror("ls_initdebug");
        exit(-1);
    }
    if (logclass & (LC_TRACE))
        ls_syslog(LOG_DEBUG, "%s: Entering this routine...", fname);

    while ((cc = getopt(argc, argv, "VhlrmMt")) != EOF) {
        switch(cc) {
            case 'V':
                fputs(_LS_VERSION_, stderr);
                exit(0);
            case 'l':
                longFormat = TRUE;
                break;
            case 'r':
                rFlag = TRUE;
                break;
            case 't':
                tFlag = TRUE;
                break;
            case 'm':
                mFlag = TRUE;
                break;
            case 'M':
                mFlag  = TRUE;
                mmFlag = TRUE;
                break;
            case 'h':
            default:
                usage(argv[0]);
        }
    }

    for (nnames=0; optind < argc; optind++, nnames++)
        namebufs[nnames] = argv[optind];

    if ((lsInfo = ls_info()) == NULL) {
	ls_perror("lsinfo");
        exit(-10);
    }


    if (!nnames && !rFlag && !mFlag && !tFlag && !mmFlag)
        rFlag = mFlag = tFlag = TRUE;
    else if (nnames)
        rFlag = TRUE;

    if (rFlag) {
        if (!longFormat) {
	    char *buf1, *buf2, *buf3, *buf4;

	    buf1 = putstr_(_i18n_msg_get(ls_catd,NL_SETN,1804, "RESOURCE_NAME")), /* catgets  1804  */
	    buf2 = putstr_(_i18n_msg_get(ls_catd,NL_SETN,1805, "  TYPE ")), /* catgets  1805  */
	    buf3 = putstr_(_i18n_msg_get(ls_catd,NL_SETN,1806, "ORDER")), /* catgets  1806  */
	    buf4 = putstr_(_i18n_msg_get(ls_catd,NL_SETN,1807, "DESCRIPTION")), /* catgets  1807  */

            printf("%-13.13s %7.7s  %5.5s  %s\n",
		buf1, buf2, buf3, buf4);

	    FREEUP(buf1);
	    FREEUP(buf2);
	    FREEUP(buf3);
	    FREEUP(buf4);
	}

        for (i=0; i < lsInfo->nRes; i++) {
            if (!nameInList(namebufs, nnames, lsInfo->resTable[i].name))
                continue;
            if (!longFormat) {
               printf("%-13.13s %7.7s %5.5s   %s\n",
                   lsInfo->resTable[i].name,
                   valueTypeToStr(lsInfo->resTable[i].valueType),
                   orderTypeToStr(lsInfo->resTable[i].orderType),
                   lsInfo->resTable[i].des);
            } else
               print_long(&(lsInfo->resTable[i]));
        }

        for (i=0; i < nnames; i++)
            if (namebufs[i])
                printf(_i18n_msg_get(ls_catd,NL_SETN,1808, "%s: Resource name not found\n"),/* catgets  1808  */
		    namebufs[i]);

    }

    if (tFlag) {
        if (rFlag)
            putchar('\n');
        puts(_i18n_msg_get(ls_catd,NL_SETN,1809, "TYPE_NAME")); /* catgets  1809  */
        for (i=0;i<lsInfo->nTypes;i++)
            puts(lsInfo->hostTypes[i]);
    }

    if (mFlag) {
        if (rFlag || tFlag)
            putchar('\n');
        puts(_i18n_msg_get(ls_catd,NL_SETN,1810,
            "MODEL_NAME      CPU_FACTOR      ARCHITECTURE")); /* catgets  1810  */
        for (i = 0; i < lsInfo->nModels; ++i)
            if (mmFlag || lsInfo->modelRefs[i])
                printf("%-16s    %6.2f      %s\n", lsInfo->hostModels[i],
                    lsInfo->cpuFactor[i], lsInfo->hostArchs[i]);
    }

    _i18n_end ( ls_catd );

    exit(0);
}