extern int select_p_select_jobinfo_unpack(select_jobinfo_t **jobinfo_pptr, Buf buffer, uint16_t protocol_version) { int rc = SLURM_ERROR; select_jobinfo_t *jobinfo = xmalloc(sizeof(struct select_jobinfo)); *jobinfo_pptr = jobinfo; jobinfo->magic = JOBINFO_MAGIC; if (protocol_version >= SLURM_MIN_PROTOCOL_VERSION) { safe_unpack8(&jobinfo->confirmed, buffer); safe_unpack32(&jobinfo->reservation_id, buffer); safe_unpack64(&jobinfo->confirm_cookie, buffer); rc = other_select_jobinfo_unpack(&jobinfo->other_jobinfo, buffer, protocol_version); } else { error("select_p_select_jobinfo_unpack: protocol_version " "%hu not supported", protocol_version); } if (rc != SLURM_SUCCESS) goto unpack_error; return SLURM_SUCCESS; unpack_error: select_p_select_jobinfo_free(jobinfo); *jobinfo_pptr = NULL; return SLURM_ERROR; }
extern int acct_gather_energy_unpack(acct_gather_energy_t **energy, Buf buffer, uint16_t protocol_version, bool need_alloc) { uint32_t uint32_tmp; acct_gather_energy_t *energy_ptr; if (need_alloc) { energy_ptr = acct_gather_energy_alloc(1); *energy = energy_ptr; } else { energy_ptr = *energy; } if (protocol_version >= SLURM_15_08_PROTOCOL_VERSION) { safe_unpack64(&energy_ptr->base_consumed_energy, buffer); safe_unpack32(&energy_ptr->base_watts, buffer); safe_unpack64(&energy_ptr->consumed_energy, buffer); safe_unpack32(&energy_ptr->current_watts, buffer); safe_unpack64(&energy_ptr->previous_consumed_energy, buffer); safe_unpack_time(&energy_ptr->poll_time, buffer); } else if (protocol_version >= SLURM_MIN_PROTOCOL_VERSION) { safe_unpack32(&uint32_tmp, buffer); energy_ptr->base_consumed_energy = (uint64_t) uint32_tmp; safe_unpack32(&energy_ptr->base_watts, buffer); safe_unpack32(&uint32_tmp, buffer); energy_ptr->consumed_energy = (uint64_t) uint32_tmp; safe_unpack32(&energy_ptr->current_watts, buffer); safe_unpack32(&uint32_tmp, buffer); energy_ptr->previous_consumed_energy = (uint64_t) uint32_tmp; safe_unpack_time(&energy_ptr->poll_time, buffer); } return SLURM_SUCCESS; unpack_error: if (need_alloc) { acct_gather_energy_destroy(energy_ptr); *energy = NULL; } else memset(energy_ptr, 0, sizeof(acct_gather_energy_t)); return SLURM_ERROR; }
extern int slurmdbd_unpack_id_rc_msg(void **msg, uint16_t rpc_version, Buf buffer) { dbd_id_rc_msg_t *msg_ptr = xmalloc(sizeof(dbd_id_rc_msg_t)); *msg = msg_ptr; if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { safe_unpack32(&msg_ptr->job_id, buffer); safe_unpack64(&msg_ptr->db_index, buffer); safe_unpack32(&msg_ptr->return_code, buffer); } return SLURM_SUCCESS; unpack_error: slurmdbd_free_id_rc_msg(msg_ptr); *msg = NULL; return SLURM_ERROR; }
static int _unpack_job_suspend_msg(dbd_job_suspend_msg_t **msg, uint16_t rpc_version, Buf buffer) { dbd_job_suspend_msg_t *msg_ptr = xmalloc(sizeof(dbd_job_suspend_msg_t)); *msg = msg_ptr; if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { safe_unpack32(&msg_ptr->assoc_id, buffer); safe_unpack64(&msg_ptr->db_index, buffer); safe_unpack32(&msg_ptr->job_id, buffer); safe_unpack32(&msg_ptr->job_state, buffer); safe_unpack_time(&msg_ptr->submit_time, buffer); safe_unpack_time(&msg_ptr->suspend_time, buffer); } return SLURM_SUCCESS; unpack_error: slurmdbd_free_job_suspend_msg(msg_ptr); *msg = NULL; return SLURM_ERROR; }
static int _unpack_step_start_msg(dbd_step_start_msg_t **msg, uint16_t rpc_version, Buf buffer) { uint32_t uint32_tmp = 0; dbd_step_start_msg_t *msg_ptr = xmalloc(sizeof(dbd_step_start_msg_t)); *msg = msg_ptr; if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { safe_unpack32(&msg_ptr->assoc_id, buffer); safe_unpack64(&msg_ptr->db_index, buffer); safe_unpack32(&msg_ptr->job_id, buffer); safe_unpackstr_xmalloc(&msg_ptr->name, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->nodes, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->node_inx, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->node_cnt, buffer); safe_unpack_time(&msg_ptr->start_time, buffer); safe_unpack_time(&msg_ptr->job_submit_time, buffer); safe_unpack32(&msg_ptr->req_cpufreq_min, buffer); safe_unpack32(&msg_ptr->req_cpufreq_max, buffer); safe_unpack32(&msg_ptr->req_cpufreq_gov, buffer); safe_unpack32(&msg_ptr->step_id, buffer); safe_unpack32(&msg_ptr->task_dist, buffer); safe_unpack32(&msg_ptr->total_tasks, buffer); safe_unpackstr_xmalloc(&msg_ptr->tres_alloc_str, &uint32_tmp, buffer); } else goto unpack_error; return SLURM_SUCCESS; unpack_error: debug2("slurmdbd_unpack_step_start_msg:" "unpack_error: size_buf(buffer) %u", size_buf(buffer)); slurmdbd_free_step_start_msg(msg_ptr); *msg = NULL; return SLURM_ERROR; }
static int _unpack_step_complete_msg(dbd_step_comp_msg_t **msg, uint16_t rpc_version, Buf buffer) { uint32_t uint32_tmp; dbd_step_comp_msg_t *msg_ptr = xmalloc(sizeof(dbd_step_comp_msg_t)); *msg = msg_ptr; if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { safe_unpack32(&msg_ptr->assoc_id, buffer); safe_unpack64(&msg_ptr->db_index, buffer); safe_unpack_time(&msg_ptr->end_time, buffer); safe_unpack32(&msg_ptr->exit_code, buffer); jobacctinfo_unpack((struct jobacctinfo **)&msg_ptr->jobacct, rpc_version, PROTOCOL_TYPE_DBD, buffer, 1); safe_unpack32(&msg_ptr->job_id, buffer); safe_unpack_time(&msg_ptr->job_submit_time, buffer); safe_unpackstr_xmalloc(&msg_ptr->job_tres_alloc_str, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->req_uid, buffer); safe_unpack_time(&msg_ptr->start_time, buffer); safe_unpack16(&msg_ptr->state, buffer); safe_unpack32(&msg_ptr->step_id, buffer); safe_unpack32(&msg_ptr->total_tasks, buffer); } else goto unpack_error; return SLURM_SUCCESS; unpack_error: debug2("slurmdbd_unpack_step_complete_msg:" "unpack_error: size_buf(buffer) %u", size_buf(buffer)); slurmdbd_free_step_complete_msg(msg_ptr); *msg = NULL; return SLURM_ERROR; }
static int _unpack_job_complete_msg(dbd_job_comp_msg_t **msg, uint16_t rpc_version, Buf buffer) { uint32_t uint32_tmp; dbd_job_comp_msg_t *msg_ptr = xmalloc(sizeof(dbd_job_comp_msg_t)); *msg = msg_ptr; if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { safe_unpackstr_xmalloc(&msg_ptr->admin_comment, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->assoc_id, buffer); safe_unpackstr_xmalloc(&msg_ptr->comment, &uint32_tmp, buffer); safe_unpack64(&msg_ptr->db_index, buffer); safe_unpack32(&msg_ptr->derived_ec, buffer); safe_unpack_time(&msg_ptr->end_time, buffer); safe_unpack32(&msg_ptr->exit_code, buffer); safe_unpack32(&msg_ptr->job_id, buffer); safe_unpack32(&msg_ptr->job_state, buffer); safe_unpackstr_xmalloc(&msg_ptr->nodes, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->req_uid, buffer); safe_unpack_time(&msg_ptr->start_time, buffer); safe_unpack_time(&msg_ptr->submit_time, buffer); safe_unpackstr_xmalloc(&msg_ptr->system_comment, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->tres_alloc_str, &uint32_tmp, buffer); } else goto unpack_error; return SLURM_SUCCESS; unpack_error: slurmdbd_free_job_complete_msg(msg_ptr); *msg = NULL; return SLURM_ERROR; }
extern int jobacctinfo_unpack(jobacctinfo_t **jobacct, uint16_t rpc_version, uint16_t protocol_type, Buf buffer, bool alloc) { uint32_t uint32_tmp; uint8_t uint8_tmp; if (jobacct_gather_init() < 0) return SLURM_ERROR; if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { safe_unpack8(&uint8_tmp, buffer); if (uint8_tmp == (uint8_t) 0) return SLURM_SUCCESS; if (alloc) *jobacct = xmalloc(sizeof(struct jobacctinfo)); safe_unpack32(&uint32_tmp, buffer); (*jobacct)->user_cpu_sec = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); (*jobacct)->user_cpu_usec = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); (*jobacct)->sys_cpu_sec = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); (*jobacct)->sys_cpu_usec = uint32_tmp; safe_unpack64(&(*jobacct)->max_vsize, buffer); safe_unpack64(&(*jobacct)->tot_vsize, buffer); safe_unpack64(&(*jobacct)->max_rss, buffer); safe_unpack64(&(*jobacct)->tot_rss, buffer); safe_unpack64(&(*jobacct)->max_pages, buffer); safe_unpack64(&(*jobacct)->tot_pages, buffer); safe_unpack32(&(*jobacct)->min_cpu, buffer); safe_unpackdouble(&(*jobacct)->tot_cpu, buffer); safe_unpack32(&(*jobacct)->act_cpufreq, buffer); safe_unpack64(&(*jobacct)->energy.consumed_energy, buffer); safe_unpackdouble(&(*jobacct)->max_disk_read, buffer); safe_unpackdouble(&(*jobacct)->tot_disk_read, buffer); safe_unpackdouble(&(*jobacct)->max_disk_write, buffer); safe_unpackdouble(&(*jobacct)->tot_disk_write, buffer); if (_unpack_jobacct_id(&(*jobacct)->max_vsize_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_rss_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_pages_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->min_cpu_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_disk_read_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_disk_write_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; } else { info("jobacctinfo_unpack version %u not supported", rpc_version); return SLURM_ERROR; } return SLURM_SUCCESS; unpack_error: debug2("jobacctinfo_unpack: unpack_error: size_buf(buffer) %u", size_buf(buffer)); if (alloc) xfree(*jobacct); return SLURM_ERROR; }
extern int unpack_slurmd_conf_lite_no_alloc(slurmd_conf_t *conf, Buf buffer) { uint32_t uint32_tmp; uint16_t protocol_version; char *ver_str = NULL; safe_unpackstr_xmalloc(&ver_str, &uint32_tmp, buffer); safe_unpack16(&protocol_version, buffer); xfree(ver_str); if (protocol_version >= SLURM_MIN_PROTOCOL_VERSION) { safe_unpackstr_xmalloc(&conf->hostname, &uint32_tmp, buffer); safe_unpack16(&conf->cpus, buffer); safe_unpack16(&conf->boards, buffer); safe_unpack16(&conf->sockets, buffer); safe_unpack16(&conf->cores, buffer); safe_unpack16(&conf->threads, buffer); safe_unpack64(&conf->real_memory_size, buffer); safe_unpack16(&conf->block_map_size, buffer); safe_unpack16_array(&conf->block_map, &uint32_tmp, buffer); safe_unpack16_array(&conf->block_map_inv, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->spooldir, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->node_name, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->logfile, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->task_prolog, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->task_epilog, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->job_acct_gather_freq, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->job_acct_gather_type, &uint32_tmp, buffer); safe_unpack16(&conf->propagate_prio, buffer); safe_unpack64(&conf->debug_flags, buffer); safe_unpack32(&uint32_tmp, buffer); conf->debug_level = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); conf->daemonize = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); conf->slurm_user_id = (uid_t)uint32_tmp; safe_unpack16(&conf->use_pam, buffer); safe_unpack32(&conf->task_plugin_param, buffer); safe_unpackstr_xmalloc(&conf->node_topo_addr, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->node_topo_pattern, &uint32_tmp, buffer); safe_unpack32(&uint32_tmp, buffer); conf->port = uint32_tmp; safe_unpack16(&conf->log_fmt, buffer); safe_unpack16(&conf->mem_limit_enforce, buffer); safe_unpack64(&conf->msg_aggr_window_msgs, buffer); safe_unpackstr_xmalloc(&conf->tmpfs, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->x11_params, &uint32_tmp, buffer); } return SLURM_SUCCESS; unpack_error: error("unpack_error in unpack_slurmd_conf_lite_no_alloc: %m"); xfree(conf->job_acct_gather_freq); xfree(conf->job_acct_gather_type); xfree(conf->hostname); xfree(conf->spooldir); xfree(conf->node_name); xfree(conf->logfile); xfree(conf->task_prolog); xfree(conf->task_epilog); xfree(conf->node_topo_addr); xfree(conf->node_topo_pattern); xfree(conf->tmpfs); xfree(conf->x11_params); return SLURM_ERROR; }
extern int unpack_slurmd_conf_lite_no_alloc(slurmd_conf_t *conf, Buf buffer) { uint32_t uint32_tmp; uint16_t protocol_version; char *ver_str = NULL; safe_unpackstr_xmalloc(&ver_str, &uint32_tmp, buffer); if (ver_str && !xstrcmp(ver_str, PROTOCOL_VERSION)) { safe_unpack16(&protocol_version, buffer); xfree(ver_str); } else { /* Kludge to add protocol version in existing data structure: * use "hostname" as a version marker. Eliminate this in * the future. */ conf->hostname = ver_str; protocol_version = SLURM_16_05_PROTOCOL_VERSION; } if (protocol_version >= SLURM_17_02_PROTOCOL_VERSION) { safe_unpackstr_xmalloc(&conf->hostname, &uint32_tmp, buffer); safe_unpack16(&conf->cpus, buffer); safe_unpack16(&conf->boards, buffer); safe_unpack16(&conf->sockets, buffer); safe_unpack16(&conf->cores, buffer); safe_unpack16(&conf->threads, buffer); safe_unpack64(&conf->real_memory_size, buffer); safe_unpack16(&conf->block_map_size, buffer); safe_unpack16_array(&conf->block_map, &uint32_tmp, buffer); safe_unpack16_array(&conf->block_map_inv, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->spooldir, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->node_name, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->logfile, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->task_prolog, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->task_epilog, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->job_acct_gather_freq, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->job_acct_gather_type, &uint32_tmp, buffer); safe_unpack16(&conf->propagate_prio, buffer); safe_unpack64(&conf->debug_flags, buffer); safe_unpack32(&uint32_tmp, buffer); conf->debug_level = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); conf->daemonize = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); conf->slurm_user_id = (uid_t)uint32_tmp; safe_unpack16(&conf->use_pam, buffer); safe_unpack32(&conf->task_plugin_param, buffer); safe_unpackstr_xmalloc(&conf->node_topo_addr, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->node_topo_pattern, &uint32_tmp, buffer); safe_unpack32(&uint32_tmp, buffer); conf->port = uint32_tmp; safe_unpack16(&conf->log_fmt, buffer); safe_unpack16(&conf->mem_limit_enforce, buffer); safe_unpack64(&conf->msg_aggr_window_msgs, buffer); } else { uint32_t real_memory_size = 0; // safe_unpackstr_xmalloc(&conf->hostname, &uint32_tmp, buffer); safe_unpack16(&conf->cpus, buffer); safe_unpack16(&conf->boards, buffer); safe_unpack16(&conf->sockets, buffer); safe_unpack16(&conf->cores, buffer); safe_unpack16(&conf->threads, buffer); safe_unpack32(&real_memory_size, buffer); conf->real_memory_size = real_memory_size; safe_unpack16(&conf->block_map_size, buffer); safe_unpack16_array(&conf->block_map, &uint32_tmp, buffer); safe_unpack16_array(&conf->block_map_inv, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->spooldir, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->node_name, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->logfile, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->task_prolog, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->task_epilog, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->job_acct_gather_freq, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->job_acct_gather_type, &uint32_tmp, buffer); safe_unpack16(&conf->propagate_prio, buffer); safe_unpack64(&conf->debug_flags, buffer); safe_unpack32(&uint32_tmp, buffer); conf->debug_level = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); conf->daemonize = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); conf->slurm_user_id = (uid_t)uint32_tmp; safe_unpack16(&conf->use_pam, buffer); safe_unpack32(&conf->task_plugin_param, buffer); safe_unpackstr_xmalloc(&conf->node_topo_addr, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&conf->node_topo_pattern, &uint32_tmp, buffer); safe_unpack32(&uint32_tmp, buffer); conf->port = uint32_tmp; safe_unpack16(&conf->log_fmt, buffer); safe_unpack16(&conf->mem_limit_enforce, buffer); safe_unpack64(&conf->msg_aggr_window_msgs, buffer); } return SLURM_SUCCESS; unpack_error: error("unpack_error in unpack_slurmd_conf_lite_no_alloc: %m"); xfree(conf->job_acct_gather_freq); xfree(conf->job_acct_gather_type); xfree(conf->hostname); xfree(conf->spooldir); xfree(conf->node_name); xfree(conf->logfile); xfree(conf->task_prolog); xfree(conf->task_epilog); xfree(conf->node_topo_addr); xfree(conf->node_topo_pattern); return SLURM_ERROR; }
extern int jobacctinfo_unpack(jobacctinfo_t **jobacct, uint16_t rpc_version, uint16_t protocol_type, Buf buffer, bool alloc) { uint32_t uint32_tmp; uint8_t uint8_tmp; bool no_pack; jobacct_gather_init(); no_pack = (!plugin_polling && (protocol_type != PROTOCOL_TYPE_DBD)); /* The function can take calls from both DBD and from regular * SLURM functions. We choose to standardize on using the * SLURM_PROTOCOL_VERSION here so if PROTOCOL_TYPE_DBD comes * in we need to translate the DBD rpc_version to use the * SLURM protocol_version. * * If this function ever changes make sure the * slurmdbd_translate_rpc function has been updated with the * new protocol version. */ if (protocol_type == PROTOCOL_TYPE_DBD) rpc_version = slurmdbd_translate_rpc(rpc_version); if (rpc_version >= SLURM_14_03_PROTOCOL_VERSION) { safe_unpack8(&uint8_tmp, buffer); if (uint8_tmp == (uint8_t) 0) return SLURM_SUCCESS; if (alloc) *jobacct = xmalloc(sizeof(struct jobacctinfo)); safe_unpack32(&uint32_tmp, buffer); (*jobacct)->user_cpu_sec = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); (*jobacct)->user_cpu_usec = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); (*jobacct)->sys_cpu_sec = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); (*jobacct)->sys_cpu_usec = uint32_tmp; safe_unpack64(&(*jobacct)->max_vsize, buffer); safe_unpack64(&(*jobacct)->tot_vsize, buffer); safe_unpack64(&(*jobacct)->max_rss, buffer); safe_unpack64(&(*jobacct)->tot_rss, buffer); safe_unpack64(&(*jobacct)->max_pages, buffer); safe_unpack64(&(*jobacct)->tot_pages, buffer); safe_unpack32(&(*jobacct)->min_cpu, buffer); safe_unpack32(&(*jobacct)->tot_cpu, buffer); safe_unpack32(&(*jobacct)->act_cpufreq, buffer); safe_unpack32(&(*jobacct)->energy.consumed_energy, buffer); safe_unpackdouble(&(*jobacct)->max_disk_read, buffer); safe_unpackdouble(&(*jobacct)->tot_disk_read, buffer); safe_unpackdouble(&(*jobacct)->max_disk_write, buffer); safe_unpackdouble(&(*jobacct)->tot_disk_write, buffer); if (_unpack_jobacct_id(&(*jobacct)->max_vsize_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_rss_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_pages_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->min_cpu_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_disk_read_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_disk_write_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; } else if (rpc_version >= SLURM_2_6_PROTOCOL_VERSION) { if (no_pack) return SLURM_SUCCESS; if (alloc) *jobacct = xmalloc(sizeof(struct jobacctinfo)); safe_unpack32(&uint32_tmp, buffer); (*jobacct)->user_cpu_sec = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); (*jobacct)->user_cpu_usec = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); (*jobacct)->sys_cpu_sec = uint32_tmp; safe_unpack32(&uint32_tmp, buffer); (*jobacct)->sys_cpu_usec = uint32_tmp; safe_unpack32((uint32_t *)&(*jobacct)->max_vsize, buffer); safe_unpack32((uint32_t *)&(*jobacct)->tot_vsize, buffer); safe_unpack32((uint32_t *)&(*jobacct)->max_rss, buffer); safe_unpack32((uint32_t *)&(*jobacct)->tot_rss, buffer); safe_unpack32((uint32_t *)&(*jobacct)->max_pages, buffer); safe_unpack32((uint32_t *)&(*jobacct)->tot_pages, buffer); safe_unpack32(&(*jobacct)->min_cpu, buffer); safe_unpack32(&(*jobacct)->tot_cpu, buffer); safe_unpack32(&(*jobacct)->act_cpufreq, buffer); safe_unpack32(&(*jobacct)->energy.consumed_energy, buffer); safe_unpackdouble(&(*jobacct)->max_disk_read, buffer); safe_unpackdouble(&(*jobacct)->tot_disk_read, buffer); safe_unpackdouble(&(*jobacct)->max_disk_write, buffer); safe_unpackdouble(&(*jobacct)->tot_disk_write, buffer); if (_unpack_jobacct_id(&(*jobacct)->max_vsize_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_rss_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_pages_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->min_cpu_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_disk_read_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; if (_unpack_jobacct_id(&(*jobacct)->max_disk_write_id, rpc_version, buffer) != SLURM_SUCCESS) goto unpack_error; } else { info("jobacctinfo_unpack version %u not supported", rpc_version); return SLURM_ERROR; } return SLURM_SUCCESS; unpack_error: debug2("jobacctinfo_unpack: unpack_error: size_buf(buffer) %u", size_buf(buffer)); if (alloc) xfree(*jobacct); return SLURM_ERROR; }
static int _unpack_job_start_msg(void **msg, uint16_t rpc_version, Buf buffer) { uint32_t uint32_tmp; dbd_job_start_msg_t *msg_ptr = xmalloc(sizeof(dbd_job_start_msg_t)); *msg = msg_ptr; msg_ptr->array_job_id = 0; msg_ptr->array_task_id = NO_VAL; if (rpc_version >= SLURM_19_05_PROTOCOL_VERSION) { safe_unpackstr_xmalloc(&msg_ptr->account, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->alloc_nodes, buffer); safe_unpack32(&msg_ptr->array_job_id, buffer); safe_unpack32(&msg_ptr->array_max_tasks, buffer); safe_unpack32(&msg_ptr->array_task_id, buffer); safe_unpackstr_xmalloc(&msg_ptr->array_task_str, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->array_task_pending, buffer); safe_unpack32(&msg_ptr->assoc_id, buffer); safe_unpackstr_xmalloc(&msg_ptr->constraints, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->db_flags, buffer); safe_unpack64(&msg_ptr->db_index, buffer); safe_unpack_time(&msg_ptr->eligible_time, buffer); safe_unpack32(&msg_ptr->gid, buffer); safe_unpackstr_xmalloc(&msg_ptr->gres_alloc, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->gres_req, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->gres_used, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->job_id, buffer); safe_unpack32(&msg_ptr->job_state, buffer); safe_unpack32(&msg_ptr->state_reason_prev, buffer); safe_unpackstr_xmalloc(&msg_ptr->mcs_label, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->name, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->nodes, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->node_inx, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->pack_job_id, buffer); safe_unpack32(&msg_ptr->pack_job_offset, buffer); safe_unpackstr_xmalloc(&msg_ptr->partition, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->priority, buffer); safe_unpack32(&msg_ptr->qos_id, buffer); safe_unpack32(&msg_ptr->req_cpus, buffer); safe_unpack64(&msg_ptr->req_mem, buffer); safe_unpack32(&msg_ptr->resv_id, buffer); safe_unpack_time(&msg_ptr->start_time, buffer); safe_unpack_time(&msg_ptr->submit_time, buffer); safe_unpack32(&msg_ptr->timelimit, buffer); safe_unpackstr_xmalloc(&msg_ptr->tres_alloc_str, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->tres_req_str, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->uid, buffer); safe_unpackstr_xmalloc(&msg_ptr->wckey, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->work_dir, &uint32_tmp, buffer); } else if (rpc_version >= SLURM_MIN_PROTOCOL_VERSION) { char *tmp_char = NULL; safe_unpackstr_xmalloc(&msg_ptr->account, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->alloc_nodes, buffer); safe_unpack32(&msg_ptr->array_job_id, buffer); safe_unpack32(&msg_ptr->array_max_tasks, buffer); safe_unpack32(&msg_ptr->array_task_id, buffer); safe_unpackstr_xmalloc(&msg_ptr->array_task_str, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->array_task_pending, buffer); safe_unpack32(&msg_ptr->assoc_id, buffer); safe_unpackstr_xmalloc(&tmp_char, &uint32_tmp, buffer); xfree(tmp_char); /* block_id */ safe_unpack64(&msg_ptr->db_index, buffer); safe_unpack_time(&msg_ptr->eligible_time, buffer); safe_unpack32(&msg_ptr->gid, buffer); safe_unpackstr_xmalloc(&msg_ptr->gres_alloc, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->gres_req, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->gres_used, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->job_id, buffer); safe_unpack32(&msg_ptr->job_state, buffer); safe_unpackstr_xmalloc(&msg_ptr->mcs_label, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->name, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->nodes, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->node_inx, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->pack_job_id, buffer); safe_unpack32(&msg_ptr->pack_job_offset, buffer); safe_unpackstr_xmalloc(&msg_ptr->partition, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->priority, buffer); safe_unpack32(&msg_ptr->qos_id, buffer); safe_unpack32(&msg_ptr->req_cpus, buffer); safe_unpack64(&msg_ptr->req_mem, buffer); safe_unpack32(&msg_ptr->resv_id, buffer); safe_unpack_time(&msg_ptr->start_time, buffer); safe_unpack_time(&msg_ptr->submit_time, buffer); safe_unpack32(&msg_ptr->timelimit, buffer); safe_unpackstr_xmalloc(&msg_ptr->tres_alloc_str, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->tres_req_str, &uint32_tmp, buffer); safe_unpack32(&msg_ptr->uid, buffer); safe_unpackstr_xmalloc(&msg_ptr->wckey, &uint32_tmp, buffer); safe_unpackstr_xmalloc(&msg_ptr->work_dir, &uint32_tmp, buffer); } else goto unpack_error; return SLURM_SUCCESS; unpack_error: slurmdbd_free_job_start_msg(msg_ptr); *msg = NULL; return SLURM_ERROR; }