diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c index ef9ea73df0eabc76844ef47e96f6d2af2c00d2de..c99cb088e4a1578fc33d81b7f11af03d06f45fba 100644 --- a/src/common/slurm_protocol_defs.c +++ b/src/common/slurm_protocol_defs.c @@ -239,6 +239,13 @@ void slurm_free_revoke_credential_msg(revoke_credential_msg_t * msg) } } +void slurm_free_update_job_time_msg(job_time_msg_t * msg) +{ + if (msg) { + xfree(msg); + } +} + void slurm_free_task_exit_msg(task_exit_msg_t * msg) { if (msg) { diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h index 2d98a051ee38f300e1f00f284dc7239fc0957959..b6ac1ef8e335fb08111ce50ff5b89e3e4102bd83 100644 --- a/src/common/slurm_protocol_defs.h +++ b/src/common/slurm_protocol_defs.h @@ -118,6 +118,7 @@ typedef enum { REQUEST_ALLOCATION_AND_RUN_JOB_STEP, RESPONSE_ALLOCATION_AND_RUN_JOB_STEP, REQUEST_OLD_JOB_RESOURCE_ALLOCATION, + REQUEST_UPDATE_JOB_TIME, REQUEST_JOB_STEP_CREATE = 5001, RESPONSE_JOB_STEP_CREATE, @@ -284,6 +285,11 @@ typedef struct revoke_credential_msg { char signature[SLURM_SSL_SIGNATURE_LENGTH]; } revoke_credential_msg_t; +typedef struct job_time_msg { + uint32_t job_id; + time_t expiration_time; +} job_time_msg_t; + typedef struct reattach_tasks_request_msg { uint32_t job_id; uint32_t job_step_id; @@ -379,6 +385,7 @@ void inline slurm_free_reattach_tasks_response_msg(reattach_tasks_response_msg_t * msg); void inline slurm_free_revoke_credential_msg(revoke_credential_msg_t * msg); +void inline slurm_free_update_job_time_msg(job_time_msg_t * msg); extern char *job_dist_string(uint16_t inx); extern char *job_state_string(enum job_states inx); diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c index 18d56643f22d0e68380dcc1f4dae5202df41d70c..7964a3bcc0d84a403b9bc40ea3d6e433d5a34531 100644 --- a/src/common/slurm_protocol_pack.c +++ b/src/common/slurm_protocol_pack.c @@ -92,6 +92,9 @@ static void _pack_revoke_credential_msg(revoke_credential_msg_t * msg, static int _unpack_revoke_credential_msg(revoke_credential_msg_t ** msg, Buf buffer); +static void _pack_update_job_time_msg(job_time_msg_t * msg, Buf buffer); +static int _unpack_update_job_time_msg(job_time_msg_t ** msg, Buf buffer); + static void _pack_job_step_create_response_msg(job_step_create_response_msg_t * msg, Buf buffer); @@ -402,6 +405,10 @@ pack_msg(slurm_msg_t const *msg, Buf buffer) _pack_revoke_credential_msg((revoke_credential_msg_t *) msg->data, buffer); break; + case REQUEST_UPDATE_JOB_TIME: + _pack_update_job_time_msg((job_time_msg_t *) + msg->data, buffer); + break; case REQUEST_SIGNAL_JOB: break; case REQUEST_SIGNAL_JOB_STEP: @@ -594,6 +601,11 @@ unpack_msg(slurm_msg_t * msg, Buf buffer) (revoke_credential_msg_t **) & (msg->data), buffer); break; + case REQUEST_UPDATE_JOB_TIME: + rc = _unpack_update_job_time_msg( + (job_time_msg_t **) + & (msg->data), buffer); + break; case REQUEST_SIGNAL_JOB: break; case REQUEST_SIGNAL_JOB_STEP: @@ -1127,7 +1139,7 @@ _pack_revoke_credential_msg(revoke_credential_msg_t * msg, Buf buffer) assert(msg != NULL); pack32(msg->job_id, buffer); - pack32((uint32_t) msg->expiration_time, buffer); + pack_time(msg->expiration_time, buffer); packmem_array(msg->signature, (uint32_t) SLURM_SSL_SIGNATURE_LENGTH, buffer); } @@ -1143,7 +1155,7 @@ _unpack_revoke_credential_msg(revoke_credential_msg_t ** msg, Buf buffer) *msg = tmp_ptr; safe_unpack32(&(tmp_ptr->job_id), buffer); - safe_unpack32((uint32_t *) & (tmp_ptr->expiration_time), buffer); + safe_unpack_time(& (tmp_ptr->expiration_time), buffer); safe_unpackmem_array(tmp_ptr->signature, (uint32_t) SLURM_SSL_SIGNATURE_LENGTH, buffer); @@ -1155,6 +1167,35 @@ _unpack_revoke_credential_msg(revoke_credential_msg_t ** msg, Buf buffer) return SLURM_ERROR; } +static void +_pack_update_job_time_msg(job_time_msg_t * msg, Buf buffer) +{ + assert(msg != NULL); + + pack32(msg->job_id, buffer); + pack_time((uint32_t) msg->expiration_time, buffer); +} + +static int +_unpack_update_job_time_msg(job_time_msg_t ** msg, Buf buffer) +{ + job_time_msg_t *tmp_ptr; + + /* alloc memory for structure */ + assert(msg); + tmp_ptr = xmalloc(sizeof(job_time_msg_t)); + *msg = tmp_ptr; + + safe_unpack32(&(tmp_ptr->job_id), buffer); + safe_unpack_time(& (tmp_ptr->expiration_time), buffer); + return SLURM_SUCCESS; + + unpack_error: + xfree(tmp_ptr); + *msg = NULL; + return SLURM_ERROR; +} + /* pack_job_credential * packs a slurm job credential * IN cred - pointer to the credential