diff options
Diffstat (limited to 'indra/media_plugins/base')
| -rw-r--r-- | indra/media_plugins/base/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | indra/media_plugins/base/media_plugin_base.cpp | 33 | ||||
| -rw-r--r--[-rwxr-xr-x] | indra/media_plugins/base/media_plugin_base.exp | 0 | ||||
| -rw-r--r-- | indra/media_plugins/base/media_plugin_base.h | 8 |
4 files changed, 20 insertions, 23 deletions
diff --git a/indra/media_plugins/base/CMakeLists.txt b/indra/media_plugins/base/CMakeLists.txt index 57e3782ada..b98617cc4f 100644 --- a/indra/media_plugins/base/CMakeLists.txt +++ b/indra/media_plugins/base/CMakeLists.txt @@ -28,5 +28,5 @@ add_library(media_plugin_base ${media_plugin_base_SOURCE_FILES} ) -target_link_libraries( media_plugin_base llplugin ) +target_link_libraries( media_plugin_base llplugin ll::pluginlibraries) target_include_directories( media_plugin_base INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/indra/media_plugins/base/media_plugin_base.cpp b/indra/media_plugins/base/media_plugin_base.cpp index d54e67c532..692c2f6c1c 100644 --- a/indra/media_plugins/base/media_plugin_base.cpp +++ b/indra/media_plugins/base/media_plugin_base.cpp @@ -169,6 +169,8 @@ void MediaPluginBase::sendStatus() #if LL_LINUX || __FreeBSD__ +#include <dlfcn.h> + size_t SymbolGrabber::registerSymbol( SymbolToGrab aSymbol ) { gSymbolsToGrab.emplace_back(aSymbol); @@ -177,25 +179,22 @@ size_t SymbolGrabber::registerSymbol( SymbolToGrab aSymbol ) bool SymbolGrabber::grabSymbols(std::vector< std::string > const &aDSONames) { - std::cerr << "SYMBOLS: " << gSymbolsToGrab.size() << std::endl; - if (sSymsGrabbed) return true; - //attempt to load the shared libraries - apr_pool_create(&sSymDSOMemoryPool, nullptr); - for( std::vector< std::string >::const_iterator itr = aDSONames.begin(); itr != aDSONames.end(); ++itr ) { - apr_dso_handle_t *pDSO(NULL); - std::string strDSO{ *itr }; - if( APR_SUCCESS == apr_dso_load( &pDSO, strDSO.c_str(), sSymDSOMemoryPool )) - sLoadedLibraries.push_back( pDSO ); + auto pDSO = dlopen( itr->c_str(), RTLD_NOW ); - for( auto i = 0; i < gSymbolsToGrab.size(); ++i ) + if( pDSO ) { - if( !*gSymbolsToGrab[i].mPPFunc ) - apr_dso_sym( gSymbolsToGrab[i].mPPFunc, pDSO, gSymbolsToGrab[i].mName ); + sLoadedLibraries.push_back(pDSO); + + for (auto i = 0; i < gSymbolsToGrab.size(); ++i) + { + if (!*gSymbolsToGrab[i].mPPFunc) + *gSymbolsToGrab[i].mPPFunc = dlsym(pDSO, gSymbolsToGrab[i].mName); + } } } @@ -220,10 +219,8 @@ void SymbolGrabber::ungrabSymbols() #if LL_WINDOWS # define LLSYMEXPORT __declspec(dllexport) -#elif LL_LINUX || __FreeBSD__ -# define LLSYMEXPORT __attribute__ ((visibility("default"))) #else -# define LLSYMEXPORT /**/ +# define LLSYMEXPORT __attribute__ ((visibility("default"))) #endif extern "C" @@ -270,13 +267,13 @@ pid_t getParentPid( pid_t aPid ) { std::string line; line.resize( 1024, 0 ); - in.getline( &line[0], line.length() ); + in.getline( &line[0], line.length() ); auto i = line.find( "PPid:" ); - + if( i == std::string::npos ) continue; - + char const *pIn = line.c_str() + 5; // Skip over pid; while( *pIn != 0 && isspace( *pIn ) ) ++pIn; diff --git a/indra/media_plugins/base/media_plugin_base.exp b/indra/media_plugins/base/media_plugin_base.exp index d8c7bb712a..d8c7bb712a 100755..100644 --- a/indra/media_plugins/base/media_plugin_base.exp +++ b/indra/media_plugins/base/media_plugin_base.exp diff --git a/indra/media_plugins/base/media_plugin_base.h b/indra/media_plugins/base/media_plugin_base.h index a6f3bc7d71..af431e1dc5 100644 --- a/indra/media_plugins/base/media_plugin_base.h +++ b/indra/media_plugins/base/media_plugin_base.h @@ -38,7 +38,7 @@ struct SymbolToGrab { bool mRequired; char const *mName; - apr_dso_handle_sym_t *mPPFunc; + void **mPPFunc; }; class SymbolGrabber @@ -52,8 +52,7 @@ private: std::vector< SymbolToGrab > gSymbolsToGrab; bool sSymsGrabbed = false; - apr_pool_t *sSymDSOMemoryPool = nullptr; - std::vector<apr_dso_handle_t *> sLoadedLibraries; + std::vector<void *> sLoadedLibraries; }; extern SymbolGrabber gSymbolGrabber; @@ -63,7 +62,7 @@ extern SymbolGrabber gSymbolGrabber; #define LL_GRAB_SYM(SYMBOL_GRABBER, REQUIRED, SYMBOL_NAME, RETURN, ...) \ RETURN (*ll##SYMBOL_NAME)(__VA_ARGS__) = nullptr; \ size_t gRegistered##SYMBOL_NAME = SYMBOL_GRABBER.registerSymbol( \ - { REQUIRED, #SYMBOL_NAME , (apr_dso_handle_sym_t*)&ll##SYMBOL_NAME} \ + { REQUIRED, #SYMBOL_NAME , (void**)&ll##SYMBOL_NAME} \ ); #endif @@ -81,6 +80,7 @@ public: static void staticReceiveMessage(const char *message_string, void **user_data); protected: + /** Plugin status. */ typedef enum { |
