int pmixp_stepd_init(const stepd_step_rec_t *job, char ***env) { char *path; int fd, rc; if (SLURM_SUCCESS != (rc = pmixp_info_set(job, env))) { PMIXP_ERROR("pmixp_info_set(job, env) failed"); goto err_info; } /* Create UNIX socket for slurmd communication */ path = pmixp_info_nspace_usock(pmixp_info_namespace()); if (NULL == path) { PMIXP_ERROR("pmixp_info_nspace_usock: out-of-memory"); rc = SLURM_ERROR; goto err_path; } if ((fd = pmixp_usock_create_srv(path)) < 0) { PMIXP_ERROR("pmixp_usock_create_srv"); rc = SLURM_ERROR; goto err_usock; } fd_set_close_on_exec(fd); pmixp_info_srv_usock_set(path, fd); if (!pmixp_info_same_arch()){ _direct_proto.hdr_unpack_cb = _direct_hdr_unpack_portable; _direct_hdr_pack = _direct_hdr_pack_portable; } pmixp_conn_init(_slurm_proto, _direct_proto); if((rc = pmixp_dconn_init(pmixp_info_nodes_uni(), _direct_proto)) ){ PMIXP_ERROR("pmixp_dconn_init() failed"); goto err_dconn; } if ((rc = pmixp_nspaces_init())) { PMIXP_ERROR("pmixp_nspaces_init() failed"); goto err_nspaces; } if (SLURM_SUCCESS != (rc = pmixp_state_init())) { PMIXP_ERROR("pmixp_state_init() failed"); goto err_state; } if (SLURM_SUCCESS != (rc = pmixp_dmdx_init())) { PMIXP_ERROR("pmixp_dmdx_init() failed"); goto err_dmdx; } if (SLURM_SUCCESS != (rc = pmixp_libpmix_init())) { PMIXP_ERROR("pmixp_libpmix_init() failed"); goto err_lib; } if (SLURM_SUCCESS != (rc = pmixp_libpmix_job_set())) { PMIXP_ERROR("pmixp_libpmix_job_set() failed"); goto err_job; } pmixp_server_init_pp(env); pmixp_server_init_cperf(env); xfree(path); _was_initialized = 1; return SLURM_SUCCESS; err_job: pmixp_libpmix_finalize(); err_lib: pmixp_dmdx_finalize(); err_dmdx: pmixp_state_finalize(); err_state: pmixp_nspaces_finalize(); err_nspaces: pmixp_dconn_fini(); err_dconn: pmixp_conn_fini(); close(pmixp_info_srv_usock_fd()); err_usock: xfree(path); err_path: pmixp_info_free(); err_info: return rc; }
int pmixp_stepd_init(const stepd_step_rec_t *job, char ***env) { char *path; int fd, rc; if (SLURM_SUCCESS != (rc = pmixp_info_set(job, env))) { PMIXP_ERROR("pmixp_info_set(job, env) failed"); return rc; } /* Create UNIX socket for slurmd communication */ path = pmixp_info_nspace_usock(pmixp_info_namespace()); if (NULL == path) { PMIXP_ERROR("Out-of-memory"); rc = SLURM_ERROR; goto err_path; } if ((fd = pmixp_usock_create_srv(path)) < 0) { rc = SLURM_ERROR; goto err_usock; } fd_set_close_on_exec(fd); pmixp_info_srv_contacts(path, fd); if (SLURM_SUCCESS != (rc = pmixp_nspaces_init())) { PMIXP_ERROR("pmixp_nspaces_init() failed"); goto err_usock; } if (SLURM_SUCCESS != (rc = pmixp_state_init())) { PMIXP_ERROR("pmixp_state_init() failed"); goto err_state; } if (SLURM_SUCCESS != (rc = pmixp_dmdx_init())) { PMIXP_ERROR("pmixp_dmdx_init() failed"); goto err_dmdx; } if (SLURM_SUCCESS != (rc = pmixp_libpmix_init())) { PMIXP_ERROR("pmixp_libpmix_init() failed"); goto err_lib; } if (SLURM_SUCCESS != (rc = pmixp_libpmix_job_set())) { PMIXP_ERROR("pmixp_libpmix_job_set() failed"); goto err_job; } xfree(path); _was_initialized = 1; return SLURM_SUCCESS; err_job: pmixp_libpmix_finalize(); err_lib: pmixp_dmdx_finalize(); err_dmdx: pmixp_state_finalize(); err_state: pmixp_nspaces_finalize(); err_usock: xfree(path); err_path: pmixp_info_free(); return rc; }