⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getconfig.c

📁 openPBS的开放源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
	(void)sprintf(log_buffer, "%-24s = %s", "NP_DRAIN_IDLETIME",	schd_sec2val(schd_NP_DRAIN_IDLETIME));	log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    }    (void)sprintf(log_buffer, "%-24s = %s", "WALLT_LIMIT_LARGE_JOB",        schd_sec2val(schd_WALLT_LARGE_LIMIT));    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    if (schd_SMALL_JOB_MAX) {        (void)sprintf(log_buffer, "%-24s = %d", "SMALL_JOB_MAX",            schd_SMALL_JOB_MAX);        log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);        (void)sprintf(log_buffer, "%-24s = %s", "WALLT_LIMIT_SMALL_JOB",            schd_sec2val(schd_WALLT_SMALL_LIMIT));        log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    }    (void)sprintf(log_buffer, "%-24s = %s", "PRIME_TIME_START",	schd_sec2val(schd_PRIME_TIME_START));    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "PRIME_TIME_END",	schd_sec2val(schd_PRIME_TIME_END));    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %d%%", "TARGET_LOAD_PCT",	schd_TARGET_LOAD_PCT);    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = -%d%%,+%d%%", "TARGET_LOAD_VARIANCE",	schd_TARGET_LOAD_MINUS, schd_TARGET_LOAD_PLUS);    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %d", "HIGH_SYSTIME", schd_HIGH_SYSTIME);    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %d", "MAX_JOBS", schd_MAX_JOBS);    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %d", "MIN_JOBS", schd_MIN_JOBS);    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "MAX_QUEUED_TIME",	schd_sec2val(schd_MAX_QUEUED_TIME));    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "SMALL_QUEUED_TIME",	schd_sec2val(schd_SMALL_QUEUED_TIME));    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %d", "INTERACTIVE_LONG_WAIT",	schd_INTERACTIVE_LONG_WAIT);    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %d", "MAX_DEDICATED_JOBS",	schd_MAX_DEDICATED_JOBS);    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "SORT_BY_PAST_USAGE",	schd_bool2val(schd_SORT_BY_PAST_USAGE));    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "ENFORCE_ALLOCATION",	schd_booltime2val(schd_ENFORCE_ALLOCATION));    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "ENFORCE_DEDICATED_TIME",	schd_booltime2val(schd_ENFORCE_DEDTIME));    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "SCHED_ACCT_DIR",	schd_SCHED_ACCT_DIR ? schd_SCHED_ACCT_DIR : "[null]");    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "DEDICATED_TIME_COMMAND",	schd_DEDTIME_COMMAND ? schd_DEDTIME_COMMAND : "[null]");    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "SYSTEM_NAME",	schd_SYSTEM_NAME ? schd_SYSTEM_NAME : "[null]");    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "SERVER_HOST",	schd_SERVER_HOST ? schd_SERVER_HOST : "[null]");    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "SCHED_HOST",	schd_SCHED_HOST ? schd_SCHED_HOST : "[null]");    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    (void)sprintf(log_buffer, "%-24s = %s", "SCHED_RESTART_ACTION",	(schd_SCHED_RESTART_ACTION == SCHD_RESTART_NONE ? "NONE" : 	(schd_SCHED_RESTART_ACTION == SCHD_RESTART_RESUBMIT ? "RESUBMIT" :	(schd_SCHED_RESTART_ACTION == SCHD_RESTART_RERUN ? "RERUN" : "?"))));    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    if (schd_AVOID_FRAGS) {	(void)sprintf(log_buffer, "%-24s = %s", "AVOID_FRAGMENTATION",	    schd_bool2val(schd_AVOID_FRAGS));	log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    }    if (schd_JOB_DUMPFILE) {	(void)sprintf(log_buffer, "%-24s = %s", "SORTED_JOB_DUMPFILE",	    schd_JOB_DUMPFILE);	log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    }    if (schd_FAKE_MACH_MULT != 1) {	(void)sprintf(log_buffer, "%-24s = %d", "FAKE_MACHINE_MULT",	    schd_FAKE_MACH_MULT);	log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer);    }}static int arg_to_qlist(char *arg, char *sep, QueueList **qlist_ptr){    char	*id = "arg_to_qlist";    QueueList  *qptr = NULL, *new;    int     num = 0;    char   *name, *exechost, canon[PBS_MAXHOSTNAME + 1];    /*     * Multiple lines may be used to add queues to the queue list.  Find     * the tail of the passed-in list (if there is one), and assign the     * qptr to the tail element.  Later, the new element will be hung off     * qptr's next field (or qptr will be set to it.)     */    if (*qlist_ptr) {	for (qptr = *qlist_ptr; qptr->next != NULL; qptr = qptr->next)	    /* Walk the list, looking for last element. */;    } else {	qptr = NULL;    }    for (name = strtok(arg, sep); name != NULL; name = strtok(NULL, sep)) {	/* 	 * If the list is NULL, create the first element and point qptr	 * at it.  If not, take the qptr from the last iteration (which	 * will be the head the second time through) and place a new	 * element on its next pointer.  Then replace qptr with the	 * address of the newly allocated struct.	 */		new = (QueueList *)malloc(sizeof (QueueList));	if (new == NULL) {	    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id,		"malloc(newQueue)");	    goto error_in_list;	}	memset(new, 0, sizeof (QueueList));	if (qptr == NULL) {	    *qlist_ptr = new;	    qptr = *qlist_ptr;	} else {	    qptr->next = new;	    qptr = new;	}	new->queue = (Queue *)malloc(sizeof (Queue));	if (new->queue == NULL) {	    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id,		"malloc(newQueue->queue)");	    goto error_in_list;	}	memset(new->queue, 0, sizeof (Queue));	/*	 * Queue names may be either 'queue3' or 'queue3@exechost'.	 * If there is a '@', convert it to a '\0' and copy the two	 * halves of the string into the qname and exechost fields.	 * Otherwise, this queue is local to this host - paste in the	 * "local" hostname.	 */	if ((exechost = strchr(name, '@')) != NULL) {	    /* Parse queue@host into queue and hostname. */	    *exechost = '\0';		/* '@' ==> '\0' to terminate qname   */	    exechost ++;		/* Next character after the new '\0' */	    if (get_fullhostname(exechost, canon, PBS_MAXHOSTNAME) == 0) {		exechost = canon;	/* Point at canonical name. */	    } else {		sprintf(log_buffer, "Warning: Cannot canonicalize queue %s@%s",		    name, exechost);		log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, 		    log_buffer);		DBPRT(("%s: %s\n", id, log_buffer));	    }	} else {	    exechost = schd_ThisHost;	/* Queue lives on localhost. */	}	new->queue->qname = schd_strdup(name);	if (new->queue->qname == NULL) {	    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id,		"schd_strdup(qname)");	    goto error_in_list;	}	new->queue->exechost = schd_strdup(exechost);	if (new->queue->exechost == NULL) {	    log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id,		"schd_strdup(exechost)");	    goto error_in_list;	}	num++;    }    return (num);error_in_list:    /* Something went wrong - delete the new list and return a fatal error. */    if (*qlist_ptr) {	schd_destroy_qlist(*qlist_ptr);	*qlist_ptr = NULL;    }    return (-1);}static intqlist_disjoint(QueueList *qlist1, QueueList *qlist2){    QueueList *q1, *q2;    /*     * If both pointers are NULL, or they point to the same list, then     * they are obviously not disjoint sets.     */    if (qlist1 == qlist2)	return (0);    /*     * If any element of one list cannot be found in any element of the     * other list, than the sets are disjoint.  Walk the first list, and     * search for the queue on the second list.  If not found, then they     * are disjoint.     */    for (q1 = qlist1; q1 != NULL; q1 = q1->next) {	for (q2 = qlist2; q2 != NULL; q2 = q2->next)	    /* Check the name, then break ties with exechost. */	    if ((strcmp(q1->queue->qname, q2->queue->qname) == 0) &&	        (strcmp(q1->queue->exechost, q2->queue->exechost) == 0))	    {		break;	    }	if (q2 == NULL)	    return (1);    }    /*     * Walk the second list, searching for the named queue on the first     * list.  If not found, then they are disjoint.     */    for (q1 = qlist1; q1 != NULL; q1 = q1->next) {	for (q2 = qlist2; q2 != NULL; q2 = q2->next)	    /* Make sure both the name and execution host match. */	    if ((strcmp(q1->queue->qname, q2->queue->qname) == 0) &&	        (strcmp(q1->queue->exechost, q2->queue->exechost) == 0))	    {		break;	    }	if (q2 == NULL)	    return (1);    }    /*     * Both lists contain the same set of (possibly repeated) elements.     * They are not disjoint.     */    return (0);}static intqlist_unique(QueueList *qlist){    QueueList *q1, *q2;    /* No member of the empty set is repeated. */    if (qlist == NULL)	return (1);    /* A list with only 1 element cannot have repeated elements. */    if (qlist->next == NULL)	return (1);    /*     * For each element in the list, see if any other element in the list     * matches its queue name.  If so, the members of the set are not unique.     */    for (q1 = qlist; q1 != NULL; q1 = q1->next)	for (q2 = qlist; q2 != NULL; q2 = q2->next) {	    /* Is this the *same pointer* (not the same name)? */	    if (q1 == q2)		continue;	    	    /* 	     * If the queues match, then the list members are not unique.	     * Make sure both the name and execution host match.	     */	    if ((strcmp(q1->queue->qname, q2->queue->qname) == 0) &&	        (strcmp(q1->queue->exechost, q2->queue->exechost) == 0))	    {		return (0);	    }	}    /* No repeated elements found in the list -- it is unique. */    return (1);}/* Make sure no host is listed twice in the list. */static intqlist_one_per_host(QueueList *qlist){    QueueList *q1, *q2;    for (q1 = qlist; q1 != NULL; q1 = q1->next) {	for (q2 = qlist; q2 != NULL; q2 = q2->next) {	    if (q1 == q2)		continue;	    if (strcmp(q1->queue->exechost, q2->queue->exechost) == 0)		return (0);	}    }    return (1);		/* No host mentioned more than once. */}static intget_variance(char *string, int *lowp, int *highp){/*    char   *id = "get_variance"; */    char   *ptr, *buf, *end, sign;    long    n;    int     i, low = -1, high = -1;    if ((string == NULL) || ((buf = schd_strdup(string)) == NULL))	return (-1);    ptr = strtok(buf, ",");    while (ptr != NULL) {	/* Ensure that the string matches '{+-}[0-9][0-9]*%'. */	sign = *ptr;	if ((sign != '+') && (sign != '-'))	    goto parse_error;	ptr++;	if ((*ptr < '0') || (*ptr > '9'))	    goto parse_error;	n = strtol(ptr, &end, 10);	if (n > INT_MAX)	    goto parse_error;	i = (int)n;		if (*end != '%')	    goto parse_error;	if (sign == '-') {	    if (low >= 0)		/* Already set. */		goto parse_error;	    else		low = i;	} else {	    if (high >= 0)		/* Already set. */		goto parse_error;	    else		high = i;	}	ptr = strtok(NULL, ",");    }    free(buf);    *lowp  = (low >= 0) ? low : 0;    *highp = (high >= 0) ? high : 0;    return (0);parse_error:    free(buf);    return (-1);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -