/* * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. * Copyright (c) 2004-2005 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ #include "orte_config.h" #include #ifdef HAVE_UNISTD_H #include #endif #include #include "orte/orte_constants.h" #include "opal/util/output.h" #include "opal/util/trace.h" #include "orte/dss/dss.h" #include "orte/mca/rmgr/base/base.h" #include "orte/mca/errmgr/errmgr.h" /* * */ static int orte_rmgr_base_cmd_query(orte_buffer_t* req, orte_buffer_t* rsp) { int32_t rc = orte_rmgr.query(); OPAL_TRACE(4); return orte_dss.pack(rsp, &rc, 1, ORTE_INT32); } static int orte_rmgr_base_cmd_create(orte_buffer_t* req, orte_buffer_t* rsp) { int rc; int32_t ret; orte_app_context_t** context; orte_jobid_t jobid; size_t i, cnt, num_context; OPAL_TRACE(4); cnt = 1; if(ORTE_SUCCESS != (rc = orte_dss.unpack(req, &num_context, &cnt, ORTE_SIZE))) { ORTE_ERROR_LOG(rc); return rc; } if(NULL == (context = malloc(sizeof(orte_app_context_t*)*num_context))) { ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE); return ORTE_ERR_OUT_OF_RESOURCE; } cnt = num_context; if(ORTE_SUCCESS != (rc = orte_dss.unpack(req, context, &cnt, ORTE_APP_CONTEXT))) { ORTE_ERROR_LOG(rc); free(context); return rc; } ret = orte_rmgr.create(context, num_context, &jobid); if(ORTE_SUCCESS != (rc = orte_dss.pack(rsp, &jobid, 1, ORTE_JOBID))) { ORTE_ERROR_LOG(rc); goto cleanup; } if(ORTE_SUCCESS != (rc = orte_dss.pack(rsp, &ret, 1, ORTE_INT32))) { ORTE_ERROR_LOG(rc); goto cleanup; } cleanup: for(i=0; i