Newer
Older
*part = xmalloc ( sizeof(partition_info_t) );
if (unpack_partition_info_members ( *part , buffer ) ) {
xfree (*part);
*part = NULL;
return SLURM_ERROR;
} else
return SLURM_SUCCESS ;

tewk
committed
}
int unpack_partition_info_members ( partition_info_t * part , Buf buffer )

tewk
committed
{
uint16_t uint16_tmp;
char * node_inx_str = NULL;

tewk
committed
safe_unpackstr_xmalloc (&part->name, &uint16_tmp, buffer);

tewk
committed
if (part->name == NULL)
part->name = xmalloc(1); /* part->name = "" implicit set */
safe_unpack32 (&part->max_time, buffer);
safe_unpack32 (&part->max_nodes, buffer);
safe_unpack32 (&part->total_nodes, buffer);
safe_unpack32 (&part->total_cpus, buffer);
safe_unpack16 (&part->default_part, buffer);
safe_unpack16 (&part->root_only, buffer);
safe_unpack16 (&part->shared, buffer);
safe_unpack16 (&part->state_up, buffer);
safe_unpackstr_xmalloc (&part->allow_groups, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&part->nodes, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&node_inx_str, &uint16_tmp, buffer);

tewk
committed
if (node_inx_str == NULL)
part->node_inx = bitfmt2int("");
else {
part->node_inx = bitfmt2int(node_inx_str);
xfree ( node_inx_str );
node_inx_str = NULL;
return SLURM_SUCCESS;
unpack_error:
if (part->name)
xfree (part->name);
if (part->allow_groups)
xfree (part->allow_groups);
if (part->nodes)
xfree (part->nodes);
if (node_inx_str)
xfree (node_inx_str);
return SLURM_ERROR;

tewk
committed
}
void pack_job_step_info_members( uint32_t job_id, uint16_t step_id,
uint32_t user_id, time_t start_time, char *partition, char *nodes,
Buf buffer )
{
pack32 ( job_id , buffer ) ;
pack16 ( step_id , buffer ) ;
pack32 ( user_id , buffer ) ;
pack_time ( start_time , buffer ) ;
packstr ( partition, buffer ) ;
packstr ( nodes, buffer ) ;
void pack_job_step_info ( job_step_info_t* step, Buf buffer )
{
pack_job_step_info_members(
step->job_id,
step->step_id,
step->user_id,
step->start_time,
step->partition ,
step->nodes,
buffer
);
}
int unpack_job_step_info_members ( job_step_info_t * step , Buf buffer )
{
uint16_t uint16_tmp = 0;
safe_unpack32 (&step->job_id, buffer);
safe_unpack16 (&step->step_id, buffer);
safe_unpack32 (&step->user_id, buffer);
safe_unpack_time (&step->start_time, buffer);
safe_unpackstr_xmalloc (&step->partition, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&step->nodes, &uint16_tmp, buffer);
return SLURM_SUCCESS;
unpack_error:
if (step->partition)
xfree (step->partition);
if (step->nodes)
xfree (step->nodes);
return SLURM_ERROR;
int unpack_job_step_info ( job_step_info_t ** step , Buf buffer )
{
*step = xmalloc( sizeof( job_step_info_t ) );
if (unpack_job_step_info_members( *step, buffer )) {
xfree (*step);
*step = NULL;
return SLURM_ERROR;
} else
return SLURM_SUCCESS;
int unpack_job_step_info_response_msg ( job_step_info_response_msg_t** msg, Buf buffer )
{
int i=0;
job_step_info_t * step;
*msg = xmalloc( sizeof( job_step_info_response_msg_t ) );
safe_unpack_time (&(*msg)->last_update , buffer);
safe_unpack32 (&(*msg)->job_step_count , buffer);
step = (*msg)->job_steps = xmalloc( sizeof(job_step_info_t) * (*msg)->job_step_count );
for ( i=0; i < (*msg)->job_step_count; i++ )
if (unpack_job_step_info_members ( &step[i] , buffer))
goto unpack_error;
return SLURM_SUCCESS;
unpack_error:
if (step)
xfree (step);
xfree (*msg);
*msg = NULL;
return SLURM_ERROR;
void pack_buffer_msg ( slurm_msg_t * msg, Buf buffer )
{
packmem_array ( msg->data , msg->data_size, buffer );
int unpack_job_info_msg ( job_info_msg_t ** msg , Buf buffer )
job_info_t *job = NULL;
*msg = xmalloc ( sizeof ( job_info_msg_t ) );
/* load buffer's header (data structure version and time) */
safe_unpack32 (&((*msg) -> record_count), buffer);
safe_unpack_time (&((*msg) -> last_update ) , buffer);
job = (*msg) -> job_array = xmalloc ( sizeof ( job_info_t ) * (*msg)->record_count ) ;
/* load individual job info */
for (i = 0; i < (*msg)->record_count ; i++) {
if (unpack_job_info_members ( & job[i] , buffer ))
goto unpack_error;
return SLURM_SUCCESS;
unpack_error:
if (job)
xfree (job);
xfree (*msg);
*msg = NULL;
return SLURM_ERROR;
int unpack_job_info ( job_info_t ** msg , Buf buffer )
if (unpack_job_info_members ( *msg , buffer ) )
goto unpack_error;
return SLURM_SUCCESS ;
unpack_error:
xfree (*msg);
*msg = NULL;
return SLURM_ERROR;
int unpack_job_info_members ( job_info_t * job , Buf buffer )
{
uint16_t uint16_tmp;
char * node_inx_str;
safe_unpack32 (&job->job_id, buffer);
safe_unpack32 (&job->user_id, buffer);
safe_unpack16 (&job->job_state, buffer);
safe_unpack32 (&job->time_limit, buffer);
safe_unpack_time (&job->start_time, buffer);
safe_unpack_time (&job->end_time, buffer);
safe_unpack32 (&job->priority, buffer);
safe_unpackstr_xmalloc (&job->nodes, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&job->partition, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&job->name, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&node_inx_str, &uint16_tmp, buffer);
job->node_inx = bitfmt2int("");
else {
job->node_inx = bitfmt2int(node_inx_str);
xfree ( node_inx_str );
}
safe_unpack32 (&job->num_procs, buffer);
safe_unpack32 (&job->num_nodes, buffer);
safe_unpack16 (&job->shared, buffer);
safe_unpack16 (&job->contiguous, buffer);
safe_unpack32 (&job->min_procs, buffer);
safe_unpack32 (&job->min_memory, buffer);
safe_unpack32 (&job->min_tmp_disk, buffer);
safe_unpackstr_xmalloc (&job->req_nodes, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&node_inx_str, &uint16_tmp, buffer);
job->req_node_inx = bitfmt2int("");
else {
safe_unpackstr_xmalloc (&job->features, &uint16_tmp, buffer);
return SLURM_SUCCESS ;
unpack_error:
if (job->nodes)
xfree (job->nodes);
if (job->partition)
xfree (job->partition);
if (job->name)
xfree (job->name);
if (job->req_nodes)
xfree (job->req_nodes);
if (job->features)
xfree (job->features);
return SLURM_ERROR;

tewk
committed
}
void pack_slurm_ctl_conf ( slurm_ctl_conf_info_msg_t * build_ptr, Buf buffer )
pack_time (build_ptr->last_update, buffer);
packstr (build_ptr->backup_addr, buffer);
packstr (build_ptr->backup_controller, buffer);
packstr (build_ptr->control_addr, buffer);
packstr (build_ptr->control_machine, buffer);
packstr (build_ptr->epilog, buffer);
pack16 (build_ptr->fast_schedule, buffer);
pack16 (build_ptr->hash_base, buffer);
pack16 (build_ptr->heartbeat_interval, buffer);
pack16 (build_ptr->inactive_limit, buffer);
pack16 (build_ptr->kill_wait, buffer);
packstr (build_ptr->prioritize, buffer);
packstr (build_ptr->prolog, buffer);
pack16 (build_ptr->ret2service, buffer);
pack16 (build_ptr->slurmctld_timeout, buffer);
pack16 (build_ptr->slurmd_timeout, buffer);
packstr (build_ptr->slurm_conf, buffer);
packstr (build_ptr->state_save_location, buffer);
packstr (build_ptr->tmp_fs, buffer);
packstr (build_ptr->job_credential_private_key, buffer);
packstr (build_ptr->job_credential_public_certificate, buffer);
}
int unpack_slurm_ctl_conf ( slurm_ctl_conf_info_msg_t **build_buffer_ptr, Buf buffer )
{
uint16_t uint16_tmp;
slurm_ctl_conf_info_msg_t * build_ptr ;
/* alloc memory for structure */
build_ptr = xmalloc ( sizeof ( slurm_ctl_conf_t ) ) ;
*build_buffer_ptr = build_ptr ;
/* load the data values */
/* unpack timestamp of snapshot */
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
safe_unpack_time (&build_ptr->last_update, buffer);
safe_unpackstr_xmalloc (&build_ptr->backup_addr, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&build_ptr->backup_controller, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&build_ptr->control_addr, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&build_ptr->control_machine, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&build_ptr->epilog, &uint16_tmp, buffer);
safe_unpack16 (&build_ptr->fast_schedule, buffer);
safe_unpack16 (&build_ptr->hash_base, buffer);
safe_unpack16 (&build_ptr->heartbeat_interval, buffer);
safe_unpack16 (&build_ptr->inactive_limit, buffer);
safe_unpack16 (&build_ptr->kill_wait, buffer);
safe_unpackstr_xmalloc (&build_ptr->prioritize, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&build_ptr->prolog, &uint16_tmp, buffer);
safe_unpack16 (&build_ptr->ret2service, buffer);
safe_unpack16 (&build_ptr->slurmctld_timeout, buffer);
safe_unpack16 (&build_ptr->slurmd_timeout, buffer);
safe_unpackstr_xmalloc (&build_ptr->slurm_conf, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&build_ptr->state_save_location, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&build_ptr->tmp_fs, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&build_ptr->job_credential_private_key, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&build_ptr->job_credential_public_certificate, &uint16_tmp, buffer);
return SLURM_SUCCESS ;
unpack_error:
if (build_ptr->backup_addr)
xfree (build_ptr->backup_addr);
if (build_ptr->control_addr)
xfree (build_ptr->control_addr);
if (build_ptr->control_addr)
xfree (build_ptr->control_addr);
if (build_ptr->control_machine)
xfree (build_ptr->control_machine);
if (build_ptr->epilog)
xfree (build_ptr->epilog);
if (build_ptr->prioritize)
xfree (build_ptr->prioritize);
if (build_ptr->prolog)
xfree (build_ptr->prolog);
if (build_ptr->slurm_conf)
xfree (build_ptr->slurm_conf);
if (build_ptr->state_save_location)
xfree (build_ptr->state_save_location);
if (build_ptr->tmp_fs)
xfree (build_ptr->tmp_fs);
if (build_ptr->job_credential_private_key)
xfree (build_ptr->job_credential_private_key);
if (build_ptr->job_credential_public_certificate)
xfree (build_ptr->job_credential_public_certificate);
xfree (build_ptr);
*build_buffer_ptr = NULL;
return SLURM_ERROR;
/* pack_job_desc
* packs a job_desc struct
* header - the body structure to pack
* buffer - destination of the pack, contains pointers that are automatically updated
void pack_job_desc ( job_desc_msg_t * job_desc_ptr, Buf buffer )
{
/* load the data values */
pack16 (job_desc_ptr->contiguous, buffer);
pack16 (job_desc_ptr->kill_on_node_fail, buffer);
packstr (job_desc_ptr->features, buffer);
pack32 (job_desc_ptr->job_id, buffer);
packstr (job_desc_ptr->name, buffer);
pack32 (job_desc_ptr->min_procs, buffer);
pack32 (job_desc_ptr->min_memory, buffer);
pack32 (job_desc_ptr->min_tmp_disk, buffer);
packstr (job_desc_ptr->partition, buffer);
pack32 (job_desc_ptr->priority, buffer);
packstr (job_desc_ptr->req_nodes, buffer);
packstr_array (job_desc_ptr->environment, job_desc_ptr->env_size, buffer);
packstr (job_desc_ptr->script, buffer);
packstr (job_desc_ptr->err, buffer);
packstr (job_desc_ptr->in, buffer);
packstr (job_desc_ptr->out, buffer);
packstr (job_desc_ptr->work_dir, buffer);
pack16 (job_desc_ptr->shared, buffer);
pack32 (job_desc_ptr->time_limit, buffer);
pack32 (job_desc_ptr->num_procs, buffer);
pack32 (job_desc_ptr->num_nodes, buffer);
pack32 (job_desc_ptr->user_id, buffer);
* unpacks a job_desc struct
* header - the body structure to unpack
* buffer - source of the unpack, contains pointers that are automatically updated
int unpack_job_desc ( job_desc_msg_t **job_desc_buffer_ptr, Buf buffer )
{
uint16_t uint16_tmp;
job_desc_msg_t * job_desc_ptr ;
/* alloc memory for structure */
job_desc_ptr = xmalloc ( sizeof ( job_desc_msg_t ) ) ;
*job_desc_buffer_ptr = job_desc_ptr ;
/* load the data values */
safe_unpack16 (&job_desc_ptr->contiguous, buffer);
safe_unpack16 (&job_desc_ptr->kill_on_node_fail, buffer);
safe_unpackstr_xmalloc (&job_desc_ptr->features, &uint16_tmp, buffer);
safe_unpack32 (&job_desc_ptr->job_id, buffer);
safe_unpackstr_xmalloc (&job_desc_ptr->name, &uint16_tmp, buffer);
safe_unpack32 (&job_desc_ptr->min_procs, buffer);
safe_unpack32 (&job_desc_ptr->min_memory, buffer);
safe_unpack32 (&job_desc_ptr->min_tmp_disk, buffer);
safe_unpackstr_xmalloc (&job_desc_ptr->partition, &uint16_tmp, buffer);
safe_unpack32 (&job_desc_ptr->priority, buffer);
safe_unpackstr_xmalloc (&job_desc_ptr->req_nodes, &uint16_tmp, buffer);
safe_unpackstr_array (&job_desc_ptr->environment, &job_desc_ptr->env_size, buffer);
safe_unpackstr_xmalloc (&job_desc_ptr->script, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&job_desc_ptr->err, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&job_desc_ptr->in, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&job_desc_ptr->out, &uint16_tmp, buffer);
safe_unpackstr_xmalloc (&job_desc_ptr->work_dir, &uint16_tmp, buffer);
safe_unpack16 (&job_desc_ptr->shared, buffer);
safe_unpack32 (&job_desc_ptr->time_limit, buffer);
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
safe_unpack32 (&job_desc_ptr->num_procs, buffer);
safe_unpack32 (&job_desc_ptr->num_nodes, buffer);
safe_unpack32 (&job_desc_ptr->user_id, buffer);
return SLURM_SUCCESS ;
unpack_error:
if (job_desc_ptr->features)
xfree (job_desc_ptr->features);
if (job_desc_ptr->name)
xfree (job_desc_ptr->name);
if (job_desc_ptr->partition)
xfree (job_desc_ptr->partition);
if (job_desc_ptr->req_nodes)
xfree (job_desc_ptr->req_nodes);
if (job_desc_ptr->environment)
xfree (job_desc_ptr->environment);
if (job_desc_ptr->script)
xfree (job_desc_ptr->script);
if (job_desc_ptr->err)
xfree (job_desc_ptr->err);
if (job_desc_ptr->in)
xfree (job_desc_ptr->in);
if (job_desc_ptr->out)
xfree (job_desc_ptr->out);
if (job_desc_ptr->work_dir)
xfree (job_desc_ptr->work_dir);
xfree (job_desc_ptr);
*job_desc_buffer_ptr = NULL;
return SLURM_ERROR;
}
void pack_old_job_desc ( old_job_alloc_msg_t * job_desc_ptr, Buf buffer )
{
/* load the data values */
pack32 (job_desc_ptr->job_id, buffer);
pack32 (job_desc_ptr->uid, buffer);
}
int unpack_old_job_desc ( old_job_alloc_msg_t **job_desc_buffer_ptr, Buf buffer )
{
old_job_alloc_msg_t * job_desc_ptr ;
/* alloc memory for structure */
assert (job_desc_buffer_ptr != NULL);
job_desc_ptr = xmalloc ( sizeof ( old_job_alloc_msg_t ) ) ;
*job_desc_buffer_ptr = job_desc_ptr ;
/* load the data values */
safe_unpack32 (&job_desc_ptr->job_id, buffer);
safe_unpack32 (&job_desc_ptr->uid, buffer);
return SLURM_SUCCESS ;
unpack_error:
xfree (job_desc_ptr);
*job_desc_buffer_ptr = NULL;
return SLURM_ERROR;
void pack_last_update ( last_update_msg_t * msg , Buf buffer )
{
pack_time ( msg -> last_update , buffer ) ;
}
int unpack_last_update ( last_update_msg_t ** msg , Buf buffer )
{
last_update_msg_t * last_update_msg ;
last_update_msg = xmalloc ( sizeof ( last_update_msg_t ) ) ;
*msg = last_update_msg ;
safe_unpack_time ( & last_update_msg -> last_update , buffer ) ;
return SLURM_SUCCESS ;
unpack_error:
xfree (last_update_msg);
*msg = NULL;
return SLURM_ERROR;
void pack_return_code ( return_code_msg_t * msg , Buf buffer )
pack32 ( msg -> return_code , buffer ) ;
int unpack_return_code ( return_code_msg_t ** msg , Buf buffer )
{
return_code_msg_t * return_code_msg ;
return_code_msg = xmalloc ( sizeof ( return_code_msg_t ) ) ;
safe_unpack32 ( & return_code_msg -> return_code , buffer ) ;
return SLURM_SUCCESS ;
unpack_error:
xfree (return_code_msg);
*msg = NULL;
return SLURM_ERROR;
void pack_reattach_tasks_streams_msg ( reattach_tasks_streams_msg_t * msg , Buf buffer )
pack32 ( msg -> job_id , buffer ) ;
pack32 ( msg -> job_step_id , buffer ) ;
pack32 ( msg -> uid , buffer ) ;
pack_job_credential ( msg -> credential , buffer ) ;
pack32 ( msg -> tasks_to_reattach , buffer ) ;
slurm_pack_slurm_addr ( & msg -> streams , buffer ) ;
pack32_array ( msg -> global_task_ids , ( uint16_t ) msg -> tasks_to_reattach , buffer ) ;
int unpack_reattach_tasks_streams_msg ( reattach_tasks_streams_msg_t ** msg_ptr , Buf buffer )
{
uint16_t uint16_tmp;
reattach_tasks_streams_msg_t * msg ;
msg = xmalloc ( sizeof ( reattach_tasks_streams_msg_t ) ) ;
safe_unpack32 ( & msg -> job_id , buffer ) ;
safe_unpack32 ( & msg -> job_step_id , buffer ) ;
safe_unpack32 ( & msg -> uid , buffer ) ;
if (unpack_job_credential( & msg -> credential , buffer ))
goto unpack_error;
safe_unpack32 ( & msg -> tasks_to_reattach , buffer ) ;
if (slurm_unpack_slurm_addr_no_alloc ( & msg -> streams , buffer ))
goto unpack_error;
safe_unpack32_array ( & msg -> global_task_ids , & uint16_tmp , buffer ) ;
return SLURM_SUCCESS ;
unpack_error:
if (msg -> global_task_ids)
xfree (msg -> global_task_ids);
xfree (msg);
*msg_ptr = NULL;
return SLURM_ERROR;
void pack_task_exit_msg ( task_exit_msg_t * msg , Buf buffer )
pack32 ( msg -> task_id , buffer ) ;
pack32 ( msg -> return_code , buffer ) ;
int unpack_task_exit_msg ( task_exit_msg_t ** msg_ptr , Buf buffer )
safe_unpack32 ( & msg -> task_id , buffer ) ;
safe_unpack32 ( & msg -> return_code , buffer ) ;
return SLURM_SUCCESS ;
unpack_error:
xfree (msg);
*msg_ptr = NULL;
return SLURM_ERROR;
void pack_launch_tasks_response_msg ( launch_tasks_response_msg_t * msg , Buf buffer )
packstr ( msg -> node_name , buffer ) ;
pack32 ( msg -> srun_node_id , buffer ) ;
int unpack_launch_tasks_response_msg ( launch_tasks_response_msg_t ** msg_ptr , Buf buffer )
{
uint16_t uint16_tmp;
launch_tasks_response_msg_t * msg ;
msg = xmalloc ( sizeof ( launch_tasks_response_msg_t ) ) ;
*msg_ptr = msg ;
safe_unpack32 ( & msg -> return_code , buffer ) ;
safe_unpackstr_xmalloc ( & msg -> node_name , & uint16_tmp , buffer ) ;
safe_unpack32 ( & msg -> srun_node_id , buffer ) ;
return SLURM_SUCCESS ;
unpack_error:
if (msg -> node_name)
xfree (msg -> node_name);
xfree (msg);
*msg_ptr = NULL;
return SLURM_ERROR;
void pack_launch_tasks_request_msg ( launch_tasks_request_msg_t * msg , Buf buffer )
{
pack32 ( msg -> job_id , buffer ) ;
pack32 ( msg -> job_step_id , buffer ) ;
pack32 ( msg -> nnodes, buffer ) ;
pack32 ( msg -> nprocs, buffer ) ;
pack32 ( msg -> uid , buffer ) ;
pack32 ( msg -> srun_node_id , buffer ) ;
pack_job_credential ( msg -> credential , buffer ) ;
pack32 ( msg -> tasks_to_launch , buffer ) ;
packstr_array ( msg -> env , msg -> envc , buffer ) ;
packstr ( msg -> cwd , buffer ) ;
packstr_array ( msg -> argv , msg -> argc , buffer ) ;
pack16 ( msg -> resp_port , buffer ) ;
pack16 ( msg -> io_port , buffer ) ;
pack32_array ( msg -> global_task_ids , (uint16_t) msg -> tasks_to_launch , buffer ) ;
qsw_pack_jobinfo( msg -> qsw_job , buffer ) ;
int unpack_launch_tasks_request_msg ( launch_tasks_request_msg_t ** msg_ptr , Buf buffer )
launch_tasks_request_msg_t * msg ;
msg = xmalloc ( sizeof ( launch_tasks_request_msg_t ) ) ;
*msg_ptr = msg ;
safe_unpack32 ( & msg -> job_id , buffer ) ;
safe_unpack32 ( & msg -> job_step_id , buffer ) ;
safe_unpack32 ( & msg -> nnodes, buffer ) ;
safe_unpack32 ( & msg -> nprocs, buffer ) ;
safe_unpack32 ( & msg -> uid , buffer ) ;
safe_unpack32 ( & msg -> srun_node_id , buffer ) ;
if (unpack_job_credential( & msg -> credential , buffer ))
goto unpack_error;
safe_unpack32 ( & msg -> tasks_to_launch , buffer ) ;
safe_unpackstr_array ( & msg -> env , & msg -> envc , buffer ) ;
safe_unpackstr_xmalloc ( & msg -> cwd , & uint16_tmp , buffer ) ;
safe_unpackstr_array ( & msg -> argv , & msg->argc , buffer ) ;
safe_unpack16 ( & msg -> resp_port , buffer ) ;
safe_unpack16 ( & msg -> io_port , buffer ) ;
safe_unpack32_array ( & msg -> global_task_ids , & uint16_tmp , buffer ) ;
qsw_alloc_jobinfo(&msg->qsw_job);
if (qsw_unpack_jobinfo(msg->qsw_job, (void **) buffer) < 0) {
goto unpack_error;
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);
*msg_ptr = NULL;
return SLURM_ERROR;
void pack_cancel_tasks_msg ( kill_tasks_msg_t * msg , Buf buffer )
pack32 ( msg -> job_id , buffer ) ;
pack32 ( msg -> job_step_id , buffer ) ;
pack32 ( msg -> signal , buffer ) ;
int unpack_cancel_tasks_msg ( kill_tasks_msg_t ** msg_ptr , Buf buffer )
msg = xmalloc ( sizeof ( kill_tasks_msg_t ) ) ;
safe_unpack32 ( & msg -> job_id , buffer ) ;
safe_unpack32 ( & msg -> job_step_id , buffer ) ;
safe_unpack32 ( & msg -> signal , buffer ) ;
return SLURM_SUCCESS ;
unpack_error:
xfree (msg);
*msg_ptr = NULL;
return SLURM_ERROR ;
void pack_shutdown_msg ( shutdown_msg_t * msg , Buf buffer )

Moe Jette
committed
{
pack16 ( msg -> core , buffer ) ;

Moe Jette
committed
}
int unpack_shutdown_msg ( shutdown_msg_t ** msg_ptr , Buf buffer )

Moe Jette
committed
{
shutdown_msg_t * msg ;
msg = xmalloc ( sizeof ( shutdown_msg_t ) ) ;
*msg_ptr = msg ;
safe_unpack16 ( & msg -> core , buffer ) ;
return SLURM_SUCCESS ;
unpack_error:
xfree (msg);
*msg_ptr = NULL;
return SLURM_ERROR;

Moe Jette
committed
}
void pack_job_step_id ( job_step_id_t * msg , Buf buffer )
pack_time ( msg -> last_update , buffer ) ;
pack32 ( msg -> job_id , buffer ) ;
pack32 ( msg -> job_step_id , buffer ) ;
int unpack_job_step_id ( job_step_id_t ** msg_ptr , Buf buffer )
{
job_step_id_msg_t * msg ;
msg = xmalloc ( sizeof ( job_step_id_msg_t ) ) ;
*msg_ptr = msg ;
safe_unpack_time ( & msg -> last_update , buffer ) ;
safe_unpack32 ( & msg -> job_id , buffer ) ;
safe_unpack32 ( & msg -> job_step_id , buffer ) ;
return SLURM_SUCCESS ;
unpack_error:
xfree (msg);
*msg_ptr = NULL;
return SLURM_ERROR;
void pack_get_job_step_info ( job_step_info_request_msg_t * msg , Buf buffer )
pack_time ( msg -> last_update , buffer ) ;
pack32 ( msg -> job_id , buffer ) ;
pack32 ( msg -> step_id , buffer ) ;
int unpack_get_job_step_info ( job_step_info_request_msg_t ** msg , Buf buffer )
{
job_step_info_request_msg_t * job_step_info ;
job_step_info = xmalloc ( sizeof ( job_step_info_request_msg_t ) ) ;
*msg = job_step_info;
safe_unpack_time ( & job_step_info -> last_update , buffer ) ;
safe_unpack32 ( & job_step_info -> job_id , buffer ) ;
safe_unpack32 ( & job_step_info -> step_id , buffer ) ;
return SLURM_SUCCESS ;
unpack_error:
xfree (job_step_info);
*msg = NULL;
return SLURM_ERROR;
void pack_slurm_addr_array ( slurm_addr * slurm_address , uint16_t size_val, Buf buffer )
{
int i=0;
uint16_t nl = htons(size_val);
pack16( nl, buffer );
for ( i=0; i < size_val; i++ )
{
slurm_pack_slurm_addr ( slurm_address + i , buffer ) ;
int
unpack_slurm_addr_array ( slurm_addr ** slurm_address , uint16_t * size_val , Buf buffer )
{
int i=0;
uint16_t nl ;
*slurm_address = NULL;
safe_unpack16( & nl , buffer );
*size_val = ntohs ( nl ) ;
*slurm_address = xmalloc( (*size_val) * sizeof( slurm_addr ) );
for ( i=0; i < *size_val; i++ )
{
if (slurm_unpack_slurm_addr_no_alloc ( (*slurm_address) + i , buffer ))
goto unpack_error;
return SLURM_SUCCESS;
unpack_error:
if (*slurm_address)
xfree (*slurm_address);
*slurm_address = NULL;
return SLURM_ERROR;
pack_batch_job_launch ( batch_job_launch_msg_t* msg , Buf buffer )
{
assert ( msg != NULL );
pack32 ( msg -> job_id, buffer ) ;
pack32 ( msg -> user_id, buffer ) ;
packstr ( msg -> nodes, buffer ) ;
packstr ( msg -> script, buffer ) ;
packstr ( msg -> work_dir, buffer ) ;
packstr ( msg -> err, buffer ) ;
packstr ( msg -> in, buffer ) ;
packstr ( msg -> out, buffer ) ;
pack16 ( msg -> argc, buffer ) ;
packstr_array (msg -> argv, msg -> argc, buffer);
pack16 ( msg -> env_size, buffer ) ;
packstr_array (msg -> environment, msg -> env_size, buffer);
unpack_batch_job_launch( batch_job_launch_msg_t** msg , Buf buffer )
{
uint16_t uint16_tmp;
batch_job_launch_msg_t *launch_msg_ptr ;
assert ( msg != NULL );
launch_msg_ptr = xmalloc ( sizeof (batch_job_launch_msg_t) ) ;
*msg = launch_msg_ptr ;
safe_unpack32 ( & launch_msg_ptr -> job_id, buffer ) ;
safe_unpack32 ( & launch_msg_ptr -> user_id, buffer ) ;
safe_unpackstr_xmalloc ( & launch_msg_ptr -> nodes, & uint16_tmp , buffer ) ;
safe_unpackstr_xmalloc ( & launch_msg_ptr -> script, & uint16_tmp , buffer ) ;
safe_unpackstr_xmalloc ( & launch_msg_ptr -> work_dir, & uint16_tmp , buffer ) ;
safe_unpackstr_xmalloc ( & launch_msg_ptr -> err, & uint16_tmp , buffer ) ;
safe_unpackstr_xmalloc ( & launch_msg_ptr -> in, & uint16_tmp , buffer ) ;
safe_unpackstr_xmalloc ( & launch_msg_ptr -> out, & uint16_tmp , buffer ) ;
safe_unpack16 ( & launch_msg_ptr -> argc, buffer ) ;
safe_unpackstr_array (& launch_msg_ptr -> argv, &launch_msg_ptr -> argc, buffer);
safe_unpack16 ( & launch_msg_ptr -> env_size, buffer ) ;
safe_unpackstr_array (& launch_msg_ptr -> environment, &launch_msg_ptr -> env_size, buffer);
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
return SLURM_SUCCESS;
unpack_error:
if (launch_msg_ptr -> nodes)
xfree (launch_msg_ptr -> nodes);
if (launch_msg_ptr -> script)
xfree (launch_msg_ptr -> script);
if (launch_msg_ptr -> work_dir)
xfree (launch_msg_ptr -> work_dir);
if (launch_msg_ptr -> err)
xfree (launch_msg_ptr -> err);
if (launch_msg_ptr -> in)
xfree (launch_msg_ptr -> in);
if (launch_msg_ptr -> out)
xfree (launch_msg_ptr -> out);
if (launch_msg_ptr -> argv)
xfree (launch_msg_ptr -> argv);
if (launch_msg_ptr -> environment)
xfree (launch_msg_ptr -> environment);
xfree (launch_msg_ptr);
*msg = NULL;
return SLURM_ERROR;
void pack_ ( * msg , Buf buffer )
assert ( msg != NULL );
pack16 ( msg -> , buffer ) ;
pack32 ( msg -> , buffer ) ;
packstr ( msg -> , buffer ) ;
int unpack_ ( ** msg_ptr , Buf buffer )
uint16_t uint16_tmp;
assert ( msg_ptr != NULL );
msg = xmalloc ( sizeof ( ) ) ;
*msg_ptr = msg;
safe_unpack16 ( & msg -> , buffer ) ;
safe_unpack32 ( & msg -> , buffer ) ;
safe_unpackstr_xmalloc ( & msg -> x, & uint16_tmp , buffer ) ;
return SLURM_SUCCESS;
unpack_error:
if (msg -> x)
xfree (msg -> x);
xfree (msg);
*msg_ptr = NULL;
return SLURM_ERROR;