Exemplo n.º 1
0
unsigned long measure() {

    char q;
    write(sockfd,"1",1);
    RESET;
    read(sockfd,&q,1);
    GET_HIGH(t);
    return t;
}
Exemplo n.º 2
0
unsigned long measure() {

    char q;
    write(sockfd,"1",1);
    RESET;
    read(sockfd,bigpacket,BYTES);
    GET_HIGH(t);
    return t;
}
Exemplo n.º 3
0
char *
lsb_pendreason(int numReasons, int *rsTb, struct jobInfoHead *jInfoH,
               struct loadIndexLog *ld)
{
    static char fname[] = "lsb_pendreason";
    int i;
    int j;
    int num;
    int hostId;
    int reason;
    int hostIdJ;
    int reasonJ;
    static int *reasonTb;
    static int memSize;
    static char *hostList = NULL;
    static char *retMsg = NULL;
    char *sp;
    struct msgMap pendMsg[] = {
        /*
         * Job Related Reasons (001 - 300)
         */
        { PEND_JOB_NEW,
          "New job is waiting for scheduling"},
        { PEND_JOB_START_TIME,
          "The job has a specified start time"},
        { PEND_JOB_DEPEND,
          "Job dependency condition not satisfied"},
        { PEND_JOB_DEP_INVALID,
          "Dependency condition invalid or never satisfied"},
        { PEND_JOB_MIG,
          "Migrating job is waiting for rescheduling"},
        { PEND_JOB_PRE_EXEC,
          "The job's pre-exec command exited with non-zero status"},
        { PEND_JOB_NO_FILE,
          "Unable to access job file"},
        { PEND_JOB_ENV,
          "Unable to set job's environment variables"},
        { PEND_JOB_PATHS,
          "Unable to determine job's home/working directories"},
        { PEND_JOB_OPEN_FILES,
          "Unable to open job's I/O buffers"},
        { PEND_JOB_EXEC_INIT,
          "Job execution initialization failed"},
        { PEND_JOB_RESTART_FILE,
          "Unable to copy restarting job's checkpoint files"},
        { PEND_JOB_DELAY_SCHED,
          "The schedule of the job is postponed for a while"},
        { PEND_JOB_SWITCH,
          "Waiting for re-scheduling after switching queue"},
        {PEND_JOB_DEP_REJECT,
         "Event is rejected by eeventd due to syntax error"},
        {PEND_JOB_NO_PASSWD,
         "Failed to get user password"},
        {PEND_JOB_MODIFY,
         "Waiting for re-scheduling after parameters have been changed"},
        { PEND_SYS_UNABLE,
          "System is unable to schedule the job" },
        /*
         * Queue and System Related Reasons (301 - 599)
         */
        { PEND_QUE_INACT,
          "The queue is inactivated by the administrator"},
        { PEND_QUE_WINDOW,
          "The queue is inactivated by its time windows"},
        { PEND_QUE_JOB_LIMIT,
          "The queue has reached its job slot limit"},
        { PEND_QUE_PJOB_LIMIT,
          "The queue has not enough job slots for the parallel job"},
        { PEND_QUE_USR_JLIMIT,
          "User has reached the per-user job slot limit of the queue"},
        { PEND_QUE_USR_PJLIMIT,
          "Not enough per-user job slots of the queue for the parallel job"},
        { PEND_QUE_PRE_FAIL,
          "The queue's pre-exec command exited with non-zero status"},
        { PEND_SYS_NOT_READY,
          "System is not ready for scheduling after reconfiguration"},
        { PEND_SBD_JOB_REQUEUE,
          "Requeued job is waiting for rescheduling"},
        { PEND_JOB_SPREAD_TASK,
          "Not enough hosts to meet the job's spanning requirement"},
        { PEND_QUE_SPREAD_TASK,
          "Not enough hosts to meet the queue's spanning requirement"},
        { PEND_QUE_WINDOW_WILL_CLOSE,
          "Job will not finish before queue's run window is closed"},
        /*
         * User Related Reasons (601 - 800)
         */
        { PEND_USER_JOB_LIMIT,
          "The user has reached his/her job slot limit"},
        { PEND_UGRP_JOB_LIMIT,
          "One of the user's groups has reached its job slot limit"},
        { PEND_USER_PJOB_LIMIT,
          "The user has not enough job slots for the parallel job"},
        {PEND_UGRP_PJOB_LIMIT,
         "One of user's groups has not enough job slots for the parallel job"},
        { PEND_USER_RESUME,
          "Waiting for scheduling after resumed by user"},
        { PEND_USER_STOP,
          "The job was suspended by the user while pending"},
        { PEND_ADMIN_STOP,
          "The job was suspended by LSF admin or root while pending"},
        { PEND_NO_MAPPING,
          "Unable to determine user account for execution"},
        { PEND_RMT_PERMISSION,
          "The user has no permission to run the job on remote host/cluster"},
        /*
         * NON-EXCLUSIVE PENDING REASONS
         * A job may still start even though non-exclusive reasons exist.
         *
         * Job and Host(sbatchd) Related Reasons (1001 - 1300)
         */
        { PEND_HOST_RES_REQ,
          "Job's resource requirements not satisfied"},
        { PEND_HOST_NONEXCLUSIVE,
          "Job's requirement for exclusive execution not satisfied"},
        { PEND_HOST_JOB_SSUSP,
          "Higher or equal priority jobs already suspended by system"},
        { PEND_SBD_GETPID,
          "Unable to get the PID of the restarting job"},
        { PEND_SBD_LOCK,
          "Unable to lock host for exclusively executing the job"},
        { PEND_SBD_ZOMBIE,
          "Cleaning up zombie job"},
        { PEND_SBD_ROOT,
          "Can't run jobs submitted by root"},
        { PEND_HOST_WIN_WILL_CLOSE,
          "Job will not finish on the host before queue's run window is closed"},
        { PEND_HOST_MISS_DEADLINE,
          "Job will not finish on the host before job's termination deadline"},
        /*
         * Host Related Reasons (1301 - 1600)
         */
        { PEND_HOST_DISABLED,
          "Closed by LSF administrator"},
        { PEND_HOST_LOCKED,
          "Host is locked"},
        { PEND_HOST_LESS_SLOTS,
          "Not enough job slot(s)"},
        { PEND_HOST_WINDOW,
          "Dispatch windows closed"},
        { PEND_HOST_JOB_LIMIT,
          "Job slot limit reached"},
        { PEND_QUE_PROC_JLIMIT,
          "Queue's per-CPU job slot limit reached"},
        { PEND_QUE_HOST_JLIMIT,
          "Queue's per-host job slot limit reached"},
        { PEND_USER_PROC_JLIMIT,
          "User's per-CPU job slot limit reached"},
        { PEND_UGRP_PROC_JLIMIT,
          "User group's per-CPU job slot limit reached"},
        { PEND_HOST_USR_JLIMIT,
          "Host's per-user job slot limit reached"},
        { PEND_HOST_QUE_MEMB,
          "Not usable to the queue"},
        { PEND_HOST_USR_SPEC,
          "Not specified in job submission"},
        { PEND_HOST_PART_USER,
          "User has no access to the host partition"},
        { PEND_HOST_NO_USER,
          "There is no such user account"},
        { PEND_HOST_ACCPT_ONE,
          "Just started a job recently"},
        { PEND_LOAD_UNAVAIL,
          "Load information unavailable"},
        { PEND_HOST_NO_LIM,
          "LIM is unreachable now"},
        { PEND_HOST_QUE_RESREQ,
          "Queue's resource requirements not satisfied"},
        { PEND_HOST_SCHED_TYPE,
          "Not the same type as the submission host"},
        { PEND_JOB_NO_SPAN,
          "Not enough processors to meet the job's spanning requirement"},
        { PEND_QUE_NO_SPAN,
          "Not enough processors to meet the queue's spanning requirement"},
        { PEND_HOST_EXCLUSIVE,
          "Running an exclusive job"},
        { PEND_HOST_QUE_RUSAGE,
          "Queue's requirements for resource reservation not satisfied"},
        { PEND_HOST_JOB_RUSAGE,
          "Job's requirements for resource reservation not satisfied"},
/*
 * sbatchd Related Reasons (1601 - 1900)
 */
        { PEND_SBD_UNREACH,
          "Unable to reach slave batch server"},
        { PEND_SBD_JOB_QUOTA,
          "Number of jobs exceeds quota"},
        { PEND_JOB_START_FAIL,
          "Failed in talking to server to start the job"},
        { PEND_JOB_START_UNKNWN,
          "Failed in receiving the reply from server when starting the job"},
        { PEND_SBD_NO_MEM,
          "Unable to allocate memory to run job"},
        { PEND_SBD_NO_PROCESS,
          "Unable to fork process to run job"},
        { PEND_SBD_SOCKETPAIR,
          "Unable to communicate with job process"},
        { PEND_SBD_JOB_ACCEPT,
          "Slave batch server failed to accept job"},
/*
 * Load Related Reasons (2001 - 2300)
 */
        { PEND_HOST_LOAD,
          "Load threshold reached"},
        { PEND_JOB_PREEMPTED,
          "Preempted job is waiting to be resumed"},
        { PEND_JOB_REQUEUED,
          "The job has been requeued"},
        { 0, NULL}
    };

