From d08c5a387a4723e23501991bc9834ba7eb2def94 Mon Sep 17 00:00:00 2001
From: Mark Grondona <mgrondona@llnl.gov>
Date: Tue, 7 Oct 2003 20:15:51 +0000
Subject: [PATCH]  o add new variable for totalview support "totalview_jobid"
 which   contains the string that %J will expand to during totalview bulk  
 launch.

---
 src/srun/attach.h | 4 ++++
 src/srun/msg.c    | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/srun/attach.h b/src/srun/attach.h
index 6d13cd80a79..7238f75a967 100644
--- a/src/srun/attach.h
+++ b/src/srun/attach.h
@@ -77,4 +77,8 @@ extern int MPIR_acquired_pre_main;
 extern void MPIR_Breakpoint(void);
 extern void tv_launch_failure(void);
 
+/* Value for totalview %J expansion in bulk launch string
+ */
+extern char *totalview_jobid; 
+
 #endif
diff --git a/src/srun/msg.c b/src/srun/msg.c
index 355b1e0b864..deda10f4304 100644
--- a/src/srun/msg.c
+++ b/src/srun/msg.c
@@ -62,6 +62,8 @@
 #  include "src/srun/attach.h"
 #endif
 
+#include "src/common/xstring.h"
+
 #define LAUNCH_WAIT_SEC	 60	/* max wait to confirm launches, sec */
 
 static int    tasks_exited     = 0;
@@ -113,6 +115,8 @@ _build_tv_list(job_t *job, char *host, int nodeid, int ntasks, uint32_t *pid)
 	if (MPIR_proctable_size == 0) {
 		MPIR_proctable_size = opt.nprocs;
 		MPIR_proctable = xmalloc(sizeof(MPIR_PROCDESC) * opt.nprocs);
+		totalview_jobid = NULL;
+		xstrfmtcat(totalview_jobid, "%lu", job->jobid);
 	}
 
 	for (i = 0; i < ntasks; i++) {
-- 
GitLab