From d5dd760048cad0f73bd587ec214f44db65ae164f Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Mon, 7 Mar 2005 13:50:01 +0000
Subject: [PATCH] Added new slurm_step_ctx_get() option: SLURM_STEP_CTX_RESP.

---
 doc/man/Makefile.am        | 1 +
 doc/man/man3/slurm_spawn.3 | 6 +++++-
 slurm/slurm.h.in           | 3 ++-
 src/api/spawn.c            | 7 +++++++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index feac6bbec21..360832c22fb 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -67,6 +67,7 @@ man3_MANS = man3/slurm_hostlist_create.3 \
 	man3/slurm_spawn_kill.3 \
 	man3/slurm_step_ctx_create.3 \
 	man3/slurm_step_ctx_destroy.3 \
+	man3/slurm_step_ctx_get.3 \
 	man3/slurm_step_ctx_set.3 \
 	man3/slurm_strerror.3 \
 	man3/slurm_submit_batch_job.3 \
diff --git a/doc/man/man3/slurm_spawn.3 b/doc/man/man3/slurm_spawn.3
index 00edf2fa772..6682e791d6b 100644
--- a/doc/man/man3/slurm_spawn.3
+++ b/doc/man/man3/slurm_spawn.3
@@ -1,4 +1,4 @@
-.TH "Slurm API" "3" "July 2004" "Morris Jette" "Slurm task spawn functions"
+.TH "Slurm API" "3" "March 2005" "Morris Jette" "Slurm task spawn functions"
 .SH "NAME"
 slurm_spawn \- Slurm task spawn functions
 .SH "SYNTAX"
@@ -127,6 +127,10 @@ Accepts two additional arguments, the first of type int and
 the second of type char **. By default the current environment 
 variables are copied to started task's environment.
 .TP
+\fBSLURM_STEP_CTX_RESP\fR
+Get the job step response message.
+Accepts one additional argument of type job_step_create_response_msg_t **.
+.TP
 \fBSLURM_STEP_CTX_STEPID\fR
 Get the step id of the created job step.
 Accepts one additional argument of type uint32_t *.
diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in
index 10b5b3bad65..9dacbf5d489 100644
--- a/slurm/slurm.h.in
+++ b/slurm/slurm.h.in
@@ -226,7 +226,8 @@ enum ctx_keys {
 	SLURM_STEP_CTX_ENV,	/* set environment variable count and values */
 	SLURM_STEP_CTX_STEPID,	/* get the created job step id */
 	SLURM_STEP_CTX_TASKS,	/* get array of task count on each node */
-	SLURM_STEP_CTX_TID	/* get array of task IDs for specified node */
+	SLURM_STEP_CTX_TID,	/* get array of task IDs for specified node */
+	SLURM_STEP_CTX_RESP	/* get job step create response message */
 };
 
 /*****************************************************************************\
diff --git a/src/api/spawn.c b/src/api/spawn.c
index b297e631ddf..968dc7f94b5 100644
--- a/src/api/spawn.c
+++ b/src/api/spawn.c
@@ -162,6 +162,7 @@ slurm_step_ctx_get (slurm_step_ctx ctx, int ctx_key, ...)
 	uint32_t node_inx;
 	uint32_t *step_id_ptr;
 	uint32_t **array_pptr = (uint32_t **) NULL;
+	job_step_create_response_msg_t ** step_resp_pptr;
 
 	if ((ctx == NULL) ||
 	    (ctx->magic != STEP_CTX_MAGIC)) {
@@ -191,6 +192,12 @@ slurm_step_ctx_get (slurm_step_ctx ctx, int ctx_key, ...)
 			*array_pptr = ctx->tids[node_inx];
 			break;
 
+		case SLURM_STEP_CTX_RESP:
+			step_resp_pptr = (job_step_create_response_msg_t **) 
+				va_arg(ap, void *);
+			*step_resp_pptr = ctx->step_resp;
+			break;
+
 		default:
 			slurm_seterrno(EINVAL);
 			rc = SLURM_ERROR;
-- 
GitLab