root/opal/mca/pmix/pmix4x/pmix/src/mca/pdl/plibltdl/pdl_libltdl_component.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. plibltpdl_component_register
  2. plibltpdl_component_open
  3. plibltpdl_component_close
  4. plibltpdl_component_query

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2015       Cisco Systems, Inc.  All rights reserved.
   4  * Copyright (c) 2015       Los Alamos National Security, Inc.  All rights
   5  *                          reserved.
   6  * Copyright (c) 2017      Intel, Inc.  All rights reserved.
   7  * $COPYRIGHT$
   8  *
   9  * Additional copyrights may follow
  10  *
  11  * $HEADER$
  12  */
  13 
  14 #include "pmix_config.h"
  15 
  16 #include "pmix_common.h"
  17 #include "pmix/mca/pdl/pdl.h"
  18 #include "pmix/mca/base/pmix_mca_base_var.h"
  19 #include "pmix/util/argv.h"
  20 
  21 #include "pdl_libltdl.h"
  22 
  23 
  24 /*
  25  * Public string showing the sysinfo ompi_linux component version number
  26  */
  27 const char *pmix_pdl_plibltpdl_component_version_string =
  28     "PMIX pdl plibltdl MCA component version " PMIX_VERSION;
  29 
  30 
  31 /*
  32  * Local functions
  33  */
  34 static int plibltpdl_component_register(void);
  35 static int plibltpdl_component_open(void);
  36 static int plibltpdl_component_close(void);
  37 static int plibltpdl_component_query(mca_base_module_t **module, int *priority);
  38 
  39 /*
  40  * Instantiate the public struct with all of our public information
  41  * and pointers to our public functions in it
  42  */
  43 
  44 pmix_pdl_plibltpdl_component_t mca_pdl_plibltpdl_component = {
  45 
  46     /* Fill in the mca_pdl_base_component_t */
  47     .base = {
  48 
  49         /* First, the mca_component_t struct containing meta information
  50            about the component itself */
  51         .base_version = {
  52             PMIX_DL_BASE_VERSION_1_0_0,
  53 
  54             /* Component name and version */
  55             .mca_component_name = "plibltdl",
  56             MCA_BASE_MAKE_VERSION(component, PMIX_MAJOR_VERSION, PMIX_MINOR_VERSION,
  57                                   PMIX_RELEASE_VERSION),
  58 
  59             /* Component functions */
  60             .mca_register_component_params = plibltpdl_component_register,
  61             .mca_open_component = plibltpdl_component_open,
  62             .mca_close_component = plibltpdl_component_close,
  63             .mca_query_component = plibltpdl_component_query,
  64         },
  65 
  66         .base_data = {
  67             /* The component is checkpoint ready */
  68             MCA_BASE_METADATA_PARAM_CHECKPOINT
  69         },
  70 
  71         /* The dl framework members */
  72         .priority = 50
  73     }
  74 
  75     /* Now fill in the plibltdl component-specific members */
  76 };
  77 
  78 
  79 static int plibltpdl_component_register(void)
  80 {
  81     /* Register an info param indicating whether we have lt_dladvise
  82        support or not */
  83     bool supported = PMIX_INT_TO_BOOL(PMIX_DL_LIBLTDL_HAVE_LT_DLADVISE);
  84     mca_base_component_var_register(&mca_pdl_plibltpdl_component.base.base_version,
  85                                     "have_lt_dladvise",
  86                                     "Whether the version of plibltdl that this component is built against supports lt_dladvise functionality or not",
  87                                     MCA_BASE_VAR_TYPE_BOOL,
  88                                     NULL,
  89                                     0,
  90                                     MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
  91                                     PMIX_INFO_LVL_7,
  92                                     MCA_BASE_VAR_SCOPE_CONSTANT,
  93                                     &supported);
  94 
  95     return PMIX_SUCCESS;
  96 }
  97 
  98 static int plibltpdl_component_open(void)
  99 {
 100     if (lt_dlinit()) {
 101         return PMIX_ERROR;
 102     }
 103 
 104 #if PMIX_DL_LIBLTDL_HAVE_LT_DLADVISE
 105     pmix_pdl_plibltpdl_component_t *c = &mca_pdl_plibltpdl_component;
 106 
 107     if (lt_dladvise_init(&c->advise_private_noext)) {
 108         return PMIX_ERR_OUT_OF_RESOURCE;
 109     }
 110 
 111     if (lt_dladvise_init(&c->advise_private_ext) ||
 112         lt_dladvise_ext(&c->advise_private_ext)) {
 113         return PMIX_ERR_OUT_OF_RESOURCE;
 114     }
 115 
 116     if (lt_dladvise_init(&c->advise_public_noext) ||
 117         lt_dladvise_global(&c->advise_public_noext)) {
 118         return PMIX_ERR_OUT_OF_RESOURCE;
 119     }
 120 
 121     if (lt_dladvise_init(&c->advise_public_ext) ||
 122         lt_dladvise_global(&c->advise_public_ext) ||
 123         lt_dladvise_ext(&c->advise_public_ext)) {
 124         return PMIX_ERR_OUT_OF_RESOURCE;
 125     }
 126 #endif
 127 
 128     return PMIX_SUCCESS;
 129 }
 130 
 131 
 132 static int plibltpdl_component_close(void)
 133 {
 134 #if PMIX_DL_LIBLTDL_HAVE_LT_DLADVISE
 135     pmix_pdl_plibltpdl_component_t *c = &mca_pdl_plibltpdl_component;
 136 
 137     lt_dladvise_destroy(&c->advise_private_noext);
 138     lt_dladvise_destroy(&c->advise_private_ext);
 139     lt_dladvise_destroy(&c->advise_public_noext);
 140     lt_dladvise_destroy(&c->advise_public_ext);
 141 #endif
 142 
 143     lt_dlexit();
 144 
 145     return PMIX_SUCCESS;
 146 }
 147 
 148 
 149 static int plibltpdl_component_query(mca_base_module_t **module, int *priority)
 150 {
 151     /* The priority value is somewhat meaningless here; by
 152        pmix/mca/dl/configure.m4, there's at most one component
 153        available. */
 154     *priority = mca_pdl_plibltpdl_component.base.priority;
 155     *module = &pmix_pdl_plibltpdl_module.super;
 156 
 157     return PMIX_SUCCESS;
 158 }

/* [<][>][^][v][top][bottom][index][help] */