1
1

After talking through the patch with Jeff, we have a couple more fixes to r21766 that should also go over to v1.3 in Ticket #1987.

* Check for {{{dlfcn.h}}} in the self component's configure.m4 (also clean up the .m4 a bit.
 * Adjust the priority of the BLCR component so that the self component has a higher priority (if the application went to the trouble of writing the routines, why not use them.) The 'self' component checks for the appropriate functions during query, so it know if it -can- be used during component selection.
 * Adjust some copyrights that I missed before
 * Fix a warning when casing the result of dlsym() into a function pointer. There is a bit of pointer magic to make this happen (thanks to the following website, and RedHat EL 4 man pages for illustrating it:
  http://www.opengroup.org/onlinepubs/009695399/functions/dlsym.html

Passing to Jeff for a final review of the patch before moving to v1.3.

This commit was SVN r21768.

The following SVN revision numbers were found above:
  r21766 --> open-mpi/ompi@91e52d062b
Этот коммит содержится в:
Josh Hursey 2009-08-05 22:07:37 +00:00
родитель 41f38110ff
Коммит 063f5b2ff6
6 изменённых файлов: 59 добавлений и 47 удалений

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

@ -65,7 +65,7 @@ opal_crs_blcr_component_t mca_crs_blcr_component = {
/* opal_output handler */
-1,
/* Default priority */
50
10
}
};

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2008 The Trustees of Indiana University.
* Copyright (c) 2004-2009 The Trustees of Indiana University.
* All rights reserved.
* $COPYRIGHT$
*

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

