From 5d39520acfa3bf96148326eeef432c5f89151c54 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Thu, 14 Dec 2006 20:36:41 +0000 Subject: [PATCH] Add missing symbol (wiki2 module with function not in wiki plugin). --- src/plugins/sched/wiki/get_jobs.c | 36 ++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/plugins/sched/wiki/get_jobs.c b/src/plugins/sched/wiki/get_jobs.c index 2b067b31ace..bb0bee1ab2d 100644 --- a/src/plugins/sched/wiki/get_jobs.c +++ b/src/plugins/sched/wiki/get_jobs.c @@ -189,11 +189,12 @@ static char * _dump_job(struct job_record *job_ptr, int state_info) && (job_ptr->details) && (job_ptr->details->req_nodes) && (job_ptr->details->req_nodes[0])) { + char *hosts = bitmap2wiki_node_name( + job_ptr->details->req_node_bitmap); snprintf(tmp, sizeof(tmp), - "HOSTLIST=%s;", - bitmap2wiki_node_name( - job_ptr->details->req_node_bitmap)); + "HOSTLIST=%s;", hosts); xstrcat(buf, tmp); + xfree(hosts); } if (job_ptr->job_state == JOB_FAILED) { @@ -364,3 +365,32 @@ static uint32_t _get_job_suspend_time(struct job_record *job_ptr) } return (uint32_t) 0; } + +/* + * bitmap2wiki_node_name - given a bitmap, build a list of colon separated + * node names (if we can't use node range expressions), or the + * normal slurm node name expression + * + * IN bitmap - bitmap pointer + * RET pointer to node list or NULL on error + * globals: node_record_table_ptr - pointer to node table + * NOTE: the caller must xfree the memory at node_list when no longer required + */ +extern char * bitmap2wiki_node_name(bitstr_t *bitmap) +{ + int i, first = 1; + char *buf = NULL; + + if (bitmap == NULL) + return xstrdup(""); + + for (i = 0; i < node_record_count; i++) { + if (bit_test (bitmap, i) == 0) + continue; + if (first == 0) + xstrcat(buf, ":"); + first = 0; + xstrcat(buf, node_record_table_ptr[i].name); + } + return buf; +} -- GitLab