From 46bb57e986f28947a0f04ffe9c5ab5fdba8818aa Mon Sep 17 00:00:00 2001
From: tewk <tewk@unknown>
Date: Sat, 29 Jun 2002 18:08:43 +0000
Subject: [PATCH] Modified launch_task message to include stream slurm_addrs
 and global_task_ids arrays for each task to be launched

---
 src/common/pack.h                |  4 +++-
 src/common/slurm_protocol_defs.c |  8 ++++----
 src/common/slurm_protocol_defs.h |  6 ++----
 src/common/slurm_protocol_pack.c | 12 ++++--------
 src/common/slurm_protocol_pack.h |  3 +++
 5 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/src/common/pack.h b/src/common/pack.h
index db32ad7802a..10acb515422 100644
--- a/src/common/pack.h
+++ b/src/common/pack.h
@@ -86,13 +86,15 @@ void	_unpackmem_malloc(char **valp, uint16_t *size_valp, void **bufp, int *lenp)
 	_packmem(str,(uint16_t)_size,bufp,lenp);	\
 } while (0)				
 
-#define packint_array(array,_size,bufp,lenp) do {			\
+#define pack32_array(array,_size,bufp,lenp) packint_array(array,_size,bufp,lenp)
+#define packint_array(array,_size,bufp,lenp) do {	\
 	assert((bufp) != NULL && *(bufp) != NULL);	\
         assert((lenp) != NULL);				\
         assert(*(lenp) >= (sizeof(_size)+_size));	\
 	_pack32array(array,(uint16_t)_size,bufp,lenp);	\
 } while (0)				
 
+#define unpack32_array(array,_size,bufp,lenp) unpackint_array(array,_size,bufp,lenp)
 #define unpackint_array(valp,size_valp,bufp,lenp) do {	\
 	assert(valp != NULL);				\
 	assert(sizeof(size_valp) == sizeof(uint16_t *));\
diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c
index 282675d894e..645e0c2f6b5 100644
--- a/src/common/slurm_protocol_defs.c
+++ b/src/common/slurm_protocol_defs.c
@@ -243,12 +243,12 @@ void slurm_free_launch_tasks_msg ( launch_tasks_msg_t * msg )
 			xfree ( msg -> cwd );
 		if ( msg -> cmd_line )
 			xfree ( msg -> cmd_line );
+		if ( msg -> streams )
+			xfree ( msg -> streams );
+		if ( msg -> global_task_ids )
+			xfree ( msg -> global_task_ids );
 		xfree ( msg ) ;
 	}
-	/*stdin location*/
-	/*stdout location*/
-	/*stderr location*/
-	/*task completion location*/
 } 
 
 void slurm_free_kill_tasks_msg ( kill_tasks_msg_t * msg )
diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h
index c7ed74e5c79..3e9db60db60 100644
--- a/src/common/slurm_protocol_defs.h
+++ b/src/common/slurm_protocol_defs.h
@@ -188,10 +188,8 @@ typedef struct launch_tasks_msg
 	char * env ;
 	char * cwd ;
 	char * cmd_line ;
-	/*stdin location*/
-	/*stdout location*/
-	/*stderr location*/
-	/*task completion location*/
+	slurm_addr * streams;
+	uint32_t * global_task_ids;
 } launch_tasks_msg_t ;
 
 typedef struct kill_tasks_msg
diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c
index 428587e0232..e3b60327cb0 100644
--- a/src/common/slurm_protocol_pack.c
+++ b/src/common/slurm_protocol_pack.c
@@ -800,10 +800,8 @@ void pack_launch_tasks_msg ( launch_tasks_msg_t * msg , void ** buffer , uint32_
 	packstr ( msg -> env , buffer , length ) ;
 	packstr ( msg -> cwd , buffer , length ) ;
 	packstr ( msg -> cmd_line , buffer , length ) ;
-	/*stdin location*/
-	/*stdout location*/
-	/*stderr location*/
-	/*task completion location*/
+	pack_slurm_addr_array ( msg -> streams , ( uint16_t ) msg -> tasks_to_launch , buffer , length ) ;
+	pack32_array ( msg -> global_task_ids , ( uint16_t ) msg -> tasks_to_launch , buffer , length ) ;
 }
 
 int unpack_launch_tasks_msg ( launch_tasks_msg_t ** msg_ptr , void ** buffer , uint32_t * length )
@@ -827,10 +825,8 @@ int unpack_launch_tasks_msg ( launch_tasks_msg_t ** msg_ptr , void ** buffer , u
 	unpackstr_xmalloc ( & msg -> env , & uint16_tmp , buffer , length ) ;
 	unpackstr_xmalloc ( & msg -> cwd , & uint16_tmp , buffer , length ) ;
 	unpackstr_xmalloc ( & msg -> cmd_line , & uint16_tmp , buffer , length ) ;
-	/*stdin location*/
-	/*stdout location*/
-	/*stderr location*/
-	/*task completion location*/
+	unpack_slurm_addr_array ( & msg -> streams , & uint16_tmp , buffer , length ) ;
+	unpack32_array ( & msg -> global_task_ids , & uint16_tmp , buffer , length ) ;
 	*msg_ptr = msg ;
 	return 0 ;
 }
diff --git a/src/common/slurm_protocol_pack.h b/src/common/slurm_protocol_pack.h
index f305e94bb5d..42e1cb43bfe 100644
--- a/src/common/slurm_protocol_pack.h
+++ b/src/common/slurm_protocol_pack.h
@@ -72,4 +72,7 @@ int unpack_launch_tasks_msg ( launch_tasks_msg_t ** msg_ptr , void ** buffer , u
 
 void pack_kill_tasks_msg ( kill_tasks_msg_t * msg , void ** buffer , uint32_t * length );
 int unpack_kill_tasks_msg ( kill_tasks_msg_t ** msg_ptr , void ** buffer , uint32_t * length );
+
+void pack_slurm_addr_array ( slurm_addr * slurm_address , uint16_t size_val, void ** buffer , int * length );
+void unpack_slurm_addr_array ( slurm_addr ** slurm_address , uint16_t * size_val , void ** buffer , int * length );
 #endif
-- 
GitLab