1
1

Create a close function for the mpool SM module, in order to allow the cleanup. The

mca_common_sm_mmap file was left over by the SM mpool, and there was nobody able
to unmap and unlink it.

This commit was SVN r10770.
Этот коммит содержится в:
George Bosilca 2006-07-12 22:12:07 +00:00
родитель 62c189ea1c
Коммит d00e6e29e8
2 изменённых файлов: 19 добавлений и 8 удалений

Просмотреть файл

@ -176,7 +176,7 @@ int mca_btl_sm_component_open(void)
int mca_btl_sm_component_close(void)
{
int return_value=OMPI_SUCCESS;
int return_value = OMPI_SUCCESS;
OBJ_DESTRUCT(&mca_btl_sm_component.sm_lock);
OBJ_DESTRUCT(&mca_btl_sm_component.sm_frags1);
@ -185,7 +185,7 @@ int mca_btl_sm_component_close(void)
/* unmap the shared memory control structure */
if(mca_btl_sm_component.mmap_file != NULL) {
return_value = mca_common_sm_mmap_fini( mca_btl_sm_component.mmap_file );
if(-1 == return_value) {
if( OMPI_SUCCESS != return_value ) {
return_value=OMPI_ERROR;
opal_output(0," munmap failed :: file - %s :: errno - %d \n",
mca_btl_sm_component.mmap_file->map_addr,

Просмотреть файл

@ -17,6 +17,9 @@
*/
#include "ompi_config.h"
#if HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H*/
#include "opal/util/output.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h"
@ -30,6 +33,7 @@
* Local functions
*/
static int mca_mpool_sm_open(void);
static int mca_mpool_sm_close( void );
static mca_mpool_base_module_t* mca_mpool_sm_init(
struct mca_mpool_base_resources_t* resources);
@ -49,7 +53,7 @@ mca_mpool_sm_component_t mca_mpool_sm_component = {
OMPI_MINOR_VERSION, /* MCA component minor version */
OMPI_RELEASE_VERSION, /* MCA component release version */
mca_mpool_sm_open, /* component open */
NULL
mca_mpool_sm_close
},
/* Next the MCA v1.0.0 component meta data */
@ -97,6 +101,16 @@ static int mca_mpool_sm_open(void)
return OMPI_SUCCESS;
}
static int mca_mpool_sm_close( void )
{
if( NULL != mca_common_sm_mmap ) {
if( OMPI_SUCCESS == mca_common_sm_mmap_fini( mca_common_sm_mmap ) ) {
unlink( mca_common_sm_mmap->map_path );
}
OBJ_DESTRUCT( mca_common_sm_mmap );
}
return OMPI_SUCCESS;
}
static mca_mpool_base_module_t* mca_mpool_sm_init(
struct mca_mpool_base_resources_t* resources)
@ -126,7 +140,7 @@ static mca_mpool_base_module_t* mca_mpool_sm_init(
mpool_module = (mca_mpool_sm_module_t*)malloc(sizeof(mca_mpool_sm_module_t));
mca_mpool_sm_module_init(mpool_module);
/* create initial shared memory mapping */
len = asprintf( &file_name, "%sshared_mem_pool.%s",
orte_process_info.job_session_dir,
@ -147,10 +161,7 @@ static mca_mpool_base_module_t* mca_mpool_sm_init(
}
free(file_name);
/* setup function pointers */
/* setup allocator TODO fix up */
/* setup allocator */
mpool_module->sm_allocator =
allocator_component->allocator_init(true,
mca_common_sm_mmap_seg_alloc, NULL, NULL);