Merge pull request #3017 from rhc54/topic/dlopen
Update to PMIx master to include dlopen fixes and addition of libltdl support
Этот коммит содержится в:
Коммит
591a2d4a88
@ -2,6 +2,7 @@
|
||||
#
|
||||
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
|
||||
#
|
||||
# Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
@ -20,7 +21,7 @@ AC_DEFUN([MCA_opal_dl_libltdl_COMPILE_MODE], [
|
||||
AC_MSG_RESULT([$$4])
|
||||
])
|
||||
|
||||
# MCA_event_external_POST_CONFIG()
|
||||
# MCA_opal_dl_libltdl_POST_CONFIG()
|
||||
# ---------------------------------
|
||||
AC_DEFUN([MCA_opal_dl_libltdl_POST_CONFIG],[
|
||||
# If we won, then do all the rest of the setup
|
||||
|
@ -23,14 +23,14 @@ release=0
|
||||
# The only requirement is that it must be entirely printable ASCII
|
||||
# characters and have no white space.
|
||||
|
||||
greek=a1
|
||||
greek=
|
||||
|
||||
# If repo_rev is empty, then the repository version number will be
|
||||
# obtained during "make dist" via the "git describe --tags --always"
|
||||
# command, or with the date (if "git describe" fails) in the form of
|
||||
# "date<date>".
|
||||
|
||||
repo_rev=gitf57d9b2
|
||||
repo_rev=git129dc44
|
||||
|
||||
# If tarball_version is not empty, it is used as the version string in
|
||||
# the tarball filename, regardless of all other versions listed in
|
||||
@ -44,7 +44,7 @@ tarball_version=
|
||||
|
||||
# The date when this release was created
|
||||
|
||||
date="Feb 20, 2017"
|
||||
date="Feb 22, 2017"
|
||||
|
||||
# The shared library version of each of PMIx's public libraries.
|
||||
# These versions are maintained in accordance with the "Library
|
||||
|
@ -4,6 +4,7 @@
|
||||
# Copyright (c) 2016 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
#
|
||||
# Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
@ -22,6 +23,19 @@ AC_DEFUN([MCA_pmix_pdl_pdlopen_COMPILE_MODE], [
|
||||
AC_MSG_RESULT([$$3])
|
||||
])
|
||||
|
||||
# MCA_pmix_pdl_pdlopen_POST_CONFIG()
|
||||
# ---------------------------------
|
||||
AC_DEFUN([MCA_pmix_pdl_pdlopen_POST_CONFIG],[
|
||||
# If we won, then do all the rest of the setup
|
||||
AS_IF([test "$1" = "1"],
|
||||
[
|
||||
# Add some stuff to CPPFLAGS so that the rest of the source
|
||||
# tree can be built
|
||||
LDFLAGS="$LDFLAGS $pmix_pdl_pdlopen_ADD_LDFLAGS"
|
||||
LIBS="$LIBS $pmix_pdl_pdlopen_ADD_LIBS"
|
||||
])
|
||||
])dnl
|
||||
|
||||
# MCA_pdl_pdlopen_CONFIG([action-if-can-compile],
|
||||
# [action-if-cant-compile])
|
||||
# ------------------------------------------------
|
||||
@ -30,13 +44,13 @@ AC_DEFUN([MCA_pmix_pdl_pdlopen_CONFIG],[
|
||||
|
||||
dnl This is effectively a back-door for PMIX developers to
|
||||
dnl force the use of the libltdl pdl component.
|
||||
AC_ARG_ENABLE([pdl-dlopen],
|
||||
[AS_HELP_STRING([--disable-pdl-dlopen],
|
||||
[Disable the "dlopen" PDL component (and probably force the use of the "libltdl" PDL component). This option should really only be used by PMIX developers. You are probably actually looking for the "--disable-dlopen" option, which disables all dlopen-like functionality from PMIX.])
|
||||
AC_ARG_ENABLE([dlopen],
|
||||
[AS_HELP_STRING([--disable-dlopen],
|
||||
[Disable the "dlopen" PDL component (and probably force the use of the "libltdl" PDL component).])
|
||||
])
|
||||
|
||||
pmix_pdl_pdlopen_happy=no
|
||||
AS_IF([test "$enable_pdl_dlopen" != "no"],
|
||||
AS_IF([test "$enable_dlopen" != "no"],
|
||||
[PMIX_CHECK_PACKAGE([pmix_pdl_pdlopen],
|
||||
[dlfcn.h],
|
||||
[dl],
|
||||
|
27
opal/mca/pmix/pmix2x/pmix/src/mca/pdl/plibltdl/Makefile.am
Обычный файл
27
opal/mca/pmix/pmix2x/pmix/src/mca/pdl/plibltdl/Makefile.am
Обычный файл
@ -0,0 +1,27 @@
|
||||
#
|
||||
# Copyright (c) 2004-2010 The Trustees of Indiana University.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
sources = \
|
||||
pdl_libltdl.h \
|
||||
pdl_libltdl_component.c \
|
||||
pdl_libltdl_module.c
|
||||
|
||||
# This component will only ever be built statically -- never as a DSO.
|
||||
|
||||
noinst_LTLIBRARIES = libmca_pdl_plibltdl.la
|
||||
|
||||
libmca_pdl_plibltdl_la_SOURCES = $(sources)
|
||||
libmca_pdl_plibltdl_la_CPPFLAGS = $(pmix_pdl_plibltdl_CPPFLAGS)
|
||||
libmca_pdl_plibltdl_la_LDFLAGS = \
|
||||
$(pmix_pdl_plibltdl_LDFLAGS) \
|
||||
-module -avoid-version
|
||||
libmca_pdl_plibltdl_la_LIBADD = $(pmix_pdl_plibltdl_LIBS)
|
124
opal/mca/pmix/pmix2x/pmix/src/mca/pdl/plibltdl/configure.m4
Обычный файл
124
opal/mca/pmix/pmix2x/pmix/src/mca/pdl/plibltdl/configure.m4
Обычный файл
@ -0,0 +1,124 @@
|
||||
# -*- shell-script -*-
|
||||
#
|
||||
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
|
||||
#
|
||||
# Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
AC_DEFUN([MCA_pmix_pdl_plibltdl_PRIORITY], [50])
|
||||
|
||||
#
|
||||
# Force this component to compile in static-only mode
|
||||
#
|
||||
AC_DEFUN([MCA_pmix_pdl_plibltdl_COMPILE_MODE], [
|
||||
AC_MSG_CHECKING([for MCA component $1:$2 compile mode])
|
||||
$3="static"
|
||||
AC_MSG_RESULT([$$3])
|
||||
])
|
||||
|
||||
# MCA_pmix_pdl_plibltdl_POST_CONFIG()
|
||||
# ---------------------------------
|
||||
AC_DEFUN([MCA_pmix_pdl_plibltdl_POST_CONFIG],[
|
||||
# If we won, then do all the rest of the setup
|
||||
AS_IF([test "$1" = "1"],
|
||||
[
|
||||
# Add some stuff to CPPFLAGS so that the rest of the source
|
||||
# tree can be built
|
||||
LDFLAGS="$LDFLAGS $pmix_pdl_plibltdl_ADD_LDFLAGS"
|
||||
LIBS="$LIBS $pmix_pdl_plibltdl_ADD_LIBS"
|
||||
])
|
||||
])dnl
|
||||
|
||||
# MCA_dl_plibltdl_CONFIG([action-if-can-compile],
|
||||
# [action-if-cant-compile])
|
||||
# ------------------------------------------------
|
||||
AC_DEFUN([MCA_pmix_pdl_plibltdl_CONFIG],[
|
||||
PMIX_VAR_SCOPE_PUSH([CPPFLAGS_save LDFLAGS_save LIBS_save])
|
||||
AC_CONFIG_FILES([src/mca/pdl/plibltdl/Makefile])
|
||||
|
||||
# Add --with options
|
||||
AC_ARG_WITH([plibltdl],
|
||||
[AC_HELP_STRING([--with-libltdl(=DIR)],
|
||||
[Build libltdl support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])])
|
||||
AC_ARG_WITH([libltdl-libdir],
|
||||
[AC_HELP_STRING([--with-libltdl-libdir=DIR],
|
||||
[Search for libltdl libraries in DIR])])
|
||||
|
||||
# Sanity check the --with values
|
||||
PMIX_CHECK_WITHDIR([plibltdl], [$with_libltdl],
|
||||
[include/ltdl.h])
|
||||
PMIX_CHECK_WITHDIR([plibltdl-libdir], [$with_libltdl_libdir],
|
||||
[libltdl.*])
|
||||
|
||||
# Defaults
|
||||
pmix_check_plibltdl_dir_msg="compiler default"
|
||||
pmix_check_plibltdl_libdir_msg="linker default"
|
||||
|
||||
# Save directory names if supplied
|
||||
AS_IF([test ! -z "$with_libltdl" && test "$with_libltdl" != "yes"],
|
||||
[pmix_check_plibltdl_dir=$with_libltdl
|
||||
pmix_check_plibltdl_dir_msg="$pmix_check_plibltdl_dir (from --with-libltdl)"])
|
||||
AS_IF([test ! -z "$with_libltdl_libdir" && test "$with_libltdl_libdir" != "yes"],
|
||||
[pmix_check_plibltdl_libdir=$with_libltdl_libdir
|
||||
pmix_check_plibltdl_libdir_msg="$pmix_check_plibltdl_libdir (from --with-libltdl-libdir)"])
|
||||
|
||||
pmix_pdl_plibltdl_happy=no
|
||||
AS_IF([test "$with_plibltdl" != "no"],
|
||||
[AC_MSG_CHECKING([for libltdl dir])
|
||||
AC_MSG_RESULT([$pmix_check_plibltdl_dir_msg])
|
||||
AC_MSG_CHECKING([for libltdl library dir])
|
||||
AC_MSG_RESULT([$pmix_check_plibltdl_libdir_msg])
|
||||
|
||||
PMIX_CHECK_PACKAGE([pmix_pdl_plibltdl],
|
||||
[ltdl.h],
|
||||
[ltdl],
|
||||
[lt_dlopen],
|
||||
[],
|
||||
[$pmix_check_plibltdl_dir],
|
||||
[$pmix_check_plibltdl_libdir],
|
||||
[pmix_pdl_plibltdl_happy=yes],
|
||||
[pmix_pdl_plibltdl_happy=no])
|
||||
])
|
||||
|
||||
# If we have plibltdl, do we have lt_dladvise?
|
||||
pmix_pdl_plibltdl_have_lt_dladvise=0
|
||||
AS_IF([test "$pmix_pdl_plibltdl_happy" = "yes"],
|
||||
[CPPFLAGS_save=$CPPFLAGS
|
||||
LDFLAGS_save=$LDFLAGS
|
||||
LIBS_save=$LIBS
|
||||
|
||||
CPPFLAGS="$pmix_pdl_plibltdl_CPPFLAGS $CPPFLAGS"
|
||||
LDFLAGS="$pmix_pdl_plibltdl_LDFLAGS $LDFLAGS"
|
||||
LIBS="$pmix_pdl_plibltdl_LIBS $LIBS"
|
||||
AC_CHECK_FUNC([lt_dladvise_init],
|
||||
[pmix_pdl_plibltdl_have_lt_dladvise=1])
|
||||
CPPFLAGS=$CPPFLAGS_save
|
||||
LDFLAGS=$LDFLAGS_save
|
||||
LIBS=$LIBS_save
|
||||
])
|
||||
AC_DEFINE_UNQUOTED(PMIX_PDL_PLIBLTDL_HAVE_LT_DLADVISE,
|
||||
[$pmix_pdl_plibltdl_have_lt_dladvise],
|
||||
[Whether we have lt_dladvise or not])
|
||||
|
||||
AS_IF([test "$pmix_pdl_plibltdl_happy" = "yes"],
|
||||
[pmix_pdl_plibltdl_ADD_CPPFLAGS=$pmix_pdl_plibltdl_CPPFLAGS
|
||||
pmix_pdl_plibltdl_ADD_LDFLAGS=$pmix_pdl_plibltdl_LDFLAGS
|
||||
pmix_pdl_plibltdl_ADD_LIBS=$pmix_pdl_plibltdl_LIBS
|
||||
$1],
|
||||
[AS_IF([test ! -z "$with_libltdl" && \
|
||||
test "$with_libltdl" != "no"],
|
||||
[AC_MSG_WARN([libltdl support requested (via --with-libltdl) but not found.])
|
||||
AC_MSG_ERROR([Cannot continue.])])
|
||||
$2])
|
||||
|
||||
AC_SUBST(pmix_pdl_plibltdl_CPPFLAGS)
|
||||
AC_SUBST(pmix_pdl_plibltdl_LDFLAGS)
|
||||
AC_SUBST(pmix_pdl_plibltdl_LIBS)
|
||||
|
||||
PMIX_VAR_SCOPE_POP
|
||||
])
|
51
opal/mca/pmix/pmix2x/pmix/src/mca/pdl/plibltdl/pdl_libltdl.h
Обычный файл
51
opal/mca/pmix/pmix2x/pmix/src/mca/pdl/plibltdl/pdl_libltdl.h
Обычный файл
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef PMIX_DL_LIBLTDL
|
||||
#define PMIX_DL_LIBLTDL
|
||||
|
||||
#include "pmix_config.h"
|
||||
|
||||
#include "pmix/mca/dl/dl.h"
|
||||
|
||||
#include <ltdl.h>
|
||||
|
||||
|
||||
PMIX_DECLSPEC extern pmix_pdl_base_module_t pmix_pdl_plibltpdl_module;
|
||||
|
||||
/*
|
||||
* Dynamic library handles generated by this component.
|
||||
*
|
||||
* If we're debugging, keep a copy of the name of the file we've opened.
|
||||
*/
|
||||
struct pmix_pdl_handle_t {
|
||||
lt_dlhandle ltpdl_handle;
|
||||
#if PMIX_ENABLE_DEBUG
|
||||
char *filename;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
pmix_pdl_base_component_t base;
|
||||
|
||||
#if PMIX_DL_LIBLTDL_HAVE_LT_DLADVISE
|
||||
/* If the version of plibltdl that we are compiling against has
|
||||
lt_dladvise, use it to support opening DSOs in a variety of
|
||||
modes. */
|
||||
lt_dladvise advise_private_noext;
|
||||
lt_dladvise advise_private_ext;
|
||||
lt_dladvise advise_public_noext;
|
||||
lt_dladvise advise_public_ext;
|
||||
#endif
|
||||
} pmix_pdl_plibltpdl_component_t;
|
||||
|
||||
PMIX_DECLSPEC extern pmix_pdl_plibltpdl_component_t mca_pdl_plibltpdl_component;
|
||||
|
||||
#endif /* PMIX_DL_LIBLTDL */
|
@ -0,0 +1,158 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, Inc. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "pmix_config.h"
|
||||
|
||||
#include "pmix_common.h"
|
||||
#include "pmix/mca/pdl/pdl.h"
|
||||
#include "pmix/mca/base/pmix_mca_base_var.h"
|
||||
#include "pmix/util/argv.h"
|
||||
|
||||
#include "pdl_libltdl.h"
|
||||
|
||||
|
||||
/*
|
||||
* Public string showing the sysinfo ompi_linux component version number
|
||||
*/
|
||||
const char *pmix_pdl_plibltpdl_component_version_string =
|
||||
"PMIX pdl plibltdl MCA component version " PMIX_VERSION;
|
||||
|
||||
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
static int plibltpdl_component_register(void);
|
||||
static int plibltpdl_component_open(void);
|
||||
static int plibltpdl_component_close(void);
|
||||
static int plibltpdl_component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
/*
|
||||
* Instantiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
|
||||
pmix_pdl_plibltpdl_component_t mca_pdl_plibltpdl_component = {
|
||||
|
||||
/* Fill in the mca_pdl_base_component_t */
|
||||
.base = {
|
||||
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
.base_version = {
|
||||
PMIX_DL_BASE_VERSION_1_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
.mca_component_name = "plibltdl",
|
||||
MCA_BASE_MAKE_VERSION(component, PMIX_MAJOR_VERSION, PMIX_MINOR_VERSION,
|
||||
PMIX_RELEASE_VERSION),
|
||||
|
||||
/* Component functions */
|
||||
.mca_register_component_params = plibltpdl_component_register,
|
||||
.mca_open_component = plibltpdl_component_open,
|
||||
.mca_close_component = plibltpdl_component_close,
|
||||
.mca_query_component = plibltpdl_component_query,
|
||||
},
|
||||
|
||||
.base_data = {
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
},
|
||||
|
||||
/* The dl framework members */
|
||||
.priority = 50
|
||||
}
|
||||
|
||||
/* Now fill in the plibltdl component-specific members */
|
||||
};
|
||||
|
||||
|
||||
static int plibltpdl_component_register(void)
|
||||
{
|
||||
/* Register an info param indicating whether we have lt_dladvise
|
||||
support or not */
|
||||
bool supported = PMIX_INT_TO_BOOL(PMIX_DL_LIBLTDL_HAVE_LT_DLADVISE);
|
||||
mca_base_component_var_register(&mca_pdl_plibltpdl_component.base.base_version,
|
||||
"have_lt_dladvise",
|
||||
"Whether the version of plibltdl that this component is built against supports lt_dladvise functionality or not",
|
||||
MCA_BASE_VAR_TYPE_BOOL,
|
||||
NULL,
|
||||
0,
|
||||
MCA_BASE_VAR_FLAG_DEFAULT_ONLY,
|
||||
PMIX_INFO_LVL_7,
|
||||
MCA_BASE_VAR_SCOPE_CONSTANT,
|
||||
&supported);
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
static int plibltpdl_component_open(void)
|
||||
{
|
||||
if (lt_dlinit()) {
|
||||
return PMIX_ERROR;
|
||||
}
|
||||
|
||||
#if PMIX_DL_LIBLTDL_HAVE_LT_DLADVISE
|
||||
pmix_pdl_plibltpdl_component_t *c = &mca_pdl_plibltpdl_component;
|
||||
|
||||
if (lt_dladvise_init(&c->advise_private_noext)) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
if (lt_dladvise_init(&c->advise_private_ext) ||
|
||||
lt_dladvise_ext(&c->advise_private_ext)) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
if (lt_dladvise_init(&c->advise_public_noext) ||
|
||||
lt_dladvise_global(&c->advise_public_noext)) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
if (lt_dladvise_init(&c->advise_public_ext) ||
|
||||
lt_dladvise_global(&c->advise_public_ext) ||
|
||||
lt_dladvise_ext(&c->advise_public_ext)) {
|
||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int plibltpdl_component_close(void)
|
||||
{
|
||||
#if PMIX_DL_LIBLTDL_HAVE_LT_DLADVISE
|
||||
pmix_pdl_plibltpdl_component_t *c = &mca_pdl_plibltpdl_component;
|
||||
|
||||
lt_dladvise_destroy(&c->advise_private_noext);
|
||||
lt_dladvise_destroy(&c->advise_private_ext);
|
||||
lt_dladvise_destroy(&c->advise_public_noext);
|
||||
lt_dladvise_destroy(&c->advise_public_ext);
|
||||
#endif
|
||||
|
||||
lt_dlexit();
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int plibltpdl_component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
/* The priority value is somewhat meaningless here; by
|
||||
pmix/mca/dl/configure.m4, there's at most one component
|
||||
available. */
|
||||
*priority = mca_pdl_plibltpdl_component.base.priority;
|
||||
*module = &pmix_pdl_plibltpdl_module.super;
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
134
opal/mca/pmix/pmix2x/pmix/src/mca/pdl/plibltdl/pdl_libltdl_module.c
Обычный файл
134
opal/mca/pmix/pmix2x/pmix/src/mca/pdl/plibltdl/pdl_libltdl_module.c
Обычный файл
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||
* Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "pmix_config.h"
|
||||
|
||||
#include "pmix/constants.h"
|
||||
#include "pmix/mca/pdl/pdl.h"
|
||||
|
||||
#include "pdl_libltdl.h"
|
||||
|
||||
|
||||
static int plibltpdl_open(const char *fname, bool use_ext, bool private_namespace,
|
||||
pmix_pdl_handle_t **handle, char **err_msg)
|
||||
{
|
||||
assert(handle);
|
||||
|
||||
*handle = NULL;
|
||||
if (NULL != err_msg) {
|
||||
*err_msg = NULL;
|
||||
}
|
||||
|
||||
lt_dlhandle local_handle;
|
||||
|
||||
#if PMIX_DL_LIBLTDL_HAVE_LT_DLADVISE
|
||||
pmix_pdl_plibltpdl_component_t *c = &mca_pdl_plibltpdl_component;
|
||||
|
||||
if (use_ext && private_namespace) {
|
||||
local_handle = lt_dlopenadvise(fname, c->advise_private_ext);
|
||||
} else if (use_ext && !private_namespace) {
|
||||
local_handle = lt_dlopenadvise(fname, c->advise_public_ext);
|
||||
} else if (!use_ext && private_namespace) {
|
||||
local_handle = lt_dlopenadvise(fname, c->advise_private_noext);
|
||||
} else if (!use_ext && !private_namespace) {
|
||||
local_handle = lt_dlopenadvise(fname, c->advise_public_noext);
|
||||
}
|
||||
#else
|
||||
if (use_ext) {
|
||||
local_handle = lt_dlopenext(fname);
|
||||
} else {
|
||||
local_handle = lt_dlopen(fname);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (NULL != local_handle) {
|
||||
*handle = calloc(1, sizeof(pmix_pdl_handle_t));
|
||||
(*handle)->ltpdl_handle = local_handle;
|
||||
|
||||
#if PMIX_ENABLE_DEBUG
|
||||
if( NULL != fname ) {
|
||||
(*handle)->filename = strdup(fname);
|
||||
}
|
||||
else {
|
||||
(*handle)->filename = strdup("(null)");
|
||||
}
|
||||
#endif
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
if (NULL != err_msg) {
|
||||
*err_msg = (char*) lt_dlerror();
|
||||
}
|
||||
return PMIX_ERROR;
|
||||
}
|
||||
|
||||
|
||||
static int plibltpdl_lookup(pmix_pdl_handle_t *handle, const char *symbol,
|
||||
void **ptr, char **err_msg)
|
||||
{
|
||||
assert(handle);
|
||||
assert(handle->ltpdl_handle);
|
||||
assert(symbol);
|
||||
assert(ptr);
|
||||
|
||||
if (NULL != err_msg) {
|
||||
*err_msg = NULL;
|
||||
}
|
||||
|
||||
*ptr = lt_dlsym(handle->ltpdl_handle, symbol);
|
||||
if (NULL != *ptr) {
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
if (NULL != err_msg) {
|
||||
*err_msg = (char*) lt_dlerror();
|
||||
}
|
||||
return PMIX_ERROR;
|
||||
}
|
||||
|
||||
|
||||
static int plibltpdl_close(pmix_pdl_handle_t *handle)
|
||||
{
|
||||
assert(handle);
|
||||
|
||||
int ret;
|
||||
ret = lt_dlclose(handle->ltpdl_handle);
|
||||
|
||||
#if PMIX_ENABLE_DEBUG
|
||||
free(handle->filename);
|
||||
#endif
|
||||
free(handle);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int plibltpdl_foreachfile(const char *search_path,
|
||||
int (*func)(const char *filename, void *data),
|
||||
void *data)
|
||||
{
|
||||
assert(search_path);
|
||||
assert(func);
|
||||
|
||||
int ret = lt_dlforeachfile(search_path, func, data);
|
||||
return (0 == ret) ? PMIX_SUCCESS : PMIX_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Module definition
|
||||
*/
|
||||
pmix_pdl_base_module_t pmix_pdl_plibltpdl_module = {
|
||||
.open = plibltpdl_open,
|
||||
.lookup = plibltpdl_lookup,
|
||||
.close = plibltpdl_close,
|
||||
.foreachfile = plibltpdl_foreachfile
|
||||
};
|
Загрузка…
x
Ссылка в новой задаче
Block a user