    if (logclass & (LC_TRACE | LC_SCHED | LC_EXEC))
        ls_syslog(LOG_DEBUG1, "%s: numReasons=%d", fname, numReasons);

    if (!numReasons || !rsTb) {
        lsberrno = LSBE_BAD_ARG;
        return ("");
    }
    if (memSize < numReasons) {
        FREEUP (reasonTb);
        reasonTb = calloc(numReasons, sizeof(int));
        if (!reasonTb) {
            memSize = 0;
            lsberrno = LSBE_NO_MEM;
            return ("");
        }
        memSize = numReasons;
    }
    for (i = 0; i < numReasons; i++)
        reasonTb[i] = rsTb[i];

    FREEUP(hostList);
    FREEUP(retMsg);

    if (jInfoH && jInfoH->numHosts != 0 && jInfoH->hostNames != NULL) {
        hostList = calloc(jInfoH->numHosts, MAXHOSTNAMELEN);
        retMsg = calloc(jInfoH->numHosts, MAXHOSTNAMELEN + MSGSIZE);
        if (hostList == NULL || retMsg == NULL) {
            lsberrno = LSBE_NO_MEM;
            return "";
        }
    } else {
        retMsg = calloc(MSGSIZE, sizeof(char));
        if (retMsg == NULL) {
            lsberrno = LSBE_NO_MEM;
            return "";
        }
    }

