From f20bd3205d5e8b339c4cb84356f48407bf59b26a Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 24 Aug 2005 22:20:05 +0000 Subject: [PATCH] Add a utility function that is common to several pls's. This commit was SVN r7019. --- orte/mca/pls/base/base.h | 1 + orte/mca/pls/base/pls_base_proxy.c | 32 +++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/orte/mca/pls/base/base.h b/orte/mca/pls/base/base.h index 138213661f..e027ed3f6a 100644 --- a/orte/mca/pls/base/base.h +++ b/orte/mca/pls/base/base.h @@ -115,6 +115,7 @@ extern "C" { int orte_pls_base_proxy_set_node_name(orte_ras_node_t* node, orte_jobid_t jobid, orte_process_name_t* name); + int orte_pls_base_proxy_mca_argv(int *argc, char ***argv); int orte_pls_base_proxy_terminate_job(orte_jobid_t jobid); int orte_pls_base_proxy_terminate_proc(const orte_process_name_t *proc); diff --git a/orte/mca/pls/base/pls_base_proxy.c b/orte/mca/pls/base/pls_base_proxy.c index 940c536a2d..ac4be3c2cf 100644 --- a/orte/mca/pls/base/pls_base_proxy.c +++ b/orte/mca/pls/base/pls_base_proxy.c @@ -17,6 +17,9 @@ #include "orte_config.h" +#include "opal/util/output.h" +#include "opal/util/argv.h" +#include "opal/mca/base/mca_base_param.h" #include "orte/mca/pls/base/base.h" #include "orte/include/orte_constants.h" #include "orte/mca/ns/ns.h" @@ -26,7 +29,6 @@ #include "orte/mca/errmgr/errmgr.h" #include "orte/mca/ras/base/ras_base_node.h" #include "orte/mca/rmgr/base/base.h" -#include "opal/util/output.h" int @@ -78,6 +80,34 @@ orte_pls_base_proxy_set_node_name(orte_ras_node_t* node, +static int lookup_set(char *a, char *b, char *c, int default_val, + char *token, int *argc, char ***argv) +{ + int id, rc; + + id = mca_base_param_find(a, b, c); + if (id < 0) { + id = mca_base_param_register_int(a, b, c, NULL, default_val); + } + mca_base_param_lookup_int(id, &rc); + if (rc) { + opal_argv_append(argc, argv, token); + } + + return ORTE_SUCCESS; +} + + +int orte_pls_base_proxy_mca_argv(int *argc, char ***argv) +{ + lookup_set("orte", "debug", NULL, 0, "--debug", argc, argv); + lookup_set("orte", "debug", "daemons", 0, "--debug-daemons", argc, argv); + lookup_set("orte", "debug", "daemons_file", 0, "--debug-daemons-file", argc, argv); + + return ORTE_SUCCESS; +} + + /** * Wait for a pending job to complete. */