1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2010      Cisco Systems, Inc. All rights reserved.
4  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
5  *                         reserved.
6  *
7  * $COPYRIGHT$
8  *
9  * Additional copyrights may follow
10  *
11  * $HEADER$
12  */
13 
14 #include "orte_config.h"
15 #include "opal/util/output.h"
16 
17 #include "orte/mca/errmgr/errmgr.h"
18 #include "orte/mca/errmgr/base/base.h"
19 #include "errmgr_default_orted.h"
20 
21 /*
22  * Public string for version number
23  */
24 const char *orte_errmgr_default_orted_component_version_string =
25     "ORTE ERRMGR default_orted MCA component version " ORTE_VERSION;
26 
27 /*
28  * Local functionality
29  */
30 static int errmgr_default_orted_register(void);
31 static int errmgr_default_orted_open(void);
32 static int errmgr_default_orted_close(void);
33 static int errmgr_default_orted_component_query(mca_base_module_t **module, int *priority);
34 
35 /*
36  * Instantiate the public struct with all of our public information
37  * and pointer to our public functions in it
38  */
39 orte_errmgr_base_component_t mca_errmgr_default_orted_component =
40 {
41     /* Handle the general mca_component_t struct containing
42      *  meta information about the component itdefault_orted
43      */
44     .base_version = {
45         ORTE_ERRMGR_BASE_VERSION_3_0_0,
46         /* Component name and version */
47         .mca_component_name = "default_orted",
48         MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION,
49                               ORTE_RELEASE_VERSION),
50 
51         /* Component open and close functions */
52         .mca_open_component = errmgr_default_orted_open,
53         .mca_close_component = errmgr_default_orted_close,
54         .mca_query_component = errmgr_default_orted_component_query,
55         .mca_register_component_params = errmgr_default_orted_register,
56     },
57     .base_data = {
58         /* The component is checkpoint ready */
59         MCA_BASE_METADATA_PARAM_CHECKPOINT
60     },
61 };
62 
63 static int my_priority;
64 
errmgr_default_orted_register(void)65 static int errmgr_default_orted_register(void)
66 {
67     mca_base_component_t *c = &mca_errmgr_default_orted_component.base_version;
68 
69     my_priority = 1000;
70     (void) mca_base_component_var_register(c, "priority",
71                                            "Priority of the default_orted errmgr component",
72                                            MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
73                                            OPAL_INFO_LVL_9,
74                                            MCA_BASE_VAR_SCOPE_READONLY, &my_priority);
75 
76     return ORTE_SUCCESS;
77 }
78 
errmgr_default_orted_open(void)79 static int errmgr_default_orted_open(void)
80 {
81     return ORTE_SUCCESS;
82 }
83 
errmgr_default_orted_close(void)84 static int errmgr_default_orted_close(void)
85 {
86     return ORTE_SUCCESS;
87 }
88 
errmgr_default_orted_component_query(mca_base_module_t ** module,int * priority)89 static int errmgr_default_orted_component_query(mca_base_module_t **module, int *priority)
90 {
91     if (ORTE_PROC_IS_DAEMON) {
92         /* we are the default component for daemons */
93         *priority = my_priority;
94         *module = (mca_base_module_t *)&orte_errmgr_default_orted_module;
95         return ORTE_SUCCESS;
96     }
97 
98     *priority = -1;
99     *module = NULL;
100     return ORTE_ERROR;
101 }
102 
103