    retMsg[0] = '\0';
    for (i = 0; i < numReasons; i++) {
        if (!reasonTb[i])
            continue;
        GET_LOW (reason, reasonTb[i]);
        if (!reason)
            continue;
        GET_HIGH (hostId, reasonTb[i]);
        if (logclass & (LC_TRACE | LC_SCHED | LC_EXEC))
            ls_syslog(LOG_DEBUG2, "%s: hostId=%d, reason=%d reasonTb[%d]=%d",
                      fname, hostId, reason, i, reasonTb[i]);
        if (jInfoH && jInfoH->numHosts != 0 && jInfoH->hostNames != NULL) {
            if (hostId > 0)
                strcpy(hostList, jInfoH->hostNames[hostId - 1]);
            else
                strcpy(hostList, jInfoH->hostNames[hostId]);
        } else {
            num = 1;
        }
	/*
	 * Search for the rest of the reasonTb and see whether there
	 * is a matching reason.  If so, we add the associated host name
	 * to the string stored in hostList so that we can provide a
	 * summary information instead of repeating the same reason for
	 * each host.
	 */
        for (j = i + 1; j < numReasons; j++) {
            if (reasonTb[j] == 0)
                continue;
            GET_LOW (reasonJ, reasonTb[j]);
            if (logclass & (LC_TRACE | LC_SCHED | LC_EXEC))
                ls_syslog(LOG_DEBUG2, "%s: reasonJ=%d reasonTb[j]=%d",
                          fname, reasonJ, reasonTb[j]);
            if (reasonJ != reason)
                continue;
            GET_HIGH (hostIdJ, reasonTb[j]);
            if (logclass & (LC_TRACE | LC_SCHED | LC_EXEC))
                ls_syslog(LOG_DEBUG2, "%s: j=%d, hostIdJ=%d",
                          fname, j, hostIdJ);
            reasonTb[j] = 0;
            if (jInfoH && jInfoH->numHosts != 0 && jInfoH->hostNames != NULL) {
                if (hostIdJ > 0)
                    sprintf(hostList, "%s, %s", hostList,
                            jInfoH->hostNames[hostIdJ - 1]);
                else
                    sprintf(hostList, "%s, %s", hostList,
                            jInfoH->hostNames[hostIdJ]);
            } else {
                num++;
            }
        }
        if (reason >= PEND_HOST_LOAD
            && reason < PEND_HOST_QUE_RUSAGE) {

            getMsgByRes(reason - PEND_HOST_LOAD, PEND_HOST_LOAD, &sp, ld);

        } else if (reason >= PEND_HOST_QUE_RUSAGE
                   && reason < PEND_HOST_JOB_RUSAGE) {

            getMsgByRes(reason - PEND_HOST_QUE_RUSAGE,
                        PEND_HOST_QUE_RUSAGE,
                        &sp,
                        ld);

        } else if (reason >= PEND_HOST_JOB_RUSAGE) {

            getMsgByRes(reason - PEND_HOST_JOB_RUSAGE,
                        PEND_HOST_JOB_RUSAGE,
                        &sp,
                        ld);

        } else {
            sp = getMsg(pendMsg, reason);
        }

        if (jInfoH && jInfoH->numHosts != 0 && jInfoH->hostNames != NULL)
            sprintf(retMsg, "%s %s: %s;\n", retMsg, sp, hostList);
        else if (num == 1)
            sprintf(retMsg, "%s %s: 1 host;\n", retMsg, sp);
        else
            sprintf(retMsg, "%s %s: %d hosts;\n", retMsg, sp, num);
    }

