1
1

Convert "opal_show_help" to be a global variable pointer.

It is statically initialized to the real back-end OPAL show_help
function.  During orte_show_help_init(), the variable is re-assigned
with the value of the back-end ORTE show_help function (the one that
does error message aggregation).  

Therefore, anything that calls opal_show_help() after a certain point
in orte_init() will have their show_help messages be aggregated.
w00t!  Even code down in OPAL -- that has no knowledge of ORTE -- will
have their messages aggregated.  '''Double w00t!'''

During orte_show_help_finalize(), we restore the original pointer
value so that it something calls opal_show_help() after
orte_finalize(), it'll still work properly (but it won't be
aggregated).  

This commit was SVN r24185.
Этот коммит содержится в:
Jeff Squyres 2010-12-16 23:00:25 +00:00
родитель 80c1e9acac
Коммит a525e70f46
3 изменённых файлов: 32 добавлений и 11 удалений

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

@ -42,6 +42,18 @@ static const char *dash_line = "------------------------------------------------
static int output_stream = -1;
static char **search_dirs = NULL;
/*
* Local functions
*/
static int opal_show_vhelp_internal(const char *filename, const char *topic,
bool want_error_header, va_list arglist);
static int opal_show_help_internal(const char *filename, const char *topic,
bool want_error_header, ...);
opal_show_help_fn_t opal_show_help = opal_show_help_internal;
opal_show_vhelp_fn_t opal_show_vhelp = opal_show_vhelp_internal;
int opal_show_help_init(void)
{
opal_output_stream_t lds;
@ -311,8 +323,8 @@ char *opal_show_help_string(const char *filename, const char *topic,
return output;
}
int opal_show_vhelp(const char *filename, const char *topic,
bool want_error_header, va_list arglist)
static int opal_show_vhelp_internal(const char *filename, const char *topic,
bool want_error_header, va_list arglist)
{
char *output;
@ -329,8 +341,8 @@ int opal_show_vhelp(const char *filename, const char *topic,
return (NULL == output) ? OPAL_ERROR : OPAL_SUCCESS;
}
int opal_show_help(const char *filename, const char *topic,
bool want_error_header, ...)
static int opal_show_help_internal(const char *filename, const char *topic,
bool want_error_header, ...)
{
va_list arglist;
int rc;

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

@ -128,15 +128,17 @@ OPAL_DECLSPEC int opal_show_help_finalize(void);
* based on the topic, and displays it. If want_error_header is
* true, a header and footer of asterisks are also displayed.
*/
OPAL_DECLSPEC int opal_show_help(const char *filename, const char *topic,
bool want_error_header, ...);
typedef int (*opal_show_help_fn_t)(const char *filename, const char *topic,
bool want_error_header, ...);
OPAL_DECLSPEC extern opal_show_help_fn_t opal_show_help;
/**
* This function does the same thing as opal_show_help(), but accepts
* a va_list form of varargs.
*/
OPAL_DECLSPEC int opal_show_vhelp(const char *filename, const char *topic,
bool want_error_header, va_list ap);
typedef int (*opal_show_vhelp_fn_t)(const char *filename, const char *topic,
bool want_error_header, va_list ap);
OPAL_DECLSPEC extern opal_show_vhelp_fn_t opal_show_vhelp;
/**
* This function does the same thing as opal_show_help(), but returns

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

@ -130,6 +130,8 @@ static bool show_help_timer_set = false;
static opal_event_t show_help_timer_event;
static bool ready;
static opal_show_help_fn_t save_help = NULL;
static void tuple_list_item_constructor(tuple_list_item_t *obj)
{
obj->tli_filename = NULL;
@ -576,14 +578,17 @@ int orte_show_help_init(void)
{
OPAL_OUTPUT_VERBOSE((5, orte_debug_output, "orte_show_help init"));
/* Show help duplicate detection */
if (ready) {
return ORTE_SUCCESS;
}
ready = true;
/* Show help duplicate detection */
OBJ_CONSTRUCT(&abd_tuples, opal_list_t);
save_help = opal_show_help;
opal_show_help = orte_show_help;
return ORTE_SUCCESS;
}
@ -593,7 +598,10 @@ void orte_show_help_finalize(void)
return;
}
ready = false;
opal_show_help = save_help;
save_help = NULL;
/* Shutdown show_help, showing final messages */
if (ORTE_PROC_IS_HNP) {
show_accumulated_duplicates(0, 0, NULL);
@ -606,7 +614,6 @@ void orte_show_help_finalize(void)
orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_SHOW_HELP);
return;
}
}
int orte_show_help(const char *filename, const char *topic,