@ -1,6 +1,6 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2007 The Trustees of Indiana University.
# Copyright (c) 2004-2009 The Trustees of Indiana University.
# All rights reserved.
# Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
# All rights reserved.
@ -21,10 +21,26 @@ AC_DEFUN([MCA_crs_self_CONFIG],[
# If we don't want FT, don't compile this component
AS_IF([test "$ompi_want_ft" = "1"],
[crs_self_good="yes"],
[$2])
[crs_self_good="no"])
# We need to be able to dlopen the executable for this component to work.
AS_IF([test "$OPAL_ENABLE_DLOPEN_SUPPORT" = "1" -a "$crs_self_good" = "yes"],
# We need the dlfcn.h so we can access dlsym and friends
AS_IF([test "$crs_self_good" = "yes"],
[AC_CHECK_HEADER([dlfcn.h],
[crs_self_good="yes"],
[crs_self_good="no"])],
[crs_self_good="no"])
# If they did not ask for dlopen support,
# they probably do not want this component either
AS_IF([test "$crs_self_good" = "yes"],
[AS_IF([test "$OPAL_ENABLE_DLOPEN_SUPPORT" = "1"],
[crs_self_good="yes"],
[crs_self_good="no"])],
[crs_self_good="no"])
AS_IF([test "$crs_self_good" = "yes"],
[$1],
[$2])
[$2])
])dnl

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2008 The Trustees of Indiana University.
* Copyright (c) 2004-2009 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.

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

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2008 The Trustees of Indiana University.
* Copyright (c) 2004-2009 The Trustees of Indiana University.
* All rights reserved.
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
* All rights reserved.
@ -95,10 +95,13 @@ OBJ_CLASS_INSTANCE(opal_crs_self_snapshot_t,
opal_crs_self_destruct);
typedef void (*opal_crs_self_dlsym_dummy_fn_t)(void);
/************************************
* Locally Global vars & functions :)
************************************/
static void * crs_self_find_function(void * handle, char *prefix, char *suffix);
static int crs_self_find_function(char *prefix, char *suffix,
opal_crs_self_dlsym_dummy_fn_t *fn_ptr);
static int self_update_snapshot_metadata(opal_crs_self_snapshot_t *snapshot);
@ -163,40 +166,25 @@ int opal_crs_self_component_query(mca_base_module_t **module, int *priority)
static int opal_crs_self_extract_callbacks(void)
{
bool callback_matched = true;
void * executable = NULL;
/*
* Open the executable so that we can lookup the necessary symbols
*/
executable = dlopen(NULL, RTLD_LOCAL|RTLD_LAZY);
if ( NULL == executable) {
opal_show_help("help-opal-crs-self.txt", "self:lt_dlopen",
true);
return OPAL_ERROR;
}
opal_crs_self_dlsym_dummy_fn_t loc_fn;
/*
* Find the function names
*/
mca_crs_self_component.ucb_checkpoint_fn = (opal_crs_self_checkpoint_callback_fn_t)
crs_self_find_function(executable,
mca_crs_self_component.prefix,
SUFFIX_CHECKPOINT);
crs_self_find_function(mca_crs_self_component.prefix,
SUFFIX_CHECKPOINT,
&loc_fn);
mca_crs_self_component.ucb_checkpoint_fn = (opal_crs_self_checkpoint_callback_fn_t)loc_fn;
mca_crs_self_component.ucb_continue_fn = (opal_crs_self_continue_callback_fn_t)
crs_self_find_function(executable,
mca_crs_self_component.prefix,
SUFFIX_CONTINUE);
crs_self_find_function(mca_crs_self_component.prefix,
SUFFIX_CONTINUE,
&loc_fn);
mca_crs_self_component.ucb_continue_fn = (opal_crs_self_continue_callback_fn_t)loc_fn;
mca_crs_self_component.ucb_restart_fn = (opal_crs_self_restart_callback_fn_t)
crs_self_find_function(executable,
mca_crs_self_component.prefix,
SUFFIX_RESTART);
/*
* Done with executable, close it
*/
dlclose(executable);
crs_self_find_function(mca_crs_self_component.prefix,
SUFFIX_RESTART,
&loc_fn);
mca_crs_self_component.ucb_restart_fn = (opal_crs_self_restart_callback_fn_t)loc_fn;
/*
* Sanity check
@ -557,19 +545,21 @@ int opal_crs_self_reg_thread(void)
/******************
* Local functions
******************/
static void * crs_self_find_function(void * handle, char *prefix, char *suffix){
static int crs_self_find_function(char *prefix, char *suffix,
opal_crs_self_dlsym_dummy_fn_t *fn_ptr) {
char *func_to_find = NULL;
void * ptr = NULL;
if( NULL == prefix || 0 >= strlen(prefix) ) {
opal_output(mca_crs_self_component.super.output_handle,
"crs:self: crs_self_find_function: Error: prefix is NULL or empty string!");
return NULL;
*fn_ptr = NULL;
return OPAL_ERROR;
}
if( NULL == suffix || 0 >= strlen(suffix) ) {
opal_output(mca_crs_self_component.super.output_handle,
"crs:self: crs_self_find_function: Error: suffix is NULL or empty string!");
return NULL;
*fn_ptr = NULL;
return OPAL_ERROR;
}
opal_output_verbose(10, mca_crs_self_component.super.output_handle,
@ -578,8 +568,13 @@ static void * crs_self_find_function(void * handle, char *prefix, char *suffix){
asprintf(&func_to_find, "%s_%s", prefix, suffix);
ptr = dlsym(handle, func_to_find);
if( NULL == ptr) {
/* The RTLD_DEFAULT is a special handle that searches the default libraries
* including the current application for the indicated symbol. This allows
* us to not have to dlopen/dlclose the executable. A bit of short hand
* really.
*/
*((void**) fn_ptr) = dlsym(RTLD_DEFAULT, func_to_find);
if( NULL == fn_ptr) {
opal_output_verbose(12, mca_crs_self_component.super.output_handle,
"crs:self: crs_self_find_function: WARNING: Function \"%s\" not found",
func_to_find);
@ -590,10 +585,11 @@ static void * crs_self_find_function(void * handle, char *prefix, char *suffix){
func_to_find);
}
if( NULL == func_to_find)
if( NULL == func_to_find) {
free(func_to_find);
}
return ptr;
return OPAL_SUCCESS;
}
/*

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

@ -1,6 +1,6 @@
-*- text -*-
#
# Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
# Copyright (c) 2004-2009 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