    return retMsg;
}
Exemplo n.º 4
0
void f0() {
  GET_HIGH(t);
}
Exemplo n.º 5
0
char *
lsb_pendreason(int numReasons, int *rsTb, struct jobInfoHead *jInfoH,
               struct loadIndexLog *ld)
{
    static char fname[] = "lsb_pendreason";
    int i, j, num;
    int hostId, reason, hostIdJ, reasonJ;
    static int *reasonTb, memSize = 0;
    static char *hostList = NULL, *retMsg = NULL;
    char *sp;
    
    int pendMsg_ID[] = { 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 
			 560, 561, 562, 563, 564, 566, 567, 568,  
			 571, 583,  
			 655, 656, 586, 587, 
			 588, 589, 590, 591, 592, 596, 597, 598, 599, 600, 
			 662, 601, 602, 603, 604, 605, 606, 607, 
			 608, 609, 610, 611, 612,
			 614, 615, 616, 617, 618, 619, 667, 620, 621, 622,
			 623, 624, 625, 626, 627, 628, 629, 630, 631, 
			 633, 634, 635, 636, 638, 639, 640, 641, 642,
			 664, 646, 647, 648, 649, 650, 651, 652, 653, 654,
			 644, 645, 665, 666
    };  

    struct msgMap pendMsg[] = {
       { PEND_JOB_NEW,
        "New job is waiting for scheduling"},   /* catgets 550 */
       { PEND_JOB_START_TIME,
        "The job has a specified start time"},  /* catgets 551 */
       { PEND_JOB_DEPEND,
        "Job dependency condition not satisfied"}, /* catgets 552 */
       { PEND_JOB_DEP_INVALID,
        "Dependency condition invalid or never satisfied"},  /* catgets 553 */
       { PEND_JOB_MIG,
        "Migrating job is waiting for rescheduling"},  /* catgets 554 */
       { PEND_JOB_PRE_EXEC,
        "The job's pre-exec command exited with non-zero status"}, /* catgets 555 */
       { PEND_JOB_NO_FILE,
        "Unable to access job file"},  /* catgets 556 */
       { PEND_JOB_ENV,
        "Unable to set job's environment variables"},  /* catgets 557 */
       { PEND_JOB_PATHS,
        "Unable to determine job's home/working directories"},  /* catgets 558 */
       { PEND_JOB_OPEN_FILES,
        "Unable to open job's I/O buffers"},  /* catgets 559 */
       { PEND_JOB_EXEC_INIT,
        "Job execution initialization failed"}, /* catgets 560 */
       { PEND_JOB_RESTART_FILE,
        "Unable to copy restarting job's checkpoint files"}, /* catgets 561 */
       { PEND_JOB_DELAY_SCHED,
        "The schedule of the job is postponed for a while"},  /* catgets 562 */
       { PEND_JOB_SWITCH,
        "Waiting for re-scheduling after switching queue"},  /* catgets 563 */
       {PEND_JOB_DEP_REJECT,
        "Event is rejected by eeventd due to syntax error"},  /* catgets 564 */
       {PEND_JOB_NO_PASSWD,
        "Failed to get user password"},        /* catgets 566 */ 
       {PEND_JOB_MODIFY,
        "Waiting for re-scheduling after parameters have been changed"},/* catgets 568 */ 
       { PEND_JOB_REQUEUED,
        "Requeue the job for the next run"}, /* catgets 571 */
       { PEND_SYS_UNABLE,
	 "System is unable to schedule the job" },  /* catgets 583 */
       {PEND_JOB_ARRAY_JLIMIT,
        "The job array has reached its running element limit"},  /* catgets  655 */
       { PEND_CHKPNT_DIR,
        "Checkpoint directory is invalid"},  /* catgets 656 */

