This source file includes following definitions.
- libltdl_component_register
- libltdl_component_open
- libltdl_component_close
- libltdl_component_query
1
2
3
4
5
6
7
8
9
10
11
12
13 #include "opal_config.h"
14
15 #include "opal/constants.h"
16 #include "opal/mca/dl/dl.h"
17 #include "opal/mca/base/mca_base_var.h"
18 #include "opal/util/argv.h"
19
20 #include "dl_libltdl.h"
21
22
23
24
25
26 const char *opal_dl_libltdl_component_version_string =
27 "OPAL dl libltdl MCA component version " OPAL_VERSION;
28
29
30
31
32
33 static int libltdl_component_register(void);
34 static int libltdl_component_open(void);
35 static int libltdl_component_close(void);
36 static int libltdl_component_query(mca_base_module_t **module, int *priority);
37
38
39
40
41
42
43 opal_dl_libltdl_component_t mca_dl_libltdl_component = {
44
45
46 .base = {
47
48
49
50 .base_version = {
51 OPAL_DL_BASE_VERSION_1_0_0,
52
53
54 .mca_component_name = "libltdl",
55 MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
56 OPAL_RELEASE_VERSION),
57
58
59 .mca_register_component_params = libltdl_component_register,
60 .mca_open_component = libltdl_component_open,
61 .mca_close_component = libltdl_component_close,
62 .mca_query_component = libltdl_component_query,
63 },
64
65 .base_data = {
66
67 MCA_BASE_METADATA_PARAM_CHECKPOINT
68 },
69
70
71 .priority = 50
72 }
73
74
75 };
76
77
78 static int libltdl_component_register(void)
79 {
80
81
82 bool supported = OPAL_INT_TO_BOOL(OPAL_DL_LIBLTDL_HAVE_LT_DLADVISE);
83 mca_base_component_var_register(&mca_dl_libltdl_component.base.base_version,
84 "have_lt_dladvise",
85 "Whether the version of libltdl that this component is built against supports lt_dladvise functionality or not",
86 MCA_BASE_VAR_TYPE_BOOL,
87 NULL,
88 0,
89 MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
90 OPAL_INFO_LVL_7,
91 MCA_BASE_VAR_SCOPE_CONSTANT,
92 &supported);
93
94 return OPAL_SUCCESS;
95 }
96
97 static int libltdl_component_open(void)
98 {
99 if (lt_dlinit()) {
100 return OPAL_ERROR;
101 }
102
103 #if OPAL_DL_LIBLTDL_HAVE_LT_DLADVISE
104 opal_dl_libltdl_component_t *c = &mca_dl_libltdl_component;
105
106 if (lt_dladvise_init(&c->advise_private_noext)) {
107 return OPAL_ERR_OUT_OF_RESOURCE;
108 }
109
110 if (lt_dladvise_init(&c->advise_private_ext) ||
111 lt_dladvise_ext(&c->advise_private_ext)) {
112 return OPAL_ERR_OUT_OF_RESOURCE;
113 }
114
115 if (lt_dladvise_init(&c->advise_public_noext) ||
116 lt_dladvise_global(&c->advise_public_noext)) {
117 return OPAL_ERR_OUT_OF_RESOURCE;
118 }
119
120 if (lt_dladvise_init(&c->advise_public_ext) ||
121 lt_dladvise_global(&c->advise_public_ext) ||
122 lt_dladvise_ext(&c->advise_public_ext)) {
123 return OPAL_ERR_OUT_OF_RESOURCE;
124 }
125 #endif
126
127 return OPAL_SUCCESS;
128 }
129
130
131 static int libltdl_component_close(void)
132 {
133 #if OPAL_DL_LIBLTDL_HAVE_LT_DLADVISE
134 opal_dl_libltdl_component_t *c = &mca_dl_libltdl_component;
135
136 lt_dladvise_destroy(&c->advise_private_noext);
137 lt_dladvise_destroy(&c->advise_private_ext);
138 lt_dladvise_destroy(&c->advise_public_noext);
139 lt_dladvise_destroy(&c->advise_public_ext);
140 #endif
141
142 lt_dlexit();
143
144 return OPAL_SUCCESS;
145 }
146
147
148 static int libltdl_component_query(mca_base_module_t **module, int *priority)
149 {
150
151
152
153 *priority = mca_dl_libltdl_component.base.priority;
154 *module = &opal_dl_libltdl_module.super;
155
156 return OPAL_SUCCESS;
157 }