From e6bc3b28303fa26f3f4fb0f021433d7780132ff3 Mon Sep 17 00:00:00 2001
From: Mark Grondona <mgrondona@llnl.gov>
Date: Mon, 18 Nov 2002 18:57:35 +0000
Subject: [PATCH]  o add new fields to launch tasks message for stdout/in/err
 filenames

---
 src/common/slurm_protocol_defs.c | 10 ++++++++++
 src/common/slurm_protocol_defs.h |  5 +++++
 src/common/slurm_protocol_pack.c | 16 +++++++---------
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c
index 15b10107b83..18ac435e160 100644
--- a/src/common/slurm_protocol_defs.c
+++ b/src/common/slurm_protocol_defs.c
@@ -256,6 +256,16 @@ void slurm_free_launch_tasks_request_msg(launch_tasks_request_msg_t * msg)
 		}
 		if (msg->global_task_ids)
 			xfree(msg->global_task_ids);
+
+		if (msg->ofname)
+			xfree(msg->ofname);
+
+		if (msg->efname)
+			xfree(msg->ofname);
+
+		if (msg->ifname)
+			xfree(msg->ofname);
+
 #		ifdef HAVE_LIBELAN3
 		qsw_free_jobinfo(msg->qsw_job);
 #		endif
diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h
index 58368859798..45306472e14 100644
--- a/src/common/slurm_protocol_defs.h
+++ b/src/common/slurm_protocol_defs.h
@@ -238,6 +238,11 @@ typedef struct launch_tasks_request_msg {
 	uint16_t  task_flags;
 	uint32_t *global_task_ids;
 
+	/* stdout/err/in per task filenames */
+	char     *ofname;
+	char     *efname;
+	char     *ifname;
+
 	slurm_job_credential_t *credential;	/* job credential            */
 
 #ifdef HAVE_LIBELAN3
diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c
index d0a93cc1537..8c6209a4e9a 100644
--- a/src/common/slurm_protocol_pack.c
+++ b/src/common/slurm_protocol_pack.c
@@ -1838,6 +1838,9 @@ void pack_launch_tasks_request_msg ( launch_tasks_request_msg_t * msg ,
 	pack16 (  msg -> resp_port , buffer ) ;
 	pack16 (  msg -> io_port , buffer ) ;
 	pack16 (  msg -> task_flags , buffer ) ;
+	packstr ( msg -> ofname, buffer );
+	packstr ( msg -> efname, buffer );
+	packstr ( msg -> ifname, buffer );
 	pack32_array ( msg -> global_task_ids , 
 	               (uint16_t) msg -> tasks_to_launch , buffer ) ;
 #ifdef HAVE_LIBELAN3
@@ -1870,6 +1873,9 @@ int unpack_launch_tasks_request_msg (
 	safe_unpack16 ( & msg -> resp_port , buffer  ) ;
 	safe_unpack16 ( & msg -> io_port , buffer  ) ;
 	safe_unpack16 ( & msg -> task_flags , buffer  ) ;
+	safe_unpackstr_xmalloc ( &msg -> ofname, &uint16_tmp, buffer );
+	safe_unpackstr_xmalloc ( &msg -> efname, &uint16_tmp, buffer );
+	safe_unpackstr_xmalloc ( &msg -> ifname, &uint16_tmp, buffer );
 	safe_unpack32_array ( & msg -> global_task_ids , 
 	                      & uint16_tmp , buffer ) ;
 
@@ -1883,15 +1889,7 @@ int unpack_launch_tasks_request_msg (
 	return SLURM_SUCCESS ;
 
     unpack_error:
-	if (msg -> env)
-		xfree (msg -> env);
-	if (msg -> cwd)
-		xfree (msg -> cwd);
-	if (msg -> argv)
-		xfree (msg -> argv);
-	if (msg -> global_task_ids)
-		xfree (msg -> global_task_ids);
-        xfree (msg);
+	slurm_free_launch_tasks_request_msg(msg);
         *msg_ptr = NULL;
         return SLURM_ERROR;
 }
-- 
GitLab