       { PEND_QUE_INACT,
        "The queue is inactivated by the administrator"}, /* catgets 586 */
       { PEND_QUE_WINDOW,
        "The queue is inactivated by its time windows"},  /* catgets 587 */
       { PEND_QUE_JOB_LIMIT,
        "The queue has reached its job slot limit"},       /* catgets 588 */
       { PEND_QUE_PJOB_LIMIT,
        "The queue has not enough job slots for the parallel job"}, /* catgets 589 */
       { PEND_QUE_USR_JLIMIT,
        "User has reached the per-user job slot limit of the queue"}, /* catgets 590 */
       { PEND_QUE_USR_PJLIMIT,
        "Not enough per-user job slots of the queue for the parallel job"}, /* catgets 591 */
       { PEND_QUE_PRE_FAIL,
        "The queue's pre-exec command exited with non-zero status"}, /* catgets 592 */
       { PEND_SYS_NOT_READY,
        "System is not ready for scheduling after reconfiguration"}, /* catgets 596 */
       { PEND_SBD_JOB_REQUEUE,
        "Requeued job is waiting for rescheduling"}, /* catgets 597 */
       { PEND_JOB_SPREAD_TASK,
        "Not enough hosts to meet the job's spanning requirement"}, /* catgets 598 */
       { PEND_QUE_SPREAD_TASK,
        "Not enough hosts to meet the queue's spanning requirement"}, /* catgets 599 */
       { PEND_QUE_WINDOW_WILL_CLOSE,
	"Job will not finish before queue's run window is closed"}, /* catgets 600 */
       { PEND_QUE_PROCLIMIT,
	"Job no longer satisfies queue PROCLIMIT configuration"}, /* catgets 662 */
       { PEND_USER_JOB_LIMIT,
        "The user has reached his/her job slot limit"},  /* catgets 601 */
       { PEND_UGRP_JOB_LIMIT,
        "One of the user's groups has reached its job slot limit"}, /* catgets 602 */
       { PEND_USER_PJOB_LIMIT,
        "The user has not enough job slots for the parallel job"},  /* catgets 603 */
       {PEND_UGRP_PJOB_LIMIT,
        "One of user's groups has not enough job slots for the parallel job"}, /* catgets 604 */
       { PEND_USER_RESUME,
        "Waiting for scheduling after resumed by user"}, /* catgets 605 */
       { PEND_USER_STOP,
        "The job was suspended by the user while pending"}, /* catgets 606 */
       { PEND_ADMIN_STOP,
        "The job was suspended by LSF admin or root while pending"}, /* catgets 607 */
       { PEND_NO_MAPPING,
        "Unable to determine user account for execution"},  /* catgets 608 */
       { PEND_RMT_PERMISSION,
        "The user has no permission to run the job on remote host/cluster"}, /* catgets 609 */

       { PEND_HOST_RES_REQ,
        "Job's resource requirements not satisfied"}, /* catgets 610 */
       { PEND_HOST_NONEXCLUSIVE,
        "Job's requirement for exclusive execution not satisfied"}, /* catgets 611 */
       { PEND_HOST_JOB_SSUSP,
        "Higher or equal priority jobs suspended by host load"}, /* catgets 612 */
       { PEND_SBD_GETPID,
        "Unable to get the PID of the restarting job"},  /* catgets 614 */
       { PEND_SBD_LOCK,
        "Unable to lock host for exclusively executing the job"}, /* catgets 615 */
       { PEND_SBD_ZOMBIE,
        "Cleaning up zombie job"}, /* catgets 616 */
       { PEND_SBD_ROOT,
        "Can't run jobs submitted by root"}, /* catgets 617 */
       { PEND_HOST_WIN_WILL_CLOSE,
	 "Job will not finish on the host before queue's run window is closed"}, /* catgets 618 */
       { PEND_HOST_MISS_DEADLINE,
	 "Job will not finish on the host before job's termination deadline"}, /* catgets 619 */
       { PEND_FIRST_HOST_INELIGIBLE,
	 "The specified first exection host is not eligible for this job at this time"}, /* catgets 667 */	
       { PEND_HOST_DISABLED,
        "Closed by LSF administrator"}, /* catgets 620 */
       { PEND_HOST_LOCKED,
        "Host is locked by LSF administrator"},  /* catgets 621 */
       { PEND_HOST_LESS_SLOTS,
        "Not enough job slot(s)"},  /* catgets 622 */
       { PEND_HOST_WINDOW,
        "Dispatch windows closed"}, /* catgets 623 */
       { PEND_HOST_JOB_LIMIT,
        "Job slot limit reached"}, /* catgets 624 */
       { PEND_QUE_PROC_JLIMIT,
        "Queue's per-CPU job slot limit reached"}, /* catgets 625 */
       { PEND_QUE_HOST_JLIMIT,
        "Queue's per-host job slot limit reached"}, /* catgets 626 */
       { PEND_USER_PROC_JLIMIT,
        "User's per-CPU job slot limit reached"},  /* catgets 627 */
       { PEND_UGRP_PROC_JLIMIT,
        "User group's per-CPU job slot limit reached"}, /* catgets 628 */
       { PEND_HOST_USR_JLIMIT,
        "Host's per-user job slot limit reached"},  /* catgets 629 */
       { PEND_HOST_QUE_MEMB,
        "Not usable to the queue"},  /* catgets 630 */
       { PEND_HOST_USR_SPEC,
        "Not specified in job submission"}, /* catgets 631 */
       { PEND_HOST_NO_USER,
        "There is no such user account"},  /* catgets 633 */
       { PEND_HOST_ACCPT_ONE,
        "Just started a job recently"},   /* catgets 634 */
       { PEND_LOAD_UNAVAIL,
        "Load information unavailable"},  /* catgets 635 */
       { PEND_HOST_NO_LIM,
        "LIM is unreachable now"},   /* catgets 636 */
       { PEND_HOST_QUE_RESREQ,
        "Queue's resource requirements not satisfied"},  /* catgets 638 */
       { PEND_HOST_SCHED_TYPE,
        "Not the same type as the submission host"},  /* catgets 639 */
       { PEND_JOB_NO_SPAN,
        "Not enough processors to meet the job's spanning requirement"}, /* catgets 640 */
       { PEND_QUE_NO_SPAN,
        "Not enough processors to meet the queue's spanning requirement"}, /* catgets 641 */ 
       { PEND_HOST_EXCLUSIVE,
        "Running an exclusive job"}, /* catgets 642  */
       { PEND_HOST_LOCKED_MASTER,
        "Host is locked by master LIM"},  /* catgets 664 */
       { PEND_SBD_UNREACH,
        "Unable to reach slave batch server"}, /* catgets 646 */
       { PEND_SBD_JOB_QUOTA,
        "Number of jobs exceeds quota"},  /* catgets 647 */
       { PEND_JOB_START_FAIL,
        "Failed in talking to server to start the job"},  /* catgets 648 */
       { PEND_JOB_START_UNKNWN,
        "Failed in receiving the reply from server when starting the job"}, /* catgets 649 */
       { PEND_SBD_NO_MEM,
        "Unable to allocate memory to run job"}, /* catgets 650 */
       { PEND_SBD_NO_PROCESS,
        "Unable to fork process to run job"},  /* catgets 651 */
       { PEND_SBD_SOCKETPAIR,
        "Unable to communicate with job process"},  /* catgets 652 */
       { PEND_SBD_JOB_ACCEPT,
        "Slave batch server failed to accept job"},  /* catgets 653 */
       { PEND_HOST_LOAD,
        "Load threshold reached"},  /* catgets 654 */

       { PEND_HOST_QUE_RUSAGE,
        "Queue's requirements for resource reservation not satisfied"}, /* catgets 644 */       
       { PEND_HOST_JOB_RUSAGE,
        "Job's requirements for resource reservation not satisfied"}, /* catgets 645 */      
       { PEND_BAD_HOST,
         "Bad host name, host group name or cluster name"}, /* catgets 665 */

       { PEND_QUEUE_HOST,
         "Host or host group is not used by the queue"}, /* catgets 666 */

       { 0, NULL}
    };        
 
    if (logclass & (LC_TRACE | LC_SCHED | LC_EXEC))
        ls_syslog(LOG_DEBUG1, "%s: numReasons=%d", fname, numReasons);

    if (!numReasons || !rsTb) {
        lsberrno = LSBE_BAD_ARG;
        return ("");
    }
    if (memSize < numReasons) {
        FREEUP (reasonTb);
        reasonTb = (int *)calloc (numReasons, sizeof(int));
        if (!reasonTb) {
            memSize = 0;
            lsberrno = LSBE_NO_MEM;
            return ("");
        }
        memSize = numReasons;
    }
    for (i = 0; i < numReasons; i++)
        reasonTb[i] = rsTb[i]; 

    FREEUP (hostList);
    FREEUP (retMsg);
    if (jInfoH && jInfoH->numHosts != 0 && jInfoH->hostNames != NULL) {
        hostList = malloc (jInfoH->numHosts * MAXHOSTNAMELEN);
        retMsg = malloc (jInfoH->numHosts * MAXHOSTNAMELEN + MSGSIZE);
        if (hostList == NULL || retMsg == NULL) {
            lsberrno = LSBE_NO_MEM;
            return ("");
        }
    } else {
        retMsg = malloc (MSGSIZE);
        if (retMsg == NULL) {
            lsberrno = LSBE_NO_MEM;
            return ("");
        }
    }

    retMsg[0] = '\0';
    for (i = 0; i < numReasons; i++) {
        if (!reasonTb[i])
            continue;
        GET_LOW (reason, reasonTb[i]);
        if (!reason)
            continue;
        GET_HIGH (hostId, reasonTb[i]);
        if (logclass & (LC_TRACE | LC_SCHED | LC_EXEC))
            ls_syslog(LOG_DEBUG2, "%s: hostId=%d, reason=%d reasonTb[%d]=%d",
                                  fname, hostId, reason, i, reasonTb[i]);
        if (!hostId) {
            sprintf (msgline, " %s;\n", getMsg(pendMsg, pendMsg_ID,  reason));
            strcat (retMsg, msgline);
            continue;
        }
        if (jInfoH && jInfoH->numHosts != 0 && jInfoH->hostNames != NULL)
            strcpy (hostList, jInfoH->hostNames[hostId-1]);
        else
            num = 1;
	
        for (j = i + 1; j < numReasons; j++) {
            if (reasonTb[j] == 0)
                continue;
            GET_LOW (reasonJ, reasonTb[j]);
            if (logclass & (LC_TRACE | LC_SCHED | LC_EXEC))
                ls_syslog(LOG_DEBUG2, "%s: reasonJ=%d reasonTb[j]=%d",
                                       fname, reasonJ, reasonTb[j]);
            if (reasonJ != reason)
                continue;
            GET_HIGH (hostIdJ, reasonTb[j]);
            if (logclass & (LC_TRACE | LC_SCHED | LC_EXEC))
                ls_syslog(LOG_DEBUG2, "%s: j=%d, hostIdJ=%d", 
                                       fname, j, hostIdJ);
            reasonTb[j] = 0;
            if (jInfoH && jInfoH->numHosts != 0 && jInfoH->hostNames != NULL) {
                sprintf(hostList, "%s, %s", hostList, 
                                   jInfoH->hostNames[hostIdJ-1]);
            } else
                num++;
        }
        if (reason >= PEND_HOST_LOAD
	    && reason < PEND_HOST_QUE_RUSAGE) {	    

	    getMsgByRes(reason - PEND_HOST_LOAD, PEND_HOST_LOAD, &sp, ld);

	} else if (reason >= PEND_HOST_QUE_RUSAGE
		   && reason < PEND_HOST_JOB_RUSAGE) {

	    getMsgByRes(reason - PEND_HOST_QUE_RUSAGE, 
			PEND_HOST_QUE_RUSAGE, 
			&sp, 
			ld);

	} else if (reason >= PEND_HOST_JOB_RUSAGE) {

	    getMsgByRes(reason - PEND_HOST_JOB_RUSAGE, 
			PEND_HOST_JOB_RUSAGE, 
			&sp, 
			ld);

        } else {
            sp = getMsg(pendMsg, pendMsg_ID,  reason);
	}

        if (jInfoH && jInfoH->numHosts != 0 && jInfoH->hostNames != NULL)
            sprintf (retMsg, "%s %s: %s;\n", retMsg, sp, hostList);
        else if (num == 1)
            sprintf (retMsg, _i18n_msg_get(ls_catd , NL_SETN, 713, "%s %s: 1 host;\n"), retMsg, sp); /* catgets 713 */
        else
            sprintf (retMsg, _i18n_msg_get(ls_catd , NL_SETN, 714, "%s %s: %d hosts;\n"), retMsg, sp, num); /* catgets 714 */
    }

    return retMsg;
} 
Exemplo n.º 6
0
void f0(int v1, int v2, int v3, int v4, int v5) {
  GET_HIGH